@kynikos/react-components
Advanced tools
| "use strict"; | ||
| // This file is part of react-components | ||
| // Copyright (C) 2018-present Dario Giovannetti <dev@dariogiovannetti.net> | ||
| // Licensed under MIT | ||
| // https://github.com/kynikos/lib.js.react-components/blob/master/LICENSE | ||
| var _require = require('react'), | ||
| h = _require.createElement, | ||
| Children = _require.Children; | ||
| module.exports = function GeoMapLink(_ref) { | ||
| var query = _ref.query, | ||
| _ref$lat = _ref.lat, | ||
| lat = _ref$lat === void 0 ? 0 : _ref$lat, | ||
| _ref$lon = _ref.lon, | ||
| lon = _ref$lon === void 0 ? 0 : _ref$lon, | ||
| children = _ref.children; | ||
| var coords = [lat, lon].join(','); | ||
| return h('a', { | ||
| href: window.navigator.platform.match(/iPad|iPhone|iPod/i) == null ? "geo:".concat(coords, "?q=").concat(query || coords) // TODO: The "geo:" URI scheme doesn't work on Safari yet | ||
| // TODO: Apparently putting the coordinates in place of 0,0 doesn't work | ||
| : "maps:0,0?q=".concat(query || coords) | ||
| }, Children.toArray(children)); | ||
| }; |
| // This file is part of react-components | ||
| // Copyright (C) 2018-present Dario Giovannetti <dev@dariogiovannetti.net> | ||
| // Licensed under MIT | ||
| // https://github.com/kynikos/lib.js.react-components/blob/master/LICENSE | ||
| const {createElement: h, Children} = require('react') | ||
| module.exports = function GeoMapLink({ | ||
| query, | ||
| lat = 0, | ||
| lon = 0, | ||
| children, | ||
| }) { | ||
| const coords = [lat, lon].join(',') | ||
| return h('a', { | ||
| href: window.navigator.platform.match(/iPad|iPhone|iPod/ui) == null | ||
| ? `geo:${coords}?q=${query || coords}` | ||
| // TODO: The "geo:" URI scheme doesn't work on Safari yet | ||
| // TODO: Apparently putting the coordinates in place of 0,0 doesn't work | ||
| : `maps:0,0?q=${query || coords}`, | ||
| }, Children.toArray(children)) | ||
| } |
| // This file is part of react-components | ||
| // Copyright (C) 2018-present Dario Giovannetti <dev@dariogiovannetti.net> | ||
| // Licensed under MIT | ||
| // https://github.com/kynikos/lib.js.react-components/blob/master/LICENSE | ||
| const {Component, createElement} = require('react') | ||
| const ReactDOM = require('react-dom') | ||
| const ReactDOMServer = require('react-dom/server') | ||
| module.exports = class Iframe extends Component { | ||
| render() { | ||
| createElement('iframe', { | ||
| // Setting display:none makes it unprintable in Chrome | ||
| style: { | ||
| width: '0', | ||
| height: '0', | ||
| border: 'none', | ||
| margin: '0', | ||
| } | ||
| }) | ||
| } | ||
| componentDidMount() { | ||
| this.componentDidUpdate() | ||
| } | ||
| componentDidUpdate() { | ||
| // TODO: Use the following if browsers stop supporting document.write() | ||
| // The problem is that this won't render any external images | ||
| // embedded with <img> elements | ||
| // iframe = ReactDOM.findDOMNode(this) | ||
| // if iframe | ||
| // iframe.src = URL.createObjectURL(new Blob([ | ||
| // ReactDOMServer.renderToString(@props.html) | ||
| // ], {type: 'text/html'})) | ||
| const iframe = ReactDOM.findDOMNode(this) | ||
| const doc = iframe.contentDocument | ||
| if (doc) { | ||
| doc.open() | ||
| doc.write( | ||
| `<!doctype html>\n${ReactDOMServer.renderToString(this.props.html)}` | ||
| ) | ||
| doc.close() | ||
| } | ||
| } | ||
| print() { | ||
| const iframe = ReactDOM.findDOMNode(this) | ||
| const win = iframe.contentWindow | ||
| if (win) { | ||
| win.print() | ||
| } | ||
| } | ||
| } |
+76
-70
@@ -1,89 +0,95 @@ | ||
| 'use strict'; | ||
| "use strict"; | ||
| var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
| function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
| function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
| function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
| (function () { | ||
| // This file is part of react-components | ||
| // Copyright (C) 2018-present Dario Giovannetti <dev@dariogiovannetti.net> | ||
| // Licensed under MIT | ||
| // https://github.com/kynikos/lib.js.react-components/blob/master/LICENSE | ||
| var Component, ReactDOM, ReactDOMServer, createElement; | ||
| function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
| var _require = require('react'); | ||
| function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
| Component = _require.Component; | ||
| createElement = _require.createElement; | ||
| function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
| function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
| ReactDOM = require('react-dom'); | ||
| function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
| ReactDOMServer = require('react-dom/server'); | ||
| // This file is part of react-components | ||
| // Copyright (C) 2018-present Dario Giovannetti <dev@dariogiovannetti.net> | ||
| // Licensed under MIT | ||
| // https://github.com/kynikos/lib.js.react-components/blob/master/LICENSE | ||
| var _require = require('react'), | ||
| Component = _require.Component, | ||
| createElement = _require.createElement; | ||
| module.exports = function (_Component) { | ||
| _inherits(exports, _Component); | ||
| var ReactDOM = require('react-dom'); | ||
| function exports() { | ||
| _classCallCheck(this, exports); | ||
| var ReactDOMServer = require('react-dom/server'); | ||
| return _possibleConstructorReturn(this, (exports.__proto__ || Object.getPrototypeOf(exports)).apply(this, arguments)); | ||
| module.exports = | ||
| /*#__PURE__*/ | ||
| function (_Component) { | ||
| _inherits(Iframe, _Component); | ||
| function Iframe() { | ||
| _classCallCheck(this, Iframe); | ||
| return _possibleConstructorReturn(this, _getPrototypeOf(Iframe).apply(this, arguments)); | ||
| } | ||
| _createClass(Iframe, [{ | ||
| key: "render", | ||
| value: function render() { | ||
| createElement('iframe', { | ||
| // Setting display:none makes it unprintable in Chrome | ||
| style: { | ||
| width: '0', | ||
| height: '0', | ||
| border: 'none', | ||
| margin: '0' | ||
| } | ||
| }); | ||
| } | ||
| }, { | ||
| key: "componentDidMount", | ||
| value: function componentDidMount() { | ||
| this.componentDidUpdate(); | ||
| } | ||
| }, { | ||
| key: "componentDidUpdate", | ||
| value: function componentDidUpdate() { | ||
| // TODO: Use the following if browsers stop supporting document.write() | ||
| // The problem is that this won't render any external images | ||
| // embedded with <img> elements | ||
| // iframe = ReactDOM.findDOMNode(this) | ||
| // if iframe | ||
| // iframe.src = URL.createObjectURL(new Blob([ | ||
| // ReactDOMServer.renderToString(@props.html) | ||
| // ], {type: 'text/html'})) | ||
| var iframe = ReactDOM.findDOMNode(this); | ||
| var doc = iframe.contentDocument; | ||
| _createClass(exports, [{ | ||
| key: 'render', | ||
| value: function render() { | ||
| return createElement('iframe', { | ||
| // Setting display:none makes it unprintable in Chrome | ||
| style: { | ||
| width: '0', | ||
| height: '0', | ||
| border: 'none', | ||
| margin: '0' | ||
| } | ||
| }); | ||
| if (doc) { | ||
| doc.open(); | ||
| doc.write("<!doctype html>\n".concat(ReactDOMServer.renderToString(this.props.html))); | ||
| doc.close(); | ||
| } | ||
| }, { | ||
| key: 'componentDidMount', | ||
| value: function componentDidMount() { | ||
| return this.componentDidUpdate(); | ||
| } | ||
| }, { | ||
| key: "print", | ||
| value: function print() { | ||
| var iframe = ReactDOM.findDOMNode(this); | ||
| var win = iframe.contentWindow; | ||
| if (win) { | ||
| win.print(); | ||
| } | ||
| }, { | ||
| key: 'componentDidUpdate', | ||
| value: function componentDidUpdate() { | ||
| var doc, iframe; | ||
| // TODO: Use the following if browsers stop supporting document.write() | ||
| // The problem is that this won't render any external images | ||
| // embedded with <img> elements | ||
| // iframe = ReactDOM.findDOMNode(this) | ||
| // if iframe | ||
| // iframe.src = URL.createObjectURL(new Blob([ | ||
| // ReactDOMServer.renderToString(@props.html) | ||
| // ], {type: 'text/html'})) | ||
| iframe = ReactDOM.findDOMNode(this); | ||
| doc = iframe.contentDocument; | ||
| if (doc) { | ||
| doc.open(); | ||
| doc.write("<!doctype html>\n" + ReactDOMServer.renderToString(this.props.html)); | ||
| return doc.close(); | ||
| } | ||
| } | ||
| }, { | ||
| key: 'print', | ||
| value: function print() { | ||
| var iframe, win; | ||
| iframe = ReactDOM.findDOMNode(this); | ||
| win = iframe.contentWindow; | ||
| if (win) { | ||
| return win.print(); | ||
| } | ||
| } | ||
| }]); | ||
| } | ||
| }]); | ||
| return exports; | ||
| }(Component); | ||
| }).call(undefined); | ||
| return Iframe; | ||
| }(Component); |
+12
-8
| { | ||
| "name": "@kynikos/react-components", | ||
| "version": "1.0.1", | ||
| "version": "1.1.0", | ||
| "author": "Dario Giovannetti", | ||
@@ -14,17 +14,21 @@ "description": "React components.", | ||
| ], | ||
| "scripts": { | ||
| "compile": "./node_modules/.bin/babel src --out-dir dist" | ||
| }, | ||
| "dependencies": { | ||
| "react": "^16.2.0", | ||
| "react-dom": "^16.2.0" | ||
| "react": "^16.8.6", | ||
| "react-dom": "^16.8.6" | ||
| }, | ||
| "devDependencies": { | ||
| "babel-core": "^6.26.0", | ||
| "babel-preset-env": "^1.6.1", | ||
| "coffeelint": "^2.1.0", | ||
| "coffeescript": "^2.1.1" | ||
| "@babel/cli": "^7.4.3", | ||
| "@babel/core": "^7.4.3", | ||
| "@babel/preset-env": "^7.4.3", | ||
| "eslint": "^5.16.0", | ||
| "eslint-plugin-babel": "^5.3.0" | ||
| }, | ||
| "babel": { | ||
| "presets": [ | ||
| "env" | ||
| "@babel/preset-env" | ||
| ] | ||
| } | ||
| } |
Sorry, the diff of this file is not supported yet
| { | ||
| "arrow_spacing": { | ||
| "level": "error" | ||
| }, | ||
| "braces_spacing": { | ||
| "level": "error" | ||
| }, | ||
| "camel_case_classes": { | ||
| "level": "error" | ||
| }, | ||
| "colon_assignment_spacing": { | ||
| "level": "error", | ||
| "spacing": { | ||
| "left": 0, | ||
| "right": 1 | ||
| } | ||
| }, | ||
| "cyclomatic_complexity": { | ||
| "level": "warn" | ||
| }, | ||
| "duplicate_key": { | ||
| "level": "error" | ||
| }, | ||
| "indentation": { | ||
| "level": "error", | ||
| "value": 4 | ||
| }, | ||
| "max_line_length": { | ||
| "level": "warn", | ||
| "value": 79 | ||
| }, | ||
| "newlines_after_classes": { | ||
| "level": "error", | ||
| "value": 2 | ||
| }, | ||
| "no_implicit_braces": { | ||
| "level": "warn" | ||
| }, | ||
| "no_implicit_parens": { | ||
| "level": "error" | ||
| }, | ||
| "no_stand_alone_at": { | ||
| "level": "error" | ||
| }, | ||
| "space_operators": { | ||
| "level": "error" | ||
| }, | ||
| "spacing_after_comma": { | ||
| "level": "error" | ||
| } | ||
| } |
| # This file is part of react-components | ||
| # Copyright (C) 2018-present Dario Giovannetti <dev@dariogiovannetti.net> | ||
| # Licensed under MIT | ||
| # https://github.com/kynikos/lib.js.react-components/blob/master/LICENSE | ||
| {Component, createElement} = require('react') | ||
| ReactDOM = require('react-dom') | ||
| ReactDOMServer = require('react-dom/server') | ||
| class module.exports extends Component | ||
| render: -> | ||
| createElement('iframe', { | ||
| # Setting display:none makes it unprintable in Chrome | ||
| style: { | ||
| width: '0' | ||
| height: '0' | ||
| border: 'none' | ||
| margin: '0' | ||
| } | ||
| }) | ||
| componentDidMount: -> | ||
| @componentDidUpdate() | ||
| componentDidUpdate: -> | ||
| # TODO: Use the following if browsers stop supporting document.write() | ||
| # The problem is that this won't render any external images | ||
| # embedded with <img> elements | ||
| # iframe = ReactDOM.findDOMNode(this) | ||
| # if iframe | ||
| # iframe.src = URL.createObjectURL(new Blob([ | ||
| # ReactDOMServer.renderToString(@props.html) | ||
| # ], {type: 'text/html'})) | ||
| iframe = ReactDOM.findDOMNode(this) | ||
| doc = iframe.contentDocument | ||
| if doc | ||
| doc.open() | ||
| doc.write( | ||
| "<!doctype html>\n" + | ||
| ReactDOMServer.renderToString(@props.html) | ||
| ) | ||
| doc.close() | ||
| print: -> | ||
| iframe = ReactDOM.findDOMNode(this) | ||
| win = iframe.contentWindow | ||
| if win | ||
| win.print() |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
9314
8.73%168
33.33%5
25%1
Infinity%Updated
Updated