@ibyar/core 3.1.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/LICENSE +1 -1
  2. package/annotation/decorators.d.ts +4 -0
  3. package/annotation/decorators.d.ts.map +1 -1
  4. package/annotation/decorators.js +7 -1
  5. package/annotation/decorators.js.map +1 -1
  6. package/annotation/options.d.ts +4 -0
  7. package/annotation/options.d.ts.map +1 -1
  8. package/annotation/options.js.map +1 -1
  9. package/component/component.d.ts +1 -1
  10. package/component/component.d.ts.map +1 -1
  11. package/component/component.js +2 -2
  12. package/component/component.js.map +1 -1
  13. package/component/custom-element.d.ts +42 -0
  14. package/component/custom-element.d.ts.map +1 -1
  15. package/component/custom-element.js.map +1 -1
  16. package/component/initializer.d.ts +1 -1
  17. package/component/initializer.d.ts.map +1 -1
  18. package/component/initializer.js.map +1 -1
  19. package/component/lifecycle.d.ts +20 -0
  20. package/component/lifecycle.d.ts.map +1 -1
  21. package/component/lifecycle.js +6 -0
  22. package/component/lifecycle.js.map +1 -1
  23. package/di/inject.js +1 -1
  24. package/di/inject.js.map +1 -1
  25. package/directive/providers.d.ts +1 -2
  26. package/directive/providers.d.ts.map +1 -1
  27. package/directive/providers.js.map +1 -1
  28. package/linker/view-container-ref.d.ts +64 -32
  29. package/linker/view-container-ref.d.ts.map +1 -1
  30. package/linker/view-container-ref.js +39 -27
  31. package/linker/view-container-ref.js.map +1 -1
  32. package/linker/view-ref.d.ts +15 -3
  33. package/linker/view-ref.d.ts.map +1 -1
  34. package/linker/view-ref.js +17 -0
  35. package/linker/view-ref.js.map +1 -1
  36. package/package.json +10 -9
  37. package/pipe/pipe.d.ts +3 -9
  38. package/pipe/pipe.d.ts.map +1 -1
  39. package/pipe/pipe.js +39 -7
  40. package/pipe/pipe.js.map +1 -1
  41. package/providers/provider.d.ts +4 -4
  42. package/providers/provider.d.ts.map +1 -1
  43. package/providers/provider.js +9 -9
  44. package/providers/provider.js.map +1 -1
  45. package/view/base-view.d.ts.map +1 -1
  46. package/view/base-view.js +20 -9
  47. package/view/base-view.js.map +1 -1
  48. package/view/form-view.js +1 -1
  49. package/view/form-view.js.map +1 -1
  50. package/view/render.d.ts +0 -1
  51. package/view/render.d.ts.map +1 -1
  52. package/view/render.js +16 -30
  53. package/view/render.js.map +1 -1
  54. package/view/shadow-root.d.ts +8 -0
  55. package/view/shadow-root.d.ts.map +1 -0
  56. package/view/shadow-root.js +15 -0
  57. package/view/shadow-root.js.map +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibyar/core",
3
- "version": "3.1.1",
3
+ "version": "5.0.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",
@@ -16,7 +16,8 @@
16
16
  "contributors": [
17
17
  {
18
18
  "name": "Muhammad Salem",
19
- "email": "salem.ebo@gmail.com"
19
+ "email": "salem.ebo@gmail.com",
20
+ "url": "https://github.com/muhammad-salem"
20
21
  }
21
22
  ],
22
23
  "main": "./index.js",
@@ -35,16 +36,16 @@
35
36
  "access": "public"
36
37
  },
37
38
  "dependencies": {
38
- "@ibyar/decorators": "^3.1.1",
39
- "@ibyar/elements": "^3.1.1",
40
- "@ibyar/expressions": "^3.1.1",
41
- "tslib": "^2.8.1"
39
+ "@ibyar/decorators": "^5.0.0",
40
+ "@ibyar/elements": "^5.0.0",
41
+ "@ibyar/expressions": "^5.0.0",
42
+ "tslib": "^2.9.1"
42
43
  },
43
44
  "peerDependencies": {
44
- "zone.js": "~0.15.0"
45
+ "zone.js": "~0.16.3"
45
46
  },
46
47
  "devDependencies": {
47
- "typescript": "^5.7.3"
48
+ "typescript": "^7.0.2"
48
49
  },
49
50
  "scripts": {
50
51
  "build": "tsc --build --verbose",
@@ -78,5 +79,5 @@
78
79
  "typescript",
79
80
  "front-end"
80
81
  ],
81
- "gitHead": "9532d01b23f038ee839911245e7ccf1f24add1d6"
82
+ "gitHead": "c0e54a3bb5807191ee8d18c55835f4dee535d78d"
82
83
  }
package/pipe/pipe.d.ts CHANGED
@@ -1,22 +1,16 @@
1
1
  import { ReactiveControlScope, ReadOnlyScope, ScopeSubscription } from '@ibyar/expressions';
2
2
  import { OnDestroy } from '../component/lifecycle.js';
3
- import { ChangeDetectorRef } from '../linker/change-detector-ref.js';
4
3
  import { Type } from '../utils/typeof.js';
5
4
  /**
6
5
  * Pipes are used as singleton
7
6
  * it will be created if it needed, had no life cycle
8
- *
9
- * * no dependency injection applied on filters for now,
10
- * TODO: add support of dependency injection
11
7
  */
12
8
  export interface PipeTransform<T, U> {
13
9
  transform(value: T, ...args: any[]): U;
14
10
  }
15
- export declare abstract class AsyncPipeTransform<T, U> implements PipeTransform<T, U>, OnDestroy {
16
- protected changeDetectorRef: ChangeDetectorRef;
17
- constructor(changeDetectorRef: ChangeDetectorRef);
18
- abstract transform(value: T, ...args: any[]): U;
19
- abstract onDestroy(): void;
11
+ export interface AsyncPipeTransform<T, U> extends PipeTransform<T, U>, OnDestroy {
12
+ transform(value: T, ...args: any[]): U;
13
+ onDestroy(): void;
20
14
  }
21
15
  export declare function isPipeTransform<T extends any, U extends any>(pipe: any): pipe is PipeTransform<T, U>;
22
16
  export declare class PipeProvider extends ReadOnlyScope<{
@@ -1 +1 @@
1
- {"version":3,"file":"pipe.d.ts","sourceRoot":"","sources":["../../../src/core/pipe/pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAA2B,MAAM,kCAAkC,CAAC;AAE9F,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,aAAa,CAAC,C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G,OAAO;IA6BjG,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG,GAAG;IAG9B,WAAW,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,YAAY,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAK9E,QAAQ,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;CAGnC"}
package/pipe/pipe.js CHANGED
@@ -1,12 +1,9 @@
1
1
  import { ReactiveControlScope, ReadOnlyScope } from '@ibyar/expressions';
2
- import { createChangeDetectorRef } from '../linker/change-detector-ref.js';
2
+ import { isOnInit } from '../component/lifecycle.js';
3
+ import { ChangeDetectorRef, createChangeDetectorRef } from '../linker/change-detector-ref.js';
3
4
  import { classRegistryProvider } from '../providers/provider.js';
4
- export class AsyncPipeTransform {
5
- changeDetectorRef;
6
- constructor(changeDetectorRef) {
7
- this.changeDetectorRef = changeDetectorRef;
8
- }
9
- }
5
+ import { addProvider, forkProvider, removeProvider } from '../di/inject.js';
6
+ import { AbstractAuroraZone } from '../zone/zone.js';
10
7
  export function isPipeTransform(pipe) {
11
8
  return Reflect.has(Object.getPrototypeOf(pipe), 'transform');
12
9
  }
@@ -28,7 +25,24 @@ export class PipeProvider extends ReadOnlyScope {
28
25
  }
29
26
  const pipeRef = classRegistryProvider.getPipe(pipeName);
30
27
  if (pipeRef !== undefined && !pipeRef.asynchronous) {
28
+ const provider = forkProvider();
29
+ addProvider(provider);
31
30
  const pipe = new pipeRef.modelClass();
31
+ removeProvider(provider);
32
+ if (isOnInit(pipe)) {
33
+ if (provider.hasType(AbstractAuroraZone)) {
34
+ const zone = provider.inject(AbstractAuroraZone);
35
+ zone?.run(pipe.onInit, this.getContextProxy());
36
+ }
37
+ else {
38
+ try {
39
+ pipe.onInit();
40
+ }
41
+ catch (e) {
42
+ console.error(e);
43
+ }
44
+ }
45
+ }
32
46
  transformFunc = (value, ...args) => pipe.transform(value, ...args);
33
47
  this._ctx[pipeRef.name] = transformFunc;
34
48
  return transformFunc;
@@ -68,7 +82,25 @@ export class AsyncPipeScope extends ReactiveControlScope {
68
82
  }
69
83
  set(propertyKey, pipeClass, receiver) {
70
84
  const detector = createChangeDetectorRef(this, propertyKey);
85
+ const provider = forkProvider();
86
+ provider.setType(ChangeDetectorRef, detector);
87
+ addProvider(provider);
71
88
  const pipe = new pipeClass(detector);
89
+ removeProvider(provider);
90
+ if (isOnInit(pipe)) {
91
+ if (provider.hasType(AbstractAuroraZone)) {
92
+ const zone = provider.inject(AbstractAuroraZone);
93
+ zone?.run(pipe.onInit, this.getContextProxy());
94
+ }
95
+ else {
96
+ try {
97
+ pipe.onInit();
98
+ }
99
+ catch (e) {
100
+ console.error(e);
101
+ }
102
+ }
103
+ }
72
104
  const result = super.set(propertyKey, pipe, receiver);
73
105
  if (result) {
74
106
  this.wrapper[propertyKey] = (value, ...args) => {
package/pipe/pipe.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pipe.js","sourceRoot":"","sources":["../../../src/core/pipe/pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAqB,MAAM,oBAAoB,CAAC;AAE5F,OAAO,EAAqB,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAcjE,MAAM,OAAgB,kBAAkB;IACjB;IAAtB,YAAsB,iBAAoC;QAApC,sBAAiB,GAAjB,iBAAiB,CAAmB;IAAI,CAAC;CAG/D;AAED,MAAM,UAAU,eAAe,CAA+B,IAAS;IACtE,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,OAAO,YAAa,SAAQ,aAA+C;IAChF;QACC,KAAK,CAAC,EAAE,CAAC,CAAC;IACX,CAAC;IACD,GAAG,CAAC,QAAgB;QACnB,IAAI,QAAQ,IAAI,IAAI,CAAC,IA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AAC,SAAS,EAAE,CAAC;IAClB,CAAC;IACD,QAAQ;QACP,OAAO,cAAc,CAAC;IACvB,CAAC;CACD","sourcesContent":["import { ReactiveControlScope, ReadOnlyScope, ScopeSubscription } from '@ibyar/expressions';\nimport { OnDestroy } from '../component/lifecycle.js';\nimport { ChangeDetectorRef, createChangeDetectorRef } from '../linker/change-detector-ref.js';\nimport { classRegistryProvider } from '../providers/provider.js';\nimport { Type } from '../utils/typeof.js';\n\n/**\n * Pipes are used as singleton\n * it will be created if it needed, had no life cycle\n * \n * * no dependency injection applied on filters for now,\n * TODO: add support of dependency injection\n */\nexport interface PipeTransform<T, U> {\n\ttransform(value: T, ...args: any[]): U;\n}\n\nexport abstract class AsyncPipeTransform<T, U> implements PipeTransform<T, U>, OnDestroy {\n\tconstructor(protected changeDetectorRef: ChangeDetectorRef) { }\n\tabstract transform(value: T, ...args: any[]): U;\n\tabstract onDestroy(): void;\n}\n\nexport function isPipeTransform<T extends any, U extends any>(pipe: any): pipe is PipeTransform<T, U> {\n\treturn Reflect.has(Object.getPrototypeOf(pipe), 'transform');\n}\n\nexport class PipeProvider extends ReadOnlyScope<{ [pipeName: string]: Function }> {\n\tconstructor() {\n\t\tsuper({});\n\t}\n\thas(pipeName: string): boolean {\n\t\tif (pipeName in this._ctx) {\n\t\t\treturn true;\n\t\t}\n\t\tconst pipeRef = classRegistryProvider.getPipe<PipeTransform<any, any>>(pipeName);\n\t\treturn pipeRef !== undefined && !pipeRef.asynchronous;\n\t}\n\tget(pipeName: string): any {\n\t\tlet transformFunc: Function | undefined;\n\t\tif (transformFunc = this._ctx[pipeName]) {\n\t\t\treturn transformFunc;\n\t\t}\n\t\tconst pipeRef = classRegistryProvider.getPipe<PipeTransform<any, any>>(pipeName);\n\t\tif (pipeRef !== undefined && !pipeRef.asynchronous) {\n\t\t\tconst pipe = new pipeRef.modelClass();\n\t\t\ttransformFunc = (value: any, ...args: any[]) => pipe.transform(value, ...args);\n\t\t\tthis._ctx[pipeRef.name] = transformFunc;\n\t\t\treturn transformFunc;\n\t\t}\n\t\treturn void 0;\n\t}\n\tgetClass(): Type<PipeProvider> {\n\t\treturn PipeProvider;\n\t}\n}\n\nexport class AsyncPipeProvider extends ReadOnlyScope<object> {\n\tconstructor() {\n\t\tsuper({});\n\t}\n\thas(pipeName: string): boolean {\n\t\tconst pipeRef = classRegistryProvider.getPipe<AsyncPipeTransform<any, any>>(pipeName);\n\t\treturn pipeRef?.asynchronous ? true : false;\n\t}\n\tget(pipeName: string): Type<AsyncPipeTransform<any, any>> | undefined {\n\t\tconst pipeRef = classRegistryProvider.getPipe<AsyncPipeTransform<any, any>>(pipeName);\n\t\tif (pipeRef?.asynchronous) {\n\t\t\treturn pipeRef.modelClass;\n\t\t}\n\t\treturn;\n\t}\n\tgetClass(): Type<AsyncPipeProvider> {\n\t\treturn AsyncPipeProvider;\n\t}\n}\n\nexport class AsyncPipeScope<T extends { [key: string]: AsyncPipeTransform<any, any> }> extends ReactiveControlScope<T> {\n\tstatic blockScope<P extends { [key: string]: AsyncPipeTransform<any, any> }>(): AsyncPipeScope<P> {\n\t\treturn new AsyncPipeScope();\n\t}\n\tprivate wrapper: { [key: string]: Function } = {};\n\tconstructor() {\n\t\tsuper({} as T);\n\t}\n\toverride set(propertyKey: keyof T, pipeClass: Type<AsyncPipeTransform<any, any>>, receiver?: any): boolean {\n\t\tconst detector = createChangeDetectorRef(this, propertyKey);\n\t\tconst pipe = new pipeClass(detector);\n\t\tconst result = super.set(propertyKey, pipe, receiver);\n\t\tif (result) {\n\t\t\tthis.wrapper[propertyKey as string] = (value: any, ...args: any[]) => {\n\t\t\t\treturn pipe.transform(value, ...args)\n\t\t\t};\n\t\t}\n\t\treturn result;\n\t}\n\toverride get(propertyKey: keyof T): any {\n\t\treturn Reflect.get(this.wrapper, propertyKey);\n\t}\n\toverride unsubscribe(propertyKey: keyof T, subscription?: ScopeSubscription<T>) {\n\t\tsuper.unsubscribe(propertyKey, subscription);\n\t\tconst pipe = this._ctx[propertyKey];\n\t\tpipe.onDestroy();\n\t}\n\tgetClass(): Type<AsyncPipeScope<T>> {\n\t\treturn AsyncPipeScope;\n\t}\n}\n"]}
1
+ {"version":3,"file":"pipe.js","sourceRoot":"","sources":["../../../src/core/pipe/pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAqB,MAAM,oBAAoB,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAa,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAerD,MAAM,UAAU,eAAe,CAA+B,IAAS;IACtE,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,OAAO,YAAa,SAAQ,aAA+C;IAChF;QACC,KAAK,CAAC,EAAE,CAAC,CAAC;IACX,CAAC;IACD,GAAG,CAAC,QAAgB;QACnB,IAAI,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC;QACb,CAAC;QACD,MAAM,OAAO,GAAG,qBAAqB,CAAC,OAAO,CAA0B,QAAQ,CAAC,CAAC;QACjF,OAAO,OAAO,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;IACvD,CAAC;IACD,GAAG,CAAC,QAAgB;QACnB,IAAI,aAAmC,CAAC;QACxC,IAAI,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzC,OAAO,aAAa,CAAC;QACtB,CAAC;QACD,MAAM,OAAO,GAAG,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EAAE,IAAI,CAAC,eAAgB,EAAE,CAAC,CAAC;YACjD,CAAC;iBAAM,CAAC;gBACP,IAAI,CAAC;oBACJ,IAAI,CAAC,MAAM,EAAE,CAAC;gBACf,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACZ,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAClB,CAAC;YACF,CAAC;QACF,CAAC;QAED,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QACtD,IAAI,MAAM,EAAE,CAAC;YACZ,IAAI,CAAC,OAAO,CAAC,WAAqB,CAAC,GAAG,CAAC,KAAU,EAAE,GAAG,IAAW,EAAE,EAAE;gBACpE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAA;YACtC,CAAC,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IACQ,GAAG,CAAC,WAAoB;QAChC,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC/C,CAAC;IACQ,WAAW,CAAC,WAAoB,EAAE,YAAmC;QAC7E,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACpC,IAAI,CAAC,SAAS,EAAE,CAAC;IAClB,CAAC;IACD,QAAQ;QACP,OAAO,cAAc,CAAC;IACvB,CAAC;CACD","sourcesContent":["import { ReactiveControlScope, ReadOnlyScope, ScopeSubscription } from '@ibyar/expressions';\nimport { isOnInit, OnDestroy } from '../component/lifecycle.js';\nimport { ChangeDetectorRef, createChangeDetectorRef } from '../linker/change-detector-ref.js';\nimport { classRegistryProvider } from '../providers/provider.js';\nimport { Type } from '../utils/typeof.js';\nimport { addProvider, forkProvider, removeProvider } from '../di/inject.js';\nimport { AbstractAuroraZone } from '../zone/zone.js';\n\n/**\n * Pipes are used as singleton\n * it will be created if it needed, had no life cycle\n */\nexport interface PipeTransform<T, U> {\n\ttransform(value: T, ...args: any[]): U;\n}\n\nexport interface AsyncPipeTransform<T, U> extends PipeTransform<T, U>, OnDestroy {\n\ttransform(value: T, ...args: any[]): U;\n\tonDestroy(): void;\n}\n\nexport function isPipeTransform<T extends any, U extends any>(pipe: any): pipe is PipeTransform<T, U> {\n\treturn Reflect.has(Object.getPrototypeOf(pipe), 'transform');\n}\n\nexport class PipeProvider extends ReadOnlyScope<{ [pipeName: string]: Function }> {\n\tconstructor() {\n\t\tsuper({});\n\t}\n\thas(pipeName: string): boolean {\n\t\tif (pipeName in this._ctx) {\n\t\t\treturn true;\n\t\t}\n\t\tconst pipeRef = classRegistryProvider.getPipe<PipeTransform<any, any>>(pipeName);\n\t\treturn pipeRef !== undefined && !pipeRef.asynchronous;\n\t}\n\tget(pipeName: string): any {\n\t\tlet transformFunc: Function | undefined;\n\t\tif (transformFunc = this._ctx[pipeName]) {\n\t\t\treturn transformFunc;\n\t\t}\n\t\tconst pipeRef = classRegistryProvider.getPipe<PipeTransform<any, any>>(pipeName);\n\t\tif (pipeRef !== undefined && !pipeRef.asynchronous) {\n\t\t\tconst provider = forkProvider();\n\t\t\taddProvider(provider);\n\t\t\tconst pipe = new pipeRef.modelClass();\n\t\t\tremoveProvider(provider);\n\n\t\t\tif (isOnInit(pipe)) {\n\t\t\t\tif (provider.hasType(AbstractAuroraZone)) {\n\t\t\t\t\tconst zone = provider.inject(AbstractAuroraZone);\n\t\t\t\t\tzone?.run(pipe.onInit, this.getContextProxy!());\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tpipe.onInit();\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tconsole.error(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttransformFunc = (value: any, ...args: any[]) => pipe.transform(value, ...args);\n\t\t\tthis._ctx[pipeRef.name] = transformFunc;\n\t\t\treturn transformFunc;\n\t\t}\n\t\treturn void 0;\n\t}\n\tgetClass(): Type<PipeProvider> {\n\t\treturn PipeProvider;\n\t}\n}\n\nexport class AsyncPipeProvider extends ReadOnlyScope<object> {\n\tconstructor() {\n\t\tsuper({});\n\t}\n\thas(pipeName: string): boolean {\n\t\tconst pipeRef = classRegistryProvider.getPipe<AsyncPipeTransform<any, any>>(pipeName);\n\t\treturn pipeRef?.asynchronous ? true : false;\n\t}\n\tget(pipeName: string): Type<AsyncPipeTransform<any, any>> | undefined {\n\t\tconst pipeRef = classRegistryProvider.getPipe<AsyncPipeTransform<any, any>>(pipeName);\n\t\tif (pipeRef?.asynchronous) {\n\t\t\treturn pipeRef.modelClass;\n\t\t}\n\t\treturn;\n\t}\n\tgetClass(): Type<AsyncPipeProvider> {\n\t\treturn AsyncPipeProvider;\n\t}\n}\n\nexport class AsyncPipeScope<T extends { [key: string]: AsyncPipeTransform<any, any> }> extends ReactiveControlScope<T> {\n\tstatic blockScope<P extends { [key: string]: AsyncPipeTransform<any, any> }>(): AsyncPipeScope<P> {\n\t\treturn new AsyncPipeScope();\n\t}\n\tprivate wrapper: { [key: string]: Function } = {};\n\tconstructor() {\n\t\tsuper({} as T);\n\t}\n\toverride set(propertyKey: keyof T, pipeClass: Type<AsyncPipeTransform<any, any>>, receiver?: any): boolean {\n\t\tconst detector = createChangeDetectorRef(this, propertyKey);\n\t\tconst provider = forkProvider();\n\t\tprovider.setType(ChangeDetectorRef, detector);\n\t\taddProvider(provider);\n\t\tconst pipe = new pipeClass(detector);\n\t\tremoveProvider(provider);\n\n\t\tif (isOnInit(pipe)) {\n\t\t\tif (provider.hasType(AbstractAuroraZone)) {\n\t\t\t\tconst zone = provider.inject(AbstractAuroraZone);\n\t\t\t\tzone?.run(pipe.onInit, this.getContextProxy!());\n\t\t\t} else {\n\t\t\t\ttry {\n\t\t\t\t\tpipe.onInit();\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconsole.error(e);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst result = super.set(propertyKey, pipe, receiver);\n\t\tif (result) {\n\t\t\tthis.wrapper[propertyKey as string] = (value: any, ...args: any[]) => {\n\t\t\t\treturn pipe.transform(value, ...args)\n\t\t\t};\n\t\t}\n\t\treturn result;\n\t}\n\toverride get(propertyKey: keyof T): any {\n\t\treturn Reflect.get(this.wrapper, propertyKey);\n\t}\n\toverride unsubscribe(propertyKey: keyof T, subscription?: ScopeSubscription<T>) {\n\t\tsuper.unsubscribe(propertyKey, subscription);\n\t\tconst pipe = this._ctx[propertyKey];\n\t\tpipe.onDestroy();\n\t}\n\tgetClass(): Type<AsyncPipeScope<T>> {\n\t\treturn AsyncPipeScope;\n\t}\n}\n"]}
@@ -5,12 +5,12 @@ export type ProviderType = 'component' | 'service' | 'directive' | 'pipe' | 'sel
5
5
  export declare class ClassRegistry {
6
6
  viewSet: Set<MetadataClass>;
7
7
  componentSet: Set<MetadataClass>;
8
- injectableSet: Set<MetadataClass>;
8
+ serviceSet: Set<MetadataClass>;
9
9
  directiveSet: Set<MetadataClass>;
10
10
  pipeSet: Set<MetadataClass>;
11
11
  registerView(classRef: MetadataClass): void;
12
12
  registerComponent(classRef: MetadataClass): void;
13
- registerInjectable(classRef: MetadataClass): void;
13
+ registerService(classRef: MetadataClass): void;
14
14
  registerDirective(classRef: MetadataClass): void;
15
15
  registerPipe(classRef: MetadataClass): void;
16
16
  hasComponent<T>(selector: string): boolean;
@@ -20,13 +20,13 @@ export declare class ClassRegistry {
20
20
  hasOutput<T>(model: Object, eventName: string): PropertyRef | false;
21
21
  hasInput<T>(model: Object, eventName: string): PropertyRef | false;
22
22
  hasDirective<T>(selector: string): boolean;
23
- hasInjectable<T>(name: string): boolean;
23
+ hasService<T>(name: string): boolean;
24
24
  directiveHasInput<T>(input: string, directiveType?: 'attributes' | 'structural'): boolean;
25
25
  getDirectiveRef<T>(selector: string): DirectiveRef<T> | undefined;
26
26
  getPipe<T>(pipeName: string): PipeRef<T> | undefined;
27
27
  deleteComponent<T>(selector: string): void;
28
28
  deleteDirective<T>(selector: string): void;
29
- deleteInjectable<T>(name: string): void;
29
+ deleteService<T>(name: string): void;
30
30
  deletePipe<T>(name: string): void;
31
31
  }
32
32
  export declare const classRegistryProvider: ClassRegistry;
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/core/providers/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EACX,YAAY,EAAE,YAAY,EAAE,OAAO,EACnC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9E,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnF,qBAAa,aAAa;IACzB,OAAO,EAAE,GAAG,CAAC,aAAa,CAAC,CAAa;IACxC,YAAY,EAAE,GAAG,CAAC,aAAa,CAAC,CAAa;IAC7C,aAAa,EAAE,GAAG,CAAC,aAAa,CAAC,CAAa;IAC9C,YAAY,EAAE,GAAG,CAAC,aAAa,CAAC,CAAa;IAC7C,OAAO,EAAE,GAAG,CAAC,aAAa,CAAC,CAAa;IAExC,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAG3C,iBAAiB,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAGhD,kBAAkB,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAGjD,iBAAiB,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAGhD,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAI3C,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;IAU1C,eAAe,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,YAAY,CAAC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KAAK,EAAE,MAAM,EAAE,aAAa,GAAE,YAAY,GAAG,YAA2B,GAAG,OAAO;IAavG,eAAe,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS;IAWjE,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS;IAUpD,eAAe,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM;IAUnC,eAAe,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAU1C,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM;IAU7B,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM;CAU1B;AAED,eAAO,MAAM,qBAAqB,eAAsB,CAAC"}
@@ -2,7 +2,7 @@ import { ReflectComponents } from '../component/reflect.js';
2
2
  export class ClassRegistry {
3
3
  viewSet = new Set();
4
4
  componentSet = new Set();
5
- injectableSet = new Set();
5
+ serviceSet = new Set();
6
6
  directiveSet = new Set();
7
7
  pipeSet = new Set();
8
8
  registerView(classRef) {
@@ -11,8 +11,8 @@ export class ClassRegistry {
11
11
  registerComponent(classRef) {
12
12
  this.componentSet.add(classRef);
13
13
  }
14
- registerInjectable(classRef) {
15
- this.injectableSet.add(classRef);
14
+ registerService(classRef) {
15
+ this.serviceSet.add(classRef);
16
16
  }
17
17
  registerDirective(classRef) {
18
18
  this.directiveSet.add(classRef);
@@ -85,8 +85,8 @@ export class ClassRegistry {
85
85
  }
86
86
  return false;
87
87
  }
88
- hasInjectable(name) {
89
- for (const modelClass of this.injectableSet) {
88
+ hasService(name) {
89
+ for (const modelClass of this.serviceSet) {
90
90
  const componentRef = ReflectComponents.getMetaDate(modelClass);
91
91
  if (componentRef.name === name) {
92
92
  return true;
@@ -137,16 +137,16 @@ export class ClassRegistry {
137
137
  for (const modelClass of this.directiveSet) {
138
138
  const directiveRef = ReflectComponents.getMetaDate(modelClass);
139
139
  if (directiveRef?.selector === selector) {
140
- this.injectableSet.delete(modelClass);
140
+ this.directiveSet.delete(modelClass);
141
141
  break;
142
142
  }
143
143
  }
144
144
  }
145
- deleteInjectable(name) {
146
- for (const modelClass of this.injectableSet) {
145
+ deleteService(name) {
146
+ for (const modelClass of this.serviceSet) {
147
147
  const componentRef = ReflectComponents.getMetaDate(modelClass);
148
148
  if (componentRef.name === name) {
149
- this.injectableSet.delete(modelClass);
149
+ this.serviceSet.delete(modelClass);
150
150
  break;
151
151
  }
152
152
  }
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/core/providers/provider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAoB,MAAM,yBAAyB,CAAC;AAG9E,MAAM,OAAO,aAAa;IACzB,OAAO,GAAuB,IAAI,GAAG,EAAE,CAAC;IACxC,YAAY,GAAuB,IAAI,GAAG,EAAE,CAAC;IAC7C,aAAa,GAAuB,IAAI,GAAG,EAAE,CAAC;IAC9C,YAAY,GAAuB,IAAI,GAAG,EAAE,CAAC;IAC7C,OAAO,GAAuB,IAAI,GAAG,EAAE,CAAC;IAExC,YAAY,CAAC,QAAuB;QACnC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IACD,iBAAiB,CAAC,QAAuB;QACxC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IACD,kBAAkB,CAAC,QAAuB;QACzC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IACD,iBAAiB,CAAC,QAAuB;QACxC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IACD,YAAY,CAAC,QAAuB;QACnC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAED,YAAY,CA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ED;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,aAAa,EAAE,CAAC","sourcesContent":["import type { MetadataClass } from '@ibyar/decorators';\nimport type {\n\tComponentRef, DirectiveRef, PipeRef, InjectableRef\n} from '../component/component.js';\nimport { ReflectComponents, type PropertyRef } from '../component/reflect.js';\nexport type ProviderType = 'component' | 'service' | 'directive' | 'pipe' | 'self';\n\nexport class ClassRegistry {\n\tviewSet: Set<MetadataClass> = new Set();\n\tcomponentSet: Set<MetadataClass> = new Set();\n\tinjectableSet: Set<MetadataClass> = new Set();\n\tdirectiveSet: Set<MetadataClass> = new Set();\n\tpipeSet: Set<MetadataClass> = new Set();\n\n\tregisterView(classRef: MetadataClass): void {\n\t\tthis.viewSet.add(classRef);\n\t}\n\tregisterComponent(classRef: MetadataClass): void {\n\t\tthis.componentSet.add(classRef);\n\t}\n\tregisterInjectable(classRef: MetadataClass): void {\n\t\tthis.injectableSet.add(classRef);\n\t}\n\tregisterDirective(classRef: MetadataClass): void {\n\t\tthis.directiveSet.add(classRef);\n\t}\n\tregisterPipe(classRef: MetadataClass): void {\n\t\tthis.pipeSet.add(classRef);\n\t}\n\n\thasComponent<T>(selector: string): boolean {\n\t\tfor (const modelClass of this.componentSet) {\n\t\t\tconst componentRef = ReflectComponents.getMetaDate(modelClass) as ComponentRef<T>;\n\t\t\tif (componentRef.selector === selector) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tgetComponentRef<T>(selector: string): ComponentRef<T> | undefined {\n\t\tfor (const modelClass of this.componentSet) {\n\t\t\tconst componentRef = ReflectComponents.getMetaDate(modelClass) as ComponentRef<T>;\n\t\t\tif (componentRef.selector === selector) {\n\t\t\t\treturn componentRef;\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\tgetComponent<T>(selector: string) {\n\t\tfor (const modelClass of this.componentSet) {\n\t\t\tconst componentRef = ReflectComponents.getMetaDate(modelClass) as ComponentRef<T>;\n\t\t\tif (componentRef.selector === selector) {\n\t\t\t\treturn modelClass;\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\tgetComponentView(selector: string) {\n\t\treturn this.getComponentRef(selector)?.viewClass;\n\t}\n\n\thasOutput<T>(model: Object, eventName: string): PropertyRef | false {\n\t\tif (Reflect.has(model, 'bootstrap')) {\n\t\t\tconst componentRef: ComponentRef<T> = Reflect.get(model, 'bootstrap');\n\t\t\tif (componentRef.outputs) {\n\t\t\t\tfor (const out of componentRef.outputs) {\n\t\t\t\t\tif (out.viewAttribute === eventName) {\n\t\t\t\t\t\treturn out;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\thasInput<T>(model: Object, eventName: string): PropertyRef | false {\n\t\tif (Reflect.has(model, 'bootstrap')) {\n\t\t\tconst componentRef: ComponentRef<T> = Reflect.get(model, 'bootstrap');\n\t\t\tif (componentRef.inputs) {\n\t\t\t\tfor (const input of componentRef.inputs) {\n\t\t\t\t\tif (input.viewAttribute === eventName) {\n\t\t\t\t\t\treturn input;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\thasDirective<T>(selector: string): boolean {\n\t\tfor (const directiveClass of this.directiveSet) {\n\t\t\tconst directiveRef = ReflectComponents.getMetaDate(directiveClass) as DirectiveRef<T>;\n\t\t\tif (directiveRef.selector === selector) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\thasInjectable<T>(name: string): boolean {\n\t\tfor (const modelClass of this.injectableSet) {\n\t\t\tconst componentRef = ReflectComponents.getMetaDate(modelClass) as InjectableRef<T>;\n\t\t\tif (componentRef.name === name) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tdirectiveHasInput<T>(input: string, directiveType: 'attributes' | 'structural' = 'attributes'): boolean {\n\t\tfor (const directiveClass of this.directiveSet) {\n\t\t\tconst directiveRef = ReflectComponents.getMetaDate(directiveClass) as DirectiveRef<T>;\n\t\t\tif ((directiveType === 'attributes' && !directiveRef.selector.startsWith('*'))\n\t\t\t\t|| (directiveType === 'structural' && directiveRef.selector.startsWith('*'))) {\n\t\t\t\tif (directiveRef.inputs?.filter(ref => ref.viewAttribute === input).length > 0) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tgetDirectiveRef<T>(selector: string): DirectiveRef<T> | undefined {\n\t\tfor (const directiveClass of this.directiveSet) {\n\t\t\tconst directiveRef = ReflectComponents.getMetaDate(directiveClass) as DirectiveRef<T>;\n\t\t\tif (directiveRef?.selector === selector) {\n\t\t\t\treturn directiveRef;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\n\tgetPipe<T>(pipeName: string): PipeRef<T> | undefined {\n\t\tfor (const pipeClass of this.pipeSet) {\n\t\t\tconst pipeRef = ReflectComponents.getMetaDate(pipeClass) as PipeRef<T>;\n\t\t\tif (pipeRef.name === pipeName) {\n\t\t\t\treturn pipeRef;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tdeleteComponent<T>(selector: string) {\n\t\tfor (const modelClass of this.componentSet) {\n\t\t\tconst componentRef = ReflectComponents.getMetaDate(modelClass) as ComponentRef<T>;\n\t\t\tif (componentRef?.selector === selector) {\n\t\t\t\tthis.componentSet.delete(modelClass);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tdeleteDirective<T>(selector: string): void {\n\t\tfor (const modelClass of this.directiveSet) {\n\t\t\tconst directiveRef = ReflectComponents.getMetaDate(modelClass) as DirectiveRef<T>;\n\t\t\tif (directiveRef?.selector === selector) {\n\t\t\t\tthis.injectableSet.delete(modelClass);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tdeleteInjectable<T>(name: string) {\n\t\tfor (const modelClass of this.injectableSet) {\n\t\t\tconst componentRef = ReflectComponents.getMetaDate(modelClass) as InjectableRef<T>;\n\t\t\tif (componentRef.name === name) {\n\t\t\t\tthis.injectableSet.delete(modelClass);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tdeletePipe<T>(name: string) {\n\t\tfor (const modelClass of this.pipeSet) {\n\t\t\tconst pipeRef = ReflectComponents.getMetaDate(modelClass) as PipeRef<T>;\n\t\t\tif (pipeRef.name === name) {\n\t\t\t\tthis.pipeSet.delete(modelClass);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n}\n\nexport const classRegistryProvider = new ClassRegistry();\n"]}
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/core/providers/provider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAoB,MAAM,yBAAyB,CAAC;AAG9E,MAAM,OAAO,aAAa;IACzB,OAAO,GAAuB,IAAI,GAAG,EAAE,CAAC;IACxC,YAAY,GAAuB,IAAI,GAAG,EAAE,CAAC;IAC7C,UAAU,GAAuB,IAAI,GAAG,EAAE,CAAC;IAC3C,YAAY,GAAuB,IAAI,GAAG,EAAE,CAAC;IAC7C,OAAO,GAAuB,IAAI,GAAG,EAAE,CAAC;IAExC,YAAY,CAAC,QAAuB;QACnC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IACD,iBAAiB,CAAC,QAAuB;QACxC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IACD,eAAe,CAAC,QAAuB;QACtC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;IACD,iBAAiB,CAAC,QAAuB;QACxC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IACD,YAAY,CAAC,QAAuB;QACnC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CA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C;QACF,CAAC;IACF,CAAC;CAED;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,aAAa,EAAE,CAAC","sourcesContent":["import type { MetadataClass } from '@ibyar/decorators';\nimport type {\n\tComponentRef, DirectiveRef, PipeRef, InjectableRef\n} from '../component/component.js';\nimport { ReflectComponents, type PropertyRef } from '../component/reflect.js';\nexport type ProviderType = 'component' | 'service' | 'directive' | 'pipe' | 'self';\n\nexport class ClassRegistry {\n\tviewSet: Set<MetadataClass> = new Set();\n\tcomponentSet: Set<MetadataClass> = new Set();\n\tserviceSet: Set<MetadataClass> = new Set();\n\tdirectiveSet: Set<MetadataClass> = new Set();\n\tpipeSet: Set<MetadataClass> = new Set();\n\n\tregisterView(classRef: MetadataClass): void {\n\t\tthis.viewSet.add(classRef);\n\t}\n\tregisterComponent(classRef: MetadataClass): void {\n\t\tthis.componentSet.add(classRef);\n\t}\n\tregisterService(classRef: MetadataClass): void {\n\t\tthis.serviceSet.add(classRef);\n\t}\n\tregisterDirective(classRef: MetadataClass): void {\n\t\tthis.directiveSet.add(classRef);\n\t}\n\tregisterPipe(classRef: MetadataClass): void {\n\t\tthis.pipeSet.add(classRef);\n\t}\n\n\thasComponent<T>(selector: string): boolean {\n\t\tfor (const modelClass of this.componentSet) {\n\t\t\tconst componentRef = ReflectComponents.getMetaDate(modelClass) as ComponentRef<T>;\n\t\t\tif (componentRef.selector === selector) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tgetComponentRef<T>(selector: string): ComponentRef<T> | undefined {\n\t\tfor (const modelClass of this.componentSet) {\n\t\t\tconst componentRef = ReflectComponents.getMetaDate(modelClass) as ComponentRef<T>;\n\t\t\tif (componentRef.selector === selector) {\n\t\t\t\treturn componentRef;\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\tgetComponent<T>(selector: string) {\n\t\tfor (const modelClass of this.componentSet) {\n\t\t\tconst componentRef = ReflectComponents.getMetaDate(modelClass) as ComponentRef<T>;\n\t\t\tif (componentRef.selector === selector) {\n\t\t\t\treturn modelClass;\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}\n\n\tgetComponentView(selector: string) {\n\t\treturn this.getComponentRef(selector)?.viewClass;\n\t}\n\n\thasOutput<T>(model: Object, eventName: string): PropertyRef | false {\n\t\tif (Reflect.has(model, 'bootstrap')) {\n\t\t\tconst componentRef: ComponentRef<T> = Reflect.get(model, 'bootstrap');\n\t\t\tif (componentRef.outputs) {\n\t\t\t\tfor (const out of componentRef.outputs) {\n\t\t\t\t\tif (out.viewAttribute === eventName) {\n\t\t\t\t\t\treturn out;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\thasInput<T>(model: Object, eventName: string): PropertyRef | false {\n\t\tif (Reflect.has(model, 'bootstrap')) {\n\t\t\tconst componentRef: ComponentRef<T> = Reflect.get(model, 'bootstrap');\n\t\t\tif (componentRef.inputs) {\n\t\t\t\tfor (const input of componentRef.inputs) {\n\t\t\t\t\tif (input.viewAttribute === eventName) {\n\t\t\t\t\t\treturn input;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\thasDirective<T>(selector: string): boolean {\n\t\tfor (const directiveClass of this.directiveSet) {\n\t\t\tconst directiveRef = ReflectComponents.getMetaDate(directiveClass) as DirectiveRef<T>;\n\t\t\tif (directiveRef.selector === selector) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\thasService<T>(name: string): boolean {\n\t\tfor (const modelClass of this.serviceSet) {\n\t\t\tconst componentRef = ReflectComponents.getMetaDate(modelClass) as InjectableRef<T>;\n\t\t\tif (componentRef.name === name) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tdirectiveHasInput<T>(input: string, directiveType: 'attributes' | 'structural' = 'attributes'): boolean {\n\t\tfor (const directiveClass of this.directiveSet) {\n\t\t\tconst directiveRef = ReflectComponents.getMetaDate(directiveClass) as DirectiveRef<T>;\n\t\t\tif ((directiveType === 'attributes' && !directiveRef.selector.startsWith('*'))\n\t\t\t\t|| (directiveType === 'structural' && directiveRef.selector.startsWith('*'))) {\n\t\t\t\tif (directiveRef.inputs?.filter(ref => ref.viewAttribute === input).length > 0) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tgetDirectiveRef<T>(selector: string): DirectiveRef<T> | undefined {\n\t\tfor (const directiveClass of this.directiveSet) {\n\t\t\tconst directiveRef = ReflectComponents.getMetaDate(directiveClass) as DirectiveRef<T>;\n\t\t\tif (directiveRef?.selector === selector) {\n\t\t\t\treturn directiveRef;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\n\tgetPipe<T>(pipeName: string): PipeRef<T> | undefined {\n\t\tfor (const pipeClass of this.pipeSet) {\n\t\t\tconst pipeRef = ReflectComponents.getMetaDate(pipeClass) as PipeRef<T>;\n\t\t\tif (pipeRef.name === pipeName) {\n\t\t\t\treturn pipeRef;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tdeleteComponent<T>(selector: string) {\n\t\tfor (const modelClass of this.componentSet) {\n\t\t\tconst componentRef = ReflectComponents.getMetaDate(modelClass) as ComponentRef<T>;\n\t\t\tif (componentRef?.selector === selector) {\n\t\t\t\tthis.componentSet.delete(modelClass);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tdeleteDirective<T>(selector: string): void {\n\t\tfor (const modelClass of this.directiveSet) {\n\t\t\tconst directiveRef = ReflectComponents.getMetaDate(modelClass) as DirectiveRef<T>;\n\t\t\tif (directiveRef?.selector === selector) {\n\t\t\t\tthis.directiveSet.delete(modelClass);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tdeleteService<T>(name: string) {\n\t\tfor (const modelClass of this.serviceSet) {\n\t\t\tconst componentRef = ReflectComponents.getMetaDate(modelClass) as InjectableRef<T>;\n\t\t\tif (componentRef.name === name) {\n\t\t\t\tthis.serviceSet.delete(modelClass);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tdeletePipe<T>(name: string) {\n\t\tfor (const modelClass of this.pipeSet) {\n\t\t\tconst pipeRef = ReflectComponents.getMetaDate(modelClass) as PipeRef<T>;\n\t\t\tif (pipeRef.name === name) {\n\t\t\t\tthis.pipeSet.delete(modelClass);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n}\n\nexport const classRegistryProvider = new ClassRegistry();\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"base-view.d.ts","sourceRoot":"","sources":["../../../src/core/view/base-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAU/C,OAAO,EAAgC,aAAa,EAAa,MAAM,gCAAgC,CAAC;AAaxG,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,eAAe,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAwT5G"}
1
+ {"version":3,"file":"base-view.d.ts","sourceRoot":"","sources":["../../../src/core/view/base-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAW/C,OAAO,EAAgC,aAAa,EAAa,MAAM,gCAAgC,CAAC;AAcxG,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,eAAe,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAkU5G"}
package/view/base-view.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ReactiveScope, ReactiveControlScope, isReactive } from '@ibyar/expressions';
2
- import { isAfterContentChecked, isAfterContentInit, isAfterViewChecked, isAfterViewInit, isDoCheck, isOnChanges, isOnDestroy, isOnInit } from '../component/lifecycle.js';
2
+ import { isAfterContentChecked, isAfterContentInit, isAfterViewChecked, isAfterViewInit, isDoCheck, isOnChanges, isOnDestroy, isOnInit, isOnViewMove, isOnViewAdopted } from '../component/lifecycle.js';
3
3
  import { EventEmitter } from '../component/events.js';
4
4
  import { ComponentRender } from './render.js';
5
5
  import { getRootZone } from '../zone/bootstrap.js';
@@ -7,14 +7,14 @@ import { AbstractAuroraZone, ProxyAuroraZone } from '../zone/zone.js';
7
7
  import { ChangeDetectorRef, createModelChangeDetectorRef } from '../linker/change-detector-ref.js';
8
8
  import { createProxyZone } from '../zone/proxy.js';
9
9
  import { clearSignalScope, pushNewSignalScope } from '../signals/signals.js';
10
- import { forkProvider, addProvider, removeProvider } from '../di/inject.js';
10
+ import { forkProvider, addProvider, removeProvider, inject } from '../di/inject.js';
11
11
  import { isOutputSignal, VIEW_TOKEN } from '../component/initializer.js';
12
+ import { ShadowRootService } from './shadow-root.js';
12
13
  export function baseFactoryView(htmlElementType) {
13
14
  return class CustomView extends htmlElementType {
14
15
  _model;
15
16
  _signalScope;
16
17
  _render;
17
- _shadowRoot;
18
18
  _componentRef;
19
19
  _modelScope;
20
20
  _viewScope;
@@ -28,7 +28,8 @@ export function baseFactoryView(htmlElementType) {
28
28
  super();
29
29
  this._componentRef = componentRef;
30
30
  if (componentRef.isShadowDom && !componentRef.disabledFeatures?.includes('shadow')) {
31
- this._shadowRoot = this.attachShadow(componentRef.shadowRootInit);
31
+ const shadowRoot = this.attachShadow(componentRef.shadowRootInit);
32
+ inject(ShadowRootService).set(this, shadowRoot);
32
33
  }
33
34
  this._signalScope = pushNewSignalScope();
34
35
  this._provider = forkProvider();
@@ -193,9 +194,9 @@ export function baseFactoryView(htmlElementType) {
193
194
  // do once
194
195
  if (this.needRendering) {
195
196
  this.initView();
196
- }
197
- if (isAfterViewInit(this._model)) {
198
- this._zone.run(this._model.afterViewInit, this._modelScope.getContextProxy());
197
+ if (isAfterViewInit(this._model)) {
198
+ this._zone.run(this._model.afterViewInit, this._modelScope.getContextProxy());
199
+ }
199
200
  }
200
201
  if (isAfterViewChecked(this._model)) {
201
202
  this._zone.run(this._model.afterViewChecked, this._modelScope.getContextProxy());
@@ -263,10 +264,18 @@ export function baseFactoryView(htmlElementType) {
263
264
  this.onDestroyCalls.push(callback);
264
265
  }
265
266
  adoptedCallback() {
266
- // restart the process
267
- this.innerHTML = '';
267
+ (inject(ShadowRootService).get(this) ?? this).innerHTML = '';
268
+ this.needRendering = true;
269
+ if (isOnViewAdopted(this._model)) {
270
+ this._zone.run(this._model.onViewAdopted, this._modelScope.getContextProxy());
271
+ }
268
272
  this.connectedCallback();
269
273
  }
274
+ connectedMoveCallback() {
275
+ if (isOnViewMove(this._model)) {
276
+ this._zone.run(this._model.onViewMove, this._modelScope.getContextProxy());
277
+ }
278
+ }
270
279
  disconnectedCallback() {
271
280
  // notify first, then call model.onDestroy func
272
281
  if (isOnDestroy(this._model)) {
@@ -285,6 +294,8 @@ export function baseFactoryView(htmlElementType) {
285
294
  this.onDestroyCalls.splice(0, this.onDestroyCalls.length);
286
295
  const event = new CustomEvent('disconnected', { cancelable: true, bubbles: false, composed: false });
287
296
  this.dispatchEvent(event);
297
+ (inject(ShadowRootService).get(this) ?? this).innerHTML = '';
298
+ this.needRendering = true;
288
299
  }
289
300
  };
290
301
  }
@@ -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,EACH,UAAU,EAC1C,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;AAGnC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAA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AC,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;KAED,CAAC;AAEH,CAAC","sourcesContent":["import type { Type } from '../utils/typeof.js';\nimport {\n\tReactiveScope, ReactiveControlScope, Context,\n\tScopeSubscription, SignalScope, isReactive\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 { AbstractAuroraZone, AuroraZone, ProxyAuroraZone } from '../zone/zone.js';\nimport { ChangeDetectorRef, createModelChangeDetectorRef } from '../linker/change-detector-ref.js';\nimport { createProxyZone } from '../zone/proxy.js';\nimport { PropertyRef } from '../component/reflect.js';\nimport { clearSignalScope, pushNewSignalScope } from '../signals/signals.js';\nimport { forkProvider, addProvider, removeProvider } from '../di/inject.js';\nimport { isOutputSignal, VIEW_TOKEN } from '../component/initializer.js';\nimport { InjectionProvider } from '../di/provider.js';\n\nexport function baseFactoryView<T extends object>(htmlElementType: Type<HTMLElement>): Type<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: ReactiveControlScope<T>;\n\t\t_viewScope: ReactiveScope<{ 'this': BaseComponent<T> }>;\n\t\t_zone: AuroraZone;\n\t\t_provider: InjectionProvider;\n\t\t_detector: ChangeDetectorRef;\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: Type<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 = pushNewSignalScope();\n\t\t\tthis._provider = forkProvider();\n\n\n\t\t\t/* resolve dependency injection*/\n\t\t\tthis._detector = createModelChangeDetectorRef(() => this._modelScope);\n\t\t\tthis._zone = getRootZone().fork(componentRef.zone);\n\n\t\t\tthis._provider.setType(AbstractAuroraZone, this._zone);\n\t\t\tthis._provider.setType(ChangeDetectorRef, this._detector);\n\t\t\tthis._provider.setToken(VIEW_TOKEN, this);\n\t\t\taddProvider(this._provider);\n\t\t\tconst model = new modelClass();\n\t\t\tremoveProvider(this._provider);\n\t\t\tthis._model = model;\n\n\t\t\tclearSignalScope(this._signalScope);\n\t\t\tconst modelScope = ReactiveControlScope.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 node = this._model[key];\n\t\t\t\tif (isReactive(node)) {\n\t\t\t\t\tnode.subscribe((value, old) => this._modelScope.emit(key as any, value, old));\n\t\t\t\t}\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._render.modelStack.set(input.modelProperty, 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\tconst event = model[output.modelProperty as keyof T];\n\t\t\t\tif (event instanceof EventEmitter || isOutputSignal(event)) {\n\t\t\t\t\tconst options = isOutputSignal(event) ? event.options : output.options;\n\t\t\t\t\tevent.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: options?.bubbles,\n\t\t\t\t\t\t\t\tcomposed: 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\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\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\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._render.modelStack.get(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._render.modelStack.set(inputRef.modelProperty, value);\n\t\t\t}\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\t\tprivate initOuterAttribute(attr: Attr) {\n\t\t\t// [window, this] scope\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} else if ((elementAttr.startsWith('(') && elementAttr.endsWith(')')) || elementAttr.startsWith('@') || elementAttr.startsWith('on')) {\n\t\t\t\t// (elementAttr)=\"modelProperty()\"\n\t\t\t\t// @elementAttr=\"modelProperty()\"\n\t\t\t\t// onElementAttr=\"modelProperty()\"\n\t\t\t\t// lower-case-event-name = \"modelProperty()\"\n\n\t\t\t\tlet start = 0, end: number | undefined = undefined;\n\t\t\t\tif (elementAttr.startsWith('(') || elementAttr.startsWith('@')) {\n\t\t\t\t\tstart = 1;\n\t\t\t\t} else if (elementAttr.startsWith('on')) {\n\t\t\t\t\tstart = 2;\n\t\t\t\t}\n\t\t\t\tif (elementAttr.endsWith(')')) {\n\t\t\t\t\tend = elementAttr.length - 1;\n\t\t\t\t}\n\t\t\t\tconst eventName = elementAttr.substring(start, end)?.replaceAll('-', '').toLowerCase();\n\t\t\t\tif (modelProperty.endsWith('()')) {\n\t\t\t\t\tmodelProperty = modelProperty.substring(0, modelProperty.length - 2);\n\t\t\t\t}\n\t\t\t\tconst callback: Function = Reflect.get(window, modelProperty);\n\t\t\t\tconst customEvent = this._componentRef.outputs.find(output => output.viewAttribute.toLowerCase() === eventName);\n\t\t\t\tif (customEvent) {\n\t\t\t\t\tthis._modelScope.subscribe(customEvent.modelProperty as keyof T, (data: any) => (callback as Function)?.(data));\n\t\t\t\t} else {\n\t\t\t\t\tthis.addEventListener(elementAttr, event => callback?.(event));\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tconst inputRef = this.getInput(attr.name);\n\t\t\t\tif (inputRef) {\n\t\t\t\t\tthis._render.modelStack.set(inputRef.modelProperty, attr.value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tonDestroy(callback: () => void) {\n\t\t\tthis.onDestroyCalls.push(callback);\n\t\t}\n\n\t\tadoptedCallback() {\n\t\t\t// restart the process\n\t\t\tthis.innerHTML = '';\n\t\t\tthis.connectedCallback();\n\t\t}\n\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};\n\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,EACH,UAAU,EAC1C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAC7D,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAC9D,YAAY,EAAE,eAAe,EAC7B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAc,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AACnG,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpF,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,CAAC;YAC5E,CAAC;YACD,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;YACrD,IAAI,CAAC,aAAa,CAAC,MAAM,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;YAC1B,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC;YAC7D,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC3B,CAAC;KAED,CAAC;AAEH,CAAC","sourcesContent":["import type { Type } from '../utils/typeof.js';\nimport {\n\tReactiveScope, ReactiveControlScope, Context,\n\tScopeSubscription, SignalScope, isReactive\n} from '@ibyar/expressions';\nimport {\n\tisAfterContentChecked, isAfterContentInit, isAfterViewChecked,\n\tisAfterViewInit, isDoCheck, isOnChanges, isOnDestroy, isOnInit,\n\tisOnViewMove, isOnViewAdopted\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 { AbstractAuroraZone, AuroraZone, ProxyAuroraZone } from '../zone/zone.js';\nimport { ChangeDetectorRef, createModelChangeDetectorRef } from '../linker/change-detector-ref.js';\nimport { createProxyZone } from '../zone/proxy.js';\nimport { PropertyRef } from '../component/reflect.js';\nimport { clearSignalScope, pushNewSignalScope } from '../signals/signals.js';\nimport { forkProvider, addProvider, removeProvider, inject } from '../di/inject.js';\nimport { isOutputSignal, VIEW_TOKEN } from '../component/initializer.js';\nimport { InjectionProvider } from '../di/provider.js';\nimport { ShadowRootService } from './shadow-root.js';\n\nexport function baseFactoryView<T extends object>(htmlElementType: Type<HTMLElement>): Type<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\n\t\t_componentRef: ComponentRef<T>;\n\n\t\t_modelScope: ReactiveControlScope<T>;\n\t\t_viewScope: ReactiveScope<{ 'this': BaseComponent<T> }>;\n\t\t_zone: AuroraZone;\n\t\t_provider: InjectionProvider;\n\t\t_detector: ChangeDetectorRef;\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: Type<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\tconst shadowRoot = this.attachShadow(componentRef.shadowRootInit);\n\t\t\t\tinject(ShadowRootService).set(this, shadowRoot);\n\t\t\t}\n\n\t\t\tthis._signalScope = pushNewSignalScope();\n\t\t\tthis._provider = forkProvider();\n\n\n\t\t\t/* resolve dependency injection*/\n\t\t\tthis._detector = createModelChangeDetectorRef(() => this._modelScope);\n\t\t\tthis._zone = getRootZone().fork(componentRef.zone);\n\n\t\t\tthis._provider.setType(AbstractAuroraZone, this._zone);\n\t\t\tthis._provider.setType(ChangeDetectorRef, this._detector);\n\t\t\tthis._provider.setToken(VIEW_TOKEN, this);\n\t\t\taddProvider(this._provider);\n\t\t\tconst model = new modelClass();\n\t\t\tremoveProvider(this._provider);\n\t\t\tthis._model = model;\n\n\t\t\tclearSignalScope(this._signalScope);\n\t\t\tconst modelScope = ReactiveControlScope.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 node = this._model[key];\n\t\t\t\tif (isReactive(node)) {\n\t\t\t\t\tnode.subscribe((value, old) => this._modelScope.emit(key as any, value, old));\n\t\t\t\t}\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._render.modelStack.set(input.modelProperty, 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\tconst event = model[output.modelProperty as keyof T];\n\t\t\t\tif (event instanceof EventEmitter || isOutputSignal(event)) {\n\t\t\t\t\tconst options = isOutputSignal(event) ? event.options : output.options;\n\t\t\t\t\tevent.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: options?.bubbles,\n\t\t\t\t\t\t\t\tcomposed: 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\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\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\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._render.modelStack.get(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._render.modelStack.set(inputRef.modelProperty, value);\n\t\t\t}\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\tif (isAfterViewInit(this._model)) {\n\t\t\t\t\tthis._zone.run(this._model.afterViewInit, this._modelScope.getContextProxy!());\n\t\t\t\t}\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\t\tprivate initOuterAttribute(attr: Attr) {\n\t\t\t// [window, this] scope\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} else if ((elementAttr.startsWith('(') && elementAttr.endsWith(')')) || elementAttr.startsWith('@') || elementAttr.startsWith('on')) {\n\t\t\t\t// (elementAttr)=\"modelProperty()\"\n\t\t\t\t// @elementAttr=\"modelProperty()\"\n\t\t\t\t// onElementAttr=\"modelProperty()\"\n\t\t\t\t// lower-case-event-name = \"modelProperty()\"\n\n\t\t\t\tlet start = 0, end: number | undefined = undefined;\n\t\t\t\tif (elementAttr.startsWith('(') || elementAttr.startsWith('@')) {\n\t\t\t\t\tstart = 1;\n\t\t\t\t} else if (elementAttr.startsWith('on')) {\n\t\t\t\t\tstart = 2;\n\t\t\t\t}\n\t\t\t\tif (elementAttr.endsWith(')')) {\n\t\t\t\t\tend = elementAttr.length - 1;\n\t\t\t\t}\n\t\t\t\tconst eventName = elementAttr.substring(start, end)?.replaceAll('-', '').toLowerCase();\n\t\t\t\tif (modelProperty.endsWith('()')) {\n\t\t\t\t\tmodelProperty = modelProperty.substring(0, modelProperty.length - 2);\n\t\t\t\t}\n\t\t\t\tconst callback: Function = Reflect.get(window, modelProperty);\n\t\t\t\tconst customEvent = this._componentRef.outputs.find(output => output.viewAttribute.toLowerCase() === eventName);\n\t\t\t\tif (customEvent) {\n\t\t\t\t\tthis._modelScope.subscribe(customEvent.modelProperty as keyof T, (data: any) => (callback as Function)?.(data));\n\t\t\t\t} else {\n\t\t\t\t\tthis.addEventListener(elementAttr, event => callback?.(event));\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tconst inputRef = this.getInput(attr.name);\n\t\t\t\tif (inputRef) {\n\t\t\t\t\tthis._render.modelStack.set(inputRef.modelProperty, attr.value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tonDestroy(callback: () => void) {\n\t\t\tthis.onDestroyCalls.push(callback);\n\t\t}\n\n\t\tadoptedCallback() {\n\t\t\t(inject(ShadowRootService).get(this) ?? this).innerHTML = '';\n\t\t\tthis.needRendering = true;\n\t\t\tif (isOnViewAdopted(this._model)) {\n\t\t\t\tthis._zone.run(this._model.onViewAdopted, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t\tthis.connectedCallback();\n\t\t}\n\n\t\tconnectedMoveCallback() {\n\t\t\tif (isOnViewMove(this._model)) {\n\t\t\t\tthis._zone.run(this._model.onViewMove, this._modelScope.getContextProxy!());\n\t\t\t}\n\t\t}\n\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\t(inject(ShadowRootService).get(this) ?? this).innerHTML = '';\n\t\t\tthis.needRendering = true;\n\t\t}\n\n\t};\n\n}\n"]}
package/view/form-view.js CHANGED
@@ -58,7 +58,7 @@ export function baseFormFactoryView(htmlElementType) {
58
58
  let valueControl;
59
59
  if (typeof componentRef.formAssociated === 'function') {
60
60
  if (this._model instanceof componentRef.formAssociated) {
61
- valueControl == this._model;
61
+ valueControl = this._model;
62
62
  }
63
63
  else {
64
64
  const args = [this]; /* resolve dependency injection*/
@@ -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,CAAC,EAAE,GAAG,KAAgC,CAAC;IAC5C,CAAC;IAED,IAAI,IAAI;QACP,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;IACrB,CAAC;IACD,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,EAAE,CAAC,MAAO,CAAC;IACxB,CAAC;IAED,IAAI,UAAU;QACb,OAAO,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,IAAI,YAAY;QACf,OAAO,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,YAAY,CAAC,KAAiB,EAAE,KAAuC;QACtE,IAAI,CAAC,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;CAED;AAED,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;IACtC,MAAM,CAAC,cAAc,CAAC,sBAAsB,CAAC,SAAS,EAAE,QAAQ,EAAE;QACjE,UAAU,EAAE,IAAI;QAChB,YAAY,EAAE,IAAI;QAClB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KAAU,EAAE,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC;QACxF,CAAC;QACO,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 { Type } 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: Type<HTMLElement>): Type<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: Type<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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,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 { Type } 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: Type<HTMLElement>): Type<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: Type<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
@@ -31,7 +31,6 @@ export declare class ComponentRender<T extends object> {
31
31
  is?: string;
32
32
  }): HTMLElement;
33
33
  createElement(node: DomElementNode, contextStack: Stack, subscriptions: ScopeSubscription<Context>[], host: HTMLComponent<any> | StructuralDirective): HTMLElement;
34
- private createReadOnlyWithReactiveInnerScope;
35
34
  /**
36
35
  * use for init host bindings
37
36
  * @param element