@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
@@ -17,19 +17,6 @@ export type AddBehavior = (behavior: HostBehavior<HTMLElement>) => void;
17
17
  // @public
18
18
  export type AddViewBehaviorFactory = (factory: ViewBehaviorFactory) => string;
19
19
 
20
- // Warning: (ae-internal-missing-underscore) The name "AdoptedStyleSheetsStrategy" should be prefixed with an underscore because the declaration is marked as @internal
21
- //
22
- // @internal
23
- export class AdoptedStyleSheetsStrategy implements StyleStrategy {
24
- constructor(styles: (string | CSSStyleSheet)[]);
25
- // (undocumented)
26
- addStylesTo(target: StyleTarget): void;
27
- // (undocumented)
28
- removeStylesFrom(target: StyleTarget): void;
29
- // (undocumented)
30
- readonly sheets: CSSStyleSheet[];
31
- }
32
-
33
20
  // @public
34
21
  export interface ArrayObserver extends SubscriberSet {
35
22
  addSplice(splice: Splice): void;
@@ -44,24 +31,9 @@ export const ArrayObserver: Readonly<{
44
31
  readonly enable: () => void;
45
32
  }>;
46
33
 
47
- // @public
48
- export const Aspect: Readonly<{
49
- readonly none: 0;
50
- readonly attribute: 1;
51
- readonly booleanAttribute: 2;
52
- readonly property: 3;
53
- readonly content: 4;
54
- readonly tokenList: 5;
55
- readonly event: 6;
56
- readonly assign: (directive: Aspected, value?: string) => void;
57
- }>;
58
-
59
- // @public
60
- export type Aspect = typeof Aspect[Exclude<keyof typeof Aspect, "assign" | "none">];
61
-
62
34
  // @public
63
35
  export interface Aspected {
64
- aspectType: Aspect;
36
+ aspectType: DOMAspect;
65
37
  dataBinding?: Binding;
66
38
  sourceAspect: string;
67
39
  targetAspect: string;
@@ -108,18 +80,24 @@ export class AttributeDefinition implements Accessor {
108
80
  // @public
109
81
  export type AttributeMode = typeof reflectMode | typeof booleanMode | "fromView";
110
82
 
111
- // @public
112
- export function bind<T = any>(binding: Expression<T>, isVolatile?: boolean): Binding<T>;
113
-
114
83
  // @public
115
84
  export abstract class Binding<TSource = any, TReturn = any, TParent = any> {
116
- constructor(evaluate: Expression<TSource, TReturn, TParent>, isVolatile?: boolean);
117
- abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
85
+ constructor(evaluate: Expression<TSource, TReturn, TParent>, policy?: DOMPolicy | undefined, isVolatile?: boolean);
86
+ abstract createObserver(subscriber: Subscriber, directive: BindingDirective): ExpressionObserver<TSource, TReturn, TParent>;
118
87
  // (undocumented)
119
88
  evaluate: Expression<TSource, TReturn, TParent>;
120
89
  // (undocumented)
121
90
  isVolatile: boolean;
122
91
  options?: any;
92
+ // (undocumented)
93
+ policy?: DOMPolicy | undefined;
94
+ }
95
+
96
+ // @public
97
+ export interface BindingDirective {
98
+ readonly aspectType?: DOMAspect;
99
+ readonly dataBinding: Binding;
100
+ readonly targetAspect?: string;
123
101
  }
124
102
 
125
103
  // @public
@@ -152,17 +130,25 @@ export class ChildrenDirective extends NodeObservationDirective<ChildrenDirectiv
152
130
  // @public
153
131
  export type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | SubtreeDirectiveOptions<T>;
154
132
 
133
+ // @public
134
+ export type Class<T, C = {}> = C & Constructable<T> & {
135
+ readonly prototype: T;
136
+ };
137
+
155
138
  // @public
156
139
  export type CompilationStrategy = (
157
140
  html: string | HTMLTemplateElement,
158
- factories: Record<string, ViewBehaviorFactory>) => HTMLTemplateCompilationResult;
141
+ factories: Record<string, ViewBehaviorFactory>,
142
+ policy: DOMPolicy) => HTMLTemplateCompilationResult;
143
+
144
+ // @public
145
+ export type CompiledViewBehaviorFactory = Required<ViewBehaviorFactory>;
159
146
 
160
147
  // @public
161
148
  export const Compiler: {
162
- setHTMLPolicy(policy: TrustedTypesPolicy): void;
163
- compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, directives: Record<string, ViewBehaviorFactory>): HTMLTemplateCompilationResult<TSource, TParent>;
149
+ compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy): HTMLTemplateCompilationResult<TSource, TParent>;
164
150
  setDefaultStrategy(strategy: CompilationStrategy): void;
165
- aggregate(parts: (string | ViewBehaviorFactory)[]): ViewBehaviorFactory;
151
+ aggregate(parts: (string | ViewBehaviorFactory)[], policy?: DOMPolicy): ViewBehaviorFactory;
166
152
  };
167
153
 
168
154
  // @public
@@ -193,19 +179,30 @@ export interface ContentView {
193
179
  unbind(): void;
194
180
  }
195
181
 
196
- // Warning: (ae-internal-missing-underscore) The name "createMetadataLocator" should be prefixed with an underscore because the declaration is marked as @internal
197
- //
198
- // @internal
199
- export function createMetadataLocator<TMetadata>(): (target: {}) => TMetadata[];
200
-
201
- // Warning: (ae-internal-missing-underscore) The name "createTypeRegistry" should be prefixed with an underscore because the declaration is marked as @internal
202
- //
203
- // @internal
204
- export function createTypeRegistry<TDefinition extends TypeDefinition>(): TypeRegistry<TDefinition>;
205
-
206
182
  // @public
207
183
  export const css: CSSTemplateTag;
208
184
 
185
+ // @public
186
+ export class CSSBindingDirective implements HostBehavior, Subscriber, CSSDirective, BindingDirective {
187
+ constructor(dataBinding: Binding, targetAspect: string);
188
+ addedCallback(controller: HostController<HTMLElement & {
189
+ $cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
190
+ }>): void;
191
+ connectedCallback(controller: HostController<HTMLElement & {
192
+ $cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
193
+ }>): void;
194
+ createCSS(add: AddBehavior): ComposableStyles;
195
+ // (undocumented)
196
+ readonly dataBinding: Binding;
197
+ // @internal
198
+ handleChange(_: any, observer: ExpressionObserver): void;
199
+ removedCallback(controller: HostController<HTMLElement & {
200
+ $cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
201
+ }>): void;
202
+ // (undocumented)
203
+ readonly targetAspect: string;
204
+ }
205
+
209
206
  // @public
210
207
  export interface CSSDirective {
211
208
  createCSS(add: AddBehavior): ComposableStyles;
@@ -226,14 +223,14 @@ export interface CSSDirectiveDefinition<TType extends Constructable<CSSDirective
226
223
  readonly type: TType;
227
224
  }
228
225
 
229
- // @public @deprecated (undocumented)
230
- export const cssPartial: (strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]) => CSSDirective;
231
-
232
226
  // @public
233
- export type CSSTemplateTag = ((strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]) => ElementStyles) & {
234
- partial(strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]): CSSDirective;
227
+ export type CSSTemplateTag = (<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: CSSValue<TSource, TParent>[]) => ElementStyles) & {
228
+ partial<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: CSSValue<TSource, TParent>[]): CSSDirective;
235
229
  };
236
230
 
231
+ // @public
232
+ export type CSSValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | ComposableStyles | CSSDirective;
233
+
237
234
  // @public
238
235
  export function customElement(nameOrDef: string | PartialFASTElementDefinition): (type: Constructable<HTMLElement>) => void;
239
236
 
@@ -247,36 +244,87 @@ export interface Disposable {
247
244
 
248
245
  // @public
249
246
  export const DOM: Readonly<{
250
- queueUpdate: (callable: Callable) => void;
251
- nextUpdate: () => Promise<void>;
252
- processUpdates: () => void;
247
+ readonly policy: DOMPolicy;
248
+ setPolicy(value: DOMPolicy): void;
253
249
  setAttribute(element: HTMLElement, attributeName: string, value: any): void;
254
250
  setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
255
251
  }>;
256
252
 
253
+ // @public
254
+ export const DOMAspect: Readonly<{
255
+ readonly none: 0;
256
+ readonly attribute: 1;
257
+ readonly booleanAttribute: 2;
258
+ readonly property: 3;
259
+ readonly content: 4;
260
+ readonly tokenList: 5;
261
+ readonly event: 6;
262
+ }>;
263
+
264
+ // @public
265
+ export type DOMAspect = (typeof DOMAspect)[Exclude<keyof typeof DOMAspect, "none">];
266
+
267
+ // @public
268
+ export interface DOMPolicy {
269
+ createHTML(value: string): string;
270
+ protect(tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink): DOMSink;
271
+ }
272
+
273
+ // @public
274
+ export type DOMSink = (target: Node, aspectName: string, value: any, ...args: any[]) => void;
275
+
257
276
  // @public
258
277
  export class ElementController<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier implements HostController<TElement> {
259
278
  // @internal
260
279
  constructor(element: TElement, definition: FASTElementDefinition);
261
280
  addBehavior(behavior: HostBehavior<TElement>): void;
262
281
  addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
282
+ // (undocumented)
283
+ protected behaviors: Map<HostBehavior<TElement>, number> | null;
284
+ // (undocumented)
285
+ protected bindObservables(): void;
263
286
  connect(): void;
287
+ // (undocumented)
288
+ protected connectBehaviors(): void;
289
+ get context(): ExecutionContext;
264
290
  readonly definition: FASTElementDefinition;
265
291
  disconnect(): void;
292
+ // (undocumented)
293
+ protected disconnectBehaviors(): void;
266
294
  emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
267
295
  static forCustomElement(element: HTMLElement): ElementController;
296
+ get isBound(): boolean;
268
297
  get isConnected(): boolean;
269
298
  get mainStyles(): ElementStyles | null;
270
299
  set mainStyles(value: ElementStyles | null);
300
+ // (undocumented)
301
+ protected needsInitialization: boolean;
271
302
  onAttributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
303
+ onUnbind(behavior: {
304
+ unbind(controller: ExpressionController<TElement>): any;
305
+ }): void;
272
306
  removeBehavior(behavior: HostBehavior<TElement>, force?: boolean): void;
273
307
  removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
308
+ // (undocumented)
309
+ protected renderTemplate(template: ElementViewTemplate | null | undefined): void;
310
+ static setStrategy(strategy: ElementControllerStrategy): void;
274
311
  readonly source: TElement;
312
+ get sourceLifetime(): SourceLifetime | undefined;
313
+ // Warning: (ae-forgotten-export) The symbol "Stages" needs to be exported by the entry point index.d.ts
314
+ //
315
+ // (undocumented)
316
+ protected stage: Stages;
275
317
  get template(): ElementViewTemplate<TElement> | null;
276
318
  set template(value: ElementViewTemplate<TElement> | null);
277
319
  readonly view: ElementView<TElement> | null;
278
320
  }
279
321
 
322
+ // @public
323
+ export interface ElementControllerStrategy {
324
+ // (undocumented)
325
+ new (element: HTMLElement, definition: FASTElementDefinition): ElementController;
326
+ }
327
+
280
328
  // @public
281
329
  export const elements: (selector?: string) => ElementsFilter;
282
330
 
@@ -306,6 +354,10 @@ export class ElementStyles {
306
354
  // @public
307
355
  export interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent> {
308
356
  appendTo(node: Node): void;
357
+ onUnbind(behavior: {
358
+ unbind(controller: ViewController<TSource, TParent>): any;
359
+ }): void;
360
+ readonly sourceLifetime?: SourceLifetime;
309
361
  }
310
362
 
311
363
  // @public
@@ -366,9 +418,7 @@ export interface ExpressionObserver<TSource = any, TReturn = any, TParent = any>
366
418
  bind(controller: ExpressionController<TSource, TParent>): TReturn;
367
419
  }
368
420
 
369
- // Warning: (ae-internal-missing-underscore) The name "FAST" should be prefixed with an underscore because the declaration is marked as @internal
370
- //
371
- // @internal
421
+ // @public
372
422
  export const FAST: FASTGlobal;
373
423
 
374
424
  // @public
@@ -400,6 +450,8 @@ export class FASTElementDefinition<TType extends Constructable<HTMLElement> = Co
400
450
  get isDefined(): boolean;
401
451
  readonly name: string;
402
452
  readonly propertyLookup: Record<string, AttributeDefinition>;
453
+ // @internal
454
+ static registerBaseType(type: Function): void;
403
455
  readonly registry: CustomElementRegistry;
404
456
  readonly shadowOptions?: ShadowRootOptions;
405
457
  readonly styles?: ElementStyles;
@@ -407,9 +459,7 @@ export class FASTElementDefinition<TType extends Constructable<HTMLElement> = Co
407
459
  readonly type: TType;
408
460
  }
409
461
 
410
- // Warning: (ae-internal-missing-underscore) The name "FASTGlobal" should be prefixed with an underscore because the declaration is marked as @internal
411
- //
412
- // @internal
462
+ // @public
413
463
  export interface FASTGlobal {
414
464
  addMessages(messages: Record<number, string>): void;
415
465
  error(code: number, values?: Record<string, any>): Error;
@@ -429,31 +479,24 @@ export interface HostBehavior<TSource = any> {
429
479
  }
430
480
 
431
481
  // @public
432
- export interface HostController<TSource = any> {
482
+ export interface HostController<TSource = any> extends ExpressionController<TSource> {
433
483
  addBehavior(behavior: HostBehavior<TSource>): void;
434
484
  addStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
435
485
  readonly isConnected: boolean;
436
486
  mainStyles: ElementStyles | null;
437
487
  removeBehavior(behavior: HostBehavior<TSource>, force?: boolean): void;
438
488
  removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void;
439
- readonly source: TSource;
440
489
  }
441
490
 
442
491
  // @public
443
- export function html<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]): ViewTemplate<TSource, TParent>;
492
+ export const html: HTMLTemplateTag;
444
493
 
445
494
  // @public
446
- export class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected {
495
+ export class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected, BindingDirective {
447
496
  constructor(dataBinding: Binding);
448
- aspectType: Aspect;
449
- // @internal (undocumented)
450
- bind: (controller: ViewController) => void;
497
+ aspectType: DOMAspect;
451
498
  // @internal (undocumented)
452
- bindContent(controller: ViewController): void;
453
- // @internal (undocumented)
454
- bindDefault(controller: ViewController): void;
455
- // @internal (undocumented)
456
- bindEvent(controller: ViewController): void;
499
+ bind(controller: ViewController): void;
457
500
  createBehavior(): ViewBehavior;
458
501
  createHTML(add: AddViewBehaviorFactory): string;
459
502
  // (undocumented)
@@ -463,9 +506,11 @@ export class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory,
463
506
  // @internal (undocumented)
464
507
  handleEvent(event: Event): void;
465
508
  id: string;
466
- nodeId: string;
509
+ policy: DOMPolicy;
467
510
  sourceAspect: string;
468
511
  targetAspect: string;
512
+ targetNodeId: string;
513
+ targetTagName: string | null;
469
514
  // @internal (undocumented)
470
515
  unbind(controller: ViewController): void;
471
516
  }
@@ -480,6 +525,7 @@ export const HTMLDirective: Readonly<{
480
525
  getForInstance: (object: any) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
481
526
  getByType: (key: Function) => HTMLDirectiveDefinition<Constructable<HTMLDirective>> | undefined;
482
527
  define<TType extends Constructable<HTMLDirective>>(type: TType, options?: PartialHTMLDirectiveDefinition): TType;
528
+ assignAspect(directive: Aspected, value?: string): void;
483
529
  }>;
484
530
 
485
531
  // @public
@@ -493,36 +539,33 @@ export interface HTMLDirectiveDefinition<TType extends Constructable<HTMLDirecti
493
539
  // @public
494
540
  export interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
495
541
  createView(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
542
+ // (undocumented)
543
+ readonly factories: CompiledViewBehaviorFactory[];
496
544
  }
497
545
 
498
546
  // @public
499
- export class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
500
- constructor(fragment: DocumentFragment, factories: ReadonlyArray<ViewBehaviorFactory>, targets: ViewBehaviorTargets);
547
+ export type HTMLTemplateTag = (<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]) => ViewTemplate<TSource, TParent>) & {
548
+ partial(html: string): InlineTemplateDirective;
549
+ };
550
+
551
+ // Warning: (ae-forgotten-export) The symbol "DefaultExecutionContext" needs to be exported by the entry point index.d.ts
552
+ //
553
+ // @public
554
+ export class HTMLView<TSource = any, TParent = any> extends DefaultExecutionContext<TParent> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
555
+ constructor(fragment: DocumentFragment, factories: ReadonlyArray<CompiledViewBehaviorFactory>, targets: ViewBehaviorTargets);
501
556
  appendTo(node: Node): void;
502
557
  bind(source: TSource, context?: ExecutionContext<TParent>): void;
503
558
  context: ExecutionContext<TParent>;
504
559
  dispose(): void;
505
560
  static disposeContiguousBatch(views: SyntheticView[]): void;
506
- get event(): Event;
507
- eventDetail<TDetail>(): TDetail;
508
- eventTarget<TTarget extends EventTarget>(): TTarget;
509
561
  firstChild: Node;
510
- index: number;
511
562
  insertBefore(node: Node): void;
512
563
  isBound: boolean;
513
- get isEven(): boolean;
514
- get isFirst(): boolean;
515
- get isInMiddle(): boolean;
516
- get isLast(): boolean;
517
- get isOdd(): boolean;
518
564
  lastChild: Node;
519
- length: number;
520
565
  // (undocumented)
521
566
  onUnbind(behavior: {
522
- unbind(controller: ViewController<TSource, TParent>): any;
567
+ unbind(controller: ViewController<TSource, TParent>): void;
523
568
  }): void;
524
- readonly parent: TParent;
525
- readonly parentContext: ExecutionContext<TParent>;
526
569
  remove(): void;
527
570
  source: TSource | null;
528
571
  readonly sourceLifetime: SourceLifetime;
@@ -531,6 +574,50 @@ export class HTMLView<TSource = any, TParent = any> implements ElementView<TSour
531
574
  unbind(): void;
532
575
  }
533
576
 
577
+ // @beta
578
+ export class HydratableElementController<TElement extends HTMLElement = HTMLElement> extends ElementController<TElement> {
579
+ // (undocumented)
580
+ connect(): void;
581
+ // (undocumented)
582
+ disconnect(): void;
583
+ // (undocumented)
584
+ static install(): void;
585
+ protected needsHydration?: boolean;
586
+ }
587
+
588
+ // @public (undocumented)
589
+ export interface HydratableView<TSource = any, TParent = any> extends ElementView, SyntheticView, DefaultExecutionContext<TParent> {
590
+ // (undocumented)
591
+ [Hydratable]: symbol;
592
+ // Warning: (ae-forgotten-export) The symbol "ViewNodes" needs to be exported by the entry point index.d.ts
593
+ //
594
+ // (undocumented)
595
+ readonly bindingViewBoundaries: Record<string, ViewNodes>;
596
+ // Warning: (ae-forgotten-export) The symbol "HydrationStage" needs to be exported by the entry point index.d.ts
597
+ //
598
+ // (undocumented)
599
+ readonly hydrationStage: keyof typeof HydrationStage;
600
+ }
601
+
602
+ // @public (undocumented)
603
+ export class HydrationBindingError extends Error {
604
+ constructor(
605
+ message: string | undefined,
606
+ factory: ViewBehaviorFactory,
607
+ fragment: DocumentFragment,
608
+ templateString: string);
609
+ readonly factory: ViewBehaviorFactory;
610
+ readonly fragment: DocumentFragment;
611
+ readonly templateString: string;
612
+ }
613
+
614
+ // @public
615
+ export class InlineTemplateDirective implements HTMLDirective {
616
+ constructor(html: string, factories?: Record<string, ViewBehaviorFactory>);
617
+ createHTML(add: AddViewBehaviorFactory): string;
618
+ static readonly empty: InlineTemplateDirective;
619
+ }
620
+
534
621
  // @public
535
622
  export interface LengthObserver extends Subscriber {
536
623
  length: number;
@@ -540,7 +627,7 @@ export interface LengthObserver extends Subscriber {
540
627
  export function lengthOf<T>(array: readonly T[]): number;
541
628
 
542
629
  // @public
543
- export function listener<T = any>(binding: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
630
+ export function listener<T = any>(expression: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
544
631
 
545
632
  // @public
546
633
  export const Markup: Readonly<{
@@ -549,13 +636,6 @@ export const Markup: Readonly<{
549
636
  comment: (id: string) => string;
550
637
  }>;
551
638
 
552
- // Warning: (ae-internal-missing-underscore) The name "Mutable" should be prefixed with an underscore because the declaration is marked as @internal
553
- //
554
- // @internal
555
- export type Mutable<T> = {
556
- -readonly [P in keyof T]: T[P];
557
- };
558
-
559
639
  // @public
560
640
  export interface NodeBehaviorOptions<T = any> {
561
641
  filter?: ElementsFilter;
@@ -569,7 +649,10 @@ export abstract class NodeObservationDirective<T extends NodeBehaviorOptions> ex
569
649
  protected abstract disconnect(target: any): void;
570
650
  protected abstract getNodes(target: any): Node[];
571
651
  protected getSource(target: Node): any;
652
+ get id(): string;
653
+ set id(value: string);
572
654
  protected abstract observe(target: any): void;
655
+ targetNodeId: string;
573
656
  unbind(controller: ViewController): void;
574
657
  protected updateTarget(source: any, value: ReadonlyArray<any>): void;
575
658
  }
@@ -585,6 +668,9 @@ export interface Notifier {
585
668
  unsubscribe(subscriber: Subscriber, propertyToUnwatch?: any): void;
586
669
  }
587
670
 
671
+ // @public
672
+ export const nullableBooleanConverter: ValueConverter;
673
+
588
674
  // @public
589
675
  export const nullableNumberConverter: ValueConverter;
590
676
 
@@ -597,8 +683,8 @@ export const Observable: Readonly<{
597
683
  notify(source: unknown, args: any): void;
598
684
  defineProperty(target: {}, nameOrAccessor: string | Accessor): void;
599
685
  getAccessors: (target: {}) => Accessor[];
600
- binding<TSource = any, TReturn = any>(binding: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
601
- isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Expression<TSource_1, TReturn_1, any>): boolean;
686
+ binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
687
+ isVolatileBinding<TSource_1 = any, TReturn_1 = any>(expression: Expression<TSource_1, TReturn_1, any>): boolean;
602
688
  }>;
603
689
 
604
690
  // @public
@@ -611,7 +697,10 @@ export interface ObservationRecord {
611
697
  }
612
698
 
613
699
  // @public
614
- export function oneTime<T = any>(binding: Expression<T>): Binding<T>;
700
+ export function oneTime<T = any>(expression: Expression<T>, policy?: DOMPolicy): Binding<T>;
701
+
702
+ // @public
703
+ export function oneWay<T = any>(expression: Expression<T>, policy?: DOMPolicy, isVolatile?: boolean): Binding<T>;
615
704
 
616
705
  // @public
617
706
  export const Parser: Readonly<{
@@ -649,6 +738,33 @@ export const ref: <TSource = any, TParent = any>(propertyName: keyof TSource & s
649
738
  // @public
650
739
  export class RefDirective extends StatelessAttachedAttributeDirective<string> {
651
740
  bind(controller: ViewController): void;
741
+ targetNodeId: string;
742
+ }
743
+
744
+ // @public
745
+ export function render<TSource = any, TItem = any, TParent = any>(value?: Expression<TSource, TItem> | Binding<TSource, TItem> | {}, template?: ContentTemplate | string | Expression<TSource, ContentTemplate | string | Node, TParent> | Binding<TSource, ContentTemplate | string | Node, TParent>): CaptureType<TSource, TParent>;
746
+
747
+ // @public
748
+ export class RenderBehavior<TSource = any> implements ViewBehavior, Subscriber {
749
+ constructor(directive: RenderDirective);
750
+ bind(controller: ViewController): void;
751
+ // @internal (undocumented)
752
+ handleChange(source: any, observer: ExpressionObserver): void;
753
+ unbind(controller: ViewController): void;
754
+ }
755
+
756
+ // @public
757
+ export class RenderDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory, BindingDirective {
758
+ constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, ContentTemplate>, templateBindingDependsOnData: boolean);
759
+ createBehavior(): RenderBehavior<TSource>;
760
+ createHTML(add: AddViewBehaviorFactory): string;
761
+ // (undocumented)
762
+ readonly dataBinding: Binding<TSource>;
763
+ targetNodeId: string;
764
+ // (undocumented)
765
+ readonly templateBinding: Binding<TSource, ContentTemplate>;
766
+ // (undocumented)
767
+ readonly templateBindingDependsOnData: boolean;
652
768
  }
653
769
 
654
770
  // @public
@@ -660,19 +776,20 @@ export class RepeatBehavior<TSource = any> implements ViewBehavior, Subscriber {
660
776
  bind(controller: ViewController): void;
661
777
  handleChange(source: any, args: Splice[] | ExpressionObserver): void;
662
778
  unbind(): void;
779
+ // @internal (undocumented)
780
+ views: SyntheticView[];
663
781
  }
664
782
 
665
783
  // @public
666
- export class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
784
+ export class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory, BindingDirective {
667
785
  constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, SyntheticViewTemplate>, options: RepeatOptions);
668
786
  createBehavior(): RepeatBehavior<TSource>;
669
787
  createHTML(add: AddViewBehaviorFactory): string;
670
788
  // (undocumented)
671
789
  readonly dataBinding: Binding<TSource>;
672
- id: string;
673
- nodeId: string;
674
790
  // (undocumented)
675
791
  readonly options: RepeatOptions;
792
+ targetNodeId: string;
676
793
  // (undocumented)
677
794
  readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
678
795
  }
@@ -712,7 +829,7 @@ export const SourceLifetime: Readonly<{
712
829
  }>;
713
830
 
714
831
  // @public
715
- export type SourceLifetime = typeof SourceLifetime[keyof typeof SourceLifetime];
832
+ export type SourceLifetime = (typeof SourceLifetime)[keyof typeof SourceLifetime];
716
833
 
717
834
  // @public
718
835
  export class Splice {
@@ -754,7 +871,7 @@ export const SpliceStrategySupport: Readonly<{
754
871
  }>;
755
872
 
756
873
  // @public
757
- export type SpliceStrategySupport = typeof SpliceStrategySupport[keyof typeof SpliceStrategySupport];
874
+ export type SpliceStrategySupport = (typeof SpliceStrategySupport)[keyof typeof SpliceStrategySupport];
758
875
 
759
876
  // @public
760
877
  export abstract class StatelessAttachedAttributeDirective<TOptions> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
@@ -762,8 +879,6 @@ export abstract class StatelessAttachedAttributeDirective<TOptions> implements H
762
879
  abstract bind(controller: ViewController): void;
763
880
  createBehavior(): ViewBehavior;
764
881
  createHTML(add: AddViewBehaviorFactory): string;
765
- id: string;
766
- nodeId: string;
767
882
  // (undocumented)
768
883
  protected options: TOptions;
769
884
  }
@@ -775,7 +890,7 @@ export interface StyleStrategy {
775
890
  }
776
891
 
777
892
  // @public
778
- export interface StyleTarget {
893
+ export interface StyleTarget extends Pick<Node, "getRootNode"> {
779
894
  adoptedStyleSheets?: CSSStyleSheet[];
780
895
  append(styles: HTMLStyleElement): void;
781
896
  querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
@@ -814,41 +929,17 @@ export interface SyntheticView<TSource = any, TParent = any> extends View<TSourc
814
929
  // @public
815
930
  export interface SyntheticViewTemplate<TSource = any, TParent = any> {
816
931
  create(): SyntheticView<TSource, TParent>;
932
+ inline(): CaptureType<TSource, TParent>;
817
933
  }
818
934
 
819
935
  // @public
820
936
  export type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
821
937
 
822
- // @public
823
- export type TrustedTypes = {
824
- createPolicy(name: string, rules: TrustedTypesPolicy): TrustedTypesPolicy;
825
- };
826
-
827
938
  // @public
828
939
  export type TrustedTypesPolicy = {
829
940
  createHTML(html: string): string;
830
941
  };
831
942
 
832
- // Warning: (ae-internal-missing-underscore) The name "TypeDefinition" should be prefixed with an underscore because the declaration is marked as @internal
833
- //
834
- // @internal
835
- export interface TypeDefinition {
836
- // (undocumented)
837
- type: Function;
838
- }
839
-
840
- // Warning: (ae-internal-missing-underscore) The name "TypeRegistry" should be prefixed with an underscore because the declaration is marked as @internal
841
- //
842
- // @internal
843
- export interface TypeRegistry<TDefinition extends TypeDefinition> {
844
- // (undocumented)
845
- getByType(key: Function): TDefinition | undefined;
846
- // (undocumented)
847
- getForInstance(object: any): TDefinition | undefined;
848
- // (undocumented)
849
- register(definition: TDefinition): boolean;
850
- }
851
-
852
943
  // @public
853
944
  export interface UpdateQueue {
854
945
  enqueue(callable: Callable): void;
@@ -870,6 +961,7 @@ export interface ValueConverter {
870
961
  export interface View<TSource = any, TParent = any> extends Disposable {
871
962
  bind(source: TSource, context?: ExecutionContext<TParent>): void;
872
963
  readonly context: ExecutionContext<TParent>;
964
+ readonly isBound: boolean;
873
965
  readonly source: TSource | null;
874
966
  unbind(): void;
875
967
  }
@@ -882,23 +974,12 @@ export interface ViewBehavior<TSource = any, TParent = any> {
882
974
  // @public
883
975
  export interface ViewBehaviorFactory {
884
976
  createBehavior(): ViewBehavior;
885
- id: string;
886
- nodeId: string;
887
- }
888
-
889
- // @public
890
- export interface ViewBehaviorOrchestrator<TSource = any, TParent = any> extends ViewController<TSource, TParent>, HostBehavior<TSource> {
891
- addBehavior(behavior: ViewBehavior): void;
892
- addBehaviorFactory(factory: ViewBehaviorFactory, target: Node): void;
893
- // (undocumented)
894
- addTarget(nodeId: string, target: Node): void;
977
+ id?: string;
978
+ policy?: DOMPolicy;
979
+ targetNodeId?: string;
980
+ targetTagName?: string | null;
895
981
  }
896
982
 
897
- // @public
898
- export const ViewBehaviorOrchestrator: Readonly<{
899
- create<TSource = any, TParent = any>(source: TSource): ViewBehaviorOrchestrator<TSource, TParent>;
900
- }>;
901
-
902
983
  // @public
903
984
  export type ViewBehaviorTargets = {
904
985
  [id: string]: Node;
@@ -911,24 +992,30 @@ export interface ViewController<TSource = any, TParent = any> extends Expression
911
992
 
912
993
  // @public
913
994
  export class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
914
- constructor(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>);
995
+ constructor(html: string | HTMLTemplateElement, factories?: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy | undefined);
996
+ // @internal (undocumented)
997
+ compile(): HTMLTemplateCompilationResult<TSource, TParent>;
915
998
  create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
999
+ static create<TSource = any, TParent = any>(strings: string[], values: TemplateValue<TSource, TParent>[], policy?: DOMPolicy): ViewTemplate<TSource, TParent>;
916
1000
  readonly factories: Record<string, ViewBehaviorFactory>;
917
1001
  readonly html: string | HTMLTemplateElement;
1002
+ inline(): CaptureType<TSource, TParent>;
918
1003
  render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
1004
+ withPolicy(policy: DOMPolicy): this;
919
1005
  }
920
1006
 
921
1007
  // @public
922
1008
  export function volatile(target: {}, name: string | Accessor, descriptor: PropertyDescriptor): PropertyDescriptor;
923
1009
 
924
1010
  // @public
925
- export function when<TSource = any, TReturn = any, TParent = any>(condition: Expression<TSource, TReturn, TParent> | boolean, templateOrTemplateBinding: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>): CaptureType<TSource, TParent>;
1011
+ export function when<TSource = any, TReturn = any, TParent = any>(condition: Expression<TSource, TReturn, TParent> | boolean, templateOrTemplateBinding: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>, elseTemplateOrTemplateBinding?: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>): CaptureType<TSource, TParent>;
926
1012
 
927
1013
  // Warnings were encountered during analysis:
928
1014
  //
929
1015
  // dist/dts/components/fast-element.d.ts:60:5 - (ae-forgotten-export) The symbol "define" needs to be exported by the entry point index.d.ts
930
1016
  // dist/dts/components/fast-element.d.ts:61:5 - (ae-forgotten-export) The symbol "compose" needs to be exported by the entry point index.d.ts
931
1017
  // dist/dts/components/fast-element.d.ts:62:5 - (ae-forgotten-export) The symbol "from" needs to be exported by the entry point index.d.ts
1018
+ // dist/dts/styles/css-binding-directive.d.ts:35:9 - (ae-forgotten-export) The symbol "CSSBindingEntry" needs to be exported by the entry point index.d.ts
932
1019
 
933
1020
  // (No @packageDocumentation comment for this package)
934
1021