@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.
Files changed (63) hide show
  1. package/CHANGELOG.json +36 -0
  2. package/CHANGELOG.md +18 -1
  3. package/dist/dts/components/element-controller.d.ts +5 -0
  4. package/dist/dts/dom-policy.d.ts +68 -0
  5. package/dist/dts/dom.d.ts +116 -0
  6. package/dist/dts/index.d.ts +3 -2
  7. package/dist/dts/index.rollup.d.ts +0 -1
  8. package/dist/dts/index.rollup.debug.d.ts +0 -1
  9. package/dist/dts/interfaces.d.ts +15 -24
  10. package/dist/dts/polyfills.d.ts +0 -1
  11. package/dist/dts/templating/binding-signal.d.ts +3 -1
  12. package/dist/dts/templating/binding-two-way.d.ts +3 -1
  13. package/dist/dts/templating/binding.d.ts +16 -5
  14. package/dist/dts/templating/compiler.d.ts +11 -13
  15. package/dist/dts/templating/dangerous-html.d.ts +18 -0
  16. package/dist/dts/templating/html-directive.d.ts +54 -118
  17. package/dist/dts/templating/node-observation.d.ts +11 -1
  18. package/dist/dts/templating/ref.d.ts +4 -0
  19. package/dist/dts/templating/render.d.ts +30 -6
  20. package/dist/dts/templating/repeat.d.ts +1 -5
  21. package/dist/dts/templating/template.d.ts +44 -13
  22. package/dist/dts/templating/view.d.ts +8 -3
  23. package/dist/dts/testing/fakes.d.ts +1 -0
  24. package/dist/dts/utilities.d.ts +39 -0
  25. package/dist/esm/components/attributes.js +1 -1
  26. package/dist/esm/components/element-controller.js +6 -1
  27. package/dist/esm/debug.js +4 -1
  28. package/dist/esm/dom-policy.js +337 -0
  29. package/dist/esm/dom.js +117 -0
  30. package/dist/esm/index.js +2 -1
  31. package/dist/esm/index.rollup.debug.js +3 -1
  32. package/dist/esm/index.rollup.js +3 -1
  33. package/dist/esm/observation/observable.js +5 -1
  34. package/dist/esm/platform.js +1 -1
  35. package/dist/esm/polyfills.js +3 -7
  36. package/dist/esm/templating/binding-signal.js +9 -3
  37. package/dist/esm/templating/binding-two-way.js +9 -3
  38. package/dist/esm/templating/binding.js +40 -55
  39. package/dist/esm/templating/children.js +8 -4
  40. package/dist/esm/templating/compiler.js +31 -38
  41. package/dist/esm/templating/dangerous-html.js +23 -0
  42. package/dist/esm/templating/html-directive.js +42 -133
  43. package/dist/esm/templating/node-observation.js +14 -8
  44. package/dist/esm/templating/ref.js +1 -1
  45. package/dist/esm/templating/render.js +17 -6
  46. package/dist/esm/templating/repeat.js +2 -6
  47. package/dist/esm/templating/template.js +86 -56
  48. package/dist/esm/templating/view.js +6 -0
  49. package/dist/esm/testing/fakes.js +2 -0
  50. package/dist/esm/testing/fixture.js +1 -1
  51. package/dist/esm/utilities.js +68 -0
  52. package/dist/fast-element.api.json +1088 -608
  53. package/dist/fast-element.d.ts +194 -147
  54. package/dist/fast-element.debug.js +745 -381
  55. package/dist/fast-element.debug.min.js +1 -1
  56. package/dist/fast-element.js +716 -355
  57. package/dist/fast-element.min.js +1 -1
  58. package/dist/fast-element.untrimmed.d.ts +208 -145
  59. package/docs/api-report.md +74 -56
  60. package/package.json +5 -1
  61. package/yarn-error.log +177 -0
  62. package/dist/dts/templating/dom.d.ts +0 -41
  63. package/dist/esm/templating/dom.js +0 -49
package/CHANGELOG.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@microsoft/fast-element",
3
3
  "entries": [
4
+ {
5
+ "date": "Tue, 15 Nov 2022 02:40:34 GMT",
6
+ "tag": "@microsoft/fast-element_v2.0.0-beta.18",
7
+ "version": "2.0.0-beta.18",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "roeisenb@microsoft.com",
12
+ "package": "@microsoft/fast-element",
13
+ "commit": "1a1fc0b9e85f1e65c605e32f6724402291ffbcaa",
14
+ "comment": "chore: move ViewBehaviorOrchestrator to utilities"
15
+ },
16
+ {
17
+ "author": "roeisenb@microsoft.com",
18
+ "package": "@microsoft/fast-element",
19
+ "commit": "3c14603089495a7af8ed5b55122c418b47c45fd5",
20
+ "comment": "feat: add new DOM Policy protection throughout"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "date": "Tue, 01 Nov 2022 23:26:26 GMT",
27
+ "tag": "@microsoft/fast-element_v2.0.0-beta.17",
28
+ "version": "2.0.0-beta.17",
29
+ "comments": {
30
+ "prerelease": [
31
+ {
32
+ "author": "roeisenb@microsoft.com",
33
+ "package": "@microsoft/fast-element",
34
+ "commit": "a4982f452702a8fee67397767b603d4a67702b10",
35
+ "comment": "fix: prevent circular reference errors when stringifying DOM nodes controlled by FAST's rendering engine"
36
+ }
37
+ ]
38
+ }
39
+ },
4
40
  {
5
41
  "date": "Fri, 28 Oct 2022 20:44:44 GMT",
6
42
  "tag": "@microsoft/fast-element_v2.0.0-beta.16",
package/CHANGELOG.md CHANGED
@@ -1,9 +1,26 @@
1
1
  # Change Log - @microsoft/fast-element
2
2
 
3
- This log was last generated on Fri, 28 Oct 2022 20:44:44 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 15 Nov 2022 02:40:34 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.0.0-beta.18
8
+
9
+ Tue, 15 Nov 2022 02:40:34 GMT
10
+
11
+ ### Changes
12
+
13
+ - chore: move ViewBehaviorOrchestrator to utilities (roeisenb@microsoft.com)
14
+ - feat: add new DOM Policy protection throughout (roeisenb@microsoft.com)
15
+
16
+ ## 2.0.0-beta.17
17
+
18
+ Tue, 01 Nov 2022 23:26:26 GMT
19
+
20
+ ### Changes
21
+
22
+ - fix: prevent circular reference errors when stringifying DOM nodes controlled by FAST's rendering engine (roeisenb@microsoft.com)
23
+
7
24
  ## 2.0.0-beta.16
8
25
 
9
26
  Fri, 28 Oct 2022 20:44:44 GMT
@@ -125,6 +125,11 @@ export declare class ElementController<TElement extends HTMLElement = HTMLElemen
125
125
  * Only emits events if connected.
126
126
  */
127
127
  emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean;
128
+ /**
129
+ * Opts out of JSON stringification.
130
+ * @internal
131
+ */
132
+ toJSON: () => undefined;
128
133
  private renderTemplate;
129
134
  /**
130
135
  * Locates or creates a controller for the specified element.
@@ -0,0 +1,68 @@
1
+ import { DOMAspect, DOMPolicy, DOMSink } from "./dom.js";
2
+ import { TrustedTypesPolicy } from "./interfaces.js";
3
+ /**
4
+ * A specific DOM sink guard for a node aspect.
5
+ */
6
+ export declare type DOMSinkGuards = Record<string, (tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink) => DOMSink>;
7
+ /**
8
+ * Aspect-specific guards for a DOM Policy.
9
+ */
10
+ export declare type DOMAspectGuards = {
11
+ /**
12
+ * Guards for attributes.
13
+ */
14
+ [DOMAspect.attribute]?: DOMSinkGuards;
15
+ /**
16
+ * Guards for boolean attributes.
17
+ */
18
+ [DOMAspect.booleanAttribute]?: DOMSinkGuards;
19
+ /**
20
+ * Guards for properties.
21
+ */
22
+ [DOMAspect.property]?: DOMSinkGuards;
23
+ /**
24
+ * Guards for content.
25
+ */
26
+ [DOMAspect.content]?: DOMSinkGuards;
27
+ /**
28
+ * Guards for token list manipulation.
29
+ */
30
+ [DOMAspect.tokenList]?: DOMSinkGuards;
31
+ /**
32
+ * Guards for events.
33
+ */
34
+ [DOMAspect.event]?: DOMSinkGuards;
35
+ };
36
+ /**
37
+ * Element-specific guards for a DOM Policy.
38
+ */
39
+ export declare type DOMElementGuards = Record<string, DOMAspectGuards>;
40
+ /**
41
+ * Guard configuration for a DOM Policy.
42
+ */
43
+ export declare type DOMGuards = {
44
+ elements: DOMElementGuards;
45
+ aspects: DOMAspectGuards;
46
+ };
47
+ /**
48
+ * Options for creating a DOM Policy.
49
+ */
50
+ export declare type DOMPolicyOptions = {
51
+ /**
52
+ * The trusted type to use for HTML creation.
53
+ */
54
+ trustedType?: TrustedTypesPolicy;
55
+ /**
56
+ * The DOM guards used to override or extend the defaults.
57
+ */
58
+ guards?: Partial<DOMGuards>;
59
+ };
60
+ declare const DOMPolicy: Readonly<{
61
+ /**
62
+ * Creates a new DOM Policy object.
63
+ * @param options The options to use in creating the policy.
64
+ * @returns The newly created DOMPolicy.
65
+ */
66
+ create(options?: DOMPolicyOptions): Readonly<DOMPolicy>;
67
+ }>;
68
+ export { DOMPolicy };
@@ -0,0 +1,116 @@
1
+ import { Callable } from "./interfaces.js";
2
+ /**
3
+ * The type of HTML aspect to target.
4
+ * @public
5
+ */
6
+ export declare const DOMAspect: Readonly<{
7
+ /**
8
+ * Not aspected.
9
+ */
10
+ readonly none: 0;
11
+ /**
12
+ * An attribute.
13
+ */
14
+ readonly attribute: 1;
15
+ /**
16
+ * A boolean attribute.
17
+ */
18
+ readonly booleanAttribute: 2;
19
+ /**
20
+ * A property.
21
+ */
22
+ readonly property: 3;
23
+ /**
24
+ * Content
25
+ */
26
+ readonly content: 4;
27
+ /**
28
+ * A token list.
29
+ */
30
+ readonly tokenList: 5;
31
+ /**
32
+ * An event.
33
+ */
34
+ readonly event: 6;
35
+ }>;
36
+ /**
37
+ * The type of HTML aspect to target.
38
+ * @public
39
+ */
40
+ export declare type DOMAspect = typeof DOMAspect[Exclude<keyof typeof DOMAspect, "none">];
41
+ /**
42
+ * A function used to send values to a DOM sink.
43
+ * @public
44
+ */
45
+ export declare type DOMSink = (target: Node, aspectName: string, value: any, ...args: any[]) => void;
46
+ /**
47
+ * A security policy that FAST can use to interact with the DOM.
48
+ * @public
49
+ */
50
+ export interface DOMPolicy {
51
+ /**
52
+ * Creates safe HTML from the provided value.
53
+ * @param value - The source to convert to safe HTML.
54
+ */
55
+ createHTML(value: string): string;
56
+ /**
57
+ * Protects a DOM sink that intends to write to the DOM.
58
+ * @param tagName - The tag name for the element to write to.
59
+ * @param aspect - The aspect of the DOM to write to.
60
+ * @param aspectName - The name of the aspect to write to.
61
+ * @param sink - The sink that is used to write to the DOM.
62
+ */
63
+ protect(tagName: string | null, aspect: DOMAspect, aspectName: string, sink: DOMSink): DOMSink;
64
+ }
65
+ /**
66
+ * Common DOM APIs.
67
+ * @public
68
+ */
69
+ export declare const DOM: Readonly<{
70
+ /**
71
+ * @deprecated
72
+ * Use Updates.enqueue().
73
+ */
74
+ queueUpdate: (callable: Callable) => void;
75
+ /**
76
+ * @deprecated
77
+ * Use Updates.next()
78
+ */
79
+ nextUpdate: () => Promise<void>;
80
+ /**
81
+ * @deprecated
82
+ * Use Updates.process()
83
+ */
84
+ processUpdates: () => void;
85
+ /**
86
+ * Gets the dom policy used by the templating system.
87
+ */
88
+ readonly policy: DOMPolicy;
89
+ /**
90
+ * Sets the dom policy used by the templating system.
91
+ * @param policy - The policy to set.
92
+ * @remarks
93
+ * This API can only be called once, for security reasons. It should be
94
+ * called by the application developer at the start of their program.
95
+ */
96
+ setPolicy(value: DOMPolicy): void;
97
+ /**
98
+ * Sets an attribute value on an element.
99
+ * @param element - The element to set the attribute value on.
100
+ * @param attributeName - The attribute name to set.
101
+ * @param value - The value of the attribute to set.
102
+ * @remarks
103
+ * If the value is `null` or `undefined`, the attribute is removed, otherwise
104
+ * it is set to the provided value using the standard `setAttribute` API.
105
+ */
106
+ setAttribute(element: HTMLElement, attributeName: string, value: any): void;
107
+ /**
108
+ * Sets a boolean attribute value.
109
+ * @param element - The element to set the boolean attribute value on.
110
+ * @param attributeName - The attribute name to set.
111
+ * @param value - The value of the attribute to set.
112
+ * @remarks
113
+ * If the value is true, the attribute is added; otherwise it is removed.
114
+ */
115
+ setBooleanAttribute(element: HTMLElement, attributeName: string, value: boolean): void;
116
+ }>;
@@ -1,5 +1,6 @@
1
- export type { Callable, Constructable, Disposable, FASTGlobal, Mutable, StyleStrategy, StyleTarget, TrustedTypes, TrustedTypesPolicy, } from "./interfaces.js";
1
+ export type { Callable, Constructable, Disposable, FASTGlobal, Mutable, StyleStrategy, StyleTarget, } from "./interfaces.js";
2
2
  export * from "./platform.js";
3
+ export * from "./dom.js";
3
4
  export * from "./observation/observable.js";
4
5
  export * from "./observation/notifier.js";
5
6
  export * from "./observation/arrays.js";
@@ -8,7 +9,6 @@ export * from "./styles/element-styles.js";
8
9
  export * from "./styles/css.js";
9
10
  export * from "./styles/css-directive.js";
10
11
  export * from "./styles/host.js";
11
- export * from "./templating/dom.js";
12
12
  export * from "./templating/template.js";
13
13
  export * from "./templating/compiler.js";
14
14
  export { Markup, Parser } from "./templating/markup.js";
@@ -21,6 +21,7 @@ export * from "./templating/slotted.js";
21
21
  export * from "./templating/children.js";
22
22
  export * from "./templating/view.js";
23
23
  export * from "./templating/node-observation.js";
24
+ export * from "./templating/dangerous-html.js";
24
25
  export * from "./components/fast-element.js";
25
26
  export * from "./components/fast-definitions.js";
26
27
  export * from "./components/attributes.js";
@@ -1,2 +1 @@
1
- import "./polyfills.js";
2
1
  export * from "./index.js";
@@ -1,3 +1,2 @@
1
- import "./polyfills.js";
2
1
  import "./debug.js";
3
2
  export * from "./index.js";
@@ -44,29 +44,6 @@ export interface Disposable {
44
44
  export declare type Mutable<T> = {
45
45
  -readonly [P in keyof T]: T[P];
46
46
  };
47
- /**
48
- * A policy for use with the standard trustedTypes platform API.
49
- * @public
50
- */
51
- export declare type TrustedTypesPolicy = {
52
- /**
53
- * Creates trusted HTML.
54
- * @param html - The HTML to clear as trustworthy.
55
- */
56
- createHTML(html: string): string;
57
- };
58
- /**
59
- * Enables working with trusted types.
60
- * @public
61
- */
62
- export declare type TrustedTypes = {
63
- /**
64
- * Creates a trusted types policy.
65
- * @param name - The policy name.
66
- * @param rules - The policy rules implementation.
67
- */
68
- createPolicy(name: string, rules: TrustedTypesPolicy): TrustedTypesPolicy;
69
- };
70
47
  /**
71
48
  * The FAST global.
72
49
  * @internal
@@ -162,11 +139,14 @@ export interface StyleStrategy {
162
139
  */
163
140
  export declare const enum Message {
164
141
  needsArrayObservation = 1101,
165
- onlySetHTMLPolicyOnce = 1201,
142
+ onlySetDOMPolicyOnce = 1201,
166
143
  bindingInnerHTMLRequiresTrustedTypes = 1202,
167
144
  twoWayBindingRequiresObservables = 1203,
168
145
  hostBindingWithoutHost = 1204,
169
146
  unsupportedBindingBehavior = 1205,
147
+ directCallToHTMLTagNotAllowed = 1206,
148
+ onlySetTemplatePolicyOnce = 1207,
149
+ cannotSetTemplatePolicyAfterCompilation = 1208,
170
150
  missingElementDefinition = 1401,
171
151
  noRegistrationForContext = 1501,
172
152
  noFactoryForResolver = 1502,
@@ -195,3 +175,14 @@ export declare const isString: (object: any) => object is string;
195
175
  * @internal
196
176
  */
197
177
  export declare const noop: () => undefined;
178
+ /**
179
+ * A policy for use with the standard trustedTypes platform API.
180
+ * @public
181
+ */
182
+ export declare type TrustedTypesPolicy = {
183
+ /**
184
+ * Creates trusted HTML.
185
+ * @param html - The HTML to clear as trustworthy.
186
+ */
187
+ createHTML(html: string): string;
188
+ };
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +1,6 @@
1
1
  import type { Expression } from "../observation/observable.js";
2
2
  import type { Subscriber } from "../observation/notifier.js";
3
+ import type { DOMPolicy } from "../dom.js";
3
4
  import { Binding } from "./html-directive.js";
4
5
  export declare const Signal: Readonly<{
5
6
  subscribe(signal: string, subscriber: Subscriber): void;
@@ -15,7 +16,8 @@ export declare const Signal: Readonly<{
15
16
  * Creates a signal binding configuration with the supplied options.
16
17
  * @param expression - The binding to refresh when signaled.
17
18
  * @param options - The signal name or a binding to use to retrieve the signal name.
19
+ * @param policy - The security policy to associate with th binding.
18
20
  * @returns A binding configuration.
19
21
  * @public
20
22
  */
21
- export declare function signal<T = any>(expression: Expression<T>, options: string | Expression<T>): Binding<T>;
23
+ export declare function signal<T = any>(expression: Expression<T>, options: string | Expression<T>, policy?: DOMPolicy): Binding<T>;
@@ -1,3 +1,4 @@
1
+ import type { DOMPolicy } from "../dom.js";
1
2
  import { Expression } from "../observation/observable.js";
2
3
  import type { HTMLBindingDirective } from "./binding.js";
3
4
  import { Binding } from "./html-directive.js";
@@ -32,8 +33,9 @@ export declare const TwoWaySettings: Readonly<{
32
33
  * Creates a default binding.
33
34
  * @param expression - The binding to refresh when changed.
34
35
  * @param optionsOrChangeEvent - The binding options or the name of the change event to use.
36
+ * @param policy - The security policy to associate with the binding.
35
37
  * @param isBindingVolatile - Indicates whether the binding is volatile or not.
36
38
  * @returns A binding.
37
39
  * @public
38
40
  */
39
- export declare function twoWay<T = any>(expression: Expression<T>, optionsOrChangeEvent?: TwoWayBindingOptions | string, isBindingVolatile?: boolean): Binding<T>;
41
+ export declare function twoWay<T = any>(expression: Expression<T>, optionsOrChangeEvent?: TwoWayBindingOptions | string, policy?: DOMPolicy, isBindingVolatile?: boolean): Binding<T>;
@@ -1,5 +1,6 @@
1
1
  import { ExecutionContext, Expression, ExpressionObserver } from "../observation/observable.js";
2
- import { AddViewBehaviorFactory, Aspect, Aspected, Binding, HTMLDirective, ViewBehavior, ViewBehaviorFactory, ViewController } from "./html-directive.js";
2
+ import { DOMAspect, DOMPolicy } from "../dom.js";
3
+ import { AddViewBehaviorFactory, Aspected, Binding, HTMLDirective, ViewBehavior, ViewBehaviorFactory, ViewController } from "./html-directive.js";
3
4
  /**
4
5
  * A simple View that can be interpolated into HTML content.
5
6
  * @public
@@ -52,7 +53,15 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
52
53
  /**
53
54
  * The structural id of the DOM node to which the created behavior will apply.
54
55
  */
55
- nodeId: string;
56
+ targetNodeId: string;
57
+ /**
58
+ * The tagname associated with the target node.
59
+ */
60
+ targetTagName: string | null;
61
+ /**
62
+ * The policy that the created behavior must run under.
63
+ */
64
+ policy: DOMPolicy;
56
65
  /**
57
66
  * The original source aspect exactly as represented in markup.
58
67
  */
@@ -64,7 +73,7 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
64
73
  /**
65
74
  * The type of aspect to target.
66
75
  */
67
- aspectType: Aspect;
76
+ aspectType: DOMAspect;
68
77
  /**
69
78
  * Creates an instance of HTMLBindingDirective.
70
79
  * @param dataBinding - The binding configuration to apply.
@@ -91,18 +100,20 @@ export declare class HTMLBindingDirective implements HTMLDirective, ViewBehavior
91
100
  /**
92
101
  * Creates an standard binding.
93
102
  * @param expression - The binding to refresh when changed.
103
+ * @param policy - The security policy to associate with th binding.
94
104
  * @param isVolatile - Indicates whether the binding is volatile or not.
95
105
  * @returns A binding configuration.
96
106
  * @public
97
107
  */
98
- export declare function bind<T = any>(expression: Expression<T>, isVolatile?: boolean): Binding<T>;
108
+ export declare function bind<T = any>(expression: Expression<T>, policy?: DOMPolicy, isVolatile?: boolean): Binding<T>;
99
109
  /**
100
110
  * Creates a one time binding
101
111
  * @param expression - The binding to refresh when signaled.
112
+ * @param policy - The security policy to associate with th binding.
102
113
  * @returns A binding configuration.
103
114
  * @public
104
115
  */
105
- export declare function oneTime<T = any>(expression: Expression<T>): Binding<T>;
116
+ export declare function oneTime<T = any>(expression: Expression<T>, policy?: DOMPolicy): Binding<T>;
106
117
  /**
107
118
  * Creates an event listener binding.
108
119
  * @param expression - The binding to invoke when the event is raised.
@@ -1,4 +1,4 @@
1
- import { TrustedTypesPolicy } from "../interfaces.js";
1
+ import { DOMPolicy } from "../dom.js";
2
2
  import { ViewBehaviorFactory } from "./html-directive.js";
3
3
  import type { HTMLTemplateCompilationResult as TemplateCompilationResult } from "./template.js";
4
4
  /**
@@ -14,32 +14,29 @@ html: string | HTMLTemplateElement,
14
14
  /**
15
15
  * The behavior factories used within the html that is being compiled.
16
16
  */
17
- factories: Record<string, ViewBehaviorFactory>) => TemplateCompilationResult;
17
+ factories: Record<string, ViewBehaviorFactory>,
18
+ /**
19
+ * The security policy to compile the html with.
20
+ */
21
+ policy: DOMPolicy) => TemplateCompilationResult;
18
22
  /**
19
23
  * Common APIs related to compilation.
20
24
  * @public
21
25
  */
22
26
  export declare const Compiler: {
23
- /**
24
- * Sets the HTML trusted types policy used by the compiler.
25
- * @param policy - The policy to set for HTML.
26
- * @remarks
27
- * This API can only be called once, for security reasons. It should be
28
- * called by the application developer at the start of their program.
29
- */
30
- setHTMLPolicy(policy: TrustedTypesPolicy): void;
31
27
  /**
32
28
  * Compiles a template and associated directives into a compilation
33
29
  * result which can be used to create views.
34
30
  * @param html - The html string or template element to compile.
35
- * @param directives - The directives referenced by the template.
31
+ * @param factories - The behavior factories referenced by the template.
32
+ * @param policy - The security policy to compile the html with.
36
33
  * @remarks
37
34
  * The template that is provided for compilation is altered in-place
38
35
  * and cannot be compiled again. If the original template must be preserved,
39
36
  * it is recommended that you clone the original and pass the clone to this API.
40
37
  * @public
41
38
  */
42
- compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, directives: Record<string, ViewBehaviorFactory>): TemplateCompilationResult<TSource, TParent>;
39
+ compile<TSource = any, TParent = any>(html: string | HTMLTemplateElement, factories: Record<string, ViewBehaviorFactory>, policy?: DOMPolicy): TemplateCompilationResult<TSource, TParent>;
43
40
  /**
44
41
  * Sets the default compilation strategy that will be used by the ViewTemplate whenever
45
42
  * it needs to compile a view preprocessed with the html template function.
@@ -50,7 +47,8 @@ export declare const Compiler: {
50
47
  * Aggregates an array of strings and directives into a single directive.
51
48
  * @param parts - A heterogeneous array of static strings interspersed with
52
49
  * directives.
50
+ * @param policy - The security policy to use with the aggregated bindings.
53
51
  * @returns A single inline directive that aggregates the behavior of all the parts.
54
52
  */
55
- aggregate(parts: (string | ViewBehaviorFactory)[]): ViewBehaviorFactory;
53
+ aggregate(parts: (string | ViewBehaviorFactory)[], policy?: DOMPolicy): ViewBehaviorFactory;
56
54
  };
@@ -0,0 +1,18 @@
1
+ import { HTMLDirective } from "./html-directive.js";
2
+ import type { CaptureType } from "./template.js";
3
+ /**
4
+ * A directive capable of injecting static HTML platform runtime protection.
5
+ * @public
6
+ */
7
+ export declare class DangerousHTMLDirective implements HTMLDirective {
8
+ private html;
9
+ constructor(html: string);
10
+ createHTML(): string;
11
+ }
12
+ /**
13
+ * Injects static HTML without platform protection.
14
+ * @param html - The html to injection.
15
+ * @returns A DangerousHTMLDirective.
16
+ * @public
17
+ */
18
+ export declare function dangerousHTML<TSource = any, TParent = any>(html: string): CaptureType<TSource, TParent>;