@microsoft/fast-element 1.10.1 → 2.0.0-beta.2

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 (106) hide show
  1. package/.eslintrc.json +1 -12
  2. package/CHANGELOG.json +432 -1
  3. package/CHANGELOG.md +74 -2
  4. package/README.md +2 -2
  5. package/dist/dts/components/attributes.d.ts +4 -1
  6. package/dist/dts/components/controller.d.ts +12 -11
  7. package/dist/dts/components/fast-definitions.d.ts +10 -2
  8. package/dist/dts/components/fast-element.d.ts +12 -5
  9. package/dist/dts/context.d.ts +157 -0
  10. package/dist/dts/debug.d.ts +1 -0
  11. package/dist/dts/hooks.d.ts +20 -0
  12. package/dist/dts/index.d.ts +16 -15
  13. package/dist/dts/index.debug.d.ts +2 -0
  14. package/dist/dts/index.rollup.d.ts +2 -0
  15. package/dist/dts/index.rollup.debug.d.ts +3 -0
  16. package/dist/dts/interfaces.d.ts +144 -0
  17. package/dist/dts/metadata.d.ts +25 -0
  18. package/dist/dts/observation/arrays.d.ts +207 -0
  19. package/dist/dts/observation/behavior.d.ts +4 -4
  20. package/dist/dts/observation/notifier.d.ts +18 -18
  21. package/dist/dts/observation/observable.d.ts +56 -18
  22. package/dist/dts/observation/splice-strategies.d.ts +13 -0
  23. package/dist/dts/observation/update-queue.d.ts +40 -0
  24. package/dist/dts/platform.d.ts +18 -67
  25. package/dist/dts/polyfills.d.ts +8 -0
  26. package/dist/dts/styles/css-directive.d.ts +43 -5
  27. package/dist/dts/styles/css.d.ts +19 -3
  28. package/dist/dts/styles/element-styles.d.ts +42 -62
  29. package/dist/dts/templating/binding-signal.d.ts +38 -0
  30. package/dist/dts/templating/binding-two-way.d.ts +56 -0
  31. package/dist/dts/templating/binding.d.ts +233 -65
  32. package/dist/dts/templating/children.d.ts +18 -15
  33. package/dist/dts/templating/compiler.d.ts +46 -28
  34. package/dist/dts/templating/dom.d.ts +41 -0
  35. package/dist/dts/templating/html-directive.d.ts +179 -43
  36. package/dist/dts/templating/markup.d.ts +48 -0
  37. package/dist/dts/templating/node-observation.d.ts +45 -29
  38. package/dist/dts/templating/ref.d.ts +6 -12
  39. package/dist/dts/templating/repeat.d.ts +26 -14
  40. package/dist/dts/templating/slotted.d.ts +13 -14
  41. package/dist/dts/templating/template.d.ts +27 -21
  42. package/dist/dts/templating/view.d.ts +15 -22
  43. package/dist/{tsdoc-metadata.json → dts/tsdoc-metadata.json} +1 -1
  44. package/dist/dts/utilities.d.ts +40 -0
  45. package/dist/esm/components/attributes.js +25 -24
  46. package/dist/esm/components/controller.js +77 -57
  47. package/dist/esm/components/fast-definitions.js +16 -22
  48. package/dist/esm/components/fast-element.js +10 -2
  49. package/dist/esm/context.js +159 -0
  50. package/dist/esm/debug.js +29 -0
  51. package/dist/esm/hooks.js +32 -0
  52. package/dist/esm/index.debug.js +2 -0
  53. package/dist/esm/index.js +19 -14
  54. package/dist/esm/index.rollup.debug.js +3 -0
  55. package/dist/esm/index.rollup.js +2 -0
  56. package/dist/esm/interfaces.js +8 -1
  57. package/dist/esm/metadata.js +60 -0
  58. package/dist/esm/observation/arrays.js +269 -0
  59. package/dist/esm/observation/notifier.js +75 -83
  60. package/dist/esm/observation/observable.js +93 -68
  61. package/dist/esm/observation/{array-change-records.js → splice-strategies.js} +136 -62
  62. package/dist/esm/observation/update-queue.js +67 -0
  63. package/dist/esm/platform.js +36 -42
  64. package/dist/esm/polyfills.js +85 -0
  65. package/dist/esm/styles/css-directive.js +29 -13
  66. package/dist/esm/styles/css.js +27 -40
  67. package/dist/esm/styles/element-styles.js +65 -104
  68. package/dist/esm/templating/binding-signal.js +84 -0
  69. package/dist/esm/templating/binding-two-way.js +76 -0
  70. package/dist/esm/templating/binding.js +306 -153
  71. package/dist/esm/templating/children.js +33 -23
  72. package/dist/esm/templating/compiler.js +235 -152
  73. package/dist/esm/templating/dom.js +49 -0
  74. package/dist/esm/templating/html-directive.js +125 -40
  75. package/dist/esm/templating/markup.js +75 -0
  76. package/dist/esm/templating/node-observation.js +50 -45
  77. package/dist/esm/templating/ref.js +7 -16
  78. package/dist/esm/templating/repeat.js +39 -36
  79. package/dist/esm/templating/slotted.js +23 -20
  80. package/dist/esm/templating/template.js +51 -95
  81. package/dist/esm/templating/view.js +44 -43
  82. package/dist/esm/templating/when.js +2 -1
  83. package/dist/esm/utilities.js +139 -0
  84. package/dist/fast-element.api.json +11789 -5377
  85. package/dist/fast-element.d.ts +1177 -531
  86. package/dist/fast-element.debug.js +3717 -0
  87. package/dist/fast-element.debug.min.js +1 -0
  88. package/dist/fast-element.js +3466 -4022
  89. package/dist/fast-element.min.js +1 -1
  90. package/dist/fast-element.untrimmed.d.ts +2697 -0
  91. package/docs/api-report.md +472 -219
  92. package/docs/fast-element-2-changes.md +15 -0
  93. package/docs/guide/declaring-templates.md +5 -4
  94. package/docs/guide/defining-elements.md +3 -2
  95. package/docs/guide/leveraging-css.md +1 -0
  96. package/docs/guide/next-steps.md +3 -2
  97. package/docs/guide/observables-and-state.md +2 -1
  98. package/docs/guide/using-directives.md +2 -1
  99. package/docs/guide/working-with-shadow-dom.md +1 -0
  100. package/karma.conf.cjs +6 -17
  101. package/package.json +65 -15
  102. package/dist/dts/dom.d.ts +0 -112
  103. package/dist/dts/observation/array-change-records.d.ts +0 -48
  104. package/dist/dts/observation/array-observer.d.ts +0 -9
  105. package/dist/esm/dom.js +0 -207
  106. package/dist/esm/observation/array-observer.js +0 -173
@@ -0,0 +1,2697 @@
1
+ /**
2
+ * Represents a getter/setter property accessor on an object.
3
+ * @public
4
+ */
5
+ export declare interface Accessor {
6
+ /**
7
+ * The name of the property.
8
+ */
9
+ name: string;
10
+ /**
11
+ * Gets the value of the property on the source object.
12
+ * @param source - The source object to access.
13
+ */
14
+ getValue(source: any): any;
15
+ /**
16
+ * Sets the value of the property on the source object.
17
+ * @param source - The source object to access.
18
+ * @param value - The value to set the property to.
19
+ */
20
+ setValue(source: any, value: any): void;
21
+ }
22
+
23
+ /**
24
+ * Used to add behaviors when constructing styles.
25
+ * @public
26
+ */
27
+ export declare type AddBehavior = (behavior: Behavior<HTMLElement>) => void;
28
+
29
+ /**
30
+ * Used to add behavior factories when constructing templates.
31
+ * @public
32
+ */
33
+ export declare type AddViewBehaviorFactory = (factory: ViewBehaviorFactory) => string;
34
+
35
+ /**
36
+ * https://wicg.github.io/construct-stylesheets/
37
+ * https://developers.google.com/web/updates/2019/02/constructable-stylesheets
38
+ *
39
+ * @internal
40
+ */
41
+ export declare class AdoptedStyleSheetsStrategy implements StyleStrategy {
42
+ /** @internal */
43
+ readonly sheets: CSSStyleSheet[];
44
+ constructor(styles: (string | CSSStyleSheet)[]);
45
+ addStylesTo(target: StyleTarget): void;
46
+ removeStylesFrom(target: StyleTarget): void;
47
+ }
48
+
49
+ /**
50
+ * An observer for arrays.
51
+ * @public
52
+ */
53
+ export declare interface ArrayObserver extends SubscriberSet {
54
+ /**
55
+ * The strategy to use for tracking changes.
56
+ */
57
+ strategy: SpliceStrategy | null;
58
+ /**
59
+ * The length observer for the array.
60
+ */
61
+ readonly lengthObserver: LengthObserver;
62
+ /**
63
+ * Adds a splice to the list of changes.
64
+ * @param splice - The splice to add.
65
+ */
66
+ addSplice(splice: Splice): void;
67
+ /**
68
+ * Indicates that a reset change has occurred.
69
+ * @param oldCollection - The collection as it was before the reset.
70
+ */
71
+ reset(oldCollection: any[] | undefined): void;
72
+ /**
73
+ * Flushes the changes to subscribers.
74
+ */
75
+ flush(): void;
76
+ }
77
+
78
+ /**
79
+ * An observer for arrays.
80
+ * @public
81
+ */
82
+ export declare const ArrayObserver: Readonly<{
83
+ /**
84
+ * Enables the array observation mechanism.
85
+ * @remarks
86
+ * Array observation is enabled automatically when using the
87
+ * {@link RepeatDirective}, so calling this API manually is
88
+ * not typically necessary.
89
+ */
90
+ readonly enable: () => void;
91
+ }>;
92
+
93
+ /**
94
+ * The type of HTML aspect to target.
95
+ * @public
96
+ */
97
+ export declare const Aspect: Readonly<{
98
+ /**
99
+ * Not aspected.
100
+ */
101
+ readonly none: 0;
102
+ /**
103
+ * An attribute.
104
+ */
105
+ readonly attribute: 1;
106
+ /**
107
+ * A boolean attribute.
108
+ */
109
+ readonly booleanAttribute: 2;
110
+ /**
111
+ * A property.
112
+ */
113
+ readonly property: 3;
114
+ /**
115
+ * Content
116
+ */
117
+ readonly content: 4;
118
+ /**
119
+ * A token list.
120
+ */
121
+ readonly tokenList: 5;
122
+ /**
123
+ * An event.
124
+ */
125
+ readonly event: 6;
126
+ /**
127
+ *
128
+ * @param directive - The directive to assign the aspect to.
129
+ * @param value - The value to base the aspect determination on.
130
+ */
131
+ readonly assign: (directive: Aspected, value: string) => void;
132
+ }>;
133
+
134
+ /**
135
+ * The type of HTML aspect to target.
136
+ * @public
137
+ */
138
+ export declare type Aspect = typeof Aspect[Exclude<keyof typeof Aspect, "assign" | "none">];
139
+
140
+ /**
141
+ * Represents something that applies to a specific aspect of the DOM.
142
+ * @public
143
+ */
144
+ export declare interface Aspected {
145
+ /**
146
+ * The original source aspect exactly as represented in markup.
147
+ */
148
+ sourceAspect: string;
149
+ /**
150
+ * The evaluated target aspect, determined after processing the source.
151
+ */
152
+ targetAspect: string;
153
+ /**
154
+ * The type of aspect to target.
155
+ */
156
+ aspectType: Aspect;
157
+ /**
158
+ * A binding if one is associated with the aspect.
159
+ */
160
+ binding?: Binding;
161
+ }
162
+
163
+ /**
164
+ * Decorator: Specifies an HTML attribute.
165
+ * @param config - The configuration for the attribute.
166
+ * @public
167
+ */
168
+ export declare function attr(config?: DecoratorAttributeConfiguration): (target: {}, property: string) => void;
169
+
170
+ /**
171
+ * Decorator: Specifies an HTML attribute.
172
+ * @param target - The class to define the attribute on.
173
+ * @param prop - The property name to be associated with the attribute.
174
+ * @public
175
+ */
176
+ export declare function attr(target: {}, prop: string): void;
177
+
178
+ /**
179
+ * Metadata used to configure a custom attribute's behavior.
180
+ * @public
181
+ */
182
+ export declare type AttributeConfiguration = {
183
+ property: string;
184
+ attribute?: string;
185
+ mode?: AttributeMode;
186
+ converter?: ValueConverter;
187
+ };
188
+
189
+ /**
190
+ * An implementation of {@link Accessor} that supports reactivity,
191
+ * change callbacks, attribute reflection, and type conversion for
192
+ * custom elements.
193
+ * @public
194
+ */
195
+ export declare class AttributeDefinition implements Accessor {
196
+ private readonly fieldName;
197
+ private readonly callbackName;
198
+ private readonly hasCallback;
199
+ private readonly guards;
200
+ /**
201
+ * The class constructor that owns this attribute.
202
+ */
203
+ readonly Owner: Function;
204
+ /**
205
+ * The name of the property associated with the attribute.
206
+ */
207
+ readonly name: string;
208
+ /**
209
+ * The name of the attribute in HTML.
210
+ */
211
+ readonly attribute: string;
212
+ /**
213
+ * The {@link AttributeMode} that describes the behavior of this attribute.
214
+ */
215
+ readonly mode: AttributeMode;
216
+ /**
217
+ * A {@link ValueConverter} that integrates with the property getter/setter
218
+ * to convert values to and from a DOM string.
219
+ */
220
+ readonly converter?: ValueConverter;
221
+ /**
222
+ * Creates an instance of AttributeDefinition.
223
+ * @param Owner - The class constructor that owns this attribute.
224
+ * @param name - The name of the property associated with the attribute.
225
+ * @param attribute - The name of the attribute in HTML.
226
+ * @param mode - The {@link AttributeMode} that describes the behavior of this attribute.
227
+ * @param converter - A {@link ValueConverter} that integrates with the property getter/setter
228
+ * to convert values to and from a DOM string.
229
+ */
230
+ constructor(Owner: Function, name: string, attribute?: string, mode?: AttributeMode, converter?: ValueConverter);
231
+ /**
232
+ * Sets the value of the attribute/property on the source element.
233
+ * @param source - The source element to access.
234
+ * @param value - The value to set the attribute/property to.
235
+ */
236
+ setValue(source: HTMLElement, newValue: any): void;
237
+ /**
238
+ * Gets the value of the attribute/property on the source element.
239
+ * @param source - The source element to access.
240
+ */
241
+ getValue(source: HTMLElement): any;
242
+ /** @internal */
243
+ onAttributeChangedCallback(element: HTMLElement, value: any): void;
244
+ private tryReflectToAttribute;
245
+ /**
246
+ * Collects all attribute definitions associated with the owner.
247
+ * @param Owner - The class constructor to collect attribute for.
248
+ * @param attributeLists - Any existing attributes to collect and merge with those associated with the owner.
249
+ * @internal
250
+ */
251
+ static collect(Owner: Function, ...attributeLists: (ReadonlyArray<string | AttributeConfiguration> | undefined)[]): ReadonlyArray<AttributeDefinition>;
252
+ }
253
+
254
+ /**
255
+ * The mode that specifies the runtime behavior of the attribute.
256
+ * @remarks
257
+ * By default, attributes run in `reflect` mode, propagating their property
258
+ * values to the DOM and DOM values to the property. The `boolean` mode also
259
+ * reflects values, but uses the HTML standard boolean attribute behavior,
260
+ * interpreting the presence of the attribute as `true` and the absence as
261
+ * `false`. The `fromView` behavior only updates the property value based on
262
+ * changes in the DOM, but does not reflect property changes back.
263
+ * @public
264
+ */
265
+ export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "fromView";
266
+
267
+ /**
268
+ * Represents an object that can contribute behavior to a view or
269
+ * element's bind/unbind operations.
270
+ * @public
271
+ */
272
+ export declare interface Behavior<TSource = any, TParent = any> {
273
+ /**
274
+ * Bind this behavior to the source.
275
+ * @param source - The source to bind to.
276
+ * @param context - The execution context that the binding is operating within.
277
+ */
278
+ bind(source: TSource, context: ExecutionContext<TParent>): void;
279
+ /**
280
+ * Unbinds this behavior from the source.
281
+ * @param source - The source to unbind from.
282
+ */
283
+ unbind(source: TSource, context: ExecutionContext<TParent>): void;
284
+ }
285
+
286
+ /**
287
+ * Creates a binding directive with the specified configuration.
288
+ * @param binding - The binding expression.
289
+ * @param config - The binding configuration.
290
+ * @returns A binding directive.
291
+ * @public
292
+ */
293
+ export declare function bind<T = any>(binding: Binding<T>, config?: BindingConfig | DefaultBindingOptions): CaptureType<T>;
294
+
295
+ /**
296
+ * The signature of an arrow function capable of being evaluated
297
+ * as part of a template binding update.
298
+ * @public
299
+ */
300
+ export declare type Binding<TSource = any, TReturn = any, TParent = any> = (source: TSource, context: ExecutionContext<TParent>) => TReturn;
301
+
302
+ /**
303
+ * Describes the configuration for a binding expression.
304
+ * @public
305
+ */
306
+ export declare interface BindingConfig<T = any> {
307
+ /**
308
+ * The binding mode to configure the binding with.
309
+ */
310
+ mode: BindingMode;
311
+ /**
312
+ * Options to be supplied to the binding behaviors.
313
+ */
314
+ options: T;
315
+ }
316
+
317
+ /**
318
+ * Describes the configuration for a binding expression.
319
+ * @public
320
+ */
321
+ export declare const BindingConfig: Readonly<{
322
+ /**
323
+ * Creates a binding configuration based on the provided mode and options.
324
+ * @param mode - The mode to use for the configuration.
325
+ * @param defaultOptions - The default options to use for the configuration.
326
+ * @returns A new binding configuration.
327
+ */
328
+ define<T>(mode: BindingMode, defaultOptions: T): BindingConfig<T> & BindingConfigResolver<T>;
329
+ }>;
330
+
331
+ /**
332
+ * Creates a new binding configuration based on the supplied options.
333
+ * @public
334
+ */
335
+ export declare type BindingConfigResolver<T> = (options: T) => BindingConfig<T>;
336
+
337
+ /**
338
+ * Describes how aspects of an HTML element will be affected by bindings.
339
+ * @public
340
+ */
341
+ export declare type BindingMode = Record<Aspect, (directive: HTMLBindingDirective) => Pick<ViewBehaviorFactory, "createBehavior">>;
342
+
343
+ /**
344
+ * Describes how aspects of an HTML element will be affected by bindings.
345
+ * @public
346
+ */
347
+ export declare const BindingMode: Readonly<{
348
+ /**
349
+ * Creates a binding mode based on the supplied behavior types.
350
+ * @param UpdateType - The base behavior type used to update aspects.
351
+ * @param EventType - The base behavior type used to respond to events.
352
+ * @returns A new binding mode.
353
+ */
354
+ define(UpdateType: typeof UpdateBinding, EventType?: typeof EventBinding): BindingMode;
355
+ }>;
356
+
357
+ /**
358
+ * Enables evaluation of and subscription to a binding.
359
+ * @public
360
+ */
361
+ export declare interface BindingObserver<TSource = any, TReturn = any, TParent = any> extends Notifier, Disposable {
362
+ /**
363
+ * Begins observing the binding for the source and returns the current value.
364
+ * @param source - The source that the binding is based on.
365
+ * @param context - The execution context to execute the binding within.
366
+ * @returns The value of the binding.
367
+ */
368
+ observe(source: TSource, context?: ExecutionContext<TParent>): TReturn;
369
+ /**
370
+ * Gets {@link ObservationRecord|ObservationRecords} that the {@link BindingObserver}
371
+ * is observing.
372
+ */
373
+ records(): IterableIterator<ObservationRecord>;
374
+ /**
375
+ * Sets the update mode used by the observer.
376
+ * @param isAsync - Indicates whether updates should be asynchronous.
377
+ * @remarks
378
+ * By default, the update mode is asynchronous, since that provides the best
379
+ * performance for template rendering scenarios. Passing false to setMode will
380
+ * instead cause the observer to notify subscribers immediately when changes occur.
381
+ */
382
+ setMode(isAsync: boolean): void;
383
+ }
384
+
385
+ /**
386
+ * A {@link ValueConverter} that converts to and from `boolean` values.
387
+ * @remarks
388
+ * Used automatically when the `boolean` {@link AttributeMode} is selected.
389
+ * @public
390
+ */
391
+ export declare const booleanConverter: ValueConverter;
392
+
393
+ declare const booleanMode = "boolean";
394
+
395
+ /**
396
+ * Represents a callable type such as a function or an object with a "call" method.
397
+ * @public
398
+ */
399
+ export declare type Callable = typeof Function.prototype.call | {
400
+ call(): void;
401
+ };
402
+
403
+ /**
404
+ * A marker interface used to capture types when interpolating Directive helpers
405
+ * into templates.
406
+ * @public
407
+ */
408
+ export declare interface CaptureType<TSource> {
409
+ }
410
+
411
+ /**
412
+ * A binding behavior for bindings that change.
413
+ * @public
414
+ */
415
+ export declare class ChangeBinding extends UpdateBinding {
416
+ private isBindingVolatile;
417
+ private observerProperty;
418
+ /**
419
+ * Creates an instance of ChangeBinding.
420
+ * @param directive - The directive that has the configuration for this behavior.
421
+ * @param updateTarget - The function used to update the target with the latest value.
422
+ */
423
+ constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
424
+ /**
425
+ * Returns the binding observer used to update the node.
426
+ * @param target - The target node.
427
+ * @returns A BindingObserver.
428
+ */
429
+ protected getObserver(target: Node): BindingObserver;
430
+ /**
431
+ * Bind this behavior to the source.
432
+ * @param source - The source to bind to.
433
+ * @param context - The execution context that the binding is operating within.
434
+ * @param targets - The targets that behaviors in a view can attach to.
435
+ */
436
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
437
+ /**
438
+ * Unbinds this behavior from the source.
439
+ * @param source - The source to unbind from.
440
+ * @param context - The execution context that the binding is operating within.
441
+ * @param targets - The targets that behaviors in a view can attach to.
442
+ */
443
+ unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
444
+ /** @internal */
445
+ handleChange(binding: Binding, observer: BindingObserver): void;
446
+ }
447
+
448
+ /**
449
+ * The options used to configure child list observation.
450
+ * @public
451
+ */
452
+ export declare interface ChildListDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, Omit<MutationObserverInit, "subtree" | "childList"> {
453
+ }
454
+
455
+ /**
456
+ * A directive that observes the `childNodes` of an element and updates a property
457
+ * whenever they change.
458
+ * @param propertyOrOptions - The options used to configure child node observation.
459
+ * @public
460
+ */
461
+ export declare function children<T = any>(propertyOrOptions: (keyof T & string) | ChildrenDirectiveOptions<keyof T & string>): CaptureType<T>;
462
+
463
+ /**
464
+ * The runtime behavior for child node observation.
465
+ * @public
466
+ */
467
+ export declare class ChildrenDirective extends NodeObservationDirective<ChildrenDirectiveOptions> {
468
+ private observerProperty;
469
+ /**
470
+ * Creates an instance of ChildrenDirective.
471
+ * @param options - The options to use in configuring the child observation behavior.
472
+ */
473
+ constructor(options: ChildrenDirectiveOptions);
474
+ /**
475
+ * Begins observation of the nodes.
476
+ * @param target - The target to observe.
477
+ */
478
+ observe(target: any): void;
479
+ /**
480
+ * Disconnects observation of the nodes.
481
+ * @param target - The target to unobserve.
482
+ */
483
+ disconnect(target: any): void;
484
+ /**
485
+ * Retrieves the raw nodes that should be assigned to the source property.
486
+ * @param target - The target to get the node to.
487
+ */
488
+ getNodes(target: Element): Node[];
489
+ private handleEvent;
490
+ }
491
+
492
+ /**
493
+ * The options used to configure child/subtree node observation.
494
+ * @public
495
+ */
496
+ export declare type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | SubtreeDirectiveOptions<T>;
497
+
498
+ /**
499
+ * A function capable of compiling a template from the preprocessed form produced
500
+ * by the html template function into a result that can instantiate views.
501
+ * @public
502
+ */
503
+ export declare type CompilationStrategy = (
504
+ /**
505
+ * The preprocessed HTML string or template to compile.
506
+ */
507
+ html: string | HTMLTemplateElement,
508
+ /**
509
+ * The behavior factories used within the html that is being compiled.
510
+ */
511
+ factories: Record<string, ViewBehaviorFactory>) => HTMLTemplateCompilationResult;
512
+
513
+ /**
514
+ * Common APIs related to compilation.
515
+ * @public
516
+ */
517
+ export declare const Compiler: {
518
+ /**
519
+ * Sets the HTML trusted types policy used by the compiler.
520
+ * @param policy - The policy to set for HTML.
521
+ * @remarks
522
+ * This API can only be called once, for security reasons. It should be
523
+ * called by the application developer at the start of their program.
524
+ */
525
+ setHTMLPolicy(policy: TrustedTypesPolicy): void;
526
+ /**
527
+ * Compiles a template and associated directives into a compilation
528
+ * result which can be used to create views.
529
+ * @param html - The html string or template element to compile.
530
+ * @param directives - The directives referenced by the template.
531
+ * @remarks
532
+ * The template that is provided for compilation is altered in-place
533
+ * and cannot be compiled again. If the original template must be preserved,
534
+ * it is recommended that you clone the original and pass the clone to this API.
535
+ * @public
536
+ */
537
+ compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, directives: Record<string, ViewBehaviorFactory>): HTMLTemplateCompilationResult<TSource, TParent>;
538
+ /**
539
+ * Sets the default compilation strategy that will be used by the ViewTemplate whenever
540
+ * it needs to compile a view preprocessed with the html template function.
541
+ * @param strategy - The compilation strategy to use when compiling templates.
542
+ */
543
+ setDefaultStrategy(strategy: CompilationStrategy): void;
544
+ /**
545
+ * Aggregates an array of strings and directives into a single directive.
546
+ * @param parts - A heterogeneous array of static strings interspersed with
547
+ * directives.
548
+ * @returns A single inline directive that aggregates the behavior of all the parts.
549
+ */
550
+ aggregate(parts: (string | ViewBehaviorFactory)[]): ViewBehaviorFactory;
551
+ };
552
+
553
+ /**
554
+ * Represents styles that can be composed into the ShadowDOM of a custom element.
555
+ * @public
556
+ */
557
+ export declare type ComposableStyles = string | ElementStyles | CSSStyleSheet;
558
+
559
+ /**
560
+ * Allows for the creation of Constructable mixin classes.
561
+ *
562
+ * @public
563
+ */
564
+ export declare type Constructable<T = {}> = {
565
+ new (...args: any[]): T;
566
+ };
567
+
568
+ /**
569
+ * A type that instantiates a StyleStrategy.
570
+ * @public
571
+ */
572
+ export declare type ConstructibleStyleStrategy = {
573
+ /**
574
+ * Creates an instance of the strategy.
575
+ * @param styles - The styles to initialize the strategy with.
576
+ */
577
+ new (styles: (string | CSSStyleSheet)[]): StyleStrategy;
578
+ };
579
+
580
+ /**
581
+ * Controls the lifecycle and rendering of a `FASTElement`.
582
+ * @public
583
+ */
584
+ export declare class Controller<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier {
585
+ private boundObservables;
586
+ private behaviors;
587
+ private needsInitialization;
588
+ private hasExistingShadowRoot;
589
+ private _template;
590
+ private _styles;
591
+ private _isConnected;
592
+ /**
593
+ * This allows Observable.getNotifier(...) to return the Controller
594
+ * when the notifier for the Controller itself is being requested. The
595
+ * result is that the Observable system does not need to create a separate
596
+ * instance of Notifier for observables on the Controller. The component and
597
+ * the controller will now share the same notifier, removing one-object construct
598
+ * per web component instance.
599
+ */
600
+ private readonly $fastController;
601
+ /**
602
+ * The element being controlled by this controller.
603
+ */
604
+ readonly element: TElement;
605
+ /**
606
+ * The element definition that instructs this controller
607
+ * in how to handle rendering and other platform integrations.
608
+ */
609
+ readonly definition: FASTElementDefinition;
610
+ /**
611
+ * The view associated with the custom element.
612
+ * @remarks
613
+ * If `null` then the element is managing its own rendering.
614
+ */
615
+ readonly view: ElementView<TElement> | null;
616
+ /**
617
+ * Indicates whether or not the custom element has been
618
+ * connected to the document.
619
+ */
620
+ get isConnected(): boolean;
621
+ private setIsConnected;
622
+ /**
623
+ * Gets/sets the template used to render the component.
624
+ * @remarks
625
+ * This value can only be accurately read after connect but can be set at any time.
626
+ */
627
+ get template(): ElementViewTemplate<TElement> | null;
628
+ set template(value: ElementViewTemplate<TElement> | null);
629
+ /**
630
+ * Gets/sets the primary styles used for the component.
631
+ * @remarks
632
+ * This value can only be accurately read after connect but can be set at any time.
633
+ */
634
+ get styles(): ElementStyles | null;
635
+ set styles(value: ElementStyles | null);
636
+ /**
637
+ * Creates a Controller to control the specified element.
638
+ * @param element - The element to be controlled by this controller.
639
+ * @param definition - The element definition metadata that instructs this
640
+ * controller in how to handle rendering and other platform integrations.
641
+ * @internal
642
+ */
643
+ constructor(element: TElement, definition: FASTElementDefinition);
644
+ /**
645
+ * Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.
646
+ * @param styles - The styles to add.
647
+ */
648
+ addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
649
+ /**
650
+ * Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.
651
+ * @param styles - the styles to remove.
652
+ */
653
+ removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
654
+ /**
655
+ * Adds behaviors to this element.
656
+ * @param behaviors - The behaviors to add.
657
+ */
658
+ addBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>): void;
659
+ /**
660
+ * Removes behaviors from this element.
661
+ * @param behaviors - The behaviors to remove.
662
+ * @param force - Forces unbinding of behaviors.
663
+ */
664
+ removeBehaviors(behaviors: ReadonlyArray<Behavior<TElement>>, force?: boolean): void;
665
+ /**
666
+ * Runs connected lifecycle behavior on the associated element.
667
+ */
668
+ onConnectedCallback(): void;
669
+ /**
670
+ * Runs disconnected lifecycle behavior on the associated element.
671
+ */
672
+ onDisconnectedCallback(): void;
673
+ /**
674
+ * Runs the attribute changed callback for the associated element.
675
+ * @param name - The name of the attribute that changed.
676
+ * @param oldValue - The previous value of the attribute.
677
+ * @param newValue - The new value of the attribute.
678
+ */
679
+ onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
680
+ /**
681
+ * Emits a custom HTML event.
682
+ * @param type - The type name of the event.
683
+ * @param detail - The event detail object to send with the event.
684
+ * @param options - The event options. By default bubbles and composed.
685
+ * @remarks
686
+ * Only emits events if connected.
687
+ */
688
+ emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
689
+ private finishInitialization;
690
+ private renderTemplate;
691
+ /**
692
+ * Locates or creates a controller for the specified element.
693
+ * @param element - The element to return the controller for.
694
+ * @remarks
695
+ * The specified element must have a {@link FASTElementDefinition}
696
+ * registered either through the use of the {@link customElement}
697
+ * decorator or a call to `FASTElement.define`.
698
+ */
699
+ static forCustomElement(element: HTMLElement): Controller;
700
+ }
701
+
702
+ /**
703
+ * Do not change. Part of shared kernel contract.
704
+ * @internal
705
+ */
706
+ export declare function createTypeRegistry<TDefinition extends TypeDefinition>(): TypeRegistry<TDefinition>;
707
+
708
+ /**
709
+ * Transforms a template literal string into styles.
710
+ * @param strings - The string fragments that are interpolated with the values.
711
+ * @param values - The values that are interpolated with the string fragments.
712
+ * @remarks
713
+ * The css helper supports interpolation of strings and ElementStyle instances.
714
+ * @public
715
+ */
716
+ export declare const css: CSSTemplateTag;
717
+
718
+ /**
719
+ * Directive for use in {@link css}.
720
+ *
721
+ * @public
722
+ */
723
+ export declare interface CSSDirective {
724
+ /**
725
+ * Creates a CSS fragment to interpolate into the CSS document.
726
+ * @returns - the string to interpolate into CSS
727
+ */
728
+ createCSS(add: AddBehavior): ComposableStyles;
729
+ }
730
+
731
+ /**
732
+ * Instructs the css engine to provide dynamic styles or
733
+ * associate behaviors with styles.
734
+ * @public
735
+ */
736
+ export declare const CSSDirective: Readonly<{
737
+ /**
738
+ * Gets the directive definition associated with the instance.
739
+ * @param instance - The directive instance to retrieve the definition for.
740
+ */
741
+ getForInstance: (object: any) => CSSDirectiveDefinition<Constructable<CSSDirective>> | undefined;
742
+ /**
743
+ * Gets the directive definition associated with the specified type.
744
+ * @param type - The directive type to retrieve the definition for.
745
+ */
746
+ getByType: (key: Function) => CSSDirectiveDefinition<Constructable<CSSDirective>> | undefined;
747
+ /**
748
+ * Defines a CSSDirective.
749
+ * @param type - The type to define as a directive.
750
+ */
751
+ define<TType extends Constructable<CSSDirective>>(type: any): TType;
752
+ }>;
753
+
754
+ /**
755
+ * Decorator: Defines a CSSDirective.
756
+ * @public
757
+ */
758
+ export declare function cssDirective(): (type: Constructable<CSSDirective>) => void;
759
+
760
+ /**
761
+ * Defines metadata for a CSSDirective.
762
+ * @public
763
+ */
764
+ export declare interface CSSDirectiveDefinition<TType extends Constructable<CSSDirective> = Constructable<CSSDirective>> {
765
+ /**
766
+ * The type that the definition provides metadata for.
767
+ */
768
+ readonly type: TType;
769
+ }
770
+
771
+ /**
772
+ * @deprecated Use css.partial instead.
773
+ * @public
774
+ */
775
+ export declare const cssPartial: (strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]) => CSSDirective;
776
+
777
+ /**
778
+ * Transforms a template literal string into styles.
779
+ * @param strings - The string fragments that are interpolated with the values.
780
+ * @param values - The values that are interpolated with the string fragments.
781
+ * @remarks
782
+ * The css helper supports interpolation of strings and ElementStyle instances.
783
+ * Use the .partial method to create partial CSS fragments.
784
+ * @public
785
+ */
786
+ export declare type CSSTemplateTag = ((strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]) => ElementStyles) & {
787
+ /**
788
+ * Transforms a template literal string into partial CSS.
789
+ * @param strings - The string fragments that are interpolated with the values.
790
+ * @param values - The values that are interpolated with the string fragments.
791
+ * @public
792
+ */
793
+ partial(strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]): CSSDirective;
794
+ };
795
+
796
+ /**
797
+ * Decorator: Defines a platform custom element based on `FASTElement`.
798
+ * @param nameOrDef - The name of the element to define or a definition object
799
+ * that describes the element to define.
800
+ * @public
801
+ */
802
+ export declare function customElement(nameOrDef: string | PartialFASTElementDefinition): (type: Constructable<HTMLElement>) => void;
803
+
804
+ /**
805
+ * Metadata used to configure a custom attribute's behavior through a decorator.
806
+ * @public
807
+ */
808
+ export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
809
+
810
+ /**
811
+ * The default binding options.
812
+ * @public
813
+ */
814
+ export declare type DefaultBindingOptions = AddEventListenerOptions;
815
+
816
+ /**
817
+ * Provides a mechanism for releasing resources.
818
+ * @public
819
+ */
820
+ export declare interface Disposable {
821
+ /**
822
+ * Disposes the resources.
823
+ */
824
+ dispose(): void;
825
+ }
826
+
827
+ /**
828
+ * Common DOM APIs.
829
+ * @public
830
+ */
831
+ export declare const DOM: Readonly<{
832
+ /**
833
+ * @deprecated
834
+ * Use Updates.enqueue().
835
+ */
836
+ queueUpdate: (callable: Callable) => void;
837
+ /**
838
+ * @deprecated
839
+ * Use Updates.next()
840
+ */
841
+ nextUpdate: () => Promise<void>;
842
+ /**
843
+ * @deprecated
844
+ * Use Updates.process()
845
+ */
846
+ processUpdates: () => void;
847
+ /**
848
+ * Sets an attribute value on an element.
849
+ * @param element - The element to set the attribute value on.
850
+ * @param attributeName - The attribute name to set.
851
+ * @param value - The value of the attribute to set.
852
+ * @remarks
853
+ * If the value is `null` or `undefined`, the attribute is removed, otherwise
854
+ * it is set to the provided value using the standard `setAttribute` API.
855
+ */
856
+ setAttribute(element: HTMLElement, attributeName: string, value: any): void;
857
+ /**
858
+ * Sets a boolean attribute value.
859
+ * @param element - The element to set the boolean attribute value on.
860
+ * @param attributeName - The attribute name to set.
861
+ * @param value - The value of the attribute to set.
862
+ * @remarks
863
+ * If the value is true, the attribute is added; otherwise it is removed.
864
+ */
865
+ setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
866
+ }>;
867
+
868
+ /**
869
+ * Creates a function that can be used to filter a Node array, selecting only elements.
870
+ * @param selector - An optional selector to restrict the filter to.
871
+ * @public
872
+ */
873
+ export declare const elements: (selector?: string) => ElementsFilter;
874
+
875
+ /**
876
+ * Elements filter function type.
877
+ *
878
+ * @public
879
+ */
880
+ export declare type ElementsFilter = (value: Node, index: number, array: Node[]) => boolean;
881
+
882
+ /**
883
+ * Represents styles that can be applied to a custom element.
884
+ * @public
885
+ */
886
+ export declare class ElementStyles {
887
+ readonly styles: ReadonlyArray<ComposableStyles>;
888
+ private targets;
889
+ private _strategy;
890
+ /**
891
+ * The behaviors associated with this set of styles.
892
+ */
893
+ readonly behaviors: ReadonlyArray<Behavior<HTMLElement>> | null;
894
+ /**
895
+ * Gets the StyleStrategy associated with these element styles.
896
+ */
897
+ get strategy(): StyleStrategy;
898
+ /**
899
+ * Creates an instance of ElementStyles.
900
+ * @param styles - The styles that will be associated with elements.
901
+ */
902
+ constructor(styles: ReadonlyArray<ComposableStyles>);
903
+ /** @internal */
904
+ addStylesTo(target: StyleTarget): void;
905
+ /** @internal */
906
+ removeStylesFrom(target: StyleTarget): void;
907
+ /** @internal */
908
+ isAttachedTo(target: StyleTarget): boolean;
909
+ /**
910
+ * Associates behaviors with this set of styles.
911
+ * @param behaviors - The behaviors to associate.
912
+ */
913
+ withBehaviors(...behaviors: Behavior<HTMLElement>[]): this;
914
+ /**
915
+ * Sets the strategy that handles adding/removing these styles for an element.
916
+ * @param strategy - The strategy to use.
917
+ */
918
+ withStrategy(Strategy: ConstructibleStyleStrategy): this;
919
+ /**
920
+ * Sets the default strategy type to use when creating style strategies.
921
+ * @param Strategy - The strategy type to construct.
922
+ */
923
+ static setDefaultStrategy(Strategy: ConstructibleStyleStrategy): void;
924
+ /**
925
+ * Indicates whether the DOM supports the adoptedStyleSheets feature.
926
+ */
927
+ static readonly supportsAdoptedStyleSheets: boolean;
928
+ }
929
+
930
+ /**
931
+ * A View representing DOM nodes specifically for rendering the view of a custom element.
932
+ * @public
933
+ */
934
+ export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent> {
935
+ /**
936
+ * Appends the view's DOM nodes to the referenced node.
937
+ * @param node - The parent node to append the view's DOM nodes to.
938
+ */
939
+ appendTo(node: Node): void;
940
+ }
941
+
942
+ /**
943
+ * A template capable of creating views specifically for rendering custom elements.
944
+ * @public
945
+ */
946
+ export declare interface ElementViewTemplate<TSource = any, TParent = any> {
947
+ /**
948
+ * Creates an ElementView instance based on this template definition.
949
+ * @param hostBindingTarget - The element that host behaviors will be bound to.
950
+ */
951
+ create(hostBindingTarget: Element): ElementView<TSource, TParent>;
952
+ /**
953
+ * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
954
+ * @param source - The data source to bind the template to.
955
+ * @param host - The Element where the template will be rendered.
956
+ * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
957
+ * host that the template is being attached to.
958
+ */
959
+ render(source: TSource, host: Node, hostBindingTarget?: Element): ElementView<TSource, TParent>;
960
+ }
961
+
962
+ /**
963
+ * A readonly, empty array.
964
+ * @remarks
965
+ * Typically returned by APIs that return arrays when there are
966
+ * no actual items to return.
967
+ * @public
968
+ */
969
+ export declare const emptyArray: readonly never[];
970
+
971
+ /**
972
+ * A binding behavior for handling events.
973
+ * @public
974
+ */
975
+ export declare class EventBinding {
976
+ readonly directive: HTMLBindingDirective;
977
+ private contextProperty;
978
+ private sourceProperty;
979
+ /**
980
+ * Creates an instance of EventBinding.
981
+ * @param directive - The directive that has the configuration for this behavior.
982
+ */
983
+ constructor(directive: HTMLBindingDirective);
984
+ /**
985
+ * Bind this behavior to the source.
986
+ * @param source - The source to bind to.
987
+ * @param context - The execution context that the binding is operating within.
988
+ * @param targets - The targets that behaviors in a view can attach to.
989
+ */
990
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
991
+ /**
992
+ * Unbinds this behavior from the source.
993
+ * @param source - The source to unbind from.
994
+ * @param context - The execution context that the binding is operating within.
995
+ * @param targets - The targets that behaviors in a view can attach to.
996
+ */
997
+ unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
998
+ /**
999
+ * Creates a behavior.
1000
+ * @param targets - The targets available for behaviors to be attached to.
1001
+ */
1002
+ createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
1003
+ /**
1004
+ * @internal
1005
+ */
1006
+ handleEvent(event: Event): void;
1007
+ }
1008
+
1009
+ /**
1010
+ * Provides additional contextual information available to behaviors and expressions.
1011
+ * @public
1012
+ */
1013
+ export declare class ExecutionContext<TParentSource = any> {
1014
+ /**
1015
+ * The default execution context.
1016
+ */
1017
+ static readonly default: ExecutionContext<any>;
1018
+ /**
1019
+ * The index of the current item within a repeat context.
1020
+ */
1021
+ index: number;
1022
+ /**
1023
+ * The length of the current collection within a repeat context.
1024
+ */
1025
+ length: number;
1026
+ /**
1027
+ * The parent data source within a nested context.
1028
+ */
1029
+ readonly parent: TParentSource;
1030
+ /**
1031
+ * The parent execution context when in nested context scenarios.
1032
+ */
1033
+ readonly parentContext: ExecutionContext<TParentSource>;
1034
+ private constructor();
1035
+ /**
1036
+ * The current event within an event handler.
1037
+ */
1038
+ get event(): Event;
1039
+ /**
1040
+ * Indicates whether the current item within a repeat context
1041
+ * has an even index.
1042
+ */
1043
+ get isEven(): boolean;
1044
+ /**
1045
+ * Indicates whether the current item within a repeat context
1046
+ * has an odd index.
1047
+ */
1048
+ get isOdd(): boolean;
1049
+ /**
1050
+ * Indicates whether the current item within a repeat context
1051
+ * is the first item in the collection.
1052
+ */
1053
+ get isFirst(): boolean;
1054
+ /**
1055
+ * Indicates whether the current item within a repeat context
1056
+ * is somewhere in the middle of the collection.
1057
+ */
1058
+ get isInMiddle(): boolean;
1059
+ /**
1060
+ * Indicates whether the current item within a repeat context
1061
+ * is the last item in the collection.
1062
+ */
1063
+ get isLast(): boolean;
1064
+ /**
1065
+ * Returns the typed event detail of a custom event.
1066
+ */
1067
+ eventDetail<TDetail>(): TDetail;
1068
+ /**
1069
+ * Returns the typed event target of the event.
1070
+ */
1071
+ eventTarget<TTarget extends EventTarget>(): TTarget;
1072
+ /**
1073
+ * Updates the position/size on a context associated with a list item.
1074
+ * @param index - The new index of the item.
1075
+ * @param length - The new length of the list.
1076
+ */
1077
+ updatePosition(index: number, length: number): void;
1078
+ /**
1079
+ * Creates a new execution context descendent from the current context.
1080
+ * @param source - The source for the context if different than the parent.
1081
+ * @returns A child execution context.
1082
+ */
1083
+ createChildContext<TParentSource>(parentSource: TParentSource): ExecutionContext<TParentSource>;
1084
+ /**
1085
+ * Creates a new execution context descent suitable for use in list rendering.
1086
+ * @param item - The list item to serve as the source.
1087
+ * @param index - The index of the item in the list.
1088
+ * @param length - The length of the list.
1089
+ */
1090
+ createItemContext(index: number, length: number): ExecutionContext<TParentSource>;
1091
+ /**
1092
+ * Sets the event for the current execution context.
1093
+ * @param event - The event to set.
1094
+ * @internal
1095
+ */
1096
+ static setEvent(event: Event | null): void;
1097
+ /**
1098
+ * Creates a new root execution context.
1099
+ * @returns A new execution context.
1100
+ */
1101
+ static create(): ExecutionContext;
1102
+ }
1103
+
1104
+ /**
1105
+ * The FAST global.
1106
+ * @internal
1107
+ */
1108
+ export declare const FAST: FASTGlobal;
1109
+
1110
+ /**
1111
+ * Represents a custom element based on the FASTElement infrastructure.
1112
+ * @public
1113
+ */
1114
+ export declare interface FASTElement extends HTMLElement {
1115
+ /**
1116
+ * The underlying controller that handles the lifecycle and rendering of
1117
+ * this FASTElement.
1118
+ */
1119
+ readonly $fastController: Controller;
1120
+ /**
1121
+ * Emits a custom HTML event.
1122
+ * @param type - The type name of the event.
1123
+ * @param detail - The event detail object to send with the event.
1124
+ * @param options - The event options. By default bubbles and composed.
1125
+ * @remarks
1126
+ * Only emits events if the element is connected.
1127
+ */
1128
+ $emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): boolean | void;
1129
+ /**
1130
+ * The connected callback for this FASTElement.
1131
+ * @remarks
1132
+ * This method is invoked by the platform whenever this FASTElement
1133
+ * becomes connected to the document.
1134
+ */
1135
+ connectedCallback(): void;
1136
+ /**
1137
+ * The disconnected callback for this FASTElement.
1138
+ * @remarks
1139
+ * This method is invoked by the platform whenever this FASTElement
1140
+ * becomes disconnected from the document.
1141
+ */
1142
+ disconnectedCallback(): void;
1143
+ /**
1144
+ * The attribute changed callback for this FASTElement.
1145
+ * @param name - The name of the attribute that changed.
1146
+ * @param oldValue - The previous value of the attribute.
1147
+ * @param newValue - The new value of the attribute.
1148
+ * @remarks
1149
+ * This method is invoked by the platform whenever an observed
1150
+ * attribute of FASTElement has a value change.
1151
+ */
1152
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
1153
+ }
1154
+
1155
+ /**
1156
+ * A minimal base class for FASTElements that also provides
1157
+ * static helpers for working with FASTElements.
1158
+ * @public
1159
+ */
1160
+ export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
1161
+ /**
1162
+ * Creates a new FASTElement base class inherited from the
1163
+ * provided base type.
1164
+ * @param BaseType - The base element type to inherit from.
1165
+ */
1166
+ from<TBase extends {
1167
+ new (): HTMLElement;
1168
+ prototype: HTMLElement;
1169
+ }>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
1170
+ /**
1171
+ * Defines a platform custom element based on the provided type and definition.
1172
+ * @param type - The custom element type to define.
1173
+ * @param nameOrDef - The name of the element to define or a definition object
1174
+ * that describes the element to define.
1175
+ */
1176
+ define<TType extends Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
1177
+ /**
1178
+ * Defines metadata for a FASTElement which can be used to later define the element.
1179
+ * IMPORTANT: This API will be renamed to "compose" in a future beta.
1180
+ * @public
1181
+ */
1182
+ metadata<TType_1 extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType_1, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType_1>;
1183
+ };
1184
+
1185
+ /**
1186
+ * Defines metadata for a FASTElement.
1187
+ * @public
1188
+ */
1189
+ export declare class FASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
1190
+ private observedAttributes;
1191
+ /**
1192
+ * The type this element definition describes.
1193
+ */
1194
+ readonly type: TType;
1195
+ /**
1196
+ * Indicates if this element has been defined in at least one registry.
1197
+ */
1198
+ get isDefined(): boolean;
1199
+ /**
1200
+ * The name of the custom element.
1201
+ */
1202
+ readonly name: string;
1203
+ /**
1204
+ * The custom attributes of the custom element.
1205
+ */
1206
+ readonly attributes: ReadonlyArray<AttributeDefinition>;
1207
+ /**
1208
+ * A map enabling lookup of attribute by associated property name.
1209
+ */
1210
+ readonly propertyLookup: Record<string, AttributeDefinition>;
1211
+ /**
1212
+ * A map enabling lookup of property by associated attribute name.
1213
+ */
1214
+ readonly attributeLookup: Record<string, AttributeDefinition>;
1215
+ /**
1216
+ * The template to render for the custom element.
1217
+ */
1218
+ readonly template?: ElementViewTemplate;
1219
+ /**
1220
+ * The styles to associate with the custom element.
1221
+ */
1222
+ readonly styles?: ElementStyles;
1223
+ /**
1224
+ * Options controlling the creation of the custom element's shadow DOM.
1225
+ */
1226
+ readonly shadowOptions?: ShadowRootInit;
1227
+ /**
1228
+ * Options controlling how the custom element is defined with the platform.
1229
+ */
1230
+ readonly elementOptions?: ElementDefinitionOptions;
1231
+ /**
1232
+ * Creates an instance of FASTElementDefinition.
1233
+ * @param type - The type this definition is being created for.
1234
+ * @param nameOrConfig - The name of the element to define or a config object
1235
+ * that describes the element to define.
1236
+ */
1237
+ constructor(type: TType, nameOrConfig?: PartialFASTElementDefinition | string);
1238
+ /**
1239
+ * Defines a custom element based on this definition.
1240
+ * @param registry - The element registry to define the element in.
1241
+ * @remarks
1242
+ * This operation is idempotent per registry.
1243
+ */
1244
+ define(registry?: CustomElementRegistry): this;
1245
+ /**
1246
+ * Gets the element definition associated with the specified type.
1247
+ * @param type - The custom element type to retrieve the definition for.
1248
+ */
1249
+ static readonly getByType: (key: Function) => FASTElementDefinition<Constructable<HTMLElement>> | undefined;
1250
+ /**
1251
+ * Gets the element definition associated with the instance.
1252
+ * @param instance - The custom element instance to retrieve the definition for.
1253
+ */
1254
+ static readonly getForInstance: (object: any) => FASTElementDefinition<Constructable<HTMLElement>> | undefined;
1255
+ }
1256
+
1257
+ /**
1258
+ * The FAST global.
1259
+ * @internal
1260
+ */
1261
+ export declare interface FASTGlobal {
1262
+ /**
1263
+ * The list of loaded versions.
1264
+ */
1265
+ readonly versions: string[];
1266
+ /**
1267
+ * Gets a kernel value.
1268
+ * @param id - The id to get the value for.
1269
+ * @param initialize - Creates the initial value for the id if not already existing.
1270
+ */
1271
+ getById<T>(id: string | number): T | null;
1272
+ getById<T>(id: string | number, initialize: () => T): T;
1273
+ /**
1274
+ * Sends a warning to the developer.
1275
+ * @param code - The warning code to send.
1276
+ * @param args - Args relevant for the warning.
1277
+ */
1278
+ warn(code: number, ...args: any[]): void;
1279
+ /**
1280
+ * Creates an error.
1281
+ * @param code - The error code to send.
1282
+ * @param args - Args relevant for the error.
1283
+ */
1284
+ error(code: number, ...args: any[]): Error;
1285
+ /**
1286
+ * Adds debug messages for errors and warnings.
1287
+ * @param messages - The message dictionary to add.
1288
+ */
1289
+ addMessages(messages: Record<number, string>): void;
1290
+ }
1291
+
1292
+ /**
1293
+ * Transforms a template literal string into a ViewTemplate.
1294
+ * @param strings - The string fragments that are interpolated with the values.
1295
+ * @param values - The values that are interpolated with the string fragments.
1296
+ * @remarks
1297
+ * The html helper supports interpolation of strings, numbers, binding expressions,
1298
+ * other template instances, and Directive instances.
1299
+ * @public
1300
+ */
1301
+ export declare function html<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]): ViewTemplate<TSource, TParent>;
1302
+
1303
+ /**
1304
+ * A directive that applies bindings.
1305
+ * @public
1306
+ */
1307
+ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, Aspected {
1308
+ binding: Binding;
1309
+ mode: BindingMode;
1310
+ options: any;
1311
+ private factory;
1312
+ /**
1313
+ * The unique id of the factory.
1314
+ */
1315
+ id: string;
1316
+ /**
1317
+ * The structural id of the DOM node to which the created behavior will apply.
1318
+ */
1319
+ nodeId: string;
1320
+ /**
1321
+ * The original source aspect exactly as represented in markup.
1322
+ */
1323
+ sourceAspect: string;
1324
+ /**
1325
+ * The evaluated target aspect, determined after processing the source.
1326
+ */
1327
+ targetAspect: string;
1328
+ /**
1329
+ * The type of aspect to target.
1330
+ */
1331
+ aspectType: Aspect;
1332
+ /**
1333
+ * Creates an instance of HTMLBindingDirective.
1334
+ * @param binding - The binding to apply.
1335
+ * @param mode - The binding mode to use when applying the binding.
1336
+ * @param options - The options to configure the binding with.
1337
+ */
1338
+ constructor(binding: Binding, mode: BindingMode, options: any);
1339
+ /**
1340
+ * Creates HTML to be used within a template.
1341
+ * @param add - Can be used to add behavior factories to a template.
1342
+ */
1343
+ createHTML(add: AddViewBehaviorFactory): string;
1344
+ /**
1345
+ * Creates a behavior.
1346
+ * @param targets - The targets available for behaviors to be attached to.
1347
+ */
1348
+ createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
1349
+ }
1350
+
1351
+ /**
1352
+ * Instructs the template engine to apply behavior to a node.
1353
+ * @public
1354
+ */
1355
+ export declare interface HTMLDirective {
1356
+ /**
1357
+ * Creates HTML to be used within a template.
1358
+ * @param add - Can be used to add behavior factories to a template.
1359
+ */
1360
+ createHTML(add: AddViewBehaviorFactory): string;
1361
+ }
1362
+
1363
+ /**
1364
+ * Instructs the template engine to apply behavior to a node.
1365
+ * @public
1366
+ */
1367
+ export declare const HTMLDirective: Readonly<{
1368
+ /**
1369
+ * Gets the directive definition associated with the instance.
1370
+ * @param instance - The directive instance to retrieve the definition for.
1371
+ */
1372
+ getForInstance: (object: any) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
1373
+ /**
1374
+ * Gets the directive definition associated with the specified type.
1375
+ * @param type - The directive type to retrieve the definition for.
1376
+ */
1377
+ getByType: (key: Function) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
1378
+ /**
1379
+ * Defines an HTMLDirective based on the options.
1380
+ * @param type - The type to define as a directive.
1381
+ * @param options - Options that specify the directive's application.
1382
+ */
1383
+ define<TType extends Constructable<HTMLDirective>>(type: TType, options?: PartialHTMLDirectiveDefinition): TType;
1384
+ }>;
1385
+
1386
+ /**
1387
+ * Decorator: Defines an HTMLDirective.
1388
+ * @param options - Provides options that specify the directive's application.
1389
+ * @public
1390
+ */
1391
+ export declare function htmlDirective(options?: PartialHTMLDirectiveDefinition): (type: Constructable<HTMLDirective>) => void;
1392
+
1393
+ /**
1394
+ * Defines metadata for an HTMLDirective.
1395
+ * @public
1396
+ */
1397
+ export declare interface HTMLDirectiveDefinition<TType extends Constructable<HTMLDirective> = Constructable<HTMLDirective>> extends Required<PartialHTMLDirectiveDefinition> {
1398
+ /**
1399
+ * The type that the definition provides metadata for.
1400
+ */
1401
+ readonly type: TType;
1402
+ }
1403
+
1404
+ /**
1405
+ * The result of a template compilation operation.
1406
+ * @public
1407
+ */
1408
+ export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
1409
+ /**
1410
+ * Creates a view instance.
1411
+ * @param hostBindingTarget - The host binding target for the view.
1412
+ */
1413
+ createView(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
1414
+ }
1415
+
1416
+ /**
1417
+ * The standard View implementation, which also implements ElementView and SyntheticView.
1418
+ * @public
1419
+ */
1420
+ export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent> {
1421
+ private fragment;
1422
+ private factories;
1423
+ private targets;
1424
+ private behaviors;
1425
+ /**
1426
+ * The data that the view is bound to.
1427
+ */
1428
+ source: TSource | null;
1429
+ /**
1430
+ * The execution context the view is running within.
1431
+ */
1432
+ context: ExecutionContext<TParent> | null;
1433
+ /**
1434
+ * The first DOM node in the range of nodes that make up the view.
1435
+ */
1436
+ firstChild: Node;
1437
+ /**
1438
+ * The last DOM node in the range of nodes that make up the view.
1439
+ */
1440
+ lastChild: Node;
1441
+ /**
1442
+ * Constructs an instance of HTMLView.
1443
+ * @param fragment - The html fragment that contains the nodes for this view.
1444
+ * @param behaviors - The behaviors to be applied to this view.
1445
+ */
1446
+ constructor(fragment: DocumentFragment, factories: ReadonlyArray<ViewBehaviorFactory>, targets: ViewBehaviorTargets);
1447
+ /**
1448
+ * Appends the view's DOM nodes to the referenced node.
1449
+ * @param node - The parent node to append the view's DOM nodes to.
1450
+ */
1451
+ appendTo(node: Node): void;
1452
+ /**
1453
+ * Inserts the view's DOM nodes before the referenced node.
1454
+ * @param node - The node to insert the view's DOM before.
1455
+ */
1456
+ insertBefore(node: Node): void;
1457
+ /**
1458
+ * Removes the view's DOM nodes.
1459
+ * The nodes are not disposed and the view can later be re-inserted.
1460
+ */
1461
+ remove(): void;
1462
+ /**
1463
+ * Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
1464
+ * Once a view has been disposed, it cannot be inserted or bound again.
1465
+ */
1466
+ dispose(): void;
1467
+ /**
1468
+ * Binds a view's behaviors to its binding source.
1469
+ * @param source - The binding source for the view's binding behaviors.
1470
+ * @param context - The execution context to run the behaviors within.
1471
+ */
1472
+ bind(source: TSource, context: ExecutionContext<TParent>): void;
1473
+ /**
1474
+ * Unbinds a view's behaviors from its binding source.
1475
+ */
1476
+ unbind(): void;
1477
+ /**
1478
+ * Efficiently disposes of a contiguous range of synthetic view instances.
1479
+ * @param views - A contiguous range of views to be disposed.
1480
+ */
1481
+ static disposeContiguousBatch(views: SyntheticView[]): void;
1482
+ }
1483
+
1484
+ /**
1485
+ * Observes array lengths.
1486
+ * @public
1487
+ */
1488
+ export declare interface LengthObserver extends Subscriber {
1489
+ /**
1490
+ * The length of the observed array.
1491
+ */
1492
+ length: number;
1493
+ }
1494
+
1495
+ /**
1496
+ * Enables observing the length of an array.
1497
+ * @param array - The array to observe the length of.
1498
+ * @returns The length of the array.
1499
+ * @public
1500
+ */
1501
+ export declare function lengthOf<T>(array: readonly T[]): number;
1502
+
1503
+ /**
1504
+ * Common APIs related to markup generation.
1505
+ * @public
1506
+ */
1507
+ export declare const Markup: Readonly<{
1508
+ /**
1509
+ * Creates a placeholder string suitable for marking out a location *within*
1510
+ * an attribute value or HTML content.
1511
+ * @param index - The directive index to create the placeholder for.
1512
+ * @remarks
1513
+ * Used internally by binding directives.
1514
+ */
1515
+ interpolation: (id: string) => string;
1516
+ /**
1517
+ * Creates a placeholder that manifests itself as an attribute on an
1518
+ * element.
1519
+ * @param attributeName - The name of the custom attribute.
1520
+ * @param index - The directive index to create the placeholder for.
1521
+ * @remarks
1522
+ * Used internally by attribute directives such as `ref`, `slotted`, and `children`.
1523
+ */
1524
+ attribute: (id: string) => string;
1525
+ /**
1526
+ * Creates a placeholder that manifests itself as a marker within the DOM structure.
1527
+ * @param index - The directive index to create the placeholder for.
1528
+ * @remarks
1529
+ * Used internally by structural directives such as `repeat`.
1530
+ */
1531
+ comment: (id: string) => string;
1532
+ }>;
1533
+
1534
+ /**
1535
+ * Reverses all readonly members, making them mutable.
1536
+ * @internal
1537
+ */
1538
+ export declare type Mutable<T> = {
1539
+ -readonly [P in keyof T]: T[P];
1540
+ };
1541
+
1542
+ /**
1543
+ * Options for configuring node observation behavior.
1544
+ * @public
1545
+ */
1546
+ export declare interface NodeBehaviorOptions<T = any> {
1547
+ /**
1548
+ * The property to assign the observed nodes to.
1549
+ */
1550
+ property: T;
1551
+ /**
1552
+ * Filters nodes that are synced with the property.
1553
+ * Called one time for each element in the array.
1554
+ * @param value - The Node that is being inspected.
1555
+ * @param index - The index of the node within the array.
1556
+ * @param array - The Node array that is being filtered.
1557
+ */
1558
+ filter?: ElementsFilter;
1559
+ }
1560
+
1561
+ /**
1562
+ * A base class for node observation.
1563
+ * @public
1564
+ * @remarks
1565
+ * Internally used by the SlottedDirective and the ChildrenDirective.
1566
+ */
1567
+ export declare abstract class NodeObservationDirective<T extends NodeBehaviorOptions> extends StatelessAttachedAttributeDirective<T> {
1568
+ private sourceProperty;
1569
+ /**
1570
+ * Bind this behavior to the source.
1571
+ * @param source - The source to bind to.
1572
+ * @param context - The execution context that the binding is operating within.
1573
+ * @param targets - The targets that behaviors in a view can attach to.
1574
+ */
1575
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1576
+ /**
1577
+ * Unbinds this behavior from the source.
1578
+ * @param source - The source to unbind from.
1579
+ * @param context - The execution context that the binding is operating within.
1580
+ * @param targets - The targets that behaviors in a view can attach to.
1581
+ */
1582
+ unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1583
+ /**
1584
+ * Gets the data source for the target.
1585
+ * @param target - The target to get the source for.
1586
+ * @returns The source.
1587
+ */
1588
+ protected getSource(target: Node): any;
1589
+ /**
1590
+ * Updates the source property with the computed nodes.
1591
+ * @param source - The source object to assign the nodes property to.
1592
+ * @param value - The nodes to assign to the source object property.
1593
+ */
1594
+ protected updateTarget(source: any, value: ReadonlyArray<any>): void;
1595
+ /**
1596
+ * Computes the set of nodes that should be assigned to the source property.
1597
+ * @param target - The target to compute the nodes for.
1598
+ * @returns The computed nodes.
1599
+ * @remarks
1600
+ * Applies filters if provided.
1601
+ */
1602
+ protected computeNodes(target: any): Node[];
1603
+ /**
1604
+ * Begins observation of the nodes.
1605
+ * @param target - The target to observe.
1606
+ */
1607
+ protected abstract observe(target: any): void;
1608
+ /**
1609
+ * Disconnects observation of the nodes.
1610
+ * @param target - The target to unobserve.
1611
+ */
1612
+ protected abstract disconnect(target: any): void;
1613
+ /**
1614
+ * Retrieves the raw nodes that should be assigned to the source property.
1615
+ * @param target - The target to get the node to.
1616
+ */
1617
+ protected abstract getNodes(target: any): Node[];
1618
+ }
1619
+
1620
+ /**
1621
+ * Provides change notifications for an observed subject.
1622
+ * @public
1623
+ */
1624
+ export declare interface Notifier {
1625
+ /**
1626
+ * The object that subscribers will receive notifications for.
1627
+ */
1628
+ readonly subject: any;
1629
+ /**
1630
+ * Notifies all subscribers, based on the args.
1631
+ * @param args - Data passed along to subscribers during notification.
1632
+ * @remarks
1633
+ * In some implementations, the args may be used to target specific subscribers.
1634
+ * This is usually in the case where a propertyName was passed during subscription.
1635
+ */
1636
+ notify(args: any): void;
1637
+ /**
1638
+ * Subscribes to notification of changes in an object's state.
1639
+ * @param subscriber - The object that is subscribing for change notification.
1640
+ * @param propertyToWatch - The name of the property that the subscriber is interested in watching for changes.
1641
+ * @remarks
1642
+ * Some implementation may or may not require the propertyToWatch.
1643
+ */
1644
+ subscribe(subscriber: Subscriber, propertyToWatch?: any): void;
1645
+ /**
1646
+ * Unsubscribes from notification of changes in an object's state.
1647
+ * @param subscriber - The object that is unsubscribing from change notification.
1648
+ * @param propertyToUnwatch - The name of the property that the subscriber is no longer interested in watching.
1649
+ * @remarks
1650
+ * Some implementation may or may not require the propertyToUnwatch.
1651
+ */
1652
+ unsubscribe(subscriber: Subscriber, propertyToUnwatch?: any): void;
1653
+ }
1654
+
1655
+ /**
1656
+ * A {@link ValueConverter} that converts to and from `number` values.
1657
+ * @remarks
1658
+ * This converter allows for nullable numbers, returning `null` if the
1659
+ * input was `null`, `undefined`, or `NaN`.
1660
+ * @public
1661
+ */
1662
+ export declare const nullableNumberConverter: ValueConverter;
1663
+
1664
+ /**
1665
+ * Common Observable APIs.
1666
+ * @public
1667
+ */
1668
+ export declare const Observable: Readonly<{
1669
+ /**
1670
+ * @internal
1671
+ * @param factory - The factory used to create array observers.
1672
+ */
1673
+ setArrayObserverFactory(factory: (collection: any[]) => Notifier): void;
1674
+ /**
1675
+ * Gets a notifier for an object or Array.
1676
+ * @param source - The object or Array to get the notifier for.
1677
+ */
1678
+ getNotifier: <T extends Notifier = Notifier>(source: any) => T;
1679
+ /**
1680
+ * Records a property change for a source object.
1681
+ * @param source - The object to record the change against.
1682
+ * @param propertyName - The property to track as changed.
1683
+ */
1684
+ track(source: unknown, propertyName: string): void;
1685
+ /**
1686
+ * Notifies watchers that the currently executing property getter or function is volatile
1687
+ * with respect to its observable dependencies.
1688
+ */
1689
+ trackVolatile(): void;
1690
+ /**
1691
+ * Notifies subscribers of a source object of changes.
1692
+ * @param source - the object to notify of changes.
1693
+ * @param args - The change args to pass to subscribers.
1694
+ */
1695
+ notify(source: unknown, args: any): void;
1696
+ /**
1697
+ * Defines an observable property on an object or prototype.
1698
+ * @param target - The target object to define the observable on.
1699
+ * @param nameOrAccessor - The name of the property to define as observable;
1700
+ * or a custom accessor that specifies the property name and accessor implementation.
1701
+ */
1702
+ defineProperty(target: {}, nameOrAccessor: string | Accessor): void;
1703
+ /**
1704
+ * Finds all the observable accessors defined on the target,
1705
+ * including its prototype chain.
1706
+ * @param target - The target object to search for accessor on.
1707
+ */
1708
+ getAccessors: (target: {}) => Accessor[];
1709
+ /**
1710
+ * Creates a {@link BindingObserver} that can watch the
1711
+ * provided {@link Binding} for changes.
1712
+ * @param binding - The binding to observe.
1713
+ * @param initialSubscriber - An initial subscriber to changes in the binding value.
1714
+ * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
1715
+ */
1716
+ binding<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): BindingObserver<TSource, TReturn, any>;
1717
+ /**
1718
+ * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
1719
+ * on every evaluation of the value.
1720
+ * @param binding - The binding to inspect.
1721
+ */
1722
+ isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Binding<TSource_1, TReturn_1, any>): boolean;
1723
+ }>;
1724
+
1725
+ /**
1726
+ * Decorator: Defines an observable property on the target.
1727
+ * @param target - The target to define the observable on.
1728
+ * @param nameOrAccessor - The property name or accessor to define the observable as.
1729
+ * @public
1730
+ */
1731
+ export declare function observable(target: {}, nameOrAccessor: string | Accessor): void;
1732
+
1733
+ /**
1734
+ * A record of observable property access.
1735
+ * @public
1736
+ */
1737
+ export declare interface ObservationRecord {
1738
+ /**
1739
+ * The source object with an observable property that was accessed.
1740
+ */
1741
+ propertySource: any;
1742
+ /**
1743
+ * The name of the observable property on {@link ObservationRecord.propertySource} that was accessed.
1744
+ */
1745
+ propertyName: string;
1746
+ }
1747
+
1748
+ /**
1749
+ * The default onChange binding configuration.
1750
+ * @public
1751
+ */
1752
+ export declare const onChange: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
1753
+
1754
+ /**
1755
+ * The default onTime binding configuration.
1756
+ * @public
1757
+ */
1758
+ export declare const oneTime: BindingConfig<AddEventListenerOptions> & BindingConfigResolver<AddEventListenerOptions>;
1759
+
1760
+ /**
1761
+ * A binding behavior for one-time bindings.
1762
+ * @public
1763
+ */
1764
+ export declare class OneTimeBinding extends UpdateBinding {
1765
+ /**
1766
+ * Bind this behavior to the source.
1767
+ * @param source - The source to bind to.
1768
+ * @param context - The execution context that the binding is operating within.
1769
+ * @param targets - The targets that behaviors in a view can attach to.
1770
+ */
1771
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1772
+ }
1773
+
1774
+ /**
1775
+ * Common APIs related to content parsing.
1776
+ * @public
1777
+ */
1778
+ export declare const Parser: Readonly<{
1779
+ /**
1780
+ * Parses text content or HTML attribute content, separating out the static strings
1781
+ * from the directives.
1782
+ * @param value - The content or attribute string to parse.
1783
+ * @param factories - A list of directives to search for in the string.
1784
+ * @returns A heterogeneous array of static strings interspersed with
1785
+ * directives or null if no directives are found in the string.
1786
+ */
1787
+ parse(value: string, factories: Record<string, ViewBehaviorFactory>): (string | ViewBehaviorFactory)[] | null;
1788
+ }>;
1789
+
1790
+ /**
1791
+ * Represents metadata configuration for a custom element.
1792
+ * @public
1793
+ */
1794
+ export declare interface PartialFASTElementDefinition {
1795
+ /**
1796
+ * The name of the custom element.
1797
+ */
1798
+ readonly name: string;
1799
+ /**
1800
+ * The template to render for the custom element.
1801
+ */
1802
+ readonly template?: ElementViewTemplate;
1803
+ /**
1804
+ * The styles to associate with the custom element.
1805
+ */
1806
+ readonly styles?: ComposableStyles | ComposableStyles[];
1807
+ /**
1808
+ * The custom attributes of the custom element.
1809
+ */
1810
+ readonly attributes?: (AttributeConfiguration | string)[];
1811
+ /**
1812
+ * Options controlling the creation of the custom element's shadow DOM.
1813
+ */
1814
+ readonly shadowOptions?: Partial<ShadowRootInit> | null;
1815
+ /**
1816
+ * Options controlling how the custom element is defined with the platform.
1817
+ */
1818
+ readonly elementOptions?: ElementDefinitionOptions;
1819
+ }
1820
+
1821
+ /**
1822
+ * Represents metadata configuration for an HTMLDirective.
1823
+ * @public
1824
+ */
1825
+ export declare interface PartialHTMLDirectiveDefinition {
1826
+ /**
1827
+ * Indicates whether the directive needs access to template contextual information
1828
+ * such as the sourceAspect, targetAspect, and aspectType.
1829
+ */
1830
+ aspected?: boolean;
1831
+ }
1832
+
1833
+ /**
1834
+ * An implementation of Notifier that allows subscribers to be notified
1835
+ * of individual property changes on an object.
1836
+ * @public
1837
+ */
1838
+ export declare class PropertyChangeNotifier implements Notifier {
1839
+ private subscribers;
1840
+ private subjectSubscribers;
1841
+ /**
1842
+ * The subject that property changes are being notified for.
1843
+ */
1844
+ readonly subject: any;
1845
+ /**
1846
+ * Creates an instance of PropertyChangeNotifier for the specified subject.
1847
+ * @param subject - The object that subscribers will receive notifications for.
1848
+ */
1849
+ constructor(subject: any);
1850
+ /**
1851
+ * Notifies all subscribers, based on the specified property.
1852
+ * @param propertyName - The property name, passed along to subscribers during notification.
1853
+ */
1854
+ notify(propertyName: string): void;
1855
+ /**
1856
+ * Subscribes to notification of changes in an object's state.
1857
+ * @param subscriber - The object that is subscribing for change notification.
1858
+ * @param propertyToWatch - The name of the property that the subscriber is interested in watching for changes.
1859
+ */
1860
+ subscribe(subscriber: Subscriber, propertyToWatch?: string): void;
1861
+ /**
1862
+ * Unsubscribes from notification of changes in an object's state.
1863
+ * @param subscriber - The object that is unsubscribing from change notification.
1864
+ * @param propertyToUnwatch - The name of the property that the subscriber is no longer interested in watching.
1865
+ */
1866
+ unsubscribe(subscriber: Subscriber, propertyToUnwatch?: string): void;
1867
+ }
1868
+
1869
+ /**
1870
+ * A directive that observes the updates a property with a reference to the element.
1871
+ * @param propertyName - The name of the property to assign the reference to.
1872
+ * @public
1873
+ */
1874
+ export declare const ref: <T = any>(propertyName: keyof T & string) => CaptureType<T>;
1875
+
1876
+ /**
1877
+ * The runtime behavior for template references.
1878
+ * @public
1879
+ */
1880
+ export declare class RefDirective extends StatelessAttachedAttributeDirective<string> {
1881
+ /**
1882
+ * Bind this behavior to the source.
1883
+ * @param source - The source to bind to.
1884
+ * @param context - The execution context that the binding is operating within.
1885
+ * @param targets - The targets that behaviors in a view can attach to.
1886
+ */
1887
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
1888
+ /**
1889
+ * Unbinds this behavior from the source.
1890
+ * @param source - The source to unbind from.
1891
+ */
1892
+ unbind(): void;
1893
+ }
1894
+
1895
+ declare const reflectMode = "reflect";
1896
+
1897
+ /**
1898
+ * A directive that enables list rendering.
1899
+ * @param itemsBinding - The array to render.
1900
+ * @param templateOrTemplateBinding - The template or a template binding used obtain a template
1901
+ * to render for each item in the array.
1902
+ * @param options - Options used to turn on special repeat features.
1903
+ * @public
1904
+ */
1905
+ export declare function repeat<TSource = any, TArray extends ReadonlyArray<any> = ReadonlyArray<any>>(itemsBinding: Binding<TSource, TArray, ExecutionContext<TSource>>, templateOrTemplateBinding: ViewTemplate | Binding<TSource, ViewTemplate>, options?: RepeatOptions): CaptureType<TSource>;
1906
+
1907
+ /**
1908
+ * A behavior that renders a template for each item in an array.
1909
+ * @public
1910
+ */
1911
+ export declare class RepeatBehavior<TSource = any> implements Behavior, Subscriber {
1912
+ private location;
1913
+ private itemsBinding;
1914
+ private templateBinding;
1915
+ private options;
1916
+ private source;
1917
+ private views;
1918
+ private template;
1919
+ private templateBindingObserver;
1920
+ private items;
1921
+ private itemsObserver;
1922
+ private itemsBindingObserver;
1923
+ private context;
1924
+ private childContext;
1925
+ private bindView;
1926
+ /**
1927
+ * Creates an instance of RepeatBehavior.
1928
+ * @param location - The location in the DOM to render the repeat.
1929
+ * @param itemsBinding - The array to render.
1930
+ * @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.
1931
+ * @param templateBinding - The template to render for each item.
1932
+ * @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.
1933
+ * @param options - Options used to turn on special repeat features.
1934
+ */
1935
+ constructor(location: Node, itemsBinding: Binding<TSource, any[]>, isItemsBindingVolatile: boolean, templateBinding: Binding<TSource, SyntheticViewTemplate>, isTemplateBindingVolatile: boolean, options: RepeatOptions);
1936
+ /**
1937
+ * Bind this behavior to the source.
1938
+ * @param source - The source to bind to.
1939
+ * @param context - The execution context that the binding is operating within.
1940
+ */
1941
+ bind(source: TSource, context: ExecutionContext): void;
1942
+ /**
1943
+ * Unbinds this behavior from the source.
1944
+ * @param source - The source to unbind from.
1945
+ */
1946
+ unbind(): void;
1947
+ /**
1948
+ * Handles changes in the array, its items, and the repeat template.
1949
+ * @param source - The source of the change.
1950
+ * @param args - The details about what was changed.
1951
+ */
1952
+ handleChange(source: any, args: Splice[]): void;
1953
+ private observeItems;
1954
+ private updateViews;
1955
+ private refreshAllViews;
1956
+ private unbindAllViews;
1957
+ }
1958
+
1959
+ /**
1960
+ * A directive that configures list rendering.
1961
+ * @public
1962
+ */
1963
+ export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
1964
+ readonly itemsBinding: Binding;
1965
+ readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
1966
+ readonly options: RepeatOptions;
1967
+ private isItemsBindingVolatile;
1968
+ private isTemplateBindingVolatile;
1969
+ /**
1970
+ * The unique id of the factory.
1971
+ */
1972
+ id: string;
1973
+ /**
1974
+ * The structural id of the DOM node to which the created behavior will apply.
1975
+ */
1976
+ nodeId: string;
1977
+ /**
1978
+ * Creates a placeholder string based on the directive's index within the template.
1979
+ * @param index - The index of the directive within the template.
1980
+ */
1981
+ createHTML(add: AddViewBehaviorFactory): string;
1982
+ /**
1983
+ * Creates an instance of RepeatDirective.
1984
+ * @param itemsBinding - The binding that provides the array to render.
1985
+ * @param templateBinding - The template binding used to obtain a template to render for each item in the array.
1986
+ * @param options - Options used to turn on special repeat features.
1987
+ */
1988
+ constructor(itemsBinding: Binding, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
1989
+ /**
1990
+ * Creates a behavior for the provided target node.
1991
+ * @param target - The node instance to create the behavior for.
1992
+ */
1993
+ createBehavior(targets: ViewBehaviorTargets): RepeatBehavior<TSource>;
1994
+ }
1995
+
1996
+ /**
1997
+ * Options for configuring repeat behavior.
1998
+ * @public
1999
+ */
2000
+ export declare interface RepeatOptions {
2001
+ /**
2002
+ * Enables index, length, and dependent positioning updates in item templates.
2003
+ */
2004
+ positioning?: boolean;
2005
+ /**
2006
+ * Enables view recycling
2007
+ */
2008
+ recycle?: boolean;
2009
+ }
2010
+
2011
+ /**
2012
+ * A directive that observes the `assignedNodes()` of a slot and updates a property
2013
+ * whenever they change.
2014
+ * @param propertyOrOptions - The options used to configure slotted node observation.
2015
+ * @public
2016
+ */
2017
+ export declare function slotted<T = any>(propertyOrOptions: (keyof T & string) | SlottedDirectiveOptions<keyof T & string>): CaptureType<T>;
2018
+
2019
+ /**
2020
+ * The runtime behavior for slotted node observation.
2021
+ * @public
2022
+ */
2023
+ export declare class SlottedDirective extends NodeObservationDirective<SlottedDirectiveOptions> {
2024
+ /**
2025
+ * Begins observation of the nodes.
2026
+ * @param target - The target to observe.
2027
+ */
2028
+ observe(target: EventSource): void;
2029
+ /**
2030
+ * Disconnects observation of the nodes.
2031
+ * @param target - The target to unobserve.
2032
+ */
2033
+ disconnect(target: EventSource): void;
2034
+ /**
2035
+ * Retrieves the raw nodes that should be assigned to the source property.
2036
+ * @param target - The target to get the node to.
2037
+ */
2038
+ getNodes(target: HTMLSlotElement): Node[];
2039
+ /** @internal */
2040
+ handleEvent(event: Event): void;
2041
+ }
2042
+
2043
+ /**
2044
+ * The options used to configure slotted node observation.
2045
+ * @public
2046
+ */
2047
+ export declare interface SlottedDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, AssignedNodesOptions {
2048
+ }
2049
+
2050
+ /**
2051
+ * A splice map is a representation of how a previous array of items
2052
+ * was transformed into a new array of items. Conceptually it is a list of
2053
+ * tuples of
2054
+ *
2055
+ * (index, removed, addedCount)
2056
+ *
2057
+ * which are kept in ascending index order of. The tuple represents that at
2058
+ * the |index|, |removed| sequence of items were removed, and counting forward
2059
+ * from |index|, |addedCount| items were added.
2060
+ * @public
2061
+ */
2062
+ export declare class Splice {
2063
+ index: number;
2064
+ removed: any[];
2065
+ addedCount: number;
2066
+ /**
2067
+ * Indicates that this splice represents a complete array reset.
2068
+ */
2069
+ reset?: boolean;
2070
+ /**
2071
+ * Creates a splice.
2072
+ * @param index - The index that the splice occurs at.
2073
+ * @param removed - The items that were removed.
2074
+ * @param addedCount - The number of items that were added.
2075
+ */
2076
+ constructor(index: number, removed: any[], addedCount: number);
2077
+ /**
2078
+ * Adjusts the splice index based on the provided array.
2079
+ * @param array - The array to adjust to.
2080
+ * @returns The same splice, mutated based on the reference array.
2081
+ */
2082
+ adjustTo(array: any[]): this;
2083
+ }
2084
+
2085
+ /**
2086
+ * An approach to tracking changes in an array.
2087
+ * @public
2088
+ */
2089
+ export declare interface SpliceStrategy {
2090
+ /**
2091
+ * The level of feature support the splice strategy provides.
2092
+ */
2093
+ readonly support: SpliceStrategySupport;
2094
+ /**
2095
+ * Normalizes the splices before delivery to array change subscribers.
2096
+ * @param previous - The previous version of the array if a reset has taken place.
2097
+ * @param current - The current version of the array.
2098
+ * @param changes - The set of changes tracked against the array.
2099
+ */
2100
+ normalize(previous: unknown[] | undefined, current: unknown[], changes: Splice[] | undefined): readonly Splice[];
2101
+ /**
2102
+ * Performs and tracks a pop operation on an array.
2103
+ * @param array - The array to track the change for.
2104
+ * @param observer - The observer to register the change with.
2105
+ * @param pop - The operation to perform.
2106
+ * @param args - The arguments for the operation.
2107
+ */
2108
+ pop(array: any[], observer: ArrayObserver, pop: typeof Array.prototype.pop, args: any[]): any;
2109
+ /**
2110
+ * Performs and tracks a push operation on an array.
2111
+ * @param array - The array to track the change for.
2112
+ * @param observer - The observer to register the change with.
2113
+ * @param push - The operation to perform.
2114
+ * @param args - The arguments for the operation.
2115
+ */
2116
+ push(array: any[], observer: ArrayObserver, push: typeof Array.prototype.push, args: any[]): any;
2117
+ /**
2118
+ * Performs and tracks a reverse operation on an array.
2119
+ * @param array - The array to track the change for.
2120
+ * @param observer - The observer to register the change with.
2121
+ * @param reverse - The operation to perform.
2122
+ * @param args - The arguments for the operation.
2123
+ */
2124
+ reverse(array: any[], observer: ArrayObserver, reverse: typeof Array.prototype.reverse, args: any[]): any;
2125
+ /**
2126
+ * Performs and tracks a shift operation on an array.
2127
+ * @param array - The array to track the change for.
2128
+ * @param observer - The observer to register the change with.
2129
+ * @param shift - The operation to perform.
2130
+ * @param args - The arguments for the operation.
2131
+ */
2132
+ shift(array: any[], observer: ArrayObserver, shift: typeof Array.prototype.shift, args: any[]): any;
2133
+ /**
2134
+ * Performs and tracks a sort operation on an array.
2135
+ * @param array - The array to track the change for.
2136
+ * @param observer - The observer to register the change with.
2137
+ * @param sort - The operation to perform.
2138
+ * @param args - The arguments for the operation.
2139
+ */
2140
+ sort(array: any[], observer: ArrayObserver, sort: typeof Array.prototype.sort, args: any[]): any[];
2141
+ /**
2142
+ * Performs and tracks a splice operation on an array.
2143
+ * @param array - The array to track the change for.
2144
+ * @param observer - The observer to register the change with.
2145
+ * @param splice - The operation to perform.
2146
+ * @param args - The arguments for the operation.
2147
+ */
2148
+ splice(array: any[], observer: ArrayObserver, splice: typeof Array.prototype.splice, args: any[]): any;
2149
+ /**
2150
+ * Performs and tracks an unshift operation on an array.
2151
+ * @param array - The array to track the change for.
2152
+ * @param observer - The observer to register the change with.
2153
+ * @param unshift - The operation to perform.
2154
+ * @param args - The arguments for the operation.
2155
+ */
2156
+ unshift(array: any[], observer: ArrayObserver, unshift: typeof Array.prototype.unshift, args: any[]): any[];
2157
+ }
2158
+
2159
+ /**
2160
+ * Functionality related to tracking changes in arrays.
2161
+ * @public
2162
+ */
2163
+ export declare const SpliceStrategy: Readonly<{
2164
+ /**
2165
+ * A set of changes that represent a full array reset.
2166
+ */
2167
+ readonly reset: Splice[];
2168
+ /**
2169
+ * Sets the default strategy to use for array observers.
2170
+ * @param strategy - The splice strategy to use.
2171
+ */
2172
+ readonly setDefaultStrategy: (strategy: SpliceStrategy) => void;
2173
+ }>;
2174
+
2175
+ /**
2176
+ * Indicates what level of feature support the splice
2177
+ * strategy provides.
2178
+ * @public
2179
+ */
2180
+ export declare const SpliceStrategySupport: Readonly<{
2181
+ /**
2182
+ * Only supports resets.
2183
+ */
2184
+ readonly reset: 1;
2185
+ /**
2186
+ * Supports tracking splices and resets.
2187
+ */
2188
+ readonly splice: 2;
2189
+ /**
2190
+ * Supports tracking splices and resets, while applying some form
2191
+ * of optimization, such as merging, to the splices.
2192
+ */
2193
+ readonly optimized: 3;
2194
+ }>;
2195
+
2196
+ /**
2197
+ * The available values for SpliceStrategySupport.
2198
+ * @public
2199
+ */
2200
+ export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof typeof SpliceStrategySupport];
2201
+
2202
+ /**
2203
+ * A base class used for attribute directives that don't need internal state.
2204
+ * @public
2205
+ */
2206
+ export declare abstract class StatelessAttachedAttributeDirective<T> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
2207
+ protected options: T;
2208
+ /**
2209
+ * The unique id of the factory.
2210
+ */
2211
+ id: string;
2212
+ /**
2213
+ * The structural id of the DOM node to which the created behavior will apply.
2214
+ */
2215
+ nodeId: string;
2216
+ /**
2217
+ * Creates an instance of RefDirective.
2218
+ * @param options - The options to use in configuring the directive.
2219
+ */
2220
+ constructor(options: T);
2221
+ /**
2222
+ * Creates a behavior.
2223
+ * @param targets - The targets available for behaviors to be attached to.
2224
+ */
2225
+ createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
2226
+ /**
2227
+ * Creates a placeholder string based on the directive's index within the template.
2228
+ * @param index - The index of the directive within the template.
2229
+ * @remarks
2230
+ * Creates a custom attribute placeholder.
2231
+ */
2232
+ createHTML(add: AddViewBehaviorFactory): string;
2233
+ /**
2234
+ * Bind this behavior to the source.
2235
+ * @param source - The source to bind to.
2236
+ * @param context - The execution context that the binding is operating within.
2237
+ * @param targets - The targets that behaviors in a view can attach to.
2238
+ */
2239
+ abstract bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2240
+ /**
2241
+ * Unbinds this behavior from the source.
2242
+ * @param source - The source to unbind from.
2243
+ */
2244
+ abstract unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2245
+ }
2246
+
2247
+ /**
2248
+ * Implemented to provide specific behavior when adding/removing styles
2249
+ * for elements.
2250
+ * @public
2251
+ */
2252
+ export declare interface StyleStrategy {
2253
+ /**
2254
+ * Adds styles to the target.
2255
+ * @param target - The target to add the styles to.
2256
+ */
2257
+ addStylesTo(target: StyleTarget): void;
2258
+ /**
2259
+ * Removes styles from the target.
2260
+ * @param target - The target to remove the styles from.
2261
+ */
2262
+ removeStylesFrom(target: StyleTarget): void;
2263
+ }
2264
+
2265
+ /**
2266
+ * A node that can be targeted by styles.
2267
+ * @public
2268
+ */
2269
+ export declare interface StyleTarget {
2270
+ /**
2271
+ * Stylesheets to be adopted by the node.
2272
+ */
2273
+ adoptedStyleSheets?: CSSStyleSheet[];
2274
+ /**
2275
+ * Adds styles to the target by appending the styles.
2276
+ * @param styles - The styles element to add.
2277
+ */
2278
+ append(styles: HTMLStyleElement): void;
2279
+ /**
2280
+ * Removes styles from the target.
2281
+ * @param styles - The styles element to remove.
2282
+ */
2283
+ removeChild(styles: HTMLStyleElement): void;
2284
+ /**
2285
+ * Returns all element descendants of node that match selectors.
2286
+ * @param selectors - The CSS selector to use for the query.
2287
+ */
2288
+ querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
2289
+ }
2290
+
2291
+ /**
2292
+ * Implemented by objects that are interested in change notifications.
2293
+ * @public
2294
+ */
2295
+ export declare interface Subscriber {
2296
+ /**
2297
+ * Called when a subject this instance has subscribed to changes.
2298
+ * @param subject - The subject of the change.
2299
+ * @param args - The event args detailing the change that occurred.
2300
+ */
2301
+ handleChange(subject: any, args: any): void;
2302
+ }
2303
+
2304
+ /**
2305
+ * An implementation of {@link Notifier} that efficiently keeps track of
2306
+ * subscribers interested in a specific change notification on an
2307
+ * observable subject.
2308
+ *
2309
+ * @remarks
2310
+ * This set is optimized for the most common scenario of 1 or 2 subscribers.
2311
+ * With this in mind, it can store a subscriber in an internal field, allowing it to avoid Array#push operations.
2312
+ * If the set ever exceeds two subscribers, it upgrades to an array automatically.
2313
+ * @public
2314
+ */
2315
+ export declare class SubscriberSet implements Notifier {
2316
+ private sub1;
2317
+ private sub2;
2318
+ private spillover;
2319
+ /**
2320
+ * The object that subscribers will receive notifications for.
2321
+ */
2322
+ readonly subject: any;
2323
+ /**
2324
+ * Creates an instance of SubscriberSet for the specified subject.
2325
+ * @param subject - The subject that subscribers will receive notifications from.
2326
+ * @param initialSubscriber - An initial subscriber to changes.
2327
+ */
2328
+ constructor(subject: any, initialSubscriber?: Subscriber);
2329
+ /**
2330
+ * Checks whether the provided subscriber has been added to this set.
2331
+ * @param subscriber - The subscriber to test for inclusion in this set.
2332
+ */
2333
+ has(subscriber: Subscriber): boolean;
2334
+ /**
2335
+ * Subscribes to notification of changes in an object's state.
2336
+ * @param subscriber - The object that is subscribing for change notification.
2337
+ */
2338
+ subscribe(subscriber: Subscriber): void;
2339
+ /**
2340
+ * Unsubscribes from notification of changes in an object's state.
2341
+ * @param subscriber - The object that is unsubscribing from change notification.
2342
+ */
2343
+ unsubscribe(subscriber: Subscriber): void;
2344
+ /**
2345
+ * Notifies all subscribers.
2346
+ * @param args - Data passed along to subscribers during notification.
2347
+ */
2348
+ notify(args: any): void;
2349
+ }
2350
+
2351
+ /**
2352
+ * The options used to configure subtree observation.
2353
+ * @public
2354
+ */
2355
+ export declare interface SubtreeDirectiveOptions<T = any> extends NodeBehaviorOptions<T>, Omit<MutationObserverInit, "subtree" | "childList"> {
2356
+ /**
2357
+ * Indicates that child subtrees should be observed for changes.
2358
+ */
2359
+ subtree: boolean;
2360
+ /**
2361
+ * When subtrees are observed, a query selector is required to indicate
2362
+ * which of potentially many nodes should be assigned to the property.
2363
+ */
2364
+ selector: string;
2365
+ }
2366
+
2367
+ /**
2368
+ * A view representing a range of DOM nodes which can be added/removed ad hoc.
2369
+ * @public
2370
+ */
2371
+ export declare interface SyntheticView<TSource = any, TParent = any> extends View<TSource, TParent> {
2372
+ /**
2373
+ * The first DOM node in the range of nodes that make up the view.
2374
+ */
2375
+ readonly firstChild: Node;
2376
+ /**
2377
+ * The last DOM node in the range of nodes that make up the view.
2378
+ */
2379
+ readonly lastChild: Node;
2380
+ /**
2381
+ * Inserts the view's DOM nodes before the referenced node.
2382
+ * @param node - The node to insert the view's DOM before.
2383
+ */
2384
+ insertBefore(node: Node): void;
2385
+ /**
2386
+ * Removes the view's DOM nodes.
2387
+ * The nodes are not disposed and the view can later be re-inserted.
2388
+ */
2389
+ remove(): void;
2390
+ }
2391
+
2392
+ /**
2393
+ * A template capable of rendering views not specifically connected to custom elements.
2394
+ * @public
2395
+ */
2396
+ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
2397
+ /**
2398
+ * Creates a SyntheticView instance based on this template definition.
2399
+ */
2400
+ create(): SyntheticView<TSource, TParent>;
2401
+ }
2402
+
2403
+ /**
2404
+ * Represents the types of values that can be interpolated into a template.
2405
+ * @public
2406
+ */
2407
+ export declare type TemplateValue<TSource, TParent = any> = Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource>;
2408
+
2409
+ /**
2410
+ * Enables working with trusted types.
2411
+ * @public
2412
+ */
2413
+ export declare type TrustedTypes = {
2414
+ /**
2415
+ * Creates a trusted types policy.
2416
+ * @param name - The policy name.
2417
+ * @param rules - The policy rules implementation.
2418
+ */
2419
+ createPolicy(name: string, rules: TrustedTypesPolicy): TrustedTypesPolicy;
2420
+ };
2421
+
2422
+ /**
2423
+ * A policy for use with the standard trustedTypes platform API.
2424
+ * @public
2425
+ */
2426
+ export declare type TrustedTypesPolicy = {
2427
+ /**
2428
+ * Creates trusted HTML.
2429
+ * @param html - The HTML to clear as trustworthy.
2430
+ */
2431
+ createHTML(html: string): string;
2432
+ };
2433
+
2434
+ /**
2435
+ * Do not change. Part of shared kernel contract.
2436
+ * @internal
2437
+ */
2438
+ export declare interface TypeDefinition {
2439
+ type: Function;
2440
+ }
2441
+
2442
+ /**
2443
+ * Do not change. Part of shared kernel contract.
2444
+ * @internal
2445
+ */
2446
+ export declare interface TypeRegistry<TDefinition extends TypeDefinition> {
2447
+ register(definition: TDefinition): boolean;
2448
+ getByType(key: Function): TDefinition | undefined;
2449
+ getForInstance(object: any): TDefinition | undefined;
2450
+ }
2451
+
2452
+ /**
2453
+ * A base binding behavior for DOM updates.
2454
+ * @public
2455
+ */
2456
+ export declare class UpdateBinding implements ViewBehavior {
2457
+ readonly directive: HTMLBindingDirective;
2458
+ protected updateTarget: UpdateTarget;
2459
+ /**
2460
+ * Creates an instance of UpdateBinding.
2461
+ * @param directive - The directive that has the configuration for this behavior.
2462
+ * @param updateTarget - The function used to update the target with the latest value.
2463
+ */
2464
+ constructor(directive: HTMLBindingDirective, updateTarget: UpdateTarget);
2465
+ /**
2466
+ * Bind this behavior to the source.
2467
+ * @param source - The source to bind to.
2468
+ * @param context - The execution context that the binding is operating within.
2469
+ * @param targets - The targets that behaviors in a view can attach to.
2470
+ */
2471
+ bind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2472
+ /**
2473
+ * Unbinds this behavior from the source.
2474
+ * @param source - The source to unbind from.
2475
+ * @param context - The execution context that the binding is operating within.
2476
+ * @param targets - The targets that behaviors in a view can attach to.
2477
+ */
2478
+ unbind(source: any, context: ExecutionContext, targets: ViewBehaviorTargets): void;
2479
+ /**
2480
+ * Creates a behavior.
2481
+ * @param targets - The targets available for behaviors to be attached to.
2482
+ */
2483
+ createBehavior(targets: ViewBehaviorTargets): ViewBehavior;
2484
+ }
2485
+
2486
+ /**
2487
+ * A work queue used to synchronize writes to the DOM.
2488
+ * @public
2489
+ */
2490
+ export declare interface UpdateQueue {
2491
+ /**
2492
+ * Schedules DOM update work in the next batch.
2493
+ * @param callable - The callable function or object to queue.
2494
+ */
2495
+ enqueue(callable: Callable): void;
2496
+ /**
2497
+ * Resolves with the next DOM update.
2498
+ */
2499
+ next(): Promise<void>;
2500
+ /**
2501
+ * Immediately processes all work previously scheduled
2502
+ * through enqueue.
2503
+ * @remarks
2504
+ * This also forces next() promises
2505
+ * to resolve.
2506
+ */
2507
+ process(): void;
2508
+ /**
2509
+ * Sets the update mode used by enqueue.
2510
+ * @param isAsync - Indicates whether DOM updates should be asynchronous.
2511
+ * @remarks
2512
+ * By default, the update mode is asynchronous, since that provides the best
2513
+ * performance in the browser. Passing false to setMode will instead cause
2514
+ * the queue to be immediately processed for each call to enqueue. However,
2515
+ * ordering will still be preserved so that nested tasks do not run until
2516
+ * after parent tasks complete.
2517
+ */
2518
+ setMode(isAsync: boolean): void;
2519
+ }
2520
+
2521
+ /**
2522
+ * The default UpdateQueue.
2523
+ * @public
2524
+ */
2525
+ export declare const Updates: UpdateQueue;
2526
+
2527
+ /**
2528
+ * A target update function.
2529
+ * @param this - The "this" context for the update.
2530
+ * @param target - The node that is targeted by the update.
2531
+ * @param aspect - The aspect of the node that is being targeted.
2532
+ * @param value - The value to assign to the aspect.
2533
+ * @param source - The source object that the value was derived from.
2534
+ * @param context - The execution context that the binding is being run under.
2535
+ * @public
2536
+ */
2537
+ export declare type UpdateTarget = (this: UpdateTargetThis, target: Node, aspect: string, value: any, source: any, context: ExecutionContext) => void;
2538
+
2539
+ /**
2540
+ * The "this" context for an update target function.
2541
+ * @public
2542
+ */
2543
+ export declare interface UpdateTargetThis {
2544
+ /**
2545
+ * The directive configuration for the update.
2546
+ */
2547
+ directive: HTMLBindingDirective;
2548
+ }
2549
+
2550
+ /**
2551
+ * Represents objects that can convert values to and from
2552
+ * view or model representations.
2553
+ * @public
2554
+ */
2555
+ export declare interface ValueConverter {
2556
+ /**
2557
+ * Converts a value from its representation in the model, to a representation for the view.
2558
+ * @param value - The value to convert to a view representation.
2559
+ */
2560
+ toView(value: any): any;
2561
+ /**
2562
+ * Converts a value from its representation in the view, to a representation for the model.
2563
+ * @param value - The value to convert to a model representation.
2564
+ */
2565
+ fromView(value: any): any;
2566
+ }
2567
+
2568
+ /**
2569
+ * Represents a collection of DOM nodes which can be bound to a data source.
2570
+ * @public
2571
+ */
2572
+ export declare interface View<TSource = any, TParent = any> extends Disposable {
2573
+ /**
2574
+ * The execution context the view is running within.
2575
+ */
2576
+ readonly context: ExecutionContext<TParent> | null;
2577
+ /**
2578
+ * The data that the view is bound to.
2579
+ */
2580
+ readonly source: TSource | null;
2581
+ /**
2582
+ * Binds a view's behaviors to its binding source.
2583
+ * @param source - The binding source for the view's binding behaviors.
2584
+ * @param context - The execution context to run the view within.
2585
+ */
2586
+ bind(source: TSource, context: ExecutionContext<TParent>): void;
2587
+ /**
2588
+ * Unbinds a view's behaviors from its binding source and context.
2589
+ */
2590
+ unbind(): void;
2591
+ }
2592
+
2593
+ /**
2594
+ * Represents an object that can contribute behavior to a view.
2595
+ * @public
2596
+ */
2597
+ export declare interface ViewBehavior<TSource = any, TParent = any> {
2598
+ /**
2599
+ * Bind this behavior to the source.
2600
+ * @param source - The source to bind to.
2601
+ * @param context - The execution context that the binding is operating within.
2602
+ * @param targets - The targets that behaviors in a view can attach to.
2603
+ */
2604
+ bind(source: TSource, context: ExecutionContext<TParent>, targets: ViewBehaviorTargets): void;
2605
+ /**
2606
+ * Unbinds this behavior from the source.
2607
+ * @param source - The source to unbind from.
2608
+ * @param context - The execution context that the binding is operating within.
2609
+ * @param targets - The targets that behaviors in a view can attach to.
2610
+ */
2611
+ unbind(source: TSource, context: ExecutionContext<TParent>, targets: ViewBehaviorTargets): void;
2612
+ }
2613
+
2614
+ /**
2615
+ * A factory that can create a {@link Behavior} associated with a particular
2616
+ * location within a DOM fragment.
2617
+ * @public
2618
+ */
2619
+ export declare interface ViewBehaviorFactory {
2620
+ /**
2621
+ * The unique id of the factory.
2622
+ */
2623
+ id: string;
2624
+ /**
2625
+ * The structural id of the DOM node to which the created behavior will apply.
2626
+ */
2627
+ nodeId: string;
2628
+ /**
2629
+ * Creates a behavior.
2630
+ * @param targets - The targets available for behaviors to be attached to.
2631
+ */
2632
+ createBehavior(targets: ViewBehaviorTargets): Behavior | ViewBehavior;
2633
+ }
2634
+
2635
+ /**
2636
+ * The target nodes available to a behavior.
2637
+ * @public
2638
+ */
2639
+ export declare type ViewBehaviorTargets = {
2640
+ [id: string]: Node;
2641
+ };
2642
+
2643
+ /**
2644
+ * A template capable of creating HTMLView instances or rendering directly to DOM.
2645
+ * @public
2646
+ */
2647
+ export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
2648
+ private result;
2649
+ /**
2650
+ * The html representing what this template will
2651
+ * instantiate, including placeholders for directives.
2652
+ */
2653
+ readonly html: string | HTMLTemplateElement;
2654
+ /**
2655
+ * The directives that will be connected to placeholders in the html.
2656
+ */
2657
+ readonly factories: Record<string, ViewBehaviorFactory>;
2658
+ /**
2659
+ * Creates an instance of ViewTemplate.
2660
+ * @param html - The html representing what this template will instantiate, including placeholders for directives.
2661
+ * @param factories - The directives that will be connected to placeholders in the html.
2662
+ */
2663
+ constructor(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>);
2664
+ /**
2665
+ * Creates an HTMLView instance based on this template definition.
2666
+ * @param hostBindingTarget - The element that host behaviors will be bound to.
2667
+ */
2668
+ create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
2669
+ /**
2670
+ * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
2671
+ * @param source - The data source to bind the template to.
2672
+ * @param host - The Element where the template will be rendered.
2673
+ * @param hostBindingTarget - An HTML element to target the host bindings at if different from the
2674
+ * host that the template is being attached to.
2675
+ */
2676
+ render(source: TSource, host: Node, hostBindingTarget?: Element, context?: ExecutionContext): HTMLView<TSource, TParent>;
2677
+ }
2678
+
2679
+ /**
2680
+ * Decorator: Marks a property getter as having volatile observable dependencies.
2681
+ * @param target - The target that the property is defined on.
2682
+ * @param name - The property name.
2683
+ * @param name - The existing descriptor.
2684
+ * @public
2685
+ */
2686
+ export declare function volatile(target: {}, name: string | Accessor, descriptor: PropertyDescriptor): PropertyDescriptor;
2687
+
2688
+ /**
2689
+ * A directive that enables basic conditional rendering in a template.
2690
+ * @param binding - The condition to test for rendering.
2691
+ * @param templateOrTemplateBinding - The template or a binding that gets
2692
+ * the template to render when the condition is true.
2693
+ * @public
2694
+ */
2695
+ export declare function when<TSource = any, TReturn = any>(binding: Binding<TSource, TReturn>, templateOrTemplateBinding: SyntheticViewTemplate | Binding<TSource, SyntheticViewTemplate>): CaptureType<TSource>;
2696
+
2697
+ export { }