@ibyar/core 2.3.0 → 2.4.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.
- package/annotation/options.d.ts +6 -2
- package/annotation/options.d.ts.map +1 -1
- package/annotation/options.js.map +1 -1
- package/binding/binding.expressions.d.ts +2 -2
- package/binding/binding.expressions.d.ts.map +1 -1
- package/binding/binding.expressions.js.map +1 -1
- package/component/component.d.ts +1 -0
- package/component/component.d.ts.map +1 -1
- package/component/component.js +9 -1
- package/component/component.js.map +1 -1
- package/directive/directive.d.ts +3 -2
- package/directive/directive.d.ts.map +1 -1
- package/directive/directive.js +6 -3
- package/directive/directive.js.map +1 -1
- package/html/deserialize.d.ts.map +1 -1
- package/html/deserialize.js +11 -2
- package/html/deserialize.js.map +1 -1
- package/html/expression.d.ts.map +1 -1
- package/html/expression.js +14 -5
- package/html/expression.js.map +1 -1
- package/html/types.d.ts +6 -0
- package/html/types.d.ts.map +1 -1
- package/html/types.js.map +1 -1
- package/package.json +8 -8
- package/view/base-view.js +1 -1
- package/view/base-view.js.map +1 -1
- package/view/form-view.d.ts.map +1 -1
- package/view/form-view.js +2 -1
- package/view/form-view.js.map +1 -1
- package/view/render.d.ts +2 -1
- package/view/render.d.ts.map +1 -1
- package/view/render.js +16 -6
- package/view/render.js.map +1 -1
- package/view/view.d.ts.map +1 -1
- package/view/view.js +12 -5
- package/view/view.js.map +1 -1
- package/zone/zone.js +1 -1
- package/zone/zone.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibyar/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.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": "^2.
|
|
39
|
-
"@ibyar/elements": "^2.
|
|
40
|
-
"@ibyar/expressions": "^2.
|
|
41
|
-
"tslib": "^2.
|
|
38
|
+
"@ibyar/decorators": "^2.4.0",
|
|
39
|
+
"@ibyar/elements": "^2.4.0",
|
|
40
|
+
"@ibyar/expressions": "^2.4.0",
|
|
41
|
+
"tslib": "^2.7.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"zone.js": "~0.
|
|
44
|
+
"zone.js": "~0.15.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"typescript": "^5.
|
|
47
|
+
"typescript": "^5.6.2"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsc --build --verbose",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"typescript",
|
|
79
79
|
"front-end"
|
|
80
80
|
],
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "53497612809ca931456ce404746d2fea7ff92b84"
|
|
82
82
|
}
|
package/view/base-view.js
CHANGED
|
@@ -22,7 +22,7 @@ export function baseFactoryView(htmlElementType) {
|
|
|
22
22
|
constructor(componentRef, modelClass) {
|
|
23
23
|
super();
|
|
24
24
|
this._componentRef = componentRef;
|
|
25
|
-
if (componentRef.isShadowDom) {
|
|
25
|
+
if (componentRef.isShadowDom && !componentRef.disabledFeatures?.includes('shadow')) {
|
|
26
26
|
this._shadowRoot = this.attachShadow(componentRef.shadowRootInit);
|
|
27
27
|
}
|
|
28
28
|
this._signalScope = new SignalScope();
|
package/view/base-view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-view.js","sourceRoot":"","sources":["../../../src/core/view/base-view.ts"],"names":[],"mappings":"AACA,OAAO,EACN,aAAa,EAAE,oBAAoB,EAChB,WAAW,EAAE,eAAe,EAC/C,MAAM,oBAAoB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AAE,CAAC;gBAChB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACvB,OAAO;YACR,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import type { TypeOf } from '../utils/typeof.js';\nimport {\n\tReactiveScope, ReactiveScopeControl, Context,\n\tScopeSubscription, SignalScope, getReactiveNode\n} from '@ibyar/expressions';\nimport {\n\tisAfterContentChecked, isAfterContentInit, isAfterViewChecked,\n\tisAfterViewInit, isDoCheck, isOnChanges, isOnDestroy, isOnInit\n} from '../component/lifecycle.js';\nimport { ComponentRef } from '../component/component.js';\nimport { BaseComponent, CustomElement, HTMLComponent, ModelType } from '../component/custom-element.js';\nimport { EventEmitter } from '../component/events.js';\nimport { ComponentRender } from './render.js';\nimport { getRootZone } from '../zone/bootstrap.js';\nimport { AuroraZone, ProxyAuroraZone } from '../zone/zone.js';\nimport { createModelChangeDetectorRef } from '../linker/change-detector-ref.js';\nimport { createProxyZone } from '../zone/proxy.js';\nimport { PropertyRef } from '../component/reflect.js';\nimport { clearSignalScope, setSignalScope } from '../signals/signals.js';\n\nexport function baseFactoryView<T extends object>(htmlElementType: TypeOf<HTMLElement>): TypeOf<HTMLComponent<T>> {\n\treturn class CustomView extends htmlElementType implements BaseComponent<T>, CustomElement {\n\t\t_model: ModelType<T>;\n\t\t_signalScope: SignalScope;\n\t\t_render: ComponentRender<T>;\n\t\t_shadowRoot: ShadowRoot;\n\n\t\t_componentRef: ComponentRef<T>;\n\n\t\t_modelScope: ReactiveScopeControl<T>;\n\t\t_viewScope: ReactiveScope<{ 'this': BaseComponent<T> }>;\n\t\t_zone: AuroraZone;\n\n\t\tprivate subscriptions: ScopeSubscription<Context>[] = [];\n\t\tprivate onDestroyCalls: (() => void)[] = [];\n\t\tprivate needRendering = true;\n\n\t\tconstructor(componentRef: ComponentRef<T>, modelClass: TypeOf<T>) {\n\t\t\tsuper();\n\t\t\tthis._componentRef = componentRef;\n\t\t\tif (componentRef.isShadowDom) {\n\t\t\t\tthis._shadowRoot = this.attachShadow(componentRef.shadowRootInit);\n\t\t\t}\n\n\t\t\tthis._signalScope = new SignalScope();\n\t\t\tsetSignalScope(this._signalScope);\n\n\t\t\tconst args = []; /* resolve dependency injection*/\n\t\t\tconst detector = createModelChangeDetectorRef(() => this._modelScope);\n\t\t\targs.push(detector)\n\t\t\tthis._zone = getRootZone().fork(componentRef.zone);\n\t\t\targs.push(this._zone);\n\t\t\tconst model = new modelClass(...args);\n\t\t\tthis._model = model;\n\n\t\t\tclearSignalScope();\n\t\t\tconst modelScope = ReactiveScopeControl.for(model);\n\t\t\tconst modelProxyRef = this._zone instanceof ProxyAuroraZone\n\t\t\t\t? createProxyZone(model, this._zone)\n\t\t\t\t: model;\n\t\t\tmodelScope.getContextProxy = () => modelProxyRef;\n\t\t\tthis._modelScope = modelScope;\n\n\t\t\tObject.keys(this._model).forEach(key => {\n\t\t\t\tconst value = this._model[key];\n\t\t\t\tconst node = getReactiveNode(value);\n\t\t\t\tif (!node) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tnode.subscribe((value, old) => this._modelScope.emit(key as any, value, old));\n\t\t\t});\n\n\t\t\tthis._viewScope = ReactiveScope.for<{ 'this': BaseComponent<T> }>({ 'this': this });\n\t\t\tconst elementScope = this._viewScope.getInnerScope<ReactiveScope<BaseComponent<T>>>('this')!;\n\t\t\tcomponentRef.inputs.forEach(input => {\n\t\t\t\telementScope.subscribe(input.viewAttribute as any, (newValue, oldValue) => {\n\t\t\t\t\tif (newValue === oldValue) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis._modelScope.set(input.modelProperty as any, newValue);\n\t\t\t\t});\n\t\t\t\tthis._modelScope.subscribe(input.modelProperty as any, (newValue, oldValue) => {\n\t\t\t\t\tif (newValue === oldValue) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\telementScope.emit(input.viewAttribute as any, newValue, oldValue);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tcomponentRef.outputs.forEach(output =>\n\t\t\t\t(model[output.modelProperty as keyof T] as any as EventEmitter<any>)\n\t\t\t\t\t.subscribe((value: any) => {\n\t\t\t\t\t\tconst event = new CustomEvent(\n\t\t\t\t\t\t\toutput.viewAttribute,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdetail: value,\n\t\t\t\t\t\t\t\tcancelable: false,\n\t\t\t\t\t\t\t\tbubbles: output.options?.bubbles,\n\t\t\t\t\t\t\t\tcomposed: output.options?.bubbles,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.dispatchEvent(event);\n\t\t\t\t\t})\n\t\t\t);\n\t\t\t// if property of the model has view decorator\n\t\t\tif (this._componentRef.view) {\n\t\t\t\tReflect.set(this._model, this._componentRef.view, this);\n\t\t\t}\n\n\t\t\tthis._render = new ComponentRender(this, this.subscriptions);\n\n\t\t\tif (this.attributes.length > 0) {\n\t\t\t\tlet attrs: Attr[] = Array.prototype.slice.call(this.attributes);\n\t\t\t\tattrs.forEach(attr => this.initOuterAttribute(attr));\n\t\t\t}\n\n\t\t\tif (this._componentRef.encapsulation === 'shadow-slot') {\n\t\t\t\t// render view before inserting any slot element as child\n\t\t\t\tthis.initView();\n\t\t\t}\n\t\t}\n\n\t\tdetectChanges(): void {\n\t\t\tthis._modelScope.detectChanges();\n\t\t}\n\n\t\tdoBlockCallback = (): void => {\n\t\t\tif (isDoCheck(this._model)) {\n\t\t\t\tthis._zone.run(this._model.doCheck, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t};\n\n\t\tgetComponentRef(): ComponentRef<T> {\n\t\t\treturn this._componentRef;\n\t\t}\n\n\t\thasInputStartWith(viewProp: string): boolean {\n\t\t\tlet dotIndex = viewProp.indexOf('.');\n\t\t\tif (dotIndex > 0) {\n\t\t\t\tviewProp = viewProp.substring(0, dotIndex);\n\t\t\t}\n\t\t\treturn this.hasInput(viewProp);\n\t\t}\n\n\t\tgetInputStartWith(viewProp: string): PropertyRef | undefined {\n\t\t\tlet index = viewProp.indexOf('.');\n\t\t\tif (index > 0) {\n\t\t\t\tviewProp = viewProp.substring(0, index);\n\t\t\t}\n\t\t\tindex = viewProp.indexOf('[');\n\t\t\tif (index > 0) {\n\t\t\t\tviewProp = viewProp.substring(0, index);\n\t\t\t}\n\t\t\treturn this.getInput(viewProp);\n\t\t}\n\n\t\thasInput(viewProp: string): boolean {\n\t\t\treturn this._componentRef.inputs.some(input => input.viewAttribute === viewProp);\n\t\t}\n\n\t\tgetInput(viewProp: string): PropertyRef | undefined {\n\t\t\treturn this._componentRef.inputs.find(input => input.viewAttribute === viewProp);\n\t\t}\n\n\t\tgetInputValue(viewProp: string): any {\n\t\t\tconst inputRef = this.getInput(viewProp);\n\t\t\tif (inputRef) {\n\t\t\t\treturn this._model[inputRef.modelProperty];\n\t\t\t}\n\t\t}\n\n\t\tsetInputValue(viewProp: PropertyKey, value: any): void {\n\t\t\tconst inputRef = this.getInput(viewProp as string);\n\t\t\tif (inputRef) {\n\t\t\t\tthis._modelScope.set(inputRef.modelProperty as never, value);\n\t\t\t}\n\t\t}\n\n\t\thasOutput(viewProp: string): boolean {\n\t\t\treturn this._componentRef.outputs.some(output => output.viewAttribute === viewProp);\n\t\t}\n\n\t\tgetOutput(viewProp: string): PropertyRef | undefined {\n\t\t\treturn this._componentRef.outputs.find(output => output.viewAttribute === viewProp);\n\t\t}\n\n\t\tgetEventEmitter<V>(viewProp: string): EventEmitter<V> | undefined {\n\t\t\tconst outputRef = this.getOutput(viewProp);\n\t\t\tif (outputRef) {\n\t\t\t\treturn this._model[outputRef.modelProperty] as EventEmitter<V>;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\thasProp(propName: string): boolean {\n\t\t\treturn Reflect.has(this._model, propName);\n\t\t}\n\n\t\tprivate setAttributeHelper(attrViewName: string, value: any): void {\n\t\t\tif (value === null || value === undefined) {\n\t\t\t\tthis.removeAttribute(attrViewName);\n\t\t\t}\n\t\t\telse if (typeof value === 'boolean') {\n\t\t\t\tif (value) {\n\t\t\t\t\tsuper.setAttribute(attrViewName, '');\n\t\t\t\t} else {\n\t\t\t\t\tthis.removeAttribute(attrViewName);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsuper.setAttribute(attrViewName, value);\n\t\t\t}\n\t\t}\n\n\t\tsetAttribute(attrViewName: string, value: any): void {\n\t\t\tthis.setInputValue(attrViewName, value);\n\t\t\tthis.setAttributeHelper(attrViewName, value);\n\t\t}\n\n\t\tgetAttribute(attrViewName: string): string | null {\n\t\t\treturn this.getInputValue(attrViewName) ?? super.getAttribute(attrViewName);\n\t\t}\n\n\t\tattributeChangedCallback(name: string, oldValue: string, newValue: string) {\n\t\t\tif (newValue === oldValue) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (isOnChanges(this._model)) {\n\t\t\t\tthis._zone.run(this._model.onChanges, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tthis.doBlockCallback();\n\t\t}\n\n\t\tprivate initView() {\n\t\t\t// setup ui view\n\t\t\tthis._render.initView();\n\n\t\t\t// init view binding\n\t\t\tthis._render.initViewBinding();\n\t\t\tthis.needRendering = false;\n\t\t}\n\n\t\tconnectedCallback() {\n\t\t\tif (this.subscriptions.length) {\n\t\t\t\tthis.subscriptions.forEach(sub => sub.unsubscribe());\n\t\t\t}\n\t\t\tthis.subscriptions.splice(0, this.subscriptions.length);\n\t\t\tconst cds = this._zone.onEmpty.subscribe(() => this._modelScope.detectChanges());\n\t\t\tthis.onDestroy(() => cds.unsubscribe());\n\t\t\tthis._componentRef.inputs.forEach(input => {\n\t\t\t\tconst inputDefaultValue = this._model[input.modelProperty];\n\t\t\t\tif (inputDefaultValue !== null && inputDefaultValue !== undefined) {\n\t\t\t\t\tthis.setAttributeHelper(input.viewAttribute, inputDefaultValue);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (isOnChanges(this._model)) {\n\t\t\t\tthis._zone.run(this._model.onChanges, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tif (isOnInit(this._model)) {\n\t\t\t\tthis._zone.run(this._model.onInit, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tif (isDoCheck(this._model)) {\n\t\t\t\tthis._zone.run(this._model.doCheck, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tif (isAfterContentInit(this._model)) {\n\t\t\t\tthis._zone.run(this._model.afterContentInit, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tif (isAfterContentChecked(this._model)) {\n\t\t\t\tthis._zone.run(this._model.afterContentChecked, this._modelScope.getContextProxy!());\n\t\t\t}\n\n\t\t\t// do once\n\t\t\tif (this.needRendering) {\n\t\t\t\tthis.initView();\n\t\t\t}\n\n\t\t\tif (isAfterViewInit(this._model)) {\n\t\t\t\tthis._zone.run(this._model.afterViewInit, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tif (isAfterViewChecked(this._model)) {\n\t\t\t\tthis._zone.run(this._model.afterViewChecked, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tthis.doBlockCallback = () => {\n\t\t\t\tif (isDoCheck(this._model)) {\n\t\t\t\t\tthis._zone.run(this._model.doCheck, this._modelScope.getContextProxy!());\n\t\t\t\t}\n\t\t\t\tif (isAfterContentChecked(this._model)) {\n\t\t\t\t\tthis._zone.run(this._model.afterContentChecked, this._modelScope.getContextProxy!());\n\t\t\t\t}\n\t\t\t\tif (isAfterViewChecked(this._model)) {\n\t\t\t\t\tthis._zone.run(this._model.afterViewChecked, this._modelScope.getContextProxy!());\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst event = new CustomEvent('connected', { cancelable: true, bubbles: false, composed: false });\n\t\t\tthis.dispatchEvent(event);\n\t\t}\n\n\n\t\tprivate initOuterAttribute(attr: Attr) {\n\t\t\t// [window, this] scop\n\t\t\tlet elementAttr = attr.name;\n\t\t\tlet modelProperty = attr.value;\n\t\t\tif (elementAttr.startsWith('[')) {\n\t\t\t\telementAttr = elementAttr.substring(1, elementAttr.length - 1);\n\t\t\t\tif (Reflect.has(window, modelProperty)) {\n\t\t\t\t\tthis.setInputValue(elementAttr, Reflect.get(window, modelProperty));\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (elementAttr.startsWith('(')) {\n\t\t\t\t// (elementAttr)=\"modelProperty()\"\n\t\t\t\telementAttr = elementAttr.substring(1, elementAttr.length - 1);\n\t\t\t\t// this.handleEvent(element, elementAttr, viewProperty);\n\t\t\t\tmodelProperty = modelProperty.endsWith('()') ?\n\t\t\t\t\tmodelProperty.substring(0, modelProperty.length - 2) : modelProperty;\n\t\t\t\tlet callback: Function = Reflect.get(window, modelProperty);\n\t\t\t\tthis.addEventListener(elementAttr, event => {\n\t\t\t\t\tcallback(event);\n\t\t\t\t});\n\t\t\t} else if (elementAttr.startsWith('on')) {\n\t\t\t\tconst modelEvent = this.getEventEmitter<any>(elementAttr.substring(2));\n\t\t\t\tif (modelEvent) {\n\t\t\t\t\t// modelEvent.subscribe(listener);\n\t\t\t\t\tmodelProperty = modelProperty.endsWith('()') ?\n\t\t\t\t\t\tmodelProperty.substring(0, modelProperty.length - 2) : modelProperty;\n\t\t\t\t\tlet listener: Function = Reflect.get(window, modelProperty);\n\t\t\t\t\tmodelEvent.subscribe((data: any) => {\n\t\t\t\t\t\t(listener as Function)(data);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.setInputValue(attr.name, attr.value);\n\t\t\t}\n\t\t}\n\t\tonDestroy(callback: () => void) {\n\t\t\tthis.onDestroyCalls.push(callback);\n\t\t}\n\t\tadoptedCallback() {\n\t\t\t// restart the process\n\t\t\tthis.innerHTML = '';\n\t\t\tthis.connectedCallback();\n\t\t}\n\t\tdisconnectedCallback() {\n\t\t\t// notify first, then call model.onDestroy func\n\t\t\tif (isOnDestroy(this._model)) {\n\t\t\t\tthis._zone.run(this._model.onDestroy, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tthis.subscriptions.forEach(sub => sub.unsubscribe());\n\t\t\tthis.subscriptions.splice(0, this.subscriptions.length);\n\t\t\tthis.onDestroyCalls.forEach(callback => {\n\t\t\t\ttry {\n\t\t\t\t\tcallback();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.error(error);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.onDestroyCalls.splice(0, this.onDestroyCalls.length);\n\t\t\tconst event = new CustomEvent('disconnected', { cancelable: true, bubbles: false, composed: false });\n\t\t\tthis.dispatchEvent(event);\n\t\t}\n\n\t\ttriggerOutput(eventName: string, value?: any): void {\n\t\t\tconst modelEvent = this.getEventEmitter<any>(eventName);\n\t\t\tif (modelEvent) {\n\t\t\t\tmodelEvent.emit(value);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base-view.js","sourceRoot":"","sources":["../../../src/core/view/base-view.ts"],"names":[],"mappings":"AACA,OAAO,EACN,aAAa,EAAE,oBAAoB,EAChB,WAAW,EAAE,eAAe,EAC/C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAC7D,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAC9D,MAAM,2BAA2B,CAAC;AAInC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAc,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEzE,MAAM,UAAU,eAAe,CAAmB,eAAoC;IACrF,OAAO,MAAM,UAAW,SAAQ,eAAe;QAC9C,MAAM,CAA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AAM,CAAC,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YACxD,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBACtC,IAAI,CAAC;oBACJ,QAAQ,EAAE,CAAC;gBACZ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBAChB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACtB,CAAC;YACF,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAC1D,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,cAAc,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;YACrG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QAED,aAAa,CAAC,SAAiB,EAAE,KAAW;YAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAM,SAAS,CAAC,CAAC;YACxD,IAAI,UAAU,EAAE,CAAC;gBAChB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACvB,OAAO;YACR,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import type { TypeOf } from '../utils/typeof.js';\nimport {\n\tReactiveScope, ReactiveScopeControl, Context,\n\tScopeSubscription, SignalScope, getReactiveNode\n} from '@ibyar/expressions';\nimport {\n\tisAfterContentChecked, isAfterContentInit, isAfterViewChecked,\n\tisAfterViewInit, isDoCheck, isOnChanges, isOnDestroy, isOnInit\n} from '../component/lifecycle.js';\nimport { ComponentRef } from '../component/component.js';\nimport { BaseComponent, CustomElement, HTMLComponent, ModelType } from '../component/custom-element.js';\nimport { EventEmitter } from '../component/events.js';\nimport { ComponentRender } from './render.js';\nimport { getRootZone } from '../zone/bootstrap.js';\nimport { AuroraZone, ProxyAuroraZone } from '../zone/zone.js';\nimport { createModelChangeDetectorRef } from '../linker/change-detector-ref.js';\nimport { createProxyZone } from '../zone/proxy.js';\nimport { PropertyRef } from '../component/reflect.js';\nimport { clearSignalScope, setSignalScope } from '../signals/signals.js';\n\nexport function baseFactoryView<T extends object>(htmlElementType: TypeOf<HTMLElement>): TypeOf<HTMLComponent<T>> {\n\treturn class CustomView extends htmlElementType implements BaseComponent<T>, CustomElement {\n\t\t_model: ModelType<T>;\n\t\t_signalScope: SignalScope;\n\t\t_render: ComponentRender<T>;\n\t\t_shadowRoot: ShadowRoot;\n\n\t\t_componentRef: ComponentRef<T>;\n\n\t\t_modelScope: ReactiveScopeControl<T>;\n\t\t_viewScope: ReactiveScope<{ 'this': BaseComponent<T> }>;\n\t\t_zone: AuroraZone;\n\n\t\tprivate subscriptions: ScopeSubscription<Context>[] = [];\n\t\tprivate onDestroyCalls: (() => void)[] = [];\n\t\tprivate needRendering = true;\n\n\t\tconstructor(componentRef: ComponentRef<T>, modelClass: TypeOf<T>) {\n\t\t\tsuper();\n\t\t\tthis._componentRef = componentRef;\n\t\t\tif (componentRef.isShadowDom && !componentRef.disabledFeatures?.includes('shadow')) {\n\t\t\t\tthis._shadowRoot = this.attachShadow(componentRef.shadowRootInit);\n\t\t\t}\n\n\t\t\tthis._signalScope = new SignalScope();\n\t\t\tsetSignalScope(this._signalScope);\n\n\t\t\tconst args = []; /* resolve dependency injection*/\n\t\t\tconst detector = createModelChangeDetectorRef(() => this._modelScope);\n\t\t\targs.push(detector)\n\t\t\tthis._zone = getRootZone().fork(componentRef.zone);\n\t\t\targs.push(this._zone);\n\t\t\tconst model = new modelClass(...args);\n\t\t\tthis._model = model;\n\n\t\t\tclearSignalScope();\n\t\t\tconst modelScope = ReactiveScopeControl.for(model);\n\t\t\tconst modelProxyRef = this._zone instanceof ProxyAuroraZone\n\t\t\t\t? createProxyZone(model, this._zone)\n\t\t\t\t: model;\n\t\t\tmodelScope.getContextProxy = () => modelProxyRef;\n\t\t\tthis._modelScope = modelScope;\n\n\t\t\tObject.keys(this._model).forEach(key => {\n\t\t\t\tconst value = this._model[key];\n\t\t\t\tconst node = getReactiveNode(value);\n\t\t\t\tif (!node) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tnode.subscribe((value, old) => this._modelScope.emit(key as any, value, old));\n\t\t\t});\n\n\t\t\tthis._viewScope = ReactiveScope.for<{ 'this': BaseComponent<T> }>({ 'this': this });\n\t\t\tconst elementScope = this._viewScope.getInnerScope<ReactiveScope<BaseComponent<T>>>('this')!;\n\t\t\tcomponentRef.inputs.forEach(input => {\n\t\t\t\telementScope.subscribe(input.viewAttribute as any, (newValue, oldValue) => {\n\t\t\t\t\tif (newValue === oldValue) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis._modelScope.set(input.modelProperty as any, newValue);\n\t\t\t\t});\n\t\t\t\tthis._modelScope.subscribe(input.modelProperty as any, (newValue, oldValue) => {\n\t\t\t\t\tif (newValue === oldValue) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\telementScope.emit(input.viewAttribute as any, newValue, oldValue);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tcomponentRef.outputs.forEach(output =>\n\t\t\t\t(model[output.modelProperty as keyof T] as any as EventEmitter<any>)\n\t\t\t\t\t.subscribe((value: any) => {\n\t\t\t\t\t\tconst event = new CustomEvent(\n\t\t\t\t\t\t\toutput.viewAttribute,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdetail: value,\n\t\t\t\t\t\t\t\tcancelable: false,\n\t\t\t\t\t\t\t\tbubbles: output.options?.bubbles,\n\t\t\t\t\t\t\t\tcomposed: output.options?.bubbles,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.dispatchEvent(event);\n\t\t\t\t\t})\n\t\t\t);\n\t\t\t// if property of the model has view decorator\n\t\t\tif (this._componentRef.view) {\n\t\t\t\tReflect.set(this._model, this._componentRef.view, this);\n\t\t\t}\n\n\t\t\tthis._render = new ComponentRender(this, this.subscriptions);\n\n\t\t\tif (this.attributes.length > 0) {\n\t\t\t\tlet attrs: Attr[] = Array.prototype.slice.call(this.attributes);\n\t\t\t\tattrs.forEach(attr => this.initOuterAttribute(attr));\n\t\t\t}\n\n\t\t\tif (this._componentRef.encapsulation === 'shadow-slot') {\n\t\t\t\t// render view before inserting any slot element as child\n\t\t\t\tthis.initView();\n\t\t\t}\n\t\t}\n\n\t\tdetectChanges(): void {\n\t\t\tthis._modelScope.detectChanges();\n\t\t}\n\n\t\tdoBlockCallback = (): void => {\n\t\t\tif (isDoCheck(this._model)) {\n\t\t\t\tthis._zone.run(this._model.doCheck, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t};\n\n\t\tgetComponentRef(): ComponentRef<T> {\n\t\t\treturn this._componentRef;\n\t\t}\n\n\t\thasInputStartWith(viewProp: string): boolean {\n\t\t\tlet dotIndex = viewProp.indexOf('.');\n\t\t\tif (dotIndex > 0) {\n\t\t\t\tviewProp = viewProp.substring(0, dotIndex);\n\t\t\t}\n\t\t\treturn this.hasInput(viewProp);\n\t\t}\n\n\t\tgetInputStartWith(viewProp: string): PropertyRef | undefined {\n\t\t\tlet index = viewProp.indexOf('.');\n\t\t\tif (index > 0) {\n\t\t\t\tviewProp = viewProp.substring(0, index);\n\t\t\t}\n\t\t\tindex = viewProp.indexOf('[');\n\t\t\tif (index > 0) {\n\t\t\t\tviewProp = viewProp.substring(0, index);\n\t\t\t}\n\t\t\treturn this.getInput(viewProp);\n\t\t}\n\n\t\thasInput(viewProp: string): boolean {\n\t\t\treturn this._componentRef.inputs.some(input => input.viewAttribute === viewProp);\n\t\t}\n\n\t\tgetInput(viewProp: string): PropertyRef | undefined {\n\t\t\treturn this._componentRef.inputs.find(input => input.viewAttribute === viewProp);\n\t\t}\n\n\t\tgetInputValue(viewProp: string): any {\n\t\t\tconst inputRef = this.getInput(viewProp);\n\t\t\tif (inputRef) {\n\t\t\t\treturn this._model[inputRef.modelProperty];\n\t\t\t}\n\t\t}\n\n\t\tsetInputValue(viewProp: PropertyKey, value: any): void {\n\t\t\tconst inputRef = this.getInput(viewProp as string);\n\t\t\tif (inputRef) {\n\t\t\t\tthis._modelScope.set(inputRef.modelProperty as never, value);\n\t\t\t}\n\t\t}\n\n\t\thasOutput(viewProp: string): boolean {\n\t\t\treturn this._componentRef.outputs.some(output => output.viewAttribute === viewProp);\n\t\t}\n\n\t\tgetOutput(viewProp: string): PropertyRef | undefined {\n\t\t\treturn this._componentRef.outputs.find(output => output.viewAttribute === viewProp);\n\t\t}\n\n\t\tgetEventEmitter<V>(viewProp: string): EventEmitter<V> | undefined {\n\t\t\tconst outputRef = this.getOutput(viewProp);\n\t\t\tif (outputRef) {\n\t\t\t\treturn this._model[outputRef.modelProperty] as EventEmitter<V>;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\thasProp(propName: string): boolean {\n\t\t\treturn Reflect.has(this._model, propName);\n\t\t}\n\n\t\tprivate setAttributeHelper(attrViewName: string, value: any): void {\n\t\t\tif (value === null || value === undefined) {\n\t\t\t\tthis.removeAttribute(attrViewName);\n\t\t\t}\n\t\t\telse if (typeof value === 'boolean') {\n\t\t\t\tif (value) {\n\t\t\t\t\tsuper.setAttribute(attrViewName, '');\n\t\t\t\t} else {\n\t\t\t\t\tthis.removeAttribute(attrViewName);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsuper.setAttribute(attrViewName, value);\n\t\t\t}\n\t\t}\n\n\t\tsetAttribute(attrViewName: string, value: any): void {\n\t\t\tthis.setInputValue(attrViewName, value);\n\t\t\tthis.setAttributeHelper(attrViewName, value);\n\t\t}\n\n\t\tgetAttribute(attrViewName: string): string | null {\n\t\t\treturn this.getInputValue(attrViewName) ?? super.getAttribute(attrViewName);\n\t\t}\n\n\t\tattributeChangedCallback(name: string, oldValue: string, newValue: string) {\n\t\t\tif (newValue === oldValue) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (isOnChanges(this._model)) {\n\t\t\t\tthis._zone.run(this._model.onChanges, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tthis.doBlockCallback();\n\t\t}\n\n\t\tprivate initView() {\n\t\t\t// setup ui view\n\t\t\tthis._render.initView();\n\n\t\t\t// init view binding\n\t\t\tthis._render.initViewBinding();\n\t\t\tthis.needRendering = false;\n\t\t}\n\n\t\tconnectedCallback() {\n\t\t\tif (this.subscriptions.length) {\n\t\t\t\tthis.subscriptions.forEach(sub => sub.unsubscribe());\n\t\t\t}\n\t\t\tthis.subscriptions.splice(0, this.subscriptions.length);\n\t\t\tconst cds = this._zone.onEmpty.subscribe(() => this._modelScope.detectChanges());\n\t\t\tthis.onDestroy(() => cds.unsubscribe());\n\t\t\tthis._componentRef.inputs.forEach(input => {\n\t\t\t\tconst inputDefaultValue = this._model[input.modelProperty];\n\t\t\t\tif (inputDefaultValue !== null && inputDefaultValue !== undefined) {\n\t\t\t\t\tthis.setAttributeHelper(input.viewAttribute, inputDefaultValue);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (isOnChanges(this._model)) {\n\t\t\t\tthis._zone.run(this._model.onChanges, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tif (isOnInit(this._model)) {\n\t\t\t\tthis._zone.run(this._model.onInit, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tif (isDoCheck(this._model)) {\n\t\t\t\tthis._zone.run(this._model.doCheck, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tif (isAfterContentInit(this._model)) {\n\t\t\t\tthis._zone.run(this._model.afterContentInit, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tif (isAfterContentChecked(this._model)) {\n\t\t\t\tthis._zone.run(this._model.afterContentChecked, this._modelScope.getContextProxy!());\n\t\t\t}\n\n\t\t\t// do once\n\t\t\tif (this.needRendering) {\n\t\t\t\tthis.initView();\n\t\t\t}\n\n\t\t\tif (isAfterViewInit(this._model)) {\n\t\t\t\tthis._zone.run(this._model.afterViewInit, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tif (isAfterViewChecked(this._model)) {\n\t\t\t\tthis._zone.run(this._model.afterViewChecked, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tthis.doBlockCallback = () => {\n\t\t\t\tif (isDoCheck(this._model)) {\n\t\t\t\t\tthis._zone.run(this._model.doCheck, this._modelScope.getContextProxy!());\n\t\t\t\t}\n\t\t\t\tif (isAfterContentChecked(this._model)) {\n\t\t\t\t\tthis._zone.run(this._model.afterContentChecked, this._modelScope.getContextProxy!());\n\t\t\t\t}\n\t\t\t\tif (isAfterViewChecked(this._model)) {\n\t\t\t\t\tthis._zone.run(this._model.afterViewChecked, this._modelScope.getContextProxy!());\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst event = new CustomEvent('connected', { cancelable: true, bubbles: false, composed: false });\n\t\t\tthis.dispatchEvent(event);\n\t\t}\n\n\n\t\tprivate initOuterAttribute(attr: Attr) {\n\t\t\t// [window, this] scop\n\t\t\tlet elementAttr = attr.name;\n\t\t\tlet modelProperty = attr.value;\n\t\t\tif (elementAttr.startsWith('[')) {\n\t\t\t\telementAttr = elementAttr.substring(1, elementAttr.length - 1);\n\t\t\t\tif (Reflect.has(window, modelProperty)) {\n\t\t\t\t\tthis.setInputValue(elementAttr, Reflect.get(window, modelProperty));\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (elementAttr.startsWith('(')) {\n\t\t\t\t// (elementAttr)=\"modelProperty()\"\n\t\t\t\telementAttr = elementAttr.substring(1, elementAttr.length - 1);\n\t\t\t\t// this.handleEvent(element, elementAttr, viewProperty);\n\t\t\t\tmodelProperty = modelProperty.endsWith('()') ?\n\t\t\t\t\tmodelProperty.substring(0, modelProperty.length - 2) : modelProperty;\n\t\t\t\tlet callback: Function = Reflect.get(window, modelProperty);\n\t\t\t\tthis.addEventListener(elementAttr, event => {\n\t\t\t\t\tcallback(event);\n\t\t\t\t});\n\t\t\t} else if (elementAttr.startsWith('on')) {\n\t\t\t\tconst modelEvent = this.getEventEmitter<any>(elementAttr.substring(2));\n\t\t\t\tif (modelEvent) {\n\t\t\t\t\t// modelEvent.subscribe(listener);\n\t\t\t\t\tmodelProperty = modelProperty.endsWith('()') ?\n\t\t\t\t\t\tmodelProperty.substring(0, modelProperty.length - 2) : modelProperty;\n\t\t\t\t\tlet listener: Function = Reflect.get(window, modelProperty);\n\t\t\t\t\tmodelEvent.subscribe((data: any) => {\n\t\t\t\t\t\t(listener as Function)(data);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.setInputValue(attr.name, attr.value);\n\t\t\t}\n\t\t}\n\t\tonDestroy(callback: () => void) {\n\t\t\tthis.onDestroyCalls.push(callback);\n\t\t}\n\t\tadoptedCallback() {\n\t\t\t// restart the process\n\t\t\tthis.innerHTML = '';\n\t\t\tthis.connectedCallback();\n\t\t}\n\t\tdisconnectedCallback() {\n\t\t\t// notify first, then call model.onDestroy func\n\t\t\tif (isOnDestroy(this._model)) {\n\t\t\t\tthis._zone.run(this._model.onDestroy, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tthis.subscriptions.forEach(sub => sub.unsubscribe());\n\t\t\tthis.subscriptions.splice(0, this.subscriptions.length);\n\t\t\tthis.onDestroyCalls.forEach(callback => {\n\t\t\t\ttry {\n\t\t\t\t\tcallback();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.error(error);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.onDestroyCalls.splice(0, this.onDestroyCalls.length);\n\t\t\tconst event = new CustomEvent('disconnected', { cancelable: true, bubbles: false, composed: false });\n\t\t\tthis.dispatchEvent(event);\n\t\t}\n\n\t\ttriggerOutput(eventName: string, value?: any): void {\n\t\t\tconst modelEvent = this.getEventEmitter<any>(eventName);\n\t\t\tif (modelEvent) {\n\t\t\t\tmodelEvent.emit(value);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
|
package/view/form-view.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-view.d.ts","sourceRoot":"","sources":["../../../src/core/view/form-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAEN,uBAAuB,EAGvB,MAAM,gCAAgC,CAAC;AAIxC,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;CAE/D;AAED,qBAAa,sBAAuB,YAAW,gBAAgB;IAC9D,OAAO,CAAC,EAAE,CAAmB;gBACjB,KAAK,EAAE,uBAAuB,CAAC,GAAG,EAAE,GAAG,CAAC;IAIpD,IAAI,IAAI,sCAEP;IACD,IAAI,MAAM,iCAET;IAED,IAAI,UAAU,sBAEb;IAED,IAAI,YAAY,YAEf;IAED,YAAY,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAI,GAAG,IAAI;CAI9E;AAeD,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAAE,eAAe,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"form-view.d.ts","sourceRoot":"","sources":["../../../src/core/view/form-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAEN,uBAAuB,EAGvB,MAAM,gCAAgC,CAAC;AAIxC,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;CAE/D;AAED,qBAAa,sBAAuB,YAAW,gBAAgB;IAC9D,OAAO,CAAC,EAAE,CAAmB;gBACjB,KAAK,EAAE,uBAAuB,CAAC,GAAG,EAAE,GAAG,CAAC;IAIpD,IAAI,IAAI,sCAEP;IACD,IAAI,MAAM,iCAET;IAED,IAAI,UAAU,sBAEb;IAED,IAAI,YAAY,YAEf;IAED,YAAY,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAI,GAAG,IAAI;CAI9E;AAeD,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAAE,eAAe,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAgFnI"}
|
package/view/form-view.js
CHANGED
|
@@ -48,7 +48,8 @@ export function baseFormFactoryView(htmlElementType) {
|
|
|
48
48
|
_valueControl;
|
|
49
49
|
constructor(componentRef, modelClass) {
|
|
50
50
|
super(componentRef, modelClass);
|
|
51
|
-
if (componentRef.extend.name && isFormElement(componentRef.extend.name))
|
|
51
|
+
if ((componentRef.extend.name && isFormElement(componentRef.extend.name))
|
|
52
|
+
|| componentRef.disabledFeatures?.includes('internals')) {
|
|
52
53
|
this._internals = new NativeElementInternals(this);
|
|
53
54
|
}
|
|
54
55
|
else {
|
package/view/form-view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-view.js","sourceRoot":"","sources":["../../../src/core/view/form-view.ts"],"names":[],"mappings":"AAEA,OAAO,EAIN,cAAc,GACd,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErE,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC;AAM7C,MAAM,OAAO,sBAAsB;IAC1B,EAAE,CAAmB;IAC7B,YAAY,KAAwC;QACnD,IAAI,CAA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oBAAoB,CAAC,KAAU;YACtC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YACpC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAC9F,CAAC;QAED,sBAAsB,CAAC,IAA4B;YAClD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACnB,CAAC;QACD,oBAAoB,CAAC,QAAiB;YACrC,IAAI,CAAC,aAAa,EAAE,gBAAgB,EAAE,CAAC,QAAQ,CAAC,CAAC;QAClD,CAAC;QACD,iBAAiB;YAChB,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,wBAAwB,CAAC,KAAU,EAAE,IAAgC;YACpE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjD,CAAC;KACD,CAAA;AACF,CAAC","sourcesContent":["import type { TypeOf } from '../utils/typeof.js';\nimport { ComponentRef } from '../component/component.js';\nimport {\n\tFormAssociatedCustomElement, HTMLFormElement,\n\tFormAssociatedComponent,\n\tValueControl,\n\tisValueControl,\n} from '../component/custom-element.js';\nimport { baseFactoryView } from './base-view.js';\nimport { ARIAMixinAttributes, isFormElement } from '@ibyar/elements';\n\nexport const NOOP_CONTROL_CHANGE = () => { };\n\nexport interface NativeElementInternals extends ElementInternals {\n\n}\n\nexport class NativeElementInternals implements ElementInternals {\n\tprivate el: HTMLInputElement;\n\tconstructor(input: FormAssociatedComponent<any, any>) {\n\t\tthis.el = input as any as HTMLInputElement;\n\t}\n\n\tget form() {\n\t\treturn this.el.form;\n\t}\n\tget labels() {\n\t\treturn this.el.labels!;\n\t}\n\n\tget shadowRoot() {\n\t\treturn this.el.shadowRoot;\n\t}\n\n\tget willValidate() {\n\t\treturn this.el.willValidate;\n\t}\n\n\tsetFormValue(value: any | null, state?: File | string | FormData | null): void {\n\t\tthis.el.value = value;\n\t}\n\n}\n\nARIAMixinAttributes.forEach(ariaName => {\n\tObject.defineProperty(NativeElementInternals.prototype, ariaName, {\n\t\tenumerable: true,\n\t\tconfigurable: true,\n\t\tget: function name(this: { el: HTMLInputElement }) {\n\t\t\treturn this.el[ariaName];\n\t\t},\n\t\tset: function name(this: { el: HTMLInputElement }, value: any) {\n\t\t\treturn this.el[ariaName] = value;\n\t\t},\n\t});\n});\n\nexport function baseFormFactoryView<T extends Object>(htmlElementType: TypeOf<HTMLElement>): TypeOf<FormAssociatedComponent<T, any>> {\n\tconst baseViewClass = baseFactoryView<T>(htmlElementType);\n\treturn class BaseFormView<T> extends baseViewClass implements FormAssociatedCustomElement {\n\n\t\t/**\n\t\t * Identify the element as a form-associated custom element\n\t\t */\n\t\tstatic formAssociated = true;\n\n\t\tvalue: any;\n\n\t\tprivate _internals: ElementInternals;\n\t\tprivate _form: HTMLFormElement | null;\n\t\tprivate _valueControl?: ValueControl<T>;\n\n\t\tconstructor(componentRef: ComponentRef<T>, modelClass: TypeOf<T>) {\n\t\t\tsuper(componentRef, modelClass);\n\t\t\tif ((componentRef.extend.name && isFormElement(componentRef.extend.name))\n\t\t\t\t|| componentRef.disabledFeatures?.includes('internals')) {\n\t\t\t\tthis._internals = new NativeElementInternals(this);\n\t\t\t} else {\n\t\t\t\tthis._internals = this.attachInternals();\n\t\t\t}\n\t\t\tlet valueControl: ValueControl<any> | undefined;\n\t\t\tif (typeof componentRef.formAssociated === 'function') {\n\t\t\t\tif (this._model instanceof componentRef.formAssociated) {\n\t\t\t\t\tvalueControl == this._model;\n\t\t\t\t} else {\n\t\t\t\t\tconst args: any[] = [this]; /* resolve dependency injection*/;\n\t\t\t\t\tvalueControl = new componentRef.formAssociated(args);\n\t\t\t\t}\n\t\t\t} else if (componentRef.formAssociated === true && isValueControl(this._model)) {\n\t\t\t\tvalueControl = this._model;\n\t\t\t}\n\t\t\tvalueControl && this.registerValueControl(valueControl);\n\t\t\tconst valueInput = componentRef.inputs.filter(input => input.viewAttribute === 'value').at(0);\n\t\t\tif (valueInput) {\n\t\t\t\tthis._modelScope.subscribe(valueInput.modelProperty as any, (newValue, oldValue) => {\n\t\t\t\t\tif (newValue === oldValue) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tthis.onValueControlChange(newValue);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tget internals(): ElementInternals {\n\t\t\treturn this._internals;\n\t\t}\n\t\tget form(): HTMLFormElement | null {\n\t\t\treturn this._form;\n\t\t}\n\t\tget valueControl(): ValueControl<T> | undefined {\n\t\t\treturn this._valueControl;\n\t\t}\n\t\tregisterValueControl(valueControl: ValueControl): void {\n\t\t\tif (this.valueControl) {\n\t\t\t\tthis.valueControl.registerOnChange(NOOP_CONTROL_CHANGE);\n\t\t\t}\n\t\t\tthis._valueControl = valueControl;\n\t\t\tthis._valueControl?.registerOnChange((value: any) => this.onValueControlChange(value));\n\t\t}\n\t\tprivate onValueControlChange(value: any) {\n\t\t\tthis._internals.setFormValue(value);\n\t\t\tthis.value = value;\n\t\t\tthis.dispatchEvent(new Event('change', { bubbles: true, cancelable: true, composed: true }));\n\t\t}\n\n\t\tformAssociatedCallback(form: HTMLFormElement | null): void {\n\t\t\tthis._form = form;\n\t\t}\n\t\tformDisabledCallback(disabled: boolean): void {\n\t\t\tthis._valueControl?.setDisabledState?.(disabled);\n\t\t}\n\t\tformResetCallback(): void {\n\t\t\tthis._valueControl?.writeValue({ mode: 'reset' });\n\t\t}\n\t\tformStateRestoreCallback(value: any, mode: 'restore' | 'autocomplete'): void {\n\t\t\tthis._valueControl?.writeValue({ value, mode });\n\t\t}\n\t}\n}\n"]}
|
package/view/render.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context, ScopeSubscription, Stack } from '@ibyar/expressions';
|
|
2
|
-
import { CommentNode, DomStructuralDirectiveNode, DomElementNode, DomFragmentNode, DomNode, LiveTextContent, TextContent, DomAttributeDirectiveNode } from '@ibyar/elements';
|
|
2
|
+
import { CommentNode, DomStructuralDirectiveNode, LocalTemplateVariables, DomElementNode, DomFragmentNode, DomNode, LiveTextContent, TextContent, DomAttributeDirectiveNode } from '@ibyar/elements';
|
|
3
3
|
import { HTMLComponent } from '../component/custom-element.js';
|
|
4
4
|
import { AttributeDirective, AttributeOnStructuralDirective, StructuralDirective } from '../directive/directive.js';
|
|
5
5
|
export declare class ComponentRender<T extends object> {
|
|
@@ -21,6 +21,7 @@ export declare class ComponentRender<T extends object> {
|
|
|
21
21
|
createComment(node: CommentNode): Comment;
|
|
22
22
|
createText(node: TextContent): Text;
|
|
23
23
|
createLiveText(textNode: LiveTextContent, contextStack: Stack, subscriptions: ScopeSubscription<Context>[]): Text;
|
|
24
|
+
createLocalTemplateVariables(localNode: LocalTemplateVariables, contextStack: Stack, subscriptions: ScopeSubscription<Context>[]): void;
|
|
24
25
|
createDocumentFragment(node: DomFragmentNode, contextStack: Stack, parentNode: Node, subscriptions: ScopeSubscription<Context>[], host: HTMLComponent<any> | StructuralDirective): DocumentFragment;
|
|
25
26
|
appendChildToParent(fragmentParent: HTMLElement | DocumentFragment, child: DomNode, contextStack: Stack, parentNode: Node, subscriptions: ScopeSubscription<Context>[], host: HTMLComponent<any> | StructuralDirective): void;
|
|
26
27
|
createElementByTagName(node: {
|
package/view/render.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/core/view/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,OAAO,EAAE,iBAAiB,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/core/view/render.ts"],"names":[],"mappings":"AAAA,OAAO,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I;IAEnI;;;;;;;OAOG;IACH,eAAe,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,mBAAmB,GAAG,IAAI;IAqCnL,OAAO,CAAC,uBAAuB;IA+C/B,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAAE;IAwE5G,aAAa,CACZ,SAAS,EAAE,mBAAmB,GAAG,kBAAkB,GAAG,8BAA8B,EACpF,IAAI,EAAE,0BAA0B,GAAG,yBAAyB,EAC5D,YAAY,EAAE,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAAE;CA6CnD"}
|
package/view/render.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactiveScope, ReadOnlyScope } from '@ibyar/expressions';
|
|
2
|
-
import { CommentNode, DomStructuralDirectiveNode, DomElementNode, DomFragmentNode, isLiveTextContent, isTagNameNative, isValidCustomElementName, TextContent, isFormAssociatedCustomElementByTag } from '@ibyar/elements';
|
|
2
|
+
import { CommentNode, DomStructuralDirectiveNode, LocalTemplateVariables, DomElementNode, DomFragmentNode, isLiveTextContent, isTagNameNative, isValidCustomElementName, TextContent, isFormAssociatedCustomElementByTag } from '@ibyar/elements';
|
|
3
3
|
import { isHTMLComponent } from '../component/custom-element.js';
|
|
4
4
|
import { documentStack } from '../context/stack.js';
|
|
5
5
|
import { classRegistryProvider } from '../providers/provider.js';
|
|
@@ -110,10 +110,7 @@ export class ComponentRender {
|
|
|
110
110
|
}
|
|
111
111
|
const stack = directiveStack.copyStack();
|
|
112
112
|
const templateRef = new TemplateRefImpl(this, directive.node, stack, directive.templateExpressions ?? []);
|
|
113
|
-
|
|
114
|
-
if (directive.successor) {
|
|
115
|
-
successorTemplateRef = new TemplateRefImpl(this, directive.successor, stack, []);
|
|
116
|
-
}
|
|
113
|
+
const successorTemplateRefs = Object.fromEntries((directive.successors ?? [])?.map(successor => [successor.name, new TemplateRefImpl(this, successor, stack, [])]));
|
|
117
114
|
const directiveZone = this.view._zone.fork(directiveRef.zone);
|
|
118
115
|
const viewContainerRef = new ViewContainerRefImpl(parentNode, comment);
|
|
119
116
|
directiveZone.onEmpty.subscribe(() => {
|
|
@@ -123,7 +120,7 @@ export class ComponentRender {
|
|
|
123
120
|
}
|
|
124
121
|
});
|
|
125
122
|
const StructuralDirectiveClass = directiveRef.modelClass;
|
|
126
|
-
const structural = directiveZone.run(() => new StructuralDirectiveClass(templateRef, viewContainerRef, host, directiveZone,
|
|
123
|
+
const structural = directiveZone.run(() => new StructuralDirectiveClass(templateRef, viewContainerRef, host, directiveZone, successorTemplateRefs));
|
|
127
124
|
templateRef.host = structural;
|
|
128
125
|
const scope = ReactiveScope.readOnlyScopeForThis(structural);
|
|
129
126
|
scope.getInnerScope('this').getContextProxy = () => structural;
|
|
@@ -157,6 +154,16 @@ export class ComponentRender {
|
|
|
157
154
|
textNode.expression.get(contextStack);
|
|
158
155
|
return liveText;
|
|
159
156
|
}
|
|
157
|
+
createLocalTemplateVariables(localNode, contextStack, subscriptions) {
|
|
158
|
+
const entries = localNode.variables.map(variable => [variable.expression.getLeft().getDeclarationName(), undefined]);
|
|
159
|
+
const context = Object.fromEntries(entries);
|
|
160
|
+
contextStack.pushReactiveScopeFor(context);
|
|
161
|
+
localNode.variables.forEach(variable => {
|
|
162
|
+
const localSubscriptions = variable.expression.subscribe(contextStack, variable.pipelineNames);
|
|
163
|
+
subscriptions.push(...localSubscriptions);
|
|
164
|
+
variable.expression.get(contextStack);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
160
167
|
createDocumentFragment(node, contextStack, parentNode, subscriptions, host) {
|
|
161
168
|
const fragment = document.createDocumentFragment();
|
|
162
169
|
node.children?.forEach(child => this.appendChildToParent(fragment, child, contextStack, parentNode, subscriptions, host));
|
|
@@ -185,6 +192,9 @@ export class ComponentRender {
|
|
|
185
192
|
else if (isLiveTextContent(child)) {
|
|
186
193
|
fragmentParent.append(this.createLiveText(child, contextStack, subscriptions));
|
|
187
194
|
}
|
|
195
|
+
else if (child instanceof LocalTemplateVariables) {
|
|
196
|
+
this.createLocalTemplateVariables(child, contextStack, subscriptions);
|
|
197
|
+
}
|
|
188
198
|
else if (child instanceof TextContent) {
|
|
189
199
|
fragmentParent.append(this.createText(child));
|
|
190
200
|
}
|
package/view/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/core/view/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAqC,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACrG,OAAO,EACN,WAAW,EAAE,0BAA0B,EACvC,cAAc,EAAE,eAAe,EAAW,iBAAiB,EAC3D,eAAe,EAAE,wBAAwB,EACzC,WAAW,EAA6B,kCAAkC,EAC1E,MAAM,iBAAiB,CAAC;AAGzB,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,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAKvE,SAAS,kBAAkB,CAAC,OAAe;IAC1C,QAA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ChC,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;QACJ,CAAC;QACD,SAAS;QACT,qBAAqB;QACrB,OAAO,aAAa,CAAC;IACtB,CAAC;CAED","sourcesContent":["import { ReactiveScope, Context, ScopeSubscription, Stack, ReadOnlyScope } from '@ibyar/expressions';\nimport {\n\tCommentNode, DomStructuralDirectiveNode,\n\tDomElementNode, DomFragmentNode, DomNode, isLiveTextContent,\n\tisTagNameNative, isValidCustomElementName, LiveTextContent,\n\tTextContent, DomAttributeDirectiveNode, isFormAssociatedCustomElementByTag\n} from '@ibyar/elements';\nimport type { DomStructuralDirectiveNodeUpgrade } from '@ibyar/elements/node.js';\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 { createDestroySubscription } from '../context/subscription.js';\nimport { EventEmitter } from '../component/events.js';\n\ntype ViewContext = { [element: string]: HTMLElement };\n\nfunction getChangeEventName(tagName: string): 'input' | 'change' | undefined {\n\tswitch (true) {\n\t\tcase tagName === 'input':\n\t\t\treturn 'input';\n\t\tcase tagName === 'textarea':\n\t\tcase tagName === 'select':\n\t\tcase isFormAssociatedCustomElementByTag(tagName):\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 exportAsScope: ReactiveScope<Record<string, any>>;\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.exportAsScope = this.contextStack.pushReactiveScope();\n\t\tthis.templateNameScope = this.contextStack.pushReactiveScope();\n\t}\n\tinitView(): void {\n\t\tif (!this.componentRef.template) {\n\t\t\treturn;\n\t\t}\n\t\tif (typeof this.componentRef.template === 'function') {\n\t\t\tthis.template = this.componentRef.template(this.view._model);\n\t\t} else {\n\t\t\tthis.template = this.componentRef.template;\n\t\t}\n\n\t\tlet rootRef: HTMLElement | ShadowRoot;\n\t\tif (this.componentRef.isShadowDom) {\n\t\t\trootRef = Reflect.get(this.view, '_shadowRoot') as ShadowRoot;\n\t\t\tReflect.deleteProperty(this.view, '_shadowRoot');\n\t\t} else {\n\t\t\trootRef = this.view;\n\t\t}\n\t\tthis.initTemplateRefMap(this.template);\n\t\tlet rootFragment: DocumentFragment;\n\t\tif (this.template instanceof DomFragmentNode) {\n\t\t\trootFragment = this.createDocumentFragment(this.template, this.contextStack, rootRef, this.subscriptions, this.view);\n\t\t} else {\n\t\t\trootFragment = document.createDocumentFragment();\n\t\t\tthis.appendChildToParent(rootFragment, this.template, this.contextStack, rootRef, this.subscriptions, this.view);\n\t\t}\n\t\trootRef.append(rootFragment);\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) || !domNode.children) {\n\t\t\treturn;\n\t\t}\n\t\tfor (let index = 0; index < domNode.children.length; index++) {\n\t\t\tconst child = domNode.children[index];\n\t\t\tif (this.isTemplateRefName(child)) {\n\t\t\t\tthis.templateNameScope.set(child.templateRefName!.name, undefined);\n\t\t\t} else {\n\t\t\t\tthis.initTemplateRefMap(child);\n\t\t\t}\n\t\t}\n\t}\n\tinitViewBinding() {\n\t\tif (this.componentRef.viewBindings) {\n\t\t\tthis.initHtmlElement(this.view, this.componentRef.viewBindings, this.contextStack, this.subscriptions);\n\t\t}\n\t\tif (this.componentRef.windowBindings) {\n\t\t\tthis.subscriptions.push(...this.initAttribute(window as any, this.componentRef.windowBindings, this.contextStack));\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\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\treturn;\n\t\t}\n\t\tconst stack = directiveStack.copyStack();\n\t\tconst templateRef = new TemplateRefImpl(\n\t\t\tthis,\n\t\t\tdirective.node,\n\t\t\tstack,\n\t\t\t(directive as DomStructuralDirectiveNodeUpgrade).templateExpressions ?? [],\n\t\t);\n\t\tlet successorTemplateRef: TemplateRef | undefined;\n\t\tif (directive.successor) {\n\t\t\tsuccessorTemplateRef = new TemplateRefImpl(\n\t\t\t\tthis,\n\t\t\t\tdirective.successor,\n\t\t\t\tstack,\n\t\t\t\t[]\n\t\t\t);\n\t\t}\n\n\t\tconst directiveZone = this.view._zone.fork(directiveRef.zone);\n\t\tconst viewContainerRef = new ViewContainerRefImpl(parentNode as Element, comment);\n\n\t\tdirectiveZone.onEmpty.subscribe(() => {\n\t\t\tconst length = viewContainerRef.length;\n\t\t\tfor (let index = 0; index < length; index++) {\n\t\t\t\tviewContainerRef.get(index)?.detectChanges();\n\t\t\t}\n\t\t});\n\n\t\tconst StructuralDirectiveClass = directiveRef.modelClass as typeof StructuralDirective;\n\t\tconst structural = directiveZone.run(() => new StructuralDirectiveClass(\n\t\t\ttemplateRef,\n\t\t\tviewContainerRef,\n\t\t\thost,\n\t\t\tdirectiveZone,\n\t\t\tsuccessorTemplateRef,\n\t\t));\n\n\t\ttemplateRef.host = structural;\n\t\tconst scope = ReactiveScope.readOnlyScopeForThis(structural);\n\t\tscope.getInnerScope('this')!.getContextProxy = () => structural;\n\t\tstack.pushScope(scope);\n\t\tif (directiveRef.exportAs) {\n\t\t\tstack.pushBlockScopeFor({ [directiveRef.exportAs]: structural });\n\t\t}\n\t\tsubscriptions.push(...this.initDirective(structural, directive, stack));\n\t\tif (isOnInit(structural)) {\n\t\t\tdirectiveZone.run(structural.onInit, structural);\n\t\t}\n\t\tif (directive.attributeDirectives?.length) {\n\t\t\tthis.initAttributeDirectives(directive.attributeDirectives, structural, stack, subscriptions);\n\t\t}\n\t\tif (isOnDestroy(structural)) {\n\t\t\tsubscriptions.push(createDestroySubscription(() => structural.onDestroy()));\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, 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, host));\n\t\t} else if (child instanceof DomStructuralDirectiveNode) {\n\t\t\tconst comment = document.createComment(` @${child.name.substring(1)} ${typeof child.value ? `(${child.value}) ` : ''}`);\n\t\t\tfragmentParent.append(comment);\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, 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\treturn element;\n\t}\n\tcreateElement(node: DomElementNode, contextStack: Stack, subscriptions: ScopeSubscription<Context>[], host: HTMLComponent<any> | StructuralDirective): HTMLElement {\n\t\tconst element = this.createElementByTagName(node);\n\t\tthis.initHtmlElement(element, node, contextStack, subscriptions, host);\n\t\treturn element;\n\t}\n\n\tprivate createReadOnlyWithReactiveInnerScope<T extends Context>(ctx: T, aliasName?: string, propertyKeys?: (keyof T)[]) {\n\t\tif (!aliasName) {\n\t\t\treturn ReactiveScope.readOnlyScopeForThis(ctx, propertyKeys);\n\t\t}\n\t\tconst reactiveScope = ReactiveScope.for(ctx, propertyKeys);\n\t\tconst context: Record<string, any> = {\n\t\t\t'this': ctx,\n\t\t\t[aliasName]: ctx,\n\t\t};\n\t\tconst rootScope = ReadOnlyScope.for(context, ['this', aliasName]);\n\t\trootScope.setInnerScope('this', reactiveScope);\n\t\trootScope.setInnerScope(aliasName as 'this', reactiveScope);\n\t\treturn rootScope;\n\t}\n\n\t/**\n\t * use for init host bindings\n\t * @param element \n\t * @param node \n\t * @param contextStack \n\t * @param subscriptions \n\t */\n\tinitHtmlElement(element: HTMLElement, node: DomElementNode, contextStack: Stack, subscriptions: ScopeSubscription<Context>[]): void;\n\n\t/**\n\t * use to init a new create html element\n\t * @param element \n\t * @param node \n\t * @param contextStack \n\t * @param subscriptions \n\t * @param host is the direct html element `this.view` or a sub `structural directive` like `*if` or `*for`, etc...\n\t */\n\tinitHtmlElement(element: HTMLElement, node: DomElementNode, contextStack: Stack, subscriptions: ScopeSubscription<Context>[], host: HTMLComponent<any> | StructuralDirective): void;\n\tinitHtmlElement(element: HTMLElement, node: DomElementNode, contextStack: Stack, subscriptions: ScopeSubscription<Context>[], host?: HTMLComponent<any> | StructuralDirective): void {\n\t\tconst elementStack = contextStack.copyStack();\n\t\tconst elementScope = isHTMLComponent(element)\n\t\t\t? element._viewScope\n\t\t\t: this.createReadOnlyWithReactiveInnerScope(element, node.templateRefName?.name);\n\t\telementStack.pushScope<Context>(elementScope);\n\t\tconst attributesSubscriptions = this.initAttribute(element, node, elementStack);\n\t\tsubscriptions.push(...attributesSubscriptions);\n\t\tconst changeEventName = getChangeEventName(node.tagName);\n\t\tif (changeEventName) {\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(changeEventName, listener);\n\t\t\tsubscriptions.push(createDestroySubscription(\n\t\t\t\t() => element.removeEventListener(changeEventName, listener),\n\t\t\t));\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}\n\tprivate initAttributeDirectives(\n\t\tattributeDirectives: DomAttributeDirectiveNode[],\n\t\telement: HTMLElement | StructuralDirective,\n\t\tcontextStack: Stack,\n\t\tsubscriptions: 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\treturn;\n\t\t\t}\n\t\t\tconst directiveZone = this.view._zone.fork(directiveRef.zone);\n\t\t\tconst directive = directiveZone.run(() => new directiveRef.modelClass(element, directiveZone) as AttributeDirective | AttributeOnStructuralDirective);\n\t\t\tif (directiveRef.exportAs) {\n\t\t\t\tthis.exportAsScope.set(directiveRef.exportAs, directive);\n\t\t\t}\n\n\t\t\tconst stack = contextStack.copyStack();\n\t\t\tconst scope = ReactiveScope.readOnlyScopeForThis(directive);\n\t\t\tconst directiveScope = scope.getInnerScope('this')!;\n\t\t\tdirectiveScope.getContextProxy = () => directive;\n\t\t\tstack.pushScope(scope);\n\n\t\t\tconst directiveSubscriptions = this.initDirective(directive, directiveNode, stack);\n\t\t\tsubscriptions.push(...directiveSubscriptions);\n\t\t\tif (isOnInit(directive)) {\n\t\t\t\tdirectiveZone.run(directive.onInit, directive);\n\t\t\t}\n\t\t\tif (isOnDestroy(directive)) {\n\t\t\t\tsubscriptions.push(createDestroySubscription(() => directive.onDestroy()));\n\t\t\t}\n\t\t\tif (!(element instanceof HTMLElement)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst attributeName = directiveRef.selector.replace(/[A-Z]/g, m => '-' + m.toLowerCase());\n\t\t\tif (!element.hasAttribute(attributeName)) {\n\t\t\t\telement.setAttribute(attributeName, '');\n\t\t\t}\n\t\t\tif (directiveRef.viewBindings) {\n\t\t\t\tconst directiveStack = stack.copyStack();\n\t\t\t\tdirectiveStack.pushScope(directiveScope);\n\t\t\t\tthis.initHtmlElement(element, directiveRef.viewBindings, directiveStack, subscriptions);\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\" data-id=\"1234567890\" data-user=\"carinaanand\" data-date-of-birth />\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\tsubscriptions.push(createDestroySubscription(\n\t\t\t\t\t() => element.removeEventListener(event.name as any, listener as any),\n\t\t\t\t));\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\tinitDirective(\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\tconst subscription = ((directive as any)[event.name] as EventEmitter<T>).subscribe(listener);\n\t\t\t\tsubscriptions.push(createDestroySubscription(\n\t\t\t\t\t() => ((directive as any)[event.name] as EventEmitter<T>).remove(subscription),\n\t\t\t\t));\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"]}
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/core/view/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAqC,aAAa,EAAc,MAAM,oBAAoB,CAAC;AACjH,OAAO,EACN,WAAW,EAAE,0BAA0B,EAAE,sBAAsB,EAC/D,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KAAK,CAAC,IAAI,CAAqB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAC7F,aAAa,CAAC,IAAI,CAAC,yBAAyB,CAC3C,GAAG,EAAE,CAAG,SAAiB,CAAC,KAAK,CAAC,IAAI,CAAqB,CAAC,MAAM,CAAC,YAAY,CAAC,CAC9E,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;QACJ,CAAC;QACD,IAAI,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC;YAChC,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;QACJ,CAAC;QACD,SAAS;QACT,qBAAqB;QACrB,OAAO,aAAa,CAAC;IACtB,CAAC;CAED","sourcesContent":["import { ReactiveScope, Context, ScopeSubscription, Stack, ReadOnlyScope, Identifier } from '@ibyar/expressions';\nimport {\n\tCommentNode, DomStructuralDirectiveNode, LocalTemplateVariables,\n\tDomElementNode, DomFragmentNode, DomNode, isLiveTextContent,\n\tisTagNameNative, isValidCustomElementName, LiveTextContent,\n\tTextContent, DomAttributeDirectiveNode, isFormAssociatedCustomElementByTag\n} from '@ibyar/elements';\nimport type { DomStructuralDirectiveNodeUpgrade } from '@ibyar/elements/node.js';\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 { createDestroySubscription } from '../context/subscription.js';\nimport { EventEmitter } from '../component/events.js';\n\ntype ViewContext = { [element: string]: HTMLElement };\n\nfunction getChangeEventName(tagName: string): 'input' | 'change' | undefined {\n\tswitch (true) {\n\t\tcase tagName === 'input':\n\t\t\treturn 'input';\n\t\tcase tagName === 'textarea':\n\t\tcase tagName === 'select':\n\t\tcase isFormAssociatedCustomElementByTag(tagName):\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 exportAsScope: ReactiveScope<Record<string, any>>;\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.exportAsScope = this.contextStack.pushReactiveScope();\n\t\tthis.templateNameScope = this.contextStack.pushReactiveScope();\n\t}\n\tinitView(): void {\n\t\tif (!this.componentRef.template) {\n\t\t\treturn;\n\t\t}\n\t\tif (typeof this.componentRef.template === 'function') {\n\t\t\tthis.template = this.componentRef.template(this.view._model);\n\t\t} else {\n\t\t\tthis.template = this.componentRef.template;\n\t\t}\n\n\t\tlet rootRef: HTMLElement | ShadowRoot;\n\t\tif (this.componentRef.isShadowDom) {\n\t\t\trootRef = Reflect.get(this.view, '_shadowRoot') as ShadowRoot;\n\t\t\tReflect.deleteProperty(this.view, '_shadowRoot');\n\t\t} else {\n\t\t\trootRef = this.view;\n\t\t}\n\t\tthis.initTemplateRefMap(this.template);\n\t\tlet rootFragment: DocumentFragment;\n\t\tif (this.template instanceof DomFragmentNode) {\n\t\t\trootFragment = this.createDocumentFragment(this.template, this.contextStack, rootRef, this.subscriptions, this.view);\n\t\t} else {\n\t\t\trootFragment = document.createDocumentFragment();\n\t\t\tthis.appendChildToParent(rootFragment, this.template, this.contextStack, rootRef, this.subscriptions, this.view);\n\t\t}\n\t\trootRef.append(rootFragment);\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) || !domNode.children) {\n\t\t\treturn;\n\t\t}\n\t\tfor (let index = 0; index < domNode.children.length; index++) {\n\t\t\tconst child = domNode.children[index];\n\t\t\tif (this.isTemplateRefName(child)) {\n\t\t\t\tthis.templateNameScope.set(child.templateRefName!.name, undefined);\n\t\t\t} else {\n\t\t\t\tthis.initTemplateRefMap(child);\n\t\t\t}\n\t\t}\n\t}\n\tinitViewBinding() {\n\t\tif (this.componentRef.viewBindings) {\n\t\t\tthis.initHtmlElement(this.view, this.componentRef.viewBindings, this.contextStack, this.subscriptions);\n\t\t}\n\t\tif (this.componentRef.windowBindings) {\n\t\t\tthis.subscriptions.push(...this.initAttribute(window as any, this.componentRef.windowBindings, this.contextStack));\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\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\treturn;\n\t\t}\n\t\tconst stack = directiveStack.copyStack();\n\t\tconst templateRef = new TemplateRefImpl(\n\t\t\tthis,\n\t\t\tdirective.node,\n\t\t\tstack,\n\t\t\t(directive as DomStructuralDirectiveNodeUpgrade).templateExpressions ?? [],\n\t\t);\n\t\tconst successorTemplateRefs = Object.fromEntries((directive.successors ?? [])?.map(\n\t\t\tsuccessor => [successor.name, new TemplateRefImpl(this, successor, stack, [])]\n\t\t));\n\t\tconst directiveZone = this.view._zone.fork(directiveRef.zone);\n\t\tconst viewContainerRef = new ViewContainerRefImpl(parentNode as Element, comment);\n\n\t\tdirectiveZone.onEmpty.subscribe(() => {\n\t\t\tconst length = viewContainerRef.length;\n\t\t\tfor (let index = 0; index < length; index++) {\n\t\t\t\tviewContainerRef.get(index)?.detectChanges();\n\t\t\t}\n\t\t});\n\n\t\tconst StructuralDirectiveClass = directiveRef.modelClass as typeof StructuralDirective;\n\t\tconst structural = directiveZone.run(() => new StructuralDirectiveClass(\n\t\t\ttemplateRef,\n\t\t\tviewContainerRef,\n\t\t\thost,\n\t\t\tdirectiveZone,\n\t\t\tsuccessorTemplateRefs,\n\t\t));\n\n\t\ttemplateRef.host = structural;\n\t\tconst scope = ReactiveScope.readOnlyScopeForThis(structural);\n\t\tscope.getInnerScope('this')!.getContextProxy = () => structural;\n\t\tstack.pushScope(scope);\n\t\tif (directiveRef.exportAs) {\n\t\t\tstack.pushBlockScopeFor({ [directiveRef.exportAs]: structural });\n\t\t}\n\t\tsubscriptions.push(...this.initDirective(structural, directive, stack));\n\t\tif (isOnInit(structural)) {\n\t\t\tdirectiveZone.run(structural.onInit, structural);\n\t\t}\n\t\tif (directive.attributeDirectives?.length) {\n\t\t\tthis.initAttributeDirectives(directive.attributeDirectives, structural, stack, subscriptions);\n\t\t}\n\t\tif (isOnDestroy(structural)) {\n\t\t\tsubscriptions.push(createDestroySubscription(() => structural.onDestroy()));\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, 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\tcreateLocalTemplateVariables(localNode: LocalTemplateVariables, contextStack: Stack, subscriptions: ScopeSubscription<Context>[]): void {\n\t\tconst entries = localNode.variables.map(variable => [(variable.expression.getLeft() as Identifier).getDeclarationName(), undefined]);\n\t\tconst context = Object.fromEntries(entries);\n\t\tcontextStack.pushReactiveScopeFor(context);\n\t\tlocalNode.variables.forEach(variable => {\n\t\t\tconst localSubscriptions = variable.expression.subscribe(contextStack, variable.pipelineNames);\n\t\t\tsubscriptions.push(...localSubscriptions);\n\t\t\tvariable.expression.get(contextStack);\n\t\t});\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, host));\n\t\t} else if (child instanceof DomStructuralDirectiveNode) {\n\t\t\tconst comment = document.createComment(` @${child.name.substring(1)} ${typeof child.value ? `(${child.value}) ` : ''}`);\n\t\t\tfragmentParent.append(comment);\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, subscriptions));\n\t\t} else if (child instanceof LocalTemplateVariables) {\n\t\t\tthis.createLocalTemplateVariables(child, contextStack, 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\treturn element;\n\t}\n\tcreateElement(node: DomElementNode, contextStack: Stack, subscriptions: ScopeSubscription<Context>[], host: HTMLComponent<any> | StructuralDirective): HTMLElement {\n\t\tconst element = this.createElementByTagName(node);\n\t\tthis.initHtmlElement(element, node, contextStack, subscriptions, host);\n\t\treturn element;\n\t}\n\n\tprivate createReadOnlyWithReactiveInnerScope<T extends Context>(ctx: T, aliasName?: string, propertyKeys?: (keyof T)[]) {\n\t\tif (!aliasName) {\n\t\t\treturn ReactiveScope.readOnlyScopeForThis(ctx, propertyKeys);\n\t\t}\n\t\tconst reactiveScope = ReactiveScope.for(ctx, propertyKeys);\n\t\tconst context: Record<string, any> = {\n\t\t\t'this': ctx,\n\t\t\t[aliasName]: ctx,\n\t\t};\n\t\tconst rootScope = ReadOnlyScope.for(context, ['this', aliasName]);\n\t\trootScope.setInnerScope('this', reactiveScope);\n\t\trootScope.setInnerScope(aliasName as 'this', reactiveScope);\n\t\treturn rootScope;\n\t}\n\n\t/**\n\t * use for init host bindings\n\t * @param element \n\t * @param node \n\t * @param contextStack \n\t * @param subscriptions \n\t */\n\tinitHtmlElement(element: HTMLElement, node: DomElementNode, contextStack: Stack, subscriptions: ScopeSubscription<Context>[]): void;\n\n\t/**\n\t * use to init a new create html element\n\t * @param element \n\t * @param node \n\t * @param contextStack \n\t * @param subscriptions \n\t * @param host is the direct html element `this.view` or a sub `structural directive` like `*if` or `*for`, etc...\n\t */\n\tinitHtmlElement(element: HTMLElement, node: DomElementNode, contextStack: Stack, subscriptions: ScopeSubscription<Context>[], host: HTMLComponent<any> | StructuralDirective): void;\n\tinitHtmlElement(element: HTMLElement, node: DomElementNode, contextStack: Stack, subscriptions: ScopeSubscription<Context>[], host?: HTMLComponent<any> | StructuralDirective): void {\n\t\tconst elementStack = contextStack.copyStack();\n\t\tconst elementScope = isHTMLComponent(element)\n\t\t\t? element._viewScope\n\t\t\t: this.createReadOnlyWithReactiveInnerScope(element, node.templateRefName?.name);\n\t\telementStack.pushScope<Context>(elementScope);\n\t\tconst attributesSubscriptions = this.initAttribute(element, node, elementStack);\n\t\tsubscriptions.push(...attributesSubscriptions);\n\t\tconst changeEventName = getChangeEventName(node.tagName);\n\t\tif (changeEventName) {\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(changeEventName, listener);\n\t\t\tsubscriptions.push(createDestroySubscription(\n\t\t\t\t() => element.removeEventListener(changeEventName, listener),\n\t\t\t));\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}\n\tprivate initAttributeDirectives(\n\t\tattributeDirectives: DomAttributeDirectiveNode[],\n\t\telement: HTMLElement | StructuralDirective,\n\t\tcontextStack: Stack,\n\t\tsubscriptions: 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\treturn;\n\t\t\t}\n\t\t\tconst directiveZone = this.view._zone.fork(directiveRef.zone);\n\t\t\tconst directive = directiveZone.run(() => new directiveRef.modelClass(element, directiveZone) as AttributeDirective | AttributeOnStructuralDirective);\n\t\t\tif (directiveRef.exportAs) {\n\t\t\t\tthis.exportAsScope.set(directiveRef.exportAs, directive);\n\t\t\t}\n\n\t\t\tconst stack = contextStack.copyStack();\n\t\t\tconst scope = ReactiveScope.readOnlyScopeForThis(directive);\n\t\t\tconst directiveScope = scope.getInnerScope('this')!;\n\t\t\tdirectiveScope.getContextProxy = () => directive;\n\t\t\tstack.pushScope(scope);\n\n\t\t\tconst directiveSubscriptions = this.initDirective(directive, directiveNode, stack);\n\t\t\tsubscriptions.push(...directiveSubscriptions);\n\t\t\tif (isOnInit(directive)) {\n\t\t\t\tdirectiveZone.run(directive.onInit, directive);\n\t\t\t}\n\t\t\tif (isOnDestroy(directive)) {\n\t\t\t\tsubscriptions.push(createDestroySubscription(() => directive.onDestroy()));\n\t\t\t}\n\t\t\tif (!(element instanceof HTMLElement)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst attributeName = directiveRef.selector.replace(/[A-Z]/g, m => '-' + m.toLowerCase());\n\t\t\tif (!element.hasAttribute(attributeName)) {\n\t\t\t\telement.setAttribute(attributeName, '');\n\t\t\t}\n\t\t\tif (directiveRef.viewBindings) {\n\t\t\t\tconst directiveStack = stack.copyStack();\n\t\t\t\tdirectiveStack.pushScope(directiveScope);\n\t\t\t\tthis.initHtmlElement(element, directiveRef.viewBindings, directiveStack, subscriptions);\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\" data-id=\"1234567890\" data-user=\"carinaanand\" data-date-of-birth />\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\tsubscriptions.push(createDestroySubscription(\n\t\t\t\t\t() => element.removeEventListener(event.name as any, listener as any),\n\t\t\t\t));\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\tinitDirective(\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\tconst subscription = ((directive as any)[event.name] as EventEmitter<T>).subscribe(listener);\n\t\t\t\tsubscriptions.push(createDestroySubscription(\n\t\t\t\t\t() => ((directive as any)[event.name] as EventEmitter<T>).remove(subscription),\n\t\t\t\t));\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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/core/view/view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAY,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAS/D;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../../src/core/view/view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAY,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAS/D;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAiGpJ;AAED,MAAM,MAAM,mBAAmB,GAC9B,aAAa,GACX;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GACzB;IAAE,SAAS,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CAAE,GACxC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAA;CAAE,CAAC;AAEjD,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,MAAM,QAUnK;AAED,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,UAK9D"}
|
package/view/view.js
CHANGED
|
@@ -14,7 +14,6 @@ const FACTORY_CACHE = new WeakMap();
|
|
|
14
14
|
export function initCustomElementView(modelClass, componentRef) {
|
|
15
15
|
var _a;
|
|
16
16
|
const htmlParent = componentRef.extend.classRef;
|
|
17
|
-
let viewClass;
|
|
18
17
|
const viewClassName = buildViewClassNameFromSelector(componentRef.selector);
|
|
19
18
|
const htmlViewClassName = `HTML${viewClassName}Element`;
|
|
20
19
|
let parentClass;
|
|
@@ -30,7 +29,7 @@ export function initCustomElementView(modelClass, componentRef) {
|
|
|
30
29
|
FACTORY_CACHE.set(htmlParent, parentClass);
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
|
-
viewClass = ({
|
|
32
|
+
const viewClass = ({
|
|
34
33
|
[_a = __propKey(htmlViewClassName)]: (() => {
|
|
35
34
|
let _classDecorators = [Metadata()];
|
|
36
35
|
let _classDescriptor;
|
|
@@ -45,11 +44,16 @@ export function initCustomElementView(modelClass, componentRef) {
|
|
|
45
44
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
46
45
|
class_1 = _classThis = _classDescriptor.value;
|
|
47
46
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
48
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
49
47
|
}
|
|
48
|
+
static allAttributes = [];
|
|
49
|
+
static disabledFeatures = [];
|
|
50
|
+
static observedAttributes = [];
|
|
50
51
|
constructor(optionalComponentRef, modelConstructor) {
|
|
51
52
|
super(optionalComponentRef ?? componentRef, modelConstructor ?? modelClass);
|
|
52
53
|
}
|
|
54
|
+
static {
|
|
55
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
56
|
+
}
|
|
53
57
|
};
|
|
54
58
|
return class_1 = _classThis;
|
|
55
59
|
})()
|
|
@@ -109,8 +113,11 @@ export function initCustomElementView(modelClass, componentRef) {
|
|
|
109
113
|
if (componentRef.formAssociated && !observedAttributes.includes('value')) {
|
|
110
114
|
observedAttributes.push('value');
|
|
111
115
|
}
|
|
112
|
-
|
|
113
|
-
|
|
116
|
+
viewClass.allAttributes.push(...defaultAttributes.concat(observedAttributes));
|
|
117
|
+
viewClass.observedAttributes.push(...observedAttributes);
|
|
118
|
+
if (Array.isArray(componentRef.disabledFeatures)) {
|
|
119
|
+
viewClass.disabledFeatures.push(...componentRef.disabledFeatures);
|
|
120
|
+
}
|
|
114
121
|
addViewToModelClass(modelClass, componentRef.selector, viewClass, htmlViewClassName);
|
|
115
122
|
if (!Reflect.has(window, htmlViewClassName)) {
|
|
116
123
|
Reflect.set(window, htmlViewClassName, viewClass);
|