@siemens/ix-icons 1.0.4 → 1.1.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. package/README.md +39 -0
  2. package/dist/cjs/icon-f99c8bde.js +99 -0
  3. package/dist/cjs/icon-f99c8bde.js.map +1 -0
  4. package/dist/cjs/index-22d7f5a7.js +1481 -0
  5. package/dist/cjs/index-22d7f5a7.js.map +1 -0
  6. package/dist/cjs/index.cjs.js +12 -0
  7. package/dist/cjs/index.cjs.js.map +1 -0
  8. package/dist/cjs/ix-icon.cjs.entry.js +12 -0
  9. package/dist/cjs/ix-icon.cjs.entry.js.map +1 -0
  10. package/dist/cjs/ix-icons.cjs.js +28 -0
  11. package/dist/cjs/ix-icons.cjs.js.map +1 -0
  12. package/dist/cjs/loader.cjs.js +24 -0
  13. package/dist/cjs/loader.cjs.js.map +1 -0
  14. package/dist/collection/collection-manifest.json +12 -0
  15. package/dist/collection/components/icon/icon.css +2519 -0
  16. package/dist/collection/components/icon/icon.js +158 -0
  17. package/dist/collection/components/icon/icon.js.map +1 -0
  18. package/dist/collection/components/icon/resolveIcon.js +37 -0
  19. package/dist/collection/components/icon/resolveIcon.js.map +1 -0
  20. package/dist/collection/components/icon/test/rocker-example.js +5 -0
  21. package/dist/collection/components/icon/test/rocker-example.js.map +1 -0
  22. package/dist/collection/index.js +2 -0
  23. package/dist/collection/index.js.map +1 -0
  24. package/dist/components/icon.js +118 -0
  25. package/dist/components/icon.js.map +1 -0
  26. package/dist/components/index.d.ts +27 -0
  27. package/dist/components/index.js +4 -0
  28. package/dist/components/index.js.map +1 -0
  29. package/dist/components/ix-icon.d.ts +11 -0
  30. package/dist/components/ix-icon.js +8 -0
  31. package/dist/components/ix-icon.js.map +1 -0
  32. package/dist/esm/icon-f67da1e1.js +97 -0
  33. package/dist/esm/icon-f67da1e1.js.map +1 -0
  34. package/dist/esm/index-460e19e2.js +1454 -0
  35. package/dist/esm/index-460e19e2.js.map +1 -0
  36. package/dist/esm/index.js +4 -0
  37. package/dist/esm/index.js.map +1 -0
  38. package/dist/esm/ix-icon.entry.js +4 -0
  39. package/dist/esm/ix-icon.entry.js.map +1 -0
  40. package/dist/esm/ix-icons.js +23 -0
  41. package/dist/esm/ix-icons.js.map +1 -0
  42. package/dist/esm/loader.js +20 -0
  43. package/dist/esm/loader.js.map +1 -0
  44. package/dist/esm/polyfills/core-js.js +11 -0
  45. package/dist/esm/polyfills/css-shim.js +1 -0
  46. package/dist/esm/polyfills/dom.js +79 -0
  47. package/dist/esm/polyfills/es5-html-element.js +1 -0
  48. package/dist/esm/polyfills/index.js +34 -0
  49. package/dist/esm/polyfills/system.js +6 -0
  50. package/dist/fonts/ix-icons.eot +0 -0
  51. package/dist/fonts/ix-icons.ttf +0 -0
  52. package/dist/fonts/ix-icons.woff +0 -0
  53. package/dist/fonts/ix-icons.woff2 +0 -0
  54. package/dist/index.cjs.js +1 -0
  55. package/dist/index.js +1 -0
  56. package/dist/ix-icons/index.esm.js +2 -0
  57. package/dist/ix-icons/index.esm.js.map +1 -0
  58. package/dist/ix-icons/ix-icons.esm.js +2 -0
  59. package/dist/ix-icons/ix-icons.esm.js.map +1 -0
  60. package/dist/ix-icons/p-11a7e554.js +2 -0
  61. package/dist/ix-icons/p-11a7e554.js.map +1 -0
  62. package/dist/ix-icons/p-625c25c8.js +3 -0
  63. package/dist/ix-icons/p-625c25c8.js.map +1 -0
  64. package/dist/ix-icons/p-fcaa76de.entry.js +2 -0
  65. package/dist/ix-icons/p-fcaa76de.entry.js.map +1 -0
  66. package/dist/types/components/icon/icon.d.ts +24 -0
  67. package/dist/types/components/icon/resolveIcon.d.ts +3 -0
  68. package/dist/types/components/icon/test/rocker-example.d.ts +1 -0
  69. package/dist/types/components.d.ts +65 -0
  70. package/dist/types/index.d.ts +2 -0
  71. package/dist/types/stencil-public-runtime.d.ts +1638 -0
  72. package/icons/index.d.ts +595 -0
  73. package/icons/index.js +595 -0
  74. package/icons/index.mjs +595 -0
  75. package/icons/package.json +8 -0
  76. package/loader/cdn.js +3 -0
  77. package/loader/index.cjs.js +3 -0
  78. package/loader/index.d.ts +21 -0
  79. package/loader/index.es2017.js +3 -0
  80. package/loader/index.js +4 -0
  81. package/loader/package.json +11 -0
  82. package/package.json +37 -15
  83. package/dist/scss/ix-icons.scss +0 -639
@@ -0,0 +1,1481 @@
1
+ 'use strict';
2
+
3
+ function _interopNamespace(e) {
4
+ if (e && e.__esModule) return e;
5
+ var n = Object.create(null);
6
+ if (e) {
7
+ Object.keys(e).forEach(function (k) {
8
+ if (k !== 'default') {
9
+ var d = Object.getOwnPropertyDescriptor(e, k);
10
+ Object.defineProperty(n, k, d.get ? d : {
11
+ enumerable: true,
12
+ get: function () {
13
+ return e[k];
14
+ }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n['default'] = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ const NAMESPACE = 'ix-icons';
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
+ */
33
+ let scopeId;
34
+ let hostTagName;
35
+ let isSvgMode = false;
36
+ let queuePending = false;
37
+ const createTime = (fnName, tagName = '') => {
38
+ {
39
+ return () => {
40
+ return;
41
+ };
42
+ }
43
+ };
44
+ const uniqueTime = (key, measureText) => {
45
+ {
46
+ return () => {
47
+ return;
48
+ };
49
+ }
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
+ const isDef = (v) => v != null;
61
+ /**
62
+ * Check whether a value is a 'complex type', defined here as an object or a
63
+ * function.
64
+ *
65
+ * @param o the value to check
66
+ * @returns whether it's a complex type or not
67
+ */
68
+ const isComplexType = (o) => {
69
+ // https://jsperf.com/typeof-fn-object/5
70
+ o = typeof o;
71
+ return o === 'object' || o === 'function';
72
+ };
73
+ /**
74
+ * Helper method for querying a `meta` tag that contains a nonce value
75
+ * out of a DOM's head.
76
+ *
77
+ * @param doc The DOM containing the `head` to query against
78
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
79
+ * exists or the tag has no content.
80
+ */
81
+ function queryNonceMetaTagContent(doc) {
82
+ var _a, _b, _c;
83
+ 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;
84
+ }
85
+ /**
86
+ * Production h() function based on Preact by
87
+ * Jason Miller (@developit)
88
+ * Licensed under the MIT License
89
+ * https://github.com/developit/preact/blob/master/LICENSE
90
+ *
91
+ * Modified for Stencil's compiler and vdom
92
+ */
93
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
94
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
95
+ const h = (nodeName, vnodeData, ...children) => {
96
+ let child = null;
97
+ let simple = false;
98
+ let lastSimple = false;
99
+ const vNodeChildren = [];
100
+ const walk = (c) => {
101
+ for (let i = 0; i < c.length; i++) {
102
+ child = c[i];
103
+ if (Array.isArray(child)) {
104
+ walk(child);
105
+ }
106
+ else if (child != null && typeof child !== 'boolean') {
107
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
108
+ child = String(child);
109
+ }
110
+ if (simple && lastSimple) {
111
+ // If the previous child was simple (string), we merge both
112
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
113
+ }
114
+ else {
115
+ // Append a new vNode, if it's text, we create a text vNode
116
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
117
+ }
118
+ lastSimple = simple;
119
+ }
120
+ }
121
+ };
122
+ walk(children);
123
+ if (vnodeData) {
124
+ {
125
+ const classData = vnodeData.className || vnodeData.class;
126
+ if (classData) {
127
+ vnodeData.class =
128
+ typeof classData !== 'object'
129
+ ? classData
130
+ : Object.keys(classData)
131
+ .filter((k) => classData[k])
132
+ .join(' ');
133
+ }
134
+ }
135
+ }
136
+ const vnode = newVNode(nodeName, null);
137
+ vnode.$attrs$ = vnodeData;
138
+ if (vNodeChildren.length > 0) {
139
+ vnode.$children$ = vNodeChildren;
140
+ }
141
+ return vnode;
142
+ };
143
+ /**
144
+ * A utility function for creating a virtual DOM node from a tag and some
145
+ * possible text content.
146
+ *
147
+ * @param tag the tag for this element
148
+ * @param text possible text content for the node
149
+ * @returns a newly-minted virtual DOM node
150
+ */
151
+ const newVNode = (tag, text) => {
152
+ const vnode = {
153
+ $flags$: 0,
154
+ $tag$: tag,
155
+ $text$: text,
156
+ $elm$: null,
157
+ $children$: null,
158
+ };
159
+ {
160
+ vnode.$attrs$ = null;
161
+ }
162
+ return vnode;
163
+ };
164
+ const Host = {};
165
+ /**
166
+ * Check whether a given node is a Host node or not
167
+ *
168
+ * @param node the virtual DOM node to check
169
+ * @returns whether it's a Host node or not
170
+ */
171
+ const isHost = (node) => node && node.$tag$ === Host;
172
+ /**
173
+ * Parse a new property value for a given property type.
174
+ *
175
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
176
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
177
+ * 1. `any`, the type given to `propValue` in the function signature
178
+ * 2. the type stored from `propType`.
179
+ *
180
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
181
+ *
182
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
183
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
184
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
185
+ * ```tsx
186
+ * <my-cmp prop-val={0}></my-cmp>
187
+ * ```
188
+ *
189
+ * HTML prop values on the other hand, will always a string
190
+ *
191
+ * @param propValue the new value to coerce to some type
192
+ * @param propType the type of the prop, expressed as a binary number
193
+ * @returns the parsed/coerced value
194
+ */
195
+ const parsePropertyValue = (propValue, propType) => {
196
+ // ensure this value is of the correct prop type
197
+ if (propValue != null && !isComplexType(propValue)) {
198
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
199
+ // could have been passed as a number or boolean
200
+ // but we still want it as a string
201
+ return String(propValue);
202
+ }
203
+ // redundant return here for better minification
204
+ return propValue;
205
+ }
206
+ // not sure exactly what type we want
207
+ // so no need to change to a different type
208
+ return propValue;
209
+ };
210
+ /**
211
+ * Helper function to create & dispatch a custom Event on a provided target
212
+ * @param elm the target of the Event
213
+ * @param name the name to give the custom Event
214
+ * @param opts options for configuring a custom Event
215
+ * @returns the custom Event
216
+ */
217
+ const emitEvent = (elm, name, opts) => {
218
+ const ev = plt.ce(name, opts);
219
+ elm.dispatchEvent(ev);
220
+ return ev;
221
+ };
222
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
223
+ const registerStyle = (scopeId, cssText, allowCS) => {
224
+ let style = styles.get(scopeId);
225
+ if (supportsConstructableStylesheets && allowCS) {
226
+ style = (style || new CSSStyleSheet());
227
+ if (typeof style === 'string') {
228
+ style = cssText;
229
+ }
230
+ else {
231
+ style.replaceSync(cssText);
232
+ }
233
+ }
234
+ else {
235
+ style = cssText;
236
+ }
237
+ styles.set(scopeId, style);
238
+ };
239
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
240
+ var _a;
241
+ let scopeId = getScopeId(cmpMeta);
242
+ const style = styles.get(scopeId);
243
+ // if an element is NOT connected then getRootNode() will return the wrong root node
244
+ // so the fallback is to always use the document for the root node in those cases
245
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
246
+ if (style) {
247
+ if (typeof style === 'string') {
248
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
249
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
250
+ let styleElm;
251
+ if (!appliedStyles) {
252
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
253
+ }
254
+ if (!appliedStyles.has(scopeId)) {
255
+ {
256
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
257
+ {
258
+ styleElm = doc.createElement('style');
259
+ styleElm.innerHTML = style;
260
+ }
261
+ // Apply CSP nonce to the style tag if it exists
262
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
263
+ if (nonce != null) {
264
+ styleElm.setAttribute('nonce', nonce);
265
+ }
266
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
267
+ }
268
+ if (appliedStyles) {
269
+ appliedStyles.add(scopeId);
270
+ }
271
+ }
272
+ }
273
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
274
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
275
+ }
276
+ }
277
+ return scopeId;
278
+ };
279
+ const attachStyles = (hostRef) => {
280
+ const cmpMeta = hostRef.$cmpMeta$;
281
+ const elm = hostRef.$hostElement$;
282
+ const flags = cmpMeta.$flags$;
283
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
284
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
285
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
286
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
287
+ // only required when we're NOT using native shadow dom (slot)
288
+ // or this browser doesn't support native shadow dom
289
+ // and this host element was NOT created with SSR
290
+ // let's pick out the inner content for slot projection
291
+ // create a node to represent where the original
292
+ // content was first placed, which is useful later on
293
+ // DOM WRITE!!
294
+ elm['s-sc'] = scopeId;
295
+ elm.classList.add(scopeId + '-h');
296
+ }
297
+ endAttachStyles();
298
+ };
299
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
300
+ /**
301
+ * Production setAccessor() function based on Preact by
302
+ * Jason Miller (@developit)
303
+ * Licensed under the MIT License
304
+ * https://github.com/developit/preact/blob/master/LICENSE
305
+ *
306
+ * Modified for Stencil's compiler and vdom
307
+ */
308
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
309
+ if (oldValue !== newValue) {
310
+ let isProp = isMemberInElement(elm, memberName);
311
+ memberName.toLowerCase();
312
+ if (memberName === 'class') {
313
+ const classList = elm.classList;
314
+ const oldClasses = parseClassList(oldValue);
315
+ const newClasses = parseClassList(newValue);
316
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
317
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
318
+ }
319
+ else if (memberName === 'style') {
320
+ // update style attribute, css properties and values
321
+ {
322
+ for (const prop in oldValue) {
323
+ if (!newValue || newValue[prop] == null) {
324
+ if (prop.includes('-')) {
325
+ elm.style.removeProperty(prop);
326
+ }
327
+ else {
328
+ elm.style[prop] = '';
329
+ }
330
+ }
331
+ }
332
+ }
333
+ for (const prop in newValue) {
334
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
335
+ if (prop.includes('-')) {
336
+ elm.style.setProperty(prop, newValue[prop]);
337
+ }
338
+ else {
339
+ elm.style[prop] = newValue[prop];
340
+ }
341
+ }
342
+ }
343
+ }
344
+ else {
345
+ // Set property if it exists and it's not a SVG
346
+ const isComplex = isComplexType(newValue);
347
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
348
+ try {
349
+ if (!elm.tagName.includes('-')) {
350
+ const n = newValue == null ? '' : newValue;
351
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
352
+ if (memberName === 'list') {
353
+ isProp = false;
354
+ }
355
+ else if (oldValue == null || elm[memberName] != n) {
356
+ elm[memberName] = n;
357
+ }
358
+ }
359
+ else {
360
+ elm[memberName] = newValue;
361
+ }
362
+ }
363
+ catch (e) { }
364
+ }
365
+ if (newValue == null || newValue === false) {
366
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
367
+ {
368
+ elm.removeAttribute(memberName);
369
+ }
370
+ }
371
+ }
372
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
373
+ newValue = newValue === true ? '' : newValue;
374
+ {
375
+ elm.setAttribute(memberName, newValue);
376
+ }
377
+ }
378
+ }
379
+ }
380
+ };
381
+ const parseClassListRegex = /\s/;
382
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
383
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
384
+ // if the element passed in is a shadow root, which is a document fragment
385
+ // then we want to be adding attrs/props to the shadow root's "host" element
386
+ // if it's not a shadow root, then we add attrs/props to the same element
387
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
388
+ ? newVnode.$elm$.host
389
+ : newVnode.$elm$;
390
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
391
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
392
+ {
393
+ // remove attributes no longer present on the vnode by setting them to undefined
394
+ for (memberName in oldVnodeAttrs) {
395
+ if (!(memberName in newVnodeAttrs)) {
396
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
397
+ }
398
+ }
399
+ }
400
+ // add new & update changed attributes
401
+ for (memberName in newVnodeAttrs) {
402
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
403
+ }
404
+ };
405
+ /**
406
+ * Create a DOM Node corresponding to one of the children of a given VNode.
407
+ *
408
+ * @param oldParentVNode the parent VNode from the previous render
409
+ * @param newParentVNode the parent VNode from the current render
410
+ * @param childIndex the index of the VNode, in the _new_ parent node's
411
+ * children, for which we will create a new DOM node
412
+ * @param parentElm the parent DOM node which our new node will be a child of
413
+ * @returns the newly created node
414
+ */
415
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
416
+ // tslint:disable-next-line: prefer-const
417
+ const newVNode = newParentVNode.$children$[childIndex];
418
+ let i = 0;
419
+ let elm;
420
+ let childNode;
421
+ if (newVNode.$text$ !== null) {
422
+ // create text node
423
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
424
+ }
425
+ else {
426
+ // create element
427
+ elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
428
+ // add css classes, attrs, props, listeners, etc.
429
+ {
430
+ updateElement(null, newVNode, isSvgMode);
431
+ }
432
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
433
+ // if there is a scopeId and this is the initial render
434
+ // then let's add the scopeId as a css class
435
+ elm.classList.add((elm['s-si'] = scopeId));
436
+ }
437
+ if (newVNode.$children$) {
438
+ for (i = 0; i < newVNode.$children$.length; ++i) {
439
+ // create the node
440
+ childNode = createElm(oldParentVNode, newVNode, i);
441
+ // return node could have been null
442
+ if (childNode) {
443
+ // append our new node
444
+ elm.appendChild(childNode);
445
+ }
446
+ }
447
+ }
448
+ }
449
+ return elm;
450
+ };
451
+ /**
452
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
453
+ * add them to the DOM in the appropriate place.
454
+ *
455
+ * @param parentElm the DOM node which should be used as a parent for the new
456
+ * DOM nodes
457
+ * @param before a child of the `parentElm` which the new children should be
458
+ * inserted before (optional)
459
+ * @param parentVNode the parent virtual DOM node
460
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
461
+ * @param startIdx the index in the child virtual DOM nodes at which to start
462
+ * creating DOM nodes (inclusive)
463
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
464
+ * creating DOM nodes (inclusive)
465
+ */
466
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
467
+ let containerElm = (parentElm);
468
+ let childNode;
469
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
470
+ containerElm = containerElm.shadowRoot;
471
+ }
472
+ for (; startIdx <= endIdx; ++startIdx) {
473
+ if (vnodes[startIdx]) {
474
+ childNode = createElm(null, parentVNode, startIdx);
475
+ if (childNode) {
476
+ vnodes[startIdx].$elm$ = childNode;
477
+ containerElm.insertBefore(childNode, before);
478
+ }
479
+ }
480
+ }
481
+ };
482
+ /**
483
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
484
+ * This can be used to, for instance, clean up after a list of children which
485
+ * should no longer be shown.
486
+ *
487
+ * This function also handles some of Stencil's slot relocation logic.
488
+ *
489
+ * @param vnodes a list of virtual DOM nodes to remove
490
+ * @param startIdx the index at which to start removing nodes (inclusive)
491
+ * @param endIdx the index at which to stop removing nodes (inclusive)
492
+ */
493
+ const removeVnodes = (vnodes, startIdx, endIdx) => {
494
+ for (let index = startIdx; index <= endIdx; ++index) {
495
+ const vnode = vnodes[index];
496
+ if (vnode) {
497
+ const elm = vnode.$elm$;
498
+ if (elm) {
499
+ // remove the vnode's element from the dom
500
+ elm.remove();
501
+ }
502
+ }
503
+ }
504
+ };
505
+ /**
506
+ * Reconcile the children of a new VNode with the children of an old VNode by
507
+ * traversing the two collections of children, identifying nodes that are
508
+ * conserved or changed, calling out to `patch` to make any necessary
509
+ * updates to the DOM, and rearranging DOM nodes as needed.
510
+ *
511
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
512
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
513
+ * 'windows' by storing start and end indices and references to the
514
+ * corresponding array entries. Initially the two 'windows' are basically equal
515
+ * to the entire array, but we progressively narrow the windows until there are
516
+ * no children left to update by doing the following:
517
+ *
518
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
519
+ * that if we have an initial array like the following we'll end up dealing
520
+ * only with a window bounded by the highlighted elements:
521
+ *
522
+ * [null, null, VNode1 , ... , VNode2, null, null]
523
+ * ^^^^^^ ^^^^^^
524
+ *
525
+ * 2. Check to see if the elements at the head and tail positions are equal
526
+ * across the windows. This will basically detect elements which haven't
527
+ * been added, removed, or changed position, i.e. if you had the following
528
+ * VNode elements (represented as HTML):
529
+ *
530
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
531
+ * newVNode: `<div><p><span>THERE</span></p></div>`
532
+ *
533
+ * Then when comparing the children of the `<div>` tag we check the equality
534
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
535
+ * same tag in the same position, we'd be able to avoid completely
536
+ * re-rendering the subtree under them with a new DOM element and would just
537
+ * call out to `patch` to handle reconciling their children and so on.
538
+ *
539
+ * 3. Check, for both windows, to see if the element at the beginning of the
540
+ * window corresponds to the element at the end of the other window. This is
541
+ * a heuristic which will let us identify _some_ situations in which
542
+ * elements have changed position, for instance it _should_ detect that the
543
+ * children nodes themselves have not changed but merely moved in the
544
+ * following example:
545
+ *
546
+ * oldVNode: `<div><element-one /><element-two /></div>`
547
+ * newVNode: `<div><element-two /><element-one /></div>`
548
+ *
549
+ * If we find cases like this then we also need to move the concrete DOM
550
+ * elements corresponding to the moved children to write the re-order to the
551
+ * DOM.
552
+ *
553
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
554
+ * nodes in the old children which have the same key as the first element in
555
+ * our window on the new children. If we find such a node we handle calling
556
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
557
+ * what we find.
558
+ *
559
+ * Finally, once we've narrowed our 'windows' to the point that either of them
560
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
561
+ * insertion or deletion that needs to happen to get a DOM state that correctly
562
+ * reflects the new child VNodes. If, for instance, after our window on the old
563
+ * children has collapsed we still have more nodes on the new children that
564
+ * we haven't dealt with yet then we need to add them, or if the new children
565
+ * collapse but we still have unhandled _old_ children then we need to make
566
+ * sure the corresponding DOM nodes are removed.
567
+ *
568
+ * @param parentElm the node into which the parent VNode is rendered
569
+ * @param oldCh the old children of the parent node
570
+ * @param newVNode the new VNode which will replace the parent
571
+ * @param newCh the new children of the parent node
572
+ */
573
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
574
+ let oldStartIdx = 0;
575
+ let newStartIdx = 0;
576
+ let oldEndIdx = oldCh.length - 1;
577
+ let oldStartVnode = oldCh[0];
578
+ let oldEndVnode = oldCh[oldEndIdx];
579
+ let newEndIdx = newCh.length - 1;
580
+ let newStartVnode = newCh[0];
581
+ let newEndVnode = newCh[newEndIdx];
582
+ let node;
583
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
584
+ if (oldStartVnode == null) {
585
+ // VNode might have been moved left
586
+ oldStartVnode = oldCh[++oldStartIdx];
587
+ }
588
+ else if (oldEndVnode == null) {
589
+ oldEndVnode = oldCh[--oldEndIdx];
590
+ }
591
+ else if (newStartVnode == null) {
592
+ newStartVnode = newCh[++newStartIdx];
593
+ }
594
+ else if (newEndVnode == null) {
595
+ newEndVnode = newCh[--newEndIdx];
596
+ }
597
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
598
+ // if the start nodes are the same then we should patch the new VNode
599
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
600
+ // indices to reflect that. We don't need to move any DOM Nodes around
601
+ // since things are matched up in order.
602
+ patch(oldStartVnode, newStartVnode);
603
+ oldStartVnode = oldCh[++oldStartIdx];
604
+ newStartVnode = newCh[++newStartIdx];
605
+ }
606
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
607
+ // likewise, if the end nodes are the same we patch new onto old and
608
+ // decrement our end indices, and also likewise in this case we don't
609
+ // need to move any DOM Nodes.
610
+ patch(oldEndVnode, newEndVnode);
611
+ oldEndVnode = oldCh[--oldEndIdx];
612
+ newEndVnode = newCh[--newEndIdx];
613
+ }
614
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
615
+ patch(oldStartVnode, newEndVnode);
616
+ // We need to move the element for `oldStartVnode` into a position which
617
+ // will be appropriate for `newEndVnode`. For this we can use
618
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
619
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
620
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
621
+ //
622
+ // <old-start-node />
623
+ // <some-intervening-node />
624
+ // <old-end-node />
625
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
626
+ // <next-sibling />
627
+ //
628
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
629
+ // the node for `oldStartVnode` at the end of the children of
630
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
631
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
632
+ // append it to the children of the parent element.
633
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
634
+ oldStartVnode = oldCh[++oldStartIdx];
635
+ newEndVnode = newCh[--newEndIdx];
636
+ }
637
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
638
+ patch(oldEndVnode, newStartVnode);
639
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
640
+ // the same node, so since we're here we know that they are not. Thus we
641
+ // can move the element for `oldEndVnode` _before_ the element for
642
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
643
+ // future.
644
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
645
+ oldEndVnode = oldCh[--oldEndIdx];
646
+ newStartVnode = newCh[++newStartIdx];
647
+ }
648
+ else {
649
+ {
650
+ // We either didn't find an element in the old children that matches
651
+ // the key of the first new child OR the build is not using `key`
652
+ // attributes at all. In either case we need to create a new element
653
+ // for the new node.
654
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
655
+ newStartVnode = newCh[++newStartIdx];
656
+ }
657
+ if (node) {
658
+ // if we created a new node then handle inserting it to the DOM
659
+ {
660
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
661
+ }
662
+ }
663
+ }
664
+ }
665
+ if (oldStartIdx > oldEndIdx) {
666
+ // we have some more new nodes to add which don't match up with old nodes
667
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
668
+ }
669
+ else if (newStartIdx > newEndIdx) {
670
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
671
+ // in the new array, so lets remove them (which entails cleaning up the
672
+ // relevant DOM nodes)
673
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
674
+ }
675
+ };
676
+ /**
677
+ * Compare two VNodes to determine if they are the same
678
+ *
679
+ * **NB**: This function is an equality _heuristic_ based on the available
680
+ * information set on the two VNodes and can be misleading under certain
681
+ * circumstances. In particular, if the two nodes do not have `key` attrs
682
+ * (available under `$key$` on VNodes) then the function falls back on merely
683
+ * checking that they have the same tag.
684
+ *
685
+ * So, in other words, if `key` attrs are not set on VNodes which may be
686
+ * changing order within a `children` array or something along those lines then
687
+ * we could obtain a false negative and then have to do needless re-rendering
688
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
689
+ *
690
+ * @param leftVNode the first VNode to check
691
+ * @param rightVNode the second VNode to check
692
+ * @returns whether they're equal or not
693
+ */
694
+ const isSameVnode = (leftVNode, rightVNode) => {
695
+ // compare if two vnode to see if they're "technically" the same
696
+ // need to have the same element tag, and same key to be the same
697
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
698
+ return true;
699
+ }
700
+ return false;
701
+ };
702
+ /**
703
+ * Handle reconciling an outdated VNode with a new one which corresponds to
704
+ * it. This function handles flushing updates to the DOM and reconciling the
705
+ * children of the two nodes (if any).
706
+ *
707
+ * @param oldVNode an old VNode whose DOM element and children we want to update
708
+ * @param newVNode a new VNode representing an updated version of the old one
709
+ */
710
+ const patch = (oldVNode, newVNode) => {
711
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
712
+ const oldChildren = oldVNode.$children$;
713
+ const newChildren = newVNode.$children$;
714
+ const text = newVNode.$text$;
715
+ if (text === null) {
716
+ {
717
+ {
718
+ // either this is the first render of an element OR it's an update
719
+ // AND we already know it's possible it could have changed
720
+ // this updates the element's css classes, attrs, props, listeners, etc.
721
+ updateElement(oldVNode, newVNode, isSvgMode);
722
+ }
723
+ }
724
+ if (oldChildren !== null && newChildren !== null) {
725
+ // looks like there's child vnodes for both the old and new vnodes
726
+ // so we need to call `updateChildren` to reconcile them
727
+ updateChildren(elm, oldChildren, newVNode, newChildren);
728
+ }
729
+ else if (newChildren !== null) {
730
+ // no old child vnodes, but there are new child vnodes to add
731
+ if (oldVNode.$text$ !== null) {
732
+ // the old vnode was text, so be sure to clear it out
733
+ elm.textContent = '';
734
+ }
735
+ // add the new vnode children
736
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
737
+ }
738
+ else if (oldChildren !== null) {
739
+ // no new child vnodes, but there are old child vnodes to remove
740
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
741
+ }
742
+ }
743
+ else if (oldVNode.$text$ !== text) {
744
+ // update the text content for the text only vnode
745
+ // and also only if the text is different than before
746
+ elm.data = text;
747
+ }
748
+ };
749
+ /**
750
+ * The main entry point for Stencil's virtual DOM-based rendering engine
751
+ *
752
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
753
+ * function will handle creating a virtual DOM tree with a single root, patching
754
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
755
+ * relocation, and reflecting attributes.
756
+ *
757
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
758
+ * the DOM node into which it should be rendered.
759
+ * @param renderFnResults the virtual DOM nodes to be rendered
760
+ */
761
+ const renderVdom = (hostRef, renderFnResults) => {
762
+ const hostElm = hostRef.$hostElement$;
763
+ const cmpMeta = hostRef.$cmpMeta$;
764
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
765
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
766
+ hostTagName = hostElm.tagName;
767
+ if (cmpMeta.$attrsToReflect$) {
768
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
769
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
770
+ }
771
+ rootVnode.$tag$ = null;
772
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
773
+ hostRef.$vnode$ = rootVnode;
774
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
775
+ {
776
+ scopeId = hostElm['s-sc'];
777
+ }
778
+ // synchronous patch
779
+ patch(oldVNode, rootVnode);
780
+ };
781
+ const attachToAncestor = (hostRef, ancestorComponent) => {
782
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
783
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
784
+ }
785
+ };
786
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
787
+ {
788
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
789
+ }
790
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
791
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
792
+ return;
793
+ }
794
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
795
+ // there is no ancestor component or the ancestor component
796
+ // has already fired off its lifecycle update then
797
+ // fire off the initial update
798
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
799
+ return writeTask(dispatch) ;
800
+ };
801
+ /**
802
+ * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
803
+ * component lifecycle methods like `componentWillLoad` as well as
804
+ * {@link updateComponent}, which will kick off the virtual DOM re-render.
805
+ *
806
+ * @param hostRef a reference to a host DOM node
807
+ * @param isInitialLoad whether we're on the initial load or not
808
+ * @returns an empty Promise which is used to enqueue a series of operations for
809
+ * the component
810
+ */
811
+ const dispatchHooks = (hostRef, isInitialLoad) => {
812
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
813
+ const instance = hostRef.$lazyInstance$ ;
814
+ // We're going to use this variable together with `enqueue` to implement a
815
+ // little promise-based queue. We start out with it `undefined`. When we add
816
+ // the first function to the queue we'll set this variable to be that
817
+ // function's return value. When we attempt to add subsequent values to the
818
+ // queue we'll check that value and, if it was a `Promise`, we'll then chain
819
+ // the new function off of that `Promise` using `.then()`. This will give our
820
+ // queue two nice properties:
821
+ //
822
+ // 1. If all functions added to the queue are synchronous they'll be called
823
+ // synchronously right away.
824
+ // 2. If all functions added to the queue are asynchronous they'll all be
825
+ // called in order after `dispatchHooks` exits.
826
+ let maybePromise;
827
+ endSchedule();
828
+ return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
829
+ };
830
+ /**
831
+ * This function uses a Promise to implement a simple first-in, first-out queue
832
+ * of functions to be called.
833
+ *
834
+ * The queue is ordered on the basis of the first argument. If it's
835
+ * `undefined`, then nothing is on the queue yet, so the provided function can
836
+ * be called synchronously (although note that this function may return a
837
+ * `Promise`). The idea is that then the return value of that enqueueing
838
+ * operation is kept around, so that if it was a `Promise` then subsequent
839
+ * functions can be enqueued by calling this function again with that `Promise`
840
+ * as the first argument.
841
+ *
842
+ * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
843
+ * @param fn a function to enqueue
844
+ * @returns either a `Promise` or the return value of the provided function
845
+ */
846
+ const enqueue = (maybePromise, fn) => maybePromise instanceof Promise ? maybePromise.then(fn) : fn();
847
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
848
+ const elm = hostRef.$hostElement$;
849
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
850
+ const rc = elm['s-rc'];
851
+ if (isInitialLoad) {
852
+ // DOM WRITE!
853
+ attachStyles(hostRef);
854
+ }
855
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
856
+ {
857
+ callRender(hostRef, instance);
858
+ }
859
+ if (rc) {
860
+ // ok, so turns out there are some child host elements
861
+ // waiting on this parent element to load
862
+ // let's fire off all update callbacks waiting
863
+ rc.map((cb) => cb());
864
+ elm['s-rc'] = undefined;
865
+ }
866
+ endRender();
867
+ endUpdate();
868
+ {
869
+ const childrenPromises = elm['s-p'];
870
+ const postUpdate = () => postUpdateComponent(hostRef);
871
+ if (childrenPromises.length === 0) {
872
+ postUpdate();
873
+ }
874
+ else {
875
+ Promise.all(childrenPromises).then(postUpdate);
876
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
877
+ childrenPromises.length = 0;
878
+ }
879
+ }
880
+ };
881
+ const callRender = (hostRef, instance, elm) => {
882
+ try {
883
+ instance = instance.render() ;
884
+ {
885
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
886
+ }
887
+ {
888
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
889
+ }
890
+ {
891
+ {
892
+ // looks like we've got child nodes to render into this host element
893
+ // or we need to update the css class/attrs on the host element
894
+ // DOM WRITE!
895
+ {
896
+ renderVdom(hostRef, instance);
897
+ }
898
+ }
899
+ }
900
+ }
901
+ catch (e) {
902
+ consoleError(e, hostRef.$hostElement$);
903
+ }
904
+ return null;
905
+ };
906
+ const postUpdateComponent = (hostRef) => {
907
+ const tagName = hostRef.$cmpMeta$.$tagName$;
908
+ const elm = hostRef.$hostElement$;
909
+ const endPostUpdate = createTime('postUpdate', tagName);
910
+ const ancestorComponent = hostRef.$ancestorComponent$;
911
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
912
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
913
+ {
914
+ // DOM WRITE!
915
+ addHydratedFlag(elm);
916
+ }
917
+ endPostUpdate();
918
+ {
919
+ hostRef.$onReadyResolve$(elm);
920
+ if (!ancestorComponent) {
921
+ appDidLoad();
922
+ }
923
+ }
924
+ }
925
+ else {
926
+ endPostUpdate();
927
+ }
928
+ // load events fire from bottom to top
929
+ // the deepest elements load first then bubbles up
930
+ {
931
+ if (hostRef.$onRenderResolve$) {
932
+ hostRef.$onRenderResolve$();
933
+ hostRef.$onRenderResolve$ = undefined;
934
+ }
935
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
936
+ nextTick(() => scheduleUpdate(hostRef, false));
937
+ }
938
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
939
+ }
940
+ // ( •_•)
941
+ // ( •_•)>⌐■-■
942
+ // (⌐■_■)
943
+ };
944
+ const appDidLoad = (who) => {
945
+ // on appload
946
+ // we have finish the first big initial render
947
+ {
948
+ addHydratedFlag(doc.documentElement);
949
+ }
950
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
951
+ };
952
+ const safeCall = (instance, method, arg) => {
953
+ if (instance && instance[method]) {
954
+ try {
955
+ return instance[method](arg);
956
+ }
957
+ catch (e) {
958
+ consoleError(e);
959
+ }
960
+ }
961
+ return undefined;
962
+ };
963
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
964
+ ;
965
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
966
+ const setValue = (ref, propName, newVal, cmpMeta) => {
967
+ // check our new property value against our internal value
968
+ const hostRef = getHostRef(ref);
969
+ const elm = hostRef.$hostElement$ ;
970
+ const oldVal = hostRef.$instanceValues$.get(propName);
971
+ const flags = hostRef.$flags$;
972
+ const instance = hostRef.$lazyInstance$ ;
973
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
974
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
975
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
976
+ const didValueChange = newVal !== oldVal && !areBothNaN;
977
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
978
+ // gadzooks! the property's value has changed!!
979
+ // set our new value!
980
+ hostRef.$instanceValues$.set(propName, newVal);
981
+ if (instance) {
982
+ // get an array of method names of watch functions to call
983
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
984
+ const watchMethods = cmpMeta.$watchers$[propName];
985
+ if (watchMethods) {
986
+ // this instance is watching for when this property changed
987
+ watchMethods.map((watchMethodName) => {
988
+ try {
989
+ // fire off each of the watch methods that are watching this property
990
+ instance[watchMethodName](newVal, oldVal, propName);
991
+ }
992
+ catch (e) {
993
+ consoleError(e, elm);
994
+ }
995
+ });
996
+ }
997
+ }
998
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
999
+ // looks like this value actually changed, so we've got work to do!
1000
+ // but only if we've already rendered, otherwise just chill out
1001
+ // queue that we need to do an update, but don't worry about queuing
1002
+ // up millions cuz this function ensures it only runs once
1003
+ scheduleUpdate(hostRef, false);
1004
+ }
1005
+ }
1006
+ }
1007
+ };
1008
+ /**
1009
+ * Attach a series of runtime constructs to a compiled Stencil component
1010
+ * constructor, including getters and setters for the `@Prop` and `@State`
1011
+ * decorators, callbacks for when attributes change, and so on.
1012
+ *
1013
+ * @param Cstr the constructor for a component that we need to process
1014
+ * @param cmpMeta metadata collected previously about the component
1015
+ * @param flags a number used to store a series of bit flags
1016
+ * @returns a reference to the same constructor passed in (but now mutated)
1017
+ */
1018
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
1019
+ if (cmpMeta.$members$) {
1020
+ if (Cstr.watchers) {
1021
+ cmpMeta.$watchers$ = Cstr.watchers;
1022
+ }
1023
+ // It's better to have a const than two Object.entries()
1024
+ const members = Object.entries(cmpMeta.$members$);
1025
+ const prototype = Cstr.prototype;
1026
+ members.map(([memberName, [memberFlags]]) => {
1027
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1028
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1029
+ // proxyComponent - prop
1030
+ Object.defineProperty(prototype, memberName, {
1031
+ get() {
1032
+ // proxyComponent, get value
1033
+ return getValue(this, memberName);
1034
+ },
1035
+ set(newValue) {
1036
+ // proxyComponent, set value
1037
+ setValue(this, memberName, newValue, cmpMeta);
1038
+ },
1039
+ configurable: true,
1040
+ enumerable: true,
1041
+ });
1042
+ }
1043
+ });
1044
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1045
+ const attrNameToPropName = new Map();
1046
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1047
+ plt.jmp(() => {
1048
+ const propName = attrNameToPropName.get(attrName);
1049
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1050
+ // in the case where an attribute was set inline.
1051
+ // ```html
1052
+ // <my-component some-attribute="some-value"></my-component>
1053
+ // ```
1054
+ //
1055
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
1056
+ // programmatically changes it before it has been upgraded as shown below:
1057
+ //
1058
+ // ```html
1059
+ // <!-- this component has _not_ been upgraded yet -->
1060
+ // <my-component id="test" some-attribute="some-value"></my-component>
1061
+ // <script>
1062
+ // // grab non-upgraded component
1063
+ // el = document.querySelector("#test");
1064
+ // el.someAttribute = "another-value";
1065
+ // // upgrade component
1066
+ // customElements.define('my-component', MyComponent);
1067
+ // </script>
1068
+ // ```
1069
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
1070
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1071
+ // to the value that was set inline i.e. "some-value" from above example. When
1072
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
1073
+ //
1074
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
1075
+ // by connectedCallback as this attributeChangedCallback will not fire.
1076
+ //
1077
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1078
+ //
1079
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1080
+ // properties here given that this goes against best practices outlined here
1081
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1082
+ if (this.hasOwnProperty(propName)) {
1083
+ newValue = this[propName];
1084
+ delete this[propName];
1085
+ }
1086
+ else if (prototype.hasOwnProperty(propName) &&
1087
+ typeof this[propName] === 'number' &&
1088
+ this[propName] == newValue) {
1089
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1090
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1091
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1092
+ return;
1093
+ }
1094
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1095
+ });
1096
+ };
1097
+ // create an array of attributes to observe
1098
+ // and also create a map of html attribute name to js property name
1099
+ Cstr.observedAttributes = members
1100
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1101
+ .map(([propName, m]) => {
1102
+ const attrName = m[1] || propName;
1103
+ attrNameToPropName.set(attrName, propName);
1104
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1105
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
1106
+ }
1107
+ return attrName;
1108
+ });
1109
+ }
1110
+ }
1111
+ return Cstr;
1112
+ };
1113
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1114
+ // initializeComponent
1115
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1116
+ // Let the runtime know that the component has been initialized
1117
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1118
+ {
1119
+ // lazy loaded components
1120
+ // request the component's implementation to be
1121
+ // wired up with the host element
1122
+ Cstr = loadModule(cmpMeta);
1123
+ if (Cstr.then) {
1124
+ // Await creates a micro-task avoid if possible
1125
+ const endLoad = uniqueTime();
1126
+ Cstr = await Cstr;
1127
+ endLoad();
1128
+ }
1129
+ if (!Cstr.isProxied) {
1130
+ // we've never proxied this Constructor before
1131
+ // let's add the getters/setters to its prototype before
1132
+ // the first time we create an instance of the implementation
1133
+ {
1134
+ cmpMeta.$watchers$ = Cstr.watchers;
1135
+ }
1136
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1137
+ Cstr.isProxied = true;
1138
+ }
1139
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1140
+ // ok, time to construct the instance
1141
+ // but let's keep track of when we start and stop
1142
+ // so that the getters/setters don't incorrectly step on data
1143
+ {
1144
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1145
+ }
1146
+ // construct the lazy-loaded component implementation
1147
+ // passing the hostRef is very important during
1148
+ // construction in order to directly wire together the
1149
+ // host element and the lazy-loaded instance
1150
+ try {
1151
+ new Cstr(hostRef);
1152
+ }
1153
+ catch (e) {
1154
+ consoleError(e);
1155
+ }
1156
+ {
1157
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1158
+ }
1159
+ {
1160
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1161
+ }
1162
+ endNewInstance();
1163
+ fireConnectedCallback(hostRef.$lazyInstance$);
1164
+ }
1165
+ if (Cstr.style) {
1166
+ // this component has styles but we haven't registered them yet
1167
+ let style = Cstr.style;
1168
+ const scopeId = getScopeId(cmpMeta);
1169
+ if (!styles.has(scopeId)) {
1170
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1171
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1172
+ endRegisterStyles();
1173
+ }
1174
+ }
1175
+ }
1176
+ // we've successfully created a lazy instance
1177
+ const ancestorComponent = hostRef.$ancestorComponent$;
1178
+ const schedule = () => scheduleUpdate(hostRef, true);
1179
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1180
+ // this is the initial load and this component it has an ancestor component
1181
+ // but the ancestor component has NOT fired its will update lifecycle yet
1182
+ // so let's just cool our jets and wait for the ancestor to continue first
1183
+ // this will get fired off when the ancestor component
1184
+ // finally gets around to rendering its lazy self
1185
+ // fire off the initial update
1186
+ ancestorComponent['s-rc'].push(schedule);
1187
+ }
1188
+ else {
1189
+ schedule();
1190
+ }
1191
+ };
1192
+ const fireConnectedCallback = (instance) => {
1193
+ {
1194
+ safeCall(instance, 'connectedCallback');
1195
+ }
1196
+ };
1197
+ const connectedCallback = (elm) => {
1198
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1199
+ const hostRef = getHostRef(elm);
1200
+ const cmpMeta = hostRef.$cmpMeta$;
1201
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1202
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1203
+ // first time this component has connected
1204
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1205
+ {
1206
+ // find the first ancestor component (if there is one) and register
1207
+ // this component as one of the actively loading child components for its ancestor
1208
+ let ancestorComponent = elm;
1209
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1210
+ // climb up the ancestors looking for the first
1211
+ // component that hasn't finished its lifecycle update yet
1212
+ if (ancestorComponent['s-p']) {
1213
+ // we found this components first ancestor component
1214
+ // keep a reference to this component's ancestor component
1215
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1216
+ break;
1217
+ }
1218
+ }
1219
+ }
1220
+ // Lazy properties
1221
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1222
+ if (cmpMeta.$members$) {
1223
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1224
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1225
+ const value = elm[memberName];
1226
+ delete elm[memberName];
1227
+ elm[memberName] = value;
1228
+ }
1229
+ });
1230
+ }
1231
+ {
1232
+ initializeComponent(elm, hostRef, cmpMeta);
1233
+ }
1234
+ }
1235
+ else {
1236
+ // fire off connectedCallback() on component instance
1237
+ fireConnectedCallback(hostRef.$lazyInstance$);
1238
+ }
1239
+ endConnected();
1240
+ }
1241
+ };
1242
+ const disconnectedCallback = (elm) => {
1243
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1244
+ getHostRef(elm);
1245
+ }
1246
+ };
1247
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1248
+ var _a;
1249
+ const endBootstrap = createTime();
1250
+ const cmpTags = [];
1251
+ const exclude = options.exclude || [];
1252
+ const customElements = win.customElements;
1253
+ const head = doc.head;
1254
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1255
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1256
+ const deferredConnectedCallbacks = [];
1257
+ let appLoadFallback;
1258
+ let isBootstrapping = true;
1259
+ Object.assign(plt, options);
1260
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1261
+ lazyBundles.map((lazyBundle) => {
1262
+ lazyBundle[1].map((compactMeta) => {
1263
+ const cmpMeta = {
1264
+ $flags$: compactMeta[0],
1265
+ $tagName$: compactMeta[1],
1266
+ $members$: compactMeta[2],
1267
+ $listeners$: compactMeta[3],
1268
+ };
1269
+ {
1270
+ cmpMeta.$members$ = compactMeta[2];
1271
+ }
1272
+ {
1273
+ cmpMeta.$attrsToReflect$ = [];
1274
+ }
1275
+ {
1276
+ cmpMeta.$watchers$ = {};
1277
+ }
1278
+ const tagName = cmpMeta.$tagName$;
1279
+ const HostElement = class extends HTMLElement {
1280
+ // StencilLazyHost
1281
+ constructor(self) {
1282
+ // @ts-ignore
1283
+ super(self);
1284
+ self = this;
1285
+ registerHost(self, cmpMeta);
1286
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1287
+ // this component is using shadow dom
1288
+ // and this browser supports shadow dom
1289
+ // add the read-only property "shadowRoot" to the host element
1290
+ // adding the shadow root build conditionals to minimize runtime
1291
+ {
1292
+ {
1293
+ self.attachShadow({ mode: 'open' });
1294
+ }
1295
+ }
1296
+ }
1297
+ }
1298
+ connectedCallback() {
1299
+ if (appLoadFallback) {
1300
+ clearTimeout(appLoadFallback);
1301
+ appLoadFallback = null;
1302
+ }
1303
+ if (isBootstrapping) {
1304
+ // connectedCallback will be processed once all components have been registered
1305
+ deferredConnectedCallbacks.push(this);
1306
+ }
1307
+ else {
1308
+ plt.jmp(() => connectedCallback(this));
1309
+ }
1310
+ }
1311
+ disconnectedCallback() {
1312
+ plt.jmp(() => disconnectedCallback(this));
1313
+ }
1314
+ componentOnReady() {
1315
+ return getHostRef(this).$onReadyPromise$;
1316
+ }
1317
+ };
1318
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1319
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1320
+ cmpTags.push(tagName);
1321
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1322
+ }
1323
+ });
1324
+ });
1325
+ {
1326
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1327
+ visibilityStyle.setAttribute('data-styles', '');
1328
+ // Apply CSP nonce to the style tag if it exists
1329
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1330
+ if (nonce != null) {
1331
+ visibilityStyle.setAttribute('nonce', nonce);
1332
+ }
1333
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1334
+ }
1335
+ // Process deferred connectedCallbacks now all components have been registered
1336
+ isBootstrapping = false;
1337
+ if (deferredConnectedCallbacks.length) {
1338
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1339
+ }
1340
+ else {
1341
+ {
1342
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1343
+ }
1344
+ }
1345
+ // Fallback appLoad event
1346
+ endBootstrap();
1347
+ };
1348
+ /**
1349
+ * Assigns the given value to the nonce property on the runtime platform object.
1350
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1351
+ * @param nonce The value to be assigned to the platform nonce property.
1352
+ * @returns void
1353
+ */
1354
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1355
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1356
+ const getHostRef = (ref) => hostRefs.get(ref);
1357
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1358
+ const registerHost = (elm, cmpMeta) => {
1359
+ const hostRef = {
1360
+ $flags$: 0,
1361
+ $hostElement$: elm,
1362
+ $cmpMeta$: cmpMeta,
1363
+ $instanceValues$: new Map(),
1364
+ };
1365
+ {
1366
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1367
+ elm['s-p'] = [];
1368
+ elm['s-rc'] = [];
1369
+ }
1370
+ return hostRefs.set(elm, hostRef);
1371
+ };
1372
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1373
+ const consoleError = (e, el) => (0, console.error)(e, el);
1374
+ const cmpModules = /*@__PURE__*/ new Map();
1375
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1376
+ // loadModuleImport
1377
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1378
+ const bundleId = cmpMeta.$lazyBundleId$;
1379
+ const module = cmpModules.get(bundleId) ;
1380
+ if (module) {
1381
+ return module[exportName];
1382
+ }
1383
+
1384
+ if (!hmrVersionId || !BUILD.hotModuleReplacement) {
1385
+ const processMod = importedModule => {
1386
+ cmpModules.set(bundleId, importedModule);
1387
+ return importedModule[exportName];
1388
+ }
1389
+ switch(bundleId) {
1390
+
1391
+ case 'ix-icon.cjs':
1392
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1393
+ /* webpackMode: "lazy" */
1394
+ './ix-icon.cjs.entry.js')); }).then(processMod, consoleError);
1395
+ }
1396
+ }
1397
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1398
+ /* @vite-ignore */
1399
+ /* webpackInclude: /\.entry\.js$/ */
1400
+ /* webpackExclude: /\.system\.entry\.js$/ */
1401
+ /* webpackMode: "lazy" */
1402
+ `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
1403
+ {
1404
+ cmpModules.set(bundleId, importedModule);
1405
+ }
1406
+ return importedModule[exportName];
1407
+ }, consoleError);
1408
+ };
1409
+ const styles = /*@__PURE__*/ new Map();
1410
+ const win = typeof window !== 'undefined' ? window : {};
1411
+ const doc = win.document || { head: {} };
1412
+ const plt = {
1413
+ $flags$: 0,
1414
+ $resourcesUrl$: '',
1415
+ jmp: (h) => h(),
1416
+ raf: (h) => requestAnimationFrame(h),
1417
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1418
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1419
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1420
+ };
1421
+ const promiseResolve = (v) => Promise.resolve(v);
1422
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1423
+ try {
1424
+ new CSSStyleSheet();
1425
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1426
+ }
1427
+ catch (e) { }
1428
+ return false;
1429
+ })()
1430
+ ;
1431
+ const queueDomReads = [];
1432
+ const queueDomWrites = [];
1433
+ const queueTask = (queue, write) => (cb) => {
1434
+ queue.push(cb);
1435
+ if (!queuePending) {
1436
+ queuePending = true;
1437
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1438
+ nextTick(flush);
1439
+ }
1440
+ else {
1441
+ plt.raf(flush);
1442
+ }
1443
+ }
1444
+ };
1445
+ const consume = (queue) => {
1446
+ for (let i = 0; i < queue.length; i++) {
1447
+ try {
1448
+ queue[i](performance.now());
1449
+ }
1450
+ catch (e) {
1451
+ consoleError(e);
1452
+ }
1453
+ }
1454
+ queue.length = 0;
1455
+ };
1456
+ const flush = () => {
1457
+ // always force a bunch of medium callbacks to run, but still have
1458
+ // a throttle on how many can run in a certain time
1459
+ // DOM READS!!!
1460
+ consume(queueDomReads);
1461
+ // DOM WRITES!!!
1462
+ {
1463
+ consume(queueDomWrites);
1464
+ if ((queuePending = queueDomReads.length > 0)) {
1465
+ // still more to do yet, but we've run out of time
1466
+ // let's let this thing cool off and try again in the next tick
1467
+ plt.raf(flush);
1468
+ }
1469
+ }
1470
+ };
1471
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1472
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1473
+
1474
+ exports.Host = Host;
1475
+ exports.bootstrapLazy = bootstrapLazy;
1476
+ exports.h = h;
1477
+ exports.promiseResolve = promiseResolve;
1478
+ exports.registerInstance = registerInstance;
1479
+ exports.setNonce = setNonce;
1480
+
1481
+ //# sourceMappingURL=index-22d7f5a7.js.map