UNPKG

@resk/core

Version:

An innovative TypeScript framework that empowers developers to build applications with a fully decorator-based architecture for efficient resource management. By combining the power of decorators with a resource-oriented design, DecorRes enhances code cla

1 lines 1.76 kB
'use strict';require('reflect-metadata');var o=require('../utils/defaultStr'),object=require('../utils/object');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var o__default=/*#__PURE__*/_interopDefault(o);function x(r,t){return (e,n)=>{const a=e==null?void 0:e.constructor,p=Object.assign({},Reflect.getMetadata(r,a)),i=p[n],s=typeof t=="function"?t(i,p,e,n):t;p[n]=s,Reflect.defineMetadata(r,p,a),Reflect.defineMetadata(r,t,e,n);}}function d(r,t){return object.extendObj({},Reflect.getMetadata(t,r),Reflect.getMetadata(t,r.prototype))}function D(r,t,e){return d(r,t)[e]}const g="typeRegistry",c="componentRegistry";class y{static getMetadataKey(t,e){return `${g}-${e}:${t}`.trim()}static register(t,e,n){!t||typeof t!="string"||!e||typeof e!="string"||Reflect.defineMetadata(this.getMetadataKey(t,e),n,y);}static getRenderer(t,e){return Reflect.getMetadata(this.getMetadataKey(t,e),y)}static hasRenderer(t,e){return !!this.getRenderer(t,e)}static render(t,e,n,a){const p=y.getRenderer(t,n);return p?p(e):a}}function P(r){return t=>function(e){y.register(t,r,e);}}class u{static getMetadataKey(t){return t=o__default.default(t,"undefined-component-name"),`${c}:${t}`.trim()}static register(t,e){!t||typeof t!="string"||Reflect.defineMetadata(this.getMetadataKey(t),e,u);}static getRenderer(t){return Reflect.getMetadata(this.getMetadataKey(t),u)}static hasRenderer(t){return !!this.getRenderer(t)}static render(t,e,n){const a=this.getRenderer(e);return a?a(t):n}}function b(r){return function(t){u.register(r,t);}}exports.ComponentRegistry=u;exports.TypeRegistry=y;exports.createComponentRegistryDecorator=b;exports.createPropertyDecorator=x;exports.createTypeRegistryDecorator=P;exports.getDecoratedProperties=d;exports.getDecoratedProperty=D;