@swisspost/design-system-components 1.0.0-beta.2 → 1.2.0

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 (111) hide show
  1. package/README.md +15 -23
  2. package/dist/cjs/{index-5c30acf6.js → index-8880977f.js} +588 -154
  3. package/dist/cjs/index-8880977f.js.map +1 -0
  4. package/dist/cjs/index.cjs.js +2 -0
  5. package/dist/cjs/index.cjs.js.map +1 -0
  6. package/dist/cjs/loader.cjs.js +6 -3
  7. package/dist/cjs/loader.cjs.js.map +1 -0
  8. package/dist/cjs/post-collapsible.cjs.entry.js +134 -0
  9. package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -0
  10. package/dist/cjs/post-components.cjs.js +12 -3
  11. package/dist/cjs/post-components.cjs.js.map +1 -0
  12. package/dist/cjs/post-icon.cjs.entry.js +142 -0
  13. package/dist/cjs/post-icon.cjs.entry.js.map +1 -0
  14. package/dist/cjs/property-checkers-586ad9d4.js +40 -0
  15. package/dist/cjs/property-checkers-586ad9d4.js.map +1 -0
  16. package/dist/collection/collection-manifest.json +4 -3
  17. package/dist/collection/components/post-collapsible/post-collapsible.css +17142 -0
  18. package/dist/collection/components/post-collapsible/post-collapsible.js +173 -0
  19. package/dist/collection/components/post-collapsible/post-collapsible.js.map +1 -0
  20. package/dist/collection/components/post-icon/post-icon.css +94 -0
  21. package/dist/collection/components/post-icon/post-icon.js +291 -0
  22. package/dist/collection/components/post-icon/post-icon.js.map +1 -0
  23. package/dist/collection/index.js +1 -0
  24. package/dist/collection/index.js.map +1 -0
  25. package/dist/collection/utils/get-element-height.js +15 -0
  26. package/dist/collection/utils/get-element-height.js.map +1 -0
  27. package/dist/collection/utils/index.js +8 -0
  28. package/dist/collection/utils/index.js.map +1 -0
  29. package/dist/collection/utils/on-transition-end.js +18 -0
  30. package/dist/collection/utils/on-transition-end.js.map +1 -0
  31. package/dist/collection/utils/property-checkers.js +31 -0
  32. package/dist/collection/utils/property-checkers.js.map +1 -0
  33. package/dist/collection/utils/should-reduce-motion.js +7 -0
  34. package/dist/collection/utils/should-reduce-motion.js.map +1 -0
  35. package/dist/components/index.d.ts +9 -4
  36. package/dist/components/index.js +3 -2
  37. package/dist/components/index.js.map +1 -0
  38. package/dist/components/post-collapsible.d.ts +11 -0
  39. package/dist/components/post-collapsible.js +158 -0
  40. package/dist/components/post-collapsible.js.map +1 -0
  41. package/dist/components/{my-component.d.ts → post-icon.d.ts} +4 -4
  42. package/dist/components/post-icon.js +168 -0
  43. package/dist/components/post-icon.js.map +1 -0
  44. package/dist/components/property-checkers.js +34 -0
  45. package/dist/components/property-checkers.js.map +1 -0
  46. package/dist/docs.d.ts +24 -0
  47. package/dist/docs.json +153 -41
  48. package/dist/esm/{index-865c32d6.js → index-6d5a72fa.js} +586 -154
  49. package/dist/esm/index-6d5a72fa.js.map +1 -0
  50. package/dist/esm/index.js +2 -0
  51. package/dist/esm/index.js.map +1 -0
  52. package/dist/esm/loader.js +6 -3
  53. package/dist/esm/loader.js.map +1 -0
  54. package/dist/esm/polyfills/css-shim.js +1 -1
  55. package/dist/esm/post-collapsible.entry.js +130 -0
  56. package/dist/esm/post-collapsible.entry.js.map +1 -0
  57. package/dist/esm/post-components.js +9 -3
  58. package/dist/esm/post-components.js.map +1 -0
  59. package/dist/esm/post-icon.entry.js +138 -0
  60. package/dist/esm/post-icon.entry.js.map +1 -0
  61. package/dist/esm/property-checkers-484ca671.js +34 -0
  62. package/dist/esm/property-checkers-484ca671.js.map +1 -0
  63. package/dist/post-components/index.esm.js +2 -0
  64. package/dist/post-components/index.esm.js.map +1 -0
  65. package/dist/post-components/p-6588c1b7.entry.js +2 -0
  66. package/dist/post-components/p-6588c1b7.entry.js.map +1 -0
  67. package/dist/post-components/p-7cd9c1ad.js +2 -0
  68. package/dist/post-components/p-7cd9c1ad.js.map +1 -0
  69. package/dist/post-components/p-a93114b9.js +3 -0
  70. package/dist/post-components/p-a93114b9.js.map +1 -0
  71. package/dist/post-components/p-b07185a3.entry.js +2 -0
  72. package/dist/post-components/p-b07185a3.entry.js.map +1 -0
  73. package/dist/post-components/post-components.esm.js +2 -1
  74. package/dist/post-components/post-components.esm.js.map +1 -0
  75. package/dist/types/components/post-collapsible/post-collapsible.d.ts +30 -0
  76. package/dist/types/components/post-icon/post-icon.d.ts +50 -0
  77. package/dist/types/components.d.ts +96 -28
  78. package/dist/types/stencil-public-runtime.d.ts +91 -19
  79. package/dist/types/utils/get-element-height.d.ts +3 -0
  80. package/dist/types/utils/index.d.ts +4 -0
  81. package/dist/types/utils/on-transition-end.d.ts +1 -0
  82. package/dist/types/utils/property-checkers.d.ts +5 -0
  83. package/dist/types/utils/should-reduce-motion.d.ts +1 -0
  84. package/loader/index.d.ts +9 -0
  85. package/package.json +18 -38
  86. package/dist/cjs/my-component.cjs.entry.js +0 -35
  87. package/dist/collection/components/my-component/my-component.css +0 -3
  88. package/dist/collection/components/my-component/my-component.js +0 -129
  89. package/dist/collection/components/my-component/my-component.stories.js +0 -19
  90. package/dist/collection/stories/Button.js +0 -21
  91. package/dist/collection/stories/Button.stories.js +0 -48
  92. package/dist/collection/stories/Header.js +0 -45
  93. package/dist/collection/stories/Header.stories.js +0 -20
  94. package/dist/collection/stories/Page.js +0 -67
  95. package/dist/collection/stories/Page.stories.js +0 -24
  96. package/dist/collection/stories/assets/code-brackets.svg +0 -1
  97. package/dist/collection/stories/assets/colors.svg +0 -1
  98. package/dist/collection/stories/assets/comments.svg +0 -1
  99. package/dist/collection/stories/assets/direction.svg +0 -1
  100. package/dist/collection/stories/assets/flow.svg +0 -1
  101. package/dist/collection/stories/assets/plugin.svg +0 -1
  102. package/dist/collection/stories/assets/repo.svg +0 -1
  103. package/dist/collection/stories/assets/stackalt.svg +0 -1
  104. package/dist/collection/utils/utils.js +0 -3
  105. package/dist/components/my-component.js +0 -54
  106. package/dist/esm/my-component.entry.js +0 -31
  107. package/dist/post-components/p-89fc10d3.js +0 -2
  108. package/dist/post-components/p-e4e802f7.entry.js +0 -1
  109. package/dist/types/components/my-component/my-component.d.ts +0 -22
  110. package/dist/types/components/my-component/my-component.stories.d.ts +0 -12
  111. package/dist/types/utils/utils.d.ts +0 -1
@@ -1,30 +1,17 @@
1
1
  const NAMESPACE = 'post-components';
2
2
 
3
+ /**
4
+ * Virtual DOM patching algorithm based on Snabbdom by
5
+ * Simon Friis Vindum (@paldepind)
6
+ * Licensed under the MIT License
7
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
8
+ *
9
+ * Modified for Stencil's renderer and slot projection
10
+ */
3
11
  let scopeId;
4
12
  let hostTagName;
13
+ let isSvgMode = false;
5
14
  let queuePending = false;
6
- const win = typeof window !== 'undefined' ? window : {};
7
- const doc = win.document || { head: {} };
8
- const plt = {
9
- $flags$: 0,
10
- $resourcesUrl$: '',
11
- jmp: (h) => h(),
12
- raf: (h) => requestAnimationFrame(h),
13
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
14
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
15
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
16
- };
17
- const promiseResolve = (v) => Promise.resolve(v);
18
- const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
19
- try {
20
- new CSSStyleSheet();
21
- return typeof new CSSStyleSheet().replaceSync === 'function';
22
- }
23
- catch (e) { }
24
- return false;
25
- })()
26
- ;
27
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
28
15
  const createTime = (fnName, tagName = '') => {
29
16
  {
30
17
  return () => {
@@ -39,6 +26,249 @@ const uniqueTime = (key, measureText) => {
39
26
  };
40
27
  }
41
28
  };
29
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
30
+ /**
31
+ * Default style mode id
32
+ */
33
+ /**
34
+ * Reusable empty obj/array
35
+ * Don't add values to these!!
36
+ */
37
+ const EMPTY_OBJ = {};
38
+ /**
39
+ * Namespaces
40
+ */
41
+ const SVG_NS = 'http://www.w3.org/2000/svg';
42
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
43
+ const isDef = (v) => v != null;
44
+ /**
45
+ * Check whether a value is a 'complex type', defined here as an object or a
46
+ * function.
47
+ *
48
+ * @param o the value to check
49
+ * @returns whether it's a complex type or not
50
+ */
51
+ const isComplexType = (o) => {
52
+ // https://jsperf.com/typeof-fn-object/5
53
+ o = typeof o;
54
+ return o === 'object' || o === 'function';
55
+ };
56
+ /**
57
+ * Helper method for querying a `meta` tag that contains a nonce value
58
+ * out of a DOM's head.
59
+ *
60
+ * @param doc The DOM containing the `head` to query against
61
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
62
+ * exists or the tag has no content.
63
+ */
64
+ function queryNonceMetaTagContent(doc) {
65
+ var _a, _b, _c;
66
+ return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
67
+ }
68
+ /**
69
+ * Production h() function based on Preact by
70
+ * Jason Miller (@developit)
71
+ * Licensed under the MIT License
72
+ * https://github.com/developit/preact/blob/master/LICENSE
73
+ *
74
+ * Modified for Stencil's compiler and vdom
75
+ */
76
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
77
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
78
+ const h = (nodeName, vnodeData, ...children) => {
79
+ let child = null;
80
+ let simple = false;
81
+ let lastSimple = false;
82
+ const vNodeChildren = [];
83
+ const walk = (c) => {
84
+ for (let i = 0; i < c.length; i++) {
85
+ child = c[i];
86
+ if (Array.isArray(child)) {
87
+ walk(child);
88
+ }
89
+ else if (child != null && typeof child !== 'boolean') {
90
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
91
+ child = String(child);
92
+ }
93
+ if (simple && lastSimple) {
94
+ // If the previous child was simple (string), we merge both
95
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
96
+ }
97
+ else {
98
+ // Append a new vNode, if it's text, we create a text vNode
99
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
100
+ }
101
+ lastSimple = simple;
102
+ }
103
+ }
104
+ };
105
+ walk(children);
106
+ if (vnodeData) {
107
+ {
108
+ const classData = vnodeData.className || vnodeData.class;
109
+ if (classData) {
110
+ vnodeData.class =
111
+ typeof classData !== 'object'
112
+ ? classData
113
+ : Object.keys(classData)
114
+ .filter((k) => classData[k])
115
+ .join(' ');
116
+ }
117
+ }
118
+ }
119
+ if (typeof nodeName === 'function') {
120
+ // nodeName is a functional component
121
+ return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
122
+ }
123
+ const vnode = newVNode(nodeName, null);
124
+ vnode.$attrs$ = vnodeData;
125
+ if (vNodeChildren.length > 0) {
126
+ vnode.$children$ = vNodeChildren;
127
+ }
128
+ return vnode;
129
+ };
130
+ /**
131
+ * A utility function for creating a virtual DOM node from a tag and some
132
+ * possible text content.
133
+ *
134
+ * @param tag the tag for this element
135
+ * @param text possible text content for the node
136
+ * @returns a newly-minted virtual DOM node
137
+ */
138
+ const newVNode = (tag, text) => {
139
+ const vnode = {
140
+ $flags$: 0,
141
+ $tag$: tag,
142
+ $text$: text,
143
+ $elm$: null,
144
+ $children$: null,
145
+ };
146
+ {
147
+ vnode.$attrs$ = null;
148
+ }
149
+ return vnode;
150
+ };
151
+ const Host = {};
152
+ /**
153
+ * Check whether a given node is a Host node or not
154
+ *
155
+ * @param node the virtual DOM node to check
156
+ * @returns whether it's a Host node or not
157
+ */
158
+ const isHost = (node) => node && node.$tag$ === Host;
159
+ /**
160
+ * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
161
+ *
162
+ * Note that these functions convert from {@link d.VNode} to
163
+ * {@link d.ChildNode} to give functional component developers a friendly
164
+ * interface.
165
+ */
166
+ const vdomFnUtils = {
167
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
168
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
169
+ };
170
+ /**
171
+ * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
172
+ * friendlier public interface (hence, 'convertToPublic').
173
+ *
174
+ * @param node the virtual DOM node to convert
175
+ * @returns a converted child node
176
+ */
177
+ const convertToPublic = (node) => ({
178
+ vattrs: node.$attrs$,
179
+ vchildren: node.$children$,
180
+ vkey: node.$key$,
181
+ vname: node.$name$,
182
+ vtag: node.$tag$,
183
+ vtext: node.$text$,
184
+ });
185
+ /**
186
+ * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
187
+ * order to use the resulting object in the virtual DOM. The initial object was
188
+ * likely created as part of presenting a public API, so converting it back
189
+ * involved making it 'private' again (hence, `convertToPrivate`).
190
+ *
191
+ * @param node the child node to convert
192
+ * @returns a converted virtual DOM node
193
+ */
194
+ const convertToPrivate = (node) => {
195
+ if (typeof node.vtag === 'function') {
196
+ const vnodeData = Object.assign({}, node.vattrs);
197
+ if (node.vkey) {
198
+ vnodeData.key = node.vkey;
199
+ }
200
+ if (node.vname) {
201
+ vnodeData.name = node.vname;
202
+ }
203
+ return h(node.vtag, vnodeData, ...(node.vchildren || []));
204
+ }
205
+ const vnode = newVNode(node.vtag, node.vtext);
206
+ vnode.$attrs$ = node.vattrs;
207
+ vnode.$children$ = node.vchildren;
208
+ vnode.$key$ = node.vkey;
209
+ vnode.$name$ = node.vname;
210
+ return vnode;
211
+ };
212
+ /**
213
+ * Parse a new property value for a given property type.
214
+ *
215
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
216
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
217
+ * 1. `any`, the type given to `propValue` in the function signature
218
+ * 2. the type stored from `propType`.
219
+ *
220
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
221
+ *
222
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
223
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
224
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
225
+ * ```tsx
226
+ * <my-cmp prop-val={0}></my-cmp>
227
+ * ```
228
+ *
229
+ * HTML prop values on the other hand, will always a string
230
+ *
231
+ * @param propValue the new value to coerce to some type
232
+ * @param propType the type of the prop, expressed as a binary number
233
+ * @returns the parsed/coerced value
234
+ */
235
+ const parsePropertyValue = (propValue, propType) => {
236
+ // ensure this value is of the correct prop type
237
+ if (propValue != null && !isComplexType(propValue)) {
238
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
239
+ // per the HTML spec, any string value means it is a boolean true value
240
+ // but we'll cheat here and say that the string "false" is the boolean false
241
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
242
+ }
243
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
244
+ // force it to be a number
245
+ return parseFloat(propValue);
246
+ }
247
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
248
+ // could have been passed as a number or boolean
249
+ // but we still want it as a string
250
+ return String(propValue);
251
+ }
252
+ // redundant return here for better minification
253
+ return propValue;
254
+ }
255
+ // not sure exactly what type we want
256
+ // so no need to change to a different type
257
+ return propValue;
258
+ };
259
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
260
+ /**
261
+ * Helper function to create & dispatch a custom Event on a provided target
262
+ * @param elm the target of the Event
263
+ * @param name the name to give the custom Event
264
+ * @param opts options for configuring a custom Event
265
+ * @returns the custom Event
266
+ */
267
+ const emitEvent = (elm, name, opts) => {
268
+ const ev = plt.ce(name, opts);
269
+ elm.dispatchEvent(ev);
270
+ return ev;
271
+ };
42
272
  const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
43
273
  const registerStyle = (scopeId, cssText, allowCS) => {
44
274
  let style = styles.get(scopeId);
@@ -57,6 +287,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
57
287
  styles.set(scopeId, style);
58
288
  };
59
289
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
290
+ var _a;
60
291
  let scopeId = getScopeId(cmpMeta);
61
292
  const style = styles.get(scopeId);
62
293
  // if an element is NOT connected then getRootNode() will return the wrong root node
@@ -72,10 +303,16 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
72
303
  }
73
304
  if (!appliedStyles.has(scopeId)) {
74
305
  {
306
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
75
307
  {
76
308
  styleElm = doc.createElement('style');
77
309
  styleElm.innerHTML = style;
78
310
  }
311
+ // Apply CSP nonce to the style tag if it exists
312
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
313
+ if (nonce != null) {
314
+ styleElm.setAttribute('nonce', nonce);
315
+ }
79
316
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
80
317
  }
81
318
  if (appliedStyles) {
@@ -95,6 +332,7 @@ const attachStyles = (hostRef) => {
95
332
  const flags = cmpMeta.$flags$;
96
333
  const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
97
334
  const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
335
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
98
336
  if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
99
337
  // only required when we're NOT using native shadow dom (slot)
100
338
  // or this browser doesn't support native shadow dom
@@ -109,70 +347,150 @@ const attachStyles = (hostRef) => {
109
347
  endAttachStyles();
110
348
  };
111
349
  const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
112
- const isDef = (v) => v != null;
113
- const isComplexType = (o) => {
114
- // https://jsperf.com/typeof-fn-object/5
115
- o = typeof o;
116
- return o === 'object' || o === 'function';
117
- };
118
350
  /**
119
- * Production h() function based on Preact by
351
+ * Production setAccessor() function based on Preact by
120
352
  * Jason Miller (@developit)
121
353
  * Licensed under the MIT License
122
354
  * https://github.com/developit/preact/blob/master/LICENSE
123
355
  *
124
356
  * Modified for Stencil's compiler and vdom
125
357
  */
126
- // const stack: any[] = [];
127
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
128
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
129
- const h = (nodeName, vnodeData, ...children) => {
130
- let child = null;
131
- let simple = false;
132
- let lastSimple = false;
133
- const vNodeChildren = [];
134
- const walk = (c) => {
135
- for (let i = 0; i < c.length; i++) {
136
- child = c[i];
137
- if (Array.isArray(child)) {
138
- walk(child);
358
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
359
+ if (oldValue !== newValue) {
360
+ let isProp = isMemberInElement(elm, memberName);
361
+ let ln = memberName.toLowerCase();
362
+ if (memberName === 'class') {
363
+ const classList = elm.classList;
364
+ const oldClasses = parseClassList(oldValue);
365
+ const newClasses = parseClassList(newValue);
366
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
367
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
368
+ }
369
+ else if (memberName === 'style') {
370
+ // update style attribute, css properties and values
371
+ {
372
+ for (const prop in oldValue) {
373
+ if (!newValue || newValue[prop] == null) {
374
+ if (prop.includes('-')) {
375
+ elm.style.removeProperty(prop);
376
+ }
377
+ else {
378
+ elm.style[prop] = '';
379
+ }
380
+ }
381
+ }
139
382
  }
140
- else if (child != null && typeof child !== 'boolean') {
141
- if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
142
- child = String(child);
383
+ for (const prop in newValue) {
384
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
385
+ if (prop.includes('-')) {
386
+ elm.style.setProperty(prop, newValue[prop]);
387
+ }
388
+ else {
389
+ elm.style[prop] = newValue[prop];
390
+ }
143
391
  }
144
- if (simple && lastSimple) {
145
- // If the previous child was simple (string), we merge both
146
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
392
+ }
393
+ }
394
+ else if ((!isProp ) &&
395
+ memberName[0] === 'o' &&
396
+ memberName[1] === 'n') {
397
+ // Event Handlers
398
+ // so if the member name starts with "on" and the 3rd characters is
399
+ // a capital letter, and it's not already a member on the element,
400
+ // then we're assuming it's an event listener
401
+ if (memberName[2] === '-') {
402
+ // on- prefixed events
403
+ // allows to be explicit about the dom event to listen without any magic
404
+ // under the hood:
405
+ // <my-cmp on-click> // listens for "click"
406
+ // <my-cmp on-Click> // listens for "Click"
407
+ // <my-cmp on-ionChange> // listens for "ionChange"
408
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
409
+ memberName = memberName.slice(3);
410
+ }
411
+ else if (isMemberInElement(win, ln)) {
412
+ // standard event
413
+ // the JSX attribute could have been "onMouseOver" and the
414
+ // member name "onmouseover" is on the window's prototype
415
+ // so let's add the listener "mouseover", which is all lowercased
416
+ memberName = ln.slice(2);
417
+ }
418
+ else {
419
+ // custom event
420
+ // the JSX attribute could have been "onMyCustomEvent"
421
+ // so let's trim off the "on" prefix and lowercase the first character
422
+ // and add the listener "myCustomEvent"
423
+ // except for the first character, we keep the event name case
424
+ memberName = ln[2] + memberName.slice(3);
425
+ }
426
+ if (oldValue) {
427
+ plt.rel(elm, memberName, oldValue, false);
428
+ }
429
+ if (newValue) {
430
+ plt.ael(elm, memberName, newValue, false);
431
+ }
432
+ }
433
+ else {
434
+ // Set property if it exists and it's not a SVG
435
+ const isComplex = isComplexType(newValue);
436
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
437
+ try {
438
+ if (!elm.tagName.includes('-')) {
439
+ const n = newValue == null ? '' : newValue;
440
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
441
+ if (memberName === 'list') {
442
+ isProp = false;
443
+ }
444
+ else if (oldValue == null || elm[memberName] != n) {
445
+ elm[memberName] = n;
446
+ }
447
+ }
448
+ else {
449
+ elm[memberName] = newValue;
450
+ }
147
451
  }
148
- else {
149
- // Append a new vNode, if it's text, we create a text vNode
150
- vNodeChildren.push(simple ? newVNode(null, child) : child);
452
+ catch (e) { }
453
+ }
454
+ if (newValue == null || newValue === false) {
455
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
456
+ {
457
+ elm.removeAttribute(memberName);
458
+ }
459
+ }
460
+ }
461
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
462
+ newValue = newValue === true ? '' : newValue;
463
+ {
464
+ elm.setAttribute(memberName, newValue);
151
465
  }
152
- lastSimple = simple;
153
466
  }
154
467
  }
155
- };
156
- walk(children);
157
- const vnode = newVNode(nodeName, null);
158
- vnode.$attrs$ = vnodeData;
159
- if (vNodeChildren.length > 0) {
160
- vnode.$children$ = vNodeChildren;
161
468
  }
162
- return vnode;
163
469
  };
164
- const newVNode = (tag, text) => {
165
- const vnode = {
166
- $flags$: 0,
167
- $tag$: tag,
168
- $text$: text,
169
- $elm$: null,
170
- $children$: null,
171
- };
172
- return vnode;
470
+ const parseClassListRegex = /\s/;
471
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
472
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
473
+ // if the element passed in is a shadow root, which is a document fragment
474
+ // then we want to be adding attrs/props to the shadow root's "host" element
475
+ // if it's not a shadow root, then we add attrs/props to the same element
476
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
477
+ ? newVnode.$elm$.host
478
+ : newVnode.$elm$;
479
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
480
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
481
+ {
482
+ // remove attributes no longer present on the vnode by setting them to undefined
483
+ for (memberName in oldVnodeAttrs) {
484
+ if (!(memberName in newVnodeAttrs)) {
485
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
486
+ }
487
+ }
488
+ }
489
+ // add new & update changed attributes
490
+ for (memberName in newVnodeAttrs) {
491
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
492
+ }
173
493
  };
174
- const Host = {};
175
- const isHost = (node) => node && node.$tag$ === Host;
176
494
  /**
177
495
  * Create a DOM Node corresponding to one of the children of a given VNode.
178
496
  *
@@ -189,13 +507,20 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
189
507
  let i = 0;
190
508
  let elm;
191
509
  let childNode;
192
- if (newVNode.$text$ !== null) {
193
- // create text node
194
- elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
195
- }
196
- else {
510
+ {
511
+ if (!isSvgMode) {
512
+ isSvgMode = newVNode.$tag$ === 'svg';
513
+ }
197
514
  // create element
198
- elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
515
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
516
+ );
517
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
518
+ isSvgMode = false;
519
+ }
520
+ // add css classes, attrs, props, listeners, etc.
521
+ {
522
+ updateElement(null, newVNode, isSvgMode);
523
+ }
199
524
  if (isDef(scopeId) && elm['s-si'] !== scopeId) {
200
525
  // if there is a scopeId and this is the initial render
201
526
  // then let's add the scopeId as a css class
@@ -212,9 +537,34 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
212
537
  }
213
538
  }
214
539
  }
540
+ {
541
+ if (newVNode.$tag$ === 'svg') {
542
+ // Only reset the SVG context when we're exiting <svg> element
543
+ isSvgMode = false;
544
+ }
545
+ else if (elm.tagName === 'foreignObject') {
546
+ // Reenter SVG context when we're exiting <foreignObject> element
547
+ isSvgMode = true;
548
+ }
549
+ }
215
550
  }
216
551
  return elm;
217
552
  };
553
+ /**
554
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
555
+ * add them to the DOM in the appropriate place.
556
+ *
557
+ * @param parentElm the DOM node which should be used as a parent for the new
558
+ * DOM nodes
559
+ * @param before a child of the `parentElm` which the new children should be
560
+ * inserted before (optional)
561
+ * @param parentVNode the parent virtual DOM node
562
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
563
+ * @param startIdx the index in the child virtual DOM nodes at which to start
564
+ * creating DOM nodes (inclusive)
565
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
566
+ * creating DOM nodes (inclusive)
567
+ */
218
568
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
219
569
  let containerElm = (parentElm);
220
570
  let childNode;
@@ -231,6 +581,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
231
581
  }
232
582
  }
233
583
  };
584
+ /**
585
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
586
+ * This can be used to, for instance, clean up after a list of children which
587
+ * should no longer be shown.
588
+ *
589
+ * This function also handles some of Stencil's slot relocation logic.
590
+ *
591
+ * @param vnodes a list of virtual DOM nodes to remove
592
+ * @param startIdx the index at which to start removing nodes (inclusive)
593
+ * @param endIdx the index at which to stop removing nodes (inclusive)
594
+ * @param vnode a VNode
595
+ * @param elm an element
596
+ */
234
597
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
235
598
  for (; startIdx <= endIdx; ++startIdx) {
236
599
  if ((vnode = vnodes[startIdx])) {
@@ -422,7 +785,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
422
785
  *
423
786
  * So, in other words, if `key` attrs are not set on VNodes which may be
424
787
  * changing order within a `children` array or something along those lines then
425
- * we could obtain a false positive and then have to do needless re-rendering.
788
+ * we could obtain a false negative and then have to do needless re-rendering
789
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
426
790
  *
427
791
  * @param leftVNode the first VNode to check
428
792
  * @param rightVNode the second VNode to check
@@ -448,19 +812,29 @@ const patch = (oldVNode, newVNode) => {
448
812
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
449
813
  const oldChildren = oldVNode.$children$;
450
814
  const newChildren = newVNode.$children$;
451
- const text = newVNode.$text$;
452
- if (text === null) {
815
+ const tag = newVNode.$tag$;
816
+ {
817
+ {
818
+ // test if we're rendering an svg element, or still rendering nodes inside of one
819
+ // only add this to the when the compiler sees we're using an svg somewhere
820
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
821
+ }
822
+ {
823
+ if (tag === 'slot')
824
+ ;
825
+ else {
826
+ // either this is the first render of an element OR it's an update
827
+ // AND we already know it's possible it could have changed
828
+ // this updates the element's css classes, attrs, props, listeners, etc.
829
+ updateElement(oldVNode, newVNode, isSvgMode);
830
+ }
831
+ }
453
832
  if (oldChildren !== null && newChildren !== null) {
454
833
  // looks like there's child vnodes for both the old and new vnodes
455
834
  // so we need to call `updateChildren` to reconcile them
456
835
  updateChildren(elm, oldChildren, newVNode, newChildren);
457
836
  }
458
837
  else if (newChildren !== null) {
459
- // no old child vnodes, but there are new child vnodes to add
460
- if (oldVNode.$text$ !== null) {
461
- // the old vnode was text, so be sure to clear it out
462
- elm.textContent = '';
463
- }
464
838
  // add the new vnode children
465
839
  addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
466
840
  }
@@ -468,13 +842,23 @@ const patch = (oldVNode, newVNode) => {
468
842
  // no new child vnodes, but there are old child vnodes to remove
469
843
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
470
844
  }
471
- }
472
- else if (oldVNode.$text$ !== text) {
473
- // update the text content for the text only vnode
474
- // and also only if the text is different than before
475
- elm.data = text;
845
+ if (isSvgMode && tag === 'svg') {
846
+ isSvgMode = false;
847
+ }
476
848
  }
477
849
  };
850
+ /**
851
+ * The main entry point for Stencil's virtual DOM-based rendering engine
852
+ *
853
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
854
+ * function will handle creating a virtual DOM tree with a single root, patching
855
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
856
+ * relocation, and reflecting attributes.
857
+ *
858
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
859
+ * the DOM node into which it should be rendered.
860
+ * @param renderFnResults the virtual DOM nodes to be rendered
861
+ */
478
862
  const renderVdom = (hostRef, renderFnResults) => {
479
863
  const hostElm = hostRef.$hostElement$;
480
864
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -490,32 +874,6 @@ const renderVdom = (hostRef, renderFnResults) => {
490
874
  // synchronous patch
491
875
  patch(oldVNode, rootVnode);
492
876
  };
493
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
494
- const createEvent = (ref, name, flags) => {
495
- const elm = getElement(ref);
496
- return {
497
- emit: (detail) => {
498
- return emitEvent(elm, name, {
499
- bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
500
- composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
501
- cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
502
- detail,
503
- });
504
- },
505
- };
506
- };
507
- /**
508
- * Helper function to create & dispatch a custom Event on a provided target
509
- * @param elm the target of the Event
510
- * @param name the name to give the custom Event
511
- * @param opts options for configuring a custom Event
512
- * @returns the custom Event
513
- */
514
- const emitEvent = (elm, name, opts) => {
515
- const ev = plt.ce(name, opts);
516
- elm.dispatchEvent(ev);
517
- return ev;
518
- };
519
877
  const attachToAncestor = (hostRef, ancestorComponent) => {
520
878
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
521
879
  ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
@@ -540,6 +898,14 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
540
898
  const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
541
899
  const instance = hostRef.$lazyInstance$ ;
542
900
  let promise;
901
+ if (isInitialLoad) {
902
+ {
903
+ promise = safeCall(instance, 'componentWillLoad');
904
+ }
905
+ }
906
+ {
907
+ promise = then(promise, () => safeCall(instance, 'componentWillRender'));
908
+ }
543
909
  endSchedule();
544
910
  return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
545
911
  };
@@ -607,6 +973,7 @@ const postUpdateComponent = (hostRef) => {
607
973
  const tagName = hostRef.$cmpMeta$.$tagName$;
608
974
  const elm = hostRef.$hostElement$;
609
975
  const endPostUpdate = createTime('postUpdate', tagName);
976
+ const instance = hostRef.$lazyInstance$ ;
610
977
  const ancestorComponent = hostRef.$ancestorComponent$;
611
978
  if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
612
979
  hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
@@ -614,6 +981,9 @@ const postUpdateComponent = (hostRef) => {
614
981
  // DOM WRITE!
615
982
  addHydratedFlag(elm);
616
983
  }
984
+ {
985
+ safeCall(instance, 'componentDidLoad');
986
+ }
617
987
  endPostUpdate();
618
988
  {
619
989
  hostRef.$onReadyResolve$(elm);
@@ -652,53 +1022,27 @@ const appDidLoad = (who) => {
652
1022
  }
653
1023
  nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
654
1024
  };
1025
+ const safeCall = (instance, method, arg) => {
1026
+ if (instance && instance[method]) {
1027
+ try {
1028
+ return instance[method](arg);
1029
+ }
1030
+ catch (e) {
1031
+ consoleError(e);
1032
+ }
1033
+ }
1034
+ return undefined;
1035
+ };
655
1036
  const then = (promise, thenFn) => {
656
1037
  return promise && promise.then ? promise.then(thenFn) : thenFn();
657
1038
  };
658
1039
  const addHydratedFlag = (elm) => elm.classList.add('hydrated')
659
1040
  ;
660
- /**
661
- * Parse a new property value for a given property type.
662
- *
663
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
664
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
665
- * 1. `any`, the type given to `propValue` in the function signature
666
- * 2. the type stored from `propType`.
667
- *
668
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
669
- *
670
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
671
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
672
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
673
- * ```tsx
674
- * <my-cmp prop-val={0}></my-cmp>
675
- * ```
676
- *
677
- * HTML prop values on the other hand, will always a string
678
- *
679
- * @param propValue the new value to coerce to some type
680
- * @param propType the type of the prop, expressed as a binary number
681
- * @returns the parsed/coerced value
682
- */
683
- const parsePropertyValue = (propValue, propType) => {
684
- // ensure this value is of the correct prop type
685
- if (propValue != null && !isComplexType(propValue)) {
686
- if (propType & 1 /* MEMBER_FLAGS.String */) {
687
- // could have been passed as a number or boolean
688
- // but we still want it as a string
689
- return String(propValue);
690
- }
691
- // redundant return here for better minification
692
- return propValue;
693
- }
694
- // not sure exactly what type we want
695
- // so no need to change to a different type
696
- return propValue;
697
- };
698
1041
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
699
1042
  const setValue = (ref, propName, newVal, cmpMeta) => {
700
1043
  // check our new property value against our internal value
701
1044
  const hostRef = getHostRef(ref);
1045
+ const elm = hostRef.$hostElement$ ;
702
1046
  const oldVal = hostRef.$instanceValues$.get(propName);
703
1047
  const flags = hostRef.$flags$;
704
1048
  const instance = hostRef.$lazyInstance$ ;
@@ -711,6 +1055,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
711
1055
  // set our new value!
712
1056
  hostRef.$instanceValues$.set(propName, newVal);
713
1057
  if (instance) {
1058
+ // get an array of method names of watch functions to call
1059
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1060
+ const watchMethods = cmpMeta.$watchers$[propName];
1061
+ if (watchMethods) {
1062
+ // this instance is watching for when this property changed
1063
+ watchMethods.map((watchMethodName) => {
1064
+ try {
1065
+ // fire off each of the watch methods that are watching this property
1066
+ instance[watchMethodName](newVal, oldVal, propName);
1067
+ }
1068
+ catch (e) {
1069
+ consoleError(e, elm);
1070
+ }
1071
+ });
1072
+ }
1073
+ }
714
1074
  if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
715
1075
  // looks like this value actually changed, so we've got work to do!
716
1076
  // but only if we've already rendered, otherwise just chill out
@@ -721,8 +1081,21 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
721
1081
  }
722
1082
  }
723
1083
  };
1084
+ /**
1085
+ * Attach a series of runtime constructs to a compiled Stencil component
1086
+ * constructor, including getters and setters for the `@Prop` and `@State`
1087
+ * decorators, callbacks for when attributes change, and so on.
1088
+ *
1089
+ * @param Cstr the constructor for a component that we need to process
1090
+ * @param cmpMeta metadata collected previously about the component
1091
+ * @param flags a number used to store a series of bit flags
1092
+ * @returns a reference to the same constructor passed in (but now mutated)
1093
+ */
724
1094
  const proxyComponent = (Cstr, cmpMeta, flags) => {
725
1095
  if (cmpMeta.$members$) {
1096
+ if (Cstr.watchers) {
1097
+ cmpMeta.$watchers$ = Cstr.watchers;
1098
+ }
726
1099
  // It's better to have a const than two Object.entries()
727
1100
  const members = Object.entries(cmpMeta.$members$);
728
1101
  const prototype = Cstr.prototype;
@@ -837,6 +1210,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
837
1210
  endLoad();
838
1211
  }
839
1212
  if (!Cstr.isProxied) {
1213
+ // we've never proxied this Constructor before
1214
+ // let's add the getters/setters to its prototype before
1215
+ // the first time we create an instance of the implementation
1216
+ {
1217
+ cmpMeta.$watchers$ = Cstr.watchers;
1218
+ }
840
1219
  proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
841
1220
  Cstr.isProxied = true;
842
1221
  }
@@ -860,7 +1239,11 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
860
1239
  {
861
1240
  hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
862
1241
  }
1242
+ {
1243
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1244
+ }
863
1245
  endNewInstance();
1246
+ fireConnectedCallback(hostRef.$lazyInstance$);
864
1247
  }
865
1248
  if (Cstr.style) {
866
1249
  // this component has styles but we haven't registered them yet
@@ -889,6 +1272,11 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
889
1272
  schedule();
890
1273
  }
891
1274
  };
1275
+ const fireConnectedCallback = (instance) => {
1276
+ {
1277
+ safeCall(instance, 'connectedCallback');
1278
+ }
1279
+ };
892
1280
  const connectedCallback = (elm) => {
893
1281
  if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
894
1282
  const hostRef = getHostRef(elm);
@@ -927,6 +1315,10 @@ const connectedCallback = (elm) => {
927
1315
  initializeComponent(elm, hostRef, cmpMeta);
928
1316
  }
929
1317
  }
1318
+ else {
1319
+ // fire off connectedCallback() on component instance
1320
+ fireConnectedCallback(hostRef.$lazyInstance$);
1321
+ }
930
1322
  endConnected();
931
1323
  }
932
1324
  };
@@ -936,6 +1328,7 @@ const disconnectedCallback = (elm) => {
936
1328
  }
937
1329
  };
938
1330
  const bootstrapLazy = (lazyBundles, options = {}) => {
1331
+ var _a;
939
1332
  const endBootstrap = createTime();
940
1333
  const cmpTags = [];
941
1334
  const exclude = options.exclude || [];
@@ -959,6 +1352,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
959
1352
  {
960
1353
  cmpMeta.$members$ = compactMeta[2];
961
1354
  }
1355
+ {
1356
+ cmpMeta.$watchers$ = {};
1357
+ }
962
1358
  const tagName = cmpMeta.$tagName$;
963
1359
  const HostElement = class extends HTMLElement {
964
1360
  // StencilLazyHost
@@ -1009,6 +1405,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1009
1405
  {
1010
1406
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1011
1407
  visibilityStyle.setAttribute('data-styles', '');
1408
+ // Apply CSP nonce to the style tag if it exists
1409
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1410
+ if (nonce != null) {
1411
+ visibilityStyle.setAttribute('nonce', nonce);
1412
+ }
1012
1413
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1013
1414
  }
1014
1415
  // Process deferred connectedCallbacks now all components have been registered
@@ -1024,6 +1425,13 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1024
1425
  // Fallback appLoad event
1025
1426
  endBootstrap();
1026
1427
  };
1428
+ /**
1429
+ * Assigns the given value to the nonce property on the runtime platform object.
1430
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1431
+ * @param nonce The value to be assigned to the platform nonce property.
1432
+ * @returns void
1433
+ */
1434
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1027
1435
  const hostRefs = /*@__PURE__*/ new WeakMap();
1028
1436
  const getHostRef = (ref) => hostRefs.get(ref);
1029
1437
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1044,6 +1452,7 @@ const registerHost = (elm, cmpMeta) => {
1044
1452
  }
1045
1453
  return hostRefs.set(elm, hostRef);
1046
1454
  };
1455
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1047
1456
  const consoleError = (e, el) => (0, console.error)(e, el);
1048
1457
  const cmpModules = /*@__PURE__*/ new Map();
1049
1458
  const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
@@ -1068,6 +1477,27 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1068
1477
  }, consoleError);
1069
1478
  };
1070
1479
  const styles = /*@__PURE__*/ new Map();
1480
+ const win = typeof window !== 'undefined' ? window : {};
1481
+ const doc = win.document || { head: {} };
1482
+ const plt = {
1483
+ $flags$: 0,
1484
+ $resourcesUrl$: '',
1485
+ jmp: (h) => h(),
1486
+ raf: (h) => requestAnimationFrame(h),
1487
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1488
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1489
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1490
+ };
1491
+ const promiseResolve = (v) => Promise.resolve(v);
1492
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1493
+ try {
1494
+ new CSSStyleSheet();
1495
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1496
+ }
1497
+ catch (e) { }
1498
+ return false;
1499
+ })()
1500
+ ;
1071
1501
  const queueDomReads = [];
1072
1502
  const queueDomWrites = [];
1073
1503
  const queueTask = (queue, write) => (cb) => {
@@ -1111,4 +1541,6 @@ const flush = () => {
1111
1541
  const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1112
1542
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1113
1543
 
1114
- export { bootstrapLazy as b, createEvent as c, h, promiseResolve as p, registerInstance as r };
1544
+ export { Host as H, bootstrapLazy as b, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
1545
+
1546
+ //# sourceMappingURL=index-6d5a72fa.js.map