@microsoft/fast-element 2.0.0-beta.9 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/.eslintrc.json +1 -1
  2. package/CHANGELOG.json +518 -0
  3. package/CHANGELOG.md +181 -1
  4. package/README.md +1 -9
  5. package/api-extractor.context.json +14 -0
  6. package/api-extractor.di.json +14 -0
  7. package/dist/context/context.api.json +1068 -0
  8. package/dist/di/di.api.json +4929 -0
  9. package/dist/dts/binding/binding.d.ts +49 -0
  10. package/dist/dts/binding/normalize.d.ts +9 -0
  11. package/dist/dts/binding/one-time.d.ts +11 -0
  12. package/dist/dts/binding/one-way.d.ts +20 -0
  13. package/dist/dts/{templating/binding-signal.d.ts → binding/signal.d.ts} +19 -4
  14. package/dist/dts/{templating/binding-two-way.d.ts → binding/two-way.d.ts} +9 -5
  15. package/dist/dts/components/attributes.d.ts +7 -1
  16. package/dist/dts/components/element-controller.d.ts +104 -8
  17. package/dist/dts/components/element-hydration.d.ts +2 -0
  18. package/dist/dts/components/fast-definitions.d.ts +6 -0
  19. package/dist/dts/components/hydration.d.ts +56 -0
  20. package/dist/dts/components/install-hydration.d.ts +1 -0
  21. package/dist/dts/context.d.ts +29 -15
  22. package/dist/dts/di/di.d.ts +0 -5
  23. package/dist/dts/dom-policy.d.ts +83 -0
  24. package/dist/dts/dom.d.ts +100 -0
  25. package/dist/dts/hydration/target-builder.d.ts +63 -0
  26. package/dist/dts/index.d.ts +33 -26
  27. package/dist/dts/index.rollup.d.ts +0 -1
  28. package/dist/dts/index.rollup.debug.d.ts +0 -1
  29. package/dist/dts/interfaces.d.ts +32 -82
  30. package/dist/dts/metadata.d.ts +6 -5
  31. package/dist/dts/observation/arrays.d.ts +1 -1
  32. package/dist/dts/observation/observable.bench.d.ts +18 -0
  33. package/dist/dts/observation/observable.d.ts +5 -5
  34. package/dist/dts/pending-task.d.ts +19 -7
  35. package/dist/dts/platform.d.ts +11 -2
  36. package/dist/dts/polyfills.d.ts +0 -8
  37. package/dist/dts/styles/css-binding-directive.d.ts +60 -0
  38. package/dist/dts/styles/css.d.ts +9 -7
  39. package/dist/dts/styles/element-styles.d.ts +1 -14
  40. package/dist/dts/styles/host.d.ts +2 -5
  41. package/dist/dts/styles/style-strategy.d.ts +42 -0
  42. package/dist/dts/templating/compiler.d.ts +11 -13
  43. package/dist/dts/templating/{binding.d.ts → html-binding-directive.d.ts} +21 -41
  44. package/dist/dts/templating/html-directive.d.ts +44 -140
  45. package/dist/dts/templating/install-hydratable-view-templates.d.ts +1 -0
  46. package/dist/dts/templating/node-observation.d.ts +11 -1
  47. package/dist/dts/templating/ref.d.ts +4 -0
  48. package/dist/dts/templating/render.bench.d.ts +3 -0
  49. package/dist/dts/templating/render.d.ts +49 -9
  50. package/dist/dts/templating/repeat-basic-reverse.bench.d.ts +3 -0
  51. package/dist/dts/templating/repeat-basic-shift.bench.d.ts +3 -0
  52. package/dist/dts/templating/repeat.d.ts +31 -9
  53. package/dist/dts/templating/template.d.ts +97 -12
  54. package/dist/dts/templating/view.d.ts +146 -29
  55. package/dist/dts/templating/when-basic.bench.d.ts +3 -0
  56. package/dist/dts/templating/when-conditional.bench.d.ts +3 -0
  57. package/dist/dts/templating/when-switch.bench.d.ts +3 -0
  58. package/dist/dts/templating/when.d.ts +3 -1
  59. package/dist/dts/testing/fakes.d.ts +12 -1
  60. package/dist/dts/tsdoc-metadata.json +1 -1
  61. package/dist/dts/utilities.d.ts +55 -1
  62. package/dist/esm/binding/binding.js +18 -0
  63. package/dist/esm/binding/normalize.js +17 -0
  64. package/dist/esm/binding/one-time.js +21 -0
  65. package/dist/esm/binding/one-way.js +30 -0
  66. package/dist/esm/{templating/binding-signal.js → binding/signal.js} +22 -6
  67. package/dist/esm/{templating/binding-two-way.js → binding/two-way.js} +18 -12
  68. package/dist/esm/components/attributes.js +19 -6
  69. package/dist/esm/components/element-controller.js +319 -49
  70. package/dist/esm/components/element-hydration.js +2 -0
  71. package/dist/esm/components/fast-definitions.js +12 -4
  72. package/dist/esm/components/fast-element.js +3 -1
  73. package/dist/esm/components/hydration.js +104 -0
  74. package/dist/esm/components/install-hydration.js +3 -0
  75. package/dist/esm/context.js +26 -4
  76. package/dist/esm/debug.js +8 -2
  77. package/dist/esm/di/di.js +9 -12
  78. package/dist/esm/dom-policy.js +345 -0
  79. package/dist/esm/dom.js +101 -0
  80. package/dist/esm/hydration/target-builder.js +175 -0
  81. package/dist/esm/index.js +34 -25
  82. package/dist/esm/index.rollup.debug.js +3 -1
  83. package/dist/esm/index.rollup.js +3 -1
  84. package/dist/esm/interfaces.js +51 -3
  85. package/dist/esm/metadata.js +11 -8
  86. package/dist/esm/observation/arrays.js +1 -1
  87. package/dist/esm/observation/observable.bench.js +79 -0
  88. package/dist/esm/observation/observable.js +20 -15
  89. package/dist/esm/observation/update-queue.js +2 -2
  90. package/dist/esm/pending-task.js +13 -1
  91. package/dist/esm/platform.js +12 -2
  92. package/dist/esm/polyfills.js +3 -61
  93. package/dist/esm/styles/css-binding-directive.js +76 -0
  94. package/dist/esm/styles/css.js +14 -7
  95. package/dist/esm/styles/element-styles.js +0 -33
  96. package/dist/esm/styles/style-strategy.js +1 -0
  97. package/dist/esm/templating/children.js +8 -4
  98. package/dist/esm/templating/compiler.js +37 -44
  99. package/dist/esm/templating/html-binding-directive.js +218 -0
  100. package/dist/esm/templating/html-directive.js +25 -152
  101. package/dist/esm/templating/install-hydratable-view-templates.js +17 -0
  102. package/dist/esm/templating/node-observation.js +14 -8
  103. package/dist/esm/templating/ref.js +1 -1
  104. package/dist/esm/templating/render.bench.js +56 -0
  105. package/dist/esm/templating/render.js +74 -30
  106. package/dist/esm/templating/repeat-basic-reverse.bench.js +43 -0
  107. package/dist/esm/templating/repeat-basic-shift.bench.js +43 -0
  108. package/dist/esm/templating/repeat.js +116 -17
  109. package/dist/esm/templating/template.js +135 -60
  110. package/dist/esm/templating/view.js +254 -34
  111. package/dist/esm/templating/when-basic.bench.js +36 -0
  112. package/dist/esm/templating/when-conditional.bench.js +39 -0
  113. package/dist/esm/templating/when-switch.bench.js +68 -0
  114. package/dist/esm/templating/when.js +12 -5
  115. package/dist/esm/testing/fakes.js +32 -1
  116. package/dist/esm/testing/fixture.js +1 -1
  117. package/dist/esm/utilities.js +97 -1
  118. package/dist/fast-element.api.json +9789 -5667
  119. package/dist/fast-element.d.ts +813 -2392
  120. package/dist/fast-element.debug.js +2788 -974
  121. package/dist/fast-element.debug.min.js +3 -1
  122. package/dist/fast-element.js +2641 -833
  123. package/dist/fast-element.min.js +3 -1
  124. package/dist/fast-element.untrimmed.d.ts +662 -314
  125. package/docs/{api-report.md → api-report.api.md} +238 -151
  126. package/docs/context/api-report.api.md +69 -0
  127. package/docs/di/api-report.api.md +315 -0
  128. package/karma.conf.cjs +2 -1
  129. package/package.json +59 -47
  130. package/scripts/run-api-extractor.js +51 -0
  131. package/scripts/run-benchmarks.js +46 -0
  132. package/tensile.config.js +12 -0
  133. package/dist/dts/templating/dom.d.ts +0 -41
  134. package/dist/esm/templating/binding.js +0 -282
  135. package/dist/esm/templating/dom.js +0 -49
  136. package/docs/guide/declaring-templates.md +0 -230
  137. package/docs/guide/defining-elements.md +0 -214
  138. package/docs/guide/leveraging-css.md +0 -253
  139. package/docs/guide/next-steps.md +0 -13
  140. package/docs/guide/observables-and-state.md +0 -213
  141. package/docs/guide/using-directives.md +0 -576
  142. package/docs/guide/working-with-shadow-dom.md +0 -296
@@ -0,0 +1,100 @@
1
+ /**
2
+ * The type of HTML aspect to target.
3
+ * @public
4
+ */
5
+ export declare const DOMAspect: Readonly<{
6
+ /**
7
+ * Not aspected.
8
+ */
9
+ readonly none: 0;
10
+ /**
11
+ * An attribute.
12
+ */
13
+ readonly attribute: 1;
14
+ /**
15
+ * A boolean attribute.
16
+ */
17
+ readonly booleanAttribute: 2;
18
+ /**
19
+ * A property.
20
+ */
21
+ readonly property: 3;
22
+ /**
23
+ * Content
24
+ */
25
+ readonly content: 4;
26
+ /**
27
+ * A token list.
28
+ */
29
+ readonly tokenList: 5;
30
+ /**
31
+ * An event.
32
+ */
33
+ readonly event: 6;
34
+ }>;
35
+ /**
36
+ * The type of HTML aspect to target.
37
+ * @public
38
+ */
39
+ export declare type DOMAspect = (typeof DOMAspect)[Exclude<keyof typeof DOMAspect, "none">];
40
+ /**
41
+ * A function used to send values to a DOM sink.
42
+ * @public
43
+ */
44
+ export declare type DOMSink = (target: Node, aspectName: string, value: any, ...args: any[]) => void;
45
+ /**
46
+ * A security policy that FAST can use to interact with the DOM.
47
+ * @public
48
+ */
49
+ export interface DOMPolicy {
50
+ /**
51
+ * Creates safe HTML from the provided value.
52
+ * @param value - The source to convert to safe HTML.
53
+ */
54
+ createHTML(value: string): string;
55
+ /**
56
+ * Protects a DOM sink that intends to write to the DOM.
57
+ * @param tagName - The tag name for the element to write to.
58
+ * @param aspect - The aspect of the DOM to write to.
59
+ * @param aspectName - The name of the aspect to write to.
60
+ * @param sink - The sink that is used to write to the DOM.
61
+ */
62
+ protect(tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink): DOMSink;
63
+ }
64
+ /**
65
+ * Common DOM APIs.
66
+ * @public
67
+ */
68
+ export declare const DOM: Readonly<{
69
+ /**
70
+ * Gets the dom policy used by the templating system.
71
+ */
72
+ readonly policy: DOMPolicy;
73
+ /**
74
+ * Sets the dom policy used by the templating system.
75
+ * @param policy - The policy to set.
76
+ * @remarks
77
+ * This API can only be called once, for security reasons. It should be
78
+ * called by the application developer at the start of their program.
79
+ */
80
+ setPolicy(value: DOMPolicy): void;
81
+ /**
82
+ * Sets an attribute value on an element.
83
+ * @param element - The element to set the attribute value on.
84
+ * @param attributeName - The attribute name to set.
85
+ * @param value - The value of the attribute to set.
86
+ * @remarks
87
+ * If the value is `null` or `undefined`, the attribute is removed, otherwise
88
+ * it is set to the provided value using the standard `setAttribute` API.
89
+ */
90
+ setAttribute(element: HTMLElement, attributeName: string, value: any): void;
91
+ /**
92
+ * Sets a boolean attribute value.
93
+ * @param element - The element to set the boolean attribute value on.
94
+ * @param attributeName - The attribute name to set.
95
+ * @param value - The value of the attribute to set.
96
+ * @remarks
97
+ * If the value is true, the attribute is added; otherwise it is removed.
98
+ */
99
+ setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
100
+ }>;
@@ -0,0 +1,63 @@
1
+ import type { CompiledViewBehaviorFactory, ViewBehaviorFactory, ViewBehaviorTargets } from "../templating/html-directive.js";
2
+ export declare class HydrationTargetElementError extends Error {
3
+ /**
4
+ * The Compiled View Behavior Factories that belong to the view.
5
+ */
6
+ readonly factories: CompiledViewBehaviorFactory[];
7
+ /**
8
+ * The node to target factory.
9
+ */
10
+ readonly node: Element;
11
+ /**
12
+ * String representation of the HTML in the template that
13
+ * threw the target element error.
14
+ */
15
+ templateString?: string;
16
+ constructor(
17
+ /**
18
+ * The error message
19
+ */
20
+ message: string | undefined,
21
+ /**
22
+ * The Compiled View Behavior Factories that belong to the view.
23
+ */
24
+ factories: CompiledViewBehaviorFactory[],
25
+ /**
26
+ * The node to target factory.
27
+ */
28
+ node: Element);
29
+ }
30
+ /**
31
+ * Represents the DOM boundaries controlled by a view
32
+ */
33
+ export interface ViewBoundaries {
34
+ first: Node;
35
+ last: Node;
36
+ }
37
+ /**
38
+ * Stores relationships between a {@link ViewBehaviorFactory} and
39
+ * the {@link ViewBoundaries} the factory created.
40
+ */
41
+ export interface ViewBehaviorBoundaries {
42
+ [factoryId: string]: ViewBoundaries;
43
+ }
44
+ /**
45
+ * Returns a range object inclusive of all nodes including and between the
46
+ * provided first and last node.
47
+ * @param first - The first node
48
+ * @param last - This last node
49
+ * @returns
50
+ */
51
+ export declare function createRangeForNodes(first: Node, last: Node): Range;
52
+ /**
53
+ * Maps {@link CompiledViewBehaviorFactory} ids to the corresponding node targets for the view.
54
+ * @param firstNode - The first node of the view.
55
+ * @param lastNode - The last node of the view.
56
+ * @param factories - The Compiled View Behavior Factories that belong to the view.
57
+ * @returns - A {@link ViewBehaviorTargets } object for the factories in the view.
58
+ */
59
+ export declare function buildViewBindingTargets(firstNode: Node, lastNode: Node, factories: CompiledViewBehaviorFactory[]): {
60
+ targets: ViewBehaviorTargets;
61
+ boundaries: ViewBehaviorBoundaries;
62
+ };
63
+ export declare function targetFactory(factory: ViewBehaviorFactory, node: Node, targets: ViewBehaviorTargets): void;
@@ -1,27 +1,34 @@
1
- export type { Callable, Constructable, Disposable, FASTGlobal, Mutable, StyleStrategy, StyleTarget, TrustedTypes, TrustedTypesPolicy, } from "./interfaces.js";
2
- export * from "./platform.js";
3
- export * from "./observation/observable.js";
4
- export * from "./observation/notifier.js";
5
- export * from "./observation/arrays.js";
6
- export * from "./observation/update-queue.js";
7
- export * from "./styles/element-styles.js";
8
- export * from "./styles/css.js";
9
- export * from "./styles/css-directive.js";
10
- export * from "./styles/host.js";
11
- export * from "./templating/dom.js";
12
- export * from "./templating/template.js";
13
- export * from "./templating/compiler.js";
1
+ export type { Callable, Constructable, Class, Disposable, FASTGlobal, TrustedTypesPolicy, } from "./interfaces.js";
2
+ export { FAST, emptyArray } from "./platform.js";
3
+ export { DOMAspect, DOMSink, DOMPolicy, DOM } from "./dom.js";
4
+ export { Accessor, Expression, ExecutionContext, ExpressionController, ExpressionObserver, ExpressionNotifier, Observable, observable, ObservationRecord, SourceLifetime, volatile, } from "./observation/observable.js";
5
+ export { Notifier, PropertyChangeNotifier, Subscriber, SubscriberSet, } from "./observation/notifier.js";
6
+ export { ArrayObserver, LengthObserver, lengthOf, Splice, SpliceStrategy, SpliceStrategySupport, } from "./observation/arrays.js";
7
+ export { UpdateQueue, Updates } from "./observation/update-queue.js";
8
+ export { Binding, BindingDirective } from "./binding/binding.js";
9
+ export { listener, oneWay } from "./binding/one-way.js";
10
+ export { oneTime } from "./binding/one-time.js";
11
+ export { normalizeBinding } from "./binding/normalize.js";
12
+ export { ComposableStyles, ConstructibleStyleStrategy, ElementStyles, } from "./styles/element-styles.js";
13
+ export { css, CSSTemplateTag, CSSValue } from "./styles/css.js";
14
+ export { AddBehavior, cssDirective, CSSDirective, CSSDirectiveDefinition, } from "./styles/css-directive.js";
15
+ export { HostController, HostBehavior } from "./styles/host.js";
16
+ export { StyleStrategy, StyleTarget } from "./styles/style-strategy.js";
17
+ export { CSSBindingDirective } from "./styles/css-binding-directive.js";
18
+ export { CaptureType, ElementViewTemplate, html, HTMLTemplateCompilationResult, HTMLTemplateTag, InlineTemplateDirective, SyntheticViewTemplate, TemplateValue, ViewTemplate, } from "./templating/template.js";
19
+ export { CompilationStrategy, Compiler } from "./templating/compiler.js";
14
20
  export { Markup, Parser } from "./templating/markup.js";
15
- export * from "./templating/binding.js";
16
- export * from "./templating/html-directive.js";
17
- export * from "./templating/ref.js";
18
- export * from "./templating/when.js";
19
- export * from "./templating/repeat.js";
20
- export * from "./templating/slotted.js";
21
- export * from "./templating/children.js";
22
- export * from "./templating/view.js";
23
- export * from "./templating/node-observation.js";
24
- export * from "./components/fast-element.js";
25
- export * from "./components/fast-definitions.js";
26
- export * from "./components/attributes.js";
27
- export * from "./components/element-controller.js";
21
+ export { ContentTemplate, ContentView, HTMLBindingDirective, } from "./templating/html-binding-directive.js";
22
+ export { AddViewBehaviorFactory, Aspected, CompiledViewBehaviorFactory, htmlDirective, HTMLDirective, HTMLDirectiveDefinition, PartialHTMLDirectiveDefinition, StatelessAttachedAttributeDirective, ViewBehavior, ViewBehaviorFactory, ViewBehaviorTargets, ViewController, } from "./templating/html-directive.js";
23
+ export { ref, RefDirective } from "./templating/ref.js";
24
+ export { when } from "./templating/when.js";
25
+ export { repeat, RepeatBehavior, RepeatDirective, RepeatOptions, } from "./templating/repeat.js";
26
+ export { slotted, SlottedDirective, SlottedDirectiveOptions, } from "./templating/slotted.js";
27
+ export { children, ChildrenDirective, ChildrenDirectiveOptions, ChildListDirectiveOptions, SubtreeDirectiveOptions, } from "./templating/children.js";
28
+ export { ElementView, HTMLView, SyntheticView, View, HydratableView, HydrationBindingError, } from "./templating/view.js";
29
+ export { elements, ElementsFilter, NodeBehaviorOptions, NodeObservationDirective, } from "./templating/node-observation.js";
30
+ export { render, RenderBehavior, RenderDirective } from "./templating/render.js";
31
+ export { customElement, FASTElement } from "./components/fast-element.js";
32
+ export { FASTElementDefinition, PartialFASTElementDefinition, ShadowRootOptions, } from "./components/fast-definitions.js";
33
+ export { attr, AttributeConfiguration, AttributeDefinition, AttributeMode, booleanConverter, DecoratorAttributeConfiguration, nullableBooleanConverter, nullableNumberConverter, ValueConverter, } from "./components/attributes.js";
34
+ export { ElementController, ElementControllerStrategy, HydratableElementController, } from "./components/element-controller.js";
@@ -1,2 +1 @@
1
- import "./polyfills.js";
2
1
  export * from "./index.js";
@@ -1,3 +1,2 @@
1
- import "./polyfills.js";
2
1
  import "./debug.js";
3
2
  export * from "./index.js";
@@ -6,7 +6,7 @@ export declare type Callable = typeof Function.prototype.call | {
6
6
  call(): void;
7
7
  };
8
8
  /**
9
- * Allows for the creation of Constructable mixin classes.
9
+ * Represents a type which can be constructed with the new operator.
10
10
  *
11
11
  * @public
12
12
  */
@@ -14,18 +14,14 @@ export declare type Constructable<T = {}> = {
14
14
  new (...args: any[]): T;
15
15
  };
16
16
  /**
17
- * Represents a class.
17
+ * Represents a constructable class with a prototype.
18
18
  * @public
19
19
  */
20
- export declare type Class<T, C = {}> = C & {
20
+ export declare type Class<T, C = {}> = C & Constructable<T> & {
21
21
  /**
22
22
  * The class's prototype;
23
23
  */
24
24
  readonly prototype: T;
25
- /**
26
- * The class's constructor.
27
- */
28
- new (...args: any[]): T;
29
25
  };
30
26
  /**
31
27
  * Provides a mechanism for releasing resources.
@@ -37,18 +33,6 @@ export interface Disposable {
37
33
  */
38
34
  dispose(): void;
39
35
  }
40
- /**
41
- * Reverses all readonly members, making them mutable.
42
- * @internal
43
- */
44
- export declare type Mutable<T> = {
45
- -readonly [P in keyof T]: T[P];
46
- };
47
- /**
48
- * Extracts the item type from an array.
49
- * @public
50
- */
51
- export declare type ArrayItem<T> = T extends ReadonlyArray<infer TItem> ? TItem : T extends Array<infer TItem> ? TItem : any;
52
36
  /**
53
37
  * A policy for use with the standard trustedTypes platform API.
54
38
  * @public
@@ -61,20 +45,20 @@ export declare type TrustedTypesPolicy = {
61
45
  createHTML(html: string): string;
62
46
  };
63
47
  /**
64
- * Enables working with trusted types.
48
+ * Reverses all readonly members, making them mutable.
65
49
  * @public
66
50
  */
67
- export declare type TrustedTypes = {
68
- /**
69
- * Creates a trusted types policy.
70
- * @param name - The policy name.
71
- * @param rules - The policy rules implementation.
72
- */
73
- createPolicy(name: string, rules: TrustedTypesPolicy): TrustedTypesPolicy;
51
+ export declare type Mutable<T> = {
52
+ -readonly [P in keyof T]: T[P];
74
53
  };
54
+ /**
55
+ * A temporary type as a workaround for the TS compiler's erroneous built-in ParameterDecorator type.
56
+ * @public
57
+ */
58
+ export declare type ParameterDecorator = (target: Object, propertyKey: string | undefined, parameterIndex: number) => void;
75
59
  /**
76
60
  * The FAST global.
77
- * @internal
61
+ * @public
78
62
  */
79
63
  export interface FASTGlobal {
80
64
  /**
@@ -110,69 +94,32 @@ export interface FASTGlobal {
110
94
  addMessages(messages: Record<number, string>): void;
111
95
  }
112
96
  /**
113
- * Core services shared across FAST instances.
97
+ * Core services that can be shared across FAST instances.
114
98
  * @internal
115
99
  */
116
- export declare const enum KernelServiceId {
117
- updateQueue = 1,
118
- observable = 2,
119
- contextEvent = 3,
120
- elementRegistry = 4,
121
- styleSheetStrategy = 5
122
- }
123
- /**
124
- * A node that can be targeted by styles.
125
- * @public
126
- */
127
- export interface StyleTarget {
128
- /**
129
- * Stylesheets to be adopted by the node.
130
- */
131
- adoptedStyleSheets?: CSSStyleSheet[];
132
- /**
133
- * Adds styles to the target by appending the styles.
134
- * @param styles - The styles element to add.
135
- */
136
- append(styles: HTMLStyleElement): void;
137
- /**
138
- * Removes styles from the target.
139
- * @param styles - The styles element to remove.
140
- */
141
- removeChild(styles: HTMLStyleElement): void;
142
- /**
143
- * Returns all element descendants of node that match selectors.
144
- * @param selectors - The CSS selector to use for the query.
145
- */
146
- querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
147
- }
148
- /**
149
- * Implemented to provide specific behavior when adding/removing styles
150
- * for elements.
151
- * @public
152
- */
153
- export interface StyleStrategy {
154
- /**
155
- * Adds styles to the target.
156
- * @param target - The target to add the styles to.
157
- */
158
- addStylesTo(target: StyleTarget): void;
159
- /**
160
- * Removes styles from the target.
161
- * @param target - The target to remove the styles from.
162
- */
163
- removeStylesFrom(target: StyleTarget): void;
164
- }
100
+ declare type KernelServiceId = {
101
+ readonly updateQueue: string | number;
102
+ readonly observable: string | number;
103
+ readonly contextEvent: string | number;
104
+ readonly elementRegistry: string | number;
105
+ };
106
+ declare let KernelServiceId: KernelServiceId;
107
+ export { KernelServiceId };
165
108
  /**
166
109
  * Warning and error messages.
167
110
  * @internal
168
111
  */
169
112
  export declare const enum Message {
170
113
  needsArrayObservation = 1101,
171
- onlySetHTMLPolicyOnce = 1201,
114
+ onlySetDOMPolicyOnce = 1201,
172
115
  bindingInnerHTMLRequiresTrustedTypes = 1202,
173
116
  twoWayBindingRequiresObservables = 1203,
174
117
  hostBindingWithoutHost = 1204,
175
118
  unsupportedBindingBehavior = 1205,
119
+ directCallToHTMLTagNotAllowed = 1206,
120
+ onlySetTemplatePolicyOnce = 1207,
121
+ cannotSetTemplatePolicyAfterCompilation = 1208,
122
+ blockedByDOMPolicy = 1209,
176
123
  missingElementDefinition = 1401,
177
124
  noRegistrationForContext = 1501,
178
125
  noFactoryForResolver = 1502,
@@ -190,14 +137,17 @@ export declare const enum Message {
190
137
  connectUpdateRequiresController = 1514
191
138
  }
192
139
  /**
193
- * @internal
140
+ * Determines whether or not an object is a function.
141
+ * @public
194
142
  */
195
143
  export declare const isFunction: (object: any) => object is Function;
196
144
  /**
197
- * @internal
145
+ * Determines whether or not an object is a string.
146
+ * @public
198
147
  */
199
148
  export declare const isString: (object: any) => object is string;
200
149
  /**
201
- * @internal
150
+ * A function which does nothing.
151
+ * @public
202
152
  */
203
153
  export declare const noop: () => undefined;
@@ -1,6 +1,7 @@
1
1
  import type { Constructable } from "./interfaces.js";
2
2
  /**
3
3
  * Provides basic metadata capabilities used by Context and Dependency Injection.
4
+ * @public
4
5
  */
5
6
  export declare const Metadata: Readonly<{
6
7
  /**
@@ -8,18 +9,18 @@ export declare const Metadata: Readonly<{
8
9
  * @param Type - The type to get the metadata for.
9
10
  * @returns The metadata array or a frozen empty array if no metadata is found.
10
11
  */
11
- getDesignParamTypes: (Type: any) => any;
12
+ getDesignParamTypes: (Type: Constructable) => readonly any[];
12
13
  /**
13
14
  * Gets the "annotation:paramtypes" metadata for the specified type.
14
15
  * @param Type - The type to get the metadata for.
15
16
  * @returns The metadata array or a frozen empty array if no metadata is found.
16
17
  */
17
- getAnnotationParamTypes: (Type: any) => any;
18
+ getAnnotationParamTypes: (Type: Constructable) => readonly any[];
18
19
  /**
19
- *
20
- * @param Type - Gets the "annotation:paramtypes" metadata for the specified type. If none is found,
20
+ * Gets the "annotation:paramtypes" metadata for the specified type. If none is found,
21
21
  * an empty, mutable metadata array is created and added.
22
- * @returns The metadata array.
22
+ * @param Type - The type to get or create the metadata for.
23
+ * @returns A mutable metadata array.
23
24
  */
24
25
  getOrCreateAnnotationParamTypes(Type: Constructable): any[];
25
26
  }>;
@@ -57,7 +57,7 @@ export declare const SpliceStrategySupport: Readonly<{
57
57
  * The available values for SpliceStrategySupport.
58
58
  * @public
59
59
  */
60
- export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof typeof SpliceStrategySupport];
60
+ export declare type SpliceStrategySupport = (typeof SpliceStrategySupport)[keyof typeof SpliceStrategySupport];
61
61
  /**
62
62
  * An approach to tracking changes in an array.
63
63
  * @public
@@ -0,0 +1,18 @@
1
+ import { FASTElement } from "../index.js";
2
+ export declare class TestObservable extends FASTElement {
3
+ private _greetMessage;
4
+ private _name;
5
+ private _exit;
6
+ firstName: string;
7
+ lastName: string;
8
+ connectedCallback(): void;
9
+ get greetMessage(): string;
10
+ set greetMessage(value: string);
11
+ get name(): string;
12
+ set name(value: string);
13
+ get exit(): boolean;
14
+ set exit(value: boolean);
15
+ }
16
+ declare const itemRenderer: () => HTMLElement;
17
+ export default itemRenderer;
18
+ export { tests } from "@tensile-perf/web-components";
@@ -60,7 +60,7 @@ export declare const SourceLifetime: Readonly<{
60
60
  * Describes how the source's lifetime relates to its controller's lifetime.
61
61
  * @public
62
62
  */
63
- export declare type SourceLifetime = typeof SourceLifetime[keyof typeof SourceLifetime];
63
+ export declare type SourceLifetime = (typeof SourceLifetime)[keyof typeof SourceLifetime];
64
64
  /**
65
65
  * Controls the lifecycle of an expression and provides relevant context.
66
66
  * @public
@@ -176,17 +176,17 @@ export declare const Observable: Readonly<{
176
176
  /**
177
177
  * Creates a {@link ExpressionNotifier} that can watch the
178
178
  * provided {@link Expression} for changes.
179
- * @param binding - The binding to observe.
179
+ * @param expression - The binding to observe.
180
180
  * @param initialSubscriber - An initial subscriber to changes in the binding value.
181
181
  * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
182
182
  */
183
- binding<TSource = any, TReturn = any>(binding: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
183
+ binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
184
184
  /**
185
185
  * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
186
186
  * on every evaluation of the value.
187
- * @param binding - The binding to inspect.
187
+ * @param expression - The binding to inspect.
188
188
  */
189
- isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Expression<TSource_1, TReturn_1, any>): boolean;
189
+ isVolatileBinding<TSource_1 = any, TReturn_1 = any>(expression: Expression<TSource_1, TReturn_1, any>): boolean;
190
190
  }>;
191
191
  /**
192
192
  * Decorator: Defines an observable property on the target.
@@ -1,20 +1,32 @@
1
- /**
2
- * This module provides
3
- */
4
1
  /**
5
2
  * An implementation of the https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/pending-task.md proposal.
6
- * @beta
3
+ * @public
7
4
  */
8
5
  export interface PendingTask extends Event {
9
- complete: Promise<void>;
6
+ /**
7
+ * A promise that resolves when the pending task is complete.
8
+ */
9
+ readonly complete: Promise<void>;
10
10
  }
11
11
  /**
12
12
  * A concrete implementation of {@link PendingTask}
13
- * @beta
13
+ * @public
14
14
  */
15
15
  export declare class PendingTaskEvent extends Event implements PendingTask {
16
- complete: Promise<void>;
16
+ readonly complete: Promise<void>;
17
+ /**
18
+ * The type of the pending task event.
19
+ */
17
20
  static readonly type = "pending-task";
21
+ /**
22
+ * Creates an instance of PendingTaskEvent.
23
+ * @param complete - A promise that resolves when the pending task is complete.
24
+ */
18
25
  constructor(complete: Promise<void>);
26
+ /**
27
+ * Determines whether a value is a PendingTaskEvent.
28
+ * @param value - The value to check.
29
+ * @returns True if the value is a PendingTaskEvent; false otherwise.
30
+ */
19
31
  static isPendingTask<T extends Event>(value: T | PendingTask): value is PendingTask;
20
32
  }
@@ -1,7 +1,8 @@
1
- import type { FASTGlobal } from "./interfaces.js";
1
+ import { FASTGlobal } from "./interfaces.js";
2
+ import "./polyfills.js";
2
3
  /**
3
4
  * The FAST global.
4
- * @internal
5
+ * @public
5
6
  */
6
7
  export declare const FAST: FASTGlobal;
7
8
  /**
@@ -39,3 +40,11 @@ export declare function createTypeRegistry<TDefinition extends TypeDefinition>()
39
40
  * @internal
40
41
  */
41
42
  export declare function createMetadataLocator<TMetadata>(): (target: {}) => TMetadata[];
43
+ /**
44
+ * Makes a type noop for JSON serialization.
45
+ * @param type - The type to make noop for JSON serialization.
46
+ * @internal
47
+ */
48
+ export declare function makeSerializationNoop(type: {
49
+ readonly prototype: any;
50
+ }): void;
@@ -1,8 +0,0 @@
1
- import type { StyleStrategy, StyleTarget } from "./interfaces.js";
2
- export declare class StyleElementStrategy implements StyleStrategy {
3
- private readonly styles;
4
- private readonly styleClass;
5
- constructor(styles: string[]);
6
- addStylesTo(target: StyleTarget): void;
7
- removeStylesFrom(target: StyleTarget): void;
8
- }
@@ -0,0 +1,60 @@
1
+ import type { Binding, BindingDirective } from "../binding/binding.js";
2
+ import type { Subscriber } from "../observation/notifier.js";
3
+ import type { ExpressionObserver } from "../observation/observable.js";
4
+ import { AddBehavior, CSSDirective } from "./css-directive.js";
5
+ import type { ComposableStyles } from "./element-styles.js";
6
+ import type { HostBehavior, HostController } from "./host.js";
7
+ declare type CSSBindingEntry = {
8
+ observer: ExpressionObserver;
9
+ controller: HostController;
10
+ };
11
+ /**
12
+ * Enables bindings in CSS.
13
+ *
14
+ * @public
15
+ */
16
+ export declare class CSSBindingDirective implements HostBehavior, Subscriber, CSSDirective, BindingDirective {
17
+ readonly dataBinding: Binding;
18
+ readonly targetAspect: string;
19
+ /**
20
+ * Creates an instance of CSSBindingDirective.
21
+ * @param dataBinding - The binding to use in CSS.
22
+ * @param targetAspect - The CSS property to target.
23
+ */
24
+ constructor(dataBinding: Binding, targetAspect: string);
25
+ /**
26
+ * Creates a CSS fragment to interpolate into the CSS document.
27
+ * @returns - the string to interpolate into CSS
28
+ */
29
+ createCSS(add: AddBehavior): ComposableStyles;
30
+ /**
31
+ * Executed when this behavior is attached to a controller.
32
+ * @param controller - Controls the behavior lifecycle.
33
+ */
34
+ addedCallback(controller: HostController<HTMLElement & {
35
+ $cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
36
+ }>): void;
37
+ /**
38
+ * Executed when this behavior's host is connected.
39
+ * @param controller - Controls the behavior lifecycle.
40
+ */
41
+ connectedCallback(controller: HostController<HTMLElement & {
42
+ $cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
43
+ }>): void;
44
+ /**
45
+ * Executed when this behavior is detached from a controller.
46
+ * @param controller - Controls the behavior lifecycle.
47
+ */
48
+ removedCallback(controller: HostController<HTMLElement & {
49
+ $cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
50
+ }>): void;
51
+ /**
52
+ * Called when a subject this instance has subscribed to changes.
53
+ * @param subject - The subject of the change.
54
+ * @param args - The event args detailing the change that occurred.
55
+ *
56
+ * @internal
57
+ */
58
+ handleChange(_: any, observer: ExpressionObserver): void;
59
+ }
60
+ export {};