@ibyar/core 0.8.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/annotation/decorators.d.ts +20 -285
  2. package/annotation/decorators.d.ts.map +1 -0
  3. package/annotation/decorators.js +92 -84
  4. package/annotation/decorators.js.map +1 -1
  5. package/annotation/options.d.ts +276 -0
  6. package/annotation/options.d.ts.map +1 -0
  7. package/annotation/options.js +2 -0
  8. package/annotation/options.js.map +1 -0
  9. package/binding/binding.expressions.d.ts +2 -1
  10. package/binding/binding.expressions.d.ts.map +1 -0
  11. package/binding/binding.expressions.js +149 -124
  12. package/binding/binding.expressions.js.map +1 -1
  13. package/component/component.d.ts +13 -11
  14. package/component/component.d.ts.map +1 -0
  15. package/component/component.js +39 -45
  16. package/component/component.js.map +1 -1
  17. package/component/custom-element.d.ts +1 -3
  18. package/component/custom-element.d.ts.map +1 -0
  19. package/component/custom-element.js.map +1 -1
  20. package/component/events.d.ts +1 -0
  21. package/component/events.d.ts.map +1 -0
  22. package/component/events.js +4 -3
  23. package/component/events.js.map +1 -1
  24. package/component/lifecycle.d.ts +1 -0
  25. package/component/lifecycle.d.ts.map +1 -0
  26. package/component/reflect.d.ts +12 -15
  27. package/component/reflect.d.ts.map +1 -0
  28. package/component/reflect.js +28 -47
  29. package/component/reflect.js.map +1 -1
  30. package/context/stack.d.ts +1 -0
  31. package/context/stack.d.ts.map +1 -0
  32. package/context/subscription.d.ts +1 -0
  33. package/context/subscription.d.ts.map +1 -0
  34. package/directive/directive.d.ts +1 -0
  35. package/directive/directive.d.ts.map +1 -0
  36. package/directive/directive.js +8 -0
  37. package/directive/directive.js.map +1 -1
  38. package/directive/parser.d.ts +1 -0
  39. package/directive/parser.d.ts.map +1 -0
  40. package/directive/parser.js +9 -7
  41. package/directive/parser.js.map +1 -1
  42. package/directive/providers.d.ts +1 -0
  43. package/directive/providers.d.ts.map +1 -0
  44. package/directive/providers.js +2 -1
  45. package/directive/providers.js.map +1 -1
  46. package/html/deserialize.d.ts +1 -0
  47. package/html/deserialize.d.ts.map +1 -0
  48. package/html/expression.d.ts +1 -0
  49. package/html/expression.d.ts.map +1 -0
  50. package/html/expression.js +2 -2
  51. package/html/expression.js.map +1 -1
  52. package/html/types.d.ts +1 -0
  53. package/html/types.d.ts.map +1 -0
  54. package/index.d.ts +2 -2
  55. package/index.d.ts.map +1 -0
  56. package/index.js +1 -2
  57. package/index.js.map +1 -1
  58. package/linker/change-detector-ref.d.ts +1 -0
  59. package/linker/change-detector-ref.d.ts.map +1 -0
  60. package/linker/template-ref.d.ts +1 -0
  61. package/linker/template-ref.d.ts.map +1 -0
  62. package/linker/template-ref.js +5 -0
  63. package/linker/template-ref.js.map +1 -1
  64. package/linker/view-container-ref.d.ts +4 -2
  65. package/linker/view-container-ref.d.ts.map +1 -0
  66. package/linker/view-container-ref.js +9 -7
  67. package/linker/view-container-ref.js.map +1 -1
  68. package/linker/view-ref.d.ts +1 -0
  69. package/linker/view-ref.d.ts.map +1 -0
  70. package/linker/view-ref.js +5 -2
  71. package/linker/view-ref.js.map +1 -1
  72. package/node.d.ts +1 -0
  73. package/node.d.ts.map +1 -0
  74. package/package.json +8 -9
  75. package/pipe/pipe.d.ts +1 -0
  76. package/pipe/pipe.d.ts.map +1 -0
  77. package/pipe/pipe.js +2 -1
  78. package/pipe/pipe.js.map +1 -1
  79. package/providers/provider.d.ts +15 -13
  80. package/providers/provider.d.ts.map +1 -0
  81. package/providers/provider.js +13 -15
  82. package/providers/provider.js.map +1 -1
  83. package/scope/variables.d.ts +19 -0
  84. package/scope/variables.d.ts.map +1 -0
  85. package/scope/variables.js +38 -0
  86. package/scope/variables.js.map +1 -0
  87. package/utils/elements-util.d.ts +1 -0
  88. package/utils/elements-util.d.ts.map +1 -0
  89. package/utils/path.d.ts +1 -0
  90. package/utils/path.d.ts.map +1 -0
  91. package/utils/typeof.d.ts +3 -0
  92. package/utils/typeof.d.ts.map +1 -0
  93. package/utils/typeof.js.map +1 -1
  94. package/utils/utils.d.ts +1 -0
  95. package/utils/utils.d.ts.map +1 -0
  96. package/view/base-view.d.ts +1 -0
  97. package/view/base-view.d.ts.map +1 -0
  98. package/view/base-view.js +33 -29
  99. package/view/base-view.js.map +1 -1
  100. package/view/form-view.d.ts +1 -0
  101. package/view/form-view.d.ts.map +1 -0
  102. package/view/form-view.js +70 -67
  103. package/view/form-view.js.map +1 -1
  104. package/view/mutation.d.ts +1 -0
  105. package/view/mutation.d.ts.map +1 -0
  106. package/view/mutation.js +35 -35
  107. package/view/mutation.js.map +1 -1
  108. package/view/render.d.ts +2 -0
  109. package/view/render.d.ts.map +1 -0
  110. package/view/render.js +25 -13
  111. package/view/render.js.map +1 -1
  112. package/view/utils.d.ts +4 -3
  113. package/view/utils.d.ts.map +1 -0
  114. package/view/utils.js.map +1 -1
  115. package/view/view.d.ts +5 -4
  116. package/view/view.d.ts.map +1 -0
  117. package/view/view.js +34 -7
  118. package/view/view.js.map +1 -1
  119. package/zone/bootstrap.d.ts +1 -0
  120. package/zone/bootstrap.d.ts.map +1 -0
  121. package/zone/proxy.d.ts +1 -0
  122. package/zone/proxy.d.ts.map +1 -0
  123. package/zone/proxy.js +1 -0
  124. package/zone/proxy.js.map +1 -1
  125. package/zone/task.d.ts +1 -0
  126. package/zone/task.d.ts.map +1 -0
  127. package/zone/task.js +11 -3
  128. package/zone/task.js.map +1 -1
  129. package/zone/zone.d.ts +1 -0
  130. package/zone/zone.d.ts.map +1 -0
  131. package/zone/zone.js +8 -6
  132. package/zone/zone.js.map +1 -1
  133. package/providers/injector.d.ts +0 -10
  134. package/providers/injector.js +0 -27
  135. package/providers/injector.js.map +0 -1
  136. package/render/host-binding.handler.d.ts +0 -46
  137. package/render/host-binding.handler.js +0 -60
  138. package/render/host-binding.handler.js.map +0 -1
  139. package/render/host-listener.handler.d.ts +0 -50
  140. package/render/host-listener.handler.js +0 -88
  141. package/render/host-listener.handler.js.map +0 -1
  142. package/render/render-handler.d.ts +0 -11
  143. package/render/render-handler.js +0 -2
  144. package/render/render-handler.js.map +0 -1
@@ -1,286 +1,21 @@
1
- import type { TypeOf } from '../utils/typeof.js';
2
- import { DomNode } from '@ibyar/elements';
3
- import { TemplateUrl } from '../utils/path.js';
4
- import { ZoneType } from '../zone/bootstrap.js';
5
- import { ValueControl } from '../component/custom-element.js';
6
- export interface DirectiveOptions {
7
- /**
8
- * the name of the directive which is used in the template
9
- *
10
- * a structural directive name should start with `*`,
11
- * and an attributes directive should not.
12
- */
1
+ import type { Class } from '../utils/typeof.js';
2
+ import { ChildOptions, ComponentOptions, DirectiveOptions, OutputEventInit, OutputOptions, PipeOptions } from './options.js';
3
+ type PropertyValue<T> = T | ((value: T) => void) | undefined;
4
+ export declare function Input<This, Value>(name?: string): (value: PropertyValue<Value>, context: ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>) => void;
5
+ export declare function FormValue<This, Value>(): (value: PropertyValue<Value>, context: ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>) => void;
6
+ export declare function Output<This, Value>(options?: OutputOptions): (value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
7
+ export declare function Output<This, Value>(name?: string, options?: OutputEventInit): (value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
8
+ export declare function View<This, Value>(): (value: PropertyValue<Value>, context: ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>) => void;
9
+ export declare function ViewChild<This, Value>(selector: string | typeof HTMLElement | CustomElementConstructor, childOptions?: ChildOptions): (value: PropertyValue<Value>, context: ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>) => void;
10
+ export declare function ViewChildren<This, Value>(selector: string | typeof HTMLElement | CustomElementConstructor): (value: PropertyValue<Value>, context: ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>) => void;
11
+ export declare function HostListener<This, Value extends (this: This, ...args: any) => any>(eventName: string, args?: string | string[]): (value: Value, context: ClassMethodDecoratorContext<unknown, (this: unknown, ...args: any) => any>) => void;
12
+ type ValueGetter<T> = T | (() => T) | undefined;
13
+ export declare function HostBinding<This, Value>(hostPropertyName: string): (value: ValueGetter<Value>, context: ClassFieldDecoratorContext<This, Value> | ClassMethodDecoratorContext<This, any> | ClassGetterDecoratorContext<This, Value>) => void;
14
+ export declare const Pipe: (param: PipeOptions) => (constructor: any, context: ClassDecoratorContext<new (...args: any) => any>) => any;
15
+ export declare const Directive: (param: DirectiveOptions) => (constructor: any, context: ClassDecoratorContext<new (...args: any) => any>) => any;
16
+ export declare const Component: (param: ComponentOptions<Class> | ComponentOptions<Class>[]) => (constructor: any, context: ClassDecoratorContext<new (...args: any) => any>) => any;
17
+ export declare const customElement: (param: {
13
18
  selector: string;
14
- /**
15
- * - use `manual` for no zone.js patch effect applied,
16
- * and used for manual change detection for heavily process components.
17
- *
18
- * - use `proxy` zone for automatic detect changes without use of `zone.js`
19
- *
20
- * - use `aurora` for detection events like `rxjs` observables, `setTimeout`,
21
- * `setInterval` and `fetch` and `XMLHttpRequest`, etc...
22
- * make sure that `zone.js` is imported in the polyfills module.
23
- *
24
- * if no value specified, the value will be initialized by the custom element `web component` zone,
25
- * - if the web component zone is `manual`, the directive zone also will be `manual`, expect weird behavior.
26
- * - if the web component zone is `proxy`, the directive zone also will be `proxy`.
27
- * - if the web component zone is `aurora`, the directive zone also will be `aurora` and will get the benefit of `zone.js`.
28
- */
29
- zone?: ZoneType;
30
- }
31
- export interface ServiceOptions {
32
- provideIn?: TypeOf<CustomElementConstructor> | 'root' | 'platform' | 'any';
33
- }
34
- export interface PipeOptions {
35
- name: string;
36
- asynchronous?: boolean;
37
- }
38
- export interface ComponentOptions<T = Function> {
39
- /**
40
- * a tag name for the component,
41
- * if the tag name is valid custom element name, the view class will be a custom element,
42
- * otherwise an HTMLUnknownElement will be created
43
- */
44
- selector: string;
45
- /**
46
- * add html file url path to fetch,
47
- * templateUrl had propriety than template, and will override it.
48
- *
49
- * Can provide file name as "person-view.html" will resolved
50
- * as 'http://site-address.org/persin-view.html',
51
- *
52
- * OR as an object { moduleMeta: import.meta, filename: 'person-edit.html' }
53
- * let (import.meta = '/person/person.js') will resolved
54
- * as 'http://site-address.org/person/person-edit.html',
55
- *
56
- * OR as an object { moduleMeta: import.meta }
57
- * let (import.meta = '/person/person.js') will resolved as 'http://site-address.org/person/person.html'.
58
- *
59
- * if url not found, component will not be defined,
60
- *
61
- * if you didn't use webpack or rollup.js or any bundler,
62
- * you should copy the html files to its folder by yourself.
63
- */
64
- templateUrl?: TemplateUrl | string;
65
- /**
66
- * template: typeof 'string' ==> html string,
67
- * TypeOf 'DomRootRenderNode<T>' ==> JSX, create factory
68
- * if template === null || undefined ==> it had nothing to render,
69
- * and may be inherit from an html element
70
- *
71
- * 2 possible way to write a template, as inline string, represent a a valid html,
72
- * or us aurora jsx factory
73
- *
74
- */
75
- template?: string | DomNode;
76
- /**
77
- * style for this element
78
- */
79
- styles?: string | {
80
- [key: string]: string;
81
- }[];
82
- /**
83
- * what basic element should the new component inherit from,
84
- * the tag name to inherit from as 'a', 'div', 'table', 'td', 'th', 'tr', etc ...
85
- */
86
- extend?: keyof HTMLElementTagNameMap;
87
- /**
88
- * An encapsulation policy for the template and CSS styles. One of:
89
- * 'custom': Use global CSS without any encapsulation.
90
- * 'shadow-dom': Use Shadow DOM v1 to encapsulate styles.
91
- *
92
- * 'template': like 'custom', with load the template from the document ('index.html' file)
93
- * that had the same id as the component "selector".
94
- * 'shadow-dom-template': like 'shadowDom', and load template by selector id.
95
- *
96
- * Both 'template' & 'shadow-dom-template' encapsulation type:
97
- * should had attributes name like lowercase,
98
- * the browser itself, will convert all attributes to lowercase
99
- *
100
- * ```typescript
101
- * @Input('personage') personAge: number;
102
- * @Input('propname') propName: string;
103
- * @Output('savebuttonclick') saveButtonClick = new EventEmitter<Persons>();
104
- * @View('personform') personForm: HTMLFormElement;
105
- * ```
106
- *
107
- * any root element as
108
- *
109
- * ```html
110
- * <root-app></root-app>
111
- * ```
112
- *
113
- * the supported bind options is 'One way binding *(as passing data only)'
114
- * and 'template parsing' and 'event binding' syntax, HTML (angular) like.
115
- * it load its attributes from 'window object'
116
- *
117
- * so to pass date to A root element,
118
- *
119
- * ```html
120
- * <script>
121
- * let appVersion = '0.1.504';
122
- * function onRootAppClick() {
123
- * console.log('root app clicked');
124
- * }
125
- * function onSave(data){
126
- * console.log('root app save', data);
127
- * }
128
- * </script>
129
- * <root-app [version]="appVersion"
130
- * onclick="onRootAppClick()"
131
- * (save)="onSave()" ></root-app>
132
- * ```
133
- *
134
- * default is 'custom'
135
- * @type {'custom' | 'shadowDom' | 'template' | 'shadowDom-template'}
136
- */
137
- encapsulation?: 'custom' | 'shadow-dom' | 'template' | 'shadow-dom-template';
138
- /**
139
- * default: 'open'
140
- */
141
- shadowDomMode?: ShadowRootMode;
142
- /**
143
- * default: false
144
- */
145
- shadowDomDelegatesFocus?: boolean;
146
- /**
147
- * Create a custom form-associated element with HTMLElement.attachInternals
148
- * default: false
149
- *
150
- * if the value is `true` it is expected from the model class to implement `ValueControl<T>` interface
151
- *
152
- * otherwise you can register another class that implement `ValueControl<T>`,
153
- * in case if you want split the model and the value controller.
154
- *
155
- * #### Usage Notes:
156
- *
157
- * ```ts
158
- *
159
- * @Component({
160
- * selector: 'custom-message',
161
- * template: `
162
- * <label for="message">Message</label>
163
- * <textarea id="message" [(value)]="message" [disabled]="disabled" (change)="onMessageChange($event.target.value)"></textarea>
164
- * `,
165
- * formAssociated: true,
166
- * // formAssociated: CustomMessage,
167
- * })
168
- * export class CustomMessage implements ValueControl<string> {
169
- *
170
- * private message: string | null = '';
171
- * private disabled: boolean = false;
172
- * private _onChange: (_: any) => void = () => {};
173
- *
174
- * writeValue({ value, mode }: WriteValueOptions<string>) {
175
- * this.message = mode !== 'reset' ? value : '';
176
- * }
177
- *
178
- * registerOnChange(fn: (_: any) => void): void {
179
- * this._onChange = fn;
180
- * }
181
- *
182
- * setDisabledState(isDisabled: boolean) {
183
- * this.disabled = isDisabled;
184
- * }
185
- *
186
- * onMessageChange(message: string) {
187
- * this._onChange(message);
188
- * }
189
- *
190
- * }
191
- *
192
- *
193
- * export class CustomInputValueControl implements ValueControl<number> {
194
- *
195
- * private _value: number | null = null;
196
- * private _disabled: boolean = false;
197
- * private _onChange: (_: any) => void = () => {};
198
- *
199
- * writeValue({ value, mode }: WriteValueOptions<number>) {
200
- * this._value = mode !== 'reset' ? value : null;
201
- * }
202
- *
203
- * registerOnChange(fn: (_: any) => void): void {
204
- * this._onChange = fn;
205
- * }
206
- *
207
- * setDisabledState(isDisabled: boolean) {
208
- * this._disabled = isDisabled;
209
- * }
210
- *
211
- * }
212
- *
213
- * @Component({
214
- * selector: 'custom-input',
215
- * extend: 'input',
216
- * formAssociated: CustomInputValueControl,
217
- * })
218
- * export class CustomInputElement {
219
- * @View()
220
- * view: HTMLInputElement;
221
- *
222
- * onInit() {
223
- * this.view.type = 'number';
224
- * }
225
- * }
226
- *
227
- * ```
228
- */
229
- formAssociated?: boolean | TypeOf<ValueControl<any>>;
230
- /**
231
- * - use `manual` for no zone.js patch effect applied,
232
- * and used for manual change detection for heavily process components.
233
- *
234
- * - use `proxy` zone for automatic detect changes without use of `zone.js`
235
- *
236
- * - use `aurora` for detection events like `rxjs` observables, `setTimeout`,
237
- * `setInterval` and `fetch` and `XMLHttpRequest`, etc...
238
- * make sure that `zone.js` is imported in the polyfills module.
239
- *
240
- * the default value is the platform zone type which can be changed by:
241
- *
242
- * ```js
243
- * bootstrapZone('manual')
244
- * bootstrapZone('proxy')
245
- * bootstrapZone('aurora')
246
- * ```
247
- *
248
- * if `bootstrapZone` never been called, then the default zone is a `manual`.
249
- */
250
- zone?: ZoneType;
251
- /**
252
- * The imports property specifies the component's template dependencies — those directives, components, and pipes that can be used within its template.
253
- */
254
- imports?: (TypeOf<any> | ReadonlyArray<any>)[];
255
- }
256
- export interface ChildOptions {
257
- [key: string]: any;
258
- }
259
- export interface ViewChildOpt {
260
- selector: string | typeof HTMLElement | CustomElementConstructor;
261
- childOptions?: ChildOptions;
262
- }
263
- export declare function Input(name?: string): Function;
264
- export declare function FormValue(): Function;
265
- export type OutputEventInit = Omit<EventInit, 'cancelable'>;
266
- export type OutputOptions = {
267
- name?: string;
268
- } & OutputEventInit;
269
- export declare function Output(options?: OutputOptions): Function;
270
- export declare function Output(name?: string, options?: OutputEventInit): Function;
271
- export declare function View(): Function;
272
- export declare function ViewChild(selector: string | typeof HTMLElement | CustomElementConstructor, childOptions?: ChildOptions): Function;
273
- export declare function ViewChildren(selector: string | typeof HTMLElement | CustomElementConstructor): Function;
274
- export declare function HostListener(eventName: string, args?: string | string[]): Function;
275
- export declare function HostBinding(hostPropertyName: string): Function;
276
- export declare function Pipe(opt: PipeOptions): Function;
277
- export declare function Service(opt: ServiceOptions): Function;
278
- export declare function Directive(opt: DirectiveOptions): Function;
279
- export declare function Component<T extends {
280
- new (...args: any[]): {};
281
- }>(opt: ComponentOptions<T> | ComponentOptions<T>[]): Function;
282
- export declare function SelfSkip(name?: string): Function;
283
- export declare function Optional(): Function;
284
- export declare function customElement<T extends HTMLElement>(opt: {
285
- selector: string;
286
- } & ElementDefinitionOptions): Function;
19
+ } & ElementDefinitionOptions) => (constructor: any, context: ClassDecoratorContext<new (...args: any) => any>) => any;
20
+ export {};
21
+ //# sourceMappingURL=decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAQhD,OAAO,EACN,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAChD,eAAe,EAAE,aAAa,EAAE,WAAW,EAC3C,MAAM,cAAc,CAAC;AAItB,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG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,8GAIhB,CAAC;AAGF,eAAO,MAAM,SAAS,mHAIrB,CAAC;AAoBF,eAAO,MAAM,SAAS,sJAUrB,CAAC;AAEF,eAAO,MAAM,aAAa;cAAkC,MAAM;qHAIjE,CAAC"}
@@ -1,77 +1,111 @@
1
+ import { makeClassDecorator, makeClassMemberDecorator } from '@ibyar/decorators';
1
2
  import { Components } from '../component/component.js';
2
3
  import { ReflectComponents } from '../component/reflect.js';
3
4
  import { fetchHtml } from '../utils/path.js';
4
5
  export function Input(name) {
5
- return (target, propertyKey) => {
6
- ReflectComponents.addInput(target, propertyKey, name || propertyKey);
7
- };
6
+ return makeClassMemberDecorator((value, context, metadata) => {
7
+ if (!name && typeof context.name !== 'string') {
8
+ throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
9
+ }
10
+ if (context.private) {
11
+ throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
12
+ }
13
+ ReflectComponents.addInput(metadata, context.name, name || context.name);
14
+ });
8
15
  }
9
16
  export function FormValue() {
10
- return (target, propertyKey) => {
11
- ReflectComponents.addInput(target, propertyKey, 'value');
12
- };
17
+ return makeClassMemberDecorator((value, context, metadata) => {
18
+ if (typeof context.name !== 'string') {
19
+ throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
20
+ }
21
+ if (context.private) {
22
+ throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
23
+ }
24
+ ReflectComponents.addInput(metadata, context.name, 'value');
25
+ });
13
26
  }
14
27
  export function Output(name, options) {
15
28
  const eventType = typeof name === 'object' ? name.name : name;
16
29
  const eventOpts = typeof name === 'object' ? name : options;
17
- return (target, propertyKey) => {
18
- ReflectComponents.addOutput(target, propertyKey, eventType || propertyKey, {
30
+ return makeClassMemberDecorator((value, context, metadata) => {
31
+ if (typeof context.name !== 'string') {
32
+ throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
33
+ }
34
+ if (context.private) {
35
+ throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
36
+ }
37
+ ReflectComponents.addOutput(metadata, context.name, eventType || context.name, {
19
38
  bubbles: eventOpts?.bubbles ?? false,
20
39
  composed: eventOpts?.composed ?? false
21
40
  });
22
- };
41
+ });
23
42
  }
24
43
  export function View() {
25
- return (target, propertyKey) => {
26
- ReflectComponents.setComponentView(target, propertyKey);
27
- };
44
+ return makeClassMemberDecorator((value, context, metadata) => {
45
+ if (typeof context.name !== 'string') {
46
+ throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
47
+ }
48
+ if (context.private) {
49
+ throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
50
+ }
51
+ ReflectComponents.setComponentView(metadata, context.name);
52
+ });
28
53
  }
29
54
  export function ViewChild(selector, childOptions) {
30
- return (target, propertyKey) => {
31
- ReflectComponents.addViewChild(target, propertyKey, selector, childOptions);
32
- };
55
+ return makeClassMemberDecorator((value, context, metadata) => {
56
+ if (typeof context.name !== 'string') {
57
+ throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
58
+ }
59
+ if (context.private) {
60
+ throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
61
+ }
62
+ ReflectComponents.addViewChild(metadata, context.name, selector, childOptions);
63
+ });
33
64
  }
34
65
  export function ViewChildren(selector) {
35
- return (target, propertyKey) => {
36
- ReflectComponents.addViewChildren(target, propertyKey, selector);
37
- };
66
+ return makeClassMemberDecorator((value, context, metadata) => {
67
+ if (typeof context.name !== 'string') {
68
+ throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
69
+ }
70
+ if (context.private) {
71
+ throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
72
+ }
73
+ ReflectComponents.addViewChildren(metadata, context.name, selector);
74
+ });
38
75
  }
39
76
  export function HostListener(eventName, args) {
40
- return (target, propertyKey) => {
77
+ return makeClassMemberDecorator((value, context, metadata) => {
78
+ if (typeof context.name !== 'string') {
79
+ throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
80
+ }
41
81
  args = typeof args === 'string' ? [args] : args;
42
- ReflectComponents.addHostListener(target, propertyKey, eventName, args || []);
43
- };
82
+ ReflectComponents.addHostListener(metadata, context.name, eventName, args || []);
83
+ });
44
84
  }
45
85
  export function HostBinding(hostPropertyName) {
46
- return (target, propertyKey) => {
47
- ReflectComponents.addHostBinding(target, propertyKey, hostPropertyName);
48
- };
49
- }
50
- export function Pipe(opt) {
51
- return (target) => {
52
- Components.definePipe(target, opt);
53
- return target;
54
- };
55
- }
56
- export function Service(opt) {
57
- return (target) => {
58
- Components.defineService(target, opt);
59
- return target;
60
- };
61
- }
62
- export function Directive(opt) {
63
- return (target) => {
64
- Components.defineDirective(target, opt);
65
- return target;
66
- };
67
- }
68
- function generateComponent(target, opt) {
86
+ return makeClassMemberDecorator((value, context, metadata) => {
87
+ if (typeof context.name !== 'string') {
88
+ throw new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);
89
+ }
90
+ if (context.private) {
91
+ throw new SyntaxError(`private members '${context.name.toString()}' is not supported.`);
92
+ }
93
+ ReflectComponents.addHostBinding(metadata, context.name, hostPropertyName);
94
+ });
95
+ }
96
+ export const Pipe = makeClassDecorator((opt, constructor, context, metadata) => {
97
+ Components.definePipe(constructor, opt, metadata);
98
+ });
99
+ export const Directive = makeClassDecorator((opt, constructor, context, metadata) => {
100
+ Components.defineDirective(constructor, opt, metadata);
101
+ });
102
+ function generateComponent(target, opt, metadata) {
69
103
  if (opt.templateUrl) {
70
104
  fetchHtml(opt.templateUrl)
71
105
  .then(htmlTemplate => {
72
106
  if (htmlTemplate) {
73
107
  opt.template = htmlTemplate;
74
- Components.defineComponent(target, opt);
108
+ Components.defineComponent(target, opt, metadata);
75
109
  }
76
110
  })
77
111
  .catch(reason => {
@@ -79,46 +113,20 @@ function generateComponent(target, opt) {
79
113
  });
80
114
  }
81
115
  else {
82
- Components.defineComponent(target, opt);
116
+ Components.defineComponent(target, opt, metadata);
83
117
  }
84
118
  }
85
- export function Component(opt) {
86
- return (target) => {
87
- if (Array.isArray(opt)) {
88
- for (const comp of opt) {
89
- generateComponent(target, comp);
90
- }
91
- }
92
- else if (typeof opt === 'object') {
93
- generateComponent(target, opt);
119
+ export const Component = makeClassDecorator((opt, constructor, context, metadata) => {
120
+ if (Array.isArray(opt)) {
121
+ for (const comp of opt) {
122
+ generateComponent(constructor, comp, metadata);
94
123
  }
95
- return target;
96
- };
97
- }
98
- export function SelfSkip(name) {
99
- return (target, propertyKey, index) => {
100
- let metadata = Reflect.getMetadata('selfskip', target, propertyKey);
101
- if (!metadata) {
102
- metadata = {};
103
- Reflect.defineMetadata('selfskip', metadata, target, propertyKey);
104
- }
105
- metadata[index] = name;
106
- };
107
- }
108
- export function Optional() {
109
- return (target, propertyKey, index) => {
110
- let metadata = Reflect.getMetadata('optional', target, propertyKey);
111
- if (!metadata) {
112
- metadata = {};
113
- Reflect.defineMetadata('optional', metadata, target, propertyKey);
114
- }
115
- metadata[index] = true;
116
- };
117
- }
118
- export function customElement(opt) {
119
- return (target) => {
120
- Components.defineView(target, opt);
121
- return target;
122
- };
123
- }
124
+ }
125
+ else if (typeof opt === 'object') {
126
+ generateComponent(constructor, opt, metadata);
127
+ }
128
+ });
129
+ export const customElement = makeClassDecorator((opt, constructor, context) => {
130
+ Components.defineView(constructor, opt);
131
+ });
124
132
  //# sourceMappingURL=decorators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../src/core/annotation/decorators.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAe,MAAM,kBAAkB,CAAC;AAmR1D,MAAM,UAAU,KAAK,CAAC,IAAa;IAClC,OAAO,CAAC,MAAc,EAAE,WAAmB,EAAE,EAAE;QAC9C,iBAAiB,CAAC,QAAQ,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OAAO,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;SAClE;QACD,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IACxB,CAAC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,QAAQ;IACvB,OAAO,CAAC,MAAgB,EAAE,WAAmB,EAAE,KAAa,EAAE,EAAE;QAC/D,IAAI,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACpE,IAAI,CAAC,QAAQ,EAAE;YACd,QAAQ,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;SAClE;QACD,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IACxB,CAAC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAwB,GAAoD;IACxG,OAAO,CAAC,MAAiB,EAAE,EAAE;QAC5B,UAAU,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACnC,OAAO,MAAM,CAAC;IACf,CAAC,CAAC;AACH,CAAC","sourcesContent":["import type { TypeOf } from '../utils/typeof.js';\nimport { DomNode } from '@ibyar/elements';\nimport { Components } from '../component/component.js';\nimport { ReflectComponents } from '../component/reflect.js';\nimport { fetchHtml, TemplateUrl } from '../utils/path.js';\nimport { ZoneType } from '../zone/bootstrap.js';\nimport { ValueControl } from '../component/custom-element.js';\n\n\nexport interface DirectiveOptions {\n\n\t/**\n\t * the name of the directive which is used in the template\n\t * \n\t * a structural directive name should start with `*`,\n\t * and an attributes directive should not.\n\t */\n\tselector: string;\n\n\t/**\n\t * - use `manual` for no zone.js patch effect applied,\n\t * and used for manual change detection for heavily process components.\n\t * \n\t * - use `proxy` zone for automatic detect changes without use of `zone.js`\n\t * \n\t * - use `aurora` for detection events like `rxjs` observables, `setTimeout`,\n\t * `setInterval` and `fetch` and `XMLHttpRequest`, etc...\n\t * make sure that `zone.js` is imported in the polyfills module. \n\t * \n\t * if no value specified, the value will be initialized by the custom element `web component` zone,\n\t * - if the web component zone is `manual`, the directive zone also will be `manual`, expect weird behavior.\n\t * - if the web component zone is `proxy`, the directive zone also will be `proxy`.\n\t * - if the web component zone is `aurora`, the directive zone also will be `aurora` and will get the benefit of `zone.js`.\n\t */\n\tzone?: ZoneType;\n}\n\nexport interface ServiceOptions {\n\tprovideIn?: TypeOf<CustomElementConstructor> | 'root' | 'platform' | 'any';\n}\n\nexport interface PipeOptions {\n\tname: string;\n\tasynchronous?: boolean;\n}\n\nexport interface ComponentOptions<T = Function> {\n\t/**\n\t * a tag name for the component,\n\t * if the tag name is valid custom element name, the view class will be a custom element,\n\t * otherwise an HTMLUnknownElement will be created\n\t */\n\tselector: string;\n\n\t/**\n\t * add html file url path to fetch,\n\t * templateUrl had propriety than template, and will override it.\n\t *\n\t * Can provide file name as \"person-view.html\" will resolved \n\t * as 'http://site-address.org/persin-view.html',\n\t * \n\t * OR as an object { moduleMeta: import.meta, filename: 'person-edit.html' }\n\t * let (import.meta = '/person/person.js') will resolved \n\t * as 'http://site-address.org/person/person-edit.html',\n\t * \n\t * OR as an object { moduleMeta: import.meta }\n\t * let (import.meta = '/person/person.js') will resolved as 'http://site-address.org/person/person.html'.\n\t * \n\t * if url not found, component will not be defined,\n\t * \n\t * if you didn't use webpack or rollup.js or any bundler, \n\t * you should copy the html files to its folder by yourself. \n\t */\n\ttemplateUrl?: TemplateUrl | string;\n\t/**\n\t * template: typeof 'string' ==> html string,\n\t * \t\t\t TypeOf 'DomRootRenderNode<T>' ==> JSX, create factory\n\t * \tif template === null || undefined ==> it had nothing to render, \n\t * and may be inherit from an html element\n\t * \n\t * 2 possible way to write a template, as inline string, represent a a valid html, \n\t * or us aurora jsx factory \n\t * \t\t\t\t\n\t */\n\ttemplate?: string | DomNode;\n\t/**\n\t * style for this element\n\t */\n\tstyles?: string | { [key: string]: string }[];\n\t/**\n\t * what basic element should the new component inherit from,\n\t * the tag name to inherit from as 'a', 'div', 'table', 'td', 'th', 'tr', etc ...\n\t */\n\textend?: keyof HTMLElementTagNameMap;\n\n\t/**\n\t * An encapsulation policy for the template and CSS styles. One of:\n\t * 'custom': Use global CSS without any encapsulation.\n\t * 'shadow-dom': Use Shadow DOM v1 to encapsulate styles.\n\t * \n\t * 'template': like 'custom', with load the template from the document ('index.html' file)\n\t * \t \t\t\tthat had the same id as the component \"selector\".\n\t * 'shadow-dom-template': like 'shadowDom', and load template by selector id.\n\t * \n\t * Both 'template' & 'shadow-dom-template' encapsulation type:\n\t * should had attributes name like lowercase,\n\t * \tthe browser itself, will convert all attributes to lowercase\n\t * \n\t * ```typescript\n\t *\t\t@Input('personage') personAge: number;\n\t *\t\t@Input('propname') propName: string;\n\t *\t\t@Output('savebuttonclick') saveButtonClick = new EventEmitter<Persons>();\n\t *\t\t@View('personform') personForm: HTMLFormElement;\n\t * ```\n\t * \n\t * any root element as \n\t * \n\t * ```html\n\t * <root-app></root-app>\n\t * ```\n\t * \n\t * the supported bind options is 'One way binding *(as passing data only)'\n\t * and 'template parsing' and 'event binding' syntax, HTML (angular) like.\n\t * it load its attributes from 'window object'\n\t * \n\t * so to pass date to A root element, \n\t * \n\t * ```html\n\t * <script>\n\t * \tlet appVersion = '0.1.504';\n\t * \tfunction onRootAppClick() {\n\t *\t\tconsole.log('root app clicked');\n\t * \t}\n\t * \tfunction onSave(data){\n\t *\t\tconsole.log('root app save', data);\n\t * \t}\n\t * </script>\n\t * <root-app [version]=\"appVersion\" \n\t * \t\tonclick=\"onRootAppClick()\"\n\t * \t\t(save)=\"onSave()\" ></root-app>\n\t * ```\n\t * \n\t * default is 'custom'\n\t * @type {'custom' | 'shadowDom' | 'template' | 'shadowDom-template'}\n\t */\n\tencapsulation?: 'custom' | 'shadow-dom' | 'template' | 'shadow-dom-template';\n\n\t/**\n\t * default: 'open'\n\t */\n\tshadowDomMode?: ShadowRootMode;\n\n\t/**\n\t * default: false\n\t */\n\tshadowDomDelegatesFocus?: boolean;\n\n\t/**\n\t * Create a custom form-associated element with HTMLElement.attachInternals\n\t * default: false\n\t * \n\t * if the value is `true` it is expected from the model class to implement `ValueControl<T>` interface\n\t * \n\t * otherwise you can register another class that implement `ValueControl<T>`,\n\t * in case if you want split the model and the value controller.\n\t * \n\t * #### Usage Notes:\n\t * \n\t * ```ts\n\t * \n\t * @Component({\n\t * \tselector: 'custom-message',\n\t * \ttemplate: `\n\t * \t\t<label for=\"message\">Message</label>\n\t * \t\t<textarea id=\"message\" [(value)]=\"message\" [disabled]=\"disabled\" (change)=\"onMessageChange($event.target.value)\"></textarea>\n\t * \t`,\n\t * \tformAssociated: true,\n\t * \t// formAssociated: CustomMessage,\n\t * })\n\t * export class CustomMessage implements ValueControl<string> {\n\t * \n\t * \tprivate message: string | null = '';\n\t * \tprivate disabled: boolean = false;\n\t * \tprivate _onChange: (_: any) => void = () => {};\n\t * \n\t * \twriteValue({ value, mode }: WriteValueOptions<string>) {\n\t * \t\tthis.message = mode !== 'reset' ? value : '';\n\t * \t}\n\t * \n\t * \tregisterOnChange(fn: (_: any) => void): void {\n\t * \t\tthis._onChange = fn;\n\t * \t}\n\t * \n\t * \tsetDisabledState(isDisabled: boolean) {\n\t * \t\tthis.disabled = isDisabled;\n\t * \t}\n\t * \n\t * \tonMessageChange(message: string) {\n\t * \t\tthis._onChange(message);\n\t * \t}\n\t * \t\n\t * }\n\t * \n\t * \n\t * export class CustomInputValueControl implements ValueControl<number> {\n\t * \n\t * \tprivate _value: number | null = null;\n\t * \tprivate _disabled: boolean = false;\n\t * \tprivate _onChange: (_: any) => void = () => {};\n\t * \n\t * \twriteValue({ value, mode }: WriteValueOptions<number>) {\n\t * \t\tthis._value = mode !== 'reset' ? value : null;\n\t * \t}\n\t * \n\t * \tregisterOnChange(fn: (_: any) => void): void {\n\t * \t\tthis._onChange = fn;\n\t * \t}\n\t * \n\t * \tsetDisabledState(isDisabled: boolean) {\n\t * \t\tthis._disabled = isDisabled;\n\t * \t}\n\t * \t\n\t * }\n\t * \n\t * @Component({\n\t * \tselector: 'custom-input',\n\t * \textend: 'input',\n\t * \tformAssociated: CustomInputValueControl,\n\t * })\n\t * export class CustomInputElement {\n\t * \t@View()\n\t * \tview: HTMLInputElement;\n\t * \n\t * \tonInit() {\n\t * \t\tthis.view.type = 'number';\n\t * \t}\n\t * }\n\t * \n\t * ```\n\t */\n\tformAssociated?: boolean | TypeOf<ValueControl<any>>;\n\n\t/**\n\t * - use `manual` for no zone.js patch effect applied,\n\t * and used for manual change detection for heavily process components.\n\t * \n\t * - use `proxy` zone for automatic detect changes without use of `zone.js`\n\t * \n\t * - use `aurora` for detection events like `rxjs` observables, `setTimeout`,\n\t * `setInterval` and `fetch` and `XMLHttpRequest`, etc...\n\t * make sure that `zone.js` is imported in the polyfills module. \n\t * \n\t * the default value is the platform zone type which can be changed by:\n\t * \n\t * ```js\n\t * bootstrapZone('manual')\n\t * bootstrapZone('proxy')\n\t * bootstrapZone('aurora')\n\t * ```\n\t * \n\t * if `bootstrapZone` never been called, then the default zone is a `manual`.\n\t */\n\tzone?: ZoneType;\n\n\t/**\n\t * The imports property specifies the component's template dependencies — those directives, components, and pipes that can be used within its template.\n\t */\n\timports?: (TypeOf<any> | ReadonlyArray<any>)[];\n}\n\nexport interface ChildOptions {\n\t[key: string]: any;\n}\n\nexport interface ViewChildOpt {\n\tselector: string | typeof HTMLElement | CustomElementConstructor;\n\tchildOptions?: ChildOptions;\n}\n\nexport function Input(name?: string): Function {\n\treturn (target: Object, propertyKey: string) => {\n\t\tReflectComponents.addInput(target, propertyKey, name || propertyKey);\n\t};\n}\n\nexport function FormValue(): Function {\n\treturn (target: Object, propertyKey: string) => {\n\t\tReflectComponents.addInput(target, propertyKey, 'value');\n\t};\n}\n\nexport type OutputEventInit = Omit<EventInit, 'cancelable'>;\nexport type OutputOptions = { name?: string } & OutputEventInit;\n\nexport function Output(options?: OutputOptions): Function;\nexport function Output(name?: string, options?: OutputEventInit): Function;\nexport function Output(name?: string | OutputOptions, options?: OutputEventInit): Function {\n\tconst eventType = typeof name === 'object' ? name.name : name;\n\tconst eventOpts = typeof name === 'object' ? name : options;\n\treturn (target: Object, propertyKey: string) => {\n\t\tReflectComponents.addOutput(\n\t\t\ttarget,\n\t\t\tpropertyKey, eventType || propertyKey,\n\t\t\t{\n\t\t\t\tbubbles: eventOpts?.bubbles ?? false,\n\t\t\t\tcomposed: eventOpts?.composed ?? false\n\t\t\t}\n\t\t);\n\t};\n}\n\nexport function View(): Function {\n\treturn (target: Object, propertyKey: string) => {\n\t\tReflectComponents.setComponentView(target, propertyKey);\n\t};\n}\n\nexport function ViewChild(selector: string | typeof HTMLElement | CustomElementConstructor,\n\tchildOptions?: ChildOptions): Function {\n\treturn (target: Object, propertyKey: string) => {\n\t\tReflectComponents.addViewChild(target, propertyKey, selector, childOptions);\n\t};\n}\n\nexport function ViewChildren(selector: string | typeof HTMLElement | CustomElementConstructor): Function {\n\treturn (target: Object, propertyKey: string) => {\n\t\tReflectComponents.addViewChildren(target, propertyKey, selector);\n\t};\n}\n\nexport function HostListener(eventName: string, args?: string | string[]): Function {\n\treturn (target: Object, propertyKey: string) => {\n\t\targs = typeof args === 'string' ? [args] : args;\n\t\tReflectComponents.addHostListener(\n\t\t\ttarget,\n\t\t\tpropertyKey,\n\t\t\teventName,\n\t\t\targs || []\n\t\t);\n\t};\n}\n\nexport function HostBinding(hostPropertyName: string): Function {\n\treturn (target: Object, propertyKey: string) => {\n\t\tReflectComponents.addHostBinding(target, propertyKey, hostPropertyName);\n\t};\n}\n\nexport function Pipe(opt: PipeOptions): Function {\n\treturn (target: Function) => {\n\t\tComponents.definePipe(target, opt);\n\t\treturn target;\n\t};\n}\n\nexport function Service(opt: ServiceOptions): Function {\n\treturn (target: Function) => {\n\t\tComponents.defineService(target, opt);\n\t\treturn target;\n\t};\n}\n\nexport function Directive(opt: DirectiveOptions): Function {\n\treturn (target: Function) => {\n\t\tComponents.defineDirective(target, opt);\n\t\treturn target;\n\t};\n}\n\nfunction generateComponent<T extends { new(...args: any[]): {} }>(target: TypeOf<T>, opt: ComponentOptions<T>) {\n\tif (opt.templateUrl) {\n\t\tfetchHtml(opt.templateUrl)\n\t\t\t.then(htmlTemplate => {\n\t\t\t\tif (htmlTemplate) {\n\t\t\t\t\topt.template = htmlTemplate;\n\t\t\t\t\tComponents.defineComponent(target, opt);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(reason => {\n\t\t\t\tconsole.error(`Error @URL: ${opt.templateUrl}, for model Class: ${target.name},\\n Reason: ${reason}.`);\n\t\t\t});\n\t} else {\n\t\tComponents.defineComponent(target, opt);\n\t}\n}\n\nexport function Component<T extends { new(...args: any[]): {} }>(opt: ComponentOptions<T> | ComponentOptions<T>[]): Function {\n\treturn (target: TypeOf<T>) => {\n\t\tif (Array.isArray(opt)) {\n\t\t\tfor (const comp of opt) {\n\t\t\t\tgenerateComponent(target, comp);\n\t\t\t}\n\t\t} else if (typeof opt === 'object') {\n\t\t\tgenerateComponent(target, opt);\n\t\t}\n\t\treturn target;\n\t};\n}\n\nexport function SelfSkip(name?: string): Function {\n\treturn (target: Function, propertyKey: string, index: number) => {\n\t\tlet metadata = Reflect.getMetadata('selfskip', target, propertyKey);\n\t\tif (!metadata) {\n\t\t\tmetadata = {};\n\t\t\tReflect.defineMetadata('selfskip', metadata, target, propertyKey);\n\t\t}\n\t\tmetadata[index] = name;\n\t};\n}\n\nexport function Optional(): Function {\n\treturn (target: Function, propertyKey: string, index: number) => {\n\t\tlet metadata = Reflect.getMetadata('optional', target, propertyKey);\n\t\tif (!metadata) {\n\t\t\tmetadata = {};\n\t\t\tReflect.defineMetadata('optional', metadata, target, propertyKey);\n\t\t}\n\t\tmetadata[index] = true;\n\t};\n}\n\nexport function customElement<T extends HTMLElement>(opt: { selector: string } & ElementDefinitionOptions): Function {\n\treturn (target: TypeOf<T>) => {\n\t\tComponents.defineView(target, opt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C;KACJ;SAAM;QACN,UAAU,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;KAClD;AACF,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAC1C,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;IACvC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACvB,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE;YACvB,iBAAiB,CAAC,WAAkB,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;SACtD;KACD;SAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QACnC,iBAAiB,CAAC,WAAkB,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;KACrD;AACF,CAAC,CACD,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAC9C,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE;IAC7B,UAAU,CAAC,UAAU,CAAC,WAAkB,EAAE,GAAG,CAAC,CAAC;AAChD,CAAC,CACD,CAAC","sourcesContent":["import type { Class } from '../utils/typeof.js';\nimport {\n\tMetadataClass, MetadataContext,\n\tmakeClassDecorator, makeClassMemberDecorator\n} from '@ibyar/decorators';\nimport { Components } from '../component/component.js';\nimport { ReflectComponents } from '../component/reflect.js';\nimport { fetchHtml } from '../utils/path.js';\nimport {\n\tChildOptions, ComponentOptions, DirectiveOptions,\n\tOutputEventInit, OutputOptions, PipeOptions, ServiceOptions\n} from './options.js';\n\n\n\ntype PropertyValue<T> = T | ((value: T) => void) | undefined;\n\n\nexport function Input<This, Value>(name?: string) {\n\treturn makeClassMemberDecorator<PropertyValue<Value>, ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (!name && typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addInput(metadata, context.name as string, name || context.name as string);\n\t\t}\n\t);\n}\n\nexport function FormValue<This, Value>() {\n\treturn makeClassMemberDecorator<PropertyValue<Value>, ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addInput(metadata, context.name, 'value');\n\t\t}\n\t);\n}\n\nexport function Output<This, Value>(options?: OutputOptions): (value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;\nexport function Output<This, Value>(name?: string, options?: OutputEventInit): (value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;\nexport function Output<This, Value>(name?: string | OutputOptions, options?: OutputEventInit): (value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void {\n\tconst eventType = typeof name === 'object' ? name.name : name;\n\tconst eventOpts = typeof name === 'object' ? name : options;\n\treturn makeClassMemberDecorator<undefined, ClassFieldDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addOutput(\n\t\t\t\tmetadata,\n\t\t\t\tcontext.name,\n\t\t\t\teventType || context.name,\n\t\t\t\t{\n\t\t\t\t\tbubbles: eventOpts?.bubbles ?? false,\n\t\t\t\t\tcomposed: eventOpts?.composed ?? false\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t);\n}\n\nexport function View<This, Value>() {\n\treturn makeClassMemberDecorator<PropertyValue<Value>, ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.setComponentView(metadata, context.name);\n\t\t}\n\t);\n}\n\nexport function ViewChild<This, Value>(selector: string | typeof HTMLElement | CustomElementConstructor, childOptions?: ChildOptions) {\n\treturn makeClassMemberDecorator<PropertyValue<Value>, ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addViewChild(metadata, context.name, selector, childOptions);\n\t\t}\n\t);\n}\n\nexport function ViewChildren<This, Value>(selector: string | typeof HTMLElement | CustomElementConstructor) {\n\treturn makeClassMemberDecorator<PropertyValue<Value>, ClassFieldDecoratorContext<This, Value> | ClassSetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addViewChildren(metadata, context.name, selector);\n\t\t}\n\t);\n}\n\n\nexport function HostListener<This, Value extends (this: This, ...args: any) => any>(eventName: string, args?: string | string[]) {\n\treturn makeClassMemberDecorator<Value, ClassMethodDecoratorContext>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\targs = typeof args === 'string' ? [args] : args;\n\t\t\tReflectComponents.addHostListener(\n\t\t\t\tmetadata,\n\t\t\t\tcontext.name,\n\t\t\t\teventName,\n\t\t\t\targs || []\n\t\t\t);\n\t\t}\n\t);\n}\n\n\ntype ValueGetter<T> = T | (() => T) | undefined;\n\nexport function HostBinding<This, Value>(hostPropertyName: string) {\n\treturn makeClassMemberDecorator<ValueGetter<Value>, ClassFieldDecoratorContext<This, Value> | ClassMethodDecoratorContext<This, any> | ClassGetterDecoratorContext<This, Value>>(\n\t\t(value, context, metadata) => {\n\t\t\tif (typeof context.name !== 'string') {\n\t\t\t\tthrow new TypeError(`type ${typeof context.name} of '${context.name.toString()}' is not supported`);\n\t\t\t}\n\t\t\tif (context.private) {\n\t\t\t\tthrow new SyntaxError(`private members '${context.name.toString()}' is not supported.`);\n\t\t\t}\n\t\t\tReflectComponents.addHostBinding(metadata, context.name, hostPropertyName);\n\t\t}\n\t);\n}\n\nexport const Pipe = makeClassDecorator<PipeOptions>(\n\t(opt, constructor, context, metadata) => {\n\t\tComponents.definePipe(constructor as any, opt, metadata);\n\t}\n);\n\n\nexport const Directive = makeClassDecorator<DirectiveOptions>(\n\t(opt, constructor, context, metadata) => {\n\t\tComponents.defineDirective(constructor as any, opt, metadata);\n\t}\n);\n\n\nfunction generateComponent<T extends Class>(target: MetadataClass<T>, opt: ComponentOptions<T>, metadata: MetadataContext) {\n\tif (opt.templateUrl) {\n\t\tfetchHtml(opt.templateUrl)\n\t\t\t.then(htmlTemplate => {\n\t\t\t\tif (htmlTemplate) {\n\t\t\t\t\topt.template = htmlTemplate;\n\t\t\t\t\tComponents.defineComponent(target, opt, metadata);\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch(reason => {\n\t\t\t\tconsole.error(`Error @URL: ${opt.templateUrl}, for model Class: ${target.name},\\n Reason: ${reason}.`);\n\t\t\t});\n\t} else {\n\t\tComponents.defineComponent(target, opt, metadata);\n\t}\n}\n\nexport const Component = makeClassDecorator<ComponentOptions | ComponentOptions[]>(\n\t(opt, constructor, context, metadata) => {\n\t\tif (Array.isArray(opt)) {\n\t\t\tfor (const comp of opt) {\n\t\t\t\tgenerateComponent(constructor as any, comp, metadata);\n\t\t\t}\n\t\t} else if (typeof opt === 'object') {\n\t\t\tgenerateComponent(constructor as any, opt, metadata);\n\t\t}\n\t}\n);\n\nexport const customElement = makeClassDecorator<{ selector: string } & ElementDefinitionOptions, Class<HTMLElement>>(\n\t(opt, constructor, context) => {\n\t\tComponents.defineView(constructor as any, opt);\n\t}\n);\n"]}