@atjson/renderer-react
Advanced tools
Comparing version 0.5.2 to 0.5.3
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [0, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread = (this && this.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var renderer_hir_1 = require("@atjson/renderer-hir"); | ||
var React = require("react"); | ||
var ReactRenderer = (function (_super) { | ||
__extends(ReactRenderer, _super); | ||
function ReactRenderer(componentLookup) { | ||
var _this = _super.call(this) || this; | ||
_this.componentLookup = componentLookup; | ||
return _this; | ||
const renderer_hir_1 = require("@atjson/renderer-hir"); | ||
const React = require("react"); | ||
class ReactRenderer extends renderer_hir_1.default { | ||
constructor(componentLookup) { | ||
super(); | ||
this.componentLookup = componentLookup; | ||
} | ||
ReactRenderer.prototype.registerComponent = function (type, component) { | ||
registerComponent(type, component) { | ||
this.componentLookup[type] = component; | ||
}; | ||
ReactRenderer.prototype.unregisterComponent = function (type) { | ||
} | ||
unregisterComponent(type) { | ||
delete this.componentLookup[type]; | ||
}; | ||
ReactRenderer.prototype.willRender = function () { | ||
} | ||
willRender() { | ||
this.pushScope({ | ||
componentLookup: this.componentLookup | ||
}); | ||
}; | ||
ReactRenderer.prototype.renderAnnotation = function (annotation) { | ||
var AnnotationComponent, _a, _b, _c, _d; | ||
return __generator(this, function (_e) { | ||
switch (_e.label) { | ||
case 0: | ||
AnnotationComponent = this.componentLookup[annotation.type]; | ||
if (!AnnotationComponent) return [3, 2]; | ||
_b = (_a = React.createElement).apply; | ||
_c = [React]; | ||
_d = [[AnnotationComponent, | ||
annotation.attributes]]; | ||
return [4]; | ||
case 1: return [2, _b.apply(_a, _c.concat([__spread.apply(void 0, _d.concat([_e.sent()]))]))]; | ||
case 2: return [2]; | ||
} | ||
}); | ||
}; | ||
return ReactRenderer; | ||
}(renderer_hir_1.default)); | ||
} | ||
*renderAnnotation(node) { | ||
let AnnotationComponent = this.componentLookup[node.type]; | ||
if (AnnotationComponent) { | ||
return React.createElement(AnnotationComponent, node.attributes, ...yield); | ||
} | ||
else { | ||
return; | ||
} | ||
} | ||
} | ||
exports.default = ReactRenderer; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiL3VzZXJzL3RldmFuczMvY29uZGUvYXRqc29uLyIsInNvdXJjZXMiOlsiaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFFQSxxREFBNEM7QUFDNUMsNkJBQStCO0FBWS9CO0lBQTJDLGlDQUFRO0lBR2pELHVCQUFZLGVBQWdDO1FBQTVDLFlBQ0UsaUJBQU8sU0FFUjtRQURDLEtBQUksQ0FBQyxlQUFlLEdBQUcsZUFBZSxDQUFDOztJQUN6QyxDQUFDO0lBRUQseUNBQWlCLEdBQWpCLFVBQWtCLElBQVksRUFBRSxTQUF5QztRQUN2RSxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyxHQUFHLFNBQVMsQ0FBQztJQUN6QyxDQUFDO0lBRUQsMkNBQW1CLEdBQW5CLFVBQW9CLElBQVk7UUFDOUIsT0FBTyxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ3BDLENBQUM7SUFF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JQUFZO1FBQzlCLE9BQU8sSUFBSSxDQUFDLGVBQWUsQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUNwQyxDQUFDO0lBRUQsVUFBVTtRQUNSLElBQUksQ0FBQyxTQUFTLENBQUM7WUFDYixlQUFlLEVBQUUsSUFBSSxDQUFDLGVBQWU7U0FDdEMsQ0FBQyxDQUFDO0lBQ0wsQ0FBQztJQUVELENBQUMsZ0JBQWdCLENBQUMsSUFBYTtRQUM3QixJQUFJLG1CQUFtQixHQUFHLElBQUksQ0FBQyxlQUFlLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDO1FBQzFELEVBQUUsQ0FBQyxDQUFDLG1CQUFtQixDQUFDLENBQUMsQ0FBQztZQUN4QixNQUFNLENBQUMsS0FBSyxDQUFDLGFBQWEsQ0FDeEIsbUJBQW1CLEVBQ25CLElBQUksQ0FBQyxVQUFVLEVBQ2YsR0FBRyxLQUFLLENBQ1QsQ0FBQztRQUNKLENBQUM7UUFBQyxJQUFJLENBQUMsQ0FBQztZQUVOLE1BQU0sQ0FBQztRQUNULENBQUM7SUFDSCxDQUFDO0NBQ0Y7QUFuQ0QsZ0NBbUNDIn0= |
@@ -20,6 +20,6 @@ "use strict"; | ||
} | ||
*renderAnnotation(annotation) { | ||
let AnnotationComponent = this.componentLookup[annotation.type]; | ||
*renderAnnotation(node) { | ||
let AnnotationComponent = this.componentLookup[node.type]; | ||
if (AnnotationComponent) { | ||
return React.createElement(AnnotationComponent, annotation.attributes, ...yield); | ||
return React.createElement(AnnotationComponent, node.attributes, ...yield); | ||
} | ||
@@ -31,2 +31,2 @@ else { | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiL3VzZXJzL3RldmFuczMvY29uZGUvYXRqc29uLyIsInNvdXJjZXMiOlsiaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUVBLE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FDVCxDQUFDO1FBQ0osQ0FBQztRQUFDLElBQUksQ0FBQyxDQUFDO1lBRU4sTUFBTSxDQUFDO1FBQ1QsQ0FBQztJQUNILENBQUM7Q0FDRiJ9 |
{ | ||
"name": "@atjson/renderer-react", | ||
"version": "0.5.2", | ||
"version": "0.5.3", | ||
"description": "A brand new TypeScript library.", | ||
"main": "dist/commonjs/index.js", | ||
"module": "dist/modules/index.js", | ||
"types": "dist/amd/index.d.ts", | ||
"types": "dist/commonjs/index.d.ts", | ||
"scripts": { | ||
"prepack": "npm run build", | ||
"build": "rm -rf dist; tsc -p . --module AMD --outFile dist/amd/index.js; tsc -p . --module CommonJS --outDir dist/commonjs/; tsc -p . --module ESNext --outDir dist/modules/ --target ES2017; exit 0", | ||
"prepublish": "npm run build", | ||
"build": "rm -rf dist; tsc -p . & tsc -p . --module ESNext --outDir dist/modules/ --target ES2017; exit 0", | ||
"test": "../../node_modules/jest/bin/jest.js packages/$(basename $PWD) --config=../../package.json" | ||
}, | ||
"license": "Apache 2.0", | ||
"license": "Apache-2.0", | ||
"publishConfig": { | ||
@@ -18,7 +18,7 @@ "access": "public" | ||
"devDependencies": { | ||
"@atjson/core": "^0.5.2", | ||
"@atjson/hir": "^0.5.2", | ||
"@types/react": "^16.0.7", | ||
"@types/react-dom": "^15.5.5", | ||
"react-dom": "^15.6.1", | ||
"@atjson/core": "^0.5.3", | ||
"@atjson/hir": "^0.5.3", | ||
"@types/react": "^16.0.9", | ||
"@types/react-dom": "^16.0.0", | ||
"react-dom": "^16.0.0", | ||
"tslint": "^5.7.0", | ||
@@ -28,5 +28,5 @@ "typescript": "^2.4.2" | ||
"dependencies": { | ||
"@atjson/renderer-hir": "^0.5.2", | ||
"react": "^15.6.1" | ||
"@atjson/renderer-hir": "^0.5.3", | ||
"react": "^16.0.0" | ||
} | ||
} |
@@ -1,2 +0,1 @@ | ||
/// <amd-module name="@atjson/renderer-react"/> | ||
import { HIRNode } from '@atjson/hir'; | ||
@@ -38,12 +37,12 @@ import Renderer from '@atjson/renderer-hir'; | ||
*renderAnnotation(annotation: HIRNode): IterableIterator<React.Component | void> { | ||
let AnnotationComponent = this.componentLookup[annotation.type]; | ||
*renderAnnotation(node: HIRNode): IterableIterator<React.Component | void> { | ||
let AnnotationComponent = this.componentLookup[node.type]; | ||
if (AnnotationComponent) { | ||
return React.createElement( | ||
AnnotationComponent, | ||
annotation.attributes, | ||
node.attributes, | ||
...yield | ||
); | ||
} else { | ||
// console.warn(`No component found for "${annotation.type}"- content will be yielded`); | ||
// console.warn(`No component found for "${node.type}"- content will be yielded`); | ||
return; | ||
@@ -50,0 +49,0 @@ } |
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
370391
101
1
+ Addedreact@16.14.0(transitive)
- Removedasap@2.0.6(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedcreate-react-class@15.7.0(transitive)
- Removedencoding@0.1.13(transitive)
- Removedfbjs@0.8.18(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedpromise@7.3.1(transitive)
- Removedreact@15.7.0(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedua-parser-js@0.7.40(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)
Updated@atjson/renderer-hir@^0.5.3
Updatedreact@^16.0.0