@microsoft/fast-element 1.10.5 → 2.0.0-beta.10

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