@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
@@ -32,20 +32,6 @@ export declare type AddBehavior = (behavior: HostBehavior<HTMLElement>) => void;
32
32
  */
33
33
  export declare type AddViewBehaviorFactory = (factory: ViewBehaviorFactory) => string;
34
34
 
35
- /**
36
- * https://wicg.github.io/construct-stylesheets/
37
- * https://developers.google.com/web/updates/2019/02/constructable-stylesheets
38
- *
39
- * @internal
40
- */
41
- export declare class AdoptedStyleSheetsStrategy implements StyleStrategy {
42
- /** @internal */
43
- readonly sheets: CSSStyleSheet[];
44
- constructor(styles: (string | CSSStyleSheet)[]);
45
- addStylesTo(target: StyleTarget): void;
46
- removeStylesFrom(target: StyleTarget): void;
47
- }
48
-
49
35
  /**
50
36
  * An observer for arrays.
51
37
  * @public
@@ -90,55 +76,6 @@ export declare const ArrayObserver: Readonly<{
90
76
  readonly enable: () => void;
91
77
  }>;
92
78
 
93
- /**
94
- * The type of HTML aspect to target.
95
- * @public
96
- */
97
- export declare const Aspect: Readonly<{
98
- /**
99
- * Not aspected.
100
- */
101
- readonly none: 0;
102
- /**
103
- * An attribute.
104
- */
105
- readonly attribute: 1;
106
- /**
107
- * A boolean attribute.
108
- */
109
- readonly booleanAttribute: 2;
110
- /**
111
- * A property.
112
- */
113
- readonly property: 3;
114
- /**
115
- * Content
116
- */
117
- readonly content: 4;
118
- /**
119
- * A token list.
120
- */
121
- readonly tokenList: 5;
122
- /**
123
- * An event.
124
- */
125
- readonly event: 6;
126
- /**
127
- *
128
- * @param directive - The directive to assign the aspect to.
129
- * @param value - The value to base the aspect determination on.
130
- * @remarks
131
- * If a falsy value is provided, then the content aspect will be assigned.
132
- */
133
- readonly assign: (directive: Aspected, value?: string) => void;
134
- }>;
135
-
136
- /**
137
- * The type of HTML aspect to target.
138
- * @public
139
- */
140
- export declare type Aspect = typeof Aspect[Exclude<keyof typeof Aspect, "assign" | "none">];
141
-
142
79
  /**
143
80
  * Represents something that applies to a specific aspect of the DOM.
144
81
  * @public
@@ -155,7 +92,7 @@ export declare interface Aspected {
155
92
  /**
156
93
  * The type of aspect to target.
157
94
  */
158
- aspectType: Aspect;
95
+ aspectType: DOMAspect;
159
96
  /**
160
97
  * A binding if one is associated with the aspect.
161
98
  */
@@ -244,7 +181,7 @@ export declare class AttributeDefinition implements Accessor {
244
181
  /**
245
182
  * Sets the value of the attribute/property on the source element.
246
183
  * @param source - The source element to access.
247
- * @param value - The value to set the attribute/property to.
184
+ * @param newValue - The value to set the attribute/property to.
248
185
  */
249
186
  setValue(source: HTMLElement, newValue: any): void;
250
187
  /**
@@ -277,15 +214,6 @@ export declare class AttributeDefinition implements Accessor {
277
214
  */
278
215
  export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "fromView";
279
216
 
280
- /**
281
- * Creates an standard binding.
282
- * @param binding - The binding to refresh when changed.
283
- * @param isVolatile - Indicates whether the binding is volatile or not.
284
- * @returns A binding configuration.
285
- * @public
286
- */
287
- export declare function bind<T = any>(binding: Expression<T>, isVolatile?: boolean): Binding<T>;
288
-
289
217
  /**
290
218
  * Captures a binding expression along with related information and capabilities.
291
219
  *
@@ -293,6 +221,7 @@ export declare function bind<T = any>(binding: Expression<T>, isVolatile?: boole
293
221
  */
294
222
  export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
295
223
  evaluate: Expression<TSource, TReturn, TParent>;
224
+ policy?: DOMPolicy | undefined;
296
225
  isVolatile: boolean;
297
226
  /**
298
227
  * Options associated with the binding.
@@ -301,15 +230,36 @@ export declare abstract class Binding<TSource = any, TReturn = any, TParent = an
301
230
  /**
302
231
  * Creates a binding.
303
232
  * @param evaluate - Evaluates the binding.
233
+ * @param policy - The security policy to associate with this binding.
304
234
  * @param isVolatile - Indicates whether the binding is volatile.
305
235
  */
306
- constructor(evaluate: Expression<TSource, TReturn, TParent>, isVolatile?: boolean);
236
+ constructor(evaluate: Expression<TSource, TReturn, TParent>, policy?: DOMPolicy | undefined, isVolatile?: boolean);
307
237
  /**
308
238
  * Creates an observer capable of notifying a subscriber when the output of a binding changes.
309
- * @param directive - The HTML Directive to create the observer for.
310
239
  * @param subscriber - The subscriber to changes in the binding.
240
+ * @param directive - The Binding directive to create the observer for.
241
+ */
242
+ abstract createObserver(subscriber: Subscriber, directive: BindingDirective): ExpressionObserver<TSource, TReturn, TParent>;
243
+ }
244
+
245
+ /**
246
+ * The directive from which a binding originates.
247
+ *
248
+ * @public
249
+ */
250
+ export declare interface BindingDirective {
251
+ /**
252
+ * The binding.
253
+ */
254
+ readonly dataBinding: Binding;
255
+ /**
256
+ * The evaluated target aspect.
311
257
  */
312
- abstract createObserver(directive: HTMLDirective, subscriber: Subscriber): ExpressionObserver<TSource, TReturn, TParent>;
258
+ readonly targetAspect?: string;
259
+ /**
260
+ * The type of aspect to target.
261
+ */
262
+ readonly aspectType?: DOMAspect;
313
263
  }
314
264
 
315
265
  /**
@@ -388,6 +338,17 @@ export declare class ChildrenDirective extends NodeObservationDirective<Children
388
338
  */
389
339
  export declare type ChildrenDirectiveOptions<T = any> = ChildListDirectiveOptions<T> | SubtreeDirectiveOptions<T>;
390
340
 
341
+ /**
342
+ * Represents a constructable class with a prototype.
343
+ * @public
344
+ */
345
+ export declare type Class<T, C = {}> = C & Constructable<T> & {
346
+ /**
347
+ * The class's prototype;
348
+ */
349
+ readonly prototype: T;
350
+ };
351
+
391
352
  /**
392
353
  * A function capable of compiling a template from the preprocessed form produced
393
354
  * by the html template function into a result that can instantiate views.
@@ -401,33 +362,36 @@ html: string | HTMLTemplateElement,
401
362
  /**
402
363
  * The behavior factories used within the html that is being compiled.
403
364
  */
404
- factories: Record<string, ViewBehaviorFactory>) => HTMLTemplateCompilationResult;
365
+ factories: Record<string, ViewBehaviorFactory>,
366
+ /**
367
+ * The security policy to compile the html with.
368
+ */
369
+ policy: DOMPolicy) => HTMLTemplateCompilationResult;
370
+
371
+ /**
372
+ * Represents a ViewBehaviorFactory after the compilation process has completed.
373
+ * @public
374
+ */
375
+ export declare type CompiledViewBehaviorFactory = Required<ViewBehaviorFactory>;
405
376
 
406
377
  /**
407
378
  * Common APIs related to compilation.
408
379
  * @public
409
380
  */
410
381
  export declare const Compiler: {
411
- /**
412
- * Sets the HTML trusted types policy used by the compiler.
413
- * @param policy - The policy to set for HTML.
414
- * @remarks
415
- * This API can only be called once, for security reasons. It should be
416
- * called by the application developer at the start of their program.
417
- */
418
- setHTMLPolicy(policy: TrustedTypesPolicy): void;
419
382
  /**
420
383
  * Compiles a template and associated directives into a compilation
421
384
  * result which can be used to create views.
422
385
  * @param html - The html string or template element to compile.
423
- * @param directives - The directives referenced by the template.
386
+ * @param factories - The behavior factories referenced by the template.
387
+ * @param policy - The security policy to compile the html with.
424
388
  * @remarks
425
389
  * The template that is provided for compilation is altered in-place
426
390
  * and cannot be compiled again. If the original template must be preserved,
427
391
  * it is recommended that you clone the original and pass the clone to this API.
428
392
  * @public
429
393
  */
430
- compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, directives: Record<string, ViewBehaviorFactory>): HTMLTemplateCompilationResult<TSource, TParent>;
394
+ compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy): HTMLTemplateCompilationResult<TSource, TParent>;
431
395
  /**
432
396
  * Sets the default compilation strategy that will be used by the ViewTemplate whenever
433
397
  * it needs to compile a view preprocessed with the html template function.
@@ -438,9 +402,10 @@ export declare const Compiler: {
438
402
  * Aggregates an array of strings and directives into a single directive.
439
403
  * @param parts - A heterogeneous array of static strings interspersed with
440
404
  * directives.
405
+ * @param policy - The security policy to use with the aggregated bindings.
441
406
  * @returns A single inline directive that aggregates the behavior of all the parts.
442
407
  */
443
- aggregate(parts: (string | ViewBehaviorFactory)[]): ViewBehaviorFactory;
408
+ aggregate(parts: (string | ViewBehaviorFactory)[], policy?: DOMPolicy): ViewBehaviorFactory;
444
409
  };
445
410
 
446
411
  /**
@@ -454,7 +419,7 @@ declare function compose<TType extends Constructable<HTMLElement> = Constructabl
454
419
  declare function compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
455
420
 
456
421
  /**
457
- * Allows for the creation of Constructable mixin classes.
422
+ * Represents a type which can be constructed with the new operator.
458
423
  *
459
424
  * @public
460
425
  */
@@ -513,19 +478,6 @@ export declare interface ContentView {
513
478
  remove(): void;
514
479
  }
515
480
 
516
- /**
517
- * Creates a function capable of locating metadata associated with a type.
518
- * @returns A metadata locator function.
519
- * @internal
520
- */
521
- export declare function createMetadataLocator<TMetadata>(): (target: {}) => TMetadata[];
522
-
523
- /**
524
- * Do not change. Part of shared kernel contract.
525
- * @internal
526
- */
527
- export declare function createTypeRegistry<TDefinition extends TypeDefinition>(): TypeRegistry<TDefinition>;
528
-
529
481
  /**
530
482
  * Transforms a template literal string into styles.
531
483
  * @param strings - The string fragments that are interpolated with the values.
@@ -536,6 +488,61 @@ export declare function createTypeRegistry<TDefinition extends TypeDefinition>()
536
488
  */
537
489
  export declare const css: CSSTemplateTag;
538
490
 
491
+ /**
492
+ * Enables bindings in CSS.
493
+ *
494
+ * @public
495
+ */
496
+ export declare class CSSBindingDirective implements HostBehavior, Subscriber, CSSDirective, BindingDirective {
497
+ readonly dataBinding: Binding;
498
+ readonly targetAspect: string;
499
+ /**
500
+ * Creates an instance of CSSBindingDirective.
501
+ * @param dataBinding - The binding to use in CSS.
502
+ * @param targetAspect - The CSS property to target.
503
+ */
504
+ constructor(dataBinding: Binding, targetAspect: string);
505
+ /**
506
+ * Creates a CSS fragment to interpolate into the CSS document.
507
+ * @returns - the string to interpolate into CSS
508
+ */
509
+ createCSS(add: AddBehavior): ComposableStyles;
510
+ /**
511
+ * Executed when this behavior is attached to a controller.
512
+ * @param controller - Controls the behavior lifecycle.
513
+ */
514
+ addedCallback(controller: HostController<HTMLElement & {
515
+ $cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
516
+ }>): void;
517
+ /**
518
+ * Executed when this behavior's host is connected.
519
+ * @param controller - Controls the behavior lifecycle.
520
+ */
521
+ connectedCallback(controller: HostController<HTMLElement & {
522
+ $cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
523
+ }>): void;
524
+ /**
525
+ * Executed when this behavior is detached from a controller.
526
+ * @param controller - Controls the behavior lifecycle.
527
+ */
528
+ removedCallback(controller: HostController<HTMLElement & {
529
+ $cssBindings: Map<CSSBindingDirective, CSSBindingEntry>;
530
+ }>): void;
531
+ /**
532
+ * Called when a subject this instance has subscribed to changes.
533
+ * @param subject - The subject of the change.
534
+ * @param args - The event args detailing the change that occurred.
535
+ *
536
+ * @internal
537
+ */
538
+ handleChange(_: any, observer: ExpressionObserver): void;
539
+ }
540
+
541
+ declare type CSSBindingEntry = {
542
+ observer: ExpressionObserver;
543
+ controller: HostController;
544
+ };
545
+
539
546
  /**
540
547
  * Directive for use in {@link css}.
541
548
  *
@@ -589,12 +596,6 @@ export declare interface CSSDirectiveDefinition<TType extends Constructable<CSSD
589
596
  readonly type: TType;
590
597
  }
591
598
 
592
- /**
593
- * @deprecated Use css.partial instead.
594
- * @public
595
- */
596
- export declare const cssPartial: (strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]) => CSSDirective;
597
-
598
599
  /**
599
600
  * Transforms a template literal string into styles.
600
601
  * @param strings - The string fragments that are interpolated with the values.
@@ -604,16 +605,22 @@ export declare const cssPartial: (strings: TemplateStringsArray, ...values: (Com
604
605
  * Use the .partial method to create partial CSS fragments.
605
606
  * @public
606
607
  */
607
- export declare type CSSTemplateTag = ((strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]) => ElementStyles) & {
608
+ export declare type CSSTemplateTag = (<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: CSSValue<TSource, TParent>[]) => ElementStyles) & {
608
609
  /**
609
610
  * Transforms a template literal string into partial CSS.
610
611
  * @param strings - The string fragments that are interpolated with the values.
611
612
  * @param values - The values that are interpolated with the string fragments.
612
613
  * @public
613
614
  */
614
- partial(strings: TemplateStringsArray, ...values: (ComposableStyles | CSSDirective)[]): CSSDirective;
615
+ partial<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: CSSValue<TSource, TParent>[]): CSSDirective;
615
616
  };
616
617
 
618
+ /**
619
+ * Represents the types of values that can be interpolated into a template.
620
+ * @public
621
+ */
622
+ export declare type CSSValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | ComposableStyles | CSSDirective;
623
+
617
624
  /**
618
625
  * Decorator: Defines a platform custom element based on `FASTElement`.
619
626
  * @param nameOrDef - The name of the element to define or a definition object
@@ -628,6 +635,62 @@ export declare function customElement(nameOrDef: string | PartialFASTElementDefi
628
635
  */
629
636
  export declare type DecoratorAttributeConfiguration = Omit<AttributeConfiguration, "property">;
630
637
 
638
+ declare class DefaultExecutionContext<TParent> implements ExecutionContext<TParent> {
639
+ /**
640
+ * The index of the current item within a repeat context.
641
+ */
642
+ index: number;
643
+ /**
644
+ * The length of the current collection within a repeat context.
645
+ */
646
+ length: number;
647
+ /**
648
+ * The parent data source within a nested context.
649
+ */
650
+ readonly parent: TParent;
651
+ /**
652
+ * The parent execution context when in nested context scenarios.
653
+ */
654
+ readonly parentContext: ExecutionContext<TParent>;
655
+ /**
656
+ * The current event within an event handler.
657
+ */
658
+ get event(): Event;
659
+ /**
660
+ * Indicates whether the current item within a repeat context
661
+ * has an even index.
662
+ */
663
+ get isEven(): boolean;
664
+ /**
665
+ * Indicates whether the current item within a repeat context
666
+ * has an odd index.
667
+ */
668
+ get isOdd(): boolean;
669
+ /**
670
+ * Indicates whether the current item within a repeat context
671
+ * is the first item in the collection.
672
+ */
673
+ get isFirst(): boolean;
674
+ /**
675
+ * Indicates whether the current item within a repeat context
676
+ * is somewhere in the middle of the collection.
677
+ */
678
+ get isInMiddle(): boolean;
679
+ /**
680
+ * Indicates whether the current item within a repeat context
681
+ * is the last item in the collection.
682
+ */
683
+ get isLast(): boolean;
684
+ /**
685
+ * Returns the typed event detail of a custom event.
686
+ */
687
+ eventDetail<TDetail>(): TDetail;
688
+ /**
689
+ * Returns the typed event target of the event.
690
+ */
691
+ eventTarget<TTarget extends EventTarget>(): TTarget;
692
+ }
693
+
631
694
  declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(this: TType, nameOrDef: string | PartialFASTElementDefinition): TType;
632
695
 
633
696
  declare function define<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): TType;
@@ -649,20 +712,17 @@ export declare interface Disposable {
649
712
  */
650
713
  export declare const DOM: Readonly<{
651
714
  /**
652
- * @deprecated
653
- * Use Updates.enqueue().
715
+ * Gets the dom policy used by the templating system.
654
716
  */
655
- queueUpdate: (callable: Callable) => void;
717
+ readonly policy: DOMPolicy;
656
718
  /**
657
- * @deprecated
658
- * Use Updates.next()
659
- */
660
- nextUpdate: () => Promise<void>;
661
- /**
662
- * @deprecated
663
- * Use Updates.process()
719
+ * Sets the dom policy used by the templating system.
720
+ * @param policy - The policy to set.
721
+ * @remarks
722
+ * This API can only be called once, for security reasons. It should be
723
+ * called by the application developer at the start of their program.
664
724
  */
665
- processUpdates: () => void;
725
+ setPolicy(value: DOMPolicy): void;
666
726
  /**
667
727
  * Sets an attribute value on an element.
668
728
  * @param element - The element to set the attribute value on.
@@ -684,17 +744,95 @@ export declare const DOM: Readonly<{
684
744
  setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
685
745
  }>;
686
746
 
747
+ /**
748
+ * The type of HTML aspect to target.
749
+ * @public
750
+ */
751
+ export declare const DOMAspect: Readonly<{
752
+ /**
753
+ * Not aspected.
754
+ */
755
+ readonly none: 0;
756
+ /**
757
+ * An attribute.
758
+ */
759
+ readonly attribute: 1;
760
+ /**
761
+ * A boolean attribute.
762
+ */
763
+ readonly booleanAttribute: 2;
764
+ /**
765
+ * A property.
766
+ */
767
+ readonly property: 3;
768
+ /**
769
+ * Content
770
+ */
771
+ readonly content: 4;
772
+ /**
773
+ * A token list.
774
+ */
775
+ readonly tokenList: 5;
776
+ /**
777
+ * An event.
778
+ */
779
+ readonly event: 6;
780
+ }>;
781
+
782
+ /**
783
+ * The type of HTML aspect to target.
784
+ * @public
785
+ */
786
+ export declare type DOMAspect = (typeof DOMAspect)[Exclude<keyof typeof DOMAspect, "none">];
787
+
788
+ /**
789
+ * A security policy that FAST can use to interact with the DOM.
790
+ * @public
791
+ */
792
+ export declare interface DOMPolicy {
793
+ /**
794
+ * Creates safe HTML from the provided value.
795
+ * @param value - The source to convert to safe HTML.
796
+ */
797
+ createHTML(value: string): string;
798
+ /**
799
+ * Protects a DOM sink that intends to write to the DOM.
800
+ * @param tagName - The tag name for the element to write to.
801
+ * @param aspect - The aspect of the DOM to write to.
802
+ * @param aspectName - The name of the aspect to write to.
803
+ * @param sink - The sink that is used to write to the DOM.
804
+ */
805
+ protect(tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink): DOMSink;
806
+ }
807
+
808
+ /**
809
+ * A function used to send values to a DOM sink.
810
+ * @public
811
+ */
812
+ export declare type DOMSink = (target: Node, aspectName: string, value: any, ...args: any[]) => void;
813
+
687
814
  /**
688
815
  * Controls the lifecycle and rendering of a `FASTElement`.
689
816
  * @public
690
817
  */
691
818
  export declare class ElementController<TElement extends HTMLElement = HTMLElement> extends PropertyChangeNotifier implements HostController<TElement> {
692
819
  private boundObservables;
693
- private needsInitialization;
820
+ protected needsInitialization: boolean;
694
821
  private hasExistingShadowRoot;
695
822
  private _template;
696
- private _isConnected;
697
- private behaviors;
823
+ protected stage: Stages;
824
+ /**
825
+ * A guard against connecting behaviors multiple times
826
+ * during connect in scenarios where a behavior adds
827
+ * another behavior during it's connectedCallback
828
+ */
829
+ private guardBehaviorConnection;
830
+ protected behaviors: Map<HostBehavior<TElement>, number> | null;
831
+ /**
832
+ * Tracks whether behaviors are connected so that
833
+ * behaviors cant be connected multiple times
834
+ */
835
+ private behaviorsConnected;
698
836
  private _mainStyles;
699
837
  /**
700
838
  * This allows Observable.getNotifier(...) to return the Controller
@@ -725,7 +863,18 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
725
863
  * connected to the document.
726
864
  */
727
865
  get isConnected(): boolean;
728
- private setIsConnected;
866
+ /**
867
+ * The context the expression is evaluated against.
868
+ */
869
+ get context(): ExecutionContext;
870
+ /**
871
+ * Indicates whether the controller is bound.
872
+ */
873
+ get isBound(): boolean;
874
+ /**
875
+ * Indicates how the source's lifetime relates to the controller's lifetime.
876
+ */
877
+ get sourceLifetime(): SourceLifetime | undefined;
729
878
  /**
730
879
  * Gets/sets the template used to render the component.
731
880
  * @remarks
@@ -747,6 +896,13 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
747
896
  * @internal
748
897
  */
749
898
  constructor(element: TElement, definition: FASTElementDefinition);
899
+ /**
900
+ * Registers an unbind handler with the controller.
901
+ * @param behavior - An object to call when the controller unbinds.
902
+ */
903
+ onUnbind(behavior: {
904
+ unbind(controller: ExpressionController<TElement>): any;
905
+ }): void;
750
906
  /**
751
907
  * Adds the behavior to the component.
752
908
  * @param behavior - The behavior to add.
@@ -772,6 +928,9 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
772
928
  * Runs connected lifecycle behavior on the associated element.
773
929
  */
774
930
  connect(): void;
931
+ protected bindObservables(): void;
932
+ protected connectBehaviors(): void;
933
+ protected disconnectBehaviors(): void;
775
934
  /**
776
935
  * Runs disconnected lifecycle behavior on the associated element.
777
936
  */
@@ -792,8 +951,7 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
792
951
  * Only emits events if connected.
793
952
  */
794
953
  emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
795
- private finishInitialization;
796
- private renderTemplate;
954
+ protected renderTemplate(template: ElementViewTemplate | null | undefined): void;
797
955
  /**
798
956
  * Locates or creates a controller for the specified element.
799
957
  * @param element - The element to return the controller for.
@@ -803,6 +961,20 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
803
961
  * decorator or a call to `FASTElement.define`.
804
962
  */
805
963
  static forCustomElement(element: HTMLElement): ElementController;
964
+ /**
965
+ * Sets the strategy that ElementController.forCustomElement uses to construct
966
+ * ElementController instances for an element.
967
+ * @param strategy - The strategy to use.
968
+ */
969
+ static setStrategy(strategy: ElementControllerStrategy): void;
970
+ }
971
+
972
+ /**
973
+ * A type that instantiates an ElementController
974
+ * @public
975
+ */
976
+ export declare interface ElementControllerStrategy {
977
+ new (element: HTMLElement, definition: FASTElementDefinition): ElementController;
806
978
  }
807
979
 
808
980
  /**
@@ -878,6 +1050,17 @@ export declare class ElementStyles {
878
1050
  * @public
879
1051
  */
880
1052
  export declare interface ElementView<TSource = any, TParent = any> extends View<TSource, TParent> {
1053
+ /**
1054
+ * Indicates how the source's lifetime relates to the controller's lifetime.
1055
+ */
1056
+ readonly sourceLifetime?: SourceLifetime;
1057
+ /**
1058
+ * Registers an unbind handler with the controller.
1059
+ * @param behavior - An object to call when the controller unbinds.
1060
+ */
1061
+ onUnbind(behavior: {
1062
+ unbind(controller: ViewController<TSource, TParent>): any;
1063
+ }): void;
881
1064
  /**
882
1065
  * Appends the view's DOM nodes to the referenced node.
883
1066
  * @param node - The parent node to append the view's DOM nodes to.
@@ -1074,7 +1257,7 @@ export declare interface ExpressionObserver<TSource = any, TReturn = any, TParen
1074
1257
 
1075
1258
  /**
1076
1259
  * The FAST global.
1077
- * @internal
1260
+ * @public
1078
1261
  */
1079
1262
  export declare const FAST: FASTGlobal;
1080
1263
 
@@ -1200,6 +1383,12 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
1200
1383
  * that describes the element to define.
1201
1384
  */
1202
1385
  static compose<TType extends Constructable<HTMLElement> = Constructable<HTMLElement>>(type: TType, nameOrDef?: string | PartialFASTElementDefinition): FASTElementDefinition<TType>;
1386
+ /**
1387
+ * Registers a FASTElement base type.
1388
+ * @param type - The type to register as a base type.
1389
+ * @internal
1390
+ */
1391
+ static registerBaseType(type: Function): void;
1203
1392
  /**
1204
1393
  * Gets the element definition associated with the specified type.
1205
1394
  * @param type - The custom element type to retrieve the definition for.
@@ -1214,7 +1403,7 @@ export declare class FASTElementDefinition<TType extends Constructable<HTMLEleme
1214
1403
 
1215
1404
  /**
1216
1405
  * The FAST global.
1217
- * @internal
1406
+ * @public
1218
1407
  */
1219
1408
  export declare interface FASTGlobal {
1220
1409
  /**
@@ -1284,11 +1473,7 @@ export declare interface HostBehavior<TSource = any> {
1284
1473
  * associated with a component host.
1285
1474
  * @public
1286
1475
  */
1287
- export declare interface HostController<TSource = any> {
1288
- /**
1289
- * The component source.
1290
- */
1291
- readonly source: TSource;
1476
+ export declare interface HostController<TSource = any> extends ExpressionController<TSource> {
1292
1477
  /**
1293
1478
  * Indicates whether the host is connected or not.
1294
1479
  */
@@ -1330,13 +1515,13 @@ export declare interface HostController<TSource = any> {
1330
1515
  * other template instances, and Directive instances.
1331
1516
  * @public
1332
1517
  */
1333
- export declare function html<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]): ViewTemplate<TSource, TParent>;
1518
+ export declare const html: HTMLTemplateTag;
1334
1519
 
1335
1520
  /**
1336
1521
  * A directive that applies bindings.
1337
1522
  * @public
1338
1523
  */
1339
- export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected {
1524
+ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehaviorFactory, ViewBehavior, Aspected, BindingDirective {
1340
1525
  dataBinding: Binding;
1341
1526
  private data;
1342
1527
  private updateTarget;
@@ -1347,7 +1532,15 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
1347
1532
  /**
1348
1533
  * The structural id of the DOM node to which the created behavior will apply.
1349
1534
  */
1350
- nodeId: string;
1535
+ targetNodeId: string;
1536
+ /**
1537
+ * The tagname associated with the target node.
1538
+ */
1539
+ targetTagName: string | null;
1540
+ /**
1541
+ * The policy that the created behavior must run under.
1542
+ */
1543
+ policy: DOMPolicy;
1351
1544
  /**
1352
1545
  * The original source aspect exactly as represented in markup.
1353
1546
  */
@@ -1359,7 +1552,7 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
1359
1552
  /**
1360
1553
  * The type of aspect to target.
1361
1554
  */
1362
- aspectType: Aspect;
1555
+ aspectType: DOMAspect;
1363
1556
  /**
1364
1557
  * Creates an instance of HTMLBindingDirective.
1365
1558
  * @param dataBinding - The binding configuration to apply.
@@ -1375,13 +1568,7 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
1375
1568
  */
1376
1569
  createBehavior(): ViewBehavior;
1377
1570
  /** @internal */
1378
- bindDefault(controller: ViewController): void;
1379
- /** @internal */
1380
- bind: (controller: ViewController) => void;
1381
- /** @internal */
1382
- bindContent(controller: ViewController): void;
1383
- /** @internal */
1384
- bindEvent(controller: ViewController): void;
1571
+ bind(controller: ViewController): void;
1385
1572
  /** @internal */
1386
1573
  unbind(controller: ViewController): void;
1387
1574
  /** @internal */
@@ -1423,6 +1610,14 @@ export declare const HTMLDirective: Readonly<{
1423
1610
  * @param options - Options that specify the directive's application.
1424
1611
  */
1425
1612
  define<TType extends Constructable<HTMLDirective>>(type: TType, options?: PartialHTMLDirectiveDefinition): TType;
1613
+ /**
1614
+ *
1615
+ * @param directive - The directive to assign the aspect to.
1616
+ * @param value - The value to base the aspect determination on.
1617
+ * @remarks
1618
+ * If a falsy value is provided, then the content aspect will be assigned.
1619
+ */
1620
+ assignAspect(directive: Aspected, value?: string): void;
1426
1621
  }>;
1427
1622
 
1428
1623
  /**
@@ -1447,19 +1642,38 @@ export declare interface HTMLDirectiveDefinition<TType extends Constructable<HTM
1447
1642
  * The result of a template compilation operation.
1448
1643
  * @public
1449
1644
  */
1450
- export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
1645
+ export declare interface HTMLTemplateCompilationResult<TSource = any, TParent = any> {
1646
+ /**
1647
+ * Creates a view instance.
1648
+ * @param hostBindingTarget - The host binding target for the view.
1649
+ */
1650
+ createView(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
1651
+ readonly factories: CompiledViewBehaviorFactory[];
1652
+ }
1653
+
1654
+ /**
1655
+ * Transforms a template literal string into a ViewTemplate.
1656
+ * @param strings - The string fragments that are interpolated with the values.
1657
+ * @param values - The values that are interpolated with the string fragments.
1658
+ * @remarks
1659
+ * The html helper supports interpolation of strings, numbers, binding expressions,
1660
+ * other template instances, and Directive instances.
1661
+ * @public
1662
+ */
1663
+ export declare type HTMLTemplateTag = (<TSource = any, TParent = any>(strings: TemplateStringsArray, ...values: TemplateValue<TSource, TParent>[]) => ViewTemplate<TSource, TParent>) & {
1451
1664
  /**
1452
- * Creates a view instance.
1453
- * @param hostBindingTarget - The host binding target for the view.
1665
+ * Transforms a template literal string into partial HTML.
1666
+ * @param html - The HTML string fragment to interpolate.
1667
+ * @public
1454
1668
  */
1455
- createView(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
1456
- }
1669
+ partial(html: string): InlineTemplateDirective;
1670
+ };
1457
1671
 
1458
1672
  /**
1459
1673
  * The standard View implementation, which also implements ElementView and SyntheticView.
1460
1674
  * @public
1461
1675
  */
1462
- export declare class HTMLView<TSource = any, TParent = any> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
1676
+ export declare class HTMLView<TSource = any, TParent = any> extends DefaultExecutionContext<TParent> implements ElementView<TSource, TParent>, SyntheticView<TSource, TParent>, ExecutionContext<TParent> {
1463
1677
  private fragment;
1464
1678
  private factories;
1465
1679
  readonly targets: ViewBehaviorTargets;
@@ -1481,59 +1695,6 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
1481
1695
  * The execution context the view is running within.
1482
1696
  */
1483
1697
  context: ExecutionContext<TParent>;
1484
- /**
1485
- * The index of the current item within a repeat context.
1486
- */
1487
- index: number;
1488
- /**
1489
- * The length of the current collection within a repeat context.
1490
- */
1491
- length: number;
1492
- /**
1493
- * The parent data source within a nested context.
1494
- */
1495
- readonly parent: TParent;
1496
- /**
1497
- * The parent execution context when in nested context scenarios.
1498
- */
1499
- readonly parentContext: ExecutionContext<TParent>;
1500
- /**
1501
- * The current event within an event handler.
1502
- */
1503
- get event(): Event;
1504
- /**
1505
- * Indicates whether the current item within a repeat context
1506
- * has an even index.
1507
- */
1508
- get isEven(): boolean;
1509
- /**
1510
- * Indicates whether the current item within a repeat context
1511
- * has an odd index.
1512
- */
1513
- get isOdd(): boolean;
1514
- /**
1515
- * Indicates whether the current item within a repeat context
1516
- * is the first item in the collection.
1517
- */
1518
- get isFirst(): boolean;
1519
- /**
1520
- * Indicates whether the current item within a repeat context
1521
- * is somewhere in the middle of the collection.
1522
- */
1523
- get isInMiddle(): boolean;
1524
- /**
1525
- * Indicates whether the current item within a repeat context
1526
- * is the last item in the collection.
1527
- */
1528
- get isLast(): boolean;
1529
- /**
1530
- * Returns the typed event detail of a custom event.
1531
- */
1532
- eventDetail<TDetail>(): TDetail;
1533
- /**
1534
- * Returns the typed event target of the event.
1535
- */
1536
- eventTarget<TTarget extends EventTarget>(): TTarget;
1537
1698
  /**
1538
1699
  * The first DOM node in the range of nodes that make up the view.
1539
1700
  */
@@ -1547,7 +1708,7 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
1547
1708
  * @param fragment - The html fragment that contains the nodes for this view.
1548
1709
  * @param behaviors - The behaviors to be applied to this view.
1549
1710
  */
1550
- constructor(fragment: DocumentFragment, factories: ReadonlyArray<ViewBehaviorFactory>, targets: ViewBehaviorTargets);
1711
+ constructor(fragment: DocumentFragment, factories: ReadonlyArray<CompiledViewBehaviorFactory>, targets: ViewBehaviorTargets);
1551
1712
  /**
1552
1713
  * Appends the view's DOM nodes to the referenced node.
1553
1714
  * @param node - The parent node to append the view's DOM nodes to.
@@ -1569,7 +1730,7 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
1569
1730
  */
1570
1731
  dispose(): void;
1571
1732
  onUnbind(behavior: {
1572
- unbind(controller: ViewController<TSource, TParent>): any;
1733
+ unbind(controller: ViewController<TSource, TParent>): void;
1573
1734
  }): void;
1574
1735
  /**
1575
1736
  * Binds a view's behaviors to its binding source.
@@ -1589,6 +1750,104 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
1589
1750
  static disposeContiguousBatch(views: SyntheticView[]): void;
1590
1751
  }
1591
1752
 
1753
+ /**
1754
+ * @internal
1755
+ */
1756
+ declare const Hydratable: unique symbol;
1757
+
1758
+ /**
1759
+ * An ElementController capable of hydrating FAST elements from
1760
+ * Declarative Shadow DOM.
1761
+ *
1762
+ * @beta
1763
+ */
1764
+ export declare class HydratableElementController<TElement extends HTMLElement = HTMLElement> extends ElementController<TElement> {
1765
+ /**
1766
+ * Controls whether the controller will hydrate during the connect() method.
1767
+ * Initialized during the first connect() call to true when the `needs-hydration`
1768
+ * attribute is present on the element.
1769
+ */
1770
+ protected needsHydration?: boolean;
1771
+ private static hydrationObserver;
1772
+ private static hydrationObserverHandler;
1773
+ connect(): void;
1774
+ disconnect(): void;
1775
+ static install(): void;
1776
+ }
1777
+
1778
+ /** @public */
1779
+ export declare interface HydratableView<TSource = any, TParent = any> extends ElementView, SyntheticView, DefaultExecutionContext<TParent> {
1780
+ [Hydratable]: symbol;
1781
+ readonly bindingViewBoundaries: Record<string, ViewNodes>;
1782
+ readonly hydrationStage: keyof typeof HydrationStage;
1783
+ }
1784
+
1785
+ /** @public */
1786
+ export declare class HydrationBindingError extends Error {
1787
+ /**
1788
+ * The factory that was unable to be bound
1789
+ */
1790
+ readonly factory: ViewBehaviorFactory;
1791
+ /**
1792
+ * A DocumentFragment containing a clone of the
1793
+ * view's Nodes.
1794
+ */
1795
+ readonly fragment: DocumentFragment;
1796
+ /**
1797
+ * String representation of the HTML in the template that
1798
+ * threw the binding error.
1799
+ */
1800
+ readonly templateString: string;
1801
+ constructor(
1802
+ /**
1803
+ * The error message
1804
+ */
1805
+ message: string | undefined,
1806
+ /**
1807
+ * The factory that was unable to be bound
1808
+ */
1809
+ factory: ViewBehaviorFactory,
1810
+ /**
1811
+ * A DocumentFragment containing a clone of the
1812
+ * view's Nodes.
1813
+ */
1814
+ fragment: DocumentFragment,
1815
+ /**
1816
+ * String representation of the HTML in the template that
1817
+ * threw the binding error.
1818
+ */
1819
+ templateString: string);
1820
+ }
1821
+
1822
+ declare const HydrationStage: {
1823
+ readonly unhydrated: "unhydrated";
1824
+ readonly hydrating: "hydrating";
1825
+ readonly hydrated: "hydrated";
1826
+ };
1827
+
1828
+ /**
1829
+ * Inlines a template into another template.
1830
+ * @public
1831
+ */
1832
+ export declare class InlineTemplateDirective implements HTMLDirective {
1833
+ private html;
1834
+ private factories;
1835
+ /**
1836
+ * An empty template partial.
1837
+ */
1838
+ static readonly empty: InlineTemplateDirective;
1839
+ /**
1840
+ * Creates an instance of InlineTemplateDirective.
1841
+ * @param template - The template to inline.
1842
+ */
1843
+ constructor(html: string, factories?: Record<string, ViewBehaviorFactory>);
1844
+ /**
1845
+ * Creates HTML to be used within a template.
1846
+ * @param add - Can be used to add behavior factories to a template.
1847
+ */
1848
+ createHTML(add: AddViewBehaviorFactory): string;
1849
+ }
1850
+
1592
1851
  /**
1593
1852
  * Observes array lengths.
1594
1853
  * @public
@@ -1610,12 +1869,12 @@ export declare function lengthOf<T>(array: readonly T[]): number;
1610
1869
 
1611
1870
  /**
1612
1871
  * Creates an event listener binding.
1613
- * @param binding - The binding to invoke when the event is raised.
1872
+ * @param expression - The binding to invoke when the event is raised.
1614
1873
  * @param options - Event listener options.
1615
1874
  * @returns A binding configuration.
1616
1875
  * @public
1617
1876
  */
1618
- export declare function listener<T = any>(binding: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
1877
+ export declare function listener<T = any>(expression: Expression<T>, options?: AddEventListenerOptions): Binding<T>;
1619
1878
 
1620
1879
  /**
1621
1880
  * Common APIs related to markup generation.
@@ -1648,14 +1907,6 @@ export declare const Markup: Readonly<{
1648
1907
  comment: (id: string) => string;
1649
1908
  }>;
1650
1909
 
1651
- /**
1652
- * Reverses all readonly members, making them mutable.
1653
- * @internal
1654
- */
1655
- export declare type Mutable<T> = {
1656
- -readonly [P in keyof T]: T[P];
1657
- };
1658
-
1659
1910
  /**
1660
1911
  * Options for configuring node observation behavior.
1661
1912
  * @public
@@ -1682,7 +1933,17 @@ export declare interface NodeBehaviorOptions<T = any> {
1682
1933
  * Internally used by the SlottedDirective and the ChildrenDirective.
1683
1934
  */
1684
1935
  export declare abstract class NodeObservationDirective<T extends NodeBehaviorOptions> extends StatelessAttachedAttributeDirective<T> {
1685
- private sourceProperty;
1936
+ private _id;
1937
+ private _controllerProperty;
1938
+ /**
1939
+ * The unique id of the factory.
1940
+ */
1941
+ get id(): string;
1942
+ set id(value: string);
1943
+ /**
1944
+ * The structural id of the DOM node to which the created behavior will apply.
1945
+ */
1946
+ targetNodeId: string;
1686
1947
  /**
1687
1948
  * Bind this behavior to the source.
1688
1949
  * @param source - The source to bind to.
@@ -1777,6 +2038,13 @@ export declare interface Notifier {
1777
2038
  unsubscribe(subscriber: Subscriber, propertyToUnwatch?: any): void;
1778
2039
  }
1779
2040
 
2041
+ /**
2042
+ * A {@link ValueConverter} that converts to and from `boolean` values. `null`, `undefined`, `""`,
2043
+ * and `void` values are converted to `null`.
2044
+ * @public
2045
+ */
2046
+ export declare const nullableBooleanConverter: ValueConverter;
2047
+
1780
2048
  /**
1781
2049
  * A {@link ValueConverter} that converts to and from `number` values.
1782
2050
  * @remarks
@@ -1834,17 +2102,17 @@ export declare const Observable: Readonly<{
1834
2102
  /**
1835
2103
  * Creates a {@link ExpressionNotifier} that can watch the
1836
2104
  * provided {@link Expression} for changes.
1837
- * @param binding - The binding to observe.
2105
+ * @param expression - The binding to observe.
1838
2106
  * @param initialSubscriber - An initial subscriber to changes in the binding value.
1839
2107
  * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.
1840
2108
  */
1841
- binding<TSource = any, TReturn = any>(binding: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
2109
+ binding<TSource = any, TReturn = any>(expression: Expression<TSource, TReturn, any>, initialSubscriber?: Subscriber, isVolatileBinding?: boolean): ExpressionNotifier<TSource, TReturn, any>;
1842
2110
  /**
1843
2111
  * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated
1844
2112
  * on every evaluation of the value.
1845
- * @param binding - The binding to inspect.
2113
+ * @param expression - The binding to inspect.
1846
2114
  */
1847
- isVolatileBinding<TSource_1 = any, TReturn_1 = any>(binding: Expression<TSource_1, TReturn_1, any>): boolean;
2115
+ isVolatileBinding<TSource_1 = any, TReturn_1 = any>(expression: Expression<TSource_1, TReturn_1, any>): boolean;
1848
2116
  }>;
1849
2117
 
1850
2118
  /**
@@ -1872,11 +2140,22 @@ export declare interface ObservationRecord {
1872
2140
 
1873
2141
  /**
1874
2142
  * Creates a one time binding
1875
- * @param binding - The binding to refresh when signaled.
2143
+ * @param expression - The binding to refresh when signaled.
2144
+ * @param policy - The security policy to associate with th binding.
2145
+ * @returns A binding configuration.
2146
+ * @public
2147
+ */
2148
+ export declare function oneTime<T = any>(expression: Expression<T>, policy?: DOMPolicy): Binding<T>;
2149
+
2150
+ /**
2151
+ * Creates an standard binding.
2152
+ * @param expression - The binding to refresh when changed.
2153
+ * @param policy - The security policy to associate with th binding.
2154
+ * @param isVolatile - Indicates whether the binding is volatile or not.
1876
2155
  * @returns A binding configuration.
1877
2156
  * @public
1878
2157
  */
1879
- export declare function oneTime<T = any>(binding: Expression<T>): Binding<T>;
2158
+ export declare function oneWay<T = any>(expression: Expression<T>, policy?: DOMPolicy, isVolatile?: boolean): Binding<T>;
1880
2159
 
1881
2160
  /**
1882
2161
  * Common APIs related to content parsing.
@@ -1994,6 +2273,10 @@ export declare const ref: <TSource = any, TParent = any>(propertyName: keyof TSo
1994
2273
  * @public
1995
2274
  */
1996
2275
  export declare class RefDirective extends StatelessAttachedAttributeDirective<string> {
2276
+ /**
2277
+ * The structural id of the DOM node to which the created behavior will apply.
2278
+ */
2279
+ targetNodeId: string;
1997
2280
  /**
1998
2281
  * Bind this behavior.
1999
2282
  * @param controller - The view controller that manages the lifecycle of this behavior.
@@ -2003,6 +2286,88 @@ export declare class RefDirective extends StatelessAttachedAttributeDirective<st
2003
2286
 
2004
2287
  declare const reflectMode = "reflect";
2005
2288
 
2289
+ /**
2290
+ * Creates a RenderDirective for use in advanced rendering scenarios.
2291
+ * @param value - The binding expression that returns the data to be rendered. The expression
2292
+ * can also return a Node to render directly.
2293
+ * @param template - A template to render the data with
2294
+ * or a string to indicate which RenderInstruction to use when looking up a RenderInstruction.
2295
+ * Expressions can also be provided to dynamically determine either the template or the name.
2296
+ * @returns A RenderDirective suitable for use in a template.
2297
+ * @remarks
2298
+ * If no binding is provided, then a default binding that returns the source is created.
2299
+ * If no template is provided, then a binding is created that will use registered
2300
+ * RenderInstructions to determine the view.
2301
+ * If the template binding returns a string, then it will be used to look up a
2302
+ * RenderInstruction to determine the view.
2303
+ * @public
2304
+ */
2305
+ export declare 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>;
2306
+
2307
+ /**
2308
+ * A Behavior that enables advanced rendering.
2309
+ * @public
2310
+ */
2311
+ export declare class RenderBehavior<TSource = any> implements ViewBehavior, Subscriber {
2312
+ private directive;
2313
+ private location;
2314
+ private controller;
2315
+ private view;
2316
+ private template;
2317
+ private templateBindingObserver;
2318
+ private data;
2319
+ private dataBindingObserver;
2320
+ /**
2321
+ * Creates an instance of RenderBehavior.
2322
+ * @param directive - The render directive that created this behavior.
2323
+ */
2324
+ constructor(directive: RenderDirective);
2325
+ /**
2326
+ * Bind this behavior.
2327
+ * @param controller - The view controller that manages the lifecycle of this behavior.
2328
+ */
2329
+ bind(controller: ViewController): void;
2330
+ /**
2331
+ * Unbinds this behavior.
2332
+ * @param controller - The view controller that manages the lifecycle of this behavior.
2333
+ */
2334
+ unbind(controller: ViewController): void;
2335
+ /** @internal */
2336
+ handleChange(source: any, observer: ExpressionObserver): void;
2337
+ private bindView;
2338
+ private refreshView;
2339
+ }
2340
+
2341
+ /**
2342
+ * A Directive that enables use of the RenderBehavior.
2343
+ * @public
2344
+ */
2345
+ export declare class RenderDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory, BindingDirective {
2346
+ readonly dataBinding: Binding<TSource>;
2347
+ readonly templateBinding: Binding<TSource, ContentTemplate>;
2348
+ readonly templateBindingDependsOnData: boolean;
2349
+ /**
2350
+ * The structural id of the DOM node to which the created behavior will apply.
2351
+ */
2352
+ targetNodeId: string;
2353
+ /**
2354
+ * Creates an instance of RenderDirective.
2355
+ * @param dataBinding - A binding expression that returns the data to render.
2356
+ * @param templateBinding - A binding expression that returns the template to use to render the data.
2357
+ */
2358
+ constructor(dataBinding: Binding<TSource>, templateBinding: Binding<TSource, ContentTemplate>, templateBindingDependsOnData: boolean);
2359
+ /**
2360
+ * Creates HTML to be used within a template.
2361
+ * @param add - Can be used to add behavior factories to a template.
2362
+ */
2363
+ createHTML(add: AddViewBehaviorFactory): string;
2364
+ /**
2365
+ * Creates a behavior.
2366
+ * @param targets - The targets available for behaviors to be attached to.
2367
+ */
2368
+ createBehavior(): RenderBehavior<TSource>;
2369
+ }
2370
+
2006
2371
  /**
2007
2372
  * A directive that enables list rendering.
2008
2373
  * @param items - The array to render.
@@ -2021,13 +2386,14 @@ export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subs
2021
2386
  private directive;
2022
2387
  private location;
2023
2388
  private controller;
2024
- private views;
2025
2389
  private template;
2026
2390
  private templateBindingObserver;
2027
2391
  private items;
2028
2392
  private itemsObserver;
2029
2393
  private itemsBindingObserver;
2030
2394
  private bindView;
2395
+ /** @internal */
2396
+ views: SyntheticView[];
2031
2397
  /**
2032
2398
  * Creates an instance of RepeatBehavior.
2033
2399
  * @param location - The location in the DOM to render the repeat.
@@ -2057,24 +2423,21 @@ export declare class RepeatBehavior<TSource = any> implements ViewBehavior, Subs
2057
2423
  private updateViews;
2058
2424
  private refreshAllViews;
2059
2425
  private unbindAllViews;
2426
+ private hydrateViews;
2060
2427
  }
2061
2428
 
2062
2429
  /**
2063
2430
  * A directive that configures list rendering.
2064
2431
  * @public
2065
2432
  */
2066
- export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory {
2433
+ export declare class RepeatDirective<TSource = any> implements HTMLDirective, ViewBehaviorFactory, BindingDirective {
2067
2434
  readonly dataBinding: Binding<TSource>;
2068
2435
  readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
2069
2436
  readonly options: RepeatOptions;
2070
- /**
2071
- * The unique id of the factory.
2072
- */
2073
- id: string;
2074
2437
  /**
2075
2438
  * The structural id of the DOM node to which the created behavior will apply.
2076
2439
  */
2077
- nodeId: string;
2440
+ targetNodeId: string;
2078
2441
  /**
2079
2442
  * Creates a placeholder string based on the directive's index within the template.
2080
2443
  * @param index - The index of the directive within the template.
@@ -2181,7 +2544,7 @@ export declare const SourceLifetime: Readonly<{
2181
2544
  * Describes how the source's lifetime relates to its controller's lifetime.
2182
2545
  * @public
2183
2546
  */
2184
- export declare type SourceLifetime = typeof SourceLifetime[keyof typeof SourceLifetime];
2547
+ export declare type SourceLifetime = (typeof SourceLifetime)[keyof typeof SourceLifetime];
2185
2548
 
2186
2549
  /**
2187
2550
  * A splice map is a representation of how a previous array of items
@@ -2333,7 +2696,14 @@ export declare const SpliceStrategySupport: Readonly<{
2333
2696
  * The available values for SpliceStrategySupport.
2334
2697
  * @public
2335
2698
  */
2336
- export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof typeof SpliceStrategySupport];
2699
+ export declare type SpliceStrategySupport = (typeof SpliceStrategySupport)[keyof typeof SpliceStrategySupport];
2700
+
2701
+ declare const enum Stages {
2702
+ connecting = 0,
2703
+ connected = 1,
2704
+ disconnecting = 2,
2705
+ disconnected = 3
2706
+ }
2337
2707
 
2338
2708
  /**
2339
2709
  * A base class used for attribute directives that don't need internal state.
@@ -2341,14 +2711,6 @@ export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof t
2341
2711
  */
2342
2712
  export declare abstract class StatelessAttachedAttributeDirective<TOptions> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
2343
2713
  protected options: TOptions;
2344
- /**
2345
- * The unique id of the factory.
2346
- */
2347
- id: string;
2348
- /**
2349
- * The structural id of the DOM node to which the created behavior will apply.
2350
- */
2351
- nodeId: string;
2352
2714
  /**
2353
2715
  * Creates an instance of RefDirective.
2354
2716
  * @param options - The options to use in configuring the directive.
@@ -2395,7 +2757,7 @@ export declare interface StyleStrategy {
2395
2757
  * A node that can be targeted by styles.
2396
2758
  * @public
2397
2759
  */
2398
- export declare interface StyleTarget {
2760
+ export declare interface StyleTarget extends Pick<Node, "getRootNode"> {
2399
2761
  /**
2400
2762
  * Stylesheets to be adopted by the node.
2401
2763
  */
@@ -2527,6 +2889,10 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
2527
2889
  * Creates a SyntheticView instance based on this template definition.
2528
2890
  */
2529
2891
  create(): SyntheticView<TSource, TParent>;
2892
+ /**
2893
+ * Returns a directive that can inline the template.
2894
+ */
2895
+ inline(): CaptureType<TSource, TParent>;
2530
2896
  }
2531
2897
 
2532
2898
  /**
@@ -2535,19 +2901,6 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
2535
2901
  */
2536
2902
  export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
2537
2903
 
2538
- /**
2539
- * Enables working with trusted types.
2540
- * @public
2541
- */
2542
- export declare type TrustedTypes = {
2543
- /**
2544
- * Creates a trusted types policy.
2545
- * @param name - The policy name.
2546
- * @param rules - The policy rules implementation.
2547
- */
2548
- createPolicy(name: string, rules: TrustedTypesPolicy): TrustedTypesPolicy;
2549
- };
2550
-
2551
2904
  /**
2552
2905
  * A policy for use with the standard trustedTypes platform API.
2553
2906
  * @public
@@ -2560,24 +2913,6 @@ export declare type TrustedTypesPolicy = {
2560
2913
  createHTML(html: string): string;
2561
2914
  };
2562
2915
 
2563
- /**
2564
- * Do not change. Part of shared kernel contract.
2565
- * @internal
2566
- */
2567
- export declare interface TypeDefinition {
2568
- type: Function;
2569
- }
2570
-
2571
- /**
2572
- * Do not change. Part of shared kernel contract.
2573
- * @internal
2574
- */
2575
- export declare interface TypeRegistry<TDefinition extends TypeDefinition> {
2576
- register(definition: TDefinition): boolean;
2577
- getByType(key: Function): TDefinition | undefined;
2578
- getForInstance(object: any): TDefinition | undefined;
2579
- }
2580
-
2581
2916
  /**
2582
2917
  * A work queue used to synchronize writes to the DOM.
2583
2918
  * @public
@@ -2650,6 +2985,10 @@ export declare interface View<TSource = any, TParent = any> extends Disposable {
2650
2985
  * The data that the view is bound to.
2651
2986
  */
2652
2987
  readonly source: TSource | null;
2988
+ /**
2989
+ * Indicates whether the controller is bound.
2990
+ */
2991
+ readonly isBound: boolean;
2653
2992
  /**
2654
2993
  * Binds a view's behaviors to its binding source.
2655
2994
  * @param source - The binding source for the view's binding behaviors.
@@ -2682,56 +3021,25 @@ export declare interface ViewBehaviorFactory {
2682
3021
  /**
2683
3022
  * The unique id of the factory.
2684
3023
  */
2685
- id: string;
3024
+ id?: string;
2686
3025
  /**
2687
3026
  * The structural id of the DOM node to which the created behavior will apply.
2688
3027
  */
2689
- nodeId: string;
2690
- /**
2691
- * Creates a behavior.
2692
- */
2693
- createBehavior(): ViewBehavior;
2694
- }
2695
-
2696
- /**
2697
- * Bridges between ViewBehaviors and HostBehaviors, enabling a host to
2698
- * control ViewBehaviors.
2699
- * @public
2700
- */
2701
- export declare interface ViewBehaviorOrchestrator<TSource = any, TParent = any> extends ViewController<TSource, TParent>, HostBehavior<TSource> {
3028
+ targetNodeId?: string;
2702
3029
  /**
2703
- *
2704
- * @param nodeId - The structural id of the DOM node to which a behavior will apply.
2705
- * @param target - The DOM node associated with the id.
3030
+ * The tag name of the DOM node to which the created behavior will apply.
2706
3031
  */
2707
- addTarget(nodeId: string, target: Node): void;
3032
+ targetTagName?: string | null;
2708
3033
  /**
2709
- * Adds a behavior.
2710
- * @param behavior - The behavior to add.
3034
+ * The policy that the created behavior must run under.
2711
3035
  */
2712
- addBehavior(behavior: ViewBehavior): void;
3036
+ policy?: DOMPolicy;
2713
3037
  /**
2714
- * Adds a behavior factory.
2715
- * @param factory - The behavior factory to add.
2716
- * @param target - The target the factory will create behaviors for.
3038
+ * Creates a behavior.
2717
3039
  */
2718
- addBehaviorFactory(factory: ViewBehaviorFactory, target: Node): void;
3040
+ createBehavior(): ViewBehavior;
2719
3041
  }
2720
3042
 
2721
- /**
2722
- * Bridges between ViewBehaviors and HostBehaviors, enabling a host to
2723
- * control ViewBehaviors.
2724
- * @public
2725
- */
2726
- export declare const ViewBehaviorOrchestrator: Readonly<{
2727
- /**
2728
- * Creates a ViewBehaviorOrchestrator.
2729
- * @param source - The source to to associate behaviors with.
2730
- * @returns A ViewBehaviorOrchestrator.
2731
- */
2732
- create<TSource = any, TParent = any>(source: TSource): ViewBehaviorOrchestrator<TSource, TParent>;
2733
- }>;
2734
-
2735
3043
  /**
2736
3044
  * The target nodes available to a behavior.
2737
3045
  * @public
@@ -2751,11 +3059,17 @@ export declare interface ViewController<TSource = any, TParent = any> extends Ex
2751
3059
  readonly targets: ViewBehaviorTargets;
2752
3060
  }
2753
3061
 
3062
+ declare interface ViewNodes {
3063
+ first: Node;
3064
+ last: Node;
3065
+ }
3066
+
2754
3067
  /**
2755
3068
  * A template capable of creating HTMLView instances or rendering directly to DOM.
2756
3069
  * @public
2757
3070
  */
2758
3071
  export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
3072
+ private policy?;
2759
3073
  private result;
2760
3074
  /**
2761
3075
  * The html representing what this template will
@@ -2770,13 +3084,31 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
2770
3084
  * Creates an instance of ViewTemplate.
2771
3085
  * @param html - The html representing what this template will instantiate, including placeholders for directives.
2772
3086
  * @param factories - The directives that will be connected to placeholders in the html.
3087
+ * @param policy - The security policy to use when compiling this template.
3088
+ */
3089
+ constructor(html: string | HTMLTemplateElement, factories?: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy | undefined);
3090
+ /**
3091
+ * @internal
2773
3092
  */
2774
- constructor(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>);
3093
+ compile(): HTMLTemplateCompilationResult<TSource, TParent>;
2775
3094
  /**
2776
3095
  * Creates an HTMLView instance based on this template definition.
2777
3096
  * @param hostBindingTarget - The element that host behaviors will be bound to.
2778
3097
  */
2779
3098
  create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
3099
+ /**
3100
+ * Returns a directive that can inline the template.
3101
+ */
3102
+ inline(): CaptureType<TSource, TParent>;
3103
+ /**
3104
+ * Sets the DOMPolicy for this template.
3105
+ * @param policy - The policy to associated with this template.
3106
+ * @returns The modified template instance.
3107
+ * @remarks
3108
+ * The DOMPolicy can only be set once for a template and cannot be
3109
+ * set after the template is compiled.
3110
+ */
3111
+ withPolicy(policy: DOMPolicy): this;
2780
3112
  /**
2781
3113
  * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
2782
3114
  * @param source - The data source to bind the template to.
@@ -2785,6 +3117,20 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
2785
3117
  * host that the template is being attached to.
2786
3118
  */
2787
3119
  render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
3120
+ /**
3121
+ * Creates a template based on a set of static strings and dynamic values.
3122
+ * @param strings - The static strings to create the template with.
3123
+ * @param values - The dynamic values to create the template with.
3124
+ * @param policy - The DOMPolicy to associated with the template.
3125
+ * @returns A ViewTemplate.
3126
+ * @remarks
3127
+ * This API should not be used directly under normal circumstances because constructing
3128
+ * a template in this way, if not done properly, can open up the application to XSS
3129
+ * attacks. When using this API, provide a strong DOMPolicy that can properly sanitize
3130
+ * and also be sure to manually sanitize all static strings particularly if they can
3131
+ * come from user input.
3132
+ */
3133
+ static create<TSource = any, TParent = any>(strings: string[], values: TemplateValue<TSource, TParent>[], policy?: DOMPolicy): ViewTemplate<TSource, TParent>;
2788
3134
  }
2789
3135
 
2790
3136
  /**
@@ -2801,8 +3147,10 @@ export declare function volatile(target: {}, name: string | Accessor, descriptor
2801
3147
  * @param condition - The condition to test for rendering.
2802
3148
  * @param templateOrTemplateBinding - The template or a binding that gets
2803
3149
  * the template to render when the condition is true.
3150
+ * @param elseTemplateOrTemplateBinding - Optional template or binding that that
3151
+ * gets the template to render when the conditional is false.
2804
3152
  * @public
2805
3153
  */
2806
- export declare function when<TSource = any, TReturn = any, TParent = any>(condition: Expression<TSource, TReturn, TParent> | boolean, templateOrTemplateBinding: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>): CaptureType<TSource, TParent>;
3154
+ export declare function when<TSource = any, TReturn = any, TParent = any>(condition: Expression<TSource, TReturn, TParent> | boolean, templateOrTemplateBinding: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>, elseTemplateOrTemplateBinding?: SyntheticViewTemplate<TSource, TParent> | Expression<TSource, SyntheticViewTemplate<TSource, TParent>, TParent>): CaptureType<TSource, TParent>;
2807
3155
 
2808
3156
  export { }