@swisspost/design-system-components 1.0.0-beta.3 → 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 -37
  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
@@ -22,31 +22,18 @@ function _interopNamespace(e) {
22
22
 
23
23
  const NAMESPACE = 'post-components';
24
24
 
25
+ /**
26
+ * Virtual DOM patching algorithm based on Snabbdom by
27
+ * Simon Friis Vindum (@paldepind)
28
+ * Licensed under the MIT License
29
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
30
+ *
31
+ * Modified for Stencil's renderer and slot projection
32
+ */
25
33
  let scopeId;
26
34
  let hostTagName;
35
+ let isSvgMode = false;
27
36
  let queuePending = false;
28
- const win = typeof window !== 'undefined' ? window : {};
29
- const doc = win.document || { head: {} };
30
- const plt = {
31
- $flags$: 0,
32
- $resourcesUrl$: '',
33
- jmp: (h) => h(),
34
- raf: (h) => requestAnimationFrame(h),
35
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
36
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
37
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
38
- };
39
- const promiseResolve = (v) => Promise.resolve(v);
40
- const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
41
- try {
42
- new CSSStyleSheet();
43
- return typeof new CSSStyleSheet().replaceSync === 'function';
44
- }
45
- catch (e) { }
46
- return false;
47
- })()
48
- ;
49
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
50
37
  const createTime = (fnName, tagName = '') => {
51
38
  {
52
39
  return () => {
@@ -61,6 +48,249 @@ const uniqueTime = (key, measureText) => {
61
48
  };
62
49
  }
63
50
  };
51
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
52
+ /**
53
+ * Default style mode id
54
+ */
55
+ /**
56
+ * Reusable empty obj/array
57
+ * Don't add values to these!!
58
+ */
59
+ const EMPTY_OBJ = {};
60
+ /**
61
+ * Namespaces
62
+ */
63
+ const SVG_NS = 'http://www.w3.org/2000/svg';
64
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
65
+ const isDef = (v) => v != null;
66
+ /**
67
+ * Check whether a value is a 'complex type', defined here as an object or a
68
+ * function.
69
+ *
70
+ * @param o the value to check
71
+ * @returns whether it's a complex type or not
72
+ */
73
+ const isComplexType = (o) => {
74
+ // https://jsperf.com/typeof-fn-object/5
75
+ o = typeof o;
76
+ return o === 'object' || o === 'function';
77
+ };
78
+ /**
79
+ * Helper method for querying a `meta` tag that contains a nonce value
80
+ * out of a DOM's head.
81
+ *
82
+ * @param doc The DOM containing the `head` to query against
83
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
84
+ * exists or the tag has no content.
85
+ */
86
+ function queryNonceMetaTagContent(doc) {
87
+ var _a, _b, _c;
88
+ 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;
89
+ }
90
+ /**
91
+ * Production h() function based on Preact by
92
+ * Jason Miller (@developit)
93
+ * Licensed under the MIT License
94
+ * https://github.com/developit/preact/blob/master/LICENSE
95
+ *
96
+ * Modified for Stencil's compiler and vdom
97
+ */
98
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
99
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
100
+ const h = (nodeName, vnodeData, ...children) => {
101
+ let child = null;
102
+ let simple = false;
103
+ let lastSimple = false;
104
+ const vNodeChildren = [];
105
+ const walk = (c) => {
106
+ for (let i = 0; i < c.length; i++) {
107
+ child = c[i];
108
+ if (Array.isArray(child)) {
109
+ walk(child);
110
+ }
111
+ else if (child != null && typeof child !== 'boolean') {
112
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
113
+ child = String(child);
114
+ }
115
+ if (simple && lastSimple) {
116
+ // If the previous child was simple (string), we merge both
117
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
118
+ }
119
+ else {
120
+ // Append a new vNode, if it's text, we create a text vNode
121
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
122
+ }
123
+ lastSimple = simple;
124
+ }
125
+ }
126
+ };
127
+ walk(children);
128
+ if (vnodeData) {
129
+ {
130
+ const classData = vnodeData.className || vnodeData.class;
131
+ if (classData) {
132
+ vnodeData.class =
133
+ typeof classData !== 'object'
134
+ ? classData
135
+ : Object.keys(classData)
136
+ .filter((k) => classData[k])
137
+ .join(' ');
138
+ }
139
+ }
140
+ }
141
+ if (typeof nodeName === 'function') {
142
+ // nodeName is a functional component
143
+ return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
144
+ }
145
+ const vnode = newVNode(nodeName, null);
146
+ vnode.$attrs$ = vnodeData;
147
+ if (vNodeChildren.length > 0) {
148
+ vnode.$children$ = vNodeChildren;
149
+ }
150
+ return vnode;
151
+ };
152
+ /**
153
+ * A utility function for creating a virtual DOM node from a tag and some
154
+ * possible text content.
155
+ *
156
+ * @param tag the tag for this element
157
+ * @param text possible text content for the node
158
+ * @returns a newly-minted virtual DOM node
159
+ */
160
+ const newVNode = (tag, text) => {
161
+ const vnode = {
162
+ $flags$: 0,
163
+ $tag$: tag,
164
+ $text$: text,
165
+ $elm$: null,
166
+ $children$: null,
167
+ };
168
+ {
169
+ vnode.$attrs$ = null;
170
+ }
171
+ return vnode;
172
+ };
173
+ const Host = {};
174
+ /**
175
+ * Check whether a given node is a Host node or not
176
+ *
177
+ * @param node the virtual DOM node to check
178
+ * @returns whether it's a Host node or not
179
+ */
180
+ const isHost = (node) => node && node.$tag$ === Host;
181
+ /**
182
+ * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
183
+ *
184
+ * Note that these functions convert from {@link d.VNode} to
185
+ * {@link d.ChildNode} to give functional component developers a friendly
186
+ * interface.
187
+ */
188
+ const vdomFnUtils = {
189
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
190
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
191
+ };
192
+ /**
193
+ * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
194
+ * friendlier public interface (hence, 'convertToPublic').
195
+ *
196
+ * @param node the virtual DOM node to convert
197
+ * @returns a converted child node
198
+ */
199
+ const convertToPublic = (node) => ({
200
+ vattrs: node.$attrs$,
201
+ vchildren: node.$children$,
202
+ vkey: node.$key$,
203
+ vname: node.$name$,
204
+ vtag: node.$tag$,
205
+ vtext: node.$text$,
206
+ });
207
+ /**
208
+ * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
209
+ * order to use the resulting object in the virtual DOM. The initial object was
210
+ * likely created as part of presenting a public API, so converting it back
211
+ * involved making it 'private' again (hence, `convertToPrivate`).
212
+ *
213
+ * @param node the child node to convert
214
+ * @returns a converted virtual DOM node
215
+ */
216
+ const convertToPrivate = (node) => {
217
+ if (typeof node.vtag === 'function') {
218
+ const vnodeData = Object.assign({}, node.vattrs);
219
+ if (node.vkey) {
220
+ vnodeData.key = node.vkey;
221
+ }
222
+ if (node.vname) {
223
+ vnodeData.name = node.vname;
224
+ }
225
+ return h(node.vtag, vnodeData, ...(node.vchildren || []));
226
+ }
227
+ const vnode = newVNode(node.vtag, node.vtext);
228
+ vnode.$attrs$ = node.vattrs;
229
+ vnode.$children$ = node.vchildren;
230
+ vnode.$key$ = node.vkey;
231
+ vnode.$name$ = node.vname;
232
+ return vnode;
233
+ };
234
+ /**
235
+ * Parse a new property value for a given property type.
236
+ *
237
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
238
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
239
+ * 1. `any`, the type given to `propValue` in the function signature
240
+ * 2. the type stored from `propType`.
241
+ *
242
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
243
+ *
244
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
245
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
246
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
247
+ * ```tsx
248
+ * <my-cmp prop-val={0}></my-cmp>
249
+ * ```
250
+ *
251
+ * HTML prop values on the other hand, will always a string
252
+ *
253
+ * @param propValue the new value to coerce to some type
254
+ * @param propType the type of the prop, expressed as a binary number
255
+ * @returns the parsed/coerced value
256
+ */
257
+ const parsePropertyValue = (propValue, propType) => {
258
+ // ensure this value is of the correct prop type
259
+ if (propValue != null && !isComplexType(propValue)) {
260
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
261
+ // per the HTML spec, any string value means it is a boolean true value
262
+ // but we'll cheat here and say that the string "false" is the boolean false
263
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
264
+ }
265
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
266
+ // force it to be a number
267
+ return parseFloat(propValue);
268
+ }
269
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
270
+ // could have been passed as a number or boolean
271
+ // but we still want it as a string
272
+ return String(propValue);
273
+ }
274
+ // redundant return here for better minification
275
+ return propValue;
276
+ }
277
+ // not sure exactly what type we want
278
+ // so no need to change to a different type
279
+ return propValue;
280
+ };
281
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
282
+ /**
283
+ * Helper function to create & dispatch a custom Event on a provided target
284
+ * @param elm the target of the Event
285
+ * @param name the name to give the custom Event
286
+ * @param opts options for configuring a custom Event
287
+ * @returns the custom Event
288
+ */
289
+ const emitEvent = (elm, name, opts) => {
290
+ const ev = plt.ce(name, opts);
291
+ elm.dispatchEvent(ev);
292
+ return ev;
293
+ };
64
294
  const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
65
295
  const registerStyle = (scopeId, cssText, allowCS) => {
66
296
  let style = styles.get(scopeId);
@@ -79,6 +309,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
79
309
  styles.set(scopeId, style);
80
310
  };
81
311
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
312
+ var _a;
82
313
  let scopeId = getScopeId(cmpMeta);
83
314
  const style = styles.get(scopeId);
84
315
  // if an element is NOT connected then getRootNode() will return the wrong root node
@@ -94,10 +325,16 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
94
325
  }
95
326
  if (!appliedStyles.has(scopeId)) {
96
327
  {
328
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
97
329
  {
98
330
  styleElm = doc.createElement('style');
99
331
  styleElm.innerHTML = style;
100
332
  }
333
+ // Apply CSP nonce to the style tag if it exists
334
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
335
+ if (nonce != null) {
336
+ styleElm.setAttribute('nonce', nonce);
337
+ }
101
338
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
102
339
  }
103
340
  if (appliedStyles) {
@@ -117,6 +354,7 @@ const attachStyles = (hostRef) => {
117
354
  const flags = cmpMeta.$flags$;
118
355
  const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
119
356
  const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
357
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
120
358
  if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
121
359
  // only required when we're NOT using native shadow dom (slot)
122
360
  // or this browser doesn't support native shadow dom
@@ -131,70 +369,150 @@ const attachStyles = (hostRef) => {
131
369
  endAttachStyles();
132
370
  };
133
371
  const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
134
- const isDef = (v) => v != null;
135
- const isComplexType = (o) => {
136
- // https://jsperf.com/typeof-fn-object/5
137
- o = typeof o;
138
- return o === 'object' || o === 'function';
139
- };
140
372
  /**
141
- * Production h() function based on Preact by
373
+ * Production setAccessor() function based on Preact by
142
374
  * Jason Miller (@developit)
143
375
  * Licensed under the MIT License
144
376
  * https://github.com/developit/preact/blob/master/LICENSE
145
377
  *
146
378
  * Modified for Stencil's compiler and vdom
147
379
  */
148
- // const stack: any[] = [];
149
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
150
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
151
- const h = (nodeName, vnodeData, ...children) => {
152
- let child = null;
153
- let simple = false;
154
- let lastSimple = false;
155
- const vNodeChildren = [];
156
- const walk = (c) => {
157
- for (let i = 0; i < c.length; i++) {
158
- child = c[i];
159
- if (Array.isArray(child)) {
160
- walk(child);
380
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
381
+ if (oldValue !== newValue) {
382
+ let isProp = isMemberInElement(elm, memberName);
383
+ let ln = memberName.toLowerCase();
384
+ if (memberName === 'class') {
385
+ const classList = elm.classList;
386
+ const oldClasses = parseClassList(oldValue);
387
+ const newClasses = parseClassList(newValue);
388
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
389
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
390
+ }
391
+ else if (memberName === 'style') {
392
+ // update style attribute, css properties and values
393
+ {
394
+ for (const prop in oldValue) {
395
+ if (!newValue || newValue[prop] == null) {
396
+ if (prop.includes('-')) {
397
+ elm.style.removeProperty(prop);
398
+ }
399
+ else {
400
+ elm.style[prop] = '';
401
+ }
402
+ }
403
+ }
161
404
  }
162
- else if (child != null && typeof child !== 'boolean') {
163
- if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
164
- child = String(child);
405
+ for (const prop in newValue) {
406
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
407
+ if (prop.includes('-')) {
408
+ elm.style.setProperty(prop, newValue[prop]);
409
+ }
410
+ else {
411
+ elm.style[prop] = newValue[prop];
412
+ }
165
413
  }
166
- if (simple && lastSimple) {
167
- // If the previous child was simple (string), we merge both
168
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
414
+ }
415
+ }
416
+ else if ((!isProp ) &&
417
+ memberName[0] === 'o' &&
418
+ memberName[1] === 'n') {
419
+ // Event Handlers
420
+ // so if the member name starts with "on" and the 3rd characters is
421
+ // a capital letter, and it's not already a member on the element,
422
+ // then we're assuming it's an event listener
423
+ if (memberName[2] === '-') {
424
+ // on- prefixed events
425
+ // allows to be explicit about the dom event to listen without any magic
426
+ // under the hood:
427
+ // <my-cmp on-click> // listens for "click"
428
+ // <my-cmp on-Click> // listens for "Click"
429
+ // <my-cmp on-ionChange> // listens for "ionChange"
430
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
431
+ memberName = memberName.slice(3);
432
+ }
433
+ else if (isMemberInElement(win, ln)) {
434
+ // standard event
435
+ // the JSX attribute could have been "onMouseOver" and the
436
+ // member name "onmouseover" is on the window's prototype
437
+ // so let's add the listener "mouseover", which is all lowercased
438
+ memberName = ln.slice(2);
439
+ }
440
+ else {
441
+ // custom event
442
+ // the JSX attribute could have been "onMyCustomEvent"
443
+ // so let's trim off the "on" prefix and lowercase the first character
444
+ // and add the listener "myCustomEvent"
445
+ // except for the first character, we keep the event name case
446
+ memberName = ln[2] + memberName.slice(3);
447
+ }
448
+ if (oldValue) {
449
+ plt.rel(elm, memberName, oldValue, false);
450
+ }
451
+ if (newValue) {
452
+ plt.ael(elm, memberName, newValue, false);
453
+ }
454
+ }
455
+ else {
456
+ // Set property if it exists and it's not a SVG
457
+ const isComplex = isComplexType(newValue);
458
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
459
+ try {
460
+ if (!elm.tagName.includes('-')) {
461
+ const n = newValue == null ? '' : newValue;
462
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
463
+ if (memberName === 'list') {
464
+ isProp = false;
465
+ }
466
+ else if (oldValue == null || elm[memberName] != n) {
467
+ elm[memberName] = n;
468
+ }
469
+ }
470
+ else {
471
+ elm[memberName] = newValue;
472
+ }
169
473
  }
170
- else {
171
- // Append a new vNode, if it's text, we create a text vNode
172
- vNodeChildren.push(simple ? newVNode(null, child) : child);
474
+ catch (e) { }
475
+ }
476
+ if (newValue == null || newValue === false) {
477
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
478
+ {
479
+ elm.removeAttribute(memberName);
480
+ }
481
+ }
482
+ }
483
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
484
+ newValue = newValue === true ? '' : newValue;
485
+ {
486
+ elm.setAttribute(memberName, newValue);
173
487
  }
174
- lastSimple = simple;
175
488
  }
176
489
  }
177
- };
178
- walk(children);
179
- const vnode = newVNode(nodeName, null);
180
- vnode.$attrs$ = vnodeData;
181
- if (vNodeChildren.length > 0) {
182
- vnode.$children$ = vNodeChildren;
183
490
  }
184
- return vnode;
185
491
  };
186
- const newVNode = (tag, text) => {
187
- const vnode = {
188
- $flags$: 0,
189
- $tag$: tag,
190
- $text$: text,
191
- $elm$: null,
192
- $children$: null,
193
- };
194
- return vnode;
492
+ const parseClassListRegex = /\s/;
493
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
494
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
495
+ // if the element passed in is a shadow root, which is a document fragment
496
+ // then we want to be adding attrs/props to the shadow root's "host" element
497
+ // if it's not a shadow root, then we add attrs/props to the same element
498
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
499
+ ? newVnode.$elm$.host
500
+ : newVnode.$elm$;
501
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
502
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
503
+ {
504
+ // remove attributes no longer present on the vnode by setting them to undefined
505
+ for (memberName in oldVnodeAttrs) {
506
+ if (!(memberName in newVnodeAttrs)) {
507
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
508
+ }
509
+ }
510
+ }
511
+ // add new & update changed attributes
512
+ for (memberName in newVnodeAttrs) {
513
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
514
+ }
195
515
  };
196
- const Host = {};
197
- const isHost = (node) => node && node.$tag$ === Host;
198
516
  /**
199
517
  * Create a DOM Node corresponding to one of the children of a given VNode.
200
518
  *
@@ -211,13 +529,20 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
211
529
  let i = 0;
212
530
  let elm;
213
531
  let childNode;
214
- if (newVNode.$text$ !== null) {
215
- // create text node
216
- elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
217
- }
218
- else {
532
+ {
533
+ if (!isSvgMode) {
534
+ isSvgMode = newVNode.$tag$ === 'svg';
535
+ }
219
536
  // create element
220
- elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
537
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
538
+ );
539
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
540
+ isSvgMode = false;
541
+ }
542
+ // add css classes, attrs, props, listeners, etc.
543
+ {
544
+ updateElement(null, newVNode, isSvgMode);
545
+ }
221
546
  if (isDef(scopeId) && elm['s-si'] !== scopeId) {
222
547
  // if there is a scopeId and this is the initial render
223
548
  // then let's add the scopeId as a css class
@@ -234,9 +559,34 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
234
559
  }
235
560
  }
236
561
  }
562
+ {
563
+ if (newVNode.$tag$ === 'svg') {
564
+ // Only reset the SVG context when we're exiting <svg> element
565
+ isSvgMode = false;
566
+ }
567
+ else if (elm.tagName === 'foreignObject') {
568
+ // Reenter SVG context when we're exiting <foreignObject> element
569
+ isSvgMode = true;
570
+ }
571
+ }
237
572
  }
238
573
  return elm;
239
574
  };
575
+ /**
576
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
577
+ * add them to the DOM in the appropriate place.
578
+ *
579
+ * @param parentElm the DOM node which should be used as a parent for the new
580
+ * DOM nodes
581
+ * @param before a child of the `parentElm` which the new children should be
582
+ * inserted before (optional)
583
+ * @param parentVNode the parent virtual DOM node
584
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
585
+ * @param startIdx the index in the child virtual DOM nodes at which to start
586
+ * creating DOM nodes (inclusive)
587
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
588
+ * creating DOM nodes (inclusive)
589
+ */
240
590
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
241
591
  let containerElm = (parentElm);
242
592
  let childNode;
@@ -253,6 +603,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
253
603
  }
254
604
  }
255
605
  };
606
+ /**
607
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
608
+ * This can be used to, for instance, clean up after a list of children which
609
+ * should no longer be shown.
610
+ *
611
+ * This function also handles some of Stencil's slot relocation logic.
612
+ *
613
+ * @param vnodes a list of virtual DOM nodes to remove
614
+ * @param startIdx the index at which to start removing nodes (inclusive)
615
+ * @param endIdx the index at which to stop removing nodes (inclusive)
616
+ * @param vnode a VNode
617
+ * @param elm an element
618
+ */
256
619
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
257
620
  for (; startIdx <= endIdx; ++startIdx) {
258
621
  if ((vnode = vnodes[startIdx])) {
@@ -444,7 +807,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
444
807
  *
445
808
  * So, in other words, if `key` attrs are not set on VNodes which may be
446
809
  * changing order within a `children` array or something along those lines then
447
- * we could obtain a false positive and then have to do needless re-rendering.
810
+ * we could obtain a false negative and then have to do needless re-rendering
811
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
448
812
  *
449
813
  * @param leftVNode the first VNode to check
450
814
  * @param rightVNode the second VNode to check
@@ -470,19 +834,29 @@ const patch = (oldVNode, newVNode) => {
470
834
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
471
835
  const oldChildren = oldVNode.$children$;
472
836
  const newChildren = newVNode.$children$;
473
- const text = newVNode.$text$;
474
- if (text === null) {
837
+ const tag = newVNode.$tag$;
838
+ {
839
+ {
840
+ // test if we're rendering an svg element, or still rendering nodes inside of one
841
+ // only add this to the when the compiler sees we're using an svg somewhere
842
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
843
+ }
844
+ {
845
+ if (tag === 'slot')
846
+ ;
847
+ else {
848
+ // either this is the first render of an element OR it's an update
849
+ // AND we already know it's possible it could have changed
850
+ // this updates the element's css classes, attrs, props, listeners, etc.
851
+ updateElement(oldVNode, newVNode, isSvgMode);
852
+ }
853
+ }
475
854
  if (oldChildren !== null && newChildren !== null) {
476
855
  // looks like there's child vnodes for both the old and new vnodes
477
856
  // so we need to call `updateChildren` to reconcile them
478
857
  updateChildren(elm, oldChildren, newVNode, newChildren);
479
858
  }
480
859
  else if (newChildren !== null) {
481
- // no old child vnodes, but there are new child vnodes to add
482
- if (oldVNode.$text$ !== null) {
483
- // the old vnode was text, so be sure to clear it out
484
- elm.textContent = '';
485
- }
486
860
  // add the new vnode children
487
861
  addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
488
862
  }
@@ -490,13 +864,23 @@ const patch = (oldVNode, newVNode) => {
490
864
  // no new child vnodes, but there are old child vnodes to remove
491
865
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
492
866
  }
493
- }
494
- else if (oldVNode.$text$ !== text) {
495
- // update the text content for the text only vnode
496
- // and also only if the text is different than before
497
- elm.data = text;
867
+ if (isSvgMode && tag === 'svg') {
868
+ isSvgMode = false;
869
+ }
498
870
  }
499
871
  };
872
+ /**
873
+ * The main entry point for Stencil's virtual DOM-based rendering engine
874
+ *
875
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
876
+ * function will handle creating a virtual DOM tree with a single root, patching
877
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
878
+ * relocation, and reflecting attributes.
879
+ *
880
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
881
+ * the DOM node into which it should be rendered.
882
+ * @param renderFnResults the virtual DOM nodes to be rendered
883
+ */
500
884
  const renderVdom = (hostRef, renderFnResults) => {
501
885
  const hostElm = hostRef.$hostElement$;
502
886
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -512,32 +896,6 @@ const renderVdom = (hostRef, renderFnResults) => {
512
896
  // synchronous patch
513
897
  patch(oldVNode, rootVnode);
514
898
  };
515
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
516
- const createEvent = (ref, name, flags) => {
517
- const elm = getElement(ref);
518
- return {
519
- emit: (detail) => {
520
- return emitEvent(elm, name, {
521
- bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
522
- composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
523
- cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
524
- detail,
525
- });
526
- },
527
- };
528
- };
529
- /**
530
- * Helper function to create & dispatch a custom Event on a provided target
531
- * @param elm the target of the Event
532
- * @param name the name to give the custom Event
533
- * @param opts options for configuring a custom Event
534
- * @returns the custom Event
535
- */
536
- const emitEvent = (elm, name, opts) => {
537
- const ev = plt.ce(name, opts);
538
- elm.dispatchEvent(ev);
539
- return ev;
540
- };
541
899
  const attachToAncestor = (hostRef, ancestorComponent) => {
542
900
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
543
901
  ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
@@ -562,6 +920,14 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
562
920
  const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
563
921
  const instance = hostRef.$lazyInstance$ ;
564
922
  let promise;
923
+ if (isInitialLoad) {
924
+ {
925
+ promise = safeCall(instance, 'componentWillLoad');
926
+ }
927
+ }
928
+ {
929
+ promise = then(promise, () => safeCall(instance, 'componentWillRender'));
930
+ }
565
931
  endSchedule();
566
932
  return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
567
933
  };
@@ -629,6 +995,7 @@ const postUpdateComponent = (hostRef) => {
629
995
  const tagName = hostRef.$cmpMeta$.$tagName$;
630
996
  const elm = hostRef.$hostElement$;
631
997
  const endPostUpdate = createTime('postUpdate', tagName);
998
+ const instance = hostRef.$lazyInstance$ ;
632
999
  const ancestorComponent = hostRef.$ancestorComponent$;
633
1000
  if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
634
1001
  hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
@@ -636,6 +1003,9 @@ const postUpdateComponent = (hostRef) => {
636
1003
  // DOM WRITE!
637
1004
  addHydratedFlag(elm);
638
1005
  }
1006
+ {
1007
+ safeCall(instance, 'componentDidLoad');
1008
+ }
639
1009
  endPostUpdate();
640
1010
  {
641
1011
  hostRef.$onReadyResolve$(elm);
@@ -674,53 +1044,27 @@ const appDidLoad = (who) => {
674
1044
  }
675
1045
  nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
676
1046
  };
1047
+ const safeCall = (instance, method, arg) => {
1048
+ if (instance && instance[method]) {
1049
+ try {
1050
+ return instance[method](arg);
1051
+ }
1052
+ catch (e) {
1053
+ consoleError(e);
1054
+ }
1055
+ }
1056
+ return undefined;
1057
+ };
677
1058
  const then = (promise, thenFn) => {
678
1059
  return promise && promise.then ? promise.then(thenFn) : thenFn();
679
1060
  };
680
1061
  const addHydratedFlag = (elm) => elm.classList.add('hydrated')
681
1062
  ;
682
- /**
683
- * Parse a new property value for a given property type.
684
- *
685
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
686
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
687
- * 1. `any`, the type given to `propValue` in the function signature
688
- * 2. the type stored from `propType`.
689
- *
690
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
691
- *
692
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
693
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
694
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
695
- * ```tsx
696
- * <my-cmp prop-val={0}></my-cmp>
697
- * ```
698
- *
699
- * HTML prop values on the other hand, will always a string
700
- *
701
- * @param propValue the new value to coerce to some type
702
- * @param propType the type of the prop, expressed as a binary number
703
- * @returns the parsed/coerced value
704
- */
705
- const parsePropertyValue = (propValue, propType) => {
706
- // ensure this value is of the correct prop type
707
- if (propValue != null && !isComplexType(propValue)) {
708
- if (propType & 1 /* MEMBER_FLAGS.String */) {
709
- // could have been passed as a number or boolean
710
- // but we still want it as a string
711
- return String(propValue);
712
- }
713
- // redundant return here for better minification
714
- return propValue;
715
- }
716
- // not sure exactly what type we want
717
- // so no need to change to a different type
718
- return propValue;
719
- };
720
1063
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
721
1064
  const setValue = (ref, propName, newVal, cmpMeta) => {
722
1065
  // check our new property value against our internal value
723
1066
  const hostRef = getHostRef(ref);
1067
+ const elm = hostRef.$hostElement$ ;
724
1068
  const oldVal = hostRef.$instanceValues$.get(propName);
725
1069
  const flags = hostRef.$flags$;
726
1070
  const instance = hostRef.$lazyInstance$ ;
@@ -733,6 +1077,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
733
1077
  // set our new value!
734
1078
  hostRef.$instanceValues$.set(propName, newVal);
735
1079
  if (instance) {
1080
+ // get an array of method names of watch functions to call
1081
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1082
+ const watchMethods = cmpMeta.$watchers$[propName];
1083
+ if (watchMethods) {
1084
+ // this instance is watching for when this property changed
1085
+ watchMethods.map((watchMethodName) => {
1086
+ try {
1087
+ // fire off each of the watch methods that are watching this property
1088
+ instance[watchMethodName](newVal, oldVal, propName);
1089
+ }
1090
+ catch (e) {
1091
+ consoleError(e, elm);
1092
+ }
1093
+ });
1094
+ }
1095
+ }
736
1096
  if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
737
1097
  // looks like this value actually changed, so we've got work to do!
738
1098
  // but only if we've already rendered, otherwise just chill out
@@ -743,8 +1103,21 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
743
1103
  }
744
1104
  }
745
1105
  };
1106
+ /**
1107
+ * Attach a series of runtime constructs to a compiled Stencil component
1108
+ * constructor, including getters and setters for the `@Prop` and `@State`
1109
+ * decorators, callbacks for when attributes change, and so on.
1110
+ *
1111
+ * @param Cstr the constructor for a component that we need to process
1112
+ * @param cmpMeta metadata collected previously about the component
1113
+ * @param flags a number used to store a series of bit flags
1114
+ * @returns a reference to the same constructor passed in (but now mutated)
1115
+ */
746
1116
  const proxyComponent = (Cstr, cmpMeta, flags) => {
747
1117
  if (cmpMeta.$members$) {
1118
+ if (Cstr.watchers) {
1119
+ cmpMeta.$watchers$ = Cstr.watchers;
1120
+ }
748
1121
  // It's better to have a const than two Object.entries()
749
1122
  const members = Object.entries(cmpMeta.$members$);
750
1123
  const prototype = Cstr.prototype;
@@ -859,6 +1232,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
859
1232
  endLoad();
860
1233
  }
861
1234
  if (!Cstr.isProxied) {
1235
+ // we've never proxied this Constructor before
1236
+ // let's add the getters/setters to its prototype before
1237
+ // the first time we create an instance of the implementation
1238
+ {
1239
+ cmpMeta.$watchers$ = Cstr.watchers;
1240
+ }
862
1241
  proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
863
1242
  Cstr.isProxied = true;
864
1243
  }
@@ -882,7 +1261,11 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
882
1261
  {
883
1262
  hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
884
1263
  }
1264
+ {
1265
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1266
+ }
885
1267
  endNewInstance();
1268
+ fireConnectedCallback(hostRef.$lazyInstance$);
886
1269
  }
887
1270
  if (Cstr.style) {
888
1271
  // this component has styles but we haven't registered them yet
@@ -911,6 +1294,11 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
911
1294
  schedule();
912
1295
  }
913
1296
  };
1297
+ const fireConnectedCallback = (instance) => {
1298
+ {
1299
+ safeCall(instance, 'connectedCallback');
1300
+ }
1301
+ };
914
1302
  const connectedCallback = (elm) => {
915
1303
  if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
916
1304
  const hostRef = getHostRef(elm);
@@ -949,6 +1337,10 @@ const connectedCallback = (elm) => {
949
1337
  initializeComponent(elm, hostRef, cmpMeta);
950
1338
  }
951
1339
  }
1340
+ else {
1341
+ // fire off connectedCallback() on component instance
1342
+ fireConnectedCallback(hostRef.$lazyInstance$);
1343
+ }
952
1344
  endConnected();
953
1345
  }
954
1346
  };
@@ -958,6 +1350,7 @@ const disconnectedCallback = (elm) => {
958
1350
  }
959
1351
  };
960
1352
  const bootstrapLazy = (lazyBundles, options = {}) => {
1353
+ var _a;
961
1354
  const endBootstrap = createTime();
962
1355
  const cmpTags = [];
963
1356
  const exclude = options.exclude || [];
@@ -981,6 +1374,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
981
1374
  {
982
1375
  cmpMeta.$members$ = compactMeta[2];
983
1376
  }
1377
+ {
1378
+ cmpMeta.$watchers$ = {};
1379
+ }
984
1380
  const tagName = cmpMeta.$tagName$;
985
1381
  const HostElement = class extends HTMLElement {
986
1382
  // StencilLazyHost
@@ -1031,6 +1427,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1031
1427
  {
1032
1428
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1033
1429
  visibilityStyle.setAttribute('data-styles', '');
1430
+ // Apply CSP nonce to the style tag if it exists
1431
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1432
+ if (nonce != null) {
1433
+ visibilityStyle.setAttribute('nonce', nonce);
1434
+ }
1034
1435
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1035
1436
  }
1036
1437
  // Process deferred connectedCallbacks now all components have been registered
@@ -1046,6 +1447,13 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1046
1447
  // Fallback appLoad event
1047
1448
  endBootstrap();
1048
1449
  };
1450
+ /**
1451
+ * Assigns the given value to the nonce property on the runtime platform object.
1452
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1453
+ * @param nonce The value to be assigned to the platform nonce property.
1454
+ * @returns void
1455
+ */
1456
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1049
1457
  const hostRefs = /*@__PURE__*/ new WeakMap();
1050
1458
  const getHostRef = (ref) => hostRefs.get(ref);
1051
1459
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
@@ -1066,6 +1474,7 @@ const registerHost = (elm, cmpMeta) => {
1066
1474
  }
1067
1475
  return hostRefs.set(elm, hostRef);
1068
1476
  };
1477
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1069
1478
  const consoleError = (e, el) => (0, console.error)(e, el);
1070
1479
  const cmpModules = /*@__PURE__*/ new Map();
1071
1480
  const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
@@ -1090,6 +1499,27 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1090
1499
  }, consoleError);
1091
1500
  };
1092
1501
  const styles = /*@__PURE__*/ new Map();
1502
+ const win = typeof window !== 'undefined' ? window : {};
1503
+ const doc = win.document || { head: {} };
1504
+ const plt = {
1505
+ $flags$: 0,
1506
+ $resourcesUrl$: '',
1507
+ jmp: (h) => h(),
1508
+ raf: (h) => requestAnimationFrame(h),
1509
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1510
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1511
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1512
+ };
1513
+ const promiseResolve = (v) => Promise.resolve(v);
1514
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1515
+ try {
1516
+ new CSSStyleSheet();
1517
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1518
+ }
1519
+ catch (e) { }
1520
+ return false;
1521
+ })()
1522
+ ;
1093
1523
  const queueDomReads = [];
1094
1524
  const queueDomWrites = [];
1095
1525
  const queueTask = (queue, write) => (cb) => {
@@ -1133,8 +1563,12 @@ const flush = () => {
1133
1563
  const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1134
1564
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1135
1565
 
1566
+ exports.Host = Host;
1136
1567
  exports.bootstrapLazy = bootstrapLazy;
1137
- exports.createEvent = createEvent;
1568
+ exports.getElement = getElement;
1138
1569
  exports.h = h;
1139
1570
  exports.promiseResolve = promiseResolve;
1140
1571
  exports.registerInstance = registerInstance;
1572
+ exports.setNonce = setNonce;
1573
+
1574
+ //# sourceMappingURL=index-8880977f.js.map