@microsoft/fast-element 2.10.4 → 3.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -2
- package/README.md +244 -1
- package/dist/arrays/arrays.api.json +2621 -0
- package/dist/context/context.api.json +13 -13
- package/dist/declarative/declarative.api.json +8483 -0
- package/dist/di/di.api.json +16 -16
- package/dist/dts/__test__/helpers.d.ts +6 -0
- package/dist/dts/array-observer.d.ts +2 -0
- package/dist/dts/arrays.d.ts +2 -0
- package/dist/dts/attr.d.ts +1 -0
- package/dist/dts/binding/binding.d.ts +15 -5
- package/dist/dts/binding/one-time.d.ts +1 -1
- package/dist/dts/binding/one-way.d.ts +1 -1
- package/dist/dts/binding/signal.d.ts +6 -6
- package/dist/dts/binding/two-way.d.ts +2 -1
- package/dist/dts/binding.d.ts +7 -0
- package/dist/dts/components/attributes.d.ts +1 -4
- package/dist/dts/components/definition-schema-transforms.d.ts +9 -0
- package/dist/dts/components/element-controller.d.ts +80 -114
- package/dist/dts/components/element-hydration.d.ts +1 -1
- package/dist/dts/components/enable-hydration.d.ts +54 -0
- package/dist/dts/components/fast-definitions.d.ts +98 -46
- package/dist/dts/components/fast-element.d.ts +43 -16
- package/dist/dts/components/hydration-tracker.d.ts +83 -0
- package/dist/dts/components/hydration.d.ts +23 -53
- package/dist/dts/components/schema.d.ts +205 -0
- package/dist/dts/context.d.ts +13 -13
- package/dist/dts/css.d.ts +3 -0
- package/dist/dts/debug.d.ts +5 -1
- package/dist/dts/declarative/attribute-map.d.ts +58 -0
- package/dist/dts/declarative/debug.d.ts +4 -0
- package/dist/dts/declarative/index.d.ts +14 -0
- package/dist/dts/declarative/interfaces.d.ts +8 -0
- package/dist/dts/declarative/observer-map-utilities.d.ts +58 -0
- package/dist/dts/declarative/observer-map.d.ts +89 -0
- package/dist/dts/declarative/runtime.d.ts +5 -0
- package/dist/dts/declarative/syntax.d.ts +21 -0
- package/dist/dts/declarative/template-bridge.d.ts +33 -0
- package/dist/dts/declarative/template-parser.d.ts +98 -0
- package/dist/dts/declarative/template.d.ts +10 -0
- package/dist/dts/declarative/utilities.d.ts +358 -0
- package/dist/dts/di/di.d.ts +7 -7
- package/dist/dts/directives/children.d.ts +2 -0
- package/dist/dts/directives/node-observation.d.ts +2 -0
- package/dist/dts/directives/ref.d.ts +2 -0
- package/dist/dts/directives/repeat.d.ts +4 -0
- package/dist/dts/directives/slotted.d.ts +2 -0
- package/dist/dts/directives/when.d.ts +3 -0
- package/dist/dts/dom-policy.d.ts +23 -5
- package/dist/dts/dom.d.ts +4 -16
- package/dist/dts/html.d.ts +5 -0
- package/dist/dts/hydration/diagnostics.d.ts +93 -0
- package/dist/dts/hydration/hydration-debugger.d.ts +35 -0
- package/dist/dts/hydration/messages.d.ts +62 -0
- package/dist/dts/hydration/runtime.d.ts +7 -0
- package/dist/dts/hydration/target-builder.d.ts +40 -12
- package/dist/dts/hydration.d.ts +18 -0
- package/dist/dts/index.d.ts +42 -42
- package/dist/dts/index.debug.d.ts +0 -1
- package/dist/dts/index.rollup.debug.d.ts +0 -1
- package/dist/dts/interfaces.d.ts +2 -49
- package/dist/dts/observable.d.ts +3 -6
- package/dist/dts/observation/arrays.d.ts +1 -1
- package/dist/dts/observation/observable.d.ts +3 -3
- package/dist/dts/observation/update-queue.d.ts +1 -1
- package/dist/dts/platform.d.ts +45 -8
- package/dist/dts/registry.d.ts +1 -0
- package/dist/dts/render.d.ts +7 -0
- package/dist/dts/schema.d.ts +1 -0
- package/dist/dts/state/exports.d.ts +1 -1
- package/dist/dts/state/state.d.ts +2 -2
- package/dist/dts/styles/css-directive.d.ts +5 -12
- package/dist/dts/styles/css.d.ts +5 -7
- package/dist/dts/styles/element-styles.d.ts +0 -10
- package/dist/dts/styles.d.ts +6 -0
- package/dist/dts/templating/compiler.d.ts +1 -1
- package/dist/dts/templating/html-binding-directive.d.ts +10 -2
- package/dist/dts/templating/html-directive.d.ts +19 -1
- package/dist/dts/templating/hydration-view.d.ts +130 -0
- package/dist/dts/templating/render.d.ts +1 -1
- package/dist/dts/templating/repeat.d.ts +1 -1
- package/dist/dts/templating/template.d.ts +15 -7
- package/dist/dts/templating/view.d.ts +25 -102
- package/dist/dts/templating.d.ts +10 -0
- package/dist/dts/testing/exports.d.ts +2 -2
- package/dist/dts/testing/fakes.d.ts +4 -4
- package/dist/dts/updates.d.ts +1 -0
- package/dist/dts/volatile.d.ts +2 -0
- package/dist/esm/__test__/helpers.js +22 -0
- package/dist/esm/__test__/setup-node.js +18 -0
- package/dist/esm/array-observer.js +1 -0
- package/dist/esm/arrays.js +1 -0
- package/dist/esm/attr.js +1 -0
- package/dist/esm/binding/normalize.js +1 -1
- package/dist/esm/binding/signal.js +4 -4
- package/dist/esm/binding/two-way.js +3 -3
- package/dist/esm/binding.js +4 -0
- package/dist/esm/components/attributes.js +18 -11
- package/dist/esm/components/definition-schema-transforms.js +23 -0
- package/dist/esm/components/element-controller.js +206 -270
- package/dist/esm/components/element-hydration.js +1 -1
- package/dist/esm/components/enable-hydration.js +124 -0
- package/dist/esm/components/fast-definitions.js +219 -56
- package/dist/esm/components/fast-element.js +18 -27
- package/dist/esm/components/hydration-tracker.js +122 -0
- package/dist/esm/components/hydration.js +137 -140
- package/dist/esm/components/schema.js +253 -0
- package/dist/esm/context.js +6 -6
- package/dist/esm/css.js +3 -0
- package/dist/esm/debug.js +27 -26
- package/dist/esm/declarative/attribute-map.js +122 -0
- package/dist/esm/declarative/debug.js +4 -0
- package/dist/esm/declarative/index.js +4 -0
- package/dist/esm/declarative/interfaces.js +9 -0
- package/dist/esm/declarative/observer-map-utilities.js +565 -0
- package/dist/esm/declarative/observer-map.js +216 -0
- package/dist/esm/declarative/runtime.js +14 -0
- package/dist/esm/declarative/syntax.js +36 -0
- package/dist/esm/declarative/template-bridge.js +160 -0
- package/dist/esm/declarative/template-parser.js +306 -0
- package/dist/esm/declarative/template.js +143 -0
- package/dist/esm/declarative/utilities.js +1069 -0
- package/dist/esm/di/di.js +8 -9
- package/dist/esm/directives/children.js +1 -0
- package/dist/esm/directives/node-observation.js +1 -0
- package/dist/esm/directives/ref.js +1 -0
- package/dist/esm/directives/repeat.js +1 -0
- package/dist/esm/directives/slotted.js +1 -0
- package/dist/esm/directives/when.js +1 -0
- package/dist/esm/dom-policy.js +35 -6
- package/dist/esm/dom.js +1 -1
- package/dist/esm/html.js +2 -0
- package/dist/esm/hydration/diagnostics.js +50 -0
- package/dist/esm/hydration/hydration-debugger.js +112 -0
- package/dist/esm/hydration/messages.js +84 -0
- package/dist/esm/hydration/runtime.js +33 -0
- package/dist/esm/hydration/target-builder.js +144 -91
- package/dist/esm/hydration.js +6 -0
- package/dist/esm/index.debug.js +2 -1
- package/dist/esm/index.js +38 -29
- package/dist/esm/index.rollup.debug.js +3 -2
- package/dist/esm/index.rollup.js +1 -1
- package/dist/esm/interfaces.js +2 -45
- package/dist/esm/metadata.js +2 -8
- package/dist/esm/observable.js +1 -4
- package/dist/esm/observation/arrays.js +1 -1
- package/dist/esm/observation/notifier.js +2 -4
- package/dist/esm/observation/observable.js +5 -5
- package/dist/esm/observation/update-queue.js +47 -58
- package/dist/esm/platform.js +31 -30
- package/dist/esm/registry.js +1 -0
- package/dist/esm/render.js +1 -0
- package/dist/esm/schema.js +1 -0
- package/dist/esm/state/exports.js +1 -1
- package/dist/esm/styles/css-directive.js +1 -2
- package/dist/esm/styles/css.js +15 -56
- package/dist/esm/styles/element-styles.js +69 -15
- package/dist/esm/styles.js +2 -0
- package/dist/esm/templating/html-binding-directive.js +11 -9
- package/dist/esm/templating/hydration-view.js +228 -0
- package/dist/esm/templating/render.js +39 -18
- package/dist/esm/templating/repeat.js +69 -33
- package/dist/esm/templating/template.js +7 -7
- package/dist/esm/templating/view.js +25 -234
- package/dist/esm/templating.js +7 -0
- package/dist/esm/testing/exports.js +2 -2
- package/dist/esm/testing/fixture.js +2 -2
- package/dist/esm/testing/timeout.js +2 -2
- package/dist/esm/updates.js +1 -0
- package/dist/esm/volatile.js +1 -0
- package/dist/fast-element.api.json +14389 -11138
- package/dist/fast-element.d.ts +3651 -809
- package/dist/fast-element.debug.js +5666 -4722
- package/dist/fast-element.debug.min.js +2 -2
- package/dist/fast-element.js +5394 -4381
- package/dist/fast-element.min.js +2 -2
- package/dist/fast-element.untrimmed.d.ts +923 -472
- package/dist/hydration/hydration.api.json +6460 -0
- package/dist/styles/styles.api.json +2672 -0
- package/package.json +165 -45
- package/ARCHITECTURE_FASTELEMENT.md +0 -63
- package/ARCHITECTURE_HTML_TAGGED_TEMPLATE_LITERAL.md +0 -36
- package/ARCHITECTURE_INTRO.md +0 -10
- package/ARCHITECTURE_OVERVIEW.md +0 -52
- package/ARCHITECTURE_UPDATES.md +0 -11
- package/CHANGELOG.json +0 -2275
- package/DESIGN.md +0 -510
- package/api-extractor.context.json +0 -14
- package/api-extractor.di.json +0 -14
- package/biome.json +0 -4
- package/dist/dts/components/install-hydration.d.ts +0 -1
- package/dist/dts/pending-task.d.ts +0 -32
- package/dist/dts/styles/css-binding-directive.d.ts +0 -60
- package/dist/dts/templating/install-hydratable-view-templates.d.ts +0 -1
- package/dist/esm/components/install-hydration.js +0 -3
- package/dist/esm/pending-task.js +0 -28
- package/dist/esm/polyfills.js +0 -60
- package/dist/esm/styles/css-binding-directive.js +0 -76
- package/dist/esm/templating/install-hydratable-view-templates.js +0 -23
- package/docs/ACKNOWLEDGEMENTS.md +0 -12
- package/docs/api-report.api.md +0 -1122
- package/docs/context/api-report.api.md +0 -69
- package/docs/di/api-report.api.md +0 -315
- package/docs/fast-element-2-changes.md +0 -15
- package/playwright.config.ts +0 -26
- package/scripts/run-api-extractor.js +0 -51
- package/test/index.html +0 -11
- package/test/main.ts +0 -104
- package/test/vite.config.ts +0 -19
- package/tsconfig.api-extractor.json +0 -6
- /package/dist/dts/{polyfills.d.ts → __test__/setup-node.d.ts} +0 -0
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core APIs for building standards-based Web Components with FAST Element.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A path discovered from an access expression.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare interface AccessCachedPath extends CachedPathCommon {
|
|
11
|
+
type: "access";
|
|
12
|
+
}
|
|
13
|
+
|
|
1
14
|
/**
|
|
2
15
|
* Represents a getter/setter property accessor on an object.
|
|
3
16
|
* @public
|
|
@@ -20,12 +33,6 @@ export declare interface Accessor {
|
|
|
20
33
|
setValue(source: any, value: any): void;
|
|
21
34
|
}
|
|
22
35
|
|
|
23
|
-
/**
|
|
24
|
-
* Used to add behaviors when constructing styles.
|
|
25
|
-
* @public
|
|
26
|
-
*/
|
|
27
|
-
export declare type AddBehavior = (behavior: HostBehavior<HTMLElement>) => void;
|
|
28
|
-
|
|
29
36
|
/**
|
|
30
37
|
* Used to add behavior factories when constructing templates.
|
|
31
38
|
* @public
|
|
@@ -80,7 +87,7 @@ export declare const ArrayObserver: Readonly<{
|
|
|
80
87
|
* Enables the array observation mechanism.
|
|
81
88
|
* @remarks
|
|
82
89
|
* Array observation is enabled automatically when using the
|
|
83
|
-
*
|
|
90
|
+
* `RepeatDirective`, so calling this API manually is
|
|
84
91
|
* not typically necessary.
|
|
85
92
|
*/
|
|
86
93
|
readonly enable: () => void;
|
|
@@ -222,7 +229,7 @@ export declare class AttributeDefinition implements Accessor {
|
|
|
222
229
|
* changes in the DOM, but does not reflect property changes back.
|
|
223
230
|
* @public
|
|
224
231
|
*/
|
|
225
|
-
export declare type AttributeMode =
|
|
232
|
+
export declare type AttributeMode = "reflect" | "boolean" | "fromView";
|
|
226
233
|
|
|
227
234
|
/**
|
|
228
235
|
* Captures a binding expression along with related information and capabilities.
|
|
@@ -230,20 +237,29 @@ export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "f
|
|
|
230
237
|
* @public
|
|
231
238
|
*/
|
|
232
239
|
export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
|
|
233
|
-
evaluate: Expression<TSource, TReturn, TParent>;
|
|
234
|
-
policy?: DOMPolicy | undefined;
|
|
235
|
-
isVolatile: boolean;
|
|
236
240
|
/**
|
|
237
241
|
* Options associated with the binding.
|
|
238
242
|
*/
|
|
239
243
|
options?: any;
|
|
244
|
+
/**
|
|
245
|
+
* Evaluates the binding.
|
|
246
|
+
*/
|
|
247
|
+
evaluate: Expression<TSource, TReturn, TParent>;
|
|
248
|
+
/**
|
|
249
|
+
* The security policy to associate with this binding.
|
|
250
|
+
*/
|
|
251
|
+
policy?: DOMPolicy;
|
|
252
|
+
/**
|
|
253
|
+
* Indicates whether the binding is volatile.
|
|
254
|
+
*/
|
|
255
|
+
isVolatile: boolean;
|
|
240
256
|
/**
|
|
241
257
|
* Creates a binding.
|
|
242
258
|
* @param evaluate - Evaluates the binding.
|
|
243
259
|
* @param policy - The security policy to associate with this binding.
|
|
244
260
|
* @param isVolatile - Indicates whether the binding is volatile.
|
|
245
261
|
*/
|
|
246
|
-
constructor(evaluate: Expression<TSource, TReturn, TParent>, policy?: DOMPolicy
|
|
262
|
+
constructor(evaluate: Expression<TSource, TReturn, TParent>, policy?: DOMPolicy, isVolatile?: boolean);
|
|
247
263
|
/**
|
|
248
264
|
* Creates an observer capable of notifying a subscriber when the output of a binding changes.
|
|
249
265
|
* @param subscriber - The subscriber to changes in the binding.
|
|
@@ -280,7 +296,27 @@ export declare interface BindingDirective {
|
|
|
280
296
|
*/
|
|
281
297
|
export declare const booleanConverter: ValueConverter;
|
|
282
298
|
|
|
283
|
-
|
|
299
|
+
/**
|
|
300
|
+
* A path discovered while parsing a template.
|
|
301
|
+
* @public
|
|
302
|
+
*/
|
|
303
|
+
export declare type CachedPath = DefaultCachedPath | RepeatCachedPath | AccessCachedPath | EventCachedPath;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Common metadata for paths cached while parsing a template.
|
|
307
|
+
* @public
|
|
308
|
+
*/
|
|
309
|
+
export declare interface CachedPathCommon {
|
|
310
|
+
parentContext: string | null;
|
|
311
|
+
currentContext: string | null;
|
|
312
|
+
path: string;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* A map from element names and root properties to JSON schemas.
|
|
317
|
+
* @public
|
|
318
|
+
*/
|
|
319
|
+
export declare type CachedPathMap = Map<string, Map<string, JSONSchema>>;
|
|
284
320
|
|
|
285
321
|
/**
|
|
286
322
|
* Represents a callable type such as a function or an object with a "call" method.
|
|
@@ -295,7 +331,7 @@ export declare type Callable = typeof Function.prototype.call | {
|
|
|
295
331
|
* into templates.
|
|
296
332
|
* @public
|
|
297
333
|
*/
|
|
298
|
-
export declare interface CaptureType<TSource, TParent> {
|
|
334
|
+
export declare interface CaptureType<TSource = any, TParent = any> {
|
|
299
335
|
}
|
|
300
336
|
|
|
301
337
|
/**
|
|
@@ -347,6 +383,15 @@ export declare class ChildrenDirective extends NodeObservationDirective<Children
|
|
|
347
383
|
*/
|
|
348
384
|
export declare type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | SubtreeDirectiveOptions<T>;
|
|
349
385
|
|
|
386
|
+
/**
|
|
387
|
+
* Describes a child custom element binding referenced by a schema path.
|
|
388
|
+
* @public
|
|
389
|
+
*/
|
|
390
|
+
export declare interface ChildrenMap {
|
|
391
|
+
customElementName: string;
|
|
392
|
+
attributeName: string;
|
|
393
|
+
}
|
|
394
|
+
|
|
350
395
|
/**
|
|
351
396
|
* Represents a constructable class with a prototype.
|
|
352
397
|
* @public
|
|
@@ -423,9 +468,84 @@ export declare const Compiler: {
|
|
|
423
468
|
*/
|
|
424
469
|
export declare type ComposableStyles = string | ElementStyles | CSSStyleSheet;
|
|
425
470
|
|
|
426
|
-
|
|
471
|
+
/**
|
|
472
|
+
* Determines if the reference element contains the test element in a "composed" DOM tree that
|
|
473
|
+
* ignores shadow DOM boundaries.
|
|
474
|
+
*
|
|
475
|
+
* Returns true of the test element is a descendent of the reference, or exists in
|
|
476
|
+
* a shadow DOM that is a logical descendent of the reference. Otherwise returns false.
|
|
477
|
+
* @param reference - The element to test for containment against.
|
|
478
|
+
* @param test - The element being tested for containment.
|
|
479
|
+
*
|
|
480
|
+
* @public
|
|
481
|
+
*/
|
|
482
|
+
export declare function composedContains(reference: HTMLElement, test: HTMLElement): boolean;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Retrieves the "composed parent" element of a node, ignoring DOM tree boundaries.
|
|
486
|
+
* When the parent of a node is a shadow-root, it will return the host
|
|
487
|
+
* element of the shadow root. Otherwise it will return the parent node or null if
|
|
488
|
+
* no parent node exists.
|
|
489
|
+
* @param element - The element for which to retrieve the composed parent
|
|
490
|
+
*
|
|
491
|
+
* @public
|
|
492
|
+
*/
|
|
493
|
+
export declare function composedParent<T extends HTMLElement>(element: T): HTMLElement | null;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Provides computed state capabilities.
|
|
497
|
+
* @beta
|
|
498
|
+
*/
|
|
499
|
+
export declare type ComputedBuilder = {
|
|
500
|
+
/**
|
|
501
|
+
* Callbacks related to computed state.
|
|
502
|
+
*/
|
|
503
|
+
on: {
|
|
504
|
+
/**
|
|
505
|
+
* Provides a setup callback for the computation.
|
|
506
|
+
* @param callback - The callback to run to setup the computation.
|
|
507
|
+
*/
|
|
508
|
+
setup(callback: ComputedSetupCallback): void;
|
|
509
|
+
};
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* A callback that initializes the computation.
|
|
514
|
+
* @beta
|
|
515
|
+
*/
|
|
516
|
+
export declare type ComputedInitializer<T> = (builder: ComputedBuilder) => () => T;
|
|
427
517
|
|
|
428
|
-
|
|
518
|
+
/**
|
|
519
|
+
* A callback that enables computation setup.
|
|
520
|
+
* @beta
|
|
521
|
+
*/
|
|
522
|
+
export declare type ComputedSetupCallback = () => (() => void) | void;
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* State whose value is computed from other dependencies.
|
|
526
|
+
* @beta
|
|
527
|
+
*/
|
|
528
|
+
export declare type ComputedState<T> = ReadonlyState<T> & Disposable & {
|
|
529
|
+
/**
|
|
530
|
+
* Subscribes to notification of changes in the state.
|
|
531
|
+
* @param subscriber - The object that is subscribing for change notification.
|
|
532
|
+
*/
|
|
533
|
+
subscribe(subscriber: Subscriber): void;
|
|
534
|
+
/**
|
|
535
|
+
* Unsubscribes from notification of changes in the state.
|
|
536
|
+
* @param subscriber - The object that is unsubscribing from change notification.
|
|
537
|
+
*/
|
|
538
|
+
unsubscribe(subscriber: Subscriber): void;
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Creates a ComputedState.
|
|
543
|
+
* @param initialize - The initialization callback.
|
|
544
|
+
* @param name - A friendly name for this computation.
|
|
545
|
+
* @returns A ComputedState
|
|
546
|
+
* @beta
|
|
547
|
+
*/
|
|
548
|
+
export declare function computedState<T>(initialize: ComputedInitializer<T>, name?: string): ComputedState<T>;
|
|
429
549
|
|
|
430
550
|
/**
|
|
431
551
|
* Represents a type which can be constructed with the new operator.
|
|
@@ -492,82 +612,26 @@ export declare interface ContentView {
|
|
|
492
612
|
* @param strings - The string fragments that are interpolated with the values.
|
|
493
613
|
* @param values - The values that are interpolated with the string fragments.
|
|
494
614
|
* @remarks
|
|
495
|
-
* The css helper supports interpolation of
|
|
615
|
+
* The css helper supports interpolation of static composable styles and CSS directives.
|
|
496
616
|
* @public
|
|
497
617
|
*/
|
|
498
618
|
export declare const css: CSSTemplateTag;
|
|
499
619
|
|
|
500
620
|
/**
|
|
501
|
-
*
|
|
502
|
-
*
|
|
503
|
-
* @public
|
|
504
|
-
*/
|
|
505
|
-
export declare class CSSBindingDirective implements HostBehavior, Subscriber, CSSDirective, BindingDirective {
|
|
506
|
-
readonly dataBinding: Binding;
|
|
507
|
-
readonly targetAspect: string;
|
|
508
|
-
/**
|
|
509
|
-
* Creates an instance of CSSBindingDirective.
|
|
510
|
-
* @param dataBinding - The binding to use in CSS.
|
|
511
|
-
* @param targetAspect - The CSS property to target.
|
|
512
|
-
*/
|
|
513
|
-
constructor(dataBinding: Binding, targetAspect: string);
|
|
514
|
-
/**
|
|
515
|
-
* Creates a CSS fragment to interpolate into the CSS document.
|
|
516
|
-
* @returns - the string to interpolate into CSS
|
|
517
|
-
*/
|
|
518
|
-
createCSS(add: AddBehavior): ComposableStyles;
|
|
519
|
-
/**
|
|
520
|
-
* Executed when this behavior is attached to a controller.
|
|
521
|
-
* @param controller - Controls the behavior lifecycle.
|
|
522
|
-
*/
|
|
523
|
-
addedCallback(controller: HostController<HTMLElement & {
|
|
524
|
-
$cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
|
|
525
|
-
}>): void;
|
|
526
|
-
/**
|
|
527
|
-
* Executed when this behavior's host is connected.
|
|
528
|
-
* @param controller - Controls the behavior lifecycle.
|
|
529
|
-
*/
|
|
530
|
-
connectedCallback(controller: HostController<HTMLElement & {
|
|
531
|
-
$cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
|
|
532
|
-
}>): void;
|
|
533
|
-
/**
|
|
534
|
-
* Executed when this behavior is detached from a controller.
|
|
535
|
-
* @param controller - Controls the behavior lifecycle.
|
|
536
|
-
*/
|
|
537
|
-
removedCallback(controller: HostController<HTMLElement & {
|
|
538
|
-
$cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
|
|
539
|
-
}>): void;
|
|
540
|
-
/**
|
|
541
|
-
* Called when a subject this instance has subscribed to changes.
|
|
542
|
-
* @param subject - The subject of the change.
|
|
543
|
-
* @param args - The event args detailing the change that occurred.
|
|
544
|
-
*
|
|
545
|
-
* @internal
|
|
546
|
-
*/
|
|
547
|
-
handleChange(_: any, observer: ExpressionObserver): void;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
declare type CSSBindingEntry = {
|
|
551
|
-
observer: ExpressionObserver;
|
|
552
|
-
controller: HostController;
|
|
553
|
-
};
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* Directive for use in {@link css}.
|
|
621
|
+
* Directive for use in CSS templates.
|
|
557
622
|
*
|
|
558
623
|
* @public
|
|
559
624
|
*/
|
|
560
625
|
export declare interface CSSDirective {
|
|
561
626
|
/**
|
|
562
|
-
* Creates
|
|
563
|
-
* @returns - the
|
|
627
|
+
* Creates static styles to interpolate into the CSS document.
|
|
628
|
+
* @returns - the styles to interpolate into CSS
|
|
564
629
|
*/
|
|
565
|
-
createCSS(
|
|
630
|
+
createCSS(): ComposableStyles;
|
|
566
631
|
}
|
|
567
632
|
|
|
568
633
|
/**
|
|
569
|
-
* Instructs the css engine to provide
|
|
570
|
-
* associate behaviors with styles.
|
|
634
|
+
* Instructs the css engine to provide styles during CSS template composition.
|
|
571
635
|
* @public
|
|
572
636
|
*/
|
|
573
637
|
export declare const CSSDirective: Readonly<{
|
|
@@ -610,25 +674,25 @@ export declare interface CSSDirectiveDefinition<TType extends Constructable<CSSD
|
|
|
610
674
|
* @param strings - The string fragments that are interpolated with the values.
|
|
611
675
|
* @param values - The values that are interpolated with the string fragments.
|
|
612
676
|
* @remarks
|
|
613
|
-
* The css helper supports interpolation of
|
|
677
|
+
* The css helper supports interpolation of static composable styles and CSS directives.
|
|
614
678
|
* Use the .partial method to create partial CSS fragments.
|
|
615
679
|
* @public
|
|
616
680
|
*/
|
|
617
|
-
export declare type CSSTemplateTag = (
|
|
681
|
+
export declare type CSSTemplateTag = ((strings: TemplateStringsArray, ...values: CSSValue[]) => ElementStyles) & {
|
|
618
682
|
/**
|
|
619
683
|
* Transforms a template literal string into partial CSS.
|
|
620
684
|
* @param strings - The string fragments that are interpolated with the values.
|
|
621
685
|
* @param values - The values that are interpolated with the string fragments.
|
|
622
686
|
* @public
|
|
623
687
|
*/
|
|
624
|
-
partial
|
|
688
|
+
partial(strings: TemplateStringsArray, ...values: CSSValue[]): CSSDirective;
|
|
625
689
|
};
|
|
626
690
|
|
|
627
691
|
/**
|
|
628
692
|
* Represents the types of values that can be interpolated into a template.
|
|
629
693
|
* @public
|
|
630
694
|
*/
|
|
631
|
-
export declare type CSSValue
|
|
695
|
+
export declare type CSSValue = ComposableStyles | CSSDirective;
|
|
632
696
|
|
|
633
697
|
/**
|
|
634
698
|
* Decorator: Defines a platform custom element based on `FASTElement`.
|
|
@@ -644,7 +708,19 @@ export declare function customElement(nameOrDef: string | PartialFASTElementDefi
|
|
|
644
708
|
*/
|
|
645
709
|
export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
|
|
646
710
|
|
|
647
|
-
|
|
711
|
+
/**
|
|
712
|
+
* A path discovered from a default binding.
|
|
713
|
+
* @public
|
|
714
|
+
*/
|
|
715
|
+
export declare interface DefaultCachedPath extends CachedPathCommon {
|
|
716
|
+
type: "default";
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* The default execution context for template views.
|
|
721
|
+
* @public
|
|
722
|
+
*/
|
|
723
|
+
export declare class DefaultExecutionContext<TParent> implements ExecutionContext<TParent> {
|
|
648
724
|
/**
|
|
649
725
|
* The index of the current item within a repeat context.
|
|
650
726
|
*/
|
|
@@ -700,20 +776,6 @@ declare class DefaultExecutionContext<TParent> implements ExecutionContext<TPare
|
|
|
700
776
|
eventTarget<TTarget extends EventTarget>(): TTarget;
|
|
701
777
|
}
|
|
702
778
|
|
|
703
|
-
/**
|
|
704
|
-
* The attribute used to defer hydration of an element.
|
|
705
|
-
* @beta
|
|
706
|
-
*/
|
|
707
|
-
export declare const deferHydrationAttribute = "defer-hydration";
|
|
708
|
-
|
|
709
|
-
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
|
|
710
|
-
|
|
711
|
-
declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
|
|
712
|
-
|
|
713
|
-
declare function defineAsync<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): Promise<FASTElementDefinition<TType>>;
|
|
714
|
-
|
|
715
|
-
declare function defineAsync<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): Promise<FASTElementDefinition<TType>>;
|
|
716
|
-
|
|
717
779
|
/**
|
|
718
780
|
* Provides a mechanism for releasing resources.
|
|
719
781
|
* @public
|
|
@@ -805,7 +867,59 @@ export declare const DOMAspect: Readonly<{
|
|
|
805
867
|
export declare type DOMAspect = (typeof DOMAspect)[Exclude<keyof typeof DOMAspect, "none">];
|
|
806
868
|
|
|
807
869
|
/**
|
|
808
|
-
*
|
|
870
|
+
* Aspect-specific guards for a DOM Policy.
|
|
871
|
+
* @public
|
|
872
|
+
*/
|
|
873
|
+
export declare type DOMAspectGuards = {
|
|
874
|
+
/**
|
|
875
|
+
* Guards for attributes.
|
|
876
|
+
*/
|
|
877
|
+
[DOMAspect.attribute]?: DOMSinkGuards;
|
|
878
|
+
/**
|
|
879
|
+
* Guards for boolean attributes.
|
|
880
|
+
*/
|
|
881
|
+
[DOMAspect.booleanAttribute]?: DOMSinkGuards;
|
|
882
|
+
/**
|
|
883
|
+
* Guards for properties.
|
|
884
|
+
*/
|
|
885
|
+
[DOMAspect.property]?: DOMSinkGuards;
|
|
886
|
+
/**
|
|
887
|
+
* Guards for content.
|
|
888
|
+
*/
|
|
889
|
+
[DOMAspect.content]?: DOMSinkGuards;
|
|
890
|
+
/**
|
|
891
|
+
* Guards for token list manipulation.
|
|
892
|
+
*/
|
|
893
|
+
[DOMAspect.tokenList]?: DOMSinkGuards;
|
|
894
|
+
/**
|
|
895
|
+
* Guards for events.
|
|
896
|
+
*/
|
|
897
|
+
[DOMAspect.event]?: DOMSinkGuards;
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* Element-specific guards for a DOM Policy.
|
|
902
|
+
* @public
|
|
903
|
+
*/
|
|
904
|
+
export declare type DOMElementGuards = Record<string, DOMAspectGuards>;
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* Guard configuration for a DOM Policy.
|
|
908
|
+
* @public
|
|
909
|
+
*/
|
|
910
|
+
export declare type DOMGuards = {
|
|
911
|
+
/**
|
|
912
|
+
* Guards for specific elements.
|
|
913
|
+
*/
|
|
914
|
+
elements: DOMElementGuards;
|
|
915
|
+
/**
|
|
916
|
+
* General aspect guards independent of the element type.
|
|
917
|
+
*/
|
|
918
|
+
aspects: DOMAspectGuards;
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* A policy that controls whether values can be written to DOM sinks.
|
|
809
923
|
* @public
|
|
810
924
|
*/
|
|
811
925
|
export declare interface DOMPolicy {
|
|
@@ -824,17 +938,55 @@ export declare interface DOMPolicy {
|
|
|
824
938
|
protect(tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink): DOMSink;
|
|
825
939
|
}
|
|
826
940
|
|
|
941
|
+
/**
|
|
942
|
+
* A helper for creating DOM policies.
|
|
943
|
+
* @public
|
|
944
|
+
*/
|
|
945
|
+
export declare const DOMPolicy: Readonly<{
|
|
946
|
+
/**
|
|
947
|
+
* Creates a new DOM Policy object.
|
|
948
|
+
* @param options - The options to use in creating the policy.
|
|
949
|
+
* @returns The newly created DOMPolicy.
|
|
950
|
+
*/
|
|
951
|
+
create(options?: DOMPolicyOptions): Readonly<DOMPolicy>;
|
|
952
|
+
}>;
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Options for creating a DOM Policy.
|
|
956
|
+
* @public
|
|
957
|
+
*/
|
|
958
|
+
export declare type DOMPolicyOptions = {
|
|
959
|
+
/**
|
|
960
|
+
* The trusted type to use for HTML creation.
|
|
961
|
+
*/
|
|
962
|
+
trustedType?: TrustedTypesPolicy;
|
|
963
|
+
/**
|
|
964
|
+
* The DOM guards used to override or extend the defaults.
|
|
965
|
+
*/
|
|
966
|
+
guards?: Partial<DOMGuards>;
|
|
967
|
+
};
|
|
968
|
+
|
|
827
969
|
/**
|
|
828
970
|
* A function used to send values to a DOM sink.
|
|
829
971
|
* @public
|
|
830
972
|
*/
|
|
831
973
|
export declare type DOMSink = (target: Node, aspectName: string, value: any, ...args: any[]) => void;
|
|
832
974
|
|
|
975
|
+
/**
|
|
976
|
+
* A specific DOM sink guard for a node aspect.
|
|
977
|
+
* @public
|
|
978
|
+
*/
|
|
979
|
+
export declare type DOMSinkGuards = Record<string, (tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink) => DOMSink>;
|
|
980
|
+
|
|
833
981
|
/**
|
|
834
982
|
* Controls the lifecycle and rendering of a `FASTElement`.
|
|
835
983
|
* @public
|
|
836
984
|
*/
|
|
837
|
-
export declare class ElementController<TElement extends HTMLElement = HTMLElement>
|
|
985
|
+
export declare class ElementController<TElement extends HTMLElement = HTMLElement> implements Notifier, HostController<TElement> {
|
|
986
|
+
/**
|
|
987
|
+
* Internal notifier used to delegate subscriber management.
|
|
988
|
+
*/
|
|
989
|
+
private _notifier;
|
|
838
990
|
/**
|
|
839
991
|
* A map of observable properties that were set on the element before upgrade.
|
|
840
992
|
*/
|
|
@@ -847,6 +999,26 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
847
999
|
* Indicates whether the element has an existing shadow root (e.g. from declarative shadow DOM).
|
|
848
1000
|
*/
|
|
849
1001
|
protected hasExistingShadowRoot: boolean;
|
|
1002
|
+
/**
|
|
1003
|
+
* Resolves the isPrerendered promise.
|
|
1004
|
+
*/
|
|
1005
|
+
private _resolvePrerendered;
|
|
1006
|
+
/**
|
|
1007
|
+
* Resolves the isHydrated promise.
|
|
1008
|
+
*/
|
|
1009
|
+
private _resolveHydrated;
|
|
1010
|
+
/**
|
|
1011
|
+
* Resolves `true` when the element had an existing shadow root
|
|
1012
|
+
* (from SSR or declarative shadow DOM) at connect time, `false`
|
|
1013
|
+
* otherwise.
|
|
1014
|
+
*/
|
|
1015
|
+
readonly isPrerendered: Promise<boolean>;
|
|
1016
|
+
/**
|
|
1017
|
+
* Resolves `true` after prerendered content has been successfully
|
|
1018
|
+
* hydrated, or `false` when the component is client-side rendered
|
|
1019
|
+
* or hydration is not enabled.
|
|
1020
|
+
*/
|
|
1021
|
+
readonly isHydrated: Promise<boolean>;
|
|
850
1022
|
/**
|
|
851
1023
|
* The template used to render the component.
|
|
852
1024
|
*/
|
|
@@ -946,6 +1118,27 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
946
1118
|
* @internal
|
|
947
1119
|
*/
|
|
948
1120
|
constructor(element: TElement, definition: FASTElementDefinition);
|
|
1121
|
+
/**
|
|
1122
|
+
* The subject that subscribers will receive notifications for.
|
|
1123
|
+
*/
|
|
1124
|
+
get subject(): TElement;
|
|
1125
|
+
/**
|
|
1126
|
+
* Notifies all subscribers of a property change.
|
|
1127
|
+
* @param args - The property name that changed.
|
|
1128
|
+
*/
|
|
1129
|
+
notify(args: any): void;
|
|
1130
|
+
/**
|
|
1131
|
+
* Subscribes to notification of changes in the element's state.
|
|
1132
|
+
* @param subscriber - The object that is subscribing for change notification.
|
|
1133
|
+
* @param propertyToWatch - The name of the property to watch for changes.
|
|
1134
|
+
*/
|
|
1135
|
+
subscribe(subscriber: Subscriber, propertyToWatch?: any): void;
|
|
1136
|
+
/**
|
|
1137
|
+
* Unsubscribes from notification of changes in the element's state.
|
|
1138
|
+
* @param subscriber - The object that is unsubscribing from change notification.
|
|
1139
|
+
* @param propertyToUnwatch - The name of the property to unsubscribe from.
|
|
1140
|
+
*/
|
|
1141
|
+
unsubscribe(subscriber: Subscriber, propertyToUnwatch?: any): void;
|
|
949
1142
|
/**
|
|
950
1143
|
* Registers an unbind handler with the controller.
|
|
951
1144
|
* @param behavior - An object to call when the controller unbinds.
|
|
@@ -982,6 +1175,22 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
982
1175
|
* Binds any observables that were set before upgrade.
|
|
983
1176
|
*/
|
|
984
1177
|
protected bindObservables(): void;
|
|
1178
|
+
/**
|
|
1179
|
+
* Captures own-properties that shadow observable accessors on the prototype so
|
|
1180
|
+
* they can be rebound through the accessor before rendering.
|
|
1181
|
+
*/
|
|
1182
|
+
protected captureBoundObservables(): void;
|
|
1183
|
+
/**
|
|
1184
|
+
* Synchronizes late-defined attribute-map attributes from the live DOM to the
|
|
1185
|
+
* associated property values before the initial render occurs.
|
|
1186
|
+
*/
|
|
1187
|
+
protected syncLateAttributes(): void;
|
|
1188
|
+
/**
|
|
1189
|
+
* Observes late-defined attribute-map attributes that the platform does not
|
|
1190
|
+
* surface through attributeChangedCallback because they were added after
|
|
1191
|
+
* customElements.define() completed.
|
|
1192
|
+
*/
|
|
1193
|
+
protected observeLateAttributes(): void;
|
|
985
1194
|
/**
|
|
986
1195
|
* Connects any existing behaviors on the associated element.
|
|
987
1196
|
*/
|
|
@@ -1018,6 +1227,11 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
1018
1227
|
* If `null` is provided, any existing view will be removed.
|
|
1019
1228
|
*/
|
|
1020
1229
|
protected renderTemplate(template: ElementViewTemplate | null | undefined): void;
|
|
1230
|
+
/**
|
|
1231
|
+
* Standard client-side render: clears any stale content, clones the
|
|
1232
|
+
* compiled fragment, binds, and appends to the host.
|
|
1233
|
+
*/
|
|
1234
|
+
private renderClientSide;
|
|
1021
1235
|
/**
|
|
1022
1236
|
* Locates or creates a controller for the specified element.
|
|
1023
1237
|
* @param element - The element to return the controller for.
|
|
@@ -1034,6 +1248,18 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
1034
1248
|
* @param strategy - The strategy to use.
|
|
1035
1249
|
*/
|
|
1036
1250
|
static setStrategy(strategy: ElementControllerStrategy): void;
|
|
1251
|
+
/**
|
|
1252
|
+
* A hook that, when set, handles prerendered content hydration.
|
|
1253
|
+
* Called by renderTemplate when an existing shadow root is detected.
|
|
1254
|
+
* Returns true if hydration was performed, false to fall back to client-side.
|
|
1255
|
+
* @internal
|
|
1256
|
+
*/
|
|
1257
|
+
private static hydrationHook;
|
|
1258
|
+
/**
|
|
1259
|
+
* Installs the hydration hook. Called by enableHydration().
|
|
1260
|
+
* @internal
|
|
1261
|
+
*/
|
|
1262
|
+
static installHydrationHook(hook: (controller: ElementController, template: ElementViewTemplate, element: HTMLElement, host: Node) => boolean): void;
|
|
1037
1263
|
}
|
|
1038
1264
|
|
|
1039
1265
|
/**
|
|
@@ -1066,10 +1292,6 @@ export declare class ElementStyles {
|
|
|
1066
1292
|
readonly styles: ReadonlyArray<ComposableStyles>;
|
|
1067
1293
|
private targets;
|
|
1068
1294
|
private _strategy;
|
|
1069
|
-
/**
|
|
1070
|
-
* The behaviors associated with this set of styles.
|
|
1071
|
-
*/
|
|
1072
|
-
readonly behaviors: ReadonlyArray<HostBehavior<HTMLElement>> | null;
|
|
1073
1295
|
/**
|
|
1074
1296
|
* Gets the StyleStrategy associated with these element styles.
|
|
1075
1297
|
*/
|
|
@@ -1085,11 +1307,6 @@ export declare class ElementStyles {
|
|
|
1085
1307
|
removeStylesFrom(target: StyleTarget): void;
|
|
1086
1308
|
/** @internal */
|
|
1087
1309
|
isAttachedTo(target: StyleTarget): boolean;
|
|
1088
|
-
/**
|
|
1089
|
-
* Associates behaviors with this set of styles.
|
|
1090
|
-
* @param behaviors - The behaviors to associate.
|
|
1091
|
-
*/
|
|
1092
|
-
withBehaviors(...behaviors: HostBehavior<HTMLElement>[]): this;
|
|
1093
1310
|
/**
|
|
1094
1311
|
* Sets the strategy that handles adding/removing these styles for an element.
|
|
1095
1312
|
* @param strategy - The strategy to use.
|
|
@@ -1164,6 +1381,20 @@ export declare interface ElementViewTemplate<TSource = any, TParent = any> {
|
|
|
1164
1381
|
*/
|
|
1165
1382
|
export declare const emptyArray: readonly never[];
|
|
1166
1383
|
|
|
1384
|
+
/**
|
|
1385
|
+
* Enables human-readable FAST debug messages.
|
|
1386
|
+
* @public
|
|
1387
|
+
*/
|
|
1388
|
+
export declare function enableDebug(): void;
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* A path discovered from an event binding.
|
|
1392
|
+
* @public
|
|
1393
|
+
*/
|
|
1394
|
+
export declare interface EventCachedPath extends CachedPathCommon {
|
|
1395
|
+
type: "event";
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1167
1398
|
/**
|
|
1168
1399
|
* Provides additional contextual information available to behaviors and expressions.
|
|
1169
1400
|
* @public
|
|
@@ -1232,7 +1463,7 @@ export declare const ExecutionContext: Readonly<{
|
|
|
1232
1463
|
/**
|
|
1233
1464
|
* A default execution context.
|
|
1234
1465
|
*/
|
|
1235
|
-
default: ExecutionContext
|
|
1466
|
+
default: ExecutionContext;
|
|
1236
1467
|
/**
|
|
1237
1468
|
* Gets the current event.
|
|
1238
1469
|
* @returns An event object.
|
|
@@ -1323,10 +1554,28 @@ export declare interface ExpressionObserver<TSource = any, TReturn = any, TParen
|
|
|
1323
1554
|
}
|
|
1324
1555
|
|
|
1325
1556
|
/**
|
|
1326
|
-
* The FAST
|
|
1557
|
+
* The FAST messaging API for warnings and errors.
|
|
1327
1558
|
* @public
|
|
1328
1559
|
*/
|
|
1329
|
-
export declare const FAST:
|
|
1560
|
+
export declare const FAST: {
|
|
1561
|
+
/**
|
|
1562
|
+
* Sends a warning to the developer.
|
|
1563
|
+
* @param code - The warning code to send.
|
|
1564
|
+
* @param values - Values relevant for the warning message.
|
|
1565
|
+
*/
|
|
1566
|
+
warn(_code: number, _values?: Record<string, any>): void;
|
|
1567
|
+
/**
|
|
1568
|
+
* Creates an error from a code.
|
|
1569
|
+
* @param code - The error code.
|
|
1570
|
+
* @param values - Values relevant for the error message.
|
|
1571
|
+
*/
|
|
1572
|
+
error(code: number, _values?: Record<string, any>): Error;
|
|
1573
|
+
/**
|
|
1574
|
+
* Adds debug messages for errors and warnings.
|
|
1575
|
+
* @param messages - The message dictionary to add.
|
|
1576
|
+
*/
|
|
1577
|
+
addMessages(messages: Record<number, string>): void;
|
|
1578
|
+
};
|
|
1330
1579
|
|
|
1331
1580
|
/**
|
|
1332
1581
|
* Represents a custom element based on the FASTElement infrastructure.
|
|
@@ -1378,13 +1627,49 @@ export declare interface FASTElement extends HTMLElement {
|
|
|
1378
1627
|
* static helpers for working with FASTElements.
|
|
1379
1628
|
* @public
|
|
1380
1629
|
*/
|
|
1381
|
-
export declare const FASTElement:
|
|
1630
|
+
export declare const FASTElement: FASTElementConstructor;
|
|
1631
|
+
|
|
1632
|
+
/**
|
|
1633
|
+
* The FASTElement constructor and static registration helpers.
|
|
1634
|
+
* @public
|
|
1635
|
+
*/
|
|
1636
|
+
export declare interface FASTElementConstructor {
|
|
1637
|
+
/**
|
|
1638
|
+
* Creates a FASTElement instance.
|
|
1639
|
+
*/
|
|
1382
1640
|
new (): FASTElement;
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1641
|
+
/**
|
|
1642
|
+
* Defines a platform custom element based on the provided type and definition.
|
|
1643
|
+
* @param nameOrDef - The name of the element to define or a definition object.
|
|
1644
|
+
* @param extensions - Optional callbacks to run before registration.
|
|
1645
|
+
*/
|
|
1646
|
+
define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition<TType>, extensions?: FASTElementExtension[]): Promise<TType>;
|
|
1647
|
+
/**
|
|
1648
|
+
* Defines a platform custom element based on the provided type and definition.
|
|
1649
|
+
* @param type - The custom element type to define.
|
|
1650
|
+
* @param nameOrDef - The name of the element to define or a definition object.
|
|
1651
|
+
* @param extensions - Optional callbacks to run before registration.
|
|
1652
|
+
*/
|
|
1653
|
+
define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition<TType>, extensions?: FASTElementExtension[]): Promise<TType>;
|
|
1654
|
+
/**
|
|
1655
|
+
* Composes FASTElement metadata without registering the element.
|
|
1656
|
+
* @param nameOrDef - The name of the element to compose or a definition object.
|
|
1657
|
+
*/
|
|
1658
|
+
compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition<TType>): Promise<FASTElementDefinition<TType>>;
|
|
1659
|
+
/**
|
|
1660
|
+
* Composes FASTElement metadata without registering the element.
|
|
1661
|
+
* @param type - The custom element type to compose.
|
|
1662
|
+
* @param nameOrDef - The name of the element to compose or a definition object.
|
|
1663
|
+
*/
|
|
1664
|
+
compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition<TType>): Promise<FASTElementDefinition<TType>>;
|
|
1665
|
+
/**
|
|
1666
|
+
* Creates a new FASTElement base class inherited from the provided base type.
|
|
1667
|
+
* @param BaseType - The base element type to inherit from.
|
|
1668
|
+
*/
|
|
1669
|
+
from<TBase extends typeof HTMLElement>(BaseType: TBase): {
|
|
1670
|
+
new (): InstanceType<TBase> & FASTElement;
|
|
1671
|
+
};
|
|
1672
|
+
}
|
|
1388
1673
|
|
|
1389
1674
|
/**
|
|
1390
1675
|
* Defines metadata for a FASTElement.
|
|
@@ -1419,12 +1704,7 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1419
1704
|
/**
|
|
1420
1705
|
* The template to render for the custom element.
|
|
1421
1706
|
*/
|
|
1422
|
-
template?: ElementViewTemplate
|
|
1423
|
-
/**
|
|
1424
|
-
* The template options.
|
|
1425
|
-
* @alpha
|
|
1426
|
-
*/
|
|
1427
|
-
templateOptions?: TemplateOptions;
|
|
1707
|
+
template?: ElementViewTemplate<InstanceType<TType>>;
|
|
1428
1708
|
/**
|
|
1429
1709
|
* The styles to associate with the custom element.
|
|
1430
1710
|
*/
|
|
@@ -1445,6 +1725,12 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1445
1725
|
* Lifecycle callbacks for template events.
|
|
1446
1726
|
*/
|
|
1447
1727
|
readonly lifecycleCallbacks?: TemplateLifecycleCallbacks;
|
|
1728
|
+
/**
|
|
1729
|
+
* The optional schema associated with the custom element definition.
|
|
1730
|
+
* Declarative templates assign this automatically during template resolution.
|
|
1731
|
+
* Non-declarative callers can provide one for schema-driven extensions.
|
|
1732
|
+
*/
|
|
1733
|
+
schema?: Schema;
|
|
1448
1734
|
/**
|
|
1449
1735
|
* The definition has been registered to the FAST element registry.
|
|
1450
1736
|
*/
|
|
@@ -1453,17 +1739,19 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1453
1739
|
/**
|
|
1454
1740
|
* Defines a custom element based on this definition.
|
|
1455
1741
|
* @param registry - The element registry to define the element in.
|
|
1742
|
+
* @param extensions - An optional array of extension callbacks to invoke
|
|
1743
|
+
* with this definition before platform registration.
|
|
1456
1744
|
* @remarks
|
|
1457
1745
|
* This operation is idempotent per registry.
|
|
1458
1746
|
*/
|
|
1459
|
-
define(registry?: CustomElementRegistry): this;
|
|
1747
|
+
define(registry?: CustomElementRegistry, extensions?: FASTElementExtension[]): this;
|
|
1460
1748
|
/**
|
|
1461
1749
|
* Creates an instance of FASTElementDefinition.
|
|
1462
1750
|
* @param type - The type this definition is being created for.
|
|
1463
1751
|
* @param nameOrDef - The name of the element to define or a config object
|
|
1464
1752
|
* that describes the element to define.
|
|
1465
1753
|
*/
|
|
1466
|
-
static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType
|
|
1754
|
+
static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition<TType>): Promise<FASTElementDefinition<TType>>;
|
|
1467
1755
|
/**
|
|
1468
1756
|
* Registers a FASTElement base type.
|
|
1469
1757
|
* @param type - The type to register as a base type.
|
|
@@ -1485,64 +1773,31 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
|
|
|
1485
1773
|
* @param name - The name of the defined custom element.
|
|
1486
1774
|
* @alpha
|
|
1487
1775
|
*/
|
|
1488
|
-
static
|
|
1489
|
-
/**
|
|
1490
|
-
* Creates an instance of FASTElementDefinition asynchronously. This option assumes
|
|
1491
|
-
* that a template and shadowOptions will be provided and completes when those requirements
|
|
1492
|
-
* are met.
|
|
1493
|
-
* @param type - The type this definition is being created for.
|
|
1494
|
-
* @param nameOrDef - The name of the element to define or a config object
|
|
1495
|
-
* that describes the element to define.
|
|
1496
|
-
* @alpha
|
|
1497
|
-
*/
|
|
1498
|
-
static composeAsync<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): Promise<FASTElementDefinition<TType>>;
|
|
1776
|
+
static register: (name: string, registry?: CustomElementRegistry) => Promise<Function>;
|
|
1499
1777
|
}
|
|
1500
1778
|
|
|
1501
1779
|
/**
|
|
1502
|
-
*
|
|
1503
|
-
*
|
|
1780
|
+
* A callback that receives a FASTElementDefinition during element registration.
|
|
1781
|
+
* Extensions are invoked before the element is registered with the platform,
|
|
1782
|
+
* allowing plugins to inspect or act on the resolved definition.
|
|
1783
|
+
* @public
|
|
1504
1784
|
*/
|
|
1505
|
-
export declare
|
|
1785
|
+
export declare type FASTElementExtension = (definition: FASTElementDefinition) => void;
|
|
1506
1786
|
|
|
1507
1787
|
/**
|
|
1508
|
-
* The FAST
|
|
1788
|
+
* The FAST custom element registry.
|
|
1789
|
+
* @remarks
|
|
1790
|
+
* This registry stores FAST element definitions by constructor so consumers can
|
|
1791
|
+
* look up the `FASTElementDefinition` associated with an element type or instance.
|
|
1509
1792
|
* @public
|
|
1510
1793
|
*/
|
|
1511
|
-
export declare
|
|
1512
|
-
/**
|
|
1513
|
-
* The list of loaded versions.
|
|
1514
|
-
*/
|
|
1515
|
-
readonly versions: string[];
|
|
1516
|
-
/**
|
|
1517
|
-
* Gets a kernel value.
|
|
1518
|
-
* @param id - The id to get the value for.
|
|
1519
|
-
* @param initialize - Creates the initial value for the id if not already existing.
|
|
1520
|
-
*/
|
|
1521
|
-
getById<T>(id: string | number): T | null;
|
|
1522
|
-
getById<T>(id: string | number, initialize: () => T): T;
|
|
1523
|
-
/**
|
|
1524
|
-
* Sends a warning to the developer.
|
|
1525
|
-
* @param code - The warning code to send.
|
|
1526
|
-
* @param values - Values relevant for the warning message.
|
|
1527
|
-
*/
|
|
1528
|
-
warn(code: number, values?: Record<string, any>): void;
|
|
1529
|
-
/**
|
|
1530
|
-
* Creates an error.
|
|
1531
|
-
* @param code - The error code to send.
|
|
1532
|
-
* @param values - Values relevant for the error message.
|
|
1533
|
-
*/
|
|
1534
|
-
error(code: number, values?: Record<string, any>): Error;
|
|
1535
|
-
/**
|
|
1536
|
-
* Adds debug messages for errors and warnings.
|
|
1537
|
-
* @param messages - The message dictionary to add.
|
|
1538
|
-
* @remarks
|
|
1539
|
-
* Message can include placeholders like $\{name\} which can be
|
|
1540
|
-
* replaced by values passed at runtime.
|
|
1541
|
-
*/
|
|
1542
|
-
addMessages(messages: Record<number, string>): void;
|
|
1543
|
-
}
|
|
1794
|
+
export declare const fastElementRegistry: TypeRegistry<FASTElementDefinition>;
|
|
1544
1795
|
|
|
1545
|
-
|
|
1796
|
+
/**
|
|
1797
|
+
* Resolves an element template from a composed definition.
|
|
1798
|
+
* @public
|
|
1799
|
+
*/
|
|
1800
|
+
export declare type FASTElementTemplateResolver<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> = (definition: FASTElementDefinition<TType>) => ElementViewTemplate<InstanceType<TType>> | Promise<ElementViewTemplate<InstanceType<TType>>>;
|
|
1546
1801
|
|
|
1547
1802
|
/**
|
|
1548
1803
|
* Represents an object that can contribute behavior to a host.
|
|
@@ -1636,7 +1891,6 @@ export declare const html: HTMLTemplateTag;
|
|
|
1636
1891
|
* @public
|
|
1637
1892
|
*/
|
|
1638
1893
|
export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected, BindingDirective {
|
|
1639
|
-
dataBinding: Binding;
|
|
1640
1894
|
private data;
|
|
1641
1895
|
private updateTarget;
|
|
1642
1896
|
/**
|
|
@@ -1667,6 +1921,10 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1667
1921
|
* The type of aspect to target.
|
|
1668
1922
|
*/
|
|
1669
1923
|
aspectType: DOMAspect;
|
|
1924
|
+
/**
|
|
1925
|
+
* The binding configuration to apply.
|
|
1926
|
+
*/
|
|
1927
|
+
dataBinding: Binding;
|
|
1670
1928
|
/**
|
|
1671
1929
|
* Creates an instance of HTMLBindingDirective.
|
|
1672
1930
|
* @param dataBinding - The binding configuration to apply.
|
|
@@ -1841,6 +2099,24 @@ export declare class HTMLView<TSource = any, TParent = any> extends DefaultExecu
|
|
|
1841
2099
|
* Indicates how the source's lifetime relates to the controller's lifetime.
|
|
1842
2100
|
*/
|
|
1843
2101
|
readonly sourceLifetime: SourceLifetime;
|
|
2102
|
+
/**
|
|
2103
|
+
* When true, directives skip attribute/booleanAttribute DOM
|
|
2104
|
+
* updates during bind(). Set only during the prerendered bind
|
|
2105
|
+
* window and cleared immediately after.
|
|
2106
|
+
* @internal
|
|
2107
|
+
*/
|
|
2108
|
+
_skipAttrUpdates: boolean;
|
|
2109
|
+
/**
|
|
2110
|
+
* A promise that resolves with `true` after prerendered content
|
|
2111
|
+
* has been hydrated, or `false` when the view is client-side
|
|
2112
|
+
* rendered. Resolves once the first bind completes.
|
|
2113
|
+
*/
|
|
2114
|
+
isPrerendered: Promise<boolean>;
|
|
2115
|
+
/**
|
|
2116
|
+
* Resolves `true` after prerendered content has been hydrated,
|
|
2117
|
+
* `false` when client-side rendered or hydration not enabled.
|
|
2118
|
+
*/
|
|
2119
|
+
isHydrated: Promise<boolean>;
|
|
1844
2120
|
/**
|
|
1845
2121
|
* The execution context the view is running within.
|
|
1846
2122
|
*/
|
|
@@ -1908,228 +2184,7 @@ export declare class HTMLView<TSource = any, TParent = any> extends DefaultExecu
|
|
|
1908
2184
|
* Efficiently disposes of a contiguous range of synthetic view instances.
|
|
1909
2185
|
* @param views - A contiguous range of views to be disposed.
|
|
1910
2186
|
*/
|
|
1911
|
-
static disposeContiguousBatch(views: SyntheticView[]): void;
|
|
1912
|
-
}
|
|
1913
|
-
|
|
1914
|
-
/**
|
|
1915
|
-
* @internal
|
|
1916
|
-
*/
|
|
1917
|
-
declare const Hydratable: unique symbol;
|
|
1918
|
-
|
|
1919
|
-
declare interface HydratableContentTemplate extends ContentTemplate {
|
|
1920
|
-
/**
|
|
1921
|
-
* Hydrates a content view from first/last nodes.
|
|
1922
|
-
*/
|
|
1923
|
-
hydrate(first: Node, last: Node): ContentView;
|
|
1924
|
-
}
|
|
1925
|
-
|
|
1926
|
-
/**
|
|
1927
|
-
* An ElementController capable of hydrating FAST elements from
|
|
1928
|
-
* Declarative Shadow DOM.
|
|
1929
|
-
*
|
|
1930
|
-
* @beta
|
|
1931
|
-
*/
|
|
1932
|
-
export declare class HydratableElementController<TElement extends HTMLElement = HTMLElement> extends ElementController<TElement> {
|
|
1933
|
-
/**
|
|
1934
|
-
* Controls whether the controller will hydrate during the connect() method.
|
|
1935
|
-
* Initialized during the first connect() call to true when the `needs-hydration`
|
|
1936
|
-
* attribute is present on the element.
|
|
1937
|
-
*/
|
|
1938
|
-
protected needsHydration?: boolean;
|
|
1939
|
-
private static hydrationObserver;
|
|
1940
|
-
/**
|
|
1941
|
-
* {@inheritdoc ElementController.shadowOptions}
|
|
1942
|
-
*/
|
|
1943
|
-
get shadowOptions(): ShadowRootOptions | undefined;
|
|
1944
|
-
set shadowOptions(value: ShadowRootOptions | undefined);
|
|
1945
|
-
/**
|
|
1946
|
-
* Lifecycle callbacks for hydration events
|
|
1947
|
-
*/
|
|
1948
|
-
static lifecycleCallbacks: HydrationControllerCallbacks;
|
|
1949
|
-
/**
|
|
1950
|
-
* Whether the hydrationStarted callback has already been invoked.
|
|
1951
|
-
*/
|
|
1952
|
-
private static hydrationStarted;
|
|
1953
|
-
/**
|
|
1954
|
-
* An idle callback ID used to track hydration completion
|
|
1955
|
-
*/
|
|
1956
|
-
private static idleCallbackId;
|
|
1957
|
-
/**
|
|
1958
|
-
* Adds the current element instance to the hydrating instances map
|
|
1959
|
-
*/
|
|
1960
|
-
private addHydratingInstance;
|
|
1961
|
-
/**
|
|
1962
|
-
* Configure lifecycle callbacks for hydration events
|
|
1963
|
-
*/
|
|
1964
|
-
static config(callbacks: HydrationControllerCallbacks): typeof HydratableElementController;
|
|
1965
|
-
private static hydrationObserverHandler;
|
|
1966
|
-
/**
|
|
1967
|
-
* Checks to see if hydration is complete and if so, invokes the hydrationComplete callback.
|
|
1968
|
-
* Then resets the ElementController strategy to the default so that future elements
|
|
1969
|
-
* don't use the HydratableElementController.
|
|
1970
|
-
*
|
|
1971
|
-
* @param deadline - the idle deadline object
|
|
1972
|
-
*/
|
|
1973
|
-
private static checkHydrationComplete;
|
|
1974
|
-
/**
|
|
1975
|
-
* Runs connected lifecycle behavior on the associated element.
|
|
1976
|
-
*/
|
|
1977
|
-
connect(): void;
|
|
1978
|
-
/**
|
|
1979
|
-
* A map of element instances by the name of the custom element they are
|
|
1980
|
-
* associated with. The key is the custom element name, and the value is the
|
|
1981
|
-
* instances of hydratable elements which currently need to be hydrated.
|
|
1982
|
-
*
|
|
1983
|
-
* When all of the instances in the set have been hydrated, the set is
|
|
1984
|
-
* cleared and removed from the map. If the map is empty, the
|
|
1985
|
-
* hydrationComplete callback is invoked.
|
|
1986
|
-
*/
|
|
1987
|
-
private static hydratingInstances?;
|
|
1988
|
-
/**
|
|
1989
|
-
* Removes the current element instance from the hydrating instances map
|
|
1990
|
-
*/
|
|
1991
|
-
private removeHydratingInstance;
|
|
1992
|
-
/**
|
|
1993
|
-
* Unregisters the hydration observer when the element is disconnected.
|
|
1994
|
-
*/
|
|
1995
|
-
disconnect(): void;
|
|
1996
|
-
/**
|
|
1997
|
-
* Sets the ElementController strategy to HydratableElementController.
|
|
1998
|
-
* @remarks
|
|
1999
|
-
* This method is typically called during application startup to enable
|
|
2000
|
-
* hydration support for FAST elements.
|
|
2001
|
-
*/
|
|
2002
|
-
static install(): void;
|
|
2003
|
-
}
|
|
2004
|
-
|
|
2005
|
-
declare interface HydratableElementViewTemplate<TSource = any, TParent = any> extends ElementViewTemplate<TSource, TParent> {
|
|
2006
|
-
hydrate(firstChild: Node, lastChild: Node, hostBindingTarget?: Element): ElementView<TSource, TParent>;
|
|
2007
|
-
}
|
|
2008
|
-
|
|
2009
|
-
declare interface HydratableSyntheticViewTemplate<TSource = any, TParent = any> extends SyntheticViewTemplate {
|
|
2010
|
-
hydrate(firstChild: Node, lastChild: Node): SyntheticView<TSource, TParent>;
|
|
2011
|
-
}
|
|
2012
|
-
|
|
2013
|
-
/** @public */
|
|
2014
|
-
export declare interface HydratableView<TSource = any, TParent = any> extends ElementView, SyntheticView, DefaultExecutionContext<TParent> {
|
|
2015
|
-
[Hydratable]: symbol;
|
|
2016
|
-
readonly bindingViewBoundaries: Record<string, ViewNodes>;
|
|
2017
|
-
readonly hydrationStage: keyof typeof HydrationStage;
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
|
-
/** @public */
|
|
2021
|
-
export declare class HydrationBindingError extends Error {
|
|
2022
|
-
/**
|
|
2023
|
-
* The factory that was unable to be bound
|
|
2024
|
-
*/
|
|
2025
|
-
readonly factory: ViewBehaviorFactory;
|
|
2026
|
-
/**
|
|
2027
|
-
* A DocumentFragment containing a clone of the
|
|
2028
|
-
* view's Nodes.
|
|
2029
|
-
*/
|
|
2030
|
-
readonly fragment: DocumentFragment;
|
|
2031
|
-
/**
|
|
2032
|
-
* String representation of the HTML in the template that
|
|
2033
|
-
* threw the binding error.
|
|
2034
|
-
*/
|
|
2035
|
-
readonly templateString: string;
|
|
2036
|
-
constructor(
|
|
2037
|
-
/**
|
|
2038
|
-
* The error message
|
|
2039
|
-
*/
|
|
2040
|
-
message: string | undefined,
|
|
2041
|
-
/**
|
|
2042
|
-
* The factory that was unable to be bound
|
|
2043
|
-
*/
|
|
2044
|
-
factory: ViewBehaviorFactory,
|
|
2045
|
-
/**
|
|
2046
|
-
* A DocumentFragment containing a clone of the
|
|
2047
|
-
* view's Nodes.
|
|
2048
|
-
*/
|
|
2049
|
-
fragment: DocumentFragment,
|
|
2050
|
-
/**
|
|
2051
|
-
* String representation of the HTML in the template that
|
|
2052
|
-
* threw the binding error.
|
|
2053
|
-
*/
|
|
2054
|
-
templateString: string);
|
|
2055
|
-
}
|
|
2056
|
-
|
|
2057
|
-
/**
|
|
2058
|
-
* Lifecycle callbacks for element hydration events
|
|
2059
|
-
* @public
|
|
2060
|
-
*/
|
|
2061
|
-
export declare interface HydrationControllerCallbacks<TElement extends HTMLElement = HTMLElement> {
|
|
2062
|
-
/**
|
|
2063
|
-
* Called once when the first element enters the hydration pipeline.
|
|
2064
|
-
* This is the earliest point at which we know a component has been
|
|
2065
|
-
* async-defined with `defer-and-hydrate`, a template is pending via
|
|
2066
|
-
* `<f-template>`, and the element has `needs-hydration`.
|
|
2067
|
-
*/
|
|
2068
|
-
hydrationStarted?(): void;
|
|
2069
|
-
/**
|
|
2070
|
-
* Called before an individual element's hydration begins
|
|
2071
|
-
*/
|
|
2072
|
-
elementWillHydrate?(source: TElement): void;
|
|
2073
|
-
/**
|
|
2074
|
-
* Called after an individual element's hydration has finished
|
|
2075
|
-
*/
|
|
2076
|
-
elementDidHydrate?(source: TElement): void;
|
|
2077
|
-
/**
|
|
2078
|
-
* Called after all elements have completed hydration
|
|
2079
|
-
*/
|
|
2080
|
-
hydrationComplete?(): void;
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
|
-
declare const HydrationStage: {
|
|
2084
|
-
readonly unhydrated: "unhydrated";
|
|
2085
|
-
readonly hydrating: "hydrating";
|
|
2086
|
-
readonly hydrated: "hydrated";
|
|
2087
|
-
};
|
|
2088
|
-
|
|
2089
|
-
declare class HydrationView<TSource = any, TParent = any> extends DefaultExecutionContext<TParent> implements HydratableView {
|
|
2090
|
-
readonly firstChild: Node;
|
|
2091
|
-
readonly lastChild: Node;
|
|
2092
|
-
private sourceTemplate;
|
|
2093
|
-
private hostBindingTarget?;
|
|
2094
|
-
[Hydratable]: symbol;
|
|
2095
|
-
context: ExecutionContext<any>;
|
|
2096
|
-
source: TSource | null;
|
|
2097
|
-
isBound: boolean;
|
|
2098
|
-
get hydrationStage(): "unhydrated" | "hydrating" | "hydrated";
|
|
2099
|
-
get targets(): ViewBehaviorTargets;
|
|
2100
|
-
get bindingViewBoundaries(): ViewBehaviorBoundaries;
|
|
2101
|
-
readonly sourceLifetime: SourceLifetime;
|
|
2102
|
-
private unbindables;
|
|
2103
|
-
private fragment;
|
|
2104
|
-
private behaviors;
|
|
2105
|
-
private factories;
|
|
2106
|
-
private _hydrationStage;
|
|
2107
|
-
private _bindingViewBoundaries;
|
|
2108
|
-
private _targets;
|
|
2109
|
-
constructor(firstChild: Node, lastChild: Node, sourceTemplate: ViewTemplate, hostBindingTarget?: Element | undefined);
|
|
2110
|
-
/**
|
|
2111
|
-
* no-op. Hydrated views are don't need to be moved from a documentFragment
|
|
2112
|
-
* to the target node.
|
|
2113
|
-
*/
|
|
2114
|
-
insertBefore(node: Node): void;
|
|
2115
|
-
/**
|
|
2116
|
-
* Appends the view to a node. In cases where this is called before the
|
|
2117
|
-
* view has been removed, the method will no-op.
|
|
2118
|
-
* @param node - the node to append the view to.
|
|
2119
|
-
*/
|
|
2120
|
-
appendTo(node: Node): void;
|
|
2121
|
-
remove(): void;
|
|
2122
|
-
bind(source: TSource, context?: ExecutionContext<any>): void;
|
|
2123
|
-
unbind(): void;
|
|
2124
|
-
/**
|
|
2125
|
-
* Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.
|
|
2126
|
-
* Once a view has been disposed, it cannot be inserted or bound again.
|
|
2127
|
-
*/
|
|
2128
|
-
dispose(): void;
|
|
2129
|
-
onUnbind(behavior: {
|
|
2130
|
-
unbind(controller: ViewController<TSource, TParent>): void;
|
|
2131
|
-
}): void;
|
|
2132
|
-
private evaluateUnbindables;
|
|
2187
|
+
static disposeContiguousBatch(views: SyntheticView[]): void;
|
|
2133
2188
|
}
|
|
2134
2189
|
|
|
2135
2190
|
/**
|
|
@@ -2156,20 +2211,41 @@ export declare class InlineTemplateDirective implements HTMLDirective {
|
|
|
2156
2211
|
}
|
|
2157
2212
|
|
|
2158
2213
|
/**
|
|
2159
|
-
*
|
|
2160
|
-
*
|
|
2161
|
-
* @beta
|
|
2214
|
+
* A JSON schema describing a root property.
|
|
2215
|
+
* @public
|
|
2162
2216
|
*/
|
|
2163
|
-
export declare
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2217
|
+
export declare interface JSONSchema extends JSONSchemaCommon {
|
|
2218
|
+
$schema: string;
|
|
2219
|
+
$id: string;
|
|
2220
|
+
$defs?: Record<string, JSONSchemaDefinition>;
|
|
2221
|
+
}
|
|
2167
2222
|
|
|
2168
|
-
/**
|
|
2169
|
-
|
|
2223
|
+
/**
|
|
2224
|
+
* Common properties shared by schema nodes.
|
|
2225
|
+
* @public
|
|
2226
|
+
*/
|
|
2227
|
+
export declare interface JSONSchemaCommon {
|
|
2228
|
+
type?: string;
|
|
2229
|
+
properties?: any;
|
|
2230
|
+
items?: any;
|
|
2231
|
+
anyOf?: Array<any>;
|
|
2232
|
+
$ref?: string;
|
|
2233
|
+
/**
|
|
2234
|
+
* Stamped by `applyConfigToSchema` when an `ObserverMapConfig` excludes
|
|
2235
|
+
* this path. When `false`, the proxy system skips observation for this
|
|
2236
|
+
* node and (if all descendants are also `false`) its subtree.
|
|
2237
|
+
*/
|
|
2238
|
+
$observe?: boolean;
|
|
2239
|
+
}
|
|
2170
2240
|
|
|
2171
|
-
/**
|
|
2172
|
-
|
|
2241
|
+
/**
|
|
2242
|
+
* A reusable JSON schema definition.
|
|
2243
|
+
* @public
|
|
2244
|
+
*/
|
|
2245
|
+
export declare interface JSONSchemaDefinition extends JSONSchemaCommon {
|
|
2246
|
+
$fast_context: string;
|
|
2247
|
+
$fast_parent_contexts: Array<string>;
|
|
2248
|
+
}
|
|
2173
2249
|
|
|
2174
2250
|
/**
|
|
2175
2251
|
* Observes array lengths.
|
|
@@ -2230,12 +2306,6 @@ export declare const Markup: Readonly<{
|
|
|
2230
2306
|
comment: (id: string) => string;
|
|
2231
2307
|
}>;
|
|
2232
2308
|
|
|
2233
|
-
/**
|
|
2234
|
-
* The attribute used to indicate that an element needs hydration.
|
|
2235
|
-
* @public
|
|
2236
|
-
*/
|
|
2237
|
-
export declare const needsHydrationAttribute = "needs-hydration";
|
|
2238
|
-
|
|
2239
2309
|
/**
|
|
2240
2310
|
* Options for configuring node observation behavior.
|
|
2241
2311
|
* @public
|
|
@@ -2435,13 +2505,13 @@ export declare const Observable: Readonly<{
|
|
|
2435
2505
|
* @param initialSubscriber - An initial subscriber to changes in the binding value.
|
|
2436
2506
|
* @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
|
|
2437
2507
|
*/
|
|
2438
|
-
binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn
|
|
2508
|
+
binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn>;
|
|
2439
2509
|
/**
|
|
2440
2510
|
* Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
|
|
2441
2511
|
* on every evaluation of the value.
|
|
2442
2512
|
* @param expression - The binding to inspect.
|
|
2443
2513
|
*/
|
|
2444
|
-
isVolatileBinding<
|
|
2514
|
+
isVolatileBinding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn>): boolean;
|
|
2445
2515
|
}>;
|
|
2446
2516
|
|
|
2447
2517
|
/**
|
|
@@ -2486,6 +2556,32 @@ export declare function oneTime<T = any>(expression: Expression<T>, policy?: DOM
|
|
|
2486
2556
|
*/
|
|
2487
2557
|
export declare function oneWay<T = any>(expression: Expression<T>, policy?: DOMPolicy, isVolatile?: boolean): Binding<T>;
|
|
2488
2558
|
|
|
2559
|
+
/**
|
|
2560
|
+
* A read/write stateful value associated with an owner.
|
|
2561
|
+
* @beta
|
|
2562
|
+
*/
|
|
2563
|
+
export declare type OwnedState<T> = ReadonlyOwnedState<T> & {
|
|
2564
|
+
/**
|
|
2565
|
+
* Sets
|
|
2566
|
+
* @param owner - The object to set the state for the owner.
|
|
2567
|
+
* @param value - The new state value.
|
|
2568
|
+
*/
|
|
2569
|
+
set(owner: any, value: T): void;
|
|
2570
|
+
/**
|
|
2571
|
+
* Creates a readonly version of the state.
|
|
2572
|
+
*/
|
|
2573
|
+
asReadonly(): ReadonlyOwnedState<T>;
|
|
2574
|
+
};
|
|
2575
|
+
|
|
2576
|
+
/**
|
|
2577
|
+
* Creates a reactive state that has its value associated with a specific owner.
|
|
2578
|
+
* @param value - The initial value or a factory that provides an initial value for each owner.
|
|
2579
|
+
* @param options - Options to customize the state or a friendly name.
|
|
2580
|
+
* @returns An OwnedState instance.
|
|
2581
|
+
* @beta
|
|
2582
|
+
*/
|
|
2583
|
+
export declare function ownedState<T>(value: T | (() => T), options?: string | StateOptions): OwnedState<T>;
|
|
2584
|
+
|
|
2489
2585
|
/**
|
|
2490
2586
|
* Common APIs related to content parsing.
|
|
2491
2587
|
* @public
|
|
@@ -2506,20 +2602,15 @@ export declare const Parser: Readonly<{
|
|
|
2506
2602
|
* Represents metadata configuration for a custom element.
|
|
2507
2603
|
* @public
|
|
2508
2604
|
*/
|
|
2509
|
-
export declare interface PartialFASTElementDefinition {
|
|
2605
|
+
export declare interface PartialFASTElementDefinition<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>> {
|
|
2510
2606
|
/**
|
|
2511
2607
|
* The name of the custom element.
|
|
2512
2608
|
*/
|
|
2513
2609
|
readonly name: string;
|
|
2514
2610
|
/**
|
|
2515
|
-
* The template
|
|
2516
|
-
*/
|
|
2517
|
-
readonly template?: ElementViewTemplate;
|
|
2518
|
-
/**
|
|
2519
|
-
* Options controlling how the template will be created.
|
|
2520
|
-
* @alpha
|
|
2611
|
+
* The template, or template resolver, for the custom element.
|
|
2521
2612
|
*/
|
|
2522
|
-
readonly
|
|
2613
|
+
readonly template?: ElementViewTemplate<InstanceType<TType>> | FASTElementTemplateResolver<TType>;
|
|
2523
2614
|
/**
|
|
2524
2615
|
* The styles to associate with the custom element.
|
|
2525
2616
|
*/
|
|
@@ -2549,6 +2640,12 @@ export declare interface PartialFASTElementDefinition {
|
|
|
2549
2640
|
* Lifecycle callbacks for template events.
|
|
2550
2641
|
*/
|
|
2551
2642
|
readonly lifecycleCallbacks?: TemplateLifecycleCallbacks;
|
|
2643
|
+
/**
|
|
2644
|
+
* The optional schema associated with the custom element definition.
|
|
2645
|
+
* Declarative templates assign this automatically during template resolution.
|
|
2646
|
+
* Non-declarative callers can provide one for schema-driven extensions.
|
|
2647
|
+
*/
|
|
2648
|
+
readonly schema?: Schema;
|
|
2552
2649
|
}
|
|
2553
2650
|
|
|
2554
2651
|
/**
|
|
@@ -2599,6 +2696,41 @@ export declare class PropertyChangeNotifier implements Notifier {
|
|
|
2599
2696
|
unsubscribe(subscriber: Subscriber, propertyToUnwatch?: string): void;
|
|
2600
2697
|
}
|
|
2601
2698
|
|
|
2699
|
+
/**
|
|
2700
|
+
* Converts a plain object to a reactive, observable object.
|
|
2701
|
+
* @param object - The object to make reactive.
|
|
2702
|
+
* @param deep - Indicates whether or not to deeply convert the oject.
|
|
2703
|
+
* @returns The converted object.
|
|
2704
|
+
* @beta
|
|
2705
|
+
*/
|
|
2706
|
+
export declare function reactive<T>(object: T, deep?: boolean): T;
|
|
2707
|
+
|
|
2708
|
+
/**
|
|
2709
|
+
* A readonly stateful value associated with an object owner.
|
|
2710
|
+
* @beta
|
|
2711
|
+
*/
|
|
2712
|
+
export declare type ReadonlyOwnedState<T> = {
|
|
2713
|
+
/**
|
|
2714
|
+
* Gets the current stateful value for the owner.
|
|
2715
|
+
*/
|
|
2716
|
+
(owner: any): T;
|
|
2717
|
+
};
|
|
2718
|
+
|
|
2719
|
+
/**
|
|
2720
|
+
* A readonly stateful value.
|
|
2721
|
+
* @beta
|
|
2722
|
+
*/
|
|
2723
|
+
export declare type ReadonlyState<T> = {
|
|
2724
|
+
/**
|
|
2725
|
+
* Gets the current state value.
|
|
2726
|
+
*/
|
|
2727
|
+
(): T;
|
|
2728
|
+
/**
|
|
2729
|
+
* Gets the current state value.
|
|
2730
|
+
*/
|
|
2731
|
+
readonly current: T;
|
|
2732
|
+
};
|
|
2733
|
+
|
|
2602
2734
|
/**
|
|
2603
2735
|
* A directive that observes the updates a property with a reference to the element.
|
|
2604
2736
|
* @param propertyName - The name of the property to assign the reference to.
|
|
@@ -2622,7 +2754,15 @@ export declare class RefDirective extends StatelessAttachedAttributeDirective<st
|
|
|
2622
2754
|
bind(controller: ViewController): void;
|
|
2623
2755
|
}
|
|
2624
2756
|
|
|
2625
|
-
|
|
2757
|
+
/**
|
|
2758
|
+
* Configuration for registering a path with a schema.
|
|
2759
|
+
* @public
|
|
2760
|
+
*/
|
|
2761
|
+
export declare interface RegisterPathConfig {
|
|
2762
|
+
rootPropertyName: string;
|
|
2763
|
+
pathConfig: CachedPath;
|
|
2764
|
+
childrenMap: ChildrenMap | null;
|
|
2765
|
+
}
|
|
2626
2766
|
|
|
2627
2767
|
/**
|
|
2628
2768
|
* Creates a RenderDirective for use in advanced rendering scenarios.
|
|
@@ -2771,6 +2911,14 @@ export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subs
|
|
|
2771
2911
|
private hydrateViews;
|
|
2772
2912
|
}
|
|
2773
2913
|
|
|
2914
|
+
/**
|
|
2915
|
+
* A path discovered from a repeat directive.
|
|
2916
|
+
* @public
|
|
2917
|
+
*/
|
|
2918
|
+
export declare interface RepeatCachedPath extends CachedPathCommon {
|
|
2919
|
+
type: "repeat";
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2774
2922
|
/**
|
|
2775
2923
|
* A directive that configures list rendering.
|
|
2776
2924
|
* @public
|
|
@@ -2817,6 +2965,108 @@ export declare interface RepeatOptions {
|
|
|
2817
2965
|
recycle?: boolean;
|
|
2818
2966
|
}
|
|
2819
2967
|
|
|
2968
|
+
/**
|
|
2969
|
+
* A constructed JSON schema from a template
|
|
2970
|
+
* @public
|
|
2971
|
+
*/
|
|
2972
|
+
export declare class Schema {
|
|
2973
|
+
/**
|
|
2974
|
+
* The name of the custom element
|
|
2975
|
+
*/
|
|
2976
|
+
private customElementName;
|
|
2977
|
+
/**
|
|
2978
|
+
* Instance-level JSON schema map describing each root property
|
|
2979
|
+
*/
|
|
2980
|
+
private schemaMap;
|
|
2981
|
+
constructor(name: string);
|
|
2982
|
+
/**
|
|
2983
|
+
* Add a path to a schema
|
|
2984
|
+
* @param config - The path registration configuration.
|
|
2985
|
+
*/
|
|
2986
|
+
addPath(config: RegisterPathConfig): void;
|
|
2987
|
+
/**
|
|
2988
|
+
* Gets the JSON schema for a property name
|
|
2989
|
+
* @param rootPropertyName - the root property the JSON schema is mapped to
|
|
2990
|
+
* @returns The JSON schema for the root property
|
|
2991
|
+
*/
|
|
2992
|
+
getSchema(rootPropertyName: string): JSONSchema | null;
|
|
2993
|
+
/**
|
|
2994
|
+
* Gets root properties
|
|
2995
|
+
* @returns IterableIterator<string>
|
|
2996
|
+
*/
|
|
2997
|
+
getRootProperties(): IterableIterator<string>;
|
|
2998
|
+
/**
|
|
2999
|
+
* Get a path split into property names
|
|
3000
|
+
* @param path - The dot syntax path, e.g. `a.b.c`.
|
|
3001
|
+
* @returns An array of items in the path
|
|
3002
|
+
*/
|
|
3003
|
+
private getSplitPath;
|
|
3004
|
+
/**
|
|
3005
|
+
* Gets the path to the $def
|
|
3006
|
+
* @param context - The context name. For example, `item in items` creates the `item` context.
|
|
3007
|
+
* @returns A string to use as a $ref
|
|
3008
|
+
*/
|
|
3009
|
+
private getDefsPath;
|
|
3010
|
+
/**
|
|
3011
|
+
* Get the schema $id
|
|
3012
|
+
* @param customElementName - The custom element name
|
|
3013
|
+
* @param propertyName - The property name
|
|
3014
|
+
* @returns The ID that can be used in the JSON schema as $id
|
|
3015
|
+
*/
|
|
3016
|
+
private getSchemaId;
|
|
3017
|
+
/**
|
|
3018
|
+
* Add a new JSON schema to the JSON schema map
|
|
3019
|
+
* @param propertyName - The name of the property to assign this JSON schema to.
|
|
3020
|
+
*/
|
|
3021
|
+
private addNewSchema;
|
|
3022
|
+
/**
|
|
3023
|
+
* Add properties to a context
|
|
3024
|
+
* @param schema - The schema to add the properties to.
|
|
3025
|
+
* @param splitPath - The path split into property/context names.
|
|
3026
|
+
* @param context - The path context.
|
|
3027
|
+
*/
|
|
3028
|
+
private addPropertiesToAContext;
|
|
3029
|
+
/**
|
|
3030
|
+
* Add properties to an object
|
|
3031
|
+
* @param schema - The schema to add the properties to.
|
|
3032
|
+
* @param splitPath - The path split into property/context names.
|
|
3033
|
+
* @param context - The path context.
|
|
3034
|
+
* @param type - The data type (see JSON schema for details).
|
|
3035
|
+
*/
|
|
3036
|
+
private addPropertiesToAnObject;
|
|
3037
|
+
/**
|
|
3038
|
+
* Add an array to an object property
|
|
3039
|
+
* @param schema - The schema to add the properties to.
|
|
3040
|
+
* @param context - The name of the context.
|
|
3041
|
+
*/
|
|
3042
|
+
private addArrayToAnObject;
|
|
3043
|
+
/**
|
|
3044
|
+
* Add a context to the $defs property
|
|
3045
|
+
* @param schema - The schema to use.
|
|
3046
|
+
* @param propertyName - The name of the property the context belongs to.
|
|
3047
|
+
* @param currentContext - The current context.
|
|
3048
|
+
* @param parentContext - The parent context.
|
|
3049
|
+
* @returns
|
|
3050
|
+
*/
|
|
3051
|
+
private addContext;
|
|
3052
|
+
/**
|
|
3053
|
+
* Get parent contexts
|
|
3054
|
+
* @param schema - The schema to use.
|
|
3055
|
+
* @param parentContext - The parent context.
|
|
3056
|
+
* @param contexts - A list of parent contexts.
|
|
3057
|
+
* @returns
|
|
3058
|
+
*/
|
|
3059
|
+
private getParentContexts;
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
/**
|
|
3063
|
+
* Module-level registry that maps custom element names to their schema maps.
|
|
3064
|
+
* Used for cross-element `$ref` resolution (e.g. nested element schemas).
|
|
3065
|
+
* Each Schema instance registers itself here on construction.
|
|
3066
|
+
* @public
|
|
3067
|
+
*/
|
|
3068
|
+
export declare const schemaRegistry: CachedPathMap;
|
|
3069
|
+
|
|
2820
3070
|
/**
|
|
2821
3071
|
* Shadow root initialization options.
|
|
2822
3072
|
* @public
|
|
@@ -2830,6 +3080,40 @@ export declare interface ShadowRootOptions extends ShadowRootInit {
|
|
|
2830
3080
|
registry?: CustomElementRegistry;
|
|
2831
3081
|
}
|
|
2832
3082
|
|
|
3083
|
+
/**
|
|
3084
|
+
* The gateway to signal APIs.
|
|
3085
|
+
* @public
|
|
3086
|
+
*/
|
|
3087
|
+
export declare const Signal: Readonly<{
|
|
3088
|
+
/**
|
|
3089
|
+
* Subscribes to a signal.
|
|
3090
|
+
* @param signal - The signal to subscribe to.
|
|
3091
|
+
* @param subscriber - The subscriber.
|
|
3092
|
+
*/
|
|
3093
|
+
subscribe(signal: string, subscriber: Subscriber): void;
|
|
3094
|
+
/**
|
|
3095
|
+
* Unsubscribes from the signal.
|
|
3096
|
+
* @param signal - The signal to unsubscribe from.
|
|
3097
|
+
* @param subscriber - The subscriber.
|
|
3098
|
+
*/
|
|
3099
|
+
unsubscribe(signal: string, subscriber: Subscriber): void;
|
|
3100
|
+
/**
|
|
3101
|
+
* Sends the specified signal to subscribers.
|
|
3102
|
+
* @param signal - The signal to send.
|
|
3103
|
+
*/
|
|
3104
|
+
send(signal: string): void;
|
|
3105
|
+
}>;
|
|
3106
|
+
|
|
3107
|
+
/**
|
|
3108
|
+
* Creates a signal binding configuration with the supplied options.
|
|
3109
|
+
* @param expression - The binding to refresh when signaled.
|
|
3110
|
+
* @param options - The signal name or a binding to use to retrieve the signal name.
|
|
3111
|
+
* @param policy - The security policy to associate with th binding.
|
|
3112
|
+
* @returns A binding configuration.
|
|
3113
|
+
* @public
|
|
3114
|
+
*/
|
|
3115
|
+
export declare function signal<T = any>(expression: Expression<T>, options: string | Expression<T>, policy?: DOMPolicy): Binding<T>;
|
|
3116
|
+
|
|
2833
3117
|
/**
|
|
2834
3118
|
* A directive that observes the `assignedNodes()` of a slot and updates a property
|
|
2835
3119
|
* whenever they change.
|
|
@@ -3091,6 +3375,35 @@ export declare const enum Stages {
|
|
|
3091
3375
|
disconnected = 3
|
|
3092
3376
|
}
|
|
3093
3377
|
|
|
3378
|
+
/**
|
|
3379
|
+
* A read/write stateful value.
|
|
3380
|
+
* @beta
|
|
3381
|
+
*/
|
|
3382
|
+
export declare type State<T> = ReadonlyState<T> & {
|
|
3383
|
+
/**
|
|
3384
|
+
* Gets or sets the current state value.
|
|
3385
|
+
*/
|
|
3386
|
+
current: T;
|
|
3387
|
+
/**
|
|
3388
|
+
* Sets the current state value.
|
|
3389
|
+
* @param value - The new state value.
|
|
3390
|
+
*/
|
|
3391
|
+
set(value: T): void;
|
|
3392
|
+
/**
|
|
3393
|
+
* Creates a readonly version of the state.
|
|
3394
|
+
*/
|
|
3395
|
+
asReadonly(): ReadonlyState<T>;
|
|
3396
|
+
};
|
|
3397
|
+
|
|
3398
|
+
/**
|
|
3399
|
+
* Creates a reactive state value.
|
|
3400
|
+
* @param value - The initial state value.
|
|
3401
|
+
* @param options - Options to customize the state or a friendly name.
|
|
3402
|
+
* @returns A State instance.
|
|
3403
|
+
* @beta
|
|
3404
|
+
*/
|
|
3405
|
+
export declare function state<T>(value: T, options?: string | StateOptions): State<T>;
|
|
3406
|
+
|
|
3094
3407
|
/**
|
|
3095
3408
|
* A base class used for attribute directives that don't need internal state.
|
|
3096
3409
|
* @public
|
|
@@ -3121,6 +3434,21 @@ export declare abstract class StatelessAttachedAttributeDirective<TOptions> impl
|
|
|
3121
3434
|
abstract bind(controller: ViewController): void;
|
|
3122
3435
|
}
|
|
3123
3436
|
|
|
3437
|
+
/**
|
|
3438
|
+
* Options for creating state.
|
|
3439
|
+
* @beta
|
|
3440
|
+
*/
|
|
3441
|
+
export declare type StateOptions = {
|
|
3442
|
+
/**
|
|
3443
|
+
* Indicates whether to deeply make the state value observable.
|
|
3444
|
+
*/
|
|
3445
|
+
deep?: boolean;
|
|
3446
|
+
/**
|
|
3447
|
+
* A friendly name for the state.
|
|
3448
|
+
*/
|
|
3449
|
+
name?: string;
|
|
3450
|
+
};
|
|
3451
|
+
|
|
3124
3452
|
/**
|
|
3125
3453
|
* Implemented to provide specific behavior when adding/removing styles
|
|
3126
3454
|
* for elements.
|
|
@@ -3287,29 +3615,31 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
|
3287
3615
|
*/
|
|
3288
3616
|
export declare interface TemplateLifecycleCallbacks {
|
|
3289
3617
|
/**
|
|
3290
|
-
* Called after the
|
|
3618
|
+
* Called after the JS class definition has been registered.
|
|
3619
|
+
*/
|
|
3620
|
+
elementDidRegister?(name: string): void;
|
|
3621
|
+
/**
|
|
3622
|
+
* Called before the template has been evaluated and assigned.
|
|
3623
|
+
*/
|
|
3624
|
+
templateWillUpdate?(name: string): void;
|
|
3625
|
+
/**
|
|
3626
|
+
* Called after the template has been assigned to the definition.
|
|
3291
3627
|
*/
|
|
3292
3628
|
templateDidUpdate?(name: string): void;
|
|
3293
3629
|
/**
|
|
3294
|
-
* Called after the custom element has been defined
|
|
3630
|
+
* Called after the custom element has been defined.
|
|
3295
3631
|
*/
|
|
3296
3632
|
elementDidDefine?(name: string): void;
|
|
3633
|
+
/**
|
|
3634
|
+
* Called before an individual element's hydration begins.
|
|
3635
|
+
*/
|
|
3636
|
+
elementWillHydrate?(source: HTMLElement): void;
|
|
3637
|
+
/**
|
|
3638
|
+
* Called after an individual element's hydration has finished.
|
|
3639
|
+
*/
|
|
3640
|
+
elementDidHydrate?(source: HTMLElement): void;
|
|
3297
3641
|
}
|
|
3298
3642
|
|
|
3299
|
-
/**
|
|
3300
|
-
* Values for the `templateOptions` property.
|
|
3301
|
-
* @alpha
|
|
3302
|
-
*/
|
|
3303
|
-
export declare const TemplateOptions: {
|
|
3304
|
-
readonly deferAndHydrate: "defer-and-hydrate";
|
|
3305
|
-
};
|
|
3306
|
-
|
|
3307
|
-
/**
|
|
3308
|
-
* Type for the `TemplateOptions` const enum.
|
|
3309
|
-
* @alpha
|
|
3310
|
-
*/
|
|
3311
|
-
export declare type TemplateOptions = (typeof TemplateOptions)[keyof typeof TemplateOptions];
|
|
3312
|
-
|
|
3313
3643
|
/**
|
|
3314
3644
|
* Represents the types of values that can be interpolated into a template.
|
|
3315
3645
|
* @public
|
|
@@ -3329,23 +3659,100 @@ export declare type TrustedTypesPolicy = {
|
|
|
3329
3659
|
};
|
|
3330
3660
|
|
|
3331
3661
|
/**
|
|
3332
|
-
*
|
|
3333
|
-
* @
|
|
3662
|
+
* Creates a default binding.
|
|
3663
|
+
* @param expression - The binding to refresh when changed.
|
|
3664
|
+
* @param optionsOrChangeEvent - The binding options or the name of the change event to use.
|
|
3665
|
+
* @param policy - The security policy to associate with the binding.
|
|
3666
|
+
* @param isBindingVolatile - Indicates whether the binding is volatile or not.
|
|
3667
|
+
* @returns A binding.
|
|
3668
|
+
* @public
|
|
3669
|
+
*/
|
|
3670
|
+
export declare function twoWay<T = any>(expression: Expression<T>, optionsOrChangeEvent?: TwoWayBindingOptions | string, policy?: DOMPolicy, isBindingVolatile?: boolean): Binding<T>;
|
|
3671
|
+
|
|
3672
|
+
/**
|
|
3673
|
+
* The twoWay binding options.
|
|
3674
|
+
* @public
|
|
3675
|
+
*/
|
|
3676
|
+
export declare type TwoWayBindingOptions = {
|
|
3677
|
+
changeEvent?: string;
|
|
3678
|
+
fromView?: (value: any) => any;
|
|
3679
|
+
};
|
|
3680
|
+
|
|
3681
|
+
/**
|
|
3682
|
+
* The settings required to enable two-way binding.
|
|
3683
|
+
* @public
|
|
3684
|
+
*/
|
|
3685
|
+
export declare interface TwoWaySettings {
|
|
3686
|
+
/**
|
|
3687
|
+
* Determines which event to listen to, to detect changes in the view.
|
|
3688
|
+
* @param bindingSource - The directive to determine the change event for.
|
|
3689
|
+
* @param target - The target element to determine the change event for.
|
|
3690
|
+
*/
|
|
3691
|
+
determineChangeEvent(bindingSource: BindingDirective, target: HTMLElement): string;
|
|
3692
|
+
}
|
|
3693
|
+
|
|
3694
|
+
/**
|
|
3695
|
+
* Enables configuring two-way binding settings.
|
|
3696
|
+
* @public
|
|
3697
|
+
*/
|
|
3698
|
+
export declare const TwoWaySettings: Readonly<{
|
|
3699
|
+
/**
|
|
3700
|
+
* Configures two-way binding.
|
|
3701
|
+
* @param settings - The settings to use for the two-way binding system.
|
|
3702
|
+
*/
|
|
3703
|
+
configure(settings: TwoWaySettings): void;
|
|
3704
|
+
}>;
|
|
3705
|
+
|
|
3706
|
+
/**
|
|
3707
|
+
* A type that can be registered with a `TypeRegistry`.
|
|
3708
|
+
* @public
|
|
3334
3709
|
*/
|
|
3335
|
-
declare interface TypeDefinition {
|
|
3710
|
+
export declare interface TypeDefinition {
|
|
3711
|
+
/**
|
|
3712
|
+
* The registered type constructor.
|
|
3713
|
+
*/
|
|
3336
3714
|
type: Function;
|
|
3337
3715
|
}
|
|
3338
3716
|
|
|
3339
3717
|
/**
|
|
3340
|
-
*
|
|
3341
|
-
* @
|
|
3718
|
+
* A registry that stores definitions by type.
|
|
3719
|
+
* @public
|
|
3342
3720
|
*/
|
|
3343
3721
|
export declare interface TypeRegistry<TDefinition extends TypeDefinition> {
|
|
3722
|
+
/**
|
|
3723
|
+
* Registers a type definition.
|
|
3724
|
+
* @param definition - The type definition to register.
|
|
3725
|
+
* @returns `true` when the definition was registered, otherwise `false`.
|
|
3726
|
+
*/
|
|
3344
3727
|
register(definition: TDefinition): boolean;
|
|
3728
|
+
/**
|
|
3729
|
+
* Gets a definition by type.
|
|
3730
|
+
* @param key - The type to retrieve the definition for.
|
|
3731
|
+
*/
|
|
3345
3732
|
getByType(key: Function): TDefinition | undefined;
|
|
3733
|
+
/**
|
|
3734
|
+
* Gets a definition by instance.
|
|
3735
|
+
* @param object - The instance to retrieve the definition for.
|
|
3736
|
+
*/
|
|
3346
3737
|
getForInstance(object: any): TDefinition | undefined;
|
|
3347
3738
|
}
|
|
3348
3739
|
|
|
3740
|
+
/**
|
|
3741
|
+
* An extension of MutationObserver that supports unobserving nodes.
|
|
3742
|
+
* @internal
|
|
3743
|
+
*/
|
|
3744
|
+
export declare class UnobservableMutationObserver extends MutationObserver {
|
|
3745
|
+
private readonly callback;
|
|
3746
|
+
private observedNodes;
|
|
3747
|
+
/**
|
|
3748
|
+
* Creates an instance of UnobservableMutationObserver.
|
|
3749
|
+
* @param callback - The callback to invoke when observed nodes are changed.
|
|
3750
|
+
*/
|
|
3751
|
+
constructor(callback: MutationCallback);
|
|
3752
|
+
observe(target: Node, options?: MutationObserverInit | undefined): void;
|
|
3753
|
+
unobserve(target: Node): void;
|
|
3754
|
+
}
|
|
3755
|
+
|
|
3349
3756
|
/**
|
|
3350
3757
|
* A work queue used to synchronize writes to the DOM.
|
|
3351
3758
|
* @public
|
|
@@ -3445,14 +3852,6 @@ export declare interface ViewBehavior<TSource = any, TParent = any> {
|
|
|
3445
3852
|
bind(controller: ViewController<TSource, TParent>): void;
|
|
3446
3853
|
}
|
|
3447
3854
|
|
|
3448
|
-
/**
|
|
3449
|
-
* Stores relationships between a {@link ViewBehaviorFactory} and
|
|
3450
|
-
* the {@link ViewBoundaries} the factory created.
|
|
3451
|
-
*/
|
|
3452
|
-
declare interface ViewBehaviorBoundaries {
|
|
3453
|
-
[factoryId: string]: ViewBoundaries;
|
|
3454
|
-
}
|
|
3455
|
-
|
|
3456
3855
|
/**
|
|
3457
3856
|
* A factory that can create a {@link ViewBehavior} associated with a particular
|
|
3458
3857
|
* location within a DOM fragment.
|
|
@@ -3481,6 +3880,45 @@ export declare interface ViewBehaviorFactory {
|
|
|
3481
3880
|
createBehavior(): ViewBehavior;
|
|
3482
3881
|
}
|
|
3483
3882
|
|
|
3883
|
+
/**
|
|
3884
|
+
* Bridges between ViewBehaviors and HostBehaviors, enabling a host to
|
|
3885
|
+
* control ViewBehaviors.
|
|
3886
|
+
* @public
|
|
3887
|
+
*/
|
|
3888
|
+
export declare interface ViewBehaviorOrchestrator<TSource = any, TParent = any> extends ViewController<TSource, TParent>, HostBehavior<TSource> {
|
|
3889
|
+
/**
|
|
3890
|
+
*
|
|
3891
|
+
* @param nodeId - The structural id of the DOM node to which a behavior will apply.
|
|
3892
|
+
* @param target - The DOM node associated with the id.
|
|
3893
|
+
*/
|
|
3894
|
+
addTarget(nodeId: string, target: Node): void;
|
|
3895
|
+
/**
|
|
3896
|
+
* Adds a behavior.
|
|
3897
|
+
* @param behavior - The behavior to add.
|
|
3898
|
+
*/
|
|
3899
|
+
addBehavior(behavior: ViewBehavior): void;
|
|
3900
|
+
/**
|
|
3901
|
+
* Adds a behavior factory.
|
|
3902
|
+
* @param factory - The behavior factory to add.
|
|
3903
|
+
* @param target - The target the factory will create behaviors for.
|
|
3904
|
+
*/
|
|
3905
|
+
addBehaviorFactory(factory: ViewBehaviorFactory, target: Node): void;
|
|
3906
|
+
}
|
|
3907
|
+
|
|
3908
|
+
/**
|
|
3909
|
+
* Bridges between ViewBehaviors and HostBehaviors, enabling a host to
|
|
3910
|
+
* control ViewBehaviors.
|
|
3911
|
+
* @public
|
|
3912
|
+
*/
|
|
3913
|
+
export declare const ViewBehaviorOrchestrator: Readonly<{
|
|
3914
|
+
/**
|
|
3915
|
+
* Creates a ViewBehaviorOrchestrator.
|
|
3916
|
+
* @param source - The source to to associate behaviors with.
|
|
3917
|
+
* @returns A ViewBehaviorOrchestrator.
|
|
3918
|
+
*/
|
|
3919
|
+
create<TSource = any, TParent = any>(source: TSource): ViewBehaviorOrchestrator<TSource, TParent>;
|
|
3920
|
+
}>;
|
|
3921
|
+
|
|
3484
3922
|
/**
|
|
3485
3923
|
* The target nodes available to a behavior.
|
|
3486
3924
|
* @public
|
|
@@ -3489,14 +3927,6 @@ export declare type ViewBehaviorTargets = {
|
|
|
3489
3927
|
[id: string]: Node;
|
|
3490
3928
|
};
|
|
3491
3929
|
|
|
3492
|
-
/**
|
|
3493
|
-
* Represents the DOM boundaries controlled by a view
|
|
3494
|
-
*/
|
|
3495
|
-
declare interface ViewBoundaries {
|
|
3496
|
-
first: Node;
|
|
3497
|
-
last: Node;
|
|
3498
|
-
}
|
|
3499
|
-
|
|
3500
3930
|
/**
|
|
3501
3931
|
* Controls the lifecycle of a view and provides relevant context.
|
|
3502
3932
|
* @public
|
|
@@ -3506,11 +3936,23 @@ export declare interface ViewController<TSource = any, TParent = any> extends Ex
|
|
|
3506
3936
|
* The parts of the view that are targeted by view behaviors.
|
|
3507
3937
|
*/
|
|
3508
3938
|
readonly targets: ViewBehaviorTargets;
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3939
|
+
/**
|
|
3940
|
+
* When true, directives skip attribute/booleanAttribute DOM
|
|
3941
|
+
* updates during bind(). This is an internal flag set only
|
|
3942
|
+
* during the prerendered bind window.
|
|
3943
|
+
* @internal
|
|
3944
|
+
*/
|
|
3945
|
+
readonly _skipAttrUpdates?: boolean;
|
|
3946
|
+
/**
|
|
3947
|
+
* Resolves `true` when the view's host element had prerendered
|
|
3948
|
+
* content (existing shadow root).
|
|
3949
|
+
*/
|
|
3950
|
+
readonly isPrerendered?: Promise<boolean>;
|
|
3951
|
+
/**
|
|
3952
|
+
* Resolves `true` after prerendered content has been hydrated,
|
|
3953
|
+
* `false` when client-side rendered or hydration not enabled.
|
|
3954
|
+
*/
|
|
3955
|
+
readonly isHydrated?: Promise<boolean>;
|
|
3514
3956
|
}
|
|
3515
3957
|
|
|
3516
3958
|
/**
|
|
@@ -3540,11 +3982,6 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
|
|
|
3540
3982
|
* @internal
|
|
3541
3983
|
*/
|
|
3542
3984
|
compile(): HTMLTemplateCompilationResult<TSource, TParent>;
|
|
3543
|
-
/**
|
|
3544
|
-
* Creates an HTMLView instance based on this template definition.
|
|
3545
|
-
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
3546
|
-
*/
|
|
3547
|
-
create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
3548
3985
|
/**
|
|
3549
3986
|
* Returns a directive that can inline the template.
|
|
3550
3987
|
*/
|
|
@@ -3566,6 +4003,11 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
|
|
|
3566
4003
|
* host that the template is being attached to.
|
|
3567
4004
|
*/
|
|
3568
4005
|
render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
4006
|
+
/**
|
|
4007
|
+
* Creates an HTMLView instance based on this template definition.
|
|
4008
|
+
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
4009
|
+
*/
|
|
4010
|
+
create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
3569
4011
|
/**
|
|
3570
4012
|
* Processes the tagged template literal's static strings and interpolated values and
|
|
3571
4013
|
* creates a ViewTemplate.
|
|
@@ -3609,6 +4051,15 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
|
|
|
3609
4051
|
*/
|
|
3610
4052
|
export declare function volatile(target: {}, name: string | Accessor, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
3611
4053
|
|
|
4054
|
+
/**
|
|
4055
|
+
* Deeply subscribes to changes in existing observable objects.
|
|
4056
|
+
* @param object - The observable object to watch.
|
|
4057
|
+
* @param subscriber - The handler to call when changes are made to the object.
|
|
4058
|
+
* @returns A disposable that can be used to unsubscribe from change updates.
|
|
4059
|
+
* @beta
|
|
4060
|
+
*/
|
|
4061
|
+
export declare function watch(object: any, subscriber: Subscriber | ((subject: any, args: any) => void)): Disposable;
|
|
4062
|
+
|
|
3612
4063
|
/**
|
|
3613
4064
|
* A directive that enables basic conditional rendering in a template.
|
|
3614
4065
|
* @param condition - The condition to test for rendering.
|