@ibyar/core 0.5.6 → 0.6.1

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 (80) hide show
  1. package/annotation/decorators.d.ts +121 -0
  2. package/annotation/decorators.js.map +1 -1
  3. package/binding/binding.expressions.d.ts +9 -4
  4. package/binding/binding.expressions.js +10 -15
  5. package/binding/binding.expressions.js.map +1 -1
  6. package/component/component.d.ts +3 -0
  7. package/component/component.js +1 -0
  8. package/component/component.js.map +1 -1
  9. package/component/custom-element.d.ts +48 -4
  10. package/component/custom-element.js.map +1 -1
  11. package/component/events.js +2 -6
  12. package/component/events.js.map +1 -1
  13. package/context/stack.js +4 -0
  14. package/context/stack.js.map +1 -1
  15. package/directive/directive.d.ts +9 -0
  16. package/directive/directive.js +9 -0
  17. package/directive/directive.js.map +1 -1
  18. package/directive/parser.d.ts +4 -0
  19. package/directive/parser.js +19 -0
  20. package/directive/parser.js.map +1 -1
  21. package/directive/providers.js +3 -3
  22. package/directive/providers.js.map +1 -1
  23. package/html/expression.d.ts +5 -0
  24. package/html/expression.js +13 -1
  25. package/html/expression.js.map +1 -1
  26. package/index.d.ts +4 -0
  27. package/index.js +4 -0
  28. package/index.js.map +1 -1
  29. package/linker/change-detector-ref.d.ts +25 -2
  30. package/linker/change-detector-ref.js +30 -18
  31. package/linker/change-detector-ref.js.map +1 -1
  32. package/linker/template-ref.d.ts +17 -5
  33. package/linker/template-ref.js +23 -20
  34. package/linker/template-ref.js.map +1 -1
  35. package/linker/view-container-ref.d.ts +140 -8
  36. package/linker/view-container-ref.js +82 -31
  37. package/linker/view-container-ref.js.map +1 -1
  38. package/linker/view-ref.d.ts +49 -5
  39. package/linker/view-ref.js +23 -9
  40. package/linker/view-ref.js.map +1 -1
  41. package/package.json +9 -5
  42. package/pipe/pipe.d.ts +7 -0
  43. package/pipe/pipe.js +4 -4
  44. package/pipe/pipe.js.map +1 -1
  45. package/providers/injector.js +1 -0
  46. package/providers/injector.js.map +1 -1
  47. package/render/host-listener.handler.d.ts +17 -0
  48. package/render/host-listener.handler.js +20 -3
  49. package/render/host-listener.handler.js.map +1 -1
  50. package/render/render-handler.d.ts +6 -0
  51. package/utils/typeof.d.ts +3 -0
  52. package/utils/utils.js +1 -0
  53. package/utils/utils.js.map +1 -1
  54. package/view/base-view.js +56 -19
  55. package/view/base-view.js.map +1 -1
  56. package/view/form-view.js +21 -0
  57. package/view/form-view.js.map +1 -1
  58. package/view/mutation.js +1 -0
  59. package/view/mutation.js.map +1 -1
  60. package/view/render.d.ts +9 -9
  61. package/view/render.js +38 -29
  62. package/view/render.js.map +1 -1
  63. package/view/view.d.ts +5 -0
  64. package/view/view.js +7 -0
  65. package/view/view.js.map +1 -1
  66. package/zone/bootstrap.d.ts +21 -0
  67. package/zone/bootstrap.js +35 -0
  68. package/zone/bootstrap.js.map +1 -0
  69. package/zone/proxy.d.ts +15 -0
  70. package/zone/proxy.js +41 -0
  71. package/zone/proxy.js.map +1 -0
  72. package/zone/task.d.ts +61 -0
  73. package/zone/task.js +109 -0
  74. package/zone/task.js.map +1 -0
  75. package/zone/zone.d.ts +51 -0
  76. package/zone/zone.js +193 -0
  77. package/zone/zone.js.map +1 -0
  78. package/component/provider.d.ts +0 -10
  79. package/component/provider.js +0 -17
  80. package/component/provider.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/core/view/render.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,aAAa,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,WAAW,EAAE,0BAA0B,EACvC,cAAc,EAAE,eAAe,EAAW,iBAAiB,EAC3D,eAAe,EAAE,wBAAwB,EACzC,WAAW,EACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAiB,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,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Y,CAAC,QAAQ,EAAE,CAAC;YACzB,CAAC,CAAC,CAAC;SACH;QAGD,OAAO,aAAa,CAAC;IACtB,CAAC;CAED","sourcesContent":["import {\n\tReactiveScope, ScopeContext, ScopeSubscription, Stack\n} from '@ibyar/expressions';\nimport {\n\tCommentNode, DomStructuralDirectiveNode, DomStructuralDirectiveNodeUpgrade,\n\tDomElementNode, DomFragmentNode, DomNode, isLiveTextContent,\n\tisTagNameNative, isValidCustomElementName, LiveTextContent,\n\tTextContent, DomAttributeDirectiveNode\n} from '@ibyar/elements';\nimport { ComponentRef } from '../component/component.js';\nimport { HTMLComponent, isHTMLComponent } from '../component/custom-element.js';\nimport { documentStack } from '../context/stack.js';\nimport { ClassRegistryProvider } from '../providers/provider.js';\nimport { isOnDestroy, isOnInit } from '../component/lifecycle.js';\nimport { hasAttr } from '../utils/elements-util.js';\nimport { AttributeDirective, AttributeOnStructuralDirective, StructuralDirective } from '../directive/directive.js';\nimport { TemplateRef, TemplateRefImpl } from '../linker/template-ref.js';\nimport { ViewContainerRefImpl } from '../linker/view-container-ref.js';\nimport { createSubscriptionDestroyer } from '../context/subscription.js';\nimport { HostListenerHandler } from '../render/host-listener.handler.js';\n\ntype ViewScopeContext = { [element: string]: HTMLElement };\n\nfunction getInputEventName(element: HTMLElement): 'input' | 'change' | undefined {\n\tswitch (true) {\n\t\tcase element instanceof HTMLInputElement:\n\t\t\treturn 'input';\n\t\tcase element instanceof HTMLTextAreaElement:\n\t\tcase element instanceof HTMLSelectElement:\n\t\t\treturn 'change';\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\nexport class ComponentRender<T extends object> {\n\tprivate componentRef: ComponentRef<T>;\n\tprivate template: DomNode;\n\tprivate contextStack: Stack;\n\tprivate templateNameScope: ReactiveScope<{ [templateName: string]: TemplateRef }>;\n\tprivate viewScope: ReactiveScope<ViewScopeContext> = new ReactiveScope({});\n\n\tconstructor(public view: HTMLComponent<T>, private subscriptions: ScopeSubscription<ScopeContext>[]) {\n\t\tthis.componentRef = this.view.getComponentRef();\n\t\tthis.contextStack = documentStack.copyStack();\n\t\tthis.contextStack.pushScope<ScopeContext>(this.view._modelScope);\n\t\tthis.templateNameScope = this.contextStack.pushReactiveScope();\n\t}\n\tinitView(): void {\n\t\tif (this.componentRef.template) {\n\t\t\tif (typeof this.componentRef.template === 'function') {\n\t\t\t\tthis.template = this.componentRef.template(this.view._model);\n\t\t\t} else {\n\t\t\t\tthis.template = this.componentRef.template;\n\t\t\t}\n\n\t\t\tlet rootRef: HTMLElement | ShadowRoot;\n\t\t\tif (this.componentRef.isShadowDom) {\n\t\t\t\tif (this.view.shadowRoot /* OPEN MODE */) {\n\t\t\t\t\trootRef = this.view.shadowRoot;\n\t\t\t\t} else /* CLOSED MODE*/ {\n\t\t\t\t\trootRef = Reflect.get(this.view, '_shadowRoot') as ShadowRoot;\n\t\t\t\t\tReflect.deleteProperty(this.view, '_shadowRoot');\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trootRef = this.view;\n\t\t\t}\n\t\t\tthis.initTemplateRefMap(this.template);\n\t\t\tlet rootFragment: DocumentFragment;\n\t\t\tif (this.template instanceof DomFragmentNode) {\n\t\t\t\trootFragment = this.createDocumentFragment(this.template, this.contextStack, rootRef, this.subscriptions, this.view);\n\t\t\t} else {\n\t\t\t\trootFragment = document.createDocumentFragment();\n\t\t\t\tthis.appendChildToParent(rootFragment, this.template, this.contextStack, rootRef, this.subscriptions, this.view);\n\t\t\t}\n\t\t\trootRef.append(rootFragment);\n\t\t}\n\t}\n\tisTemplateRefName(template: DomNode): template is DomElementNode {\n\t\tif (template instanceof DomElementNode) {\n\t\t\tif (template.tagName === 'template' && template.templateRefName) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\tinitTemplateRefMap(domNode: DomNode) {\n\t\tif (domNode instanceof DomElementNode || domNode instanceof DomFragmentNode) {\n\t\t\tif (domNode.children) {\n\t\t\t\tfor (let index = 0; index < domNode.children.length; index++) {\n\t\t\t\t\tconst child = domNode.children[index];\n\t\t\t\t\tif (this.isTemplateRefName(child)) {\n\t\t\t\t\t\tthis.templateNameScope.set(child.templateRefName!.name, undefined);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.initTemplateRefMap(child);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tinitHostListener(): void {\n\t\tconst handlers = this.componentRef.hostListeners.map(listenerRef => new HostListenerHandler(listenerRef, this.view, this.viewScope));\n\t\thandlers.forEach(handler => handler.onInit());\n\t\thandlers.forEach(handler => this.subscriptions.push(createSubscriptionDestroyer(\n\t\t\t() => handler.onDestroy(),\n\t\t\t() => handler.onDisconnect(),\n\t\t\t() => handler.onConnect(),\n\t\t)));\n\t}\n\taddNativeEventListener(source: HTMLElement | Window, eventName: string, funcCallback: Function) {\n\t\tsource.addEventListener(eventName, (event: Event) => {\n\t\t\tfuncCallback.call(this.view._proxyModel, event);\n\t\t});\n\t}\n\tgetElementByName(name: string) {\n\t\treturn Reflect.get(this.view, name);\n\t}\n\tcreateStructuralDirective(directive: DomStructuralDirectiveNode, comment: Comment, directiveStack: Stack, subscriptions: ScopeSubscription<ScopeContext>[], parentNode: Node, host: HTMLComponent<any> | StructuralDirective): void {\n\t\tconst directiveRef = ClassRegistryProvider.getDirectiveRef<T>(directive.name);\n\t\tif (directiveRef) {\n\t\t\tconst stack = directiveStack.copyStack();\n\t\t\tconst templateRef = new TemplateRefImpl(\n\t\t\t\tthis,\n\t\t\t\tdirective.node,\n\t\t\t\tstack,\n\t\t\t\t(directive as DomStructuralDirectiveNodeUpgrade).templateExpressions ?? [],\n\t\t\t);\n\t\t\tconst viewContainerRef = new ViewContainerRefImpl(parentNode as Element, comment);\n\n\t\t\t// structural directive selector\n\t\t\tconst StructuralDirectiveClass = directiveRef.modelClass as typeof StructuralDirective;\n\t\t\tconst structural = new StructuralDirectiveClass(\n\t\t\t\ttemplateRef,\n\t\t\t\tviewContainerRef,\n\t\t\t\thost\n\t\t\t);\n\t\t\ttemplateRef.host = structural;\n\t\t\tstack.pushReactiveScopeFor({ 'this': structural });\n\t\t\tconst dSubs = this.initStructuralDirective(structural, directive, stack);\n\t\t\tsubscriptions.push(...dSubs);\n\t\t\tif (isOnInit(structural)) {\n\t\t\t\tstructural.onInit();\n\t\t\t}\n\t\t\tif (directive.attributeDirectives?.length) {\n\t\t\t\tthis.initAttributeDirectives(directive.attributeDirectives, structural, stack, subscriptions);\n\t\t\t}\n\t\t\tif (isOnDestroy(structural)) {\n\t\t\t\tsubscriptions.push(createSubscriptionDestroyer(() => structural.onDestroy()));\n\t\t\t}\n\t\t} else {\n\t\t\t// didn't find directive or it is not define yet.\n\t\t\t// class registry should have 'when defined' callback\n\t\t}\n\t}\n\tcreateComment(node: CommentNode): Comment {\n\t\treturn document.createComment(`${node.comment}`);\n\t}\n\tcreateText(node: TextContent): Text {\n\t\treturn new Text(node.value);\n\t}\n\tcreateLiveText(textNode: LiveTextContent, contextStack: Stack, parentNode: Node, subscriptions: ScopeSubscription<ScopeContext>[]): Text {\n\t\tconst liveText = new Text('');\n\t\tcontextStack = contextStack.copyStack();\n\t\tcontextStack.pushBlockScopeFor({ this: liveText });\n\t\tconst textSubscriptions = textNode.expression.subscribe(contextStack, textNode.pipelineNames);\n\t\tsubscriptions.push(...textSubscriptions);\n\t\tcontextStack.detach();\n\t\ttextNode.expression.get(contextStack);\n\t\tcontextStack.reattach();\n\t\treturn liveText;\n\t}\n\tcreateDocumentFragment(node: DomFragmentNode, contextStack: Stack, parentNode: Node, subscriptions: ScopeSubscription<ScopeContext>[], host: HTMLComponent<any> | StructuralDirective): DocumentFragment {\n\t\tconst fragment = document.createDocumentFragment();\n\t\tnode.children?.forEach(child => this.appendChildToParent(fragment, child, contextStack, parentNode, subscriptions, host));\n\t\treturn fragment;\n\t}\n\tappendChildToParent(fragmentParent: HTMLElement | DocumentFragment, child: DomNode, contextStack: Stack, parentNode: Node, subscriptions: ScopeSubscription<ScopeContext>[], host: HTMLComponent<any> | StructuralDirective) {\n\t\tif (child instanceof DomElementNode) {\n\t\t\tif (this.isTemplateRefName(child)) {\n\t\t\t\tconst templateRefName = child.templateRefName!;\n\t\t\t\t// const oldRef = this.templateNameScope.get(templateRefName.name);\n\t\t\t\t// if (oldRef) {\n\t\t\t\t// \treturn;\n\t\t\t\t// }\n\t\t\t\t// TODO: extract template expression\n\t\t\t\tconst templateRef = new TemplateRefImpl(\n\t\t\t\t\tthis,\n\t\t\t\t\tnew DomFragmentNode(child.children),\n\t\t\t\t\tcontextStack.copyStack(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tthis.templateNameScope.set(templateRefName.name, templateRef);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfragmentParent.append(this.createElement(child, contextStack, subscriptions, parentNode, host));\n\t\t} else if (child instanceof DomStructuralDirectiveNode) {\n\t\t\tconst commentText = child.name + (typeof child.value == 'string' ? (' = ' + child.value) : '');\n\t\t\tconst comment = document.createComment(`start ${commentText}`);\n\t\t\tfragmentParent.append(comment);\n\t\t\tconst lastComment = document.createComment(`end ${commentText}`);\n\t\t\tcomment.after(lastComment);\n\t\t\tthis.createStructuralDirective(child, comment, contextStack, subscriptions, parentNode, host);\n\t\t} else if (isLiveTextContent(child)) {\n\t\t\tfragmentParent.append(this.createLiveText(child, contextStack, parentNode, subscriptions));\n\t\t} else if (child instanceof TextContent) {\n\t\t\tfragmentParent.append(this.createText(child));\n\t\t} else if (child instanceof CommentNode) {\n\t\t\tfragmentParent.append(this.createComment(child));\n\t\t} else if (child instanceof DomFragmentNode) {\n\t\t\tfragmentParent.append(this.createDocumentFragment(child, contextStack, parentNode, subscriptions, host));\n\t\t}\n\t}\n\tcreateElementByTagName(node: { tagName: string, is?: string }): HTMLElement {\n\t\tlet element: HTMLElement;\n\t\tif (isValidCustomElementName(node.tagName)) {\n\t\t\tconst ViewClass = customElements.get(node.tagName) as ((new () => HTMLElement) | undefined);\n\t\t\tif (ViewClass) {\n\t\t\t\telement = new ViewClass();\n\t\t\t} else {\n\t\t\t\telement = document.createElement(node.tagName);\n\t\t\t\tif (element.constructor.name === 'HTMLElement') {\n\t\t\t\t\tcustomElements.whenDefined(node.tagName).then(() => customElements.upgrade(element));\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (isTagNameNative(node.tagName)) {\n\t\t\t// native tags // and custom tags can be used her\n\t\t\telement = document.createElement(node.tagName, node.is ? { is: node.is } : undefined);\n\t\t} else {\n\t\t\t// html unknown element\n\t\t\telement = document.createElement(node.tagName);\n\t\t}\n\t\tif (isHTMLComponent(element)) {\n\t\t\telement.setParentComponent(this.view);\n\t\t}\n\t\treturn element;\n\t}\n\tcreateElement(node: DomElementNode, contextStack: Stack, subscriptions: ScopeSubscription<ScopeContext>[], parentNode: Node, host: HTMLComponent<any> | StructuralDirective): HTMLElement {\n\t\tconst element = this.createElementByTagName(node);\n\t\tconst elementStack = contextStack.copyStack();\n\t\tconst elementScope = isHTMLComponent(element) ? element._viewScope : elementStack.pushReactiveScopeFor({ 'this': element });\n\t\telementStack.pushScope<ScopeContext>(elementScope);\n\t\tconst attributesSubscriptions = this.initAttribute(element, node, elementStack);\n\t\tsubscriptions.push(...attributesSubscriptions);\n\t\tconst eventName = getInputEventName(element);\n\t\tlet listener: ((event: HTMLElementEventMap['input' | 'change']) => any) | undefined;\n\t\tif (eventName) {\n\t\t\tconst inputScope = elementScope.getScopeOrCreat('this');\n\t\t\tlistener = (event) => inputScope.emit('value', (element as HTMLInputElement).value);\n\t\t\telement.addEventListener(eventName, listener);\n\t\t}\n\n\t\tconst templateRefName = node.templateRefName;\n\t\tif (templateRefName) {\n\t\t\tReflect.set(this.view, templateRefName.name, element);\n\t\t\tthis.viewScope.set(templateRefName.name, element);\n\t\t\tconst view = this.componentRef.viewChild.find(child => child.selector === templateRefName.name);\n\t\t\tif (view) {\n\t\t\t\tReflect.set(this.view._model, view.modelName, element);\n\t\t\t}\n\t\t}\n\t\tif (node.children) {\n\t\t\tfor (const child of node.children) {\n\t\t\t\tthis.appendChildToParent(element, child, elementStack, element, subscriptions, host);\n\t\t\t}\n\t\t}\n\t\tif (node.attributeDirectives?.length) {\n\t\t\tthis.initAttributeDirectives(node.attributeDirectives, element, contextStack, subscriptions);\n\t\t}\n\t\treturn element;\n\t}\n\tprivate initAttributeDirectives(\n\t\tattributeDirectives: DomAttributeDirectiveNode[],\n\t\telement: HTMLElement | StructuralDirective,\n\t\tcontextStack: Stack, subscriptions: ScopeSubscription<ScopeContext>[]) {\n\t\tattributeDirectives?.forEach(directiveNode => {\n\t\t\tconst directiveRef = ClassRegistryProvider.getDirectiveRef<any>(directiveNode.name);\n\t\t\tif (directiveRef &&\n\t\t\t\t(directiveRef.modelClass.prototype instanceof AttributeDirective\n\t\t\t\t\t|| directiveRef.modelClass.prototype instanceof AttributeOnStructuralDirective\n\t\t\t\t)) {\n\t\t\t\tconst directive = new directiveRef.modelClass(element) as AttributeDirective | AttributeOnStructuralDirective;\n\t\t\t\tconst stack = contextStack.copyStack();\n\t\t\t\tstack.pushReactiveScopeFor({ 'this': directive });\n\t\t\t\tconst directiveSubscriptions = this.initStructuralDirective(directive, directiveNode, stack);\n\t\t\t\tsubscriptions.push(...directiveSubscriptions);\n\t\t\t\tif (isOnInit(directive)) {\n\t\t\t\t\tdirective.onInit();\n\t\t\t\t}\n\t\t\t\tif (isOnDestroy(directive)) {\n\t\t\t\t\tsubscriptions.push(createSubscriptionDestroyer(() => directive.onDestroy()));\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tinitAttribute(element: HTMLElement, node: DomElementNode, contextStack: Stack): ScopeSubscription<ScopeContext>[] {\n\t\tconst subscriptions: ScopeSubscription<ScopeContext>[] = [];\n\t\tif (node.attributes?.length) {\n\t\t\tnode.attributes.forEach(attr => {\n\t\t\t\t/**\n\t\t\t\t * <input id=\"23\" name=\"person-name\" />\n\t\t\t\t */\n\t\t\t\tconst isAttr = hasAttr(element, attr.name);\n\t\t\t\tif (isAttr) {\n\t\t\t\t\tif (attr.value === false) {\n\t\t\t\t\t\telement.removeAttribute(attr.name);\n\t\t\t\t\t} else if (attr.value === true) {\n\t\t\t\t\t\telement.setAttribute(attr.name, '');\n\t\t\t\t\t} else {\n\t\t\t\t\t\telement.setAttribute(attr.name, attr.value as string);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tReflect.set(element, attr.name, attr.value);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tif (node.twoWayBinding?.length) {\n\t\t\tnode.twoWayBinding.forEach(attr => {\n\t\t\t\tconst sub = attr.expression.subscribe(contextStack);\n\t\t\t\tsubscriptions.push(...sub);\n\t\t\t\tcontextStack.detach();\n\t\t\t\tattr.expression.get(contextStack);\n\t\t\t\tcontextStack.reattach();\n\t\t\t});\n\t\t}\n\t\tif (node.inputs?.length) {\n\t\t\tnode.inputs.forEach(attr => {\n\t\t\t\tconst sub = attr.expression.subscribe(contextStack, attr.pipelineNames);\n\t\t\t\tsubscriptions.push(...sub);\n\t\t\t\tcontextStack.detach();\n\t\t\t\tattr.expression.get(contextStack);\n\t\t\t\tcontextStack.reattach();\n\t\t\t});\n\t\t}\n\t\tif (node.outputs?.length) {\n\t\t\tnode.outputs.forEach(event => {\n\t\t\t\tlet listener: Function;\n\t\t\t\t/**\n\t\t\t\t * <a (click)=\"onLinkClick($event)\"></a>\n\t\t\t\t * <a @click=\"onLinkClick($event)\"></a>\n\t\t\t\t * <input [(value)]=\"person.name\" />\n\t\t\t\t * <input (value)=\"person.name\" />\n\t\t\t\t * <!-- <input (value)=\"person.name = $event\" /> -->\n\t\t\t\t * \n\t\t\t\t * TODO: diff of event listener and back-way data binding\n\t\t\t\t */\n\t\t\t\tif (typeof event.value === 'string') {\n\t\t\t\t\tlistener = ($event: Event) => {\n\t\t\t\t\t\tconst stack = contextStack.copyStack();\n\t\t\t\t\t\tstack.pushBlockScopeFor({ $event });\n\t\t\t\t\t\tstack.detach();\n\t\t\t\t\t\tevent.expression.get(stack);\n\t\t\t\t\t\tstack.reattach();\n\t\t\t\t\t};\n\t\t\t\t} else /* if (typeof event.sourceHandler === 'function')*/ {\n\t\t\t\t\t// let eventName: keyof HTMLElementEventMap = event.eventName;\n\t\t\t\t\tlistener = event.value;\n\t\t\t\t}\n\t\t\t\telement.addEventListener(event.name as any, listener as any);\n\t\t\t});\n\t\t}\n\t\tif (node.templateAttrs?.length) {\n\t\t\tnode.templateAttrs.forEach(attr => {\n\t\t\t\tconst sub = attr.expression.subscribe(contextStack);\n\t\t\t\tsubscriptions.push(...sub);\n\t\t\t\tcontextStack.detach();\n\t\t\t\tattr.expression.get(contextStack);\n\t\t\t\tcontextStack.reattach();\n\t\t\t});\n\t\t}\n\t\treturn subscriptions;\n\t}\n\n\tinitStructuralDirective(\n\t\tdirective: StructuralDirective | AttributeDirective | AttributeOnStructuralDirective,\n\t\tnode: DomStructuralDirectiveNode | DomAttributeDirectiveNode,\n\t\tcontextStack: Stack): ScopeSubscription<ScopeContext>[] {\n\t\tconst subscriptions: ScopeSubscription<ScopeContext>[] = [];\n\n\t\tif (node.attributes?.length) {\n\t\t\tnode.attributes.forEach(attr => Reflect.set(directive, attr.name, attr.value));\n\t\t}\n\t\tif (node.twoWayBinding?.length) {\n\t\t\tnode.twoWayBinding.forEach(attr => {\n\t\t\t\tconst sub = attr.expression.subscribe(contextStack);\n\t\t\t\tsubscriptions.push(...sub);\n\t\t\t\tcontextStack.detach();\n\t\t\t\tattr.expression.get(contextStack);\n\t\t\t\tcontextStack.reattach();\n\t\t\t});\n\t\t}\n\t\tif (node.inputs?.length) {\n\t\t\tnode.inputs.forEach(attr => {\n\t\t\t\tconst sub = attr.expression.subscribe(contextStack, attr.pipelineNames);\n\t\t\t\tsubscriptions.push(...sub);\n\t\t\t\tcontextStack.detach();\n\t\t\t\tattr.expression.get(contextStack);\n\t\t\t\tcontextStack.reattach();\n\t\t\t});\n\t\t}\n\t\tif (node.outputs?.length) {\n\t\t\tnode.outputs.forEach(event => {\n\t\t\t\tconst listener = ($event: Event) => {\n\t\t\t\t\tconst stack = contextStack.copyStack();\n\t\t\t\t\tstack.pushBlockScopeFor({ $event });\n\t\t\t\t\tstack.detach();\n\t\t\t\t\tevent.expression.get(stack);\n\t\t\t\t\tstack.reattach();\n\t\t\t\t};\n\t\t\t\t((<any>directive)[event.name] as any).subscribe(listener);\n\t\t\t});\n\t\t}\n\t\tif (node.templateAttrs?.length) {\n\t\t\tnode.templateAttrs.forEach(attr => {\n\t\t\t\tconst sub = attr.expression.subscribe(contextStack);\n\t\t\t\tsubscriptions.push(...sub);\n\t\t\t\tcontextStack.detach();\n\t\t\t\tattr.expression.get(contextStack);\n\t\t\t\tcontextStack.reattach();\n\t\t\t});\n\t\t}\n\t\t// TODO: \n\t\t// check host binding\n\t\treturn subscriptions;\n\t}\n\n}\n"]}
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/core/view/render.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,aAAa,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,WAAW,EAAE,0BAA0B,EACvC,cAAc,EAAE,eAAe,EAAW,iBAAiB,EAC3D,eAAe,EAAE,wBAAwB,EACzC,WAAW,EACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAiB,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,8BAA8B,EAAuB,MAAM,2BAA2B,CAAC;AACpH,OAAO,EAAe,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OA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MAAM,KAAK,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC;oBACvC,KAAK,CAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;oBACpC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;gBACtE,CAAC,CAAC;gBACK,SAAU,CAAC,KAAK,CAAC,IAAI,CAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;SACH;QACD,IAAI,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE;YAC/B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACjC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;gBACpD,aAAa,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;gBAC3B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;SACH;QACD,SAAS;QACT,qBAAqB;QACrB,OAAO,aAAa,CAAC;IACtB,CAAC;CAED","sourcesContent":["import {\n\tReactiveScope, Context, ScopeSubscription, Stack\n} from '@ibyar/expressions';\nimport {\n\tCommentNode, DomStructuralDirectiveNode, DomStructuralDirectiveNodeUpgrade,\n\tDomElementNode, DomFragmentNode, DomNode, isLiveTextContent,\n\tisTagNameNative, isValidCustomElementName, LiveTextContent,\n\tTextContent, DomAttributeDirectiveNode\n} from '@ibyar/elements';\nimport { ComponentRef } from '../component/component.js';\nimport { HTMLComponent, isHTMLComponent } from '../component/custom-element.js';\nimport { documentStack } from '../context/stack.js';\nimport { ClassRegistryProvider } from '../providers/provider.js';\nimport { isOnDestroy, isOnInit } from '../component/lifecycle.js';\nimport { hasAttr } from '../utils/elements-util.js';\nimport { AttributeDirective, AttributeOnStructuralDirective, StructuralDirective } from '../directive/directive.js';\nimport { TemplateRef, TemplateRefImpl } from '../linker/template-ref.js';\nimport { ViewContainerRefImpl } from '../linker/view-container-ref.js';\nimport { createSubscriptionDestroyer } from '../context/subscription.js';\nimport { HostListenerHandler } from '../render/host-listener.handler.js';\n\ntype ViewContext = { [element: string]: HTMLElement };\n\nfunction getInputEventName(element: HTMLElement): 'input' | 'change' | undefined {\n\tswitch (true) {\n\t\tcase element instanceof HTMLInputElement:\n\t\t\treturn 'input';\n\t\tcase element instanceof HTMLTextAreaElement:\n\t\tcase element instanceof HTMLSelectElement:\n\t\t\treturn 'change';\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\nexport class ComponentRender<T extends object> {\n\tprivate componentRef: ComponentRef<T>;\n\tprivate template: DomNode;\n\tprivate contextStack: Stack;\n\tprivate templateNameScope: ReactiveScope<{ [templateName: string]: TemplateRef }>;\n\tprivate viewScope: ReactiveScope<ViewContext> = new ReactiveScope({});\n\n\tconstructor(public view: HTMLComponent<T>, private subscriptions: ScopeSubscription<Context>[]) {\n\t\tthis.componentRef = this.view.getComponentRef();\n\t\tthis.contextStack = documentStack.copyStack();\n\t\tthis.contextStack.pushScope<Context>(this.view._modelScope);\n\t\tthis.templateNameScope = this.contextStack.pushReactiveScope();\n\t}\n\tinitView(): void {\n\t\tif (this.componentRef.template) {\n\t\t\tif (typeof this.componentRef.template === 'function') {\n\t\t\t\tthis.template = this.componentRef.template(this.view._model);\n\t\t\t} else {\n\t\t\t\tthis.template = this.componentRef.template;\n\t\t\t}\n\n\t\t\tlet rootRef: HTMLElement | ShadowRoot;\n\t\t\tif (this.componentRef.isShadowDom) {\n\t\t\t\tif (this.view.shadowRoot /* OPEN MODE */) {\n\t\t\t\t\trootRef = this.view.shadowRoot;\n\t\t\t\t} else /* CLOSED MODE*/ {\n\t\t\t\t\trootRef = Reflect.get(this.view, '_shadowRoot') as ShadowRoot;\n\t\t\t\t\tReflect.deleteProperty(this.view, '_shadowRoot');\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trootRef = this.view;\n\t\t\t}\n\t\t\tthis.initTemplateRefMap(this.template);\n\t\t\tlet rootFragment: DocumentFragment;\n\t\t\tif (this.template instanceof DomFragmentNode) {\n\t\t\t\trootFragment = this.createDocumentFragment(this.template, this.contextStack, rootRef, this.subscriptions, this.view);\n\t\t\t} else {\n\t\t\t\trootFragment = document.createDocumentFragment();\n\t\t\t\tthis.appendChildToParent(rootFragment, this.template, this.contextStack, rootRef, this.subscriptions, this.view);\n\t\t\t}\n\t\t\trootRef.append(rootFragment);\n\t\t}\n\t}\n\tisTemplateRefName(template: DomNode): template is DomElementNode {\n\t\tif (template instanceof DomElementNode) {\n\t\t\tif (template.tagName === 'template' && template.templateRefName) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\tinitTemplateRefMap(domNode: DomNode) {\n\t\tif (domNode instanceof DomElementNode || domNode instanceof DomFragmentNode) {\n\t\t\tif (domNode.children) {\n\t\t\t\tfor (let index = 0; index < domNode.children.length; index++) {\n\t\t\t\t\tconst child = domNode.children[index];\n\t\t\t\t\tif (this.isTemplateRefName(child)) {\n\t\t\t\t\t\tthis.templateNameScope.set(child.templateRefName!.name, undefined);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.initTemplateRefMap(child);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tinitHostListener(): void {\n\t\tconst handlers = this.componentRef.hostListeners.map(listenerRef => new HostListenerHandler(listenerRef, this.view, this.viewScope));\n\t\thandlers.forEach(handler => handler.onInit());\n\t\thandlers.forEach(handler => this.subscriptions.push(createSubscriptionDestroyer(\n\t\t\t() => handler.onDestroy(),\n\t\t\t() => handler.onDisconnect(),\n\t\t\t() => handler.onConnect(),\n\t\t)));\n\t}\n\taddNativeEventListener(source: HTMLElement | Window, eventName: string, funcCallback: Function) {\n\t\tsource.addEventListener(eventName, (event: Event) => {\n\t\t\tthis.view._zone.run(funcCallback as () => void, this.view._model);\n\t\t});\n\t}\n\tgetElementByName(name: string) {\n\t\treturn Reflect.get(this.view, name);\n\t}\n\tcreateStructuralDirective(directive: DomStructuralDirectiveNode, comment: Comment, directiveStack: Stack, subscriptions: ScopeSubscription<Context>[], parentNode: Node, host: HTMLComponent<any> | StructuralDirective): void {\n\t\tconst directiveRef = ClassRegistryProvider.getDirectiveRef<T>(directive.name);\n\t\tif (directiveRef) {\n\t\t\tconst stack = directiveStack.copyStack();\n\t\t\tconst templateRef = new TemplateRefImpl(\n\t\t\t\tthis,\n\t\t\t\tdirective.node,\n\t\t\t\tstack,\n\t\t\t\t(directive as DomStructuralDirectiveNodeUpgrade).templateExpressions ?? [],\n\t\t\t);\n\t\t\tconst viewContainerRef = new ViewContainerRefImpl(parentNode as Element, comment);\n\n\t\t\t// structural directive selector\n\t\t\tconst StructuralDirectiveClass = directiveRef.modelClass as typeof StructuralDirective;\n\t\t\tconst structural = new StructuralDirectiveClass(\n\t\t\t\ttemplateRef,\n\t\t\t\tviewContainerRef,\n\t\t\t\thost\n\t\t\t);\n\t\t\ttemplateRef.host = structural;\n\t\t\tconst scope = ReactiveScope.readOnlyScopeForThis(structural);\n\t\t\tstack.pushScope(scope);\n\n\t\t\tconst dSubs = this.initStructuralDirective(structural, directive, stack);\n\t\t\tsubscriptions.push(...dSubs);\n\t\t\tif (isOnInit(structural)) {\n\t\t\t\tstructural.onInit();\n\t\t\t}\n\t\t\tif (directive.attributeDirectives?.length) {\n\t\t\t\tthis.initAttributeDirectives(directive.attributeDirectives, structural, stack, subscriptions);\n\t\t\t}\n\t\t\tif (isOnDestroy(structural)) {\n\t\t\t\tsubscriptions.push(createSubscriptionDestroyer(() => structural.onDestroy()));\n\t\t\t}\n\t\t} else {\n\t\t\t// didn't find directive or it is not define yet.\n\t\t\t// class registry should have 'when defined' callback\n\t\t}\n\t}\n\tcreateComment(node: CommentNode): Comment {\n\t\treturn document.createComment(`${node.comment}`);\n\t}\n\tcreateText(node: TextContent): Text {\n\t\treturn new Text(node.value);\n\t}\n\tcreateLiveText(textNode: LiveTextContent, contextStack: Stack, parentNode: Node, subscriptions: ScopeSubscription<Context>[]): Text {\n\t\tconst liveText = new Text('');\n\t\tcontextStack = contextStack.copyStack();\n\t\tcontextStack.pushBlockScopeFor({ this: liveText });\n\t\tconst textSubscriptions = textNode.expression.subscribe(contextStack, textNode.pipelineNames);\n\t\tsubscriptions.push(...textSubscriptions);\n\t\ttextNode.expression.get(contextStack);\n\t\treturn liveText;\n\t}\n\tcreateDocumentFragment(node: DomFragmentNode, contextStack: Stack, parentNode: Node, subscriptions: ScopeSubscription<Context>[], host: HTMLComponent<any> | StructuralDirective): DocumentFragment {\n\t\tconst fragment = document.createDocumentFragment();\n\t\tnode.children?.forEach(child => this.appendChildToParent(fragment, child, contextStack, parentNode, subscriptions, host));\n\t\treturn fragment;\n\t}\n\tappendChildToParent(fragmentParent: HTMLElement | DocumentFragment, child: DomNode, contextStack: Stack, parentNode: Node, subscriptions: ScopeSubscription<Context>[], host: HTMLComponent<any> | StructuralDirective) {\n\t\tif (child instanceof DomElementNode) {\n\t\t\tif (this.isTemplateRefName(child)) {\n\t\t\t\tconst templateRefName = child.templateRefName!;\n\t\t\t\t// const oldRef = this.templateNameScope.get(templateRefName.name);\n\t\t\t\t// if (oldRef) {\n\t\t\t\t// \treturn;\n\t\t\t\t// }\n\t\t\t\t// TODO: extract template expression\n\t\t\t\tconst templateRef = new TemplateRefImpl(\n\t\t\t\t\tthis,\n\t\t\t\t\tnew DomFragmentNode(child.children),\n\t\t\t\t\tcontextStack.copyStack(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tthis.templateNameScope.set(templateRefName.name, templateRef);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfragmentParent.append(this.createElement(child, contextStack, subscriptions, parentNode, host));\n\t\t} else if (child instanceof DomStructuralDirectiveNode) {\n\t\t\tconst commentText = child.name + (typeof child.value == 'string' ? (' = ' + child.value) : '');\n\t\t\tconst comment = document.createComment(`start ${commentText}`);\n\t\t\tfragmentParent.append(comment);\n\t\t\tconst lastComment = document.createComment(`end ${commentText}`);\n\t\t\tcomment.after(lastComment);\n\t\t\tthis.createStructuralDirective(child, comment, contextStack, subscriptions, parentNode, host);\n\t\t} else if (isLiveTextContent(child)) {\n\t\t\tfragmentParent.append(this.createLiveText(child, contextStack, parentNode, subscriptions));\n\t\t} else if (child instanceof TextContent) {\n\t\t\tfragmentParent.append(this.createText(child));\n\t\t} else if (child instanceof CommentNode) {\n\t\t\tfragmentParent.append(this.createComment(child));\n\t\t} else if (child instanceof DomFragmentNode) {\n\t\t\tfragmentParent.append(this.createDocumentFragment(child, contextStack, parentNode, subscriptions, host));\n\t\t}\n\t}\n\tcreateElementByTagName(node: { tagName: string, is?: string }): HTMLElement {\n\t\tlet element: HTMLElement;\n\t\tif (isValidCustomElementName(node.tagName)) {\n\t\t\tconst ViewClass = customElements.get(node.tagName) as ((new () => HTMLElement) | undefined);\n\t\t\tif (ViewClass) {\n\t\t\t\telement = new ViewClass();\n\t\t\t} else {\n\t\t\t\telement = document.createElement(node.tagName);\n\t\t\t\tif (element.constructor.name === 'HTMLElement') {\n\t\t\t\t\tcustomElements.whenDefined(node.tagName).then(() => customElements.upgrade(element));\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (isTagNameNative(node.tagName)) {\n\t\t\t// native tags // and custom tags can be used her\n\t\t\telement = document.createElement(node.tagName, node.is ? { is: node.is } : undefined);\n\t\t} else {\n\t\t\t// html unknown element\n\t\t\telement = document.createElement(node.tagName);\n\t\t}\n\t\tif (isHTMLComponent(element)) {\n\t\t\telement.setParentComponent(this.view);\n\t\t}\n\t\treturn element;\n\t}\n\tcreateElement(node: DomElementNode, contextStack: Stack, subscriptions: ScopeSubscription<Context>[], parentNode: Node, host: HTMLComponent<any> | StructuralDirective): HTMLElement {\n\t\tconst element = this.createElementByTagName(node);\n\t\tconst elementStack = contextStack.copyStack();\n\t\tconst elementScope = isHTMLComponent(element)\n\t\t\t? element._viewScope\n\t\t\t: ReactiveScope.readOnlyScopeForThis(element);\n\t\telementStack.pushScope<Context>(elementScope);\n\t\tconst attributesSubscriptions = this.initAttribute(element, node, elementStack);\n\t\tsubscriptions.push(...attributesSubscriptions);\n\t\tconst eventName = getInputEventName(element);\n\t\tif (eventName) {\n\t\t\tconst inputScope = elementScope.getInnerScope<ReactiveScope<HTMLInputElement>>('this')!;\n\t\t\tconst listener = (event: HTMLElementEventMap['input' | 'change']) => inputScope.emit('value', (element as HTMLInputElement).value);\n\t\t\telement.addEventListener(eventName, listener);\n\t\t}\n\n\t\tconst templateRefName = node.templateRefName;\n\t\tif (templateRefName) {\n\t\t\tReflect.set(this.view, templateRefName.name, element);\n\t\t\tthis.viewScope.set(templateRefName.name, element);\n\t\t\tconst view = this.componentRef.viewChild.find(child => child.selector === templateRefName.name);\n\t\t\tif (view) {\n\t\t\t\tReflect.set(this.view._model, view.modelName, element);\n\t\t\t}\n\t\t}\n\t\tif (node.children) {\n\t\t\tfor (const child of node.children) {\n\t\t\t\tthis.appendChildToParent(element, child, elementStack, element, subscriptions, host);\n\t\t\t}\n\t\t}\n\t\tif (node.attributeDirectives?.length) {\n\t\t\tthis.initAttributeDirectives(node.attributeDirectives, element, contextStack, subscriptions);\n\t\t}\n\t\treturn element;\n\t}\n\tprivate initAttributeDirectives(\n\t\tattributeDirectives: DomAttributeDirectiveNode[],\n\t\telement: HTMLElement | StructuralDirective,\n\t\tcontextStack: Stack, subscriptions: ScopeSubscription<Context>[]) {\n\t\tattributeDirectives?.forEach(directiveNode => {\n\t\t\tconst directiveRef = ClassRegistryProvider.getDirectiveRef<any>(directiveNode.name);\n\t\t\tif (directiveRef &&\n\t\t\t\t(directiveRef.modelClass.prototype instanceof AttributeDirective\n\t\t\t\t\t|| directiveRef.modelClass.prototype instanceof AttributeOnStructuralDirective\n\t\t\t\t)) {\n\t\t\t\tconst directive = new directiveRef.modelClass(element) as AttributeDirective | AttributeOnStructuralDirective;\n\t\t\t\tconst stack = contextStack.copyStack();\n\t\t\t\tstack.pushReactiveScopeFor({ 'this': directive });\n\n\t\t\t\tconst directiveSubscriptions = this.initStructuralDirective(directive, directiveNode, stack);\n\t\t\t\tsubscriptions.push(...directiveSubscriptions);\n\t\t\t\tif (isOnInit(directive)) {\n\t\t\t\t\tdirective.onInit();\n\t\t\t\t}\n\t\t\t\tif (isOnDestroy(directive)) {\n\t\t\t\t\tsubscriptions.push(createSubscriptionDestroyer(() => directive.onDestroy()));\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tinitAttribute(element: HTMLElement, node: DomElementNode, contextStack: Stack): ScopeSubscription<Context>[] {\n\t\tconst subscriptions: ScopeSubscription<Context>[] = [];\n\t\tif (node.attributes?.length) {\n\t\t\tnode.attributes.forEach(attr => {\n\t\t\t\t/**\n\t\t\t\t * <input id=\"23\" name=\"person-name\" />\n\t\t\t\t */\n\t\t\t\tconst isAttr = hasAttr(element, attr.name);\n\t\t\t\tif (isAttr) {\n\t\t\t\t\tif (attr.value === false) {\n\t\t\t\t\t\telement.removeAttribute(attr.name);\n\t\t\t\t\t} else if (attr.value === true) {\n\t\t\t\t\t\telement.setAttribute(attr.name, '');\n\t\t\t\t\t} else {\n\t\t\t\t\t\telement.setAttribute(attr.name, attr.value as string);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tReflect.set(element, attr.name, attr.value);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tif (node.twoWayBinding?.length) {\n\t\t\tnode.twoWayBinding.forEach(attr => {\n\t\t\t\tconst sub = attr.expression.subscribe(contextStack);\n\t\t\t\tsubscriptions.push(...sub);\n\t\t\t\tattr.expression.get(contextStack);\n\t\t\t});\n\t\t}\n\t\tif (node.inputs?.length) {\n\t\t\tnode.inputs.forEach(attr => {\n\t\t\t\tconst sub = attr.expression.subscribe(contextStack, attr.pipelineNames);\n\t\t\t\tsubscriptions.push(...sub);\n\t\t\t\tattr.expression.get(contextStack);\n\t\t\t});\n\t\t}\n\t\tif (node.outputs?.length) {\n\t\t\tnode.outputs.forEach(event => {\n\t\t\t\tlet listener: Function;\n\t\t\t\t/**\n\t\t\t\t * <a (click)=\"onLinkClick($event)\"></a>\n\t\t\t\t * <a @click=\"onLinkClick($event)\"></a>\n\t\t\t\t * <input [(value)]=\"person.name\" />\n\t\t\t\t * <input (value)=\"person.name\" />\n\t\t\t\t * <!-- <input (value)=\"person.name = $event\" /> -->\n\t\t\t\t * \n\t\t\t\t * TODO: diff of event listener and back-way data binding\n\t\t\t\t */\n\t\t\t\tif (typeof event.value === 'string') {\n\t\t\t\t\tlistener = ($event: Event) => {\n\t\t\t\t\t\tconst stack = contextStack.copyStack();\n\t\t\t\t\t\tstack.pushBlockScopeFor({ $event });\n\t\t\t\t\t\tthis.view._zone.run(event.expression.get, event.expression, [stack]);\n\t\t\t\t\t};\n\t\t\t\t} else /* if (typeof event.sourceHandler === 'function')*/ {\n\t\t\t\t\t// let eventName: keyof HTMLElementEventMap = event.eventName;\n\t\t\t\t\tlistener = event.value;\n\t\t\t\t}\n\t\t\t\telement.addEventListener(event.name as any, listener as any);\n\t\t\t});\n\t\t}\n\t\tif (node.templateAttrs?.length) {\n\t\t\tnode.templateAttrs.forEach(attr => {\n\t\t\t\tconst sub = attr.expression.subscribe(contextStack);\n\t\t\t\tsubscriptions.push(...sub);\n\t\t\t\tattr.expression.get(contextStack);\n\t\t\t});\n\t\t}\n\t\treturn subscriptions;\n\t}\n\tinitStructuralDirective(\n\t\tdirective: StructuralDirective | AttributeDirective | AttributeOnStructuralDirective,\n\t\tnode: DomStructuralDirectiveNode | DomAttributeDirectiveNode,\n\t\tcontextStack: Stack): ScopeSubscription<Context>[] {\n\t\tconst subscriptions: ScopeSubscription<Context>[] = [];\n\n\t\tif (node.attributes?.length) {\n\t\t\tnode.attributes.forEach(attr => Reflect.set(directive, attr.name, attr.value));\n\t\t}\n\t\tif (node.twoWayBinding?.length) {\n\t\t\tnode.twoWayBinding.forEach(attr => {\n\t\t\t\tconst sub = attr.expression.subscribe(contextStack);\n\t\t\t\tsubscriptions.push(...sub);\n\t\t\t\tattr.expression.get(contextStack);\n\t\t\t});\n\t\t}\n\t\tif (node.inputs?.length) {\n\t\t\tnode.inputs.forEach(attr => {\n\t\t\t\tconst sub = attr.expression.subscribe(contextStack, attr.pipelineNames);\n\t\t\t\tsubscriptions.push(...sub);\n\t\t\t\tattr.expression.get(contextStack);\n\t\t\t});\n\t\t}\n\t\tif (node.outputs?.length) {\n\t\t\tnode.outputs.forEach(event => {\n\t\t\t\tconst listener = ($event: Event) => {\n\t\t\t\t\tconst stack = contextStack.copyStack();\n\t\t\t\t\tstack.pushBlockScopeFor({ $event });\n\t\t\t\t\tthis.view._zone.run(event.expression.get, event.expression, [stack]);\n\t\t\t\t};\n\t\t\t\t((<any>directive)[event.name] as any).subscribe(listener);\n\t\t\t});\n\t\t}\n\t\tif (node.templateAttrs?.length) {\n\t\t\tnode.templateAttrs.forEach(attr => {\n\t\t\t\tconst sub = attr.expression.subscribe(contextStack);\n\t\t\t\tsubscriptions.push(...sub);\n\t\t\t\tattr.expression.get(contextStack);\n\t\t\t});\n\t\t}\n\t\t// TODO: \n\t\t// check host binding\n\t\treturn subscriptions;\n\t}\n\n}\n"]}
package/view/view.d.ts CHANGED
@@ -2,6 +2,11 @@ import type { TypeOf } from '../utils/typeof.js';
2
2
  import { ComponentRef } from '../component/component.js';
3
3
  import { HTMLComponent } from '../component/custom-element.js';
4
4
  import { Constructable } from '../providers/injector.js';
5
+ /**
6
+ *
7
+ * @param modelClass
8
+ * @param componentRef
9
+ */
5
10
  export declare function initCustomElementView<T extends Object>(modelClass: TypeOf<T>, componentRef: ComponentRef<T>): TypeOf<HTMLComponent<T>>;
6
11
  export declare type ComponentModelClass = Constructable & {
7
12
  [key: string]: string;
package/view/view.js CHANGED
@@ -2,6 +2,11 @@ import { getAllAttributes, isFormElement } from '@ibyar/elements';
2
2
  import { ToCamelCase } from '../utils/utils.js';
3
3
  import { baseFactoryView } from './base-view.js';
4
4
  import { baseFormFactoryView } from './form-view.js';
5
+ /**
6
+ *
7
+ * @param modelClass
8
+ * @param componentRef
9
+ */
5
10
  export function initCustomElementView(modelClass, componentRef) {
6
11
  const htmlParent = componentRef.extend.classRef;
7
12
  let viewClass;
@@ -64,11 +69,13 @@ export function initCustomElementView(modelClass, componentRef) {
64
69
  .concat(componentRef.outputs.map(output => output.modelProperty))
65
70
  .concat(componentRef.hostBindings.map(host => host.hostPropertyName))
66
71
  .concat(componentRef.viewChild.map(child => child.modelName))
72
+ .filter(modelName => !(modelName in modelClass.prototype))
67
73
  .forEach(modelName => modelClass.prototype[modelName] = undefined);
68
74
  const defaultAttributes = getAllAttributes(componentRef.extend.name);
69
75
  const observedAttributes = componentRef.inputs.map(input => input.viewAttribute);
70
76
  Reflect.set(viewClass, 'observedAttributes', observedAttributes);
71
77
  Reflect.set(viewClass, 'allAttributes', defaultAttributes.concat(observedAttributes));
78
+ // https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example
72
79
  if (false) {
73
80
  Object.defineProperty(viewClass, 'formAssociated', {
74
81
  get() {
package/view/view.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"view.js","sourceRoot":"","sources":["../../../src/core/view/view.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIlE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAOrD,MAAM,UAAU,qBAAqB,CAAmB,UAAqB,EAAE,YAA6B;IAC3G,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,CAAC,QAA+B,CAAC;IACvE,IAAI,SAAmC,CAAC;IACxC,MAAM,aAAa,GAAG,8BAA8B,CAAC,Y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AAiB,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAE3E,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,EAAE;QACvC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;KACzC;IAED,IAAI,qBAAqB,CAAC,UAAU,CAAC,EAAE;QACtC,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,iBAAiB,CAAC;KACnD;AACF,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,QAAgB;IAC9D,OAAO,QAAQ;SACb,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;SAC5D,IAAI,CAAC,EAAE,CAAC,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAmB,UAAqB,EAAE,QAAiB;IAC1F,IAAI,qBAAqB,CAAC,UAAU,CAAC,EAAE;QACtC,IAAI,aAAqB,CAAC;QAC1B,IAAI,QAAQ,EAAE;YACb,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAC/C,IAAI,CAAC,aAAa,EAAE;gBACnB,MAAM,IAAI,KAAK,CAAC,GAAG,UAAU,CAAC,IAAI,iBAAiB,QAAQ,UAAU,CAAC,CAAC;aACvE;SACD;aAAM;YACN,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;SACrD;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;KAC9C;IACD,OAAO;AACR,CAAC","sourcesContent":["import type { TypeOf } from '../utils/typeof.js';\nimport { getAllAttributes, isFormElement } from '@ibyar/elements';\nimport { ComponentRef } from '../component/component.js';\nimport { HTMLComponent } from '../component/custom-element.js';\nimport { EventEmitter, Subscription } from '../component/events.js';\nimport { ToCamelCase } from '../utils/utils.js';\nimport { Constructable } from '../providers/injector.js';\nimport { baseFactoryView } from './base-view.js';\nimport { baseFormFactoryView } from './form-view.js';\n\n/**\n * \n * @param modelClass \n * @param componentRef \n */\nexport function initCustomElementView<T extends Object>(modelClass: TypeOf<T>, componentRef: ComponentRef<T>): TypeOf<HTMLComponent<T>> {\n\tconst htmlParent = componentRef.extend.classRef as TypeOf<HTMLElement>;\n\tlet viewClass: TypeOf<HTMLComponent<T>>;\n\tconst viewClassName = buildViewClassNameFromSelector(componentRef.selector);\n\tconst htmlViewClassName = `HTML${viewClassName}Element`;\n\tconst parentClass = componentRef.extend.name\n\t\t? (isFormElement(componentRef.extend.name)\n\t\t\t? baseFormFactoryView<T>(htmlParent)\n\t\t\t: baseFactoryView<T>(htmlParent)\n\t\t)\n\t\t: baseFactoryView<T>(HTMLElement);\n\tviewClass = ({\n\t\t[htmlViewClassName]: class extends parentClass { constructor() { super(componentRef, modelClass); } }\n\t})[htmlViewClassName];\n\n\tcomponentRef.inputs.forEach((input) => {\n\t\tObject.defineProperty(viewClass.prototype, input.viewAttribute, {\n\t\t\tget(this: HTMLComponent<T>): any {\n\t\t\t\treturn this._modelScope.get(input.modelProperty);\n\t\t\t},\n\t\t\tset(this: HTMLComponent<{ [key: string]: any; }>, value: any) {\n\t\t\t\tthis._modelScope.set(input.modelProperty, value);\n\t\t\t},\n\t\t\tenumerable: true,\n\t\t});\n\t});\n\n\tcomponentRef.outputs.forEach(output => {\n\t\tObject.defineProperty(viewClass.prototype, output.viewAttribute, {\n\t\t\tget(): EventEmitter<any> {\n\t\t\t\treturn this._model[output.modelProperty];\n\t\t\t},\n\t\t\tenumerable: true\n\t\t});\n\t\tlet eventListener: Function | undefined;\n\t\tlet subscription: Subscription<any>;\n\t\tObject.defineProperty(viewClass.prototype, 'on' + ToCamelCase(output.viewAttribute), {\n\t\t\tget(): Function | undefined {\n\t\t\t\treturn eventListener;\n\t\t\t},\n\t\t\tset(this: HTMLComponent<T>, event: string | Function): void {\n\t\t\t\tif (!event) {\n\t\t\t\t\tif (subscription) {\n\t\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t\t\teventListener = undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (typeof event === 'string') {\n\t\t\t\t\tif (event.endsWith('()')) {\n\t\t\t\t\t\tevent = event.substring(0, event.length - 2);\n\t\t\t\t\t}\n\t\t\t\t\tevent = Reflect.get(window, event);\n\t\t\t\t}\n\t\t\t\teventListener = event as Function;\n\t\t\t\tsubscription = (this._model[output.modelProperty] as EventEmitter<any>).subscribe(event);\n\t\t\t},\n\t\t\tenumerable: true\n\t\t});\n\t});\n\n\tcomponentRef.inputs.map(input => input.modelProperty)\n\t\t.concat(componentRef.outputs.map(output => output.modelProperty))\n\t\t.concat(componentRef.hostBindings.map(host => host.hostPropertyName))\n\t\t.concat(componentRef.viewChild.map(child => child.modelName))\n\t\t.forEach(modelName => modelClass.prototype[modelName] = undefined);\n\n\tconst defaultAttributes = getAllAttributes(componentRef.extend.name);\n\tconst observedAttributes = componentRef.inputs.map(input => input.viewAttribute)\n\tReflect.set(viewClass, 'observedAttributes', observedAttributes);\n\tReflect.set(viewClass, 'allAttributes', defaultAttributes.concat(observedAttributes));\n\t// https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example\n\tif (false) {\n\t\tObject.defineProperty(viewClass, 'formAssociated', {\n\t\t\tget() {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n\t}\n\taddViewToModelClass<T>(modelClass, componentRef.selector, viewClass, htmlViewClassName);\n\tif (!Reflect.has(window, htmlViewClassName)) {\n\t\tReflect.set(window, htmlViewClassName, viewClass);\n\t}\n\treturn viewClass;\n}\n\nexport type ComponentModelClass = Constructable & { [key: string]: string } & { component: { [key: string]: string } };\n\nexport function isComponentModelClass(target: Constructable): target is ComponentModelClass {\n\treturn Reflect.has(target, 'component');\n}\n\nexport function addViewToModelClass<T extends object>(modelClass: TypeOf<T>, selector: string, viewClass: TypeOf<HTMLComponent<T>>, htmlViewClassName: string) {\n\tObject.defineProperty(modelClass, htmlViewClassName, { value: viewClass });\n\n\tif (!isComponentModelClass(modelClass)) {\n\t\tReflect.set(modelClass, 'component', {});\n\t}\n\n\tif (isComponentModelClass(modelClass)) {\n\t\tmodelClass.component[selector] = htmlViewClassName;\n\t}\n}\n\nexport function buildViewClassNameFromSelector(selector: string) {\n\treturn selector\n\t\t.split('-')\n\t\t.map(name => name.replace(/^\\w/, char => char.toUpperCase()))\n\t\t.join('');\n}\n\nexport function getComponentView<T extends object>(modelClass: TypeOf<T>, selector?: string): TypeOf<HTMLComponent<T>> | undefined {\n\tif (isComponentModelClass(modelClass)) {\n\t\tlet viewClassName: string;\n\t\tif (selector) {\n\t\t\tviewClassName = modelClass.component[selector];\n\t\t\tif (!viewClassName) {\n\t\t\t\tthrow new Error(`${modelClass.name} doesn't have ${selector} as view`);\n\t\t\t}\n\t\t} else {\n\t\t\tviewClassName = Object.keys(modelClass.component)[0];\n\t\t}\n\t\treturn Reflect.get(modelClass, viewClassName);\n\t}\n\treturn;\n}\n"]}
1
+ {"version":3,"file":"view.js","sourceRoot":"","sources":["../../../src/core/view/view.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIlE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAmB,UAAqB,EAAE,YAA6B;IAC3G,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,CAAC,QAA+B,CAAC;IACvE,IAAI,SAAmC,CAAC;IACxC,MAAM,aAAa,GAAG,8BAA8B,CAAC,YAAY,CA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import type { TypeOf } from '../utils/typeof.js';\nimport { getAllAttributes, isFormElement } from '@ibyar/elements';\nimport { ComponentRef } from '../component/component.js';\nimport { HTMLComponent } from '../component/custom-element.js';\nimport { EventEmitter, Subscription } from '../component/events.js';\nimport { ToCamelCase } from '../utils/utils.js';\nimport { Constructable } from '../providers/injector.js';\nimport { baseFactoryView } from './base-view.js';\nimport { baseFormFactoryView } from './form-view.js';\n\n/**\n * \n * @param modelClass \n * @param componentRef \n */\nexport function initCustomElementView<T extends Object>(modelClass: TypeOf<T>, componentRef: ComponentRef<T>): TypeOf<HTMLComponent<T>> {\n\tconst htmlParent = componentRef.extend.classRef as TypeOf<HTMLElement>;\n\tlet viewClass: TypeOf<HTMLComponent<T>>;\n\tconst viewClassName = buildViewClassNameFromSelector(componentRef.selector);\n\tconst htmlViewClassName = `HTML${viewClassName}Element`;\n\tconst parentClass = componentRef.extend.name\n\t\t? (isFormElement(componentRef.extend.name)\n\t\t\t? baseFormFactoryView<T>(htmlParent)\n\t\t\t: baseFactoryView<T>(htmlParent)\n\t\t)\n\t\t: baseFactoryView<T>(HTMLElement);\n\tviewClass = ({\n\t\t[htmlViewClassName]: class extends parentClass { constructor() { super(componentRef, modelClass); } }\n\t})[htmlViewClassName];\n\n\tcomponentRef.inputs.forEach((input) => {\n\t\tObject.defineProperty(viewClass.prototype, input.viewAttribute, {\n\t\t\tget(this: HTMLComponent<T>): any {\n\t\t\t\treturn this._modelScope.get(input.modelProperty);\n\t\t\t},\n\t\t\tset(this: HTMLComponent<{ [key: string]: any; }>, value: any) {\n\t\t\t\tthis._modelScope.set(input.modelProperty, value);\n\t\t\t},\n\t\t\tenumerable: true,\n\t\t});\n\t});\n\n\tcomponentRef.outputs.forEach(output => {\n\t\tObject.defineProperty(viewClass.prototype, output.viewAttribute, {\n\t\t\tget(): EventEmitter<any> {\n\t\t\t\treturn this._model[output.modelProperty];\n\t\t\t},\n\t\t\tenumerable: true\n\t\t});\n\t\tlet eventListener: Function | undefined;\n\t\tlet subscription: Subscription<any>;\n\t\tObject.defineProperty(viewClass.prototype, 'on' + ToCamelCase(output.viewAttribute), {\n\t\t\tget(): Function | undefined {\n\t\t\t\treturn eventListener;\n\t\t\t},\n\t\t\tset(this: HTMLComponent<T>, event: string | Function): void {\n\t\t\t\tif (!event) {\n\t\t\t\t\tif (subscription) {\n\t\t\t\t\t\tsubscription.unsubscribe();\n\t\t\t\t\t\teventListener = undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (typeof event === 'string') {\n\t\t\t\t\tif (event.endsWith('()')) {\n\t\t\t\t\t\tevent = event.substring(0, event.length - 2);\n\t\t\t\t\t}\n\t\t\t\t\tevent = Reflect.get(window, event);\n\t\t\t\t}\n\t\t\t\teventListener = event as Function;\n\t\t\t\tsubscription = (this._model[output.modelProperty] as EventEmitter<any>).subscribe(event);\n\t\t\t},\n\t\t\tenumerable: true\n\t\t});\n\t});\n\n\tcomponentRef.inputs.map(input => input.modelProperty)\n\t\t.concat(componentRef.outputs.map(output => output.modelProperty))\n\t\t.concat(componentRef.hostBindings.map(host => host.hostPropertyName))\n\t\t.concat(componentRef.viewChild.map(child => child.modelName))\n\t\t.filter(modelName => !(modelName in modelClass.prototype))\n\t\t.forEach(modelName => modelClass.prototype[modelName] = undefined);\n\n\tconst defaultAttributes = getAllAttributes(componentRef.extend.name);\n\tconst observedAttributes = componentRef.inputs.map(input => input.viewAttribute)\n\tReflect.set(viewClass, 'observedAttributes', observedAttributes);\n\tReflect.set(viewClass, 'allAttributes', defaultAttributes.concat(observedAttributes));\n\t// https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example\n\tif (false) {\n\t\tObject.defineProperty(viewClass, 'formAssociated', {\n\t\t\tget() {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n\t}\n\taddViewToModelClass<T>(modelClass, componentRef.selector, viewClass, htmlViewClassName);\n\tif (!Reflect.has(window, htmlViewClassName)) {\n\t\tReflect.set(window, htmlViewClassName, viewClass);\n\t}\n\treturn viewClass;\n}\n\nexport type ComponentModelClass = Constructable & { [key: string]: string } & { component: { [key: string]: string } };\n\nexport function isComponentModelClass(target: Constructable): target is ComponentModelClass {\n\treturn Reflect.has(target, 'component');\n}\n\nexport function addViewToModelClass<T extends object>(modelClass: TypeOf<T>, selector: string, viewClass: TypeOf<HTMLComponent<T>>, htmlViewClassName: string) {\n\tObject.defineProperty(modelClass, htmlViewClassName, { value: viewClass });\n\n\tif (!isComponentModelClass(modelClass)) {\n\t\tReflect.set(modelClass, 'component', {});\n\t}\n\n\tif (isComponentModelClass(modelClass)) {\n\t\tmodelClass.component[selector] = htmlViewClassName;\n\t}\n}\n\nexport function buildViewClassNameFromSelector(selector: string) {\n\treturn selector\n\t\t.split('-')\n\t\t.map(name => name.replace(/^\\w/, char => char.toUpperCase()))\n\t\t.join('');\n}\n\nexport function getComponentView<T extends object>(modelClass: TypeOf<T>, selector?: string): TypeOf<HTMLComponent<T>> | undefined {\n\tif (isComponentModelClass(modelClass)) {\n\t\tlet viewClassName: string;\n\t\tif (selector) {\n\t\t\tviewClassName = modelClass.component[selector];\n\t\t\tif (!viewClassName) {\n\t\t\t\tthrow new Error(`${modelClass.name} doesn't have ${selector} as view`);\n\t\t\t}\n\t\t} else {\n\t\t\tviewClassName = Object.keys(modelClass.component)[0];\n\t\t}\n\t\treturn Reflect.get(modelClass, viewClassName);\n\t}\n\treturn;\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { AuroraZone, ManualAuroraZone, ProxyAuroraZone } from './zone.js';
2
+ export declare type ZoneType =
3
+ /**
4
+ * used when zone.js is disabled, no change detection will applied
5
+ */
6
+ 'manual'
7
+ /***
8
+ * used when zone.js is disabled, try to detection changes using ES6 proxy handler.
9
+ */
10
+ | 'proxy'
11
+ /***
12
+ * use when zone.js is active and loaded throw a polyfills file.
13
+ *
14
+ * active change detection
15
+ */
16
+ | 'aurora';
17
+ /**
18
+ * call once to init the aurora zone, for the platform
19
+ */
20
+ export declare function bootstrapZone(type?: ZoneType): void;
21
+ export declare function getCurrentZone(type?: ZoneType): ProxyAuroraZone | AuroraZone | ManualAuroraZone;
@@ -0,0 +1,35 @@
1
+ import { AuroraZone, ManualAuroraZone, ProxyAuroraZone } from './zone.js';
2
+ const manualAuroraZone = new ManualAuroraZone();
3
+ let proxyAuroraZone;
4
+ let auroraZone;
5
+ /**
6
+ * call once to init the aurora zone, for the platform
7
+ */
8
+ export function bootstrapZone(type) {
9
+ if (auroraZone) {
10
+ return;
11
+ }
12
+ if ('aurora' === type?.toLowerCase()) {
13
+ auroraZone = new AuroraZone();
14
+ }
15
+ else if ('proxy' === type?.toLowerCase()) {
16
+ auroraZone = proxyAuroraZone = new ProxyAuroraZone();
17
+ }
18
+ else {
19
+ auroraZone = manualAuroraZone;
20
+ }
21
+ }
22
+ export function getCurrentZone(type) {
23
+ if (type) {
24
+ switch (type.toLowerCase()) {
25
+ case 'aurora':
26
+ return auroraZone ?? (auroraZone = new AuroraZone());
27
+ case 'proxy':
28
+ return proxyAuroraZone ?? (proxyAuroraZone = new ProxyAuroraZone());
29
+ default:
30
+ case 'manual': return manualAuroraZone;
31
+ }
32
+ }
33
+ return auroraZone ?? manualAuroraZone;
34
+ }
35
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../src/core/zone/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAqB1E,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAChD,IAAI,eAAgC,CAAC;AACrC,IAAI,UAAsB,CAAC;AAE3B;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAe;IAC5C,IAAI,UAAU,EAAE;QACf,OAAO;KACP;IACD,IAAI,QAAQ,KAAK,IAAI,EAAE,WAAW,EAAE,EAAE;QACrC,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;KAC9B;SAAM,IAAI,OAAO,KAAK,IAAI,EAAE,WAAW,EAAE,EAAE;QAC3C,UAAU,GAAG,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;KACrD;SAAM;QACN,UAAU,GAAG,gBAAgB,CAAC;KAC9B;AACF,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAe;IAC7C,IAAI,IAAI,EAAE;QACT,QAAQ,IAAI,CAAC,WAAW,EAAE,EAAE;YAC3B,KAAK,QAAQ;gBACZ,OAAO,UAAU,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC,CAAC;YACtD,KAAK,OAAO;gBACX,OAAO,eAAe,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC,CAAC;YACrE,QAAQ;YACR,KAAK,QAAQ,CAAC,CAAC,OAAO,gBAAgB,CAAC;SACvC;KACD;IACD,OAAO,UAAU,IAAI,gBAAgB,CAAC;AACvC,CAAC","sourcesContent":["import { AuroraZone, ManualAuroraZone, ProxyAuroraZone } from './zone.js';\n\nexport type ZoneType =\n\t/**\n\t * used when zone.js is disabled, no change detection will applied\n\t */\n\t| 'manual'\n\n\t/***\n\t * used when zone.js is disabled, try to detection changes using ES6 proxy handler.\n\t */\n\t| 'proxy'\n\n\t/***\n\t * use when zone.js is active and loaded throw a polyfills file.\n\t * \n\t * active change detection\n\t */\n\t| 'aurora'\n\t;\n\nconst manualAuroraZone = new ManualAuroraZone();\nlet proxyAuroraZone: ProxyAuroraZone;\nlet auroraZone: AuroraZone;\n\n/**\n * call once to init the aurora zone, for the platform\n */\nexport function bootstrapZone(type?: ZoneType) {\n\tif (auroraZone) {\n\t\treturn;\n\t}\n\tif ('aurora' === type?.toLowerCase()) {\n\t\tauroraZone = new AuroraZone();\n\t} else if ('proxy' === type?.toLowerCase()) {\n\t\tauroraZone = proxyAuroraZone = new ProxyAuroraZone();\n\t} else {\n\t\tauroraZone = manualAuroraZone;\n\t}\n}\n\nexport function getCurrentZone(type?: ZoneType) {\n\tif (type) {\n\t\tswitch (type.toLowerCase()) {\n\t\t\tcase 'aurora':\n\t\t\t\treturn auroraZone ?? (auroraZone = new AuroraZone());\n\t\t\tcase 'proxy':\n\t\t\t\treturn proxyAuroraZone ?? (proxyAuroraZone = new ProxyAuroraZone());\n\t\t\tdefault:\n\t\t\tcase 'manual': return manualAuroraZone;\n\t\t}\n\t}\n\treturn auroraZone ?? manualAuroraZone;\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { RevocableProxy } from '@ibyar/expressions';
2
+ import { ProxyAuroraZone } from './zone.js';
3
+ /**
4
+ * crete new proxy handler for object
5
+ */
6
+ export declare class ZoneProxyHandler<T extends object> implements ProxyHandler<T> {
7
+ private _zone;
8
+ constructor(_zone: ProxyAuroraZone);
9
+ defineProperty(target: T, p: string | symbol, attributes: PropertyDescriptor): boolean;
10
+ deleteProperty(target: T, p: string | symbol): boolean;
11
+ get(target: T, p: string | symbol, receiver: any): any;
12
+ set(target: T, p: string | symbol, value: any, receiver: any): boolean;
13
+ }
14
+ export declare function createRevocableZoneProxyHandler<T extends object>(model: T, zone: ProxyAuroraZone): RevocableProxy<T>;
15
+ export declare function createZoneProxyHandler<T extends object>(model: T, zone: ProxyAuroraZone): T;
package/zone/proxy.js ADDED
@@ -0,0 +1,41 @@
1
+ import { hasBindingHook } from '@ibyar/expressions';
2
+ const ProxyCache = new WeakMap();
3
+ /**
4
+ * crete new proxy handler for object
5
+ */
6
+ export class ZoneProxyHandler {
7
+ constructor(_zone) {
8
+ this._zone = _zone;
9
+ }
10
+ defineProperty(target, p, attributes) {
11
+ this._zone.scheduleChangesDetection();
12
+ return Reflect.defineProperty(target, p, attributes);
13
+ }
14
+ deleteProperty(target, p) {
15
+ this._zone.scheduleChangesDetection();
16
+ return Reflect.deleteProperty(target, p);
17
+ }
18
+ get(target, p, receiver) {
19
+ const value = Reflect.get(target, p, receiver);
20
+ if (ProxyCache.has(value)) {
21
+ return ProxyCache.get(value);
22
+ }
23
+ if (!(value && typeof value === 'object') || hasBindingHook(value)) {
24
+ return value;
25
+ }
26
+ const proxy = createZoneProxyHandler(value, this._zone);
27
+ ProxyCache.set(value, proxy);
28
+ return proxy;
29
+ }
30
+ set(target, p, value, receiver) {
31
+ this._zone.scheduleChangesDetection();
32
+ return Reflect.set(target, p, value, receiver);
33
+ }
34
+ }
35
+ export function createRevocableZoneProxyHandler(model, zone) {
36
+ return Proxy.revocable(model, new ZoneProxyHandler(zone));
37
+ }
38
+ export function createZoneProxyHandler(model, zone) {
39
+ return new Proxy(model, new ZoneProxyHandler(zone));
40
+ }
41
+ //# sourceMappingURL=proxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/core/zone/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAkB,MAAM,oBAAoB,CAAC;AAGpE,MAAM,UAAU,GAAG,IAAI,OAAO,EAA8B,CAAC;AAE7D;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAC5B,YAAoB,KAAsB;QAAtB,UAAK,GAAL,KAAK,CAAiB;IAAI,CAAC;IAC/C,cAAc,CAAC,MAAS,EAAE,CAAkB,EAAE,UAA8B;QAC3E,IAAI,CAAC,KAAK,CAAC,wBAAwB,EAAE,CAAC;QACtC,OAAO,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC;IACD,cAAc,CAAC,MAAS,EAAE,CAAkB;QAC3C,IAAI,CAAC,KAAK,CAAC,wBAAwB,EAAE,CAAC;QACtC,OAAO,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC1C,CAAC;IACD,GAAG,CAAC,MAAS,EAAE,CAAkB,EAAE,QAAa;QAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC/C,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YAC1B,OAAO,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SAC7B;QACD,IAAI,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE;YACnE,OAAO,KAAK,CAAC;SACb;QACD,MAAM,KAAK,GAAG,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACxD,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC7B,OAAO,KAAK,CAAC;IACd,CAAC;IACD,GAAG,CAAC,MAAS,EAAE,CAAkB,EAAE,KAAU,EAAE,QAAa;QAC3D,IAAI,CAAC,KAAK,CAAC,wBAAwB,EAAE,CAAC;QACtC,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAChD,CAAC;CACD;AAED,MAAM,UAAU,+BAA+B,CAAmB,KAAQ,EAAE,IAAqB;IAChG,OAAO,KAAK,CAAC,SAAS,CAAI,KAAK,EAAE,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAmB,KAAQ,EAAE,IAAqB;IACvF,OAAO,IAAI,KAAK,CAAI,KAAK,EAAE,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import { hasBindingHook, RevocableProxy } from '@ibyar/expressions';\nimport { ProxyAuroraZone } from './zone.js';\n\nconst ProxyCache = new WeakMap<any, ZoneProxyHandler<any>>();\n\n/**\n * crete new proxy handler for object\n */\nexport class ZoneProxyHandler<T extends object> implements ProxyHandler<T> {\n\tconstructor(private _zone: ProxyAuroraZone) { }\n\tdefineProperty(target: T, p: string | symbol, attributes: PropertyDescriptor): boolean {\n\t\tthis._zone.scheduleChangesDetection();\n\t\treturn Reflect.defineProperty(target, p, attributes);\n\t}\n\tdeleteProperty(target: T, p: string | symbol): boolean {\n\t\tthis._zone.scheduleChangesDetection();\n\t\treturn Reflect.deleteProperty(target, p);\n\t}\n\tget(target: T, p: string | symbol, receiver: any): any {\n\t\tconst value = Reflect.get(target, p, receiver);\n\t\tif (ProxyCache.has(value)) {\n\t\t\treturn ProxyCache.get(value);\n\t\t}\n\t\tif (!(value && typeof value === 'object') || hasBindingHook(value)) {\n\t\t\treturn value;\n\t\t}\n\t\tconst proxy = createZoneProxyHandler(value, this._zone);\n\t\tProxyCache.set(value, proxy);\n\t\treturn proxy;\n\t}\n\tset(target: T, p: string | symbol, value: any, receiver: any): boolean {\n\t\tthis._zone.scheduleChangesDetection();\n\t\treturn Reflect.set(target, p, value, receiver);\n\t}\n}\n\nexport function createRevocableZoneProxyHandler<T extends object>(model: T, zone: ProxyAuroraZone): RevocableProxy<T> {\n\treturn Proxy.revocable<T>(model, new ZoneProxyHandler(zone));\n}\n\nexport function createZoneProxyHandler<T extends object>(model: T, zone: ProxyAuroraZone): T {\n\treturn new Proxy<T>(model, new ZoneProxyHandler(zone));\n}\n"]}
package/zone/task.d.ts ADDED
@@ -0,0 +1,61 @@
1
+ /// <reference types="zone.js" />
2
+ import { ReactiveScopeControl, Stack } from '@ibyar/expressions';
3
+ export declare abstract class AbstractTask<T extends TaskType> implements Task {
4
+ type: T;
5
+ source: string;
6
+ callback: Function;
7
+ data?: TaskData | undefined;
8
+ scheduleFn?: ((task: Task) => void) | undefined;
9
+ cancelFn?: ((task: Task) => void) | undefined;
10
+ runCount: number;
11
+ _zone: Zone | null;
12
+ _state: TaskState;
13
+ constructor(type: T, source: string, callback: Function, data?: TaskData | undefined, scheduleFn?: ((task: Task) => void) | undefined, cancelFn?: ((task: Task) => void) | undefined);
14
+ get zone(): Zone;
15
+ get state(): TaskState;
16
+ cancelScheduleRequest(): void;
17
+ _transitionTo(toState: TaskState, fromState1: TaskState, fromState2?: TaskState): void;
18
+ toString(): string;
19
+ toJSON(): {
20
+ type: T;
21
+ state: TaskState;
22
+ source: string;
23
+ zone: string;
24
+ runCount: number;
25
+ };
26
+ abstract invoke(task: any, target: any, args: any): any;
27
+ }
28
+ export declare class ScopeTask<T extends TaskType> extends AbstractTask<T> {
29
+ scope: ReactiveScopeControl<any>;
30
+ static microTask(scope: ReactiveScopeControl<any>, source: string, callback: Function, data?: TaskData, customSchedule?: (task: Task) => void): ScopeTask<"microTask">;
31
+ static macroTask(scope: ReactiveScopeControl<any>, source: string, callback: Function, data?: TaskData, customSchedule?: (task: Task) => void, customCancel?: (task: Task) => void): ScopeTask<"macroTask">;
32
+ static eventTask(scope: ReactiveScopeControl<any>, source: string, callback: Function, data?: TaskData, customSchedule?: (task: Task) => void, customCancel?: (task: Task) => void): ScopeTask<"eventTask">;
33
+ constructor(scope: ReactiveScopeControl<any>, type: T, source: string, callback: Function, data?: TaskData, scheduleFn?: (task: Task) => void, cancelFn?: (task: Task) => void);
34
+ invoke(task: any, target: any, args: any): unknown;
35
+ toJSON(): {
36
+ type: T;
37
+ state: TaskState;
38
+ source: string;
39
+ zone: string;
40
+ runCount: number;
41
+ } & {
42
+ scope: ReactiveScopeControl<any>;
43
+ };
44
+ }
45
+ export declare class StackTask<T extends TaskType> extends AbstractTask<T> {
46
+ stack: Stack;
47
+ static microTask(stack: Stack, source: string, callback: Function, data?: TaskData, customSchedule?: (task: Task) => void): StackTask<"microTask">;
48
+ static macroTask(stack: Stack, source: string, callback: Function, data?: TaskData, customSchedule?: (task: Task) => void, customCancel?: (task: Task) => void): StackTask<"macroTask">;
49
+ static eventTask(stack: Stack, source: string, callback: Function, data?: TaskData, customSchedule?: (task: Task) => void, customCancel?: (task: Task) => void): StackTask<"eventTask">;
50
+ constructor(stack: Stack, type: T, source: string, callback: Function, data: TaskData | undefined, scheduleFn: ((task: Task) => void) | undefined, cancelFn: ((task: Task) => void) | undefined);
51
+ invoke(task: any, target: any, args: any): unknown;
52
+ toJSON(): {
53
+ type: T;
54
+ state: TaskState;
55
+ source: string;
56
+ zone: string;
57
+ runCount: number;
58
+ } & {
59
+ stack: Stack;
60
+ };
61
+ }
package/zone/task.js ADDED
@@ -0,0 +1,109 @@
1
+ const notScheduled = 'notScheduled', scheduling = 'scheduling', scheduled = 'scheduled', running = 'running', canceling = 'canceling', unknown = 'unknown';
2
+ const microTask = 'microTask', macroTask = 'macroTask', eventTask = 'eventTask';
3
+ export class AbstractTask {
4
+ constructor(type, source, callback, data, scheduleFn, cancelFn) {
5
+ this.type = type;
6
+ this.source = source;
7
+ this.callback = callback;
8
+ this.data = data;
9
+ this.scheduleFn = scheduleFn;
10
+ this.cancelFn = cancelFn;
11
+ this.runCount = 0;
12
+ this._zone = null;
13
+ this._state = 'notScheduled';
14
+ if (!callback) {
15
+ throw new Error('callback is not defined');
16
+ }
17
+ }
18
+ get zone() {
19
+ return this._zone;
20
+ }
21
+ get state() {
22
+ return this._state;
23
+ }
24
+ cancelScheduleRequest() {
25
+ this._transitionTo(notScheduled, scheduling);
26
+ }
27
+ _transitionTo(toState, fromState1, fromState2) {
28
+ if (this._state === fromState1 || this._state === fromState2) {
29
+ this._state = toState;
30
+ }
31
+ else {
32
+ throw new Error(`${this.type} '${this.source}': can not transition to '${toState}', expecting state '${fromState1}'${fromState2 ? ' or \'' + fromState2 + '\'' : ''}, was '${this._state}'.`);
33
+ }
34
+ }
35
+ toString() {
36
+ if (this.data && typeof this.data.handleId !== 'undefined') {
37
+ return this.data.handleId.toString();
38
+ }
39
+ else {
40
+ return Object.prototype.toString.call(this);
41
+ }
42
+ }
43
+ toJSON() {
44
+ return {
45
+ type: this.type,
46
+ state: this.state,
47
+ source: this.source,
48
+ zone: this.zone.name,
49
+ runCount: this.runCount
50
+ };
51
+ }
52
+ }
53
+ export class ScopeTask extends AbstractTask {
54
+ constructor(scope, type, source, callback, data, scheduleFn, cancelFn) {
55
+ super(type, source, callback, data, scheduleFn, cancelFn);
56
+ this.scope = scope;
57
+ }
58
+ static microTask(scope, source, callback, data, customSchedule) {
59
+ return new ScopeTask(scope, microTask, source, callback, data, customSchedule, undefined);
60
+ }
61
+ static macroTask(scope, source, callback, data, customSchedule, customCancel) {
62
+ return new ScopeTask(scope, macroTask, source, callback, data, customSchedule, customCancel);
63
+ }
64
+ static eventTask(scope, source, callback, data, customSchedule, customCancel) {
65
+ return new ScopeTask(scope, eventTask, source, callback, data, customSchedule, customCancel);
66
+ }
67
+ invoke(task, target, args) {
68
+ try {
69
+ this.runCount++;
70
+ this.scope.detach();
71
+ return this.zone.runTask(task, target, args);
72
+ }
73
+ finally {
74
+ this.scope.reattach();
75
+ }
76
+ }
77
+ toJSON() {
78
+ return Object.assign(super.toJSON(), { scope: this.scope });
79
+ }
80
+ }
81
+ export class StackTask extends AbstractTask {
82
+ constructor(stack, type, source, callback, data, scheduleFn, cancelFn) {
83
+ super(type, source, callback, data, scheduleFn, cancelFn);
84
+ this.stack = stack;
85
+ }
86
+ static microTask(stack, source, callback, data, customSchedule) {
87
+ return new StackTask(stack, microTask, source, callback, data, customSchedule, undefined);
88
+ }
89
+ static macroTask(stack, source, callback, data, customSchedule, customCancel) {
90
+ return new StackTask(stack, macroTask, source, callback, data, customSchedule, customCancel);
91
+ }
92
+ static eventTask(stack, source, callback, data, customSchedule, customCancel) {
93
+ return new StackTask(stack, eventTask, source, callback, data, customSchedule, customCancel);
94
+ }
95
+ invoke(task, target, args) {
96
+ try {
97
+ this.runCount++;
98
+ this.stack.detach();
99
+ return this.zone.runTask(task, target, args);
100
+ }
101
+ finally {
102
+ this.stack.reattach();
103
+ }
104
+ }
105
+ toJSON() {
106
+ return Object.assign(super.toJSON(), { stack: this.stack });
107
+ }
108
+ }
109
+ //# sourceMappingURL=task.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task.js","sourceRoot":"","sources":["../../../src/core/zone/task.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAAmB,cAAc,EAClD,UAAU,GAAiB,YAAY,EACvC,SAAS,GAAgB,W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AAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;IAC3F,CAAC;IACD,MAAM,CAAC,SAAS,CAAC,KAAY,EAAE,MAAc,EAAE,QAAkB,EAAE,IAAe,EAAE,cAAqC,EAAE,YAAmC;QAC7J,OAAO,IAAI,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IAC9F,CAAC;IACD,MAAM,CAAC,SAAS,CAAC,KAAY,EAAE,MAAc,EAAE,QAAkB,EAAE,IAAe,EAAE,cAAqC,EAAE,YAAmC;QAC7J,OAAO,IAAI,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IAC9F,CAAC;IAYD,MAAM,CAAC,IAAS,EAAE,MAAW,EAAE,IAAS;QACvC,IAAI;YACH,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;SAC7C;gBAAS;YACT,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;SACtB;IACF,CAAC;IACM,MAAM;QACZ,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC7D,CAAC;CACD","sourcesContent":["import { ReactiveScopeControl, Context, Stack } from '@ibyar/expressions';\n\nconst notScheduled: 'notScheduled' = 'notScheduled',\n\tscheduling: 'scheduling' = 'scheduling',\n\tscheduled: 'scheduled' = 'scheduled',\n\trunning: 'running' = 'running',\n\tcanceling: 'canceling' = 'canceling',\n\tunknown: 'unknown' = 'unknown';\nconst microTask: 'microTask' = 'microTask',\n\tmacroTask: 'macroTask' = 'macroTask',\n\teventTask: 'eventTask' = 'eventTask';\n\nexport abstract class AbstractTask<T extends TaskType> implements Task {\n\n\tpublic runCount: number = 0;\n\t_zone: Zone | null = null;\n\t_state: TaskState = 'notScheduled';\n\n\tconstructor(\n\t\tpublic type: T,\n\t\tpublic source: string,\n\t\tpublic callback: Function,\n\t\tpublic data?: TaskData,\n\t\tpublic scheduleFn?: (task: Task) => void,\n\t\tpublic cancelFn?: (task: Task) => void) {\n\t\tif (!callback) {\n\t\t\tthrow new Error('callback is not defined');\n\t\t}\n\t}\n\n\tget zone(): Zone {\n\t\treturn this._zone!;\n\t}\n\n\tget state(): TaskState {\n\t\treturn this._state;\n\t}\n\n\tpublic cancelScheduleRequest() {\n\t\tthis._transitionTo(notScheduled, scheduling);\n\t}\n\n\t_transitionTo(toState: TaskState, fromState1: TaskState, fromState2?: TaskState) {\n\t\tif (this._state === fromState1 || this._state === fromState2) {\n\t\t\tthis._state = toState;\n\t\t} else {\n\t\t\tthrow new Error(`${this.type} '${this.source}': can not transition to '${toState}', expecting state '${fromState1}'${fromState2 ? ' or \\'' + fromState2 + '\\'' : ''}, was '${this._state}'.`);\n\t\t}\n\t}\n\n\tpublic toString() {\n\t\tif (this.data && typeof this.data.handleId !== 'undefined') {\n\t\t\treturn this.data.handleId.toString();\n\t\t} else {\n\t\t\treturn Object.prototype.toString.call(this);\n\t\t}\n\t}\n\tpublic toJSON() {\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tstate: this.state,\n\t\t\tsource: this.source,\n\t\t\tzone: this.zone.name,\n\t\t\trunCount: this.runCount\n\t\t};\n\t}\n\n\tabstract invoke(task: any, target: any, args: any): any;\n}\n\nexport class ScopeTask<T extends TaskType> extends AbstractTask<T> {\n\tstatic microTask(scope: ReactiveScopeControl<any>, source: string, callback: Function, data?: TaskData, customSchedule?: (task: Task) => void) {\n\t\treturn new ScopeTask(scope, microTask, source, callback, data, customSchedule, undefined);\n\t}\n\tstatic macroTask(scope: ReactiveScopeControl<any>, source: string, callback: Function, data?: TaskData, customSchedule?: (task: Task) => void, customCancel?: (task: Task) => void) {\n\t\treturn new ScopeTask(scope, macroTask, source, callback, data, customSchedule, customCancel);\n\t}\n\tstatic eventTask(scope: ReactiveScopeControl<any>, source: string, callback: Function, data?: TaskData, customSchedule?: (task: Task) => void, customCancel?: (task: Task) => void) {\n\t\treturn new ScopeTask(scope, eventTask, source, callback, data, customSchedule, customCancel);\n\t}\n\n\tconstructor(\n\t\tpublic scope: ReactiveScopeControl<any>,\n\t\ttype: T,\n\t\tsource: string,\n\t\tcallback: Function,\n\t\tdata?: TaskData,\n\t\tscheduleFn?: (task: Task) => void,\n\t\tcancelFn?: (task: Task) => void) {\n\t\tsuper(type, source, callback, data, scheduleFn, cancelFn);\n\t}\n\tinvoke(task: any, target: any, args: any) {\n\t\ttry {\n\t\t\tthis.runCount++;\n\t\t\tthis.scope.detach();\n\t\t\treturn this.zone.runTask(task, target, args);\n\t\t} finally {\n\t\t\tthis.scope.reattach();\n\t\t}\n\t}\n\tpublic toJSON() {\n\t\treturn Object.assign(super.toJSON(), { scope: this.scope });\n\t}\n}\n\nexport class StackTask<T extends TaskType> extends AbstractTask<T> {\n\n\tstatic microTask(stack: Stack, source: string, callback: Function, data?: TaskData, customSchedule?: (task: Task) => void) {\n\t\treturn new StackTask(stack, microTask, source, callback, data, customSchedule, undefined);\n\t}\n\tstatic macroTask(stack: Stack, source: string, callback: Function, data?: TaskData, customSchedule?: (task: Task) => void, customCancel?: (task: Task) => void) {\n\t\treturn new StackTask(stack, macroTask, source, callback, data, customSchedule, customCancel);\n\t}\n\tstatic eventTask(stack: Stack, source: string, callback: Function, data?: TaskData, customSchedule?: (task: Task) => void, customCancel?: (task: Task) => void) {\n\t\treturn new StackTask(stack, eventTask, source, callback, data, customSchedule, customCancel);\n\t}\n\n\tconstructor(\n\t\tpublic stack: Stack,\n\t\ttype: T,\n\t\tsource: string,\n\t\tcallback: Function,\n\t\tdata: TaskData | undefined,\n\t\tscheduleFn: ((task: Task) => void) | undefined,\n\t\tcancelFn: ((task: Task) => void) | undefined) {\n\t\tsuper(type, source, callback, data, scheduleFn, cancelFn);\n\t}\n\tinvoke(task: any, target: any, args: any) {\n\t\ttry {\n\t\t\tthis.runCount++;\n\t\t\tthis.stack.detach();\n\t\t\treturn this.zone.runTask(task, target, args);\n\t\t} finally {\n\t\t\tthis.stack.reattach();\n\t\t}\n\t}\n\tpublic toJSON() {\n\t\treturn Object.assign(super.toJSON(), { stack: this.stack });\n\t}\n}\n"]}
package/zone/zone.d.ts ADDED
@@ -0,0 +1,51 @@
1
+ import { EventEmitter } from '../component/events.js';
2
+ export interface AuroraZone {
3
+ readonly onTry: EventEmitter<void>;
4
+ readonly onCatch: EventEmitter<void>;
5
+ readonly onFinal: EventEmitter<void>;
6
+ readonly onEmpty: EventEmitter<void>;
7
+ fork(): AuroraZone;
8
+ run<T>(callback: (...args: any[]) => T, applyThis?: any, applyArgs?: any[] | undefined): T;
9
+ runTask<T>(callback: (...args: any[]) => T, applyThis?: any, applyArgs?: any[] | undefined, name?: string | undefined): T;
10
+ runGuarded<T>(callback: (...args: any[]) => T, applyThis?: any, applyArgs?: any[] | undefined): T;
11
+ runOutsideAurora<T>(callback: (...args: any[]) => T): T;
12
+ }
13
+ export declare abstract class AbstractAuroraZone implements AuroraZone {
14
+ readonly onTry: EventEmitter<void>;
15
+ readonly onCatch: EventEmitter<void>;
16
+ readonly onFinal: EventEmitter<void>;
17
+ readonly onEmpty: EventEmitter<void>;
18
+ protected id: number;
19
+ constructor();
20
+ abstract fork(): AuroraZone;
21
+ abstract run<T>(callback: (...args: any[]) => T, applyThis?: any, applyArgs?: any[] | undefined): T;
22
+ abstract runTask<T>(callback: (...args: any[]) => T, applyThis?: any, applyArgs?: any[] | undefined, name?: string | undefined): T;
23
+ abstract runGuarded<T>(callback: (...args: any[]) => T, applyThis?: any, applyArgs?: any[] | undefined): T;
24
+ abstract runOutsideAurora<T>(callback: (...args: any[]) => T): T;
25
+ }
26
+ export declare class AuroraZone extends AbstractAuroraZone {
27
+ static isInAuroraZone(): boolean;
28
+ static assertInAuroraZone(): void;
29
+ static assertNotInAuroraZone(): void;
30
+ constructor(parent?: AuroraZone);
31
+ }
32
+ export declare class ManualAuroraZone extends AbstractAuroraZone {
33
+ constructor(parent?: AuroraZone);
34
+ fork(): AuroraZone;
35
+ private runCallback;
36
+ run<T>(callback: (...args: any[]) => T, applyThis?: any, applyArgs?: any[] | undefined): T;
37
+ runTask<T>(callback: (...args: any[]) => T, applyThis?: any, applyArgs?: any[] | undefined, name?: string | undefined): T;
38
+ runGuarded<T>(callback: (...args: any[]) => T, applyThis?: any, applyArgs?: any[] | undefined): T;
39
+ runOutsideAurora<T>(callback: (...args: any[]) => T): T;
40
+ }
41
+ export declare class ProxyAuroraZone extends AbstractAuroraZone {
42
+ private _cdPromise?;
43
+ constructor(parent?: AuroraZone);
44
+ fork(): AuroraZone;
45
+ private runCallback;
46
+ run<T>(callback: (...args: any[]) => T, applyThis?: any, applyArgs?: any[] | undefined): T;
47
+ runTask<T>(callback: (...args: any[]) => T, applyThis?: any, applyArgs?: any[] | undefined, name?: string | undefined): T;
48
+ runGuarded<T>(callback: (...args: any[]) => T, applyThis?: any, applyArgs?: any[] | undefined): T;
49
+ runOutsideAurora<T>(callback: (...args: any[]) => T): T;
50
+ scheduleChangesDetection(): void;
51
+ }