@atjson/renderer-react
Advanced tools
Comparing version 0.5.4 to 0.5.5
"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 }); | ||
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; | ||
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; | ||
} | ||
registerComponent(type, component) { | ||
ReactRenderer.prototype.registerComponent = function (type, component) { | ||
this.componentLookup[type] = component; | ||
} | ||
unregisterComponent(type) { | ||
}; | ||
ReactRenderer.prototype.unregisterComponent = function (type) { | ||
delete this.componentLookup[type]; | ||
} | ||
willRender() { | ||
}; | ||
ReactRenderer.prototype.willRender = function () { | ||
this.pushScope({ | ||
componentLookup: this.componentLookup | ||
}); | ||
} | ||
*renderAnnotation(node) { | ||
let AnnotationComponent = this.componentLookup[node.type]; | ||
if (AnnotationComponent) { | ||
return React.createElement(AnnotationComponent, node.attributes, ...yield); | ||
} | ||
else { | ||
return; | ||
} | ||
} | ||
} | ||
}; | ||
ReactRenderer.prototype.renderAnnotation = function (node) { | ||
var AnnotationComponent, _a, _b, _c, _d; | ||
return __generator(this, function (_e) { | ||
switch (_e.label) { | ||
case 0: | ||
AnnotationComponent = this.componentLookup[node.type]; | ||
if (!AnnotationComponent) return [3, 2]; | ||
_b = (_a = React.createElement).apply; | ||
_c = [React]; | ||
_d = [[AnnotationComponent, | ||
node.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)); | ||
exports.default = ReactRenderer; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFDQSx1REFBNEM7QUFDNUMsK0JBQStCO0FBWS9CLG1CQUFtQyxTQUFRLHNCQUFRO0lBR2pELFlBQVksZUFBZ0M7UUFDMUMsS0FBSyxFQUFFLENBQUM7UUFDUixJQUFJLENBQUMsZUFBZSxHQUFHLGVBQWUsQ0FBQztJQUN6QyxDQUFDO0lBRUQsaUJBQWlCLENBQUMsSUFBWSxFQUFFLFNBQXlDO1FBQ3ZFLElBQUksQ0FBQyxlQUFlLENBQUMsSUFBSSxDQUFDLEdBQUcsU0FBUyxDQUFDO0lBQ3pDLENBQUM7SUFFRCxtQkFBbUIsQ0FBQyxJQUFZO1FBQzlCLE9BQU8sSUFBSSxDQUFDLGVBQWUsQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUNwQyxDQUFDO0lBRUQsVUFBVTtRQUNSLElBQUksQ0FBQyxTQUFTLENBQUM7WUFDYixlQUFlLEVBQUUsSUFBSSxDQUFDLGVBQWU7U0FDdEMsQ0FBQyxDQUFDO0lBQ0wsQ0FBQztJQUVELENBQUMsZ0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UksQ0FBQyxDQUFDO0lBQ3BDLENBQUM7SUFFRCxrQ0FBVSxHQUFWO1FBQ0UsSUFBSSxDQUFDLFNBQVMsQ0FBQztZQUNiLGVBQWUsRUFBRSxJQUFJLENBQUMsZUFBZTtTQUN0QyxDQUFDLENBQUM7SUFDTCxDQUFDO0lBRUEsd0NBQWdCLEdBQWpCLFVBQWtCLElBQWE7Ozs7O29CQUN6QixtQkFBbUIsR0FBRyxJQUFJLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQzt5QkFDdEQsbUJBQW1CLEVBQW5CLGNBQW1CO3lCQUNkLENBQUEsS0FBQSxLQUFLLENBQUMsYUFBYSxDQUFBOzBCQUFuQixLQUFLOzJCQUNWLG1CQUFtQjs0QkFDbkIsSUFBSSxDQUFDLFVBQVU7b0JBQ1osV0FBSzt3QkFIVixxRUFHSyxTQUFLLFFBQ1I7d0JBR0YsV0FBTzs7O0tBRVY7SUFDSCxvQkFBQztBQUFELENBQUMsQUFuQ0QsQ0FBMkMsc0JBQVEsR0FtQ2xEIn0= |
{ | ||
"name": "@atjson/renderer-react", | ||
"version": "0.5.4", | ||
"version": "0.5.5", | ||
"description": "A brand new TypeScript library.", | ||
@@ -18,4 +18,4 @@ "main": "dist/commonjs/index.js", | ||
"devDependencies": { | ||
"@atjson/core": "^0.5.4", | ||
"@atjson/hir": "^0.5.4", | ||
"@atjson/core": "^0.5.5", | ||
"@atjson/hir": "^0.5.5", | ||
"@types/react": "^16.0.9", | ||
@@ -28,5 +28,5 @@ "@types/react-dom": "^16.0.0", | ||
"dependencies": { | ||
"@atjson/renderer-hir": "^0.5.4", | ||
"@atjson/renderer-hir": "^0.5.5", | ||
"react": "^16.0.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9979
169
Updated@atjson/renderer-hir@^0.5.5