@microsoft/fast-element 2.0.0-beta.2 → 2.0.0-beta.21

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 (115) hide show
  1. package/CHANGELOG.json +509 -0
  2. package/CHANGELOG.md +189 -1
  3. package/dist/dts/components/attributes.d.ts +15 -0
  4. package/dist/dts/components/{controller.d.ts → element-controller.d.ts} +74 -28
  5. package/dist/dts/components/fast-definitions.d.ts +41 -9
  6. package/dist/dts/components/fast-element.d.ts +14 -26
  7. package/dist/dts/components/hydration.d.ts +14 -0
  8. package/dist/{esm/observation/behavior.js → dts/components/install-hydration.d.ts} +0 -0
  9. package/dist/dts/context.d.ts +7 -7
  10. package/dist/dts/di/di.d.ts +894 -0
  11. package/dist/dts/dom-policy.d.ts +83 -0
  12. package/dist/dts/dom.d.ts +100 -0
  13. package/dist/dts/index.d.ts +5 -4
  14. package/dist/dts/index.rollup.d.ts +0 -1
  15. package/dist/dts/index.rollup.debug.d.ts +0 -1
  16. package/dist/dts/interfaces.d.ts +62 -80
  17. package/dist/dts/metadata.d.ts +5 -5
  18. package/dist/dts/observation/observable.d.ts +99 -54
  19. package/dist/dts/pending-task.d.ts +32 -0
  20. package/dist/dts/platform.d.ts +8 -1
  21. package/dist/dts/polyfills.d.ts +0 -8
  22. package/dist/dts/state/exports.d.ts +3 -0
  23. package/dist/dts/state/reactive.d.ts +8 -0
  24. package/dist/dts/state/state.d.ts +141 -0
  25. package/dist/dts/state/visitor.d.ts +6 -0
  26. package/dist/dts/state/watch.d.ts +10 -0
  27. package/dist/dts/styles/css-directive.d.ts +2 -2
  28. package/dist/dts/styles/css.d.ts +0 -5
  29. package/dist/dts/styles/element-styles.d.ts +10 -17
  30. package/dist/dts/styles/host.d.ts +68 -0
  31. package/dist/dts/styles/style-strategy.d.ts +42 -0
  32. package/dist/dts/templating/binding-signal.d.ts +12 -27
  33. package/dist/dts/templating/binding-two-way.d.ts +22 -37
  34. package/dist/dts/templating/binding.d.ts +76 -208
  35. package/dist/dts/templating/children.d.ts +1 -1
  36. package/dist/dts/templating/compiler.d.ts +11 -13
  37. package/dist/dts/templating/html-directive.d.ts +91 -97
  38. package/dist/dts/templating/node-observation.d.ts +15 -6
  39. package/dist/dts/templating/ref.d.ts +7 -11
  40. package/dist/dts/templating/render.d.ts +296 -0
  41. package/dist/dts/templating/repeat.d.ts +23 -34
  42. package/dist/dts/templating/slotted.d.ts +1 -1
  43. package/dist/dts/templating/template.d.ts +92 -14
  44. package/dist/dts/templating/view.d.ts +81 -11
  45. package/dist/dts/templating/when.d.ts +3 -3
  46. package/dist/dts/testing/exports.d.ts +3 -0
  47. package/dist/dts/testing/fakes.d.ts +14 -0
  48. package/dist/dts/testing/fixture.d.ts +84 -0
  49. package/dist/dts/testing/timeout.d.ts +7 -0
  50. package/dist/dts/utilities.d.ts +55 -19
  51. package/dist/esm/components/attributes.js +28 -5
  52. package/dist/esm/components/{controller.js → element-controller.js} +238 -137
  53. package/dist/esm/components/fast-definitions.js +38 -30
  54. package/dist/esm/components/fast-element.js +27 -16
  55. package/dist/esm/components/hydration.js +35 -0
  56. package/dist/esm/components/install-hydration.js +2 -0
  57. package/dist/esm/context.js +7 -3
  58. package/dist/esm/debug.js +41 -5
  59. package/dist/esm/di/di.js +1430 -0
  60. package/dist/esm/dom-policy.js +345 -0
  61. package/dist/esm/dom.js +101 -0
  62. package/dist/esm/index.js +4 -2
  63. package/dist/esm/index.rollup.debug.js +3 -1
  64. package/dist/esm/index.rollup.js +3 -1
  65. package/dist/esm/interfaces.js +52 -0
  66. package/dist/esm/metadata.js +9 -8
  67. package/dist/esm/observation/arrays.js +303 -2
  68. package/dist/esm/observation/observable.js +88 -142
  69. package/dist/esm/observation/update-queue.js +2 -2
  70. package/dist/esm/pending-task.js +28 -0
  71. package/dist/esm/platform.js +28 -3
  72. package/dist/esm/polyfills.js +3 -61
  73. package/dist/esm/state/exports.js +3 -0
  74. package/dist/esm/state/reactive.js +34 -0
  75. package/dist/esm/state/state.js +148 -0
  76. package/dist/esm/state/visitor.js +28 -0
  77. package/dist/esm/state/watch.js +36 -0
  78. package/dist/esm/styles/css.js +4 -9
  79. package/dist/esm/styles/element-styles.js +14 -33
  80. package/dist/esm/styles/host.js +1 -0
  81. package/dist/esm/styles/style-strategy.js +1 -0
  82. package/dist/esm/templating/binding-signal.js +67 -62
  83. package/dist/esm/templating/binding-two-way.js +72 -39
  84. package/dist/esm/templating/binding.js +142 -286
  85. package/dist/esm/templating/children.js +8 -4
  86. package/dist/esm/templating/compiler.js +59 -43
  87. package/dist/esm/templating/html-directive.js +56 -75
  88. package/dist/esm/templating/node-observation.js +20 -13
  89. package/dist/esm/templating/ref.js +4 -12
  90. package/dist/esm/templating/render.js +402 -0
  91. package/dist/esm/templating/repeat.js +88 -75
  92. package/dist/esm/templating/template.js +132 -60
  93. package/dist/esm/templating/view.js +113 -29
  94. package/dist/esm/templating/when.js +5 -4
  95. package/dist/esm/testing/exports.js +3 -0
  96. package/dist/esm/testing/fakes.js +107 -0
  97. package/dist/esm/testing/fixture.js +86 -0
  98. package/dist/esm/testing/timeout.js +24 -0
  99. package/dist/esm/utilities.js +97 -96
  100. package/dist/fast-element.api.json +9741 -8201
  101. package/dist/fast-element.d.ts +889 -646
  102. package/dist/fast-element.debug.js +2001 -1167
  103. package/dist/fast-element.debug.min.js +1 -1
  104. package/dist/fast-element.js +1907 -1109
  105. package/dist/fast-element.min.js +1 -1
  106. package/dist/fast-element.untrimmed.d.ts +913 -703
  107. package/docs/api-report.md +331 -258
  108. package/package.json +38 -16
  109. package/dist/dts/hooks.d.ts +0 -20
  110. package/dist/dts/observation/behavior.d.ts +0 -19
  111. package/dist/dts/observation/splice-strategies.d.ts +0 -13
  112. package/dist/dts/templating/dom.d.ts +0 -41
  113. package/dist/esm/hooks.js +0 -32
  114. package/dist/esm/observation/splice-strategies.js +0 -400
  115. package/dist/esm/templating/dom.js +0 -49
@@ -0,0 +1,345 @@
1
+ import { DOMAspect } from "./dom.js";
2
+ import { isString } from "./interfaces.js";
3
+ import { FAST } from "./platform.js";
4
+ function safeURL(tagName, aspect, aspectName, sink) {
5
+ return (target, name, value, ...rest) => {
6
+ if (isString(value)) {
7
+ value = value.replace("javascript:", "");
8
+ }
9
+ sink(target, name, value, ...rest);
10
+ };
11
+ }
12
+ function block(tagName, aspect, aspectName, sink) {
13
+ throw FAST.error(1209 /* Message.blockedByDOMPolicy */, {
14
+ aspectName,
15
+ tagName: tagName !== null && tagName !== void 0 ? tagName : "text",
16
+ });
17
+ }
18
+ const defaultDOMElementGuards = {
19
+ a: {
20
+ [DOMAspect.attribute]: {
21
+ href: safeURL,
22
+ },
23
+ [DOMAspect.property]: {
24
+ href: safeURL,
25
+ },
26
+ },
27
+ area: {
28
+ [DOMAspect.attribute]: {
29
+ href: safeURL,
30
+ },
31
+ [DOMAspect.property]: {
32
+ href: safeURL,
33
+ },
34
+ },
35
+ button: {
36
+ [DOMAspect.attribute]: {
37
+ formaction: safeURL,
38
+ },
39
+ [DOMAspect.property]: {
40
+ formAction: safeURL,
41
+ },
42
+ },
43
+ embed: {
44
+ [DOMAspect.attribute]: {
45
+ src: block,
46
+ },
47
+ [DOMAspect.property]: {
48
+ src: block,
49
+ },
50
+ },
51
+ form: {
52
+ [DOMAspect.attribute]: {
53
+ action: safeURL,
54
+ },
55
+ [DOMAspect.property]: {
56
+ action: safeURL,
57
+ },
58
+ },
59
+ frame: {
60
+ [DOMAspect.attribute]: {
61
+ src: safeURL,
62
+ },
63
+ [DOMAspect.property]: {
64
+ src: safeURL,
65
+ },
66
+ },
67
+ iframe: {
68
+ [DOMAspect.attribute]: {
69
+ src: safeURL,
70
+ },
71
+ [DOMAspect.property]: {
72
+ src: safeURL,
73
+ srcdoc: block,
74
+ },
75
+ },
76
+ input: {
77
+ [DOMAspect.attribute]: {
78
+ formaction: safeURL,
79
+ },
80
+ [DOMAspect.property]: {
81
+ formAction: safeURL,
82
+ },
83
+ },
84
+ link: {
85
+ [DOMAspect.attribute]: {
86
+ href: block,
87
+ },
88
+ [DOMAspect.property]: {
89
+ href: block,
90
+ },
91
+ },
92
+ object: {
93
+ [DOMAspect.attribute]: {
94
+ codebase: block,
95
+ data: block,
96
+ },
97
+ [DOMAspect.property]: {
98
+ codeBase: block,
99
+ data: block,
100
+ },
101
+ },
102
+ script: {
103
+ [DOMAspect.attribute]: {
104
+ src: block,
105
+ text: block,
106
+ },
107
+ [DOMAspect.property]: {
108
+ src: block,
109
+ text: block,
110
+ innerText: block,
111
+ textContent: block,
112
+ },
113
+ },
114
+ style: {
115
+ [DOMAspect.property]: {
116
+ innerText: block,
117
+ textContent: block,
118
+ },
119
+ },
120
+ };
121
+ const blockedEvents = {
122
+ onabort: block,
123
+ onauxclick: block,
124
+ onbeforeinput: block,
125
+ onbeforematch: block,
126
+ onblur: block,
127
+ oncancel: block,
128
+ oncanplay: block,
129
+ oncanplaythrough: block,
130
+ onchange: block,
131
+ onclick: block,
132
+ onclose: block,
133
+ oncontextlost: block,
134
+ oncontextmenu: block,
135
+ oncontextrestored: block,
136
+ oncopy: block,
137
+ oncuechange: block,
138
+ oncut: block,
139
+ ondblclick: block,
140
+ ondrag: block,
141
+ ondragend: block,
142
+ ondragenter: block,
143
+ ondragleave: block,
144
+ ondragover: block,
145
+ ondragstart: block,
146
+ ondrop: block,
147
+ ondurationchange: block,
148
+ onemptied: block,
149
+ onended: block,
150
+ onerror: block,
151
+ onfocus: block,
152
+ onformdata: block,
153
+ oninput: block,
154
+ oninvalid: block,
155
+ onkeydown: block,
156
+ onkeypress: block,
157
+ onkeyup: block,
158
+ onload: block,
159
+ onloadeddata: block,
160
+ onloadedmetadata: block,
161
+ onloadstart: block,
162
+ onmousedown: block,
163
+ onmouseenter: block,
164
+ onmouseleave: block,
165
+ onmousemove: block,
166
+ onmouseout: block,
167
+ onmouseover: block,
168
+ onmouseup: block,
169
+ onpaste: block,
170
+ onpause: block,
171
+ onplay: block,
172
+ onplaying: block,
173
+ onprogress: block,
174
+ onratechange: block,
175
+ onreset: block,
176
+ onresize: block,
177
+ onscroll: block,
178
+ onsecuritypolicyviolation: block,
179
+ onseeked: block,
180
+ onseeking: block,
181
+ onselect: block,
182
+ onslotchange: block,
183
+ onstalled: block,
184
+ onsubmit: block,
185
+ onsuspend: block,
186
+ ontimeupdate: block,
187
+ ontoggle: block,
188
+ onvolumechange: block,
189
+ onwaiting: block,
190
+ onwebkitanimationend: block,
191
+ onwebkitanimationiteration: block,
192
+ onwebkitanimationstart: block,
193
+ onwebkittransitionend: block,
194
+ onwheel: block,
195
+ };
196
+ const defaultDOMGuards = {
197
+ elements: defaultDOMElementGuards,
198
+ aspects: {
199
+ [DOMAspect.attribute]: Object.assign({}, blockedEvents),
200
+ [DOMAspect.property]: Object.assign({ innerHTML: block }, blockedEvents),
201
+ [DOMAspect.event]: Object.assign({}, blockedEvents),
202
+ },
203
+ };
204
+ function createDomSinkGuards(config, defaults) {
205
+ const result = {};
206
+ for (const name in defaults) {
207
+ const overrideValue = config[name];
208
+ const defaultValue = defaults[name];
209
+ switch (overrideValue) {
210
+ case null:
211
+ // remove the default
212
+ break;
213
+ case undefined:
214
+ // keep the default
215
+ result[name] = defaultValue;
216
+ break;
217
+ default:
218
+ // override the default
219
+ result[name] = overrideValue;
220
+ break;
221
+ }
222
+ }
223
+ // add any new sinks that were not overrides
224
+ for (const name in config) {
225
+ if (!(name in result)) {
226
+ result[name] = config[name];
227
+ }
228
+ }
229
+ return Object.freeze(result);
230
+ }
231
+ function createDOMAspectGuards(config, defaults) {
232
+ const result = {};
233
+ for (const aspect in defaults) {
234
+ const overrideValue = config[aspect];
235
+ const defaultValue = defaults[aspect];
236
+ switch (overrideValue) {
237
+ case null:
238
+ // remove the default
239
+ break;
240
+ case undefined:
241
+ // keep the default
242
+ result[aspect] = createDomSinkGuards(defaultValue, {});
243
+ break;
244
+ default:
245
+ // override the default
246
+ result[aspect] = createDomSinkGuards(overrideValue, defaultValue);
247
+ break;
248
+ }
249
+ }
250
+ // add any new aspect guards that were not overrides
251
+ for (const aspect in config) {
252
+ if (!(aspect in result)) {
253
+ result[aspect] = createDomSinkGuards(config[aspect], {});
254
+ }
255
+ }
256
+ return Object.freeze(result);
257
+ }
258
+ function createElementGuards(config, defaults) {
259
+ const result = {};
260
+ for (const tag in defaults) {
261
+ const overrideValue = config[tag];
262
+ const defaultValue = defaults[tag];
263
+ switch (overrideValue) {
264
+ case null:
265
+ // remove the default
266
+ break;
267
+ case undefined:
268
+ // keep the default
269
+ result[tag] = createDOMAspectGuards(overrideValue, {});
270
+ break;
271
+ default:
272
+ // override the default aspects
273
+ result[tag] = createDOMAspectGuards(overrideValue, defaultValue);
274
+ break;
275
+ }
276
+ }
277
+ // Add any new element guards that were not overrides
278
+ for (const tag in config) {
279
+ if (!(tag in result)) {
280
+ result[tag] = createDOMAspectGuards(config[tag], {});
281
+ }
282
+ }
283
+ return Object.freeze(result);
284
+ }
285
+ function createDOMGuards(config, defaults) {
286
+ return Object.freeze({
287
+ elements: config.elements
288
+ ? createElementGuards(config.elements, defaults.elements)
289
+ : defaults.elements,
290
+ aspects: config.aspects
291
+ ? createDOMAspectGuards(config.aspects, defaults.aspects)
292
+ : defaults.aspects,
293
+ });
294
+ }
295
+ function createTrustedType() {
296
+ const createHTML = html => html;
297
+ return globalThis.trustedTypes
298
+ ? globalThis.trustedTypes.createPolicy("fast-html", { createHTML })
299
+ : { createHTML };
300
+ }
301
+ function tryGuard(aspectGuards, tagName, aspect, aspectName, sink) {
302
+ const sinkGuards = aspectGuards[aspect];
303
+ if (sinkGuards) {
304
+ const guard = sinkGuards[aspectName];
305
+ if (guard) {
306
+ return guard(tagName, aspect, aspectName, sink);
307
+ }
308
+ }
309
+ }
310
+ /**
311
+ * A helper for creating DOM policies.
312
+ * @public
313
+ */
314
+ const DOMPolicy = Object.freeze({
315
+ /**
316
+ * Creates a new DOM Policy object.
317
+ * @param options The options to use in creating the policy.
318
+ * @returns The newly created DOMPolicy.
319
+ */
320
+ create(options = {}) {
321
+ var _a, _b;
322
+ const trustedType = (_a = options.trustedType) !== null && _a !== void 0 ? _a : createTrustedType();
323
+ const guards = createDOMGuards((_b = options.guards) !== null && _b !== void 0 ? _b : {}, defaultDOMGuards);
324
+ return Object.freeze({
325
+ createHTML(value) {
326
+ return trustedType.createHTML(value);
327
+ },
328
+ protect(tagName, aspect, aspectName, sink) {
329
+ var _a;
330
+ // Check for element-specific guards.
331
+ const key = (tagName !== null && tagName !== void 0 ? tagName : "").toLowerCase();
332
+ const elementGuards = guards.elements[key];
333
+ if (elementGuards) {
334
+ const guard = tryGuard(elementGuards, tagName, aspect, aspectName, sink);
335
+ if (guard) {
336
+ return guard;
337
+ }
338
+ }
339
+ // Check for guards applicable to all nodes.
340
+ return ((_a = tryGuard(guards.aspects, tagName, aspect, aspectName, sink)) !== null && _a !== void 0 ? _a : sink);
341
+ },
342
+ });
343
+ },
344
+ });
345
+ export { DOMPolicy };
@@ -0,0 +1,101 @@
1
+ import "./interfaces.js";
2
+ import { FAST } from "./platform.js";
3
+ /**
4
+ * The type of HTML aspect to target.
5
+ * @public
6
+ */
7
+ export const DOMAspect = Object.freeze({
8
+ /**
9
+ * Not aspected.
10
+ */
11
+ none: 0,
12
+ /**
13
+ * An attribute.
14
+ */
15
+ attribute: 1,
16
+ /**
17
+ * A boolean attribute.
18
+ */
19
+ booleanAttribute: 2,
20
+ /**
21
+ * A property.
22
+ */
23
+ property: 3,
24
+ /**
25
+ * Content
26
+ */
27
+ content: 4,
28
+ /**
29
+ * A token list.
30
+ */
31
+ tokenList: 5,
32
+ /**
33
+ * An event.
34
+ */
35
+ event: 6,
36
+ });
37
+ const createHTML = html => html;
38
+ const fastTrustedType = globalThis.trustedTypes
39
+ ? globalThis.trustedTypes.createPolicy("fast-html", { createHTML })
40
+ : { createHTML };
41
+ let defaultPolicy = Object.freeze({
42
+ createHTML(value) {
43
+ return fastTrustedType.createHTML(value);
44
+ },
45
+ protect(tagName, aspect, aspectName, sink) {
46
+ return sink;
47
+ },
48
+ });
49
+ const fastPolicy = defaultPolicy;
50
+ /**
51
+ * Common DOM APIs.
52
+ * @public
53
+ */
54
+ export const DOM = Object.freeze({
55
+ /**
56
+ * Gets the dom policy used by the templating system.
57
+ */
58
+ get policy() {
59
+ return defaultPolicy;
60
+ },
61
+ /**
62
+ * Sets the dom policy used by the templating system.
63
+ * @param policy - The policy to set.
64
+ * @remarks
65
+ * This API can only be called once, for security reasons. It should be
66
+ * called by the application developer at the start of their program.
67
+ */
68
+ setPolicy(value) {
69
+ if (defaultPolicy !== fastPolicy) {
70
+ throw FAST.error(1201 /* Message.onlySetDOMPolicyOnce */);
71
+ }
72
+ defaultPolicy = value;
73
+ },
74
+ /**
75
+ * Sets an attribute value on an element.
76
+ * @param element - The element to set the attribute value on.
77
+ * @param attributeName - The attribute name to set.
78
+ * @param value - The value of the attribute to set.
79
+ * @remarks
80
+ * If the value is `null` or `undefined`, the attribute is removed, otherwise
81
+ * it is set to the provided value using the standard `setAttribute` API.
82
+ */
83
+ setAttribute(element, attributeName, value) {
84
+ value === null || value === undefined
85
+ ? element.removeAttribute(attributeName)
86
+ : element.setAttribute(attributeName, value);
87
+ },
88
+ /**
89
+ * Sets a boolean attribute value.
90
+ * @param element - The element to set the boolean attribute value on.
91
+ * @param attributeName - The attribute name to set.
92
+ * @param value - The value of the attribute to set.
93
+ * @remarks
94
+ * If the value is true, the attribute is added; otherwise it is removed.
95
+ */
96
+ setBooleanAttribute(element, attributeName, value) {
97
+ value
98
+ ? element.setAttribute(attributeName, "")
99
+ : element.removeAttribute(attributeName);
100
+ },
101
+ });
package/dist/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./platform.js";
2
+ export * from "./dom.js";
2
3
  // Observation
3
4
  export * from "./observation/observable.js";
4
5
  export * from "./observation/notifier.js";
@@ -8,8 +9,9 @@ export * from "./observation/update-queue.js";
8
9
  export * from "./styles/element-styles.js";
9
10
  export * from "./styles/css.js";
10
11
  export * from "./styles/css-directive.js";
12
+ export * from "./styles/host.js";
13
+ export * from "./styles/style-strategy.js";
11
14
  // Templating
12
- export * from "./templating/dom.js";
13
15
  export * from "./templating/template.js";
14
16
  export * from "./templating/compiler.js";
15
17
  export { Markup, Parser } from "./templating/markup.js";
@@ -26,4 +28,4 @@ export * from "./templating/node-observation.js";
26
28
  export * from "./components/fast-element.js";
27
29
  export * from "./components/fast-definitions.js";
28
30
  export * from "./components/attributes.js";
29
- export * from "./components/controller.js";
31
+ export { ElementController, } from "./components/element-controller.js";
@@ -1,3 +1,5 @@
1
- import "./polyfills.js";
2
1
  import "./debug.js";
2
+ import { DOMPolicy } from "./dom-policy.js";
3
+ import { DOM } from "./dom.js";
3
4
  export * from "./index.js";
5
+ DOM.setPolicy(DOMPolicy.create());
@@ -1,2 +1,4 @@
1
- import "./polyfills.js";
1
+ import { DOMPolicy } from "./dom-policy.js";
2
+ import { DOM } from "./dom.js";
2
3
  export * from "./index.js";
4
+ DOM.setPolicy(DOMPolicy.create());
@@ -1,8 +1,60 @@
1
+ let kernelMode;
2
+ const kernelAttr = "fast-kernel";
3
+ try {
4
+ if (document.currentScript) {
5
+ kernelMode = document.currentScript.getAttribute(kernelAttr);
6
+ }
7
+ else {
8
+ const scripts = document.getElementsByTagName("script");
9
+ const currentScript = scripts[scripts.length - 1];
10
+ kernelMode = currentScript.getAttribute(kernelAttr);
11
+ }
12
+ }
13
+ catch (e) {
14
+ kernelMode = "isolate";
15
+ }
16
+ let KernelServiceId;
17
+ switch (kernelMode) {
18
+ case "share": // share the kernel across major versions
19
+ KernelServiceId = Object.freeze({
20
+ updateQueue: 1,
21
+ observable: 2,
22
+ contextEvent: 3,
23
+ elementRegistry: 4,
24
+ });
25
+ break;
26
+ case "share-v2": // only share the kernel with other v2 instances
27
+ KernelServiceId = Object.freeze({
28
+ updateQueue: 1.2,
29
+ observable: 2.2,
30
+ contextEvent: 3.2,
31
+ elementRegistry: 4.2,
32
+ });
33
+ break;
34
+ default:
35
+ // fully isolate the kernel from all other FAST instances
36
+ const postfix = `-${Math.random().toString(36).substring(2, 8)}`;
37
+ KernelServiceId = Object.freeze({
38
+ updateQueue: `1.2${postfix}`,
39
+ observable: `2.2${postfix}`,
40
+ contextEvent: `3.2${postfix}`,
41
+ elementRegistry: `4.2${postfix}`,
42
+ });
43
+ break;
44
+ }
45
+ export { KernelServiceId };
1
46
  /**
47
+ * Determines whether or not an object is a function.
2
48
  * @internal
3
49
  */
4
50
  export const isFunction = (object) => typeof object === "function";
5
51
  /**
52
+ * Determines whether or not an object is a string.
6
53
  * @internal
7
54
  */
8
55
  export const isString = (object) => typeof object === "string";
56
+ /**
57
+ * A function which does nothing.
58
+ * @internal
59
+ */
60
+ export const noop = () => void 0;
@@ -22,6 +22,7 @@ if (!("metadata" in Reflect)) {
22
22
  return void 0;
23
23
  };
24
24
  }
25
+ const annotationParamTypesKey = "annotation:paramtypes";
25
26
  /**
26
27
  * Provides basic metadata capabilities used by Context and Dependency Injection.
27
28
  */
@@ -31,29 +32,29 @@ export const Metadata = Object.freeze({
31
32
  * @param Type - The type to get the metadata for.
32
33
  * @returns The metadata array or a frozen empty array if no metadata is found.
33
34
  */
34
- getDesignParamTypes: Type => {
35
+ getDesignParamTypes: (Type) => {
35
36
  var _a;
36
- return (_a = Reflect.getOwnMetadata("design:paramtypes", Type)) !== null && _a !== void 0 ? _a : emptyArray;
37
+ return ((_a = Reflect.getOwnMetadata("design:paramtypes", Type)) !== null && _a !== void 0 ? _a : emptyArray);
37
38
  },
38
39
  /**
39
40
  * Gets the "annotation:paramtypes" metadata for the specified type.
40
41
  * @param Type - The type to get the metadata for.
41
42
  * @returns The metadata array or a frozen empty array if no metadata is found.
42
43
  */
43
- getAnnotationParamTypes: Type => {
44
+ getAnnotationParamTypes: (Type) => {
44
45
  var _a;
45
- return (_a = Reflect.getOwnMetadata("annotation:paramtypes", Type)) !== null && _a !== void 0 ? _a : emptyArray;
46
+ return ((_a = Reflect.getOwnMetadata(annotationParamTypesKey, Type)) !== null && _a !== void 0 ? _a : emptyArray);
46
47
  },
47
48
  /**
48
- *
49
- * @param Type - Gets the "annotation:paramtypes" metadata for the specified type. If none is found,
49
+ * Gets the "annotation:paramtypes" metadata for the specified type. If none is found,
50
50
  * an empty, mutable metadata array is created and added.
51
- * @returns The metadata array.
51
+ * @param Type - The type to get or create the metadata for.
52
+ * @returns A mutable metadata array.
52
53
  */
53
54
  getOrCreateAnnotationParamTypes(Type) {
54
55
  let types = this.getAnnotationParamTypes(Type);
55
56
  if (types === emptyArray) {
56
- Reflect.defineMetadata("annotation:paramtypes", (types = []), Type);
57
+ Reflect.defineMetadata(annotationParamTypesKey, (types = []), Type);
57
58
  }
58
59
  return types;
59
60
  },