@microsoft/fast-element 2.0.0-beta.16 → 2.0.0-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +36 -0
- package/CHANGELOG.md +18 -1
- package/dist/dts/components/element-controller.d.ts +5 -0
- package/dist/dts/dom-policy.d.ts +68 -0
- package/dist/dts/dom.d.ts +116 -0
- package/dist/dts/index.d.ts +3 -2
- package/dist/dts/index.rollup.d.ts +0 -1
- package/dist/dts/index.rollup.debug.d.ts +0 -1
- package/dist/dts/interfaces.d.ts +15 -24
- package/dist/dts/polyfills.d.ts +0 -1
- package/dist/dts/templating/binding-signal.d.ts +3 -1
- package/dist/dts/templating/binding-two-way.d.ts +3 -1
- package/dist/dts/templating/binding.d.ts +16 -5
- package/dist/dts/templating/compiler.d.ts +11 -13
- package/dist/dts/templating/dangerous-html.d.ts +18 -0
- package/dist/dts/templating/html-directive.d.ts +54 -118
- package/dist/dts/templating/node-observation.d.ts +11 -1
- package/dist/dts/templating/ref.d.ts +4 -0
- package/dist/dts/templating/render.d.ts +30 -6
- package/dist/dts/templating/repeat.d.ts +1 -5
- package/dist/dts/templating/template.d.ts +44 -13
- package/dist/dts/templating/view.d.ts +8 -3
- package/dist/dts/testing/fakes.d.ts +1 -0
- package/dist/dts/utilities.d.ts +39 -0
- package/dist/esm/components/attributes.js +1 -1
- package/dist/esm/components/element-controller.js +6 -1
- package/dist/esm/debug.js +4 -1
- package/dist/esm/dom-policy.js +337 -0
- package/dist/esm/dom.js +117 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.rollup.debug.js +3 -1
- package/dist/esm/index.rollup.js +3 -1
- package/dist/esm/observation/observable.js +5 -1
- package/dist/esm/platform.js +1 -1
- package/dist/esm/polyfills.js +3 -7
- package/dist/esm/templating/binding-signal.js +9 -3
- package/dist/esm/templating/binding-two-way.js +9 -3
- package/dist/esm/templating/binding.js +40 -55
- package/dist/esm/templating/children.js +8 -4
- package/dist/esm/templating/compiler.js +31 -38
- package/dist/esm/templating/dangerous-html.js +23 -0
- package/dist/esm/templating/html-directive.js +42 -133
- package/dist/esm/templating/node-observation.js +14 -8
- package/dist/esm/templating/ref.js +1 -1
- package/dist/esm/templating/render.js +17 -6
- package/dist/esm/templating/repeat.js +2 -6
- package/dist/esm/templating/template.js +86 -56
- package/dist/esm/templating/view.js +6 -0
- package/dist/esm/testing/fakes.js +2 -0
- package/dist/esm/testing/fixture.js +1 -1
- package/dist/esm/utilities.js +68 -0
- package/dist/fast-element.api.json +1088 -608
- package/dist/fast-element.d.ts +194 -147
- package/dist/fast-element.debug.js +745 -381
- package/dist/fast-element.debug.min.js +1 -1
- package/dist/fast-element.js +716 -355
- package/dist/fast-element.min.js +1 -1
- package/dist/fast-element.untrimmed.d.ts +208 -145
- package/docs/api-report.md +74 -56
- package/package.json +5 -1
- package/yarn-error.log +177 -0
- package/dist/dts/templating/dom.d.ts +0 -41
- package/dist/esm/templating/dom.js +0 -49
package/dist/fast-element.d.ts
CHANGED
|
@@ -76,55 +76,6 @@ export declare const ArrayObserver: Readonly<{
|
|
|
76
76
|
readonly enable: () => void;
|
|
77
77
|
}>;
|
|
78
78
|
|
|
79
|
-
/**
|
|
80
|
-
* The type of HTML aspect to target.
|
|
81
|
-
* @public
|
|
82
|
-
*/
|
|
83
|
-
export declare const Aspect: Readonly<{
|
|
84
|
-
/**
|
|
85
|
-
* Not aspected.
|
|
86
|
-
*/
|
|
87
|
-
readonly none: 0;
|
|
88
|
-
/**
|
|
89
|
-
* An attribute.
|
|
90
|
-
*/
|
|
91
|
-
readonly attribute: 1;
|
|
92
|
-
/**
|
|
93
|
-
* A boolean attribute.
|
|
94
|
-
*/
|
|
95
|
-
readonly booleanAttribute: 2;
|
|
96
|
-
/**
|
|
97
|
-
* A property.
|
|
98
|
-
*/
|
|
99
|
-
readonly property: 3;
|
|
100
|
-
/**
|
|
101
|
-
* Content
|
|
102
|
-
*/
|
|
103
|
-
readonly content: 4;
|
|
104
|
-
/**
|
|
105
|
-
* A token list.
|
|
106
|
-
*/
|
|
107
|
-
readonly tokenList: 5;
|
|
108
|
-
/**
|
|
109
|
-
* An event.
|
|
110
|
-
*/
|
|
111
|
-
readonly event: 6;
|
|
112
|
-
/**
|
|
113
|
-
*
|
|
114
|
-
* @param directive - The directive to assign the aspect to.
|
|
115
|
-
* @param value - The value to base the aspect determination on.
|
|
116
|
-
* @remarks
|
|
117
|
-
* If a falsy value is provided, then the content aspect will be assigned.
|
|
118
|
-
*/
|
|
119
|
-
readonly assign: (directive: Aspected, value?: string) => void;
|
|
120
|
-
}>;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* The type of HTML aspect to target.
|
|
124
|
-
* @public
|
|
125
|
-
*/
|
|
126
|
-
export declare type Aspect = typeof Aspect[Exclude<keyof typeof Aspect, "assign" | "none">];
|
|
127
|
-
|
|
128
79
|
/**
|
|
129
80
|
* Represents something that applies to a specific aspect of the DOM.
|
|
130
81
|
* @public
|
|
@@ -141,7 +92,7 @@ export declare interface Aspected {
|
|
|
141
92
|
/**
|
|
142
93
|
* The type of aspect to target.
|
|
143
94
|
*/
|
|
144
|
-
aspectType:
|
|
95
|
+
aspectType: DOMAspect;
|
|
145
96
|
/**
|
|
146
97
|
* A binding if one is associated with the aspect.
|
|
147
98
|
*/
|
|
@@ -259,11 +210,12 @@ export declare type AttributeMode = typeof reflectMode | typeof booleanMode | "f
|
|
|
259
210
|
/**
|
|
260
211
|
* Creates an standard binding.
|
|
261
212
|
* @param expression - The binding to refresh when changed.
|
|
213
|
+
* @param policy - The security policy to associate with th binding.
|
|
262
214
|
* @param isVolatile - Indicates whether the binding is volatile or not.
|
|
263
215
|
* @returns A binding configuration.
|
|
264
216
|
* @public
|
|
265
217
|
*/
|
|
266
|
-
export declare function bind<T = any>(expression: Expression<T>, isVolatile?: boolean): Binding<T>;
|
|
218
|
+
export declare function bind<T = any>(expression: Expression<T>, policy?: DOMPolicy, isVolatile?: boolean): Binding<T>;
|
|
267
219
|
|
|
268
220
|
/**
|
|
269
221
|
* Captures a binding expression along with related information and capabilities.
|
|
@@ -272,6 +224,7 @@ export declare function bind<T = any>(expression: Expression<T>, isVolatile?: bo
|
|
|
272
224
|
*/
|
|
273
225
|
export declare abstract class Binding<TSource = any, TReturn = any, TParent = any> {
|
|
274
226
|
evaluate: Expression<TSource, TReturn, TParent>;
|
|
227
|
+
policy?: DOMPolicy | undefined;
|
|
275
228
|
isVolatile: boolean;
|
|
276
229
|
/**
|
|
277
230
|
* Options associated with the binding.
|
|
@@ -280,9 +233,10 @@ export declare abstract class Binding<TSource = any, TReturn = any, TParent = an
|
|
|
280
233
|
/**
|
|
281
234
|
* Creates a binding.
|
|
282
235
|
* @param evaluate - Evaluates the binding.
|
|
236
|
+
* @param policy - The security policy to associate with this binding.
|
|
283
237
|
* @param isVolatile - Indicates whether the binding is volatile.
|
|
284
238
|
*/
|
|
285
|
-
constructor(evaluate: Expression<TSource, TReturn, TParent>, isVolatile?: boolean);
|
|
239
|
+
constructor(evaluate: Expression<TSource, TReturn, TParent>, policy?: DOMPolicy | undefined, isVolatile?: boolean);
|
|
286
240
|
/**
|
|
287
241
|
* Creates an observer capable of notifying a subscriber when the output of a binding changes.
|
|
288
242
|
* @param directive - The HTML Directive to create the observer for.
|
|
@@ -380,33 +334,36 @@ html: string | HTMLTemplateElement,
|
|
|
380
334
|
/**
|
|
381
335
|
* The behavior factories used within the html that is being compiled.
|
|
382
336
|
*/
|
|
383
|
-
factories: Record<string, ViewBehaviorFactory
|
|
337
|
+
factories: Record<string, ViewBehaviorFactory>,
|
|
338
|
+
/**
|
|
339
|
+
* The security policy to compile the html with.
|
|
340
|
+
*/
|
|
341
|
+
policy: DOMPolicy) => HTMLTemplateCompilationResult;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Represents a ViewBehaviorFactory after the compilation process has completed.
|
|
345
|
+
* @public
|
|
346
|
+
*/
|
|
347
|
+
export declare type CompiledViewBehaviorFactory = Required<ViewBehaviorFactory>;
|
|
384
348
|
|
|
385
349
|
/**
|
|
386
350
|
* Common APIs related to compilation.
|
|
387
351
|
* @public
|
|
388
352
|
*/
|
|
389
353
|
export declare const Compiler: {
|
|
390
|
-
/**
|
|
391
|
-
* Sets the HTML trusted types policy used by the compiler.
|
|
392
|
-
* @param policy - The policy to set for HTML.
|
|
393
|
-
* @remarks
|
|
394
|
-
* This API can only be called once, for security reasons. It should be
|
|
395
|
-
* called by the application developer at the start of their program.
|
|
396
|
-
*/
|
|
397
|
-
setHTMLPolicy(policy: TrustedTypesPolicy): void;
|
|
398
354
|
/**
|
|
399
355
|
* Compiles a template and associated directives into a compilation
|
|
400
356
|
* result which can be used to create views.
|
|
401
357
|
* @param html - The html string or template element to compile.
|
|
402
|
-
* @param
|
|
358
|
+
* @param factories - The behavior factories referenced by the template.
|
|
359
|
+
* @param policy - The security policy to compile the html with.
|
|
403
360
|
* @remarks
|
|
404
361
|
* The template that is provided for compilation is altered in-place
|
|
405
362
|
* and cannot be compiled again. If the original template must be preserved,
|
|
406
363
|
* it is recommended that you clone the original and pass the clone to this API.
|
|
407
364
|
* @public
|
|
408
365
|
*/
|
|
409
|
-
compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement,
|
|
366
|
+
compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy): HTMLTemplateCompilationResult<TSource, TParent>;
|
|
410
367
|
/**
|
|
411
368
|
* Sets the default compilation strategy that will be used by the ViewTemplate whenever
|
|
412
369
|
* it needs to compile a view preprocessed with the html template function.
|
|
@@ -417,9 +374,10 @@ export declare const Compiler: {
|
|
|
417
374
|
* Aggregates an array of strings and directives into a single directive.
|
|
418
375
|
* @param parts - A heterogeneous array of static strings interspersed with
|
|
419
376
|
* directives.
|
|
377
|
+
* @param policy - The security policy to use with the aggregated bindings.
|
|
420
378
|
* @returns A single inline directive that aggregates the behavior of all the parts.
|
|
421
379
|
*/
|
|
422
|
-
aggregate(parts: (string | ViewBehaviorFactory)[]): ViewBehaviorFactory;
|
|
380
|
+
aggregate(parts: (string | ViewBehaviorFactory)[], policy?: DOMPolicy): ViewBehaviorFactory;
|
|
423
381
|
};
|
|
424
382
|
|
|
425
383
|
/**
|
|
@@ -592,6 +550,24 @@ export declare type CSSTemplateTag = ((strings: TemplateStringsArray, ...values:
|
|
|
592
550
|
*/
|
|
593
551
|
export declare function customElement(nameOrDef: string | PartialFASTElementDefinition): (type: Constructable<HTMLElement>) => void;
|
|
594
552
|
|
|
553
|
+
/**
|
|
554
|
+
* Injects static HTML without platform protection.
|
|
555
|
+
* @param html - The html to injection.
|
|
556
|
+
* @returns A DangerousHTMLDirective.
|
|
557
|
+
* @public
|
|
558
|
+
*/
|
|
559
|
+
export declare function dangerousHTML<TSource = any, TParent = any>(html: string): CaptureType<TSource, TParent>;
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* A directive capable of injecting static HTML platform runtime protection.
|
|
563
|
+
* @public
|
|
564
|
+
*/
|
|
565
|
+
export declare class DangerousHTMLDirective implements HTMLDirective {
|
|
566
|
+
private html;
|
|
567
|
+
constructor(html: string);
|
|
568
|
+
createHTML(): string;
|
|
569
|
+
}
|
|
570
|
+
|
|
595
571
|
/**
|
|
596
572
|
* Metadata used to configure a custom attribute's behavior through a decorator.
|
|
597
573
|
* @public
|
|
@@ -633,6 +609,18 @@ export declare const DOM: Readonly<{
|
|
|
633
609
|
* Use Updates.process()
|
|
634
610
|
*/
|
|
635
611
|
processUpdates: () => void;
|
|
612
|
+
/**
|
|
613
|
+
* Gets the dom policy used by the templating system.
|
|
614
|
+
*/
|
|
615
|
+
readonly policy: DOMPolicy;
|
|
616
|
+
/**
|
|
617
|
+
* Sets the dom policy used by the templating system.
|
|
618
|
+
* @param policy - The policy to set.
|
|
619
|
+
* @remarks
|
|
620
|
+
* This API can only be called once, for security reasons. It should be
|
|
621
|
+
* called by the application developer at the start of their program.
|
|
622
|
+
*/
|
|
623
|
+
setPolicy(value: DOMPolicy): void;
|
|
636
624
|
/**
|
|
637
625
|
* Sets an attribute value on an element.
|
|
638
626
|
* @param element - The element to set the attribute value on.
|
|
@@ -654,6 +642,73 @@ export declare const DOM: Readonly<{
|
|
|
654
642
|
setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
|
|
655
643
|
}>;
|
|
656
644
|
|
|
645
|
+
/**
|
|
646
|
+
* The type of HTML aspect to target.
|
|
647
|
+
* @public
|
|
648
|
+
*/
|
|
649
|
+
export declare const DOMAspect: Readonly<{
|
|
650
|
+
/**
|
|
651
|
+
* Not aspected.
|
|
652
|
+
*/
|
|
653
|
+
readonly none: 0;
|
|
654
|
+
/**
|
|
655
|
+
* An attribute.
|
|
656
|
+
*/
|
|
657
|
+
readonly attribute: 1;
|
|
658
|
+
/**
|
|
659
|
+
* A boolean attribute.
|
|
660
|
+
*/
|
|
661
|
+
readonly booleanAttribute: 2;
|
|
662
|
+
/**
|
|
663
|
+
* A property.
|
|
664
|
+
*/
|
|
665
|
+
readonly property: 3;
|
|
666
|
+
/**
|
|
667
|
+
* Content
|
|
668
|
+
*/
|
|
669
|
+
readonly content: 4;
|
|
670
|
+
/**
|
|
671
|
+
* A token list.
|
|
672
|
+
*/
|
|
673
|
+
readonly tokenList: 5;
|
|
674
|
+
/**
|
|
675
|
+
* An event.
|
|
676
|
+
*/
|
|
677
|
+
readonly event: 6;
|
|
678
|
+
}>;
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* The type of HTML aspect to target.
|
|
682
|
+
* @public
|
|
683
|
+
*/
|
|
684
|
+
export declare type DOMAspect = typeof DOMAspect[Exclude<keyof typeof DOMAspect, "none">];
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* A security policy that FAST can use to interact with the DOM.
|
|
688
|
+
* @public
|
|
689
|
+
*/
|
|
690
|
+
export declare interface DOMPolicy {
|
|
691
|
+
/**
|
|
692
|
+
* Creates safe HTML from the provided value.
|
|
693
|
+
* @param value - The source to convert to safe HTML.
|
|
694
|
+
*/
|
|
695
|
+
createHTML(value: string): string;
|
|
696
|
+
/**
|
|
697
|
+
* Protects a DOM sink that intends to write to the DOM.
|
|
698
|
+
* @param tagName - The tag name for the element to write to.
|
|
699
|
+
* @param aspect - The aspect of the DOM to write to.
|
|
700
|
+
* @param aspectName - The name of the aspect to write to.
|
|
701
|
+
* @param sink - The sink that is used to write to the DOM.
|
|
702
|
+
*/
|
|
703
|
+
protect(tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink): DOMSink;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* A function used to send values to a DOM sink.
|
|
708
|
+
* @public
|
|
709
|
+
*/
|
|
710
|
+
export declare type DOMSink = (target: Node, aspectName: string, value: any, ...args: any[]) => void;
|
|
711
|
+
|
|
657
712
|
/**
|
|
658
713
|
* Controls the lifecycle and rendering of a `FASTElement`.
|
|
659
714
|
* @public
|
|
@@ -760,6 +815,7 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
|
|
|
760
815
|
* Only emits events if connected.
|
|
761
816
|
*/
|
|
762
817
|
emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
|
|
818
|
+
/* Excluded from this release type: toJSON */
|
|
763
819
|
private renderTemplate;
|
|
764
820
|
/**
|
|
765
821
|
* Locates or creates a controller for the specified element.
|
|
@@ -1286,7 +1342,15 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1286
1342
|
/**
|
|
1287
1343
|
* The structural id of the DOM node to which the created behavior will apply.
|
|
1288
1344
|
*/
|
|
1289
|
-
|
|
1345
|
+
targetNodeId: string;
|
|
1346
|
+
/**
|
|
1347
|
+
* The tagname associated with the target node.
|
|
1348
|
+
*/
|
|
1349
|
+
targetTagName: string | null;
|
|
1350
|
+
/**
|
|
1351
|
+
* The policy that the created behavior must run under.
|
|
1352
|
+
*/
|
|
1353
|
+
policy: DOMPolicy;
|
|
1290
1354
|
/**
|
|
1291
1355
|
* The original source aspect exactly as represented in markup.
|
|
1292
1356
|
*/
|
|
@@ -1298,7 +1362,7 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
|
|
|
1298
1362
|
/**
|
|
1299
1363
|
* The type of aspect to target.
|
|
1300
1364
|
*/
|
|
1301
|
-
aspectType:
|
|
1365
|
+
aspectType: DOMAspect;
|
|
1302
1366
|
/**
|
|
1303
1367
|
* Creates an instance of HTMLBindingDirective.
|
|
1304
1368
|
* @param dataBinding - The binding configuration to apply.
|
|
@@ -1352,6 +1416,14 @@ export declare const HTMLDirective: Readonly<{
|
|
|
1352
1416
|
* @param options - Options that specify the directive's application.
|
|
1353
1417
|
*/
|
|
1354
1418
|
define<TType extends Constructable<HTMLDirective>>(type: TType, options?: PartialHTMLDirectiveDefinition): TType;
|
|
1419
|
+
/**
|
|
1420
|
+
*
|
|
1421
|
+
* @param directive - The directive to assign the aspect to.
|
|
1422
|
+
* @param value - The value to base the aspect determination on.
|
|
1423
|
+
* @remarks
|
|
1424
|
+
* If a falsy value is provided, then the content aspect will be assigned.
|
|
1425
|
+
*/
|
|
1426
|
+
assignAspect(directive: Aspected, value?: string): void;
|
|
1355
1427
|
}>;
|
|
1356
1428
|
|
|
1357
1429
|
/**
|
|
@@ -1476,7 +1548,7 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
|
|
|
1476
1548
|
* @param fragment - The html fragment that contains the nodes for this view.
|
|
1477
1549
|
* @param behaviors - The behaviors to be applied to this view.
|
|
1478
1550
|
*/
|
|
1479
|
-
constructor(fragment: DocumentFragment, factories: ReadonlyArray<
|
|
1551
|
+
constructor(fragment: DocumentFragment, factories: ReadonlyArray<CompiledViewBehaviorFactory>, targets: ViewBehaviorTargets);
|
|
1480
1552
|
/**
|
|
1481
1553
|
* Appends the view's DOM nodes to the referenced node.
|
|
1482
1554
|
* @param node - The parent node to append the view's DOM nodes to.
|
|
@@ -1510,6 +1582,7 @@ export declare class HTMLView<TSource = any, TParent = any> implements ElementVi
|
|
|
1510
1582
|
* Unbinds a view's behaviors from its binding source.
|
|
1511
1583
|
*/
|
|
1512
1584
|
unbind(): void;
|
|
1585
|
+
/* Excluded from this release type: toJSON */
|
|
1513
1586
|
private evaluateUnbindables;
|
|
1514
1587
|
/**
|
|
1515
1588
|
* Efficiently disposes of a contiguous range of synthetic view instances.
|
|
@@ -1605,7 +1678,17 @@ export declare interface NodeBehaviorOptions<T = any> {
|
|
|
1605
1678
|
* Internally used by the SlottedDirective and the ChildrenDirective.
|
|
1606
1679
|
*/
|
|
1607
1680
|
export declare abstract class NodeObservationDirective<T extends NodeBehaviorOptions> extends StatelessAttachedAttributeDirective<T> {
|
|
1608
|
-
private
|
|
1681
|
+
private _id;
|
|
1682
|
+
private _controllerProperty;
|
|
1683
|
+
/**
|
|
1684
|
+
* The unique id of the factory.
|
|
1685
|
+
*/
|
|
1686
|
+
get id(): string;
|
|
1687
|
+
set id(value: string);
|
|
1688
|
+
/**
|
|
1689
|
+
* The structural id of the DOM node to which the created behavior will apply.
|
|
1690
|
+
*/
|
|
1691
|
+
targetNodeId: string;
|
|
1609
1692
|
/**
|
|
1610
1693
|
* Bind this behavior to the source.
|
|
1611
1694
|
* @param source - The source to bind to.
|
|
@@ -1792,10 +1875,11 @@ export declare interface ObservationRecord {
|
|
|
1792
1875
|
/**
|
|
1793
1876
|
* Creates a one time binding
|
|
1794
1877
|
* @param expression - The binding to refresh when signaled.
|
|
1878
|
+
* @param policy - The security policy to associate with th binding.
|
|
1795
1879
|
* @returns A binding configuration.
|
|
1796
1880
|
* @public
|
|
1797
1881
|
*/
|
|
1798
|
-
export declare function oneTime<T = any>(expression: Expression<T
|
|
1882
|
+
export declare function oneTime<T = any>(expression: Expression<T>, policy?: DOMPolicy): Binding<T>;
|
|
1799
1883
|
|
|
1800
1884
|
/**
|
|
1801
1885
|
* Common APIs related to content parsing.
|
|
@@ -1913,6 +1997,10 @@ export declare const ref: <TSource = any, TParent = any>(propertyName: keyof TSo
|
|
|
1913
1997
|
* @public
|
|
1914
1998
|
*/
|
|
1915
1999
|
export declare class RefDirective extends StatelessAttachedAttributeDirective<string> {
|
|
2000
|
+
/**
|
|
2001
|
+
* The structural id of the DOM node to which the created behavior will apply.
|
|
2002
|
+
*/
|
|
2003
|
+
targetNodeId: string;
|
|
1916
2004
|
/**
|
|
1917
2005
|
* Bind this behavior.
|
|
1918
2006
|
* @param controller - The view controller that manages the lifecycle of this behavior.
|
|
@@ -1986,14 +2074,10 @@ export declare class RepeatDirective<TSource = any> implements HTMLDirective, Vi
|
|
|
1986
2074
|
readonly dataBinding: Binding<TSource>;
|
|
1987
2075
|
readonly templateBinding: Binding<TSource, SyntheticViewTemplate>;
|
|
1988
2076
|
readonly options: RepeatOptions;
|
|
1989
|
-
/**
|
|
1990
|
-
* The unique id of the factory.
|
|
1991
|
-
*/
|
|
1992
|
-
id: string;
|
|
1993
2077
|
/**
|
|
1994
2078
|
* The structural id of the DOM node to which the created behavior will apply.
|
|
1995
2079
|
*/
|
|
1996
|
-
|
|
2080
|
+
targetNodeId: string;
|
|
1997
2081
|
/**
|
|
1998
2082
|
* Creates a placeholder string based on the directive's index within the template.
|
|
1999
2083
|
* @param index - The index of the directive within the template.
|
|
@@ -2259,14 +2343,7 @@ export declare type SpliceStrategySupport = typeof SpliceStrategySupport[keyof t
|
|
|
2259
2343
|
*/
|
|
2260
2344
|
export declare abstract class StatelessAttachedAttributeDirective<TOptions> implements HTMLDirective, ViewBehaviorFactory, ViewBehavior {
|
|
2261
2345
|
protected options: TOptions;
|
|
2262
|
-
|
|
2263
|
-
* The unique id of the factory.
|
|
2264
|
-
*/
|
|
2265
|
-
id: string;
|
|
2266
|
-
/**
|
|
2267
|
-
* The structural id of the DOM node to which the created behavior will apply.
|
|
2268
|
-
*/
|
|
2269
|
-
nodeId: string;
|
|
2346
|
+
/* Excluded from this release type: toJSON */
|
|
2270
2347
|
/**
|
|
2271
2348
|
* Creates an instance of RefDirective.
|
|
2272
2349
|
* @param options - The options to use in configuring the directive.
|
|
@@ -2453,31 +2530,6 @@ export declare interface SyntheticViewTemplate<TSource = any, TParent = any> {
|
|
|
2453
2530
|
*/
|
|
2454
2531
|
export declare type TemplateValue<TSource, TParent = any> = Expression<TSource, any, TParent> | Binding<TSource, any, TParent> | HTMLDirective | CaptureType<TSource, TParent>;
|
|
2455
2532
|
|
|
2456
|
-
/**
|
|
2457
|
-
* Enables working with trusted types.
|
|
2458
|
-
* @public
|
|
2459
|
-
*/
|
|
2460
|
-
export declare type TrustedTypes = {
|
|
2461
|
-
/**
|
|
2462
|
-
* Creates a trusted types policy.
|
|
2463
|
-
* @param name - The policy name.
|
|
2464
|
-
* @param rules - The policy rules implementation.
|
|
2465
|
-
*/
|
|
2466
|
-
createPolicy(name: string, rules: TrustedTypesPolicy): TrustedTypesPolicy;
|
|
2467
|
-
};
|
|
2468
|
-
|
|
2469
|
-
/**
|
|
2470
|
-
* A policy for use with the standard trustedTypes platform API.
|
|
2471
|
-
* @public
|
|
2472
|
-
*/
|
|
2473
|
-
export declare type TrustedTypesPolicy = {
|
|
2474
|
-
/**
|
|
2475
|
-
* Creates trusted HTML.
|
|
2476
|
-
* @param html - The HTML to clear as trustworthy.
|
|
2477
|
-
*/
|
|
2478
|
-
createHTML(html: string): string;
|
|
2479
|
-
};
|
|
2480
|
-
|
|
2481
2533
|
/* Excluded from this release type: TypeDefinition */
|
|
2482
2534
|
|
|
2483
2535
|
/* Excluded from this release type: TypeRegistry */
|
|
@@ -2586,56 +2638,25 @@ export declare interface ViewBehaviorFactory {
|
|
|
2586
2638
|
/**
|
|
2587
2639
|
* The unique id of the factory.
|
|
2588
2640
|
*/
|
|
2589
|
-
id
|
|
2641
|
+
id?: string;
|
|
2590
2642
|
/**
|
|
2591
2643
|
* The structural id of the DOM node to which the created behavior will apply.
|
|
2592
2644
|
*/
|
|
2593
|
-
|
|
2645
|
+
targetNodeId?: string;
|
|
2594
2646
|
/**
|
|
2595
|
-
*
|
|
2647
|
+
* The tag name of the DOM node to which the created behavior will apply.
|
|
2596
2648
|
*/
|
|
2597
|
-
|
|
2598
|
-
}
|
|
2599
|
-
|
|
2600
|
-
/**
|
|
2601
|
-
* Bridges between ViewBehaviors and HostBehaviors, enabling a host to
|
|
2602
|
-
* control ViewBehaviors.
|
|
2603
|
-
* @public
|
|
2604
|
-
*/
|
|
2605
|
-
export declare interface ViewBehaviorOrchestrator<TSource = any, TParent = any> extends ViewController<TSource, TParent>, HostBehavior<TSource> {
|
|
2606
|
-
/**
|
|
2607
|
-
*
|
|
2608
|
-
* @param nodeId - The structural id of the DOM node to which a behavior will apply.
|
|
2609
|
-
* @param target - The DOM node associated with the id.
|
|
2610
|
-
*/
|
|
2611
|
-
addTarget(nodeId: string, target: Node): void;
|
|
2649
|
+
targetTagName?: string | null;
|
|
2612
2650
|
/**
|
|
2613
|
-
*
|
|
2614
|
-
* @param behavior - The behavior to add.
|
|
2651
|
+
* The policy that the created behavior must run under.
|
|
2615
2652
|
*/
|
|
2616
|
-
|
|
2653
|
+
policy?: DOMPolicy;
|
|
2617
2654
|
/**
|
|
2618
|
-
*
|
|
2619
|
-
* @param factory - The behavior factory to add.
|
|
2620
|
-
* @param target - The target the factory will create behaviors for.
|
|
2655
|
+
* Creates a behavior.
|
|
2621
2656
|
*/
|
|
2622
|
-
|
|
2657
|
+
createBehavior(): ViewBehavior;
|
|
2623
2658
|
}
|
|
2624
2659
|
|
|
2625
|
-
/**
|
|
2626
|
-
* Bridges between ViewBehaviors and HostBehaviors, enabling a host to
|
|
2627
|
-
* control ViewBehaviors.
|
|
2628
|
-
* @public
|
|
2629
|
-
*/
|
|
2630
|
-
export declare const ViewBehaviorOrchestrator: Readonly<{
|
|
2631
|
-
/**
|
|
2632
|
-
* Creates a ViewBehaviorOrchestrator.
|
|
2633
|
-
* @param source - The source to to associate behaviors with.
|
|
2634
|
-
* @returns A ViewBehaviorOrchestrator.
|
|
2635
|
-
*/
|
|
2636
|
-
create<TSource = any, TParent = any>(source: TSource): ViewBehaviorOrchestrator<TSource, TParent>;
|
|
2637
|
-
}>;
|
|
2638
|
-
|
|
2639
2660
|
/**
|
|
2640
2661
|
* The target nodes available to a behavior.
|
|
2641
2662
|
* @public
|
|
@@ -2660,6 +2681,7 @@ export declare interface ViewController<TSource = any, TParent = any> extends Ex
|
|
|
2660
2681
|
* @public
|
|
2661
2682
|
*/
|
|
2662
2683
|
export declare class ViewTemplate<TSource = any, TParent = any> implements ElementViewTemplate<TSource, TParent>, SyntheticViewTemplate<TSource, TParent> {
|
|
2684
|
+
private policy?;
|
|
2663
2685
|
private result;
|
|
2664
2686
|
/**
|
|
2665
2687
|
* The html representing what this template will
|
|
@@ -2674,13 +2696,23 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
|
|
|
2674
2696
|
* Creates an instance of ViewTemplate.
|
|
2675
2697
|
* @param html - The html representing what this template will instantiate, including placeholders for directives.
|
|
2676
2698
|
* @param factories - The directives that will be connected to placeholders in the html.
|
|
2699
|
+
* @param policy - The security policy to use when compiling this template.
|
|
2677
2700
|
*/
|
|
2678
|
-
constructor(html: string | HTMLTemplateElement, factories
|
|
2701
|
+
constructor(html: string | HTMLTemplateElement, factories?: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy | undefined);
|
|
2679
2702
|
/**
|
|
2680
2703
|
* Creates an HTMLView instance based on this template definition.
|
|
2681
2704
|
* @param hostBindingTarget - The element that host behaviors will be bound to.
|
|
2682
2705
|
*/
|
|
2683
2706
|
create(hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
2707
|
+
/**
|
|
2708
|
+
* Sets the DOMPolicy for this template.
|
|
2709
|
+
* @param policy - The policy to associated with this template.
|
|
2710
|
+
* @returns The modified template instance.
|
|
2711
|
+
* @remarks
|
|
2712
|
+
* The DOMPolicy can only be set once for a template and cannot be
|
|
2713
|
+
* set after the template is compiled.
|
|
2714
|
+
*/
|
|
2715
|
+
withPolicy(policy: DOMPolicy): this;
|
|
2684
2716
|
/**
|
|
2685
2717
|
* Creates an HTMLView from this template, binds it to the source, and then appends it to the host.
|
|
2686
2718
|
* @param source - The data source to bind the template to.
|
|
@@ -2689,6 +2721,21 @@ export declare class ViewTemplate<TSource = any, TParent = any> implements Eleme
|
|
|
2689
2721
|
* host that the template is being attached to.
|
|
2690
2722
|
*/
|
|
2691
2723
|
render(source: TSource, host: Node, hostBindingTarget?: Element): HTMLView<TSource, TParent>;
|
|
2724
|
+
/* Excluded from this release type: toJSON */
|
|
2725
|
+
/**
|
|
2726
|
+
* Creates a template based on a set of static strings and dynamic values.
|
|
2727
|
+
* @param strings - The static strings to create the template with.
|
|
2728
|
+
* @param values - The dynamic values to create the template with.
|
|
2729
|
+
* @param policy - The DOMPolicy to associated with the template.
|
|
2730
|
+
* @returns A ViewTemplate.
|
|
2731
|
+
* @remarks
|
|
2732
|
+
* This API should not be used directly under normal circumstances because constructing
|
|
2733
|
+
* a template in this way, if not done properly, can open up the application to XSS
|
|
2734
|
+
* attacks. When using this API, provide a strong DOMPolicy that can properly sanitize
|
|
2735
|
+
* and also be sure to manually sanitize all static strings particularly if they can
|
|
2736
|
+
* come from user input.
|
|
2737
|
+
*/
|
|
2738
|
+
static create<TSource = any, TParent = any>(strings: string[], values: TemplateValue<TSource, TParent>[], policy?: DOMPolicy): ViewTemplate<TSource, TParent>;
|
|
2692
2739
|
}
|
|
2693
2740
|
|
|
2694
2741
|
/**
|