@3t-transform/threeteeui 0.0.15 → 0.0.16

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