@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.
- package/annotation/decorators.d.ts +20 -285
- package/annotation/decorators.d.ts.map +1 -0
- package/annotation/decorators.js +92 -84
- package/annotation/decorators.js.map +1 -1
- package/annotation/options.d.ts +276 -0
- package/annotation/options.d.ts.map +1 -0
- package/annotation/options.js +2 -0
- package/annotation/options.js.map +1 -0
- package/binding/binding.expressions.d.ts +2 -1
- package/binding/binding.expressions.d.ts.map +1 -0
- package/binding/binding.expressions.js +149 -124
- package/binding/binding.expressions.js.map +1 -1
- package/component/component.d.ts +13 -11
- package/component/component.d.ts.map +1 -0
- package/component/component.js +39 -45
- package/component/component.js.map +1 -1
- package/component/custom-element.d.ts +1 -3
- package/component/custom-element.d.ts.map +1 -0
- package/component/custom-element.js.map +1 -1
- package/component/events.d.ts +1 -0
- package/component/events.d.ts.map +1 -0
- package/component/events.js +4 -3
- package/component/events.js.map +1 -1
- package/component/lifecycle.d.ts +1 -0
- package/component/lifecycle.d.ts.map +1 -0
- package/component/reflect.d.ts +12 -15
- package/component/reflect.d.ts.map +1 -0
- package/component/reflect.js +28 -47
- package/component/reflect.js.map +1 -1
- package/context/stack.d.ts +1 -0
- package/context/stack.d.ts.map +1 -0
- package/context/subscription.d.ts +1 -0
- package/context/subscription.d.ts.map +1 -0
- package/directive/directive.d.ts +1 -0
- package/directive/directive.d.ts.map +1 -0
- package/directive/directive.js +8 -0
- package/directive/directive.js.map +1 -1
- package/directive/parser.d.ts +1 -0
- package/directive/parser.d.ts.map +1 -0
- package/directive/parser.js +9 -7
- package/directive/parser.js.map +1 -1
- package/directive/providers.d.ts +1 -0
- package/directive/providers.d.ts.map +1 -0
- package/directive/providers.js +2 -1
- package/directive/providers.js.map +1 -1
- package/html/deserialize.d.ts +1 -0
- package/html/deserialize.d.ts.map +1 -0
- package/html/expression.d.ts +1 -0
- package/html/expression.d.ts.map +1 -0
- package/html/expression.js +2 -2
- package/html/expression.js.map +1 -1
- package/html/types.d.ts +1 -0
- package/html/types.d.ts.map +1 -0
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -0
- package/index.js +1 -2
- package/index.js.map +1 -1
- package/linker/change-detector-ref.d.ts +1 -0
- package/linker/change-detector-ref.d.ts.map +1 -0
- package/linker/template-ref.d.ts +1 -0
- package/linker/template-ref.d.ts.map +1 -0
- package/linker/template-ref.js +5 -0
- package/linker/template-ref.js.map +1 -1
- package/linker/view-container-ref.d.ts +4 -2
- package/linker/view-container-ref.d.ts.map +1 -0
- package/linker/view-container-ref.js +9 -7
- package/linker/view-container-ref.js.map +1 -1
- package/linker/view-ref.d.ts +1 -0
- package/linker/view-ref.d.ts.map +1 -0
- package/linker/view-ref.js +5 -2
- package/linker/view-ref.js.map +1 -1
- package/node.d.ts +1 -0
- package/node.d.ts.map +1 -0
- package/package.json +8 -9
- package/pipe/pipe.d.ts +1 -0
- package/pipe/pipe.d.ts.map +1 -0
- package/pipe/pipe.js +2 -1
- package/pipe/pipe.js.map +1 -1
- package/providers/provider.d.ts +15 -13
- package/providers/provider.d.ts.map +1 -0
- package/providers/provider.js +13 -15
- package/providers/provider.js.map +1 -1
- package/scope/variables.d.ts +19 -0
- package/scope/variables.d.ts.map +1 -0
- package/scope/variables.js +38 -0
- package/scope/variables.js.map +1 -0
- package/utils/elements-util.d.ts +1 -0
- package/utils/elements-util.d.ts.map +1 -0
- package/utils/path.d.ts +1 -0
- package/utils/path.d.ts.map +1 -0
- package/utils/typeof.d.ts +3 -0
- package/utils/typeof.d.ts.map +1 -0
- package/utils/typeof.js.map +1 -1
- package/utils/utils.d.ts +1 -0
- package/utils/utils.d.ts.map +1 -0
- package/view/base-view.d.ts +1 -0
- package/view/base-view.d.ts.map +1 -0
- package/view/base-view.js +33 -29
- package/view/base-view.js.map +1 -1
- package/view/form-view.d.ts +1 -0
- package/view/form-view.d.ts.map +1 -0
- package/view/form-view.js +70 -67
- package/view/form-view.js.map +1 -1
- package/view/mutation.d.ts +1 -0
- package/view/mutation.d.ts.map +1 -0
- package/view/mutation.js +35 -35
- package/view/mutation.js.map +1 -1
- package/view/render.d.ts +2 -0
- package/view/render.d.ts.map +1 -0
- package/view/render.js +25 -13
- package/view/render.js.map +1 -1
- package/view/utils.d.ts +4 -3
- package/view/utils.d.ts.map +1 -0
- package/view/utils.js.map +1 -1
- package/view/view.d.ts +5 -4
- package/view/view.d.ts.map +1 -0
- package/view/view.js +34 -7
- package/view/view.js.map +1 -1
- package/zone/bootstrap.d.ts +1 -0
- package/zone/bootstrap.d.ts.map +1 -0
- package/zone/proxy.d.ts +1 -0
- package/zone/proxy.d.ts.map +1 -0
- package/zone/proxy.js +1 -0
- package/zone/proxy.js.map +1 -1
- package/zone/task.d.ts +1 -0
- package/zone/task.d.ts.map +1 -0
- package/zone/task.js +11 -3
- package/zone/task.js.map +1 -1
- package/zone/zone.d.ts +1 -0
- package/zone/zone.d.ts.map +1 -0
- package/zone/zone.js +8 -6
- package/zone/zone.js.map +1 -1
- package/providers/injector.d.ts +0 -10
- package/providers/injector.js +0 -27
- package/providers/injector.js.map +0 -1
- package/render/host-binding.handler.d.ts +0 -46
- package/render/host-binding.handler.js +0 -60
- package/render/host-binding.handler.js.map +0 -1
- package/render/host-listener.handler.d.ts +0 -50
- package/render/host-listener.handler.js +0 -88
- package/render/host-listener.handler.js.map +0 -1
- package/render/render-handler.d.ts +0 -11
- package/render/render-handler.js +0 -2
- package/render/render-handler.js.map +0 -1
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import type { Class, 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
|
+
*/
|
|
13
|
+
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 = Class> {
|
|
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
|
+
* also, support extends a custom element tag name.
|
|
86
|
+
*/
|
|
87
|
+
extend?: keyof HTMLElementTagNameMap | `${string}-${string}`;
|
|
88
|
+
/**
|
|
89
|
+
* An encapsulation policy for the template and CSS styles. One of:
|
|
90
|
+
* 'custom': Use global CSS without any encapsulation.
|
|
91
|
+
* 'shadow-dom': Use Shadow DOM v1 to encapsulate styles.
|
|
92
|
+
*
|
|
93
|
+
* 'template': like 'custom', with load the template from the document ('index.html' file)
|
|
94
|
+
* that had the same id as the component "selector".
|
|
95
|
+
* 'shadow-dom-template': like 'shadowDom', and load template by selector id.
|
|
96
|
+
*
|
|
97
|
+
* Both 'template' & 'shadow-dom-template' encapsulation type:
|
|
98
|
+
* should had attributes name like lowercase,
|
|
99
|
+
* the browser itself, will convert all attributes to lowercase
|
|
100
|
+
*
|
|
101
|
+
* ```typescript
|
|
102
|
+
* @Input('personage') personAge: number;
|
|
103
|
+
* @Input('propname') propName: string;
|
|
104
|
+
* @Output('savebuttonclick') saveButtonClick = new EventEmitter<Persons>();
|
|
105
|
+
* @View('personform') personForm: HTMLFormElement;
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* any app root element as
|
|
109
|
+
*
|
|
110
|
+
* ```html
|
|
111
|
+
* <app-root></app-root>
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* the supported bind options is 'One way binding *(as passing data only)'
|
|
115
|
+
* and 'template parsing' and 'event binding' syntax, HTML (angular) like.
|
|
116
|
+
* it load its attributes from 'window object'
|
|
117
|
+
*
|
|
118
|
+
* so to pass date to A root element,
|
|
119
|
+
*
|
|
120
|
+
* ```html
|
|
121
|
+
* <script>
|
|
122
|
+
* const appVersion = '0.1.504';
|
|
123
|
+
* function onRootAppClick() {
|
|
124
|
+
* console.log('root app clicked');
|
|
125
|
+
* }
|
|
126
|
+
* function onSave(data){
|
|
127
|
+
* console.log('root app save', data);
|
|
128
|
+
* }
|
|
129
|
+
* </script>
|
|
130
|
+
* <app-root [version]="appVersion"
|
|
131
|
+
* onclick="onRootAppClick()"
|
|
132
|
+
* (save)="onSave()" >
|
|
133
|
+
* </app-root>
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* default is 'custom'
|
|
137
|
+
* @type {'custom' | 'shadowDom' | 'template' | 'shadowDom-template'}
|
|
138
|
+
*/
|
|
139
|
+
encapsulation?: 'custom' | 'shadow-dom' | 'template' | 'shadow-dom-template';
|
|
140
|
+
/**
|
|
141
|
+
* default: 'open' when encapsulation used,
|
|
142
|
+
* otherwise it is undefined and will not attach shadow root element.
|
|
143
|
+
*/
|
|
144
|
+
shadowDomMode?: ShadowRootMode;
|
|
145
|
+
/**
|
|
146
|
+
* default: false
|
|
147
|
+
*/
|
|
148
|
+
shadowDomDelegatesFocus?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* shadow root initialization options,
|
|
151
|
+
* default mode: `open`, delegatesFocus: `false` and slotAssignment: `manual`
|
|
152
|
+
*/
|
|
153
|
+
shadowRootInit?: Partial<ShadowRootInit>;
|
|
154
|
+
/**
|
|
155
|
+
* Create a custom form-associated element with HTMLElement.attachInternals
|
|
156
|
+
* default: false
|
|
157
|
+
*
|
|
158
|
+
* if the value is `true` it is expected from the model class to implement `ValueControl<T>` interface
|
|
159
|
+
*
|
|
160
|
+
* otherwise you can register another class that implement `ValueControl<T>`,
|
|
161
|
+
* in case if you want split the model and the value controller.
|
|
162
|
+
*
|
|
163
|
+
* #### Usage Notes:
|
|
164
|
+
*
|
|
165
|
+
* ```ts
|
|
166
|
+
*
|
|
167
|
+
* @Component({
|
|
168
|
+
* selector: 'custom-message',
|
|
169
|
+
* template: `
|
|
170
|
+
* <label for="message">Message</label>
|
|
171
|
+
* <textarea id="message" [(value)]="message" [disabled]="disabled" (change)="onMessageChange($event.target.value)"></textarea>
|
|
172
|
+
* `,
|
|
173
|
+
* formAssociated: true,
|
|
174
|
+
* // formAssociated: CustomMessage,
|
|
175
|
+
* })
|
|
176
|
+
* export class CustomMessage implements ValueControl<string> {
|
|
177
|
+
*
|
|
178
|
+
* private message: string | null = '';
|
|
179
|
+
* private disabled: boolean = false;
|
|
180
|
+
* private _onChange: (_: any) => void = () => {};
|
|
181
|
+
*
|
|
182
|
+
* writeValue({ value, mode }: WriteValueOptions<string>) {
|
|
183
|
+
* this.message = mode !== 'reset' ? value : '';
|
|
184
|
+
* }
|
|
185
|
+
*
|
|
186
|
+
* registerOnChange(fn: (_: any) => void): void {
|
|
187
|
+
* this._onChange = fn;
|
|
188
|
+
* }
|
|
189
|
+
*
|
|
190
|
+
* setDisabledState(isDisabled: boolean) {
|
|
191
|
+
* this.disabled = isDisabled;
|
|
192
|
+
* }
|
|
193
|
+
*
|
|
194
|
+
* onMessageChange(message: string) {
|
|
195
|
+
* this._onChange(message);
|
|
196
|
+
* }
|
|
197
|
+
*
|
|
198
|
+
* }
|
|
199
|
+
*
|
|
200
|
+
*
|
|
201
|
+
* export class CustomInputValueControl implements ValueControl<number> {
|
|
202
|
+
*
|
|
203
|
+
* private _value: number | null = null;
|
|
204
|
+
* private _disabled: boolean = false;
|
|
205
|
+
* private _onChange: (_: any) => void = () => {};
|
|
206
|
+
*
|
|
207
|
+
* writeValue({ value, mode }: WriteValueOptions<number>) {
|
|
208
|
+
* this._value = mode !== 'reset' ? value : null;
|
|
209
|
+
* }
|
|
210
|
+
*
|
|
211
|
+
* registerOnChange(fn: (_: any) => void): void {
|
|
212
|
+
* this._onChange = fn;
|
|
213
|
+
* }
|
|
214
|
+
*
|
|
215
|
+
* setDisabledState(isDisabled: boolean) {
|
|
216
|
+
* this._disabled = isDisabled;
|
|
217
|
+
* }
|
|
218
|
+
*
|
|
219
|
+
* }
|
|
220
|
+
*
|
|
221
|
+
* @Component({
|
|
222
|
+
* selector: 'custom-input',
|
|
223
|
+
* extend: 'input',
|
|
224
|
+
* formAssociated: CustomInputValueControl,
|
|
225
|
+
* })
|
|
226
|
+
* export class CustomInputElement {
|
|
227
|
+
*
|
|
228
|
+
* @View()
|
|
229
|
+
* view: HTMLInputElement;
|
|
230
|
+
*
|
|
231
|
+
* onInit() {
|
|
232
|
+
* this.view.type = 'number';
|
|
233
|
+
* }
|
|
234
|
+
* }
|
|
235
|
+
*
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
formAssociated?: boolean | TypeOf<ValueControl<any>>;
|
|
239
|
+
/**
|
|
240
|
+
* - use `manual` for no zone.js patch effect applied,
|
|
241
|
+
* and used for manual change detection for heavily process components.
|
|
242
|
+
*
|
|
243
|
+
* - use `proxy` zone for automatic detect changes without use of `zone.js`
|
|
244
|
+
*
|
|
245
|
+
* - use `aurora` for detection events like `rxjs` observables, `setTimeout`,
|
|
246
|
+
* `setInterval` and `fetch` and `XMLHttpRequest`, etc...
|
|
247
|
+
* make sure that `zone.js` is imported in the polyfills module.
|
|
248
|
+
*
|
|
249
|
+
* the default value is the platform zone type which can be changed by:
|
|
250
|
+
*
|
|
251
|
+
* ```js
|
|
252
|
+
* bootstrapZone('manual')
|
|
253
|
+
* bootstrapZone('proxy')
|
|
254
|
+
* bootstrapZone('aurora')
|
|
255
|
+
* ```
|
|
256
|
+
*
|
|
257
|
+
* if `bootstrapZone` never been called, then the default zone is a `manual`.
|
|
258
|
+
*/
|
|
259
|
+
zone?: ZoneType;
|
|
260
|
+
/**
|
|
261
|
+
* The imports property specifies the component's template dependencies — those directives, components, and pipes that can be used within its template.
|
|
262
|
+
*/
|
|
263
|
+
imports?: (TypeOf<any> | ReadonlyArray<any>)[];
|
|
264
|
+
}
|
|
265
|
+
export interface ChildOptions {
|
|
266
|
+
[key: string]: any;
|
|
267
|
+
}
|
|
268
|
+
export interface ViewChildOpt {
|
|
269
|
+
selector: string | typeof HTMLElement | CustomElementConstructor;
|
|
270
|
+
childOptions?: ChildOptions;
|
|
271
|
+
}
|
|
272
|
+
export type OutputEventInit = Omit<EventInit, 'cancelable'>;
|
|
273
|
+
export type OutputOptions = {
|
|
274
|
+
name?: string;
|
|
275
|
+
} & OutputEventInit;
|
|
276
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/core/annotation/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG9D,MAAM,WAAW,gBAAgB;IAEhC;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC,wBAAwB,CAAC,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;CAC3E;AAED,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,KAAK;IAE1C;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAEnC;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAE5B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,EAAE,CAAC;IAE9C;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,qBAAqB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;IAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkDG;IACH,aAAa,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,UAAU,GAAG,qBAAqB,CAAC;IAE7E;;;OAGG;IACH,aAAa,CAAC,EAAE,cAAc,CAAC;IAE/B;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmFG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IAErD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,YAAY;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,EAAE,MAAM,GAAG,OAAO,WAAW,GAAG,wBAAwB,CAAC;IACjE,YAAY,CAAC,EAAE,YAAY,CAAC;CAC5B;AAED,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAC5D,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/core/annotation/options.ts"],"names":[],"mappings":"","sourcesContent":["import type { Class, TypeOf } from '../utils/typeof.js';\nimport { DomNode } from '@ibyar/elements';\nimport { 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 = Class> {\n\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\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\n\t/**\n\t * style for this element\n\t */\n\tstyles?: string | { [key: string]: string }[];\n\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 * also, support extends a custom element tag name.\n\t */\n\textend?: keyof HTMLElementTagNameMap | `${string}-${string}`;\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 app root element as \n\t * \n\t * ```html\n\t * <app-root></app-root>\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 * \tconst 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 * <app-root [version]=\"appVersion\" \n\t * \t\tonclick=\"onRootAppClick()\"\n\t * \t\t(save)=\"onSave()\" >\n\t * </app-root>\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' when encapsulation used,\n\t * otherwise it is undefined and will not attach shadow root element.\n\t */\n\tshadowDomMode?: ShadowRootMode;\n\n\t/**\n\t * default: false\n\t */\n\tshadowDomDelegatesFocus?: boolean;\n\n\t/**\n\t * shadow root initialization options,\n\t * default mode: `open`, delegatesFocus: `false` and slotAssignment: `manual`\n\t */\n\tshadowRootInit?: Partial<ShadowRootInit>;\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\n\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 type OutputEventInit = Omit<EventInit, 'cancelable'>;\nexport type OutputOptions = { name?: string } & OutputEventInit;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExpressionNode,
|
|
1
|
+
import { Context, ExpressionNode, Identifier, InfixExpressionNode, MemberExpression, NodeDeserializer, ScopeSubscription, Stack, VisitNodeType } from '@ibyar/expressions';
|
|
2
2
|
type OneWayOperator = '=:';
|
|
3
3
|
type TwoWayOperator = '=::';
|
|
4
4
|
type BindingOperators = OneWayOperator | TwoWayOperator;
|
|
@@ -40,3 +40,4 @@ export declare class TwoWayAssignmentExpression extends InfixExpressionNode<TwoW
|
|
|
40
40
|
subscribe(stack: Stack): ScopeSubscription<Context>[];
|
|
41
41
|
}
|
|
42
42
|
export {};
|
|
43
|
+
//# sourceMappingURL=binding.expressions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binding.expressions.d.ts","sourceRoot":"","sources":["../../../src/core/binding/binding.expressions.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,OAAO,EAAoC,cAAc,EACzD,UAAU,EAAE,mBAAmB,EAAE,gBAAgB,EACjD,gBAAgB,EAAwB,iBAAiB,EACzD,KAAK,EAAwB,aAAa,EAE1C,MAAM,oBAAoB,CAAC;AAK5B,KAAK,cAAc,GAAG,IAAI,CAAC;AAC3B,KAAK,cAAc,GAAG,KAAK,CAAC;AAC5B,KAAK,gBAAgB,GAAG,cAAc,GAAG,cAAc,CAAC;AAExD,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB,CAAC,gBAAgB,CAAC;IAC/E,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAAE,CAAC;CAChF;AAGD,qBACa,0BAA2B,SAAQ,mBAAmB,CAAC,cAAc,CAAE,YAAW,iBAAiB;IAC/G,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,0BAA0B,EAAE,YAAY,EAAE,gBAAgB,GAAG,0BAA0B;IAM7G,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,0BAA0B,EAAE,SAAS,EAAE,aAAa,GAAG,IAAI;IAK9E,UAAkB,IAAI,EAAE,gBAAgB,CAAC;IACzC,OAAO,CAAC,WAAW,CAAuB;gBAC9B,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,cAAc;IAGzD,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG;IAG5B,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG;IAKtB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAAE;CA+B/E;AAGD;;;;GAIG;AACH,qBACa,0BAA2B,SAAQ,mBAAmB,CAAC,cAAc,CAAE,YAAW,iBAAiB;IAC/G,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,0BAA0B,EAAE,YAAY,EAAE,gBAAgB,GAAG,0BAA0B;IAM7G,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,0BAA0B,EAAE,SAAS,EAAE,aAAa,GAAG,IAAI;IAK9E,UAAkB,IAAI,EAAE,gBAAgB,CAAC;IACzC,UAAkB,KAAK,EAAE,gBAAgB,GAAG,UAAU,CAAC;IAEvD,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,UAAU,CAAqB;gBAC3B,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,gBAAgB,GAAG,UAAU;IAMxE,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG;IAG5B,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG;IAItB,OAAO,CAAC,MAAM;IAGd,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,MAAM;IAGd,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,iBAAiB;IASzB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAAE;CAerD"}
|
|
@@ -1,136 +1,161 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { InfixExpressionNode, findReactiveScopeByEventMap, Scope, MemberExpression, Deserializer } from '@ibyar/expressions';
|
|
4
|
-
import { createSubscriptionDestroyer } from '../context/subscription.js';
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { Deserializer, InfixExpressionNode, Scope, findReactiveScopeByEventMap } from '@ibyar/expressions';
|
|
5
3
|
import { isOnDestroy } from '../component/lifecycle.js';
|
|
4
|
+
import { createSubscriptionDestroyer } from '../context/subscription.js';
|
|
6
5
|
import { AsyncPipeProvider, AsyncPipeScope, PipeProvider } from '../pipe/pipe.js';
|
|
7
|
-
let OneWayAssignmentExpression =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
6
|
+
let OneWayAssignmentExpression = (() => {
|
|
7
|
+
let _classDecorators = [Deserializer('OneWayAssignment')];
|
|
8
|
+
let _classDescriptor;
|
|
9
|
+
let _classExtraInitializers = [];
|
|
10
|
+
let _classThis;
|
|
11
|
+
let _classSuper = InfixExpressionNode;
|
|
12
|
+
var OneWayAssignmentExpression = class extends _classSuper {
|
|
13
|
+
static { _classThis = this; }
|
|
14
|
+
static {
|
|
15
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
16
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
17
|
+
OneWayAssignmentExpression = _classThis = _classDescriptor.value;
|
|
18
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
19
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
20
|
+
}
|
|
21
|
+
static fromJSON(node, deserializer) {
|
|
22
|
+
return new OneWayAssignmentExpression(deserializer(node.left), deserializer(node.right));
|
|
23
|
+
}
|
|
24
|
+
static visit(node, visitNode) {
|
|
25
|
+
visitNode(node.left);
|
|
26
|
+
visitNode(node.right);
|
|
27
|
+
}
|
|
28
|
+
rightEvents = this.right.events();
|
|
29
|
+
constructor(left, right) {
|
|
30
|
+
super('=:', left, right);
|
|
31
|
+
}
|
|
32
|
+
set(stack, value) {
|
|
33
|
+
return this.left.set(stack, value);
|
|
34
|
+
}
|
|
35
|
+
get(stack) {
|
|
36
|
+
const rv = this.right.get(stack);
|
|
37
|
+
this.set(stack, rv);
|
|
38
|
+
return rv;
|
|
39
|
+
}
|
|
40
|
+
subscribe(stack, pipelineNames) {
|
|
41
|
+
const subscriptions = [];
|
|
42
|
+
if (pipelineNames?.length) {
|
|
43
|
+
const syncPipeScope = Scope.blockScope();
|
|
44
|
+
const asyncPipeScope = AsyncPipeScope.blockScope();
|
|
45
|
+
let hasAsync = false, hasSync = false;
|
|
46
|
+
pipelineNames.forEach(pipelineName => {
|
|
47
|
+
const scope = stack.findScope(pipelineName);
|
|
48
|
+
const pipe = scope.get(pipelineName);
|
|
49
|
+
if (scope instanceof AsyncPipeProvider) {
|
|
50
|
+
hasAsync = true;
|
|
51
|
+
asyncPipeScope.set(pipelineName, pipe);
|
|
52
|
+
if (isOnDestroy(pipe.prototype)) {
|
|
53
|
+
subscriptions.push(createSubscriptionDestroyer(() => asyncPipeScope.unsubscribe(pipelineName)));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else if (scope instanceof PipeProvider) {
|
|
57
|
+
hasSync = true;
|
|
58
|
+
syncPipeScope.set(pipelineName, pipe);
|
|
41
59
|
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
60
|
+
});
|
|
61
|
+
hasSync && stack.pushScope(syncPipeScope);
|
|
62
|
+
hasAsync && stack.pushScope(asyncPipeScope);
|
|
63
|
+
}
|
|
64
|
+
const tuples = findReactiveScopeByEventMap(this.rightEvents, stack);
|
|
65
|
+
const callback = () => this.get(stack);
|
|
66
|
+
tuples.forEach(tuple => {
|
|
67
|
+
const subscription = tuple[1].subscribe(tuple[0], callback);
|
|
68
|
+
subscriptions.push(subscription);
|
|
47
69
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
tuples.forEach(tuple => {
|
|
54
|
-
const subscription = tuple[1].subscribe(tuple[0], callback);
|
|
55
|
-
subscriptions.push(subscription);
|
|
56
|
-
});
|
|
57
|
-
return subscriptions;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
OneWayAssignmentExpression = OneWayAssignmentExpression_1 = __decorate([
|
|
61
|
-
Deserializer('OneWayAssignment'),
|
|
62
|
-
__metadata("design:paramtypes", [MemberExpression, Object])
|
|
63
|
-
], OneWayAssignmentExpression);
|
|
70
|
+
return subscriptions;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
return OneWayAssignmentExpression = _classThis;
|
|
74
|
+
})();
|
|
64
75
|
export { OneWayAssignmentExpression };
|
|
65
76
|
/**
|
|
66
77
|
* the default behavior is assign the right hand side to the left hand side.
|
|
67
78
|
*
|
|
68
79
|
*
|
|
69
80
|
*/
|
|
70
|
-
let TwoWayAssignmentExpression =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
81
|
+
let TwoWayAssignmentExpression = (() => {
|
|
82
|
+
let _classDecorators = [Deserializer('TwoWayAssignment')];
|
|
83
|
+
let _classDescriptor;
|
|
84
|
+
let _classExtraInitializers = [];
|
|
85
|
+
let _classThis;
|
|
86
|
+
let _classSuper = InfixExpressionNode;
|
|
87
|
+
var TwoWayAssignmentExpression = class extends _classSuper {
|
|
88
|
+
static { _classThis = this; }
|
|
89
|
+
static {
|
|
90
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
91
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
92
|
+
TwoWayAssignmentExpression = _classThis = _classDescriptor.value;
|
|
93
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
94
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
95
|
+
}
|
|
96
|
+
static fromJSON(node, deserializer) {
|
|
97
|
+
return new TwoWayAssignmentExpression(deserializer(node.left), deserializer(node.right));
|
|
98
|
+
}
|
|
99
|
+
static visit(node, visitNode) {
|
|
100
|
+
visitNode(node.left);
|
|
101
|
+
visitNode(node.right);
|
|
102
|
+
}
|
|
103
|
+
rightEvents;
|
|
104
|
+
leftEvents;
|
|
105
|
+
constructor(left, right) {
|
|
106
|
+
super('=::', left, right);
|
|
107
|
+
this.rightEvents = this.right.events();
|
|
108
|
+
this.leftEvents = this.left.events();
|
|
109
|
+
}
|
|
110
|
+
set(stack, value) {
|
|
111
|
+
return this.setRTL(stack, value);
|
|
112
|
+
}
|
|
113
|
+
get(stack) {
|
|
114
|
+
return this.getRTL(stack);
|
|
115
|
+
}
|
|
116
|
+
setRTL(stack, value) {
|
|
117
|
+
return this.left.set(stack, value);
|
|
118
|
+
}
|
|
119
|
+
getRTL(stack) {
|
|
120
|
+
const rv = this.right.get(stack);
|
|
121
|
+
this.setRTL(stack, rv);
|
|
122
|
+
return rv;
|
|
123
|
+
}
|
|
124
|
+
actionRTL(stack) {
|
|
125
|
+
return () => this.getRTL(stack);
|
|
126
|
+
}
|
|
127
|
+
setLTR(stack, value) {
|
|
128
|
+
return this.right.set(stack, value);
|
|
129
|
+
}
|
|
130
|
+
getLTR(stack) {
|
|
131
|
+
const lv = this.left.get(stack);
|
|
132
|
+
this.setLTR(stack, lv);
|
|
133
|
+
return lv;
|
|
134
|
+
}
|
|
135
|
+
actionLTR(stack) {
|
|
136
|
+
return () => this.getLTR(stack);
|
|
137
|
+
}
|
|
138
|
+
subscribeToEvents(stack, tuples, actionCallback) {
|
|
139
|
+
const subscriptions = [];
|
|
140
|
+
tuples.forEach(tuple => {
|
|
141
|
+
const subscription = tuple[1].subscribe(tuple[0], actionCallback);
|
|
142
|
+
subscriptions.push(subscription);
|
|
143
|
+
});
|
|
144
|
+
return subscriptions;
|
|
145
|
+
}
|
|
146
|
+
subscribe(stack) {
|
|
147
|
+
// right to left
|
|
148
|
+
const rightTuples = findReactiveScopeByEventMap(this.rightEvents, stack);
|
|
149
|
+
const rtlAction = this.actionRTL(stack);
|
|
150
|
+
const rtlSubscriptions = this.subscribeToEvents(stack, rightTuples, rtlAction);
|
|
151
|
+
// left to right
|
|
152
|
+
const leftTuples = findReactiveScopeByEventMap(this.leftEvents, stack);
|
|
153
|
+
const ltrAction = this.actionLTR(stack);
|
|
154
|
+
const ltrSubscriptions = this.subscribeToEvents(stack, leftTuples, ltrAction);
|
|
155
|
+
return rtlSubscriptions.concat(ltrSubscriptions);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
return TwoWayAssignmentExpression = _classThis;
|
|
159
|
+
})();
|
|
135
160
|
export { TwoWayAssignmentExpression };
|
|
136
161
|
//# sourceMappingURL=binding.expressions.js.map
|