@ibyar/core 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/annotation/decorators.js +23 -23
  2. package/annotation/decorators.js.map +1 -1
  3. package/annotation/options.d.ts +2 -1
  4. package/annotation/options.d.ts.map +1 -1
  5. package/annotation/options.js.map +1 -1
  6. package/binding/binding.expressions.d.ts +1 -1
  7. package/binding/binding.expressions.d.ts.map +1 -1
  8. package/binding/binding.expressions.js +29 -17
  9. package/binding/binding.expressions.js.map +1 -1
  10. package/component/component.d.ts +1 -0
  11. package/component/component.d.ts.map +1 -1
  12. package/component/component.js +5 -4
  13. package/component/component.js.map +1 -1
  14. package/component/custom-element.d.ts +0 -3
  15. package/component/custom-element.d.ts.map +1 -1
  16. package/component/custom-element.js.map +1 -1
  17. package/component/reflect.d.ts +2 -2
  18. package/component/reflect.d.ts.map +1 -1
  19. package/component/reflect.js +2 -1
  20. package/component/reflect.js.map +1 -1
  21. package/linker/view-container-ref.d.ts.map +1 -1
  22. package/linker/view-container-ref.js +2 -1
  23. package/linker/view-container-ref.js.map +1 -1
  24. package/package.json +8 -8
  25. package/providers/provider.d.ts +1 -1
  26. package/providers/provider.d.ts.map +1 -1
  27. package/providers/provider.js +9 -8
  28. package/providers/provider.js.map +1 -1
  29. package/scope/variables.d.ts +19 -0
  30. package/scope/variables.d.ts.map +1 -0
  31. package/scope/variables.js +38 -0
  32. package/scope/variables.js.map +1 -0
  33. package/view/base-view.d.ts.map +1 -1
  34. package/view/base-view.js +4 -14
  35. package/view/base-view.js.map +1 -1
  36. package/view/mutation.js +1 -2
  37. package/view/mutation.js.map +1 -1
  38. package/view/render.d.ts +1 -0
  39. package/view/render.d.ts.map +1 -1
  40. package/view/render.js +16 -5
  41. package/view/render.js.map +1 -1
  42. package/view/view.d.ts.map +1 -1
  43. package/view/view.js +19 -8
  44. package/view/view.js.map +1 -1
  45. package/annotation/context.d.ts +0 -41
  46. package/annotation/context.d.ts.map +0 -1
  47. package/annotation/context.js +0 -79
  48. package/annotation/context.js.map +0 -1
  49. package/render/host-binding.handler.d.ts +0 -46
  50. package/render/host-binding.handler.js +0 -60
  51. package/render/host-binding.handler.js.map +0 -1
  52. package/render/host-listener.handler.d.ts +0 -50
  53. package/render/host-listener.handler.js +0 -88
  54. package/render/host-listener.handler.js.map +0 -1
  55. package/render/render-handler.d.ts +0 -11
  56. package/render/render-handler.js +0 -2
  57. package/render/render-handler.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/core/component/component.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,aAAa,EAAO,UAAU,EAAE,cAAc,EACtB,eAAe,EACvC,iBAAiB,EAAE,cAAc,EACjC,eAAe,EAAE,aAAa,EAC9B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAK7D,OAAO,EAEY,WAAW,EAE7B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAuEpE,MAAM,wBAAwB,GAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC;AAElH,MAAa,UAAU;IAEd,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,CAAM,EAAE,CAAC,CAAC;IAC3C,MAAM,CAAC,SAAS;QACvB,OAAO,UAAU,CAAC,UAAiB,CAAC;IACrC,CAAC;IAEO,MAAM,CAAC,aAAa,CAAC,KAAc,EAAE,SAA2B;QACvE,IAAI,KAAK,YAAY,cAAc,IAAI,KAAK,CAAC,eAAe,EAAE,IAAI,EAAE;YACnE,MAAM,GAAG,GAAG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AO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;gBAC/D,OAAO,CAAC,OAAO,GAAG,aAAa,CAAC;aAChC;SACD;QAGD,cAAc,CAAC,MAAM,CACpB,YAAY,CAAC,QAAkB,EAC/B,YAAY,CAAC,SAAqC,EAClD,OAAO,CACP,CAAC;IAEH,CAAC;IAED,MAAM,CAAC,UAAU,CAAwB,SAA2B,EAAE,GAAoD;QACzH,qBAAqB,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAC9C,cAAc,CAAC,MAAM,CACpB,GAAG,CAAC,QAAkB,EACtB,SAAS,EACT,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAC/C,CAAC;IACH,CAAC;;SA1NW,UAAU","sourcesContent":["import type { MetadataClass, MetadataContext } from '@ibyar/decorators';\nimport type { Class, TypeOf } from '../utils/typeof.js';\nimport type { ZoneType } from '../zone/bootstrap.js';\nimport {\n\tfindByTagName, Tag, htmlParser, templateParser,\n\tDomNode, DomRenderNode, canAttachShadow,\n\tdirectiveRegistry, DomElementNode,\n\tDomFragmentNode, DomParentNode\n} from '@ibyar/elements';\n\nimport { HTMLComponent, ValueControl } from './custom-element.js';\nimport { ClassRegistryProvider } from '../providers/provider.js';\nimport { AttributeDirective, StructuralDirective } from '../directive/directive.js';\nimport { initCustomElementView } from '../view/view.js';\nimport { buildExpressionNodes } from '../html/expression.js';\nimport {\n\tComponentOptions, PipeOptions,\n\tServiceOptions, DirectiveOptions\n} from '../annotation/options.js';\nimport {\n\tBootstrapMetadata, ChildRef, HostBindingRef,\n\tInputPropertyRef, ListenerRef, OutputPropertyRef,\n\tPropertyRef, ReflectComponents\n} from './reflect.js';\nimport { deserializeExpressionNodes } from '../html/deserialize.js';\n\n\nexport interface ServiceRef<T> {\n\tprovideIn: TypeOf<CustomElementConstructor> | 'root' | 'platform' | 'any';\n\tmodelClass: TypeOf<T>;\n\tname: string;\n}\n\nexport interface PipeRef<T> {\n\tname: string;\n\tasynchronous?: boolean;\n\tmodelClass: TypeOf<T>;\n}\nexport interface DirectiveRef<T> {\n\tselector: string;\n\tzone?: ZoneType;\n\n\tmodelClass: TypeOf<StructuralDirective> | TypeOf<AttributeDirective>;\n\n\tinputs: PropertyRef[];\n\toutputs: PropertyRef[];\n\tview: string;\n\tviewChild: ChildRef[];\n\tViewChildren: ChildRef[];\n\thostListeners: ListenerRef[];\n\thostBindings: HostBindingRef[];\n\tviewBindings?: DomElementNode;\n}\n\nexport interface ComponentRef<T> {\n\tselector: string;\n\ttemplate: DomNode | DomRenderNode<T>;\n\tcompiledTemplate?: DomNode;\n\t// attrTemplate: JsxAttrComponent;\n\tstyles: string;\n\textend: Tag;\n\n\tviewClass: MetadataClass<HTMLComponent<T>> & CustomElementConstructor;\n\tmodelClass: TypeOf<T>;\n\n\tinputs: InputPropertyRef[];\n\toutputs: OutputPropertyRef[];\n\tview: string;\n\tviewChild: ChildRef[];\n\tViewChildren: ChildRef[];\n\thostBindings: HostBindingRef[];\n\thostListeners: ListenerRef[];\n\tviewBindings?: DomElementNode;\n\twindowBindings?: DomElementNode;\n\n\tencapsulation: 'custom' | 'shadow-dom' | 'template' | 'shadow-dom-template' | 'shadow-slot';\n\tisShadowDom: boolean;\n\tshadowRootInit: ShadowRootInit;\n\tformAssociated: boolean | TypeOf<ValueControl<any>>;\n\tzone?: ZoneType;\n}\n\ntype ViewBindingOption = {\n\tprototype: Record<PropertyKey, any>;\n\thostBindings?: HostBindingRef[];\n\thostListeners?: ListenerRef[];\n\tselector?: string;\n};\n\ntype HostNode = {\n\thost?: DomElementNode;\n\twindow?: DomElementNode;\n\ttemplate?: DomElementNode[];\n};\n\nconst DEFAULT_SHADOW_ROOT_INIT: ShadowRootInit = { mode: 'open', delegatesFocus: false, slotAssignment: 'named' };\n\nexport class Components {\n\n\tprivate static EMPTY_LIST = Object.freeze<any>([]);\n\tprivate static emptyList<T>(): T[] {\n\t\treturn Components.EMPTY_LIST as T[];\n\t}\n\n\tprivate static patchTemplate(child: DomNode, templates: DomElementNode[]): void {\n\t\tif (child instanceof DomElementNode && child.templateRefName?.name) {\n\t\t\tconst ref = templates.find(node => child.templateRefName?.name === node.templateRefName?.name);\n\t\t\tif (ref?.outputs) {\n\t\t\t\t(child.outputs ??= []).push(...ref.outputs);\n\t\t\t}\n\t\t}\n\t\tif (child instanceof DomParentNode) {\n\t\t\tchild.children?.forEach(node => Components.patchTemplate(node, templates));\n\t\t}\n\t}\n\n\tprivate static createOutputs(Listeners?: ListenerRef[]) {\n\t\treturn Listeners?.map(\n\t\t\tlistener => `(${listener.eventName})=\"${listener.modelCallbackName}(${listener.args.join(', ')})\"`\n\t\t).join(' ') ?? ''\n\t}\n\n\tprivate static parseHostNode(option: ViewBindingOption): HostNode {\n\t\tconst inputs = option.hostBindings?.map(binding => {\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(option.prototype, binding.modelPropertyName);\n\t\t\tif (typeof descriptor?.value === 'function') {\n\t\t\t\treturn `[${binding.hostPropertyName}]=\"${binding.modelPropertyName}()\"`\n\t\t\t}\n\t\t\treturn `[${binding.hostPropertyName}]=\"${binding.modelPropertyName}\"`;\n\t\t}).join(' ') ?? '';\n\n\t\tconst hostListeners: ListenerRef[] = [];\n\t\tconst windowListeners: ListenerRef[] = [];\n\t\tconst templateListeners: Record<string, ListenerRef[]> = {};\n\n\t\toption.hostListeners?.forEach(listener => {\n\t\t\tconst [host, event] = listener.eventName.split(':', 2);\n\t\t\tif (event === undefined) {\n\t\t\t\thostListeners.push(listener);\n\t\t\t} else if ('window' === host.toLowerCase()) {\n\t\t\t\twindowListeners.push(new ListenerRef(event, listener.args, listener.modelCallbackName));\n\t\t\t} else {\n\t\t\t\t(templateListeners[host] ??= []).push(new ListenerRef(event, listener.args, listener.modelCallbackName));\n\t\t\t}\n\t\t});\n\n\t\tconst result: HostNode = {};\n\n\t\tif (hostListeners.length) {\n\t\t\tconst hostOutputs = Components.createOutputs(hostListeners);\n\t\t\tconst selector = option.selector ?? 'div';\n\t\t\tconst hostTemplate = `<${selector} ${inputs} ${hostOutputs}></${selector}>`;\n\t\t\tresult.host = htmlParser.toDomRootNode(hostTemplate) as DomElementNode;\n\t\t\tbuildExpressionNodes(result.host);\n\t\t}\n\n\t\tif (windowListeners.length) {\n\t\t\tconst windowOutputs = Components.createOutputs(windowListeners);\n\t\t\tconst windowTemplate = `<window ${windowOutputs}></window>`;\n\t\t\tresult.window = htmlParser.toDomRootNode(windowTemplate) as DomElementNode;\n\t\t\tbuildExpressionNodes(result.window);\n\t\t}\n\n\t\tconst templateHosts = Object.keys(templateListeners);\n\t\tif (templateHosts.length) {\n\t\t\tconst template = templateHosts.map(host => {\n\t\t\t\tconst hostOutputs = Components.createOutputs(templateListeners[host]);\n\t\t\t\treturn `<template #${host} ${hostOutputs}></template>`;\n\t\t\t}).join('');\n\t\t\tconst templateNodes = htmlParser.toDomRootNode(template) as DomElementNode | DomFragmentNode;\n\t\t\tbuildExpressionNodes(templateNodes);\n\t\t\tresult.template = templateNodes instanceof DomFragmentNode\n\t\t\t\t? templateNodes.children?.filter(child => child instanceof DomElementNode) as DomElementNode[] ?? []\n\t\t\t\t: [templateNodes];\n\t\t}\n\t\treturn result;\n\t}\n\n\tstatic defineDirective(modelClass: MetadataClass, opts: DirectiveOptions, metadata: MetadataContext) {\n\t\tObject.assign(metadata, opts);\n\t\tif (metadata.hostListeners?.length || metadata.hostBindings?.length) {\n\t\t\tconst hostNode = Components.parseHostNode({\n\t\t\t\tprototype: modelClass.prototype,\n\t\t\t\thostBindings: metadata.hostBindings,\n\t\t\t\thostListeners: metadata.hostListeners,\n\t\t\t});\n\t\t\tmetadata.viewBindings = hostNode.host;\n\t\t}\n\t\tmetadata.modelClass = modelClass;\n\t\tClassRegistryProvider.registerDirective(modelClass);\n\t\tdirectiveRegistry.register(opts.selector, {\n\t\t\tinputs: (metadata.inputs as PropertyRef[])?.map(input => input.viewAttribute),\n\t\t\toutputs: (metadata.outputs as PropertyRef[])?.map(output => output.viewAttribute),\n\t\t});\n\t}\n\n\tstatic definePipe<T extends Class>(modelClass: MetadataClass<T>, opts: PipeOptions, metadata: MetadataContext) {\n\t\tObject.assign(metadata, opts);\n\t\tmetadata.modelClass = modelClass;\n\t\tClassRegistryProvider.registerPipe(modelClass);\n\t}\n\n\tstatic defineService<T extends Class>(modelClass: MetadataClass<T>, opts: ServiceOptions, metadata: MetadataContext) {\n\t\tObject.assign(metadata, opts);\n\t\tmetadata.modelClass = modelClass;\n\t\tmetadata.name = modelClass.name;\n\t\tClassRegistryProvider.registerService(modelClass);\n\t}\n\n\tstatic defineComponent<T extends Class>(modelClass: MetadataClass<T>, opts: ComponentOptions<T>, metadata: MetadataContext) {\n\t\tconst componentRef = Object.assign(metadata, opts) as any as ComponentRef<T>;\n\t\tcomponentRef.extend = findByTagName(opts.extend);\n\n\t\tif (typeof componentRef.template === 'string') {\n\t\t\tif (componentRef.styles) {\n\t\t\t\tconst template = `<style>${componentRef.styles}</style>${componentRef.template}`;\n\t\t\t\tcomponentRef.template = htmlParser.toDomRootNode(template);\n\t\t\t} else {\n\t\t\t\tcomponentRef.template = htmlParser.toDomRootNode(componentRef.template);\n\t\t\t}\n\t\t\tbuildExpressionNodes(componentRef.template);\n\t\t} else if (typeof componentRef.template === 'object') {\n\t\t\tbuildExpressionNodes(componentRef.template);\n\t\t} else if (typeof componentRef.compiledTemplate === 'object') {\n\t\t\thtmlParser.deserializeNode(componentRef.compiledTemplate);\n\t\t\tdeserializeExpressionNodes(componentRef.compiledTemplate);\n\t\t\tcomponentRef.template = componentRef.compiledTemplate;\n\t\t\tcomponentRef.compiledTemplate = undefined;\n\t\t}\n\n\t\tif (!componentRef.template && /template/g.test(componentRef.encapsulation)) {\n\t\t\tconst template = document.querySelector('#' + componentRef.selector);\n\t\t\tif (template && template instanceof HTMLTemplateElement) {\n\t\t\t\tcomponentRef.template = templateParser.parse(template);\n\t\t\t\tbuildExpressionNodes(componentRef.template);\n\t\t\t} else {\n\t\t\t\t// didn't find this template in 'index.html' document\n\t\t\t}\n\t\t}\n\n\t\tcomponentRef.inputs ||= Components.emptyList();\n\t\tcomponentRef.outputs ||= Components.emptyList();\n\t\tcomponentRef.viewChild ||= Components.emptyList();\n\t\tcomponentRef.ViewChildren ||= Components.emptyList();\n\t\tcomponentRef.hostBindings ||= Components.emptyList();\n\t\tcomponentRef.hostListeners ||= Components.emptyList();\n\t\tcomponentRef.encapsulation ||= 'custom';\n\t\tcomponentRef.isShadowDom = /shadow/g.test(componentRef.encapsulation);\n\t\tif (componentRef.isShadowDom) {\n\t\t\tcomponentRef.shadowRootInit = Object.assign({}, DEFAULT_SHADOW_ROOT_INIT, (componentRef.shadowRootInit ?? {}));\n\t\t}\n\n\t\tif (componentRef.hostListeners.length || componentRef.hostBindings.length) {\n\t\t\tconst hostNode = Components.parseHostNode({\n\t\t\t\tprototype: modelClass.prototype,\n\t\t\t\tselector: componentRef.selector,\n\t\t\t\thostBindings: componentRef.hostBindings,\n\t\t\t\thostListeners: componentRef.hostListeners,\n\t\t\t});\n\t\t\tcomponentRef.viewBindings = hostNode.host;\n\t\t\tcomponentRef.windowBindings = hostNode.window;\n\n\t\t\tif (typeof componentRef.template === 'function') {\n\t\t\t\tconst creator = componentRef.template;\n\t\t\t\tcomponentRef.template = (model: T) => {\n\t\t\t\t\tconst template = creator(model);\n\t\t\t\t\tif (hostNode.template) {\n\t\t\t\t\t\tComponents.patchTemplate(template, hostNode.template);\n\t\t\t\t\t}\n\t\t\t\t\treturn template;\n\t\t\t\t};\n\t\t\t} else if (hostNode.template) {\n\t\t\t\tComponents.patchTemplate(componentRef.template, hostNode.template);\n\t\t\t}\n\n\t\t}\n\n\t\tif (!(componentRef.formAssociated === true || typeof componentRef.formAssociated === 'function')) {\n\t\t\tcomponentRef.formAssociated = false;\n\t\t}\n\n\t\tif (componentRef.isShadowDom && componentRef.extend.name) {\n\t\t\tcomponentRef.isShadowDom = canAttachShadow(componentRef.extend.name);\n\t\t}\n\n\t\tcomponentRef.modelClass = modelClass;\n\t\tcomponentRef.viewClass = initCustomElementView(modelClass, componentRef);\n\n\t\tClassRegistryProvider.registerComponent(modelClass);\n\t\tClassRegistryProvider.registerView(componentRef.viewClass);\n\n\t\tconst options: ElementDefinitionOptions = {};\n\t\tconst parentTagName = componentRef.extend?.name;\n\t\tif (parentTagName) {\n\t\t\tif (parentTagName !== '!' && parentTagName.indexOf('-') === -1) {\n\t\t\t\toptions.extends = parentTagName;\n\t\t\t}\n\t\t}\n\n\n\t\tcustomElements.define(\n\t\t\tcomponentRef.selector as string,\n\t\t\tcomponentRef.viewClass as CustomElementConstructor,\n\t\t\toptions\n\t\t);\n\n\t}\n\n\tstatic defineView<T extends HTMLElement>(viewClass: MetadataClass<T>, opt: { selector: string } & ElementDefinitionOptions) {\n\t\tClassRegistryProvider.registerView(viewClass);\n\t\tcustomElements.define(\n\t\t\topt.selector as string,\n\t\t\tviewClass,\n\t\t\tObject.assign({}, opt, { selector: undefined }),\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/core/component/component.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,aAAa,EAAO,UAAU,EAAE,cAAc,EACtB,eAAe,EACvC,iBAAiB,EAAE,cAAc,EACjC,eAAe,EAAE,aAAa,EAC9B,wBAAwB,EACxB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAK7D,OAAO,EAEN,WAAW,EACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAwEpE,MAAM,wBAAwB,GAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,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AY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SACrE;QAED,YAAY,CAAC,UAAU,GAAG,UAAU,CAAC;QACrC,YAAY,CAAC,SAAS,GAAG,qBAAqB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;QAEzE,qBAAqB,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACpD,qBAAqB,CAAC,YAAY,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAE3D,MAAM,OAAO,GAA6B,EAAE,CAAC;QAC7C,MAAM,aAAa,GAAG,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC;QAChD,IAAI,aAAa,EAAE;YAClB,IAAI,aAAa,KAAK,GAAG,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;gBAC/D,OAAO,CAAC,OAAO,GAAG,aAAa,CAAC;aAChC;SACD;QAGD,cAAc,CAAC,MAAM,CACpB,YAAY,CAAC,QAAkB,EAC/B,YAAY,CAAC,SAAqC,EAClD,OAAO,CACP,CAAC;IAEH,CAAC;IAED,MAAM,CAAC,UAAU,CAAwB,SAA2B,EAAE,GAAoD;QACzH,qBAAqB,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAC9C,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,GAAG,CAAC;QACxC,cAAc,CAAC,MAAM,CACpB,QAAQ,EACR,SAAS,EACT,UAAU,CACV,CAAC;IACH,CAAC","sourcesContent":["import type { MetadataClass, MetadataContext } from '@ibyar/decorators';\nimport type { Class, TypeOf } from '../utils/typeof.js';\nimport type { ZoneType } from '../zone/bootstrap.js';\nimport {\n\tfindByTagName, Tag, htmlParser, templateParser,\n\tDomNode, DomRenderNode, canAttachShadow,\n\tdirectiveRegistry, DomElementNode,\n\tDomFragmentNode, DomParentNode,\n\tisValidCustomElementName\n} from '@ibyar/elements';\n\nimport { HTMLComponent, ValueControl } from './custom-element.js';\nimport { ClassRegistryProvider } from '../providers/provider.js';\nimport { AttributeDirective, StructuralDirective } from '../directive/directive.js';\nimport { initCustomElementView } from '../view/view.js';\nimport { buildExpressionNodes } from '../html/expression.js';\nimport {\n\tComponentOptions, PipeOptions,\n\tServiceOptions, DirectiveOptions\n} from '../annotation/options.js';\nimport {\n\tChildRef, HostBindingRef, InputPropertyRef,\n\tListenerRef, OutputPropertyRef, PropertyRef\n} from './reflect.js';\nimport { deserializeExpressionNodes } from '../html/deserialize.js';\n\n\nexport interface ServiceRef<T> {\n\tprovideIn: TypeOf<CustomElementConstructor> | 'root' | 'platform' | 'any';\n\tmodelClass: TypeOf<T>;\n\tname: string;\n}\n\nexport interface PipeRef<T> {\n\tname: string;\n\tasynchronous?: boolean;\n\tmodelClass: TypeOf<T>;\n}\nexport interface DirectiveRef<T> {\n\tselector: string;\n\tzone?: ZoneType;\n\n\tmodelClass: TypeOf<StructuralDirective> | TypeOf<AttributeDirective>;\n\n\tinputs: PropertyRef[];\n\toutputs: PropertyRef[];\n\tview: string;\n\tviewChild: ChildRef[];\n\tViewChildren: ChildRef[];\n\thostListeners: ListenerRef[];\n\thostBindings: HostBindingRef[];\n\tviewBindings?: DomElementNode;\n}\n\nexport interface ComponentRef<T> {\n\tselector: string;\n\ttemplate: DomNode | DomRenderNode<T>;\n\tcompiledTemplate?: DomNode;\n\t// attrTemplate: JsxAttrComponent;\n\tstyles: string;\n\textend: Tag;\n\textendCustomElement: boolean;\n\n\tviewClass: MetadataClass<HTMLComponent<T>> & CustomElementConstructor;\n\tmodelClass: TypeOf<T>;\n\n\tinputs: InputPropertyRef[];\n\toutputs: OutputPropertyRef[];\n\tview: string;\n\tviewChild: ChildRef[];\n\tViewChildren: ChildRef[];\n\thostBindings: HostBindingRef[];\n\thostListeners: ListenerRef[];\n\tviewBindings?: DomElementNode;\n\twindowBindings?: DomElementNode;\n\n\tencapsulation: 'custom' | 'shadow-dom' | 'template' | 'shadow-dom-template' | 'shadow-slot';\n\tisShadowDom: boolean;\n\tshadowRootInit: ShadowRootInit;\n\tformAssociated: boolean | TypeOf<ValueControl<any>>;\n\tzone?: ZoneType;\n}\n\ntype ViewBindingOption = {\n\tprototype: Record<PropertyKey, any>;\n\thostBindings?: HostBindingRef[];\n\thostListeners?: ListenerRef[];\n\tselector?: string;\n};\n\ntype HostNode = {\n\thost?: DomElementNode;\n\twindow?: DomElementNode;\n\ttemplate?: DomElementNode[];\n};\n\nconst DEFAULT_SHADOW_ROOT_INIT: ShadowRootInit = { mode: 'open', delegatesFocus: false, slotAssignment: 'named' };\n\nexport class Components {\n\n\tprivate static EMPTY_LIST = Object.freeze<any>([]);\n\tprivate static emptyList<T>(): T[] {\n\t\treturn Components.EMPTY_LIST as T[];\n\t}\n\n\tprivate static patchTemplate(child: DomNode, templates: DomElementNode[]): void {\n\t\tif (child instanceof DomElementNode && child.templateRefName?.name) {\n\t\t\tconst ref = templates.find(node => child.templateRefName?.name === node.templateRefName?.name);\n\t\t\tif (ref?.outputs) {\n\t\t\t\t(child.outputs ??= []).push(...ref.outputs);\n\t\t\t}\n\t\t}\n\t\tif (child instanceof DomParentNode) {\n\t\t\tchild.children?.forEach(node => Components.patchTemplate(node, templates));\n\t\t}\n\t}\n\n\tprivate static createOutputs(Listeners?: ListenerRef[]) {\n\t\treturn Listeners?.map(\n\t\t\tlistener => `(${listener.eventName})=\"${listener.modelCallbackName}(${listener.args.join(', ')})\"`\n\t\t).join(' ') ?? ''\n\t}\n\n\tprivate static parseHostNode(option: ViewBindingOption): HostNode {\n\t\tconst inputs = option.hostBindings?.map(binding => {\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(option.prototype, binding.modelPropertyName);\n\t\t\tif (typeof descriptor?.value === 'function') {\n\t\t\t\treturn `[${binding.hostPropertyName}]=\"${binding.modelPropertyName}()\"`\n\t\t\t}\n\t\t\treturn `[${binding.hostPropertyName}]=\"${binding.modelPropertyName}\"`;\n\t\t}).join(' ') ?? '';\n\n\t\tconst hostListeners: ListenerRef[] = [];\n\t\tconst windowListeners: ListenerRef[] = [];\n\t\tconst templateListeners: Record<string, ListenerRef[]> = {};\n\n\t\toption.hostListeners?.forEach(listener => {\n\t\t\tconst [host, event] = listener.eventName.split(':', 2);\n\t\t\tif (event === undefined) {\n\t\t\t\thostListeners.push(listener);\n\t\t\t} else if ('window' === host.toLowerCase()) {\n\t\t\t\twindowListeners.push(new ListenerRef(event, listener.args, listener.modelCallbackName));\n\t\t\t} else {\n\t\t\t\t(templateListeners[host] ??= []).push(new ListenerRef(event, listener.args, listener.modelCallbackName));\n\t\t\t}\n\t\t});\n\n\t\tconst result: HostNode = {};\n\n\t\tif (hostListeners.length) {\n\t\t\tconst hostOutputs = Components.createOutputs(hostListeners);\n\t\t\tconst selector = option.selector ?? 'div';\n\t\t\tconst hostTemplate = `<${selector} ${inputs} ${hostOutputs}></${selector}>`;\n\t\t\tresult.host = htmlParser.toDomRootNode(hostTemplate) as DomElementNode;\n\t\t\tbuildExpressionNodes(result.host);\n\t\t}\n\n\t\tif (windowListeners.length) {\n\t\t\tconst windowOutputs = Components.createOutputs(windowListeners);\n\t\t\tconst windowTemplate = `<window ${windowOutputs}></window>`;\n\t\t\tresult.window = htmlParser.toDomRootNode(windowTemplate) as DomElementNode;\n\t\t\tbuildExpressionNodes(result.window);\n\t\t}\n\n\t\tconst templateHosts = Object.keys(templateListeners);\n\t\tif (templateHosts.length) {\n\t\t\tconst template = templateHosts.map(host => {\n\t\t\t\tconst hostOutputs = Components.createOutputs(templateListeners[host]);\n\t\t\t\treturn `<template #${host} ${hostOutputs}></template>`;\n\t\t\t}).join('');\n\t\t\tconst templateNodes = htmlParser.toDomRootNode(template) as DomElementNode | DomFragmentNode;\n\t\t\tbuildExpressionNodes(templateNodes);\n\t\t\tresult.template = templateNodes instanceof DomFragmentNode\n\t\t\t\t? templateNodes.children?.filter(child => child instanceof DomElementNode) as DomElementNode[] ?? []\n\t\t\t\t: [templateNodes];\n\t\t}\n\t\treturn result;\n\t}\n\n\tstatic defineDirective(modelClass: MetadataClass, opts: DirectiveOptions, metadata: MetadataContext) {\n\t\tObject.assign(metadata, opts);\n\t\tif (metadata.hostListeners?.length || metadata.hostBindings?.length) {\n\t\t\tconst hostNode = Components.parseHostNode({\n\t\t\t\tprototype: modelClass.prototype,\n\t\t\t\thostBindings: metadata.hostBindings,\n\t\t\t\thostListeners: metadata.hostListeners,\n\t\t\t});\n\t\t\tmetadata.viewBindings = hostNode.host;\n\t\t}\n\t\tmetadata.modelClass = modelClass;\n\t\tClassRegistryProvider.registerDirective(modelClass);\n\t\tdirectiveRegistry.register(opts.selector, {\n\t\t\tinputs: (metadata.inputs as PropertyRef[])?.map(input => input.viewAttribute),\n\t\t\toutputs: (metadata.outputs as PropertyRef[])?.map(output => output.viewAttribute),\n\t\t});\n\t}\n\n\tstatic definePipe<T extends Class>(modelClass: MetadataClass<T>, opts: PipeOptions, metadata: MetadataContext) {\n\t\tObject.assign(metadata, opts);\n\t\tmetadata.modelClass = modelClass;\n\t\tClassRegistryProvider.registerPipe(modelClass);\n\t}\n\n\tstatic defineService<T extends Class>(modelClass: MetadataClass<T>, opts: ServiceOptions, metadata: MetadataContext) {\n\t\tObject.assign(metadata, opts);\n\t\tmetadata.modelClass = modelClass;\n\t\tmetadata.name = modelClass.name;\n\t\tClassRegistryProvider.registerService(modelClass);\n\t}\n\n\tstatic defineComponent<T extends Class>(modelClass: MetadataClass<T>, opts: ComponentOptions<T>, metadata: MetadataContext) {\n\t\tconst componentRef = Object.assign(metadata, opts) as any as ComponentRef<T>;\n\t\tcomponentRef.extend = findByTagName(opts.extend);\n\t\tcomponentRef.extendCustomElement = !!opts.extend && isValidCustomElementName(opts.extend);\n\n\t\tif (typeof componentRef.template === 'string') {\n\t\t\tif (componentRef.styles) {\n\t\t\t\tconst template = `<style>${componentRef.styles}</style>${componentRef.template}`;\n\t\t\t\tcomponentRef.template = htmlParser.toDomRootNode(template);\n\t\t\t} else {\n\t\t\t\tcomponentRef.template = htmlParser.toDomRootNode(componentRef.template);\n\t\t\t}\n\t\t\tbuildExpressionNodes(componentRef.template);\n\t\t} else if (typeof componentRef.template === 'object') {\n\t\t\tbuildExpressionNodes(componentRef.template);\n\t\t} else if (typeof componentRef.compiledTemplate === 'object') {\n\t\t\thtmlParser.deserializeNode(componentRef.compiledTemplate);\n\t\t\tdeserializeExpressionNodes(componentRef.compiledTemplate);\n\t\t\tcomponentRef.template = componentRef.compiledTemplate;\n\t\t\tcomponentRef.compiledTemplate = undefined;\n\t\t}\n\n\t\tif (!componentRef.template && /template/g.test(componentRef.encapsulation)) {\n\t\t\tconst template = document.querySelector('#' + componentRef.selector);\n\t\t\tif (template && template instanceof HTMLTemplateElement) {\n\t\t\t\tcomponentRef.template = templateParser.parse(template);\n\t\t\t\tbuildExpressionNodes(componentRef.template);\n\t\t\t} else {\n\t\t\t\t// didn't find this template in 'index.html' document\n\t\t\t}\n\t\t}\n\n\t\tcomponentRef.inputs ||= Components.emptyList();\n\t\tcomponentRef.outputs ||= Components.emptyList();\n\t\tcomponentRef.viewChild ||= Components.emptyList();\n\t\tcomponentRef.ViewChildren ||= Components.emptyList();\n\t\tcomponentRef.hostBindings ||= Components.emptyList();\n\t\tcomponentRef.hostListeners ||= Components.emptyList();\n\t\tcomponentRef.encapsulation ||= 'custom';\n\t\tcomponentRef.isShadowDom = /shadow/g.test(componentRef.encapsulation);\n\t\tif (componentRef.isShadowDom) {\n\t\t\tcomponentRef.shadowRootInit = Object.assign({}, DEFAULT_SHADOW_ROOT_INIT, (componentRef.shadowRootInit ?? {}));\n\t\t}\n\n\t\tif (componentRef.hostListeners.length || componentRef.hostBindings.length) {\n\t\t\tconst hostNode = Components.parseHostNode({\n\t\t\t\tprototype: modelClass.prototype,\n\t\t\t\tselector: componentRef.selector,\n\t\t\t\thostBindings: componentRef.hostBindings,\n\t\t\t\thostListeners: componentRef.hostListeners,\n\t\t\t});\n\t\t\tcomponentRef.viewBindings = hostNode.host;\n\t\t\tcomponentRef.windowBindings = hostNode.window;\n\n\t\t\tif (typeof componentRef.template === 'function') {\n\t\t\t\tconst creator = componentRef.template;\n\t\t\t\tcomponentRef.template = (model: T) => {\n\t\t\t\t\tconst template = creator(model);\n\t\t\t\t\tif (hostNode.template) {\n\t\t\t\t\t\tComponents.patchTemplate(template, hostNode.template);\n\t\t\t\t\t}\n\t\t\t\t\treturn template;\n\t\t\t\t};\n\t\t\t} else if (hostNode.template) {\n\t\t\t\tComponents.patchTemplate(componentRef.template, hostNode.template);\n\t\t\t}\n\n\t\t}\n\n\t\tif (!(componentRef.formAssociated === true || typeof componentRef.formAssociated === 'function')) {\n\t\t\tcomponentRef.formAssociated = false;\n\t\t}\n\n\t\tif (componentRef.isShadowDom && componentRef.extend.name) {\n\t\t\tcomponentRef.isShadowDom = canAttachShadow(componentRef.extend.name);\n\t\t}\n\n\t\tcomponentRef.modelClass = modelClass;\n\t\tcomponentRef.viewClass = initCustomElementView(modelClass, componentRef);\n\n\t\tClassRegistryProvider.registerComponent(modelClass);\n\t\tClassRegistryProvider.registerView(componentRef.viewClass);\n\n\t\tconst options: ElementDefinitionOptions = {};\n\t\tconst parentTagName = componentRef.extend?.name;\n\t\tif (parentTagName) {\n\t\t\tif (parentTagName !== '!' && parentTagName.indexOf('-') === -1) {\n\t\t\t\toptions.extends = parentTagName;\n\t\t\t}\n\t\t}\n\n\n\t\tcustomElements.define(\n\t\t\tcomponentRef.selector as string,\n\t\t\tcomponentRef.viewClass as CustomElementConstructor,\n\t\t\toptions\n\t\t);\n\n\t}\n\n\tstatic defineView<T extends HTMLElement>(viewClass: MetadataClass<T>, opt: { selector: string } & ElementDefinitionOptions) {\n\t\tClassRegistryProvider.registerView(viewClass);\n\t\tconst { selector, ...definition } = opt;\n\t\tcustomElements.define(\n\t\t\tselector,\n\t\t\tviewClass,\n\t\t\tdefinition,\n\t\t);\n\t}\n\n}\n"]}
@@ -22,9 +22,6 @@ export interface BaseComponent<T> extends CustomElement {
22
22
  }>;
23
23
  _zone: AuroraZone;
24
24
  getComponentRef(): ComponentRef<T>;
25
- setParentComponent<V extends object>(parent: HTMLComponent<V>): void;
26
- getParentComponent<V extends object>(): HTMLComponent<V>;
27
- hasParentComponent(): boolean;
28
25
  hasInputStartWith(viewProp: string): boolean;
29
26
  getInputStartWith(viewProp: string): PropertyRef | undefined;
30
27
  getInput(viewProp: string): PropertyRef | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"custom-element.d.ts","sourceRoot":"","sources":["../../../src/core/component/custom-element.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,WAAW,aAAa;IAC7B,eAAe,IAAI,IAAI,CAAC;IACxB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,GAAG,IAAI,CAAC;IAC3E,iBAAiB,IAAI,IAAI,CAAC;IAC1B,oBAAoB,IAAI,IAAI,CAAC;CAC7B;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;AAEvC,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;IAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC;AAE9D,MAAM,WAAW,aAAa,CAAC,CAAC,CAAE,SAAQ,aAAa;IAEtD,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACrB,WAAW,EAAE,oBAAoB,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;IAE/C,UAAU,EAAE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I,CAAC;CAChB;AAED,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,mBAAmB,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAGzJ,MAAM,WAAW,iBAAiB,CAAC,CAAC;IACnC,QAAO,CAAC,CAAC;IACT,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;CACtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"custom-element.js","sourceRoot":"","sources":["../../../src/core/component/custom-element.ts"],"names":[],"mappings":"AAwDA,MAAM,UAAU,eAAe,CAAC,MAAW;IAC1C,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC;WAChC,MAAM,YAAY,WAAW,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAmB,MAAW,EAAE,SAAoB;IACxF,OAAO,eAAe,CAAC,MAAM,CAAC;WAC1B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,SAAS,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAoB;IACjD,OAAO,OAAO,IAAI,OAAO,YAAY,WAAW,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;AACrF,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,OAAoB;IACxD,OAAO,OAAO,IAAI,OAAO,YAAY,kBAAkB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC5F,CAAC;AAqHD,MAAM,UAAU,cAAc,CAAC,GAAQ;IACtC,OAAO,GAAG;WACN,OAAO,GAAG,KAAK,QAAQ;WACvB,OAAO,GAAG,CAAC,UAAU,KAAK,UAAU;WACpC,OAAO,GAAG,CAAC,gBAAgB,KAAK,UAAU,CAAC;AAChD,CAAC","sourcesContent":["import type { ReactiveScope, ReactiveScopeControl, Context } from '@ibyar/expressions';\nimport type { TypeOf } from '../utils/typeof.js';\nimport { EventEmitter } from './events.js';\nimport { ComponentRef } from './component.js';\nimport { AuroraZone } from '../zone/zone.js';\nimport { PropertyRef } from './reflect.js';\n\nexport interface CustomElement {\n\tadoptedCallback(): void;\n\tattributeChangedCallback(name: string, oldValue: any, newValue: any): void;\n\tconnectedCallback(): void;\n\tdisconnectedCallback(): void;\n}\n\nexport type ModelType<T> = T & Context;\n\nexport type NodeContextType<T> = { 'this': BaseComponent<T> };\n\nexport interface BaseComponent<T> extends CustomElement {\n\n\t_model: ModelType<T>;\n\t_modelScope: ReactiveScopeControl<T & Context>;\n\n\t_viewScope: ReactiveScope<{ 'this': BaseComponent<T> }>;\n\t_zone: AuroraZone;\n\n\tgetComponentRef(): ComponentRef<T>;\n\n\tsetParentComponent<V extends object>(parent: HTMLComponent<V>): void;\n\tgetParentComponent<V extends object>(): HTMLComponent<V>;\n\thasParentComponent(): boolean;\n\n\thasInputStartWith(viewProp: string): boolean;\n\tgetInputStartWith(viewProp: string): PropertyRef | undefined;\n\tgetInput(viewProp: string): PropertyRef | undefined;\n\tgetInputValue(viewProp: string): any;\n\tsetInputValue(viewProp: string, value: any): void;\n\n\thasInput(viewProp: string): boolean;\n\thasProp(propName: string): boolean;\n\thasOutput(viewProp: string): boolean;\n\n\tgetOutput(viewProp: string): PropertyRef | undefined;\n\tgetEventEmitter<V>(viewProp: string): EventEmitter<V> | undefined;\n\n\ttriggerOutput(eventName: string, value?: any): void;\n\tonDestroy(callback: () => void): void;\n\n\t/**\n\t * apply change detection\n\t */\n\tdetectChanges(): void;\n}\n\nexport interface HTMLComponent<T> extends BaseComponent<T>, HTMLElement { }\n\nexport function isHTMLComponent(object: any): object is HTMLComponent<any> {\n\treturn Reflect.has(object, '_model')\n\t\t&& object instanceof HTMLElement;\n}\n\nexport function isHTMLComponentOfType<T extends object>(object: any, typeClass: TypeOf<T>): object is HTMLComponent<T> {\n\treturn isHTMLComponent(object)\n\t\t&& Reflect.get(object, '_model') instanceof typeClass;\n}\n\nexport function isHTMLElement(element: HTMLElement): element is HTMLElement {\n\treturn element && element instanceof HTMLElement && !element.tagName?.includes('-');\n}\n\nexport function isHTMLUnknownElement(element: HTMLElement): element is HTMLElement {\n\treturn element && element instanceof HTMLUnknownElement && !element.tagName?.includes('-');\n}\n\n/**\n * Lifecycle callbacks\n * A map, whose keys are the strings \"connectedCallback\", \"disconnectedCallback\", \"adoptedCallback\", \"attributeChangedCallback\", \n * \"formAssociatedCallback\", \"formDisabledCallback\", \"formResetCallback\", and \"formStateRestoreCallback\" \n * https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-lifecycle-callbacks\n * \n * A form-associated custom element API includes a set of extra lifecycle callbacks to tie in to the form lifecycle.\n * The callbacks are optional: only implement a callback if your element needs to do something at that point in the lifecycle.\n * https://html.spec.whatwg.org/multipage/custom-elements.html#the-elementinternals-interface \n * https://docs.google.com/document/d/1JO8puctCSpW-ZYGU8lF-h4FWRIDQNDVexzHoOQ2iQmY/edit\n */\nexport interface FormAssociatedCustomElement extends CustomElement {\n\n\t/**\n\t * Called when the browser associates the element with a form element,\n\t * or disassociates the element from a form element.\n\t * @param form \n\t */\n\tformAssociatedCallback(form: HTMLFormElement | null): void;\n\n\t/**\n\t * Called after the disabled state of the element changes,\n\t * either because the disabled attribute of this element was added or removed;\n\t * or because the disabled state changed on a <fieldset> that's an ancestor of this element.\n\t * The disabled parameter represents the new disabled state of the element.\n\t * The element may, for example, disable elements in its shadow DOM when it is disabled.\n\t * @param disabled \n\t */\n\tformDisabledCallback(disabled: boolean): void;\n\n\t/**\n\t * Called after the form is reset.\n\t * The element should reset itself to some kind of default state.\n\t * For <input> elements, this usually involves setting the value property to\n\t * match the value attribute set in markup (or in the case of a checkbox,\n\t * setting the checked property to match the checked attribute.\n\t */\n\tformResetCallback(): void;\n\n\t/**\n\t * Called in one of two circumstances:\n\t * When the browser restores the state of the element (for example, after a navigation, or when the browser restarts).\n\t * The mode argument is \"restore\" in this case.\n\t * \n\t * When the browser's input-assist features such as form auto filling sets a value.\n\t * The mode argument is \"autocomplete\" in this case.\n\t * \n\t * The type of the first argument depends on how the setFormValue() method was called.\n\t * For more details, see Restoring form state.\n\t */\n\tformStateRestoreCallback(value: any, mode: 'restore' | 'autocomplete'): void;\n}\n\nexport type WriteValueMode = 'restore' | 'autocomplete' | 'reset';\n\nexport type WriteValueOptions<T> = { value: T | null, mode?: 'restore' | 'autocomplete' } | { value?: undefined, mode: 'reset' };\n\n\nexport interface ValueControl<T = any> {\n\t/**\n\t * reset the value of the\n\t * @param value \n\t * @param mode \n\t */\n\twriteValue(opt: { value?: undefined, mode: 'reset' }): void;\n\n\t/**\n\t * \n\t * When the browser restores the state of the element (for example, after a navigation, or when the browser restarts).\n\t * The mode argument is \"restore\" in this case.\n\t * \n\t * When the browser's input-assist features such as form auto filling sets a value.\n\t * The mode argument is \"autocomplete\" in this case.\n\t * \n\t * @param opt: options contain the `value` to be written and `mode` represented by `restore` or `autocomplete` or `undefined`\n\t */\n\n\twriteValue(opt: { value: T | null, mode?: 'restore' | 'autocomplete' }): void;\n\n\twriteValue(opt: { value?: T | null, mode?: WriteValueMode }): void;\n\n\twriteValue(opt: WriteValueOptions<T>): void;\n\n\t/**\n\t * This method is called when new `ValueControl` assigned to the form associated element.\n\t * \n\t * When implementing the registerOnChange method in your own value accessor, save the given function so your class calls it at the appropriate time.\n\t * \n\t * ```ts\n\t * registerOnChange(fn: (_: any) => void): void {\n\t * \tthis._onChange = fn;\n\t * }\n\t * ```\n\t * \n\t * When the value changes in the UI, call the registered function to allow the forms API to update itself:\n\t * \n\t * ```ts\n\t * \n\t * onChange(event: Event){\n\t * \t\n\t * }\n\t * \n\t * ```\n\t * @param fn the function to be called when a control want to change the value of a form associated element.\n\t */\n\n\tregisterOnChange(fn: (value?: T | null) => void): void;\n\n\t/**\n\t * called when `disabled` attribute change.\n\t * @param isDisabled \n\t */\n\tsetDisabledState?(isDisabled: boolean): void;\n}\n\nexport function isValueControl(obj: any): obj is ValueControl {\n\treturn obj\n\t\t&& typeof obj === 'object'\n\t\t&& typeof obj.writeValue === 'function'\n\t\t&& typeof obj.registerOnChange === 'function';\n}\n\nexport interface BaseFormAssociatedComponent<T extends Object> extends BaseComponent<T>, FormAssociatedCustomElement {\n\treadonly internals: ElementInternals;\n\treadonly form: HTMLFormElement | null;\n\treadonly valueControl?: ValueControl<T>;\n\n\tregisterValueControl(valueControl: ValueControl): void;\n}\n\nexport interface FormAssociatedComponent<T extends Object, V = any> extends BaseFormAssociatedComponent<T>, HTMLComponent<T> {\n\n\tvalue: V | null;\n}\n\nexport type HTMLFormElement = HTMLButtonElement | HTMLDataListElement | HTMLFieldSetElement | HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\n\n\nexport interface ConstructorOfView<T> {\n\tnew(): T;\n\treadonly prototype: T;\n}\n"]}
1
+ {"version":3,"file":"custom-element.js","sourceRoot":"","sources":["../../../src/core/component/custom-element.ts"],"names":[],"mappings":"AAoDA,MAAM,UAAU,eAAe,CAAC,MAAW;IAC1C,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC;WAChC,MAAM,YAAY,WAAW,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAmB,MAAW,EAAE,SAAoB;IACxF,OAAO,eAAe,CAAC,MAAM,CAAC;WAC1B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,SAAS,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAoB;IACjD,OAAO,OAAO,IAAI,OAAO,YAAY,WAAW,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;AACrF,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,OAAoB;IACxD,OAAO,OAAO,IAAI,OAAO,YAAY,kBAAkB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC5F,CAAC;AAqHD,MAAM,UAAU,cAAc,CAAC,GAAQ;IACtC,OAAO,GAAG;WACN,OAAO,GAAG,KAAK,QAAQ;WACvB,OAAO,GAAG,CAAC,UAAU,KAAK,UAAU;WACpC,OAAO,GAAG,CAAC,gBAAgB,KAAK,UAAU,CAAC;AAChD,CAAC","sourcesContent":["import type { ReactiveScope, ReactiveScopeControl, Context } from '@ibyar/expressions';\nimport type { TypeOf } from '../utils/typeof.js';\nimport { EventEmitter } from './events.js';\nimport { ComponentRef } from './component.js';\nimport { AuroraZone } from '../zone/zone.js';\nimport { PropertyRef } from './reflect.js';\n\nexport interface CustomElement {\n\tadoptedCallback(): void;\n\tattributeChangedCallback(name: string, oldValue: any, newValue: any): void;\n\tconnectedCallback(): void;\n\tdisconnectedCallback(): void;\n}\n\nexport type ModelType<T> = T & Context;\n\nexport type NodeContextType<T> = { 'this': BaseComponent<T> };\n\nexport interface BaseComponent<T> extends CustomElement {\n\n\t_model: ModelType<T>;\n\t_modelScope: ReactiveScopeControl<T & Context>;\n\n\t_viewScope: ReactiveScope<{ 'this': BaseComponent<T> }>;\n\t_zone: AuroraZone;\n\n\tgetComponentRef(): ComponentRef<T>;\n\n\thasInputStartWith(viewProp: string): boolean;\n\tgetInputStartWith(viewProp: string): PropertyRef | undefined;\n\tgetInput(viewProp: string): PropertyRef | undefined;\n\tgetInputValue(viewProp: string): any;\n\tsetInputValue(viewProp: string, value: any): void;\n\n\thasInput(viewProp: string): boolean;\n\thasProp(propName: string): boolean;\n\thasOutput(viewProp: string): boolean;\n\n\tgetOutput(viewProp: string): PropertyRef | undefined;\n\tgetEventEmitter<V>(viewProp: string): EventEmitter<V> | undefined;\n\n\ttriggerOutput(eventName: string, value?: any): void;\n\tonDestroy(callback: () => void): void;\n\n\t/**\n\t * apply change detection\n\t */\n\tdetectChanges(): void;\n}\n\nexport interface HTMLComponent<T> extends BaseComponent<T>, HTMLElement { }\n\nexport function isHTMLComponent(object: any): object is HTMLComponent<any> {\n\treturn Reflect.has(object, '_model')\n\t\t&& object instanceof HTMLElement;\n}\n\nexport function isHTMLComponentOfType<T extends object>(object: any, typeClass: TypeOf<T>): object is HTMLComponent<T> {\n\treturn isHTMLComponent(object)\n\t\t&& Reflect.get(object, '_model') instanceof typeClass;\n}\n\nexport function isHTMLElement(element: HTMLElement): element is HTMLElement {\n\treturn element && element instanceof HTMLElement && !element.tagName?.includes('-');\n}\n\nexport function isHTMLUnknownElement(element: HTMLElement): element is HTMLElement {\n\treturn element && element instanceof HTMLUnknownElement && !element.tagName?.includes('-');\n}\n\n/**\n * Lifecycle callbacks\n * A map, whose keys are the strings \"connectedCallback\", \"disconnectedCallback\", \"adoptedCallback\", \"attributeChangedCallback\", \n * \"formAssociatedCallback\", \"formDisabledCallback\", \"formResetCallback\", and \"formStateRestoreCallback\" \n * https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-lifecycle-callbacks\n * \n * A form-associated custom element API includes a set of extra lifecycle callbacks to tie in to the form lifecycle.\n * The callbacks are optional: only implement a callback if your element needs to do something at that point in the lifecycle.\n * https://html.spec.whatwg.org/multipage/custom-elements.html#the-elementinternals-interface \n * https://docs.google.com/document/d/1JO8puctCSpW-ZYGU8lF-h4FWRIDQNDVexzHoOQ2iQmY/edit\n */\nexport interface FormAssociatedCustomElement extends CustomElement {\n\n\t/**\n\t * Called when the browser associates the element with a form element,\n\t * or disassociates the element from a form element.\n\t * @param form \n\t */\n\tformAssociatedCallback(form: HTMLFormElement | null): void;\n\n\t/**\n\t * Called after the disabled state of the element changes,\n\t * either because the disabled attribute of this element was added or removed;\n\t * or because the disabled state changed on a <fieldset> that's an ancestor of this element.\n\t * The disabled parameter represents the new disabled state of the element.\n\t * The element may, for example, disable elements in its shadow DOM when it is disabled.\n\t * @param disabled \n\t */\n\tformDisabledCallback(disabled: boolean): void;\n\n\t/**\n\t * Called after the form is reset.\n\t * The element should reset itself to some kind of default state.\n\t * For <input> elements, this usually involves setting the value property to\n\t * match the value attribute set in markup (or in the case of a checkbox,\n\t * setting the checked property to match the checked attribute.\n\t */\n\tformResetCallback(): void;\n\n\t/**\n\t * Called in one of two circumstances:\n\t * When the browser restores the state of the element (for example, after a navigation, or when the browser restarts).\n\t * The mode argument is \"restore\" in this case.\n\t * \n\t * When the browser's input-assist features such as form auto filling sets a value.\n\t * The mode argument is \"autocomplete\" in this case.\n\t * \n\t * The type of the first argument depends on how the setFormValue() method was called.\n\t * For more details, see Restoring form state.\n\t */\n\tformStateRestoreCallback(value: any, mode: 'restore' | 'autocomplete'): void;\n}\n\nexport type WriteValueMode = 'restore' | 'autocomplete' | 'reset';\n\nexport type WriteValueOptions<T> = { value: T | null, mode?: 'restore' | 'autocomplete' } | { value?: undefined, mode: 'reset' };\n\n\nexport interface ValueControl<T = any> {\n\t/**\n\t * reset the value of the\n\t * @param value \n\t * @param mode \n\t */\n\twriteValue(opt: { value?: undefined, mode: 'reset' }): void;\n\n\t/**\n\t * \n\t * When the browser restores the state of the element (for example, after a navigation, or when the browser restarts).\n\t * The mode argument is \"restore\" in this case.\n\t * \n\t * When the browser's input-assist features such as form auto filling sets a value.\n\t * The mode argument is \"autocomplete\" in this case.\n\t * \n\t * @param opt: options contain the `value` to be written and `mode` represented by `restore` or `autocomplete` or `undefined`\n\t */\n\n\twriteValue(opt: { value: T | null, mode?: 'restore' | 'autocomplete' }): void;\n\n\twriteValue(opt: { value?: T | null, mode?: WriteValueMode }): void;\n\n\twriteValue(opt: WriteValueOptions<T>): void;\n\n\t/**\n\t * This method is called when new `ValueControl` assigned to the form associated element.\n\t * \n\t * When implementing the registerOnChange method in your own value accessor, save the given function so your class calls it at the appropriate time.\n\t * \n\t * ```ts\n\t * registerOnChange(fn: (_: any) => void): void {\n\t * \tthis._onChange = fn;\n\t * }\n\t * ```\n\t * \n\t * When the value changes in the UI, call the registered function to allow the forms API to update itself:\n\t * \n\t * ```ts\n\t * \n\t * onChange(event: Event){\n\t * \t\n\t * }\n\t * \n\t * ```\n\t * @param fn the function to be called when a control want to change the value of a form associated element.\n\t */\n\n\tregisterOnChange(fn: (value?: T | null) => void): void;\n\n\t/**\n\t * called when `disabled` attribute change.\n\t * @param isDisabled \n\t */\n\tsetDisabledState?(isDisabled: boolean): void;\n}\n\nexport function isValueControl(obj: any): obj is ValueControl {\n\treturn obj\n\t\t&& typeof obj === 'object'\n\t\t&& typeof obj.writeValue === 'function'\n\t\t&& typeof obj.registerOnChange === 'function';\n}\n\nexport interface BaseFormAssociatedComponent<T extends Object> extends BaseComponent<T>, FormAssociatedCustomElement {\n\treadonly internals: ElementInternals;\n\treadonly form: HTMLFormElement | null;\n\treadonly valueControl?: ValueControl<T>;\n\n\tregisterValueControl(valueControl: ValueControl): void;\n}\n\nexport interface FormAssociatedComponent<T extends Object, V = any> extends BaseFormAssociatedComponent<T>, HTMLComponent<T> {\n\n\tvalue: V | null;\n}\n\nexport type HTMLFormElement = HTMLButtonElement | HTMLDataListElement | HTMLFieldSetElement | HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\n\n\nexport interface ConstructorOfView<T> {\n\tnew(): T;\n\treadonly prototype: T;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { MetadataClass, MetadataContext } from '@ibyar/decorators';
1
+ import { type MetadataClass, type MetadataContext } from '@ibyar/decorators';
2
2
  import type { ChildOptions, OutputEventInit } from '../annotation/options.js';
3
3
  export declare class PropertyRef {
4
4
  modelProperty: string;
@@ -39,7 +39,7 @@ export interface BootstrapMetadata {
39
39
  [key: string]: any;
40
40
  }
41
41
  export declare class ReflectComponents {
42
- static getMetaDate(constructor: MetadataClass): Record<PropertyKey, any>;
42
+ static getMetaDate(constructor: MetadataClass): Record<any, any> | undefined;
43
43
  static addInput(metadata: MetadataContext, modelName: string, viewName: string): void;
44
44
  static addOutput(metadata: MetadataContext, modelName: string, viewName: string, options: OutputEventInit): void;
45
45
  static setComponentView(metadata: MetadataContext, modelName: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"reflect.d.ts","sourceRoot":"","sources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AAe,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe;IAIzG,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM;IAIpE,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,WAAW,GAAG,wBAAwB,EAAE,YAAY,CAAC,EAAE,YAAY;IAI/J,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,WAAW,GAAG,wBAAwB;IAIrI,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IAIxG,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM;CAG9F"}
@@ -1,3 +1,4 @@
1
+ import { metadataHoler } from '@ibyar/decorators';
1
2
  export class PropertyRef {
2
3
  modelProperty;
3
4
  _viewName;
@@ -48,7 +49,7 @@ export class HostBindingRef {
48
49
  }
49
50
  export class ReflectComponents {
50
51
  static getMetaDate(constructor) {
51
- return constructor[Symbol.metadata];
52
+ return metadataHoler.get(constructor[Symbol.metadata]);
52
53
  }
53
54
  static addInput(metadata, modelName, viewName) {
54
55
  (metadata.inputs ??= []).push(new InputPropertyRef(modelName, viewName));
@@ -1 +1 @@
1
- {"version":3,"file":"reflect.js","sourceRoot":"","sources":["../../../src/core/component/reflect.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,WAAW;IACJ;IAAiC;IAApD,YAAmB,aAAqB,EAAY,SAAkB;QAAnD,kBAAa,GAAb,aAAa,CAAQ;QAAY,cAAS,GAAT,SAAS,CAAS;I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, MetadataContext } from '@ibyar/decorators';\nimport type { ChildOptions, OutputEventInit } from '../annotation/options.js';\n\nexport class PropertyRef {\n\tconstructor(public modelProperty: string, protected _viewName?: string) { }\n\tget viewAttribute(): string {\n\t\treturn this._viewName || this.modelProperty;\n\t}\n}\n\nexport class InputPropertyRef extends PropertyRef {\n\n}\n\nexport class OutputPropertyRef extends PropertyRef {\n\tconstructor(modelProperty: string, viewName?: string, public options?: OutputEventInit) {\n\t\tsuper(modelProperty, viewName);\n\t}\n}\n\nexport class ChildRef {\n\tconstructor(\n\t\tpublic modelName: string,\n\t\tpublic selector: string | { new(): HTMLElement; prototype: HTMLElement } | CustomElementConstructor,\n\t\tpublic childOptions?: ChildOptions\n\t) { }\n}\n\nexport class ListenerRef {\n\tconstructor(public eventName: string, public args: string[], public modelCallbackName: string) { }\n}\n\nexport class HostBindingRef {\n\tconstructor(public modelPropertyName: string, public hostPropertyName: string) { }\n}\n\nexport interface BootstrapMetadata {\n\t[key: string]: any;\n}\n\n\nexport class ReflectComponents {\n\n\tstatic getMetaDate(constructor: MetadataClass) {\n\t\treturn constructor[Symbol.metadata];\n\t}\n\n\tstatic addInput(metadata: MetadataContext, modelName: string, viewName: string) {\n\t\t(metadata.inputs ??= []).push(new InputPropertyRef(modelName, viewName));\n\t}\n\n\tstatic addOutput(metadata: MetadataContext, modelName: string, viewName: string, options: OutputEventInit) {\n\t\t(metadata.outputs ??= []).push(new OutputPropertyRef(modelName, viewName, options));\n\t}\n\n\tstatic setComponentView(metadata: MetadataContext, modelName: string) {\n\t\tmetadata.view = modelName;\n\t}\n\n\tstatic addViewChild(metadata: MetadataContext, modelName: string, selector: string | typeof HTMLElement | CustomElementConstructor, childOptions?: ChildOptions) {\n\t\t(metadata.viewChild ??= []).push(new ChildRef(modelName, selector, childOptions));\n\t}\n\n\tstatic addViewChildren(metadata: MetadataContext, modelName: string, selector: string | typeof HTMLElement | CustomElementConstructor) {\n\t\t(metadata.ViewChildren ??= []).push(new ChildRef(modelName, selector));\n\t}\n\n\tstatic addHostListener(metadata: MetadataContext, propertyKey: string, eventName: string, args: string[]) {\n\t\t(metadata.hostListeners ??= []).push(new ListenerRef(eventName, args, propertyKey));\n\t}\n\n\tstatic addHostBinding(metadata: MetadataContext, propertyKey: string, hostPropertyName: string) {\n\t\t(metadata.hostBindings ??= []).push(new HostBindingRef(propertyKey, hostPropertyName));\n\t}\n}\n"]}
1
+ {"version":3,"file":"reflect.js","sourceRoot":"","sources":["../../../src/core/component/reflect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4C,MAAM,mBAAmB,CAAC;AAG5F,MAAM,OAAO,WAAW;IACJ;IAAiC;IAApD,YAAmB,aAAqB,EAAY,SAAkB;QAAnD,kBAAa,GAAb,aAAa,CAAQ;QAAY,cAAS,GAAT,SAAS,CAAS;IAAI,CAAC;IAC3E,IAAI,aAAa;QAChB,OAAO,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,aAAa,CAAC;IAC7C,CAAC;CACD;AAED,MAAM,OAAO,gBAAiB,SAAQ,WAAW;CAEhD;AAED,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IACY;IAA7D,YAAY,aAAqB,EAAE,QAAiB,EAAS,OAAyB;QACrF,KAAK,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;QAD6B,YAAO,GAAP,OAAO,CAAkB;IAEtF,CAAC;CACD;AAED,MAAM,OAAO,QAAQ;IAEZ;IACA;IACA;IAHR,YACQ,SAAiB,EACjB,QAA4F,EAC5F,YAA2B;QAF3B,cAAS,GAAT,SAAS,CAAQ;QACjB,aAAQ,GAAR,QAAQ,CAAoF;QAC5F,iBAAY,GAAZ,YAAY,CAAe;IAC/B,CAAC;CACL;AAED,MAAM,OAAO,WAAW;IACJ;IAA0B;IAAuB;IAApE,YAAmB,SAAiB,EAAS,IAAc,EAAS,iBAAyB;QAA1E,cAAS,GAAT,SAAS,CAAQ;QAAS,SAAI,GAAJ,IAAI,CAAU;QAAS,sBAAiB,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AAE,CAAC,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,CAAC,eAAe,CAAC,QAAyB,EAAE,WAAmB,EAAE,SAAiB,EAAE,IAAc;QACvG,CAAC,QAAQ,CAAC,aAAa,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;IACrF,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,QAAyB,EAAE,WAAmB,EAAE,gBAAwB;QAC7F,CAAC,QAAQ,CAAC,YAAY,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,CAAC;IACxF,CAAC;CACD","sourcesContent":["import { metadataHoler, type MetadataClass, type MetadataContext } from '@ibyar/decorators';\nimport type { ChildOptions, OutputEventInit } from '../annotation/options.js';\n\nexport class PropertyRef {\n\tconstructor(public modelProperty: string, protected _viewName?: string) { }\n\tget viewAttribute(): string {\n\t\treturn this._viewName || this.modelProperty;\n\t}\n}\n\nexport class InputPropertyRef extends PropertyRef {\n\n}\n\nexport class OutputPropertyRef extends PropertyRef {\n\tconstructor(modelProperty: string, viewName?: string, public options?: OutputEventInit) {\n\t\tsuper(modelProperty, viewName);\n\t}\n}\n\nexport class ChildRef {\n\tconstructor(\n\t\tpublic modelName: string,\n\t\tpublic selector: string | { new(): HTMLElement; prototype: HTMLElement } | CustomElementConstructor,\n\t\tpublic childOptions?: ChildOptions\n\t) { }\n}\n\nexport class ListenerRef {\n\tconstructor(public eventName: string, public args: string[], public modelCallbackName: string) { }\n}\n\nexport class HostBindingRef {\n\tconstructor(public modelPropertyName: string, public hostPropertyName: string) { }\n}\n\nexport interface BootstrapMetadata {\n\t[key: string]: any;\n}\n\n\nexport class ReflectComponents {\n\n\tstatic getMetaDate(constructor: MetadataClass) {\n\t\treturn metadataHoler.get(constructor[Symbol.metadata]);\n\t}\n\n\tstatic addInput(metadata: MetadataContext, modelName: string, viewName: string) {\n\t\t(metadata.inputs ??= []).push(new InputPropertyRef(modelName, viewName));\n\t}\n\n\tstatic addOutput(metadata: MetadataContext, modelName: string, viewName: string, options: OutputEventInit) {\n\t\t(metadata.outputs ??= []).push(new OutputPropertyRef(modelName, viewName, options));\n\t}\n\n\tstatic setComponentView(metadata: MetadataContext, modelName: string) {\n\t\tmetadata.view = modelName;\n\t}\n\n\tstatic addViewChild(metadata: MetadataContext, modelName: string, selector: string | typeof HTMLElement | CustomElementConstructor, childOptions?: ChildOptions) {\n\t\t(metadata.viewChild ??= []).push(new ChildRef(modelName, selector, childOptions));\n\t}\n\n\tstatic addViewChildren(metadata: MetadataContext, modelName: string, selector: string | typeof HTMLElement | CustomElementConstructor) {\n\t\t(metadata.ViewChildren ??= []).push(new ChildRef(modelName, selector));\n\t}\n\n\tstatic addHostListener(metadata: MetadataContext, propertyKey: string, eventName: string, args: string[]) {\n\t\t(metadata.hostListeners ??= []).push(new ListenerRef(eventName, args, propertyKey));\n\t}\n\n\tstatic addHostBinding(metadata: MetadataContext, propertyKey: string, hostPropertyName: string) {\n\t\t(metadata.hostBindings ??= []).push(new HostBindingRef(propertyKey, hostPropertyName));\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"view-container-ref.d.ts","sourceRoot":"","sources":["../../../src/core/linker/view-container-ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAuB,OAAO,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,UAAU,YAAY;IACrB;;OAEG;IACH,K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AAE,MAAM,GAAG,OAAO;IAO9D,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;IAU9D,kBAAkB,CAAC,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;IAKjH,eAAe,CAAC,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,CAAC;IAC1E,eAAe,CAAC,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,CAAC;IACpG,eAAe,CAAC,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,6BAA6B,GAAG,CAAC;IA0B1G,aAAa,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,qBAAqB,CAAC,CAAC,CAAC;IACzH,aAAa,CAAC,CAAC,SAAS,MAAM,+BAA+B,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,+BAA+B,CAAC,CAAC,CAAC;IAe7I,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI;IAQ1D,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI;CAS5C"}
@@ -1,6 +1,7 @@
1
1
  import { ReactiveScopeControl } from '@ibyar/expressions';
2
2
  import { EmbeddedViewRefImpl } from './view-ref.js';
3
3
  import { getComponentView } from '../view/utils.js';
4
+ import { ReflectComponents } from '../component/reflect.js';
4
5
  ;
5
6
  ;
6
7
  export class ViewContainerRef {
@@ -83,7 +84,7 @@ export class ViewContainerRefImpl extends ViewContainerRef {
83
84
  }
84
85
  else {
85
86
  const componentType = arg0;
86
- const defaultTagName = componentType[Symbol.metadata].selector;
87
+ const defaultTagName = ReflectComponents.getMetaDate(componentType)?.selector;
87
88
  const view = getComponentView(componentType, options?.selector ?? defaultTagName);
88
89
  if (!view) {
89
90
  throw new Error(`Can't find View component for class ${componentType.name}`);
@@ -1 +1 @@
1
- {"version":3,"file":"view-container-ref.js","sourceRoot":"","sources":["../../../src/core/linker/view-container-ref.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAmB,mBAAmB,EAAW,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAgBnD,CAAC;AAID,CAAC;AAMF,MAAM,OAAgB,gBAAgB;CA+IrC;AAGD,MAAM,OAAO,oBAAqB,SAAQ,gBAAgB;IAKrC;IAA0B;IAHtC,MAAM,GAA2B,EAAE,CAAC;IAG5C,YAAoB,OAAgB,EAAU,aAAsB;QACnE,KAAK,EAAE,CAAC;QADW,YAAO,GAAP,OAAO,CAAS;QAAU,kBAAa,GAAb,aAAa,CAAS;IAEpE,CAAC;IACD,IAAa,aAAa;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IACD,IAAa,MAAM;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC3B,CAAC;IACQ,KAAK;QACb,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE;gBAC9B,GAAG,CAAC,OAAO,EAAE,CAAC;aACd;YACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACtB;IACF,CAAC;IACQ,GAAG,CAAC,KAAa;QACzB,IAAI,KAAK,I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,EAAE,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACnE,OAAO,OAAO,CAAC;IAChB,CAAC;IACQ,cAAc,CAAC,IAAY,EAAE,OAAsB;QAC3D,MAAM,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,KAAK,GAAG,oBAAoB,CAAC,GAAG,CAAO,IAAI,CAAC,CAAC;QACnD,MAAM,OAAO,GAAG,IAAI,mBAAmB,CAAO,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7D,CAAC,OAAO,EAAE,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC;IACb,CAAC;IAEQ,WAAW,CAAC,KAAgB;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAyB,EAAE,CAAC,CAAC,CAAC;SAC/C;QACD,OAAO,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE;YAClC,IAAI,CAAC,MAAM,EAAE,CAAC;SACd;IACF,CAAC;CAED","sourcesContent":["import type { MetadataClass } from '@ibyar/decorators';\nimport type { TypeOf } from '../utils/typeof.js';\nimport { ReactiveScopeControl } from '@ibyar/expressions';\nimport { TemplateRef } from './template-ref.js';\nimport { EmbeddedViewRef, EmbeddedViewRefImpl, ViewRef } from './view-ref.js';\nimport { getComponentView } from '../view/utils.js';\nimport { HTMLComponent } from '../component/custom-element.js';\n\ninterface IndexOptions {\n\t/**\n\t * the index to insert the \n\t */\n\tindex?: number;\n\t/**\n\t * the default value is true\n\t */\n\tinsert?: boolean\n}\n\nexport interface ViewContainerOptions<C> extends IndexOptions {\n\tcontext?: C;\n};\n\nexport interface ViewContainerComponentOptions extends IndexOptions {\n\tselector?: string;\n};\n\nexport interface HTMLElementOptions extends ElementCreationOptions, IndexOptions {\n\n}\n\nexport abstract class ViewContainerRef {\n\n\t/**\n\t * Anchor element that specifies the location of this container in the containing view.\n\t * Each view container can have only one anchor element, and each anchor element\n\t * can have only a single view container.\n\t * \n\t * Root elements of views attached to this container become siblings of the anchor element in\n\t * the rendered view.\n\t *\n\t * Access the `ViewContainerRef` of an element by placing a `Directive` injected\n\t * with `ViewContainerRef` on the element, or use a `ViewChild` query.\n\t *\n\t */\n\tabstract get anchorElement(): Element;\n\n\t/**\n\t * Destroys all views in this container.\n\t */\n\tabstract clear(): void;\n\n\t/**\n\t * Retrieves a view from this container.\n\t * @param index The 0-based index of the view to retrieve.\n\t * @returns The `ViewRef` instance, or null if the index is out of range.\n\t */\n\tabstract get(index: number): ViewRef | undefined;\n\n\t/**\n\t * Reports how many views are currently attached to this container.\n\t * @returns The number of views.\n\t */\n\tabstract get length(): number;\n\n\t/**\n\t * Instantiates an embedded view and inserts it\n\t * into this container.\n\t * @param templateRef The HTML template that defines the view.\n\t * @param context The data-binding context of the embedded view, as declared\n\t * in the `<ng-template>` usage.\n\t * @param index The 0-based index at which to insert the new view into this container.\n\t * If not specified, appends the new view as the last entry.\n\t *\n\t * @returns The `ViewRef` instance for the newly created view.\n\t */\n\tabstract createEmbeddedView<C extends {}>(templateRef: TemplateRef, options?: ViewContainerOptions<C>): EmbeddedViewRef<C>;\n\n\t/**\n\t * create component by tag name `selector`.\n\t * @param selector the tag name for the aurora custom-element\n\t * @param options \n\t */\n\tabstract createComponent<C extends {}>(selector: string, options?: IndexOptions): C;\n\n\t/**\n\t * create component by the aurora custom-element `View` Class\n\t * @param viewClass the generated aurora view class\n\t * @param options \n\t */\n\tabstract createComponent<C extends {}>(viewClass: TypeOf<HTMLComponent<C>>, options?: IndexOptions): C;\n\t/**\n\t * Instantiates a single component and inserts its host view into this container.\n\t *\n\t * @param componentType Component Type to use.\n\t * @param options An object that contains extra parameters:\n\t * * index: the index at which to insert the new component's host view into this container.\n\t * If not specified, appends the new view as the last entry.\n\t * * selector: the tag name of the new create component that attached with this model class.\n\t * \t\tAny Model class can have many views with different selectors.\n\t *\n\t * @returns The new `HTMLComponent` which contains the component instance and the host view.\n\t */\n\tabstract createComponent<C extends {}>(componentType: TypeOf<C>, options?: ViewContainerComponentOptions): C;\n\n\n\t/**\n\t * create an HTMLElement by tag name `selector`.\n\t * @param selector the tag name for the aurora custom-element\n\t * @param options \n\t */\n\tabstract createElement<K extends keyof HTMLElementTagNameMap>(selector: K, options?: HTMLElementOptions): HTMLElementTagNameMap[K];\n\tabstract createElement<K extends keyof HTMLElementDeprecatedTagNameMap>(selector: K, options?: HTMLElementOptions): HTMLElementDeprecatedTagNameMap[K];\n\n\t/**\n\t * create HTMLElement by View Class reference\n\t * @param viewClass the generated aurora view class\n\t * @param options \n\t */\n\tabstract createElement<C extends HTMLElement>(htmlElementClass: TypeOf<C>, options?: HTMLElementOptions): C;\n\n\t/**\n\t * create a text node and insert to the view\n\t * @param data \n\t * @param options \n\t */\n\tabstract createTextNode(data: string, options?: IndexOptions): Text;\n\n\t/**\n\t * Inserts a view into this container.\n\t * @param viewRef The view to insert.\n\t * @param index The 0-based index at which to insert the view.\n\t * If not specified, appends the new view as the last entry.\n\t * @returns The inserted `ViewRef` instance.\n\t *\n\t */\n\tabstract insert(viewRef: ViewRef, index?: number): ViewRef;\n\n\t/**\n\t * Moves a view to a new location in this container.\n\t * @param viewRef The view to move.\n\t * @param newIndex The 0-based index of the new location.\n\t * @returns The moved `ViewRef` instance.\n\t */\n\tabstract move(viewRef: ViewRef, newIndex: number): ViewRef;\n\n\t/**\n\t * Returns the index of a view within the current container.\n\t * @param viewRef The view to query.\n\t * @returns The 0-based index of the view's position in this container,\n\t * or `-1` if this container doesn't contain the view.\n\t */\n\tabstract indexOf(viewRef: ViewRef): number;\n\n\t/**\n\t * Destroys a view attached to this container\n\t * @param index The 0-based index of the view to destroy.\n\t * If not specified, the last view in the container is removed.\n\t */\n\tabstract remove(index?: number): void;\n\n\t/**\n\t * Detaches a view from this container without destroying it.\n\t * Use along with `insert()` to move a view within the current container.\n\t * @param index The 0-based index of the view to detach.\n\t * If not specified, the last view in the container is detached.\n\t */\n\tabstract detach(index?: number): ViewRef | undefined;\n\n\t/**\n\t * set the current views from this\n\t * @param views the new `ViewRef` list \n\t */\n\tabstract updateViews(views: ViewRef[]): void;\n}\n\n\nexport class ViewContainerRefImpl extends ViewContainerRef {\n\n\tprivate _views: EmbeddedViewRef<any>[] = [];\n\n\tconstructor(parent: Element, firstComment: Comment);\n\tconstructor(private _parent: Element, private _firstComment: Comment) {\n\t\tsuper();\n\t}\n\toverride get anchorElement(): Element {\n\t\treturn this._parent;\n\t}\n\toverride get length(): number {\n\t\treturn this._views.length;\n\t}\n\toverride clear(): void {\n\t\tif (this._views.length > 0) {\n\t\t\tfor (const elm of this._views) {\n\t\t\t\telm.destroy();\n\t\t\t}\n\t\t\tthis._views.splice(0);\n\t\t}\n\t}\n\toverride get(index: number): ViewRef | undefined {\n\t\tif (index >= this._views.length) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this._views[index];\n\t}\n\toverride detach(index?: number): ViewRef | undefined {\n\t\tindex ??= this._views.length - 1;\n\t\tconst viewRef = this._views[index];\n\t\tviewRef.detach();\n\t\tthis._views.splice(index, 1);\n\t\treturn viewRef;\n\t}\n\toverride indexOf(viewRef: EmbeddedViewRef<any>): number {\n\t\treturn this._views.indexOf(viewRef);\n\t}\n\toverride remove(index?: number): void {\n\t\tindex ??= this._views.length - 1;\n\t\tthis._views[index].destroy();\n\t\tthis._views.splice(index, 1);\n\t}\n\toverride insert(viewRef: EmbeddedViewRef<any>, index?: number): ViewRef {\n\t\tindex = ((index ??= this._views.length) > this._views.length) ? this._views.length : index;\n\t\tconst lastNode = index == 0 ? this._firstComment : this._views[index - 1].last;\n\t\tthis._views.splice(index, 0, viewRef);\n\t\tviewRef.after(lastNode);\n\t\treturn viewRef;\n\t}\n\toverride move(viewRef: EmbeddedViewRef<any>, newIndex: number): ViewRef {\n\t\tconst oldIndex = this.indexOf(viewRef);\n\t\tif (oldIndex > -1) {\n\t\t\tthis.detach(oldIndex);\n\t\t} else {\n\t\t\t// should remove it from the container first\n\t\t\tviewRef.detach();\n\t\t}\n\t\treturn this.insert(viewRef, newIndex);\n\t}\n\toverride createEmbeddedView<C extends {}>(templateRef: TemplateRef, options?: ViewContainerOptions<C>): EmbeddedViewRef<C> {\n\t\tconst viewRef = templateRef.createEmbeddedView<C>(options?.context || <C>{}, this._parent);\n\t\t(options?.insert != false) && this.insert(viewRef, options?.index);\n\t\treturn viewRef;\n\t}\n\toverride createComponent<C extends {}>(selector: string, options?: IndexOptions): C;\n\toverride createComponent<C extends {}>(viewClass: MetadataClass<HTMLComponent<C>>, options?: IndexOptions): C;\n\toverride createComponent<C extends {}>(componentType: MetadataClass<C>, options?: ViewContainerComponentOptions): C;\n\toverride createComponent<C extends {}>(arg0: string | MetadataClass<C> | TypeOf<HTMLComponent<C>>, options?: ViewContainerComponentOptions): C {\n\t\tlet ViewClass: TypeOf<HTMLComponent<C>>;\n\t\tif (typeof arg0 === 'string') {\n\t\t\tViewClass = customElements.get(arg0) as TypeOf<HTMLComponent<C>>;\n\t\t} else if (typeof arg0 === 'function') {\n\t\t\tif (Reflect.has(arg0, 'observedAttributes')) {\n\t\t\t\tViewClass = arg0 as TypeOf<HTMLComponent<C>>;\n\t\t\t} else {\n\t\t\t\tconst componentType = arg0 as MetadataClass<C>;\n\t\t\t\tconst defaultTagName = componentType[Symbol.metadata].selector;\n\t\t\t\tconst view = getComponentView(componentType, options?.selector ?? defaultTagName);\n\t\t\t\tif (!view) {\n\t\t\t\t\tthrow new Error(`Can't find View component for class ${componentType.name}`);\n\t\t\t\t}\n\t\t\t\tViewClass = view;\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(`Can't find View component for args, ${arg0}, ${options}`);\n\t\t}\n\t\tconst component = new ViewClass();\n\t\tconst viewRef = new EmbeddedViewRefImpl<C>(component._modelScope, [component]);\n\t\t(options?.insert != false) && this.insert(viewRef, options?.index);\n\t\treturn component as any as C;\n\t}\n\n\toverride createElement<K extends keyof HTMLElementTagNameMap>(selector: K, options?: HTMLElementOptions): HTMLElementTagNameMap[K];\n\toverride createElement<K extends keyof HTMLElementDeprecatedTagNameMap>(selector: K, options?: HTMLElementOptions): HTMLElementDeprecatedTagNameMap[K];\n\toverride createElement<C extends HTMLElement>(arg0: string | TypeOf<C>, options?: HTMLElementOptions): C {\n\t\tlet element: C;\n\t\tif (typeof arg0 === 'string') {\n\t\t\telement = document.createElement(arg0, { is: options?.is }) as C;\n\t\t} else if (typeof arg0 === 'function') {\n\t\t\telement = new arg0();\n\t\t} else {\n\t\t\tthrow new Error(`Can't find View component for args, ${arg0}, ${options}`);\n\t\t}\n\t\tconst scope = ReactiveScopeControl.for<C>(element);\n\t\tconst viewRef = new EmbeddedViewRefImpl<C>(scope, [element]);\n\t\t(options?.insert != false) && this.insert(viewRef, options?.index);\n\t\treturn element;\n\t}\n\toverride createTextNode(data: string, options?: IndexOptions): Text {\n\t\tconst text = document.createTextNode(data);\n\t\tconst scope = ReactiveScopeControl.for<Text>(text);\n\t\tconst viewRef = new EmbeddedViewRefImpl<Text>(scope, [text]);\n\t\t(options?.insert != false) && this.insert(viewRef, options?.index);\n\t\treturn text;\n\t}\n\n\toverride updateViews(views: ViewRef[]): void {\n\t\tfor (let i = 0; i < views.length; i++) {\n\t\t\tthis.move(views[i] as EmbeddedViewRef<any>, i);\n\t\t}\n\t\twhile (this.length > views.length) {\n\t\t\tthis.remove();\n\t\t}\n\t}\n\n}\n"]}
1
+ {"version":3,"file":"view-container-ref.js","sourceRoot":"","sources":["../../../src/core/linker/view-container-ref.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE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KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7D,CAAC,OAAO,EAAE,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC;IACb,CAAC;IAEQ,WAAW,CAAC,KAAgB;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAyB,EAAE,CAAC,CAAC,CAAC;SAC/C;QACD,OAAO,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE;YAClC,IAAI,CAAC,MAAM,EAAE,CAAC;SACd;IACF,CAAC;CAED","sourcesContent":["import type { MetadataClass } from '@ibyar/decorators';\nimport type { TypeOf } from '../utils/typeof.js';\nimport { ReactiveScopeControl } from '@ibyar/expressions';\nimport { TemplateRef } from './template-ref.js';\nimport { EmbeddedViewRef, EmbeddedViewRefImpl, ViewRef } from './view-ref.js';\nimport { getComponentView } from '../view/utils.js';\nimport { HTMLComponent } from '../component/custom-element.js';\nimport { ReflectComponents } from '../component/reflect.js';\n\ninterface IndexOptions {\n\t/**\n\t * the index to insert the \n\t */\n\tindex?: number;\n\t/**\n\t * the default value is true\n\t */\n\tinsert?: boolean\n}\n\nexport interface ViewContainerOptions<C> extends IndexOptions {\n\tcontext?: C;\n};\n\nexport interface ViewContainerComponentOptions extends IndexOptions {\n\tselector?: string;\n};\n\nexport interface HTMLElementOptions extends ElementCreationOptions, IndexOptions {\n\n}\n\nexport abstract class ViewContainerRef {\n\n\t/**\n\t * Anchor element that specifies the location of this container in the containing view.\n\t * Each view container can have only one anchor element, and each anchor element\n\t * can have only a single view container.\n\t * \n\t * Root elements of views attached to this container become siblings of the anchor element in\n\t * the rendered view.\n\t *\n\t * Access the `ViewContainerRef` of an element by placing a `Directive` injected\n\t * with `ViewContainerRef` on the element, or use a `ViewChild` query.\n\t *\n\t */\n\tabstract get anchorElement(): Element;\n\n\t/**\n\t * Destroys all views in this container.\n\t */\n\tabstract clear(): void;\n\n\t/**\n\t * Retrieves a view from this container.\n\t * @param index The 0-based index of the view to retrieve.\n\t * @returns The `ViewRef` instance, or null if the index is out of range.\n\t */\n\tabstract get(index: number): ViewRef | undefined;\n\n\t/**\n\t * Reports how many views are currently attached to this container.\n\t * @returns The number of views.\n\t */\n\tabstract get length(): number;\n\n\t/**\n\t * Instantiates an embedded view and inserts it\n\t * into this container.\n\t * @param templateRef The HTML template that defines the view.\n\t * @param context The data-binding context of the embedded view, as declared\n\t * in the `<ng-template>` usage.\n\t * @param index The 0-based index at which to insert the new view into this container.\n\t * If not specified, appends the new view as the last entry.\n\t *\n\t * @returns The `ViewRef` instance for the newly created view.\n\t */\n\tabstract createEmbeddedView<C extends {}>(templateRef: TemplateRef, options?: ViewContainerOptions<C>): EmbeddedViewRef<C>;\n\n\t/**\n\t * create component by tag name `selector`.\n\t * @param selector the tag name for the aurora custom-element\n\t * @param options \n\t */\n\tabstract createComponent<C extends {}>(selector: string, options?: IndexOptions): C;\n\n\t/**\n\t * create component by the aurora custom-element `View` Class\n\t * @param viewClass the generated aurora view class\n\t * @param options \n\t */\n\tabstract createComponent<C extends {}>(viewClass: TypeOf<HTMLComponent<C>>, options?: IndexOptions): C;\n\t/**\n\t * Instantiates a single component and inserts its host view into this container.\n\t *\n\t * @param componentType Component Type to use.\n\t * @param options An object that contains extra parameters:\n\t * * index: the index at which to insert the new component's host view into this container.\n\t * If not specified, appends the new view as the last entry.\n\t * * selector: the tag name of the new create component that attached with this model class.\n\t * \t\tAny Model class can have many views with different selectors.\n\t *\n\t * @returns The new `HTMLComponent` which contains the component instance and the host view.\n\t */\n\tabstract createComponent<C extends {}>(componentType: TypeOf<C>, options?: ViewContainerComponentOptions): C;\n\n\n\t/**\n\t * create an HTMLElement by tag name `selector`.\n\t * @param selector the tag name for the aurora custom-element\n\t * @param options \n\t */\n\tabstract createElement<K extends keyof HTMLElementTagNameMap>(selector: K, options?: HTMLElementOptions): HTMLElementTagNameMap[K];\n\tabstract createElement<K extends keyof HTMLElementDeprecatedTagNameMap>(selector: K, options?: HTMLElementOptions): HTMLElementDeprecatedTagNameMap[K];\n\n\t/**\n\t * create HTMLElement by View Class reference\n\t * @param viewClass the generated aurora view class\n\t * @param options \n\t */\n\tabstract createElement<C extends HTMLElement>(htmlElementClass: TypeOf<C>, options?: HTMLElementOptions): C;\n\n\t/**\n\t * create a text node and insert to the view\n\t * @param data \n\t * @param options \n\t */\n\tabstract createTextNode(data: string, options?: IndexOptions): Text;\n\n\t/**\n\t * Inserts a view into this container.\n\t * @param viewRef The view to insert.\n\t * @param index The 0-based index at which to insert the view.\n\t * If not specified, appends the new view as the last entry.\n\t * @returns The inserted `ViewRef` instance.\n\t *\n\t */\n\tabstract insert(viewRef: ViewRef, index?: number): ViewRef;\n\n\t/**\n\t * Moves a view to a new location in this container.\n\t * @param viewRef The view to move.\n\t * @param newIndex The 0-based index of the new location.\n\t * @returns The moved `ViewRef` instance.\n\t */\n\tabstract move(viewRef: ViewRef, newIndex: number): ViewRef;\n\n\t/**\n\t * Returns the index of a view within the current container.\n\t * @param viewRef The view to query.\n\t * @returns The 0-based index of the view's position in this container,\n\t * or `-1` if this container doesn't contain the view.\n\t */\n\tabstract indexOf(viewRef: ViewRef): number;\n\n\t/**\n\t * Destroys a view attached to this container\n\t * @param index The 0-based index of the view to destroy.\n\t * If not specified, the last view in the container is removed.\n\t */\n\tabstract remove(index?: number): void;\n\n\t/**\n\t * Detaches a view from this container without destroying it.\n\t * Use along with `insert()` to move a view within the current container.\n\t * @param index The 0-based index of the view to detach.\n\t * If not specified, the last view in the container is detached.\n\t */\n\tabstract detach(index?: number): ViewRef | undefined;\n\n\t/**\n\t * set the current views from this\n\t * @param views the new `ViewRef` list \n\t */\n\tabstract updateViews(views: ViewRef[]): void;\n}\n\n\nexport class ViewContainerRefImpl extends ViewContainerRef {\n\n\tprivate _views: EmbeddedViewRef<any>[] = [];\n\n\tconstructor(parent: Element, firstComment: Comment);\n\tconstructor(private _parent: Element, private _firstComment: Comment) {\n\t\tsuper();\n\t}\n\toverride get anchorElement(): Element {\n\t\treturn this._parent;\n\t}\n\toverride get length(): number {\n\t\treturn this._views.length;\n\t}\n\toverride clear(): void {\n\t\tif (this._views.length > 0) {\n\t\t\tfor (const elm of this._views) {\n\t\t\t\telm.destroy();\n\t\t\t}\n\t\t\tthis._views.splice(0);\n\t\t}\n\t}\n\toverride get(index: number): ViewRef | undefined {\n\t\tif (index >= this._views.length) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn this._views[index];\n\t}\n\toverride detach(index?: number): ViewRef | undefined {\n\t\tindex ??= this._views.length - 1;\n\t\tconst viewRef = this._views[index];\n\t\tviewRef.detach();\n\t\tthis._views.splice(index, 1);\n\t\treturn viewRef;\n\t}\n\toverride indexOf(viewRef: EmbeddedViewRef<any>): number {\n\t\treturn this._views.indexOf(viewRef);\n\t}\n\toverride remove(index?: number): void {\n\t\tindex ??= this._views.length - 1;\n\t\tthis._views[index].destroy();\n\t\tthis._views.splice(index, 1);\n\t}\n\toverride insert(viewRef: EmbeddedViewRef<any>, index?: number): ViewRef {\n\t\tindex = ((index ??= this._views.length) > this._views.length) ? this._views.length : index;\n\t\tconst lastNode = index == 0 ? this._firstComment : this._views[index - 1].last;\n\t\tthis._views.splice(index, 0, viewRef);\n\t\tviewRef.after(lastNode);\n\t\treturn viewRef;\n\t}\n\toverride move(viewRef: EmbeddedViewRef<any>, newIndex: number): ViewRef {\n\t\tconst oldIndex = this.indexOf(viewRef);\n\t\tif (oldIndex > -1) {\n\t\t\tthis.detach(oldIndex);\n\t\t} else {\n\t\t\t// should remove it from the container first\n\t\t\tviewRef.detach();\n\t\t}\n\t\treturn this.insert(viewRef, newIndex);\n\t}\n\toverride createEmbeddedView<C extends {}>(templateRef: TemplateRef, options?: ViewContainerOptions<C>): EmbeddedViewRef<C> {\n\t\tconst viewRef = templateRef.createEmbeddedView<C>(options?.context || <C>{}, this._parent);\n\t\t(options?.insert != false) && this.insert(viewRef, options?.index);\n\t\treturn viewRef;\n\t}\n\toverride createComponent<C extends {}>(selector: string, options?: IndexOptions): C;\n\toverride createComponent<C extends {}>(viewClass: MetadataClass<HTMLComponent<C>>, options?: IndexOptions): C;\n\toverride createComponent<C extends {}>(componentType: MetadataClass<C>, options?: ViewContainerComponentOptions): C;\n\toverride createComponent<C extends {}>(arg0: string | MetadataClass<C> | TypeOf<HTMLComponent<C>>, options?: ViewContainerComponentOptions): C {\n\t\tlet ViewClass: TypeOf<HTMLComponent<C>>;\n\t\tif (typeof arg0 === 'string') {\n\t\t\tViewClass = customElements.get(arg0) as TypeOf<HTMLComponent<C>>;\n\t\t} else if (typeof arg0 === 'function') {\n\t\t\tif (Reflect.has(arg0, 'observedAttributes')) {\n\t\t\t\tViewClass = arg0 as TypeOf<HTMLComponent<C>>;\n\t\t\t} else {\n\t\t\t\tconst componentType = arg0 as MetadataClass<C>;\n\t\t\t\tconst defaultTagName = ReflectComponents.getMetaDate(componentType)?.selector;\n\t\t\t\tconst view = getComponentView(componentType, options?.selector ?? defaultTagName);\n\t\t\t\tif (!view) {\n\t\t\t\t\tthrow new Error(`Can't find View component for class ${componentType.name}`);\n\t\t\t\t}\n\t\t\t\tViewClass = view;\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(`Can't find View component for args, ${arg0}, ${options}`);\n\t\t}\n\t\tconst component = new ViewClass();\n\t\tconst viewRef = new EmbeddedViewRefImpl<C>(component._modelScope, [component]);\n\t\t(options?.insert != false) && this.insert(viewRef, options?.index);\n\t\treturn component as any as C;\n\t}\n\n\toverride createElement<K extends keyof HTMLElementTagNameMap>(selector: K, options?: HTMLElementOptions): HTMLElementTagNameMap[K];\n\toverride createElement<K extends keyof HTMLElementDeprecatedTagNameMap>(selector: K, options?: HTMLElementOptions): HTMLElementDeprecatedTagNameMap[K];\n\toverride createElement<C extends HTMLElement>(arg0: string | TypeOf<C>, options?: HTMLElementOptions): C {\n\t\tlet element: C;\n\t\tif (typeof arg0 === 'string') {\n\t\t\telement = document.createElement(arg0, { is: options?.is }) as C;\n\t\t} else if (typeof arg0 === 'function') {\n\t\t\telement = new arg0();\n\t\t} else {\n\t\t\tthrow new Error(`Can't find View component for args, ${arg0}, ${options}`);\n\t\t}\n\t\tconst scope = ReactiveScopeControl.for<C>(element);\n\t\tconst viewRef = new EmbeddedViewRefImpl<C>(scope, [element]);\n\t\t(options?.insert != false) && this.insert(viewRef, options?.index);\n\t\treturn element;\n\t}\n\toverride createTextNode(data: string, options?: IndexOptions): Text {\n\t\tconst text = document.createTextNode(data);\n\t\tconst scope = ReactiveScopeControl.for<Text>(text);\n\t\tconst viewRef = new EmbeddedViewRefImpl<Text>(scope, [text]);\n\t\t(options?.insert != false) && this.insert(viewRef, options?.index);\n\t\treturn text;\n\t}\n\n\toverride updateViews(views: ViewRef[]): void {\n\t\tfor (let i = 0; i < views.length; i++) {\n\t\t\tthis.move(views[i] as EmbeddedViewRef<any>, i);\n\t\t}\n\t\twhile (this.length > views.length) {\n\t\t\tthis.remove();\n\t\t}\n\t}\n\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibyar/core",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Ibyar core, Implements Aurora's core functionality, low-level services, and utilities",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/ibyar/aurora/tree/dev/packages/core",
@@ -35,16 +35,16 @@
35
35
  "access": "public"
36
36
  },
37
37
  "dependencies": {
38
- "@ibyar/decorators": "^1.0.0",
39
- "@ibyar/elements": "^1.0.0",
40
- "@ibyar/expressions": "^1.0.0",
41
- "tslib": "^2.5.0"
38
+ "@ibyar/decorators": "^1.1.0",
39
+ "@ibyar/elements": "^1.1.0",
40
+ "@ibyar/expressions": "^1.1.0",
41
+ "tslib": "^2.6.2"
42
42
  },
43
43
  "peerDependencies": {
44
- "zone.js": "~0.11.4 || ~0.12.0"
44
+ "zone.js": "~0.11.4 || ~0.12.0 || ~0.13.1"
45
45
  },
46
46
  "devDependencies": {
47
- "typescript": "^5.0.4"
47
+ "typescript": "^5.2.2"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "tsc --build --verbose"
@@ -77,5 +77,5 @@
77
77
  "typescript",
78
78
  "front-end"
79
79
  ],
80
- "gitHead": "f7c358a00514b4fad30772373e34ea6b6a7a8972"
80
+ "gitHead": "9427f428b9783263536b896d363bd10a59b380de"
81
81
  }
@@ -1,6 +1,6 @@
1
1
  import type { MetadataClass } from '@ibyar/decorators';
2
2
  import type { ComponentRef, DirectiveRef, PipeRef, ServiceRef } from '../component/component.js';
3
- import type { PropertyRef } from '../component/reflect.js';
3
+ import { type PropertyRef } from '../component/reflect.js';
4
4
  export type ProviderType = 'component' | 'service' | 'directive' | 'pipe' | 'self';
5
5
  export declare class ClassRegistry {
6
6
  viewSet: Set<MetadataClass>;
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/core/providers/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EACX,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAC/C,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnF,qBAAa,aAAa;IACzB,OAAO,EAAE,GAAG,CAAC,aAAa,CAAC,CAAa;IACxC,YAAY,EAAE,GAAG,CAAC,aAAa,CAAC,CAAa;IAC7C,UAAU,EAAE,GAAG,CAAC,aAAa,CAAC,CAAa;IAC3C,YAAY,EAAE,GAAG,CAA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AAM,GAAG,WAAW,GAAG,KAAK;IAanE,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,KAAK;IAclE,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;IAU1C,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,GAAE,YAAY,GAAG,YAA2B,GAAG,OAAO;IAavG,eAAe,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS;IAWjE,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS;IAUpD,UAAU,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS;CAS7D;AAED,eAAO,MAAM,qBAAqB,eAAsB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { ReflectComponents } from '../component/reflect.js';
1
2
  export class ClassRegistry {
2
3
  viewSet = new Set();
3
4
  componentSet = new Set();
@@ -21,7 +22,7 @@ export class ClassRegistry {
21
22
  }
22
23
  hasComponent(selector) {
23
24
  for (const modelClass of this.componentSet) {
24
- const componentRef = modelClass[Symbol.metadata];
25
+ const componentRef = ReflectComponents.getMetaDate(modelClass);
25
26
  if (componentRef.selector === selector) {
26
27
  return true;
27
28
  }
@@ -30,7 +31,7 @@ export class ClassRegistry {
30
31
  }
31
32
  getComponentRef(selector) {
32
33
  for (const modelClass of this.componentSet) {
33
- const componentRef = modelClass[Symbol.metadata];
34
+ const componentRef = ReflectComponents.getMetaDate(modelClass);
34
35
  if (componentRef.selector === selector) {
35
36
  return componentRef;
36
37
  }
@@ -39,7 +40,7 @@ export class ClassRegistry {
39
40
  }
40
41
  getComponent(selector) {
41
42
  for (const modelClass of this.componentSet) {
42
- const componentRef = modelClass[Symbol.metadata];
43
+ const componentRef = ReflectComponents.getMetaDate(modelClass);
43
44
  if (componentRef.selector === selector) {
44
45
  return modelClass;
45
46
  }
@@ -77,7 +78,7 @@ export class ClassRegistry {
77
78
  }
78
79
  hasDirective(selector) {
79
80
  for (const directiveClass of this.directiveSet) {
80
- const directiveRef = directiveClass[Symbol.metadata];
81
+ const directiveRef = ReflectComponents.getMetaDate(directiveClass);
81
82
  if (directiveRef.selector === selector) {
82
83
  return true;
83
84
  }
@@ -86,7 +87,7 @@ export class ClassRegistry {
86
87
  }
87
88
  directiveHasInput(input, directiveType = 'attributes') {
88
89
  for (const directiveClass of this.directiveSet) {
89
- const directiveRef = directiveClass[Symbol.metadata];
90
+ const directiveRef = ReflectComponents.getMetaDate(directiveClass);
90
91
  if ((directiveType === 'attributes' && !directiveRef.selector.startsWith('*'))
91
92
  || (directiveType === 'structural' && directiveRef.selector.startsWith('*'))) {
92
93
  if (directiveRef.inputs?.filter(ref => ref.viewAttribute === input).length > 0) {
@@ -98,7 +99,7 @@ export class ClassRegistry {
98
99
  }
99
100
  getDirectiveRef(selector) {
100
101
  for (const directiveClass of this.directiveSet) {
101
- const directiveRef = directiveClass[Symbol.metadata];
102
+ const directiveRef = ReflectComponents.getMetaDate(directiveClass);
102
103
  if (directiveRef.selector === selector) {
103
104
  return directiveRef;
104
105
  }
@@ -107,7 +108,7 @@ export class ClassRegistry {
107
108
  }
108
109
  getPipe(pipeName) {
109
110
  for (const pipeClass of this.pipeSet) {
110
- const pipeRef = pipeClass[Symbol.metadata];
111
+ const pipeRef = ReflectComponents.getMetaDate(pipeClass);
111
112
  if (pipeRef.name === pipeName) {
112
113
  return pipeRef;
113
114
  }
@@ -116,7 +117,7 @@ export class ClassRegistry {
116
117
  }
117
118
  getService(serviceName) {
118
119
  for (const serviceClass of this.serviceSet) {
119
- const serviceRef = serviceClass[Symbol.metadata];
120
+ const serviceRef = ReflectComponents.getMetaDate(serviceClass);
120
121
  if (serviceRef.name === serviceName) {
121
122
  return serviceRef;
122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KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,OAAO,EAAE;YACrC,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAe,CAAC;YACzD,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAC9B,OAAO,OAAO,CAAC;aACf;SACD;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,UAAU,CAAI,WAAmB;QAChC,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,UAAU,EAAE;YAC3C,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAkB,CAAC;YAClE,IAAI,UAAU,CAAC,IAAI,KAAK,WAAW,EAAE;gBACpC,OAAO,UAAU,CAAC;aAClB;SACD;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;CACD;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,aAAa,EAAE,CAAC","sourcesContent":["import type { MetadataClass } from '@ibyar/decorators';\nimport type {\n\tComponentRef, DirectiveRef, PipeRef, ServiceRef\n} from '../component/component.js';\nimport type { PropertyRef } from '../component/reflect.js';\nexport type ProviderType = 'component' | 'service' | 'directive' | 'pipe' | 'self';\n\nexport class ClassRegistry {\n\tviewSet: Set<MetadataClass> = new Set();\n\tcomponentSet: Set<MetadataClass> = new Set();\n\tserviceSet: Set<MetadataClass> = new Set();\n\tdirectiveSet: Set<MetadataClass> = new Set();\n\tpipeSet: Set<MetadataClass> = new Set();\n\n\tregisterView(classRef: MetadataClass): void {\n\t\tthis.viewSet.add(classRef);\n\t}\n\tregisterComponent(classRef: MetadataClass): void {\n\t\tthis.componentSet.add(classRef);\n\t}\n\tregisterService(classRef: MetadataClass): void {\n\t\tthis.serviceSet.add(classRef);\n\t}\n\tregisterDirective(classRef: MetadataClass): void {\n\t\tthis.directiveSet.add(classRef);\n\t}\n\tregisterPipe(classRef: MetadataClass): void {\n\t\tthis.pipeSet.add(classRef);\n\t}\n\n\thasComponent<T>(selector: string): boolean {\n\t\tfor (const modelClass of this.componentSet) {\n\t\t\tconst componentRef = modelClass[Symbol.metadata] as ComponentRef<T>;\n\t\t\tif (componentRef.selector === selector) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\tgetComponentRef<T>(selector: string): ComponentRef<T> | undefined {\n\t\tfor (const modelClass of this.componentSet) {\n\t\t\tconst componentRef = modelClass[Symbol.metadata] as ComponentRef<T>;\n\t\t\tif (componentRef.selector === selector) {\n\t\t\t\treturn componentRef;\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\tgetComponent<T>(selector: string) {\n\t\tfor (const modelClass of this.componentSet) {\n\t\t\tconst componentRef = modelClass[Symbol.metadata] as ComponentRef<T>;\n\t\t\tif (componentRef.selector === selector) {\n\t\t\t\treturn modelClass;\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\tgetComponentView(selector: string) {\n\t\treturn this.getComponentRef(selector)?.viewClass;\n\t}\n\n\thasOutput<T>(model: Object, eventName: string): PropertyRef | false {\n\t\tif (Reflect.has(model, 'bootstrap')) {\n\t\t\tconst componentRef: ComponentRef<T> = Reflect.get(model, 'bootstrap');\n\t\t\tif (componentRef.outputs) {\n\t\t\t\tfor (const out of componentRef.outputs) {\n\t\t\t\t\tif (out.viewAttribute === eventName) {\n\t\t\t\t\t\treturn out;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\thasInput<T>(model: Object, eventName: string): PropertyRef | false {\n\t\tif (Reflect.has(model, 'bootstrap')) {\n\t\t\tconst componentRef: ComponentRef<T> = Reflect.get(model, 'bootstrap');\n\t\t\tif (componentRef.inputs) {\n\t\t\t\tfor (const input of componentRef.inputs) {\n\t\t\t\t\tif (input.viewAttribute === eventName) {\n\t\t\t\t\t\treturn input;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\thasDirective<T>(selector: string): boolean {\n\t\tfor (const directiveClass of this.directiveSet) {\n\t\t\tconst directiveRef = directiveClass[Symbol.metadata] as DirectiveRef<T>;\n\t\t\tif (directiveRef.selector === selector) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tdirectiveHasInput<T>(input: string, directiveType: 'attributes' | 'structural' = 'attributes'): boolean {\n\t\tfor (const directiveClass of this.directiveSet) {\n\t\t\tconst directiveRef = directiveClass[Symbol.metadata] as DirectiveRef<T>;\n\t\t\tif ((directiveType === 'attributes' && !directiveRef.selector.startsWith('*'))\n\t\t\t\t|| (directiveType === 'structural' && directiveRef.selector.startsWith('*'))) {\n\t\t\t\tif (directiveRef.inputs?.filter(ref => ref.viewAttribute === input).length > 0) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tgetDirectiveRef<T>(selector: string): DirectiveRef<T> | undefined {\n\t\tfor (const directiveClass of this.directiveSet) {\n\t\t\tconst directiveRef = directiveClass[Symbol.metadata] as DirectiveRef<T>;\n\t\t\tif (directiveRef.selector === selector) {\n\t\t\t\treturn directiveRef;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\n\tgetPipe<T>(pipeName: string): PipeRef<T> | undefined {\n\t\tfor (const pipeClass of this.pipeSet) {\n\t\t\tconst pipeRef = pipeClass[Symbol.metadata] as PipeRef<T>;\n\t\t\tif (pipeRef.name === pipeName) {\n\t\t\t\treturn pipeRef;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tgetService<T>(serviceName: string): ServiceRef<T> | undefined {\n\t\tfor (const serviceClass of this.serviceSet) {\n\t\t\tconst serviceRef = serviceClass[Symbol.metadata] as ServiceRef<T>;\n\t\t\tif (serviceRef.name === serviceName) {\n\t\t\t\treturn serviceRef;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n}\n\nexport const ClassRegistryProvider = new ClassRegistry();\n"]}
1
+ {"version":3,"file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,OAAO,CAAI,QAAgB;QAC1B,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,OAAO,EAAE;YACrC,MAAM,OAAO,GAAG,iBAAiB,CAAC,WAAW,CAAC,SAAS,CAAe,CAAC;YACvE,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAC9B,OAAO,OAAO,CAAC;aACf;SACD;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,UAAU,CAAI,WAAmB;QAChC,KAAK,MAAM,YAAY,IAAI,IAAI,CAAC,UAAU,EAAE;YAC3C,MAAM,UAAU,GAAG,iBAAiB,CAAC,WAAW,CAAC,YAAY,CAAkB,CAAC;YAChF,IAAI,UAAU,CAAC,IAAI,KAAK,WAAW,EAAE;gBACpC,OAAO,UAAU,CAAC;aAClB;SACD;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;CACD;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,aAAa,EAAE,CAAC","sourcesContent":["import type { MetadataClass } from '@ibyar/decorators';\nimport type {\n\tComponentRef, DirectiveRef, PipeRef, ServiceRef\n} from '../component/component.js';\nimport { ReflectComponents, type PropertyRef } from '../component/reflect.js';\nexport type ProviderType = 'component' | 'service' | 'directive' | 'pipe' | 'self';\n\nexport class ClassRegistry {\n\tviewSet: Set<MetadataClass> = new Set();\n\tcomponentSet: Set<MetadataClass> = new Set();\n\tserviceSet: Set<MetadataClass> = new Set();\n\tdirectiveSet: Set<MetadataClass> = new Set();\n\tpipeSet: Set<MetadataClass> = new Set();\n\n\tregisterView(classRef: MetadataClass): void {\n\t\tthis.viewSet.add(classRef);\n\t}\n\tregisterComponent(classRef: MetadataClass): void {\n\t\tthis.componentSet.add(classRef);\n\t}\n\tregisterService(classRef: MetadataClass): void {\n\t\tthis.serviceSet.add(classRef);\n\t}\n\tregisterDirective(classRef: MetadataClass): void {\n\t\tthis.directiveSet.add(classRef);\n\t}\n\tregisterPipe(classRef: MetadataClass): void {\n\t\tthis.pipeSet.add(classRef);\n\t}\n\n\thasComponent<T>(selector: string): boolean {\n\t\tfor (const modelClass of this.componentSet) {\n\t\t\tconst componentRef = ReflectComponents.getMetaDate(modelClass) as ComponentRef<T>;\n\t\t\tif (componentRef.selector === selector) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\tgetComponentRef<T>(selector: string): ComponentRef<T> | undefined {\n\t\tfor (const modelClass of this.componentSet) {\n\t\t\tconst componentRef = ReflectComponents.getMetaDate(modelClass) as ComponentRef<T>;\n\t\t\tif (componentRef.selector === selector) {\n\t\t\t\treturn componentRef;\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\tgetComponent<T>(selector: string) {\n\t\tfor (const modelClass of this.componentSet) {\n\t\t\tconst componentRef = ReflectComponents.getMetaDate(modelClass) as ComponentRef<T>;\n\t\t\tif (componentRef.selector === selector) {\n\t\t\t\treturn modelClass;\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\tgetComponentView(selector: string) {\n\t\treturn this.getComponentRef(selector)?.viewClass;\n\t}\n\n\thasOutput<T>(model: Object, eventName: string): PropertyRef | false {\n\t\tif (Reflect.has(model, 'bootstrap')) {\n\t\t\tconst componentRef: ComponentRef<T> = Reflect.get(model, 'bootstrap');\n\t\t\tif (componentRef.outputs) {\n\t\t\t\tfor (const out of componentRef.outputs) {\n\t\t\t\t\tif (out.viewAttribute === eventName) {\n\t\t\t\t\t\treturn out;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\thasInput<T>(model: Object, eventName: string): PropertyRef | false {\n\t\tif (Reflect.has(model, 'bootstrap')) {\n\t\t\tconst componentRef: ComponentRef<T> = Reflect.get(model, 'bootstrap');\n\t\t\tif (componentRef.inputs) {\n\t\t\t\tfor (const input of componentRef.inputs) {\n\t\t\t\t\tif (input.viewAttribute === eventName) {\n\t\t\t\t\t\treturn input;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\thasDirective<T>(selector: string): boolean {\n\t\tfor (const directiveClass of this.directiveSet) {\n\t\t\tconst directiveRef = ReflectComponents.getMetaDate(directiveClass) as DirectiveRef<T>;\n\t\t\tif (directiveRef.selector === selector) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tdirectiveHasInput<T>(input: string, directiveType: 'attributes' | 'structural' = 'attributes'): boolean {\n\t\tfor (const directiveClass of this.directiveSet) {\n\t\t\tconst directiveRef = ReflectComponents.getMetaDate(directiveClass) as DirectiveRef<T>;\n\t\t\tif ((directiveType === 'attributes' && !directiveRef.selector.startsWith('*'))\n\t\t\t\t|| (directiveType === 'structural' && directiveRef.selector.startsWith('*'))) {\n\t\t\t\tif (directiveRef.inputs?.filter(ref => ref.viewAttribute === input).length > 0) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tgetDirectiveRef<T>(selector: string): DirectiveRef<T> | undefined {\n\t\tfor (const directiveClass of this.directiveSet) {\n\t\t\tconst directiveRef = ReflectComponents.getMetaDate(directiveClass) as DirectiveRef<T>;\n\t\t\tif (directiveRef.selector === selector) {\n\t\t\t\treturn directiveRef;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\n\tgetPipe<T>(pipeName: string): PipeRef<T> | undefined {\n\t\tfor (const pipeClass of this.pipeSet) {\n\t\t\tconst pipeRef = ReflectComponents.getMetaDate(pipeClass) as PipeRef<T>;\n\t\t\tif (pipeRef.name === pipeName) {\n\t\t\t\treturn pipeRef;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tgetService<T>(serviceName: string): ServiceRef<T> | undefined {\n\t\tfor (const serviceClass of this.serviceSet) {\n\t\t\tconst serviceRef = ReflectComponents.getMetaDate(serviceClass) as ServiceRef<T>;\n\t\t\tif (serviceRef.name === serviceName) {\n\t\t\t\treturn serviceRef;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n}\n\nexport const ClassRegistryProvider = new ClassRegistry();\n"]}
@@ -0,0 +1,19 @@
1
+ import { Context, ReactiveScope } from '@ibyar/expressions';
2
+ export interface ScopeVariable<T> {
3
+ readonly name: string;
4
+ get(): T | undefined;
5
+ set(value: T | undefined): void;
6
+ }
7
+ export declare class ScopeVariable<T> implements ScopeVariable<T> {
8
+ readonly name: string;
9
+ private scope;
10
+ constructor(name: string, scope: ReactiveScope<Context>, value?: T);
11
+ }
12
+ export declare class ScopeEdit {
13
+ private scopes;
14
+ getScope<T extends Context>(): ReactiveScope<T>;
15
+ pushScope<T extends Context>(scope: ReactiveScope<T>): void;
16
+ popScope<T extends Context>(): ReactiveScope<T> | undefined;
17
+ }
18
+ export declare function input<T>(name: string, value?: T): ScopeVariable<T>;
19
+ //# sourceMappingURL=variables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../../src/core/scope/variables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,WAAW,aAAa,CAAC,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IACrB,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;CAChC;AAED,qBAAa,aAAa,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IAE5C,QAAQ,CAAC,IAAI,EAAE,MAAM;IAAE,OAAO,CAAC,KAAK;gBAA3B,IAAI,EAAE,MAAM,EAAU,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;CAYnF;AAED,qBAAa,SAAS;IAErB,OAAO,CAAC,MAAM,CAAgC;IAE9C,QAAQ,CAAC,CAAC,SAAS,OAAO,KAAK,aAAa,CAAC,CAAC,CAAC;IAS/C,SAAS,CAAC,CAAC,SAAS,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;IAIpD,QAAQ,CAAC,CAAC,SAAS,OAAO,KAAK,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS;CAI3D;AAID,wBAAgB,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAElE"}