favesalon-embed 1.0.4 → 1.0.6

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