favesalon-embed 0.0.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/chat-button.cjs.entry.js +118 -0
  3. package/dist/cjs/colors-38421769.js +69 -0
  4. package/dist/cjs/favesalon-embed.cjs.js +24 -0
  5. package/dist/cjs/google-map_5.cjs.entry.js +310 -0
  6. package/{cjs/index-d5de0b9d.js → dist/cjs/index-47c2a5f6.js} +513 -199
  7. package/{cjs/index-48ac68d0.js → dist/cjs/index-7f190886.js} +1924 -0
  8. package/dist/cjs/loader.cjs.js +23 -0
  9. package/dist/cjs/relativeTime-3721080d.js +9 -0
  10. package/{cjs → dist/cjs}/salon-booking-modal.cjs.entry.js +7 -6
  11. package/{cjs → dist/cjs}/salon-booking.cjs.entry.js +8 -8
  12. package/dist/cjs/salon-gift-card-modal.cjs.entry.js +29 -0
  13. package/{cjs → dist/cjs}/salon-gift-card.cjs.entry.js +9 -8
  14. package/dist/cjs/salon-latest-reviews.cjs.entry.js +97 -0
  15. package/{cjs/salon-lookbook_2.cjs.entry.js → dist/cjs/salon-lookbook.cjs.entry.js} +28 -58
  16. package/{cjs → dist/cjs}/salon-ranking.cjs.entry.js +9 -8
  17. package/dist/cjs/salon-reviews.cjs.entry.js +193 -0
  18. package/dist/cjs/salon-services.cjs.entry.js +81 -0
  19. package/dist/cjs/salon-stylists.cjs.entry.js +118 -0
  20. package/dist/cjs/services-125c82d8.js +21492 -0
  21. package/dist/cjs/style-detail.cjs.entry.js +312 -0
  22. package/dist/cjs/user-avatar.cjs.entry.js +45 -0
  23. package/{collection → dist/collection}/collection-manifest.json +5 -5
  24. package/dist/collection/components/chat-button/index.css +122 -0
  25. package/dist/collection/components/chat-button/index.js +218 -0
  26. package/dist/collection/components/chat-conversation/index.js +103 -0
  27. package/dist/collection/components/google-map/assets/map--placeholder.jpeg +0 -0
  28. package/{collection → dist/collection}/components/google-map/index.css +0 -1
  29. package/dist/collection/components/google-map/index.js +90 -0
  30. package/{collection → dist/collection}/components/salon-booking/index.css +11 -20
  31. package/dist/collection/components/salon-booking/index.js +126 -0
  32. package/dist/collection/components/salon-booking/salon-booking-modal.js +92 -0
  33. package/dist/collection/components/salon-gift-card/index.css +30 -0
  34. package/dist/collection/components/salon-gift-card/index.js +126 -0
  35. package/dist/collection/components/salon-gift-card/salon-gift-card-modal.js +73 -0
  36. package/dist/collection/components/salon-info/index.js +77 -0
  37. package/dist/collection/components/salon-latest-reviews/index.js +163 -0
  38. package/dist/collection/components/salon-latest-styles/index.css +12 -0
  39. package/dist/collection/components/salon-latest-styles/index.js +183 -0
  40. package/{collection/components/salon-contact → dist/collection/components/salon-locations}/index.css +7 -4
  41. package/dist/collection/components/salon-locations/index.js +143 -0
  42. package/{collection → dist/collection}/components/salon-lookbook/index.css +3 -9
  43. package/dist/collection/components/salon-lookbook/index.js +368 -0
  44. package/dist/collection/components/salon-ranking/index.js +117 -0
  45. package/{collection → dist/collection}/components/salon-reviews/index.css +3 -0
  46. package/dist/collection/components/salon-reviews/index.js +249 -0
  47. package/dist/collection/components/salon-schedules/index.css +18 -0
  48. package/dist/collection/components/salon-schedules/index.js +167 -0
  49. package/dist/collection/components/salon-services/index.css +1 -0
  50. package/dist/collection/components/salon-services/index.js +146 -0
  51. package/dist/collection/components/salon-stylists/index.js +184 -0
  52. package/dist/collection/components/style-detail/index.css +76 -0
  53. package/dist/collection/components/style-detail/index.js +386 -0
  54. package/dist/collection/components/user-avatar/index.js +134 -0
  55. package/dist/collection/constants/colors.js +65 -0
  56. package/dist/collection/mocks/users.js +10 -0
  57. package/dist/collection/services/services.js +295 -0
  58. package/dist/collection/types/chat.js +23 -0
  59. package/dist/collection/types/common.js +11 -0
  60. package/{collection → dist/collection}/types/review.js +9 -5
  61. package/dist/collection/types/salon.js +58 -0
  62. package/dist/collection/types/style.js +128 -0
  63. package/{collection → dist/collection}/types/stylist.js +12 -9
  64. package/dist/collection/types/user.js +10 -0
  65. package/{custom-elements → dist/custom-elements}/index.d.ts +18 -18
  66. package/dist/custom-elements/index.js +28340 -0
  67. package/dist/esm/chat-button.entry.js +114 -0
  68. package/dist/esm/colors-ea36347a.js +67 -0
  69. package/dist/esm/favesalon-embed.js +19 -0
  70. package/dist/esm/google-map_5.entry.js +302 -0
  71. package/{esm/index-0f8eed73.js → dist/esm/index-3fae868e.js} +512 -200
  72. package/{esm/index-67d677ba.js → dist/esm/index-80523fec.js} +1924 -1
  73. package/dist/esm/index.js +1 -0
  74. package/dist/esm/loader.js +19 -0
  75. package/dist/esm/polyfills/css-shim.js +1 -0
  76. package/dist/esm/relativeTime-cd452e6d.js +7 -0
  77. package/{esm → dist/esm}/salon-booking-modal.entry.js +7 -6
  78. package/{esm → dist/esm}/salon-booking.entry.js +7 -7
  79. package/dist/esm/salon-gift-card-modal.entry.js +25 -0
  80. package/{esm → dist/esm}/salon-gift-card.entry.js +8 -7
  81. package/dist/esm/salon-latest-reviews.entry.js +93 -0
  82. package/{esm/salon-lookbook_2.entry.js → dist/esm/salon-lookbook.entry.js} +29 -58
  83. package/{esm → dist/esm}/salon-ranking.entry.js +9 -8
  84. package/dist/esm/salon-reviews.entry.js +189 -0
  85. package/dist/esm/salon-services.entry.js +77 -0
  86. package/dist/esm/salon-stylists.entry.js +114 -0
  87. package/dist/esm/services-40a3e622.js +21485 -0
  88. package/dist/esm/style-detail.entry.js +308 -0
  89. package/dist/esm/user-avatar.entry.js +41 -0
  90. package/dist/favesalon-embed/assets/map--placeholder.jpeg +0 -0
  91. package/{favesalon-embed → dist/favesalon-embed}/favesalon-embed.css +1 -1
  92. package/dist/favesalon-embed/favesalon-embed.esm.js +1 -0
  93. package/dist/favesalon-embed/p-019c5ccd.entry.js +1 -0
  94. package/dist/favesalon-embed/p-083a8821.entry.js +1 -0
  95. package/dist/favesalon-embed/p-0d0ed9ea.entry.js +1 -0
  96. package/dist/favesalon-embed/p-119db8de.entry.js +1 -0
  97. package/dist/favesalon-embed/p-1432c51b.entry.js +1 -0
  98. package/dist/favesalon-embed/p-22093506.entry.js +1 -0
  99. package/dist/favesalon-embed/p-32b314e9.js +2 -0
  100. package/dist/favesalon-embed/p-4a5eca9a.js +6 -0
  101. package/dist/favesalon-embed/p-58d2e9be.js +1 -0
  102. package/dist/favesalon-embed/p-71404b6a.entry.js +1 -0
  103. package/dist/favesalon-embed/p-857c3a61.entry.js +1 -0
  104. package/dist/favesalon-embed/p-99ec77f7.entry.js +1 -0
  105. package/dist/favesalon-embed/p-a33331cc.js +1 -0
  106. package/dist/favesalon-embed/p-b0c3673a.entry.js +1 -0
  107. package/dist/favesalon-embed/p-b287b1ea.entry.js +1 -0
  108. package/dist/favesalon-embed/p-b3af7842.entry.js +1 -0
  109. package/dist/favesalon-embed/p-b630ae68.js +1580 -0
  110. package/dist/favesalon-embed/p-ce2c1c9a.entry.js +1 -0
  111. package/dist/favesalon-embed/p-d9b7ad58.entry.js +1 -0
  112. package/dist/favesalon-embed/p-fc9a5551.js +6 -0
  113. package/dist/types/components/chat-button/index.d.ts +24 -0
  114. package/dist/types/components/google-map/index.d.ts +5 -0
  115. package/{types → dist/types}/components/salon-gift-card/salon-gift-card-modal.d.ts +1 -0
  116. package/{types → dist/types}/components/salon-info/index.d.ts +0 -1
  117. package/{types → dist/types}/components/salon-latest-reviews/index.d.ts +2 -0
  118. package/dist/types/components/salon-latest-styles/index.d.ts +12 -0
  119. package/{types → dist/types}/components/salon-locations/index.d.ts +2 -0
  120. package/{types → dist/types}/components/salon-lookbook/index.d.ts +3 -3
  121. package/dist/types/components/salon-reviews/index.d.ts +24 -0
  122. package/{types → dist/types}/components/salon-schedules/index.d.ts +2 -0
  123. package/{types → dist/types}/components/salon-services/index.d.ts +1 -0
  124. package/{types → dist/types}/components/salon-stylists/index.d.ts +6 -0
  125. package/dist/types/components/style-detail/index.d.ts +24 -0
  126. package/{types → dist/types}/components.d.ts +76 -59
  127. package/dist/types/constants/colors.d.ts +65 -0
  128. package/dist/types/mocks/users.d.ts +10 -0
  129. package/dist/types/services/services.d.ts +75 -0
  130. package/{types → dist/types}/stencil-public-runtime.d.ts +85 -11
  131. package/dist/types/types/chat.d.ts +17 -0
  132. package/dist/types/types/common.d.ts +11 -0
  133. package/{types → dist/types}/types/review.d.ts +4 -0
  134. package/{types → dist/types}/types/salon.d.ts +3 -1
  135. package/dist/types/types/style.d.ts +88 -0
  136. package/{types → dist/types}/types/stylist.d.ts +1 -1
  137. package/{types → dist/types}/types/user.d.ts +2 -2
  138. package/loader/cdn.js +3 -0
  139. package/loader/index.cjs.js +3 -0
  140. package/loader/index.d.ts +21 -0
  141. package/loader/index.es2017.js +3 -0
  142. package/loader/index.js +4 -0
  143. package/loader/package.json +11 -0
  144. package/package.json +19 -14
  145. package/readme.md +24 -7
  146. package/cjs/colors-7f354880.js +0 -95
  147. package/cjs/favesalon-embed.cjs.js +0 -20
  148. package/cjs/google-map.cjs.entry.js +0 -47
  149. package/cjs/index-95daad08.js +0 -1928
  150. package/cjs/loader.cjs.js +0 -22
  151. package/cjs/salon-contact_4.cjs.entry.js +0 -155
  152. package/cjs/salon-gift-card-modal.cjs.entry.js +0 -25
  153. package/cjs/salon-info.cjs.entry.js +0 -35
  154. package/cjs/salon-latest-reviews.cjs.entry.js +0 -58
  155. package/cjs/salon-lookbook-modal.cjs.entry.js +0 -141
  156. package/cjs/salon-reviews.cjs.entry.js +0 -205
  157. package/cjs/salon-services.cjs.entry.js +0 -47
  158. package/cjs/salon-stylists.cjs.entry.js +0 -54
  159. package/cjs/services-f1102d4a.js +0 -5762
  160. package/collection/components/google-map/index.js +0 -97
  161. package/collection/components/salon-booking/index.js +0 -121
  162. package/collection/components/salon-booking/salon-booking-modal.js +0 -88
  163. package/collection/components/salon-contact/index.js +0 -88
  164. package/collection/components/salon-gift-card/index.css +0 -25
  165. package/collection/components/salon-gift-card/index.js +0 -120
  166. package/collection/components/salon-gift-card/salon-gift-card-modal.js +0 -48
  167. package/collection/components/salon-info/index.css +0 -3
  168. package/collection/components/salon-info/index.js +0 -97
  169. package/collection/components/salon-latest-reviews/index.js +0 -108
  170. package/collection/components/salon-locations/index.js +0 -80
  171. package/collection/components/salon-lookbook/index.js +0 -376
  172. package/collection/components/salon-lookbook/lookbook-modal.css +0 -72
  173. package/collection/components/salon-lookbook/salon-lookbook-modal.js +0 -248
  174. package/collection/components/salon-ranking/index.js +0 -114
  175. package/collection/components/salon-reviews/index.js +0 -317
  176. package/collection/components/salon-schedules/index.css +0 -14
  177. package/collection/components/salon-schedules/index.js +0 -103
  178. package/collection/components/salon-services/index.js +0 -113
  179. package/collection/components/salon-styles/index.css +0 -23
  180. package/collection/components/salon-styles/index.js +0 -100
  181. package/collection/components/salon-stylists/index.js +0 -96
  182. package/collection/components/user-avatar/index.css +0 -0
  183. package/collection/components/user-avatar/index.js +0 -127
  184. package/collection/constants/colors.js +0 -91
  185. package/collection/services/services.js +0 -225
  186. package/collection/types/common.js +0 -2
  187. package/collection/types/salon.js +0 -52
  188. package/collection/types/style.js +0 -103
  189. package/collection/types/user.js +0 -10
  190. package/custom-elements/index.js +0 -12125
  191. package/esm/colors-1ec90c5f.js +0 -93
  192. package/esm/favesalon-embed.js +0 -18
  193. package/esm/google-map.entry.js +0 -43
  194. package/esm/index-09d43e3e.js +0 -1926
  195. package/esm/loader.js +0 -18
  196. package/esm/polyfills/css-shim.js +0 -1
  197. package/esm/salon-contact_4.entry.js +0 -148
  198. package/esm/salon-gift-card-modal.entry.js +0 -21
  199. package/esm/salon-info.entry.js +0 -31
  200. package/esm/salon-latest-reviews.entry.js +0 -54
  201. package/esm/salon-lookbook-modal.entry.js +0 -137
  202. package/esm/salon-reviews.entry.js +0 -201
  203. package/esm/salon-services.entry.js +0 -43
  204. package/esm/salon-stylists.entry.js +0 -50
  205. package/esm/services-74d84ca9.js +0 -5756
  206. package/favesalon-embed/favesalon-embed.esm.js +0 -1
  207. package/favesalon-embed/p-0188d4dc.entry.js +0 -1
  208. package/favesalon-embed/p-0318501e.js +0 -1
  209. package/favesalon-embed/p-078f242d.entry.js +0 -1
  210. package/favesalon-embed/p-13e23c61.entry.js +0 -1
  211. package/favesalon-embed/p-17df13ad.js +0 -1
  212. package/favesalon-embed/p-1a3179c8.entry.js +0 -1
  213. package/favesalon-embed/p-20aa75de.js +0 -6
  214. package/favesalon-embed/p-2901a6d6.entry.js +0 -1
  215. package/favesalon-embed/p-2b861430.entry.js +0 -1
  216. package/favesalon-embed/p-44d810a0.js +0 -1
  217. package/favesalon-embed/p-4a5eca9a.js +0 -6
  218. package/favesalon-embed/p-4c68700f.entry.js +0 -1
  219. package/favesalon-embed/p-4e2d7b29.js +0 -1
  220. package/favesalon-embed/p-6b845bf1.entry.js +0 -1
  221. package/favesalon-embed/p-7350f6b5.entry.js +0 -1
  222. package/favesalon-embed/p-897c2b1c.entry.js +0 -1
  223. package/favesalon-embed/p-8e60f56f.entry.js +0 -1
  224. package/favesalon-embed/p-a49afdc1.entry.js +0 -1
  225. package/favesalon-embed/p-c93867c4.entry.js +0 -1
  226. package/favesalon-embed/p-ea6a097f.entry.js +0 -1
  227. package/types/components/google-map/index.d.ts +0 -10
  228. package/types/components/salon-contact/index.d.ts +0 -9
  229. package/types/components/salon-lookbook/salon-lookbook-modal.d.ts +0 -13
  230. package/types/components/salon-reviews/index.d.ts +0 -24
  231. package/types/components/salon-styles/index.d.ts +0 -9
  232. package/types/constants/colors.d.ts +0 -88
  233. package/types/services/services.d.ts +0 -26
  234. package/types/types/common.d.ts +0 -2
  235. package/types/types/style.d.ts +0 -59
  236. /package/{cjs → dist/cjs}/_commonjsHelpers-5cfcba41.js +0 -0
  237. /package/{cjs → dist/cjs}/global-9073d10e.js +0 -0
  238. /package/{cjs → dist/cjs}/index.cjs.js +0 -0
  239. /package/{cjs → dist/cjs}/utils-c5a33b3c.js +0 -0
  240. /package/{esm/index.js → dist/collection/components/salon-info/index.css} +0 -0
  241. /package/{collection → dist/collection}/components/salon-latest-reviews/index.css +0 -0
  242. /package/{collection → dist/collection}/components/salon-ranking/index.css +0 -0
  243. /package/{collection → dist/collection}/components/salon-stylists/index.css +0 -0
  244. /package/{collection/components/salon-locations → dist/collection/components/user-avatar}/index.css +0 -0
  245. /package/{collection → dist/collection}/global/global.js +0 -0
  246. /package/{collection → dist/collection}/index.js +0 -0
  247. /package/{collection → dist/collection}/types/service.js +0 -0
  248. /package/{collection → dist/collection}/utils/utils.js +0 -0
  249. /package/{esm → dist/esm}/_commonjsHelpers-098d5b27.js +0 -0
  250. /package/{esm → dist/esm}/global-e1089ffd.js +0 -0
  251. /package/{esm → dist/esm}/polyfills/core-js.js +0 -0
  252. /package/{esm → dist/esm}/polyfills/dom.js +0 -0
  253. /package/{esm → dist/esm}/polyfills/es5-html-element.js +0 -0
  254. /package/{esm → dist/esm}/polyfills/index.js +0 -0
  255. /package/{esm → dist/esm}/polyfills/system.js +0 -0
  256. /package/{esm → dist/esm}/utils-e97485e0.js +0 -0
  257. /package/{favesalon-embed → dist/favesalon-embed}/index.esm.js +0 -0
  258. /package/{favesalon-embed → dist/favesalon-embed}/p-47e646f8.js +0 -0
  259. /package/{favesalon-embed → dist/favesalon-embed}/p-d6083940.js +0 -0
  260. /package/{index.cjs.js → dist/index.cjs.js} +0 -0
  261. /package/{index.js → dist/index.js} +0 -0
  262. /package/{collection/components/salon-services/index.css → dist/types/components/chat-conversation/index.d.ts} +0 -0
  263. /package/{types → dist/types}/components/salon-booking/index.d.ts +0 -0
  264. /package/{types → dist/types}/components/salon-booking/salon-booking-modal.d.ts +0 -0
  265. /package/{types → dist/types}/components/salon-gift-card/index.d.ts +0 -0
  266. /package/{types → dist/types}/components/salon-ranking/index.d.ts +0 -0
  267. /package/{types → dist/types}/components/user-avatar/index.d.ts +0 -0
  268. /package/{types → dist/types}/index.d.ts +0 -0
  269. /package/{types → dist/types}/types/service.d.ts +0 -0
  270. /package/{types → dist/types}/utils/utils.d.ts +0 -0
@@ -22,31 +22,20 @@ function _interopNamespace(e) {
22
22
 
23
23
  const NAMESPACE = 'favesalon-embed';
24
24
 
25
+ /**
26
+ * Virtual DOM patching algorithm based on Snabbdom by
27
+ * Simon Friis Vindum (@paldepind)
28
+ * Licensed under the MIT License
29
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
30
+ *
31
+ * Modified for Stencil's renderer and slot projection
32
+ */
25
33
  let isSvgMode = false;
26
34
  let queuePending = false;
27
- const win = typeof window !== 'undefined' ? window : {};
28
- const doc = win.document || { head: {} };
29
- const plt = {
30
- $flags$: 0,
31
- $resourcesUrl$: '',
32
- jmp: (h) => h(),
33
- raf: (h) => requestAnimationFrame(h),
34
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
35
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
36
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
35
+ const getAssetPath = (path) => {
36
+ const assetUrl = new URL(path, plt.$resourcesUrl$);
37
+ return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
37
38
  };
38
- const promiseResolve = (v) => Promise.resolve(v);
39
- const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
40
- try {
41
- new CSSStyleSheet();
42
- return typeof new CSSStyleSheet().replace === 'function';
43
- }
44
- catch (e) { }
45
- return false;
46
- })()
47
- ;
48
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
49
- const XLINK_NS = 'http://www.w3.org/1999/xlink';
50
39
  const createTime = (fnName, tagName = '') => {
51
40
  {
52
41
  return () => {
@@ -61,59 +50,8 @@ const uniqueTime = (key, measureText) => {
61
50
  };
62
51
  }
63
52
  };
64
- const rootAppliedStyles = new WeakMap();
65
- const registerStyle = (scopeId, cssText, allowCS) => {
66
- let style = styles.get(scopeId);
67
- if (supportsConstructibleStylesheets && allowCS) {
68
- style = (style || new CSSStyleSheet());
69
- style.replace(cssText);
70
- }
71
- else {
72
- style = cssText;
73
- }
74
- styles.set(scopeId, style);
75
- };
76
- const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
77
- let scopeId = getScopeId(cmpMeta);
78
- let style = styles.get(scopeId);
79
- // if an element is NOT connected then getRootNode() will return the wrong root node
80
- // so the fallback is to always use the document for the root node in those cases
81
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
82
- if (style) {
83
- if (typeof style === 'string') {
84
- styleContainerNode = styleContainerNode.head || styleContainerNode;
85
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
86
- let styleElm;
87
- if (!appliedStyles) {
88
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
89
- }
90
- if (!appliedStyles.has(scopeId)) {
91
- {
92
- {
93
- styleElm = doc.createElement('style');
94
- styleElm.innerHTML = style;
95
- }
96
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
97
- }
98
- if (appliedStyles) {
99
- appliedStyles.add(scopeId);
100
- }
101
- }
102
- }
103
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
104
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
105
- }
106
- }
107
- return scopeId;
108
- };
109
- const attachStyles = (hostRef) => {
110
- const cmpMeta = hostRef.$cmpMeta$;
111
- const elm = hostRef.$hostElement$;
112
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
113
- addStyle(elm.getRootNode(), cmpMeta);
114
- endAttachStyles();
115
- };
116
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
53
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
54
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
117
55
  /**
118
56
  * Default style mode id
119
57
  */
@@ -132,6 +70,18 @@ const isComplexType = (o) => {
132
70
  o = typeof o;
133
71
  return o === 'object' || o === 'function';
134
72
  };
73
+ /**
74
+ * Helper method for querying a `meta` tag that contains a nonce value
75
+ * out of a DOM's head.
76
+ *
77
+ * @param doc The DOM containing the `head` to query against
78
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
79
+ * exists or the tag has no content.
80
+ */
81
+ function queryNonceMetaTagContent(doc) {
82
+ var _a, _b, _c;
83
+ return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
84
+ }
135
85
  /**
136
86
  * Production h() function based on Preact by
137
87
  * Jason Miller (@developit)
@@ -140,7 +90,6 @@ const isComplexType = (o) => {
140
90
  *
141
91
  * Modified for Stencil's compiler and vdom
142
92
  */
143
- // const stack: any[] = [];
144
93
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
145
94
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
146
95
  const h = (nodeName, vnodeData, ...children) => {
@@ -148,7 +97,7 @@ const h = (nodeName, vnodeData, ...children) => {
148
97
  let key = null;
149
98
  let simple = false;
150
99
  let lastSimple = false;
151
- let vNodeChildren = [];
100
+ const vNodeChildren = [];
152
101
  const walk = (c) => {
153
102
  for (let i = 0; i < c.length; i++) {
154
103
  child = c[i];
@@ -199,6 +148,14 @@ const h = (nodeName, vnodeData, ...children) => {
199
148
  }
200
149
  return vnode;
201
150
  };
151
+ /**
152
+ * A utility function for creating a virtual DOM node from a tag and some
153
+ * possible text content.
154
+ *
155
+ * @param tag the tag for this element
156
+ * @param text possible text content for the node
157
+ * @returns a newly-minted virtual DOM node
158
+ */
202
159
  const newVNode = (tag, text) => {
203
160
  const vnode = {
204
161
  $flags$: 0,
@@ -216,7 +173,136 @@ const newVNode = (tag, text) => {
216
173
  return vnode;
217
174
  };
218
175
  const Host = {};
176
+ /**
177
+ * Check whether a given node is a Host node or not
178
+ *
179
+ * @param node the virtual DOM node to check
180
+ * @returns whether it's a Host node or not
181
+ */
219
182
  const isHost = (node) => node && node.$tag$ === Host;
183
+ /**
184
+ * Parse a new property value for a given property type.
185
+ *
186
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
187
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
188
+ * 1. `any`, the type given to `propValue` in the function signature
189
+ * 2. the type stored from `propType`.
190
+ *
191
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
192
+ *
193
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
194
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
195
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
196
+ * ```tsx
197
+ * <my-cmp prop-val={0}></my-cmp>
198
+ * ```
199
+ *
200
+ * HTML prop values on the other hand, will always a string
201
+ *
202
+ * @param propValue the new value to coerce to some type
203
+ * @param propType the type of the prop, expressed as a binary number
204
+ * @returns the parsed/coerced value
205
+ */
206
+ const parsePropertyValue = (propValue, propType) => {
207
+ // ensure this value is of the correct prop type
208
+ if (propValue != null && !isComplexType(propValue)) {
209
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
210
+ // per the HTML spec, any string value means it is a boolean true value
211
+ // but we'll cheat here and say that the string "false" is the boolean false
212
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
213
+ }
214
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
215
+ // force it to be a number
216
+ return parseFloat(propValue);
217
+ }
218
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
219
+ // could have been passed as a number or boolean
220
+ // but we still want it as a string
221
+ return String(propValue);
222
+ }
223
+ // redundant return here for better minification
224
+ return propValue;
225
+ }
226
+ // not sure exactly what type we want
227
+ // so no need to change to a different type
228
+ return propValue;
229
+ };
230
+ /**
231
+ * Helper function to create & dispatch a custom Event on a provided target
232
+ * @param elm the target of the Event
233
+ * @param name the name to give the custom Event
234
+ * @param opts options for configuring a custom Event
235
+ * @returns the custom Event
236
+ */
237
+ const emitEvent = (elm, name, opts) => {
238
+ const ev = plt.ce(name, opts);
239
+ elm.dispatchEvent(ev);
240
+ return ev;
241
+ };
242
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
243
+ const registerStyle = (scopeId, cssText, allowCS) => {
244
+ let style = styles.get(scopeId);
245
+ if (supportsConstructableStylesheets && allowCS) {
246
+ style = (style || new CSSStyleSheet());
247
+ if (typeof style === 'string') {
248
+ style = cssText;
249
+ }
250
+ else {
251
+ style.replaceSync(cssText);
252
+ }
253
+ }
254
+ else {
255
+ style = cssText;
256
+ }
257
+ styles.set(scopeId, style);
258
+ };
259
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
260
+ var _a;
261
+ let scopeId = getScopeId(cmpMeta);
262
+ const style = styles.get(scopeId);
263
+ // if an element is NOT connected then getRootNode() will return the wrong root node
264
+ // so the fallback is to always use the document for the root node in those cases
265
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
266
+ if (style) {
267
+ if (typeof style === 'string') {
268
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
269
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
270
+ let styleElm;
271
+ if (!appliedStyles) {
272
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
273
+ }
274
+ if (!appliedStyles.has(scopeId)) {
275
+ {
276
+ {
277
+ styleElm = doc.createElement('style');
278
+ styleElm.innerHTML = style;
279
+ }
280
+ // Apply CSP nonce to the style tag if it exists
281
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
282
+ if (nonce != null) {
283
+ styleElm.setAttribute('nonce', nonce);
284
+ }
285
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
286
+ }
287
+ if (appliedStyles) {
288
+ appliedStyles.add(scopeId);
289
+ }
290
+ }
291
+ }
292
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
293
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
294
+ }
295
+ }
296
+ return scopeId;
297
+ };
298
+ const attachStyles = (hostRef) => {
299
+ const cmpMeta = hostRef.$cmpMeta$;
300
+ const elm = hostRef.$hostElement$;
301
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
302
+ addStyle(elm.getRootNode(), cmpMeta);
303
+ endAttachStyles();
304
+ };
305
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
220
306
  /**
221
307
  * Production setAccessor() function based on Preact by
222
308
  * Jason Miller (@developit)
@@ -314,11 +400,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
314
400
  if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
315
401
  try {
316
402
  if (!elm.tagName.includes('-')) {
317
- let n = newValue == null ? '' : newValue;
403
+ const n = newValue == null ? '' : newValue;
318
404
  // Workaround for Safari, moving the <input> caret when re-assigning the same valued
319
405
  if (memberName === 'list') {
320
406
  isProp = false;
321
- // tslint:disable-next-line: triple-equals
322
407
  }
323
408
  else if (oldValue == null || elm[memberName] != n) {
324
409
  elm[memberName] = n;
@@ -354,7 +439,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
354
439
  }
355
440
  }
356
441
  }
357
- else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
442
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
358
443
  newValue = newValue === true ? '' : newValue;
359
444
  if (xlink) {
360
445
  elm.setAttributeNS(XLINK_NS, memberName, newValue);
@@ -372,7 +457,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
372
457
  // if the element passed in is a shadow root, which is a document fragment
373
458
  // then we want to be adding attrs/props to the shadow root's "host" element
374
459
  // if it's not a shadow root, then we add attrs/props to the same element
375
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
460
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
376
461
  ? newVnode.$elm$.host
377
462
  : newVnode.$elm$;
378
463
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
@@ -390,9 +475,19 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
390
475
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
391
476
  }
392
477
  };
478
+ /**
479
+ * Create a DOM Node corresponding to one of the children of a given VNode.
480
+ *
481
+ * @param oldParentVNode the parent VNode from the previous render
482
+ * @param newParentVNode the parent VNode from the current render
483
+ * @param childIndex the index of the VNode, in the _new_ parent node's
484
+ * children, for which we will create a new DOM node
485
+ * @param parentElm the parent DOM node which our new node will be a child of
486
+ * @returns the newly created node
487
+ */
393
488
  const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
394
489
  // tslint:disable-next-line: prefer-const
395
- let newVNode = newParentVNode.$children$[childIndex];
490
+ const newVNode = newParentVNode.$children$[childIndex];
396
491
  let i = 0;
397
492
  let elm;
398
493
  let childNode;
@@ -438,6 +533,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
438
533
  }
439
534
  return elm;
440
535
  };
536
+ /**
537
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
538
+ * add them to the DOM in the appropriate place.
539
+ *
540
+ * @param parentElm the DOM node which should be used as a parent for the new
541
+ * DOM nodes
542
+ * @param before a child of the `parentElm` which the new children should be
543
+ * inserted before (optional)
544
+ * @param parentVNode the parent virtual DOM node
545
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
546
+ * @param startIdx the index in the child virtual DOM nodes at which to start
547
+ * creating DOM nodes (inclusive)
548
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
549
+ * creating DOM nodes (inclusive)
550
+ */
441
551
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
442
552
  let containerElm = (parentElm);
443
553
  let childNode;
@@ -451,6 +561,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
451
561
  }
452
562
  }
453
563
  };
564
+ /**
565
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
566
+ * This can be used to, for instance, clean up after a list of children which
567
+ * should no longer be shown.
568
+ *
569
+ * This function also handles some of Stencil's slot relocation logic.
570
+ *
571
+ * @param vnodes a list of virtual DOM nodes to remove
572
+ * @param startIdx the index at which to start removing nodes (inclusive)
573
+ * @param endIdx the index at which to stop removing nodes (inclusive)
574
+ * @param vnode a VNode
575
+ * @param elm an element
576
+ */
454
577
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
455
578
  for (; startIdx <= endIdx; ++startIdx) {
456
579
  if ((vnode = vnodes[startIdx])) {
@@ -461,6 +584,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
461
584
  }
462
585
  }
463
586
  };
587
+ /**
588
+ * Reconcile the children of a new VNode with the children of an old VNode by
589
+ * traversing the two collections of children, identifying nodes that are
590
+ * conserved or changed, calling out to `patch` to make any necessary
591
+ * updates to the DOM, and rearranging DOM nodes as needed.
592
+ *
593
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
594
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
595
+ * 'windows' by storing start and end indices and references to the
596
+ * corresponding array entries. Initially the two 'windows' are basically equal
597
+ * to the entire array, but we progressively narrow the windows until there are
598
+ * no children left to update by doing the following:
599
+ *
600
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
601
+ * that if we have an initial array like the following we'll end up dealing
602
+ * only with a window bounded by the highlighted elements:
603
+ *
604
+ * [null, null, VNode1 , ... , VNode2, null, null]
605
+ * ^^^^^^ ^^^^^^
606
+ *
607
+ * 2. Check to see if the elements at the head and tail positions are equal
608
+ * across the windows. This will basically detect elements which haven't
609
+ * been added, removed, or changed position, i.e. if you had the following
610
+ * VNode elements (represented as HTML):
611
+ *
612
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
613
+ * newVNode: `<div><p><span>THERE</span></p></div>`
614
+ *
615
+ * Then when comparing the children of the `<div>` tag we check the equality
616
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
617
+ * same tag in the same position, we'd be able to avoid completely
618
+ * re-rendering the subtree under them with a new DOM element and would just
619
+ * call out to `patch` to handle reconciling their children and so on.
620
+ *
621
+ * 3. Check, for both windows, to see if the element at the beginning of the
622
+ * window corresponds to the element at the end of the other window. This is
623
+ * a heuristic which will let us identify _some_ situations in which
624
+ * elements have changed position, for instance it _should_ detect that the
625
+ * children nodes themselves have not changed but merely moved in the
626
+ * following example:
627
+ *
628
+ * oldVNode: `<div><element-one /><element-two /></div>`
629
+ * newVNode: `<div><element-two /><element-one /></div>`
630
+ *
631
+ * If we find cases like this then we also need to move the concrete DOM
632
+ * elements corresponding to the moved children to write the re-order to the
633
+ * DOM.
634
+ *
635
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
636
+ * nodes in the old children which have the same key as the first element in
637
+ * our window on the new children. If we find such a node we handle calling
638
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
639
+ * what we find.
640
+ *
641
+ * Finally, once we've narrowed our 'windows' to the point that either of them
642
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
643
+ * insertion or deletion that needs to happen to get a DOM state that correctly
644
+ * reflects the new child VNodes. If, for instance, after our window on the old
645
+ * children has collapsed we still have more nodes on the new children that
646
+ * we haven't dealt with yet then we need to add them, or if the new children
647
+ * collapse but we still have unhandled _old_ children then we need to make
648
+ * sure the corresponding DOM nodes are removed.
649
+ *
650
+ * @param parentElm the node into which the parent VNode is rendered
651
+ * @param oldCh the old children of the parent node
652
+ * @param newVNode the new VNode which will replace the parent
653
+ * @param newCh the new children of the parent node
654
+ */
464
655
  const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
465
656
  let oldStartIdx = 0;
466
657
  let newStartIdx = 0;
@@ -476,7 +667,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
476
667
  let elmToMove;
477
668
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
478
669
  if (oldStartVnode == null) {
479
- // Vnode might have been moved left
670
+ // VNode might have been moved left
480
671
  oldStartVnode = oldCh[++oldStartIdx];
481
672
  }
482
673
  else if (oldEndVnode == null) {
@@ -489,29 +680,65 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
489
680
  newEndVnode = newCh[--newEndIdx];
490
681
  }
491
682
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
683
+ // if the start nodes are the same then we should patch the new VNode
684
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
685
+ // indices to reflect that. We don't need to move any DOM Nodes around
686
+ // since things are matched up in order.
492
687
  patch(oldStartVnode, newStartVnode);
493
688
  oldStartVnode = oldCh[++oldStartIdx];
494
689
  newStartVnode = newCh[++newStartIdx];
495
690
  }
496
691
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
692
+ // likewise, if the end nodes are the same we patch new onto old and
693
+ // decrement our end indices, and also likewise in this case we don't
694
+ // need to move any DOM Nodes.
497
695
  patch(oldEndVnode, newEndVnode);
498
696
  oldEndVnode = oldCh[--oldEndIdx];
499
697
  newEndVnode = newCh[--newEndIdx];
500
698
  }
501
699
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
502
700
  patch(oldStartVnode, newEndVnode);
701
+ // We need to move the element for `oldStartVnode` into a position which
702
+ // will be appropriate for `newEndVnode`. For this we can use
703
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
704
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
705
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
706
+ //
707
+ // <old-start-node />
708
+ // <some-intervening-node />
709
+ // <old-end-node />
710
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
711
+ // <next-sibling />
712
+ //
713
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
714
+ // the node for `oldStartVnode` at the end of the children of
715
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
716
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
717
+ // append it to the children of the parent element.
503
718
  parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
504
719
  oldStartVnode = oldCh[++oldStartIdx];
505
720
  newEndVnode = newCh[--newEndIdx];
506
721
  }
507
722
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
508
723
  patch(oldEndVnode, newStartVnode);
724
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
725
+ // the same node, so since we're here we know that they are not. Thus we
726
+ // can move the element for `oldEndVnode` _before_ the element for
727
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
728
+ // future.
509
729
  parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
510
730
  oldEndVnode = oldCh[--oldEndIdx];
511
731
  newStartVnode = newCh[++newStartIdx];
512
732
  }
513
733
  else {
514
- // createKeyToOldIdx
734
+ // Here we do some checks to match up old and new nodes based on the
735
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
736
+ // in the JSX for a DOM element in the implementation of a Stencil
737
+ // component.
738
+ //
739
+ // First we check to see if there are any nodes in the array of old
740
+ // children which have the same key as the first node in the new
741
+ // children.
515
742
  idxInOld = -1;
516
743
  {
517
744
  for (i = oldStartIdx; i <= oldEndIdx; ++i) {
@@ -522,23 +749,32 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
522
749
  }
523
750
  }
524
751
  if (idxInOld >= 0) {
752
+ // We found a node in the old children which matches up with the first
753
+ // node in the new children! So let's deal with that
525
754
  elmToMove = oldCh[idxInOld];
526
755
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
756
+ // the tag doesn't match so we'll need a new DOM element
527
757
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
528
758
  }
529
759
  else {
530
760
  patch(elmToMove, newStartVnode);
761
+ // invalidate the matching old node so that we won't try to update it
762
+ // again later on
531
763
  oldCh[idxInOld] = undefined;
532
764
  node = elmToMove.$elm$;
533
765
  }
534
766
  newStartVnode = newCh[++newStartIdx];
535
767
  }
536
768
  else {
537
- // new element
769
+ // We either didn't find an element in the old children that matches
770
+ // the key of the first new child OR the build is not using `key`
771
+ // attributes at all. In either case we need to create a new element
772
+ // for the new node.
538
773
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
539
774
  newStartVnode = newCh[++newStartIdx];
540
775
  }
541
776
  if (node) {
777
+ // if we created a new node then handle inserting it to the DOM
542
778
  {
543
779
  oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
544
780
  }
@@ -546,22 +782,53 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
546
782
  }
547
783
  }
548
784
  if (oldStartIdx > oldEndIdx) {
785
+ // we have some more new nodes to add which don't match up with old nodes
549
786
  addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
550
787
  }
551
788
  else if (newStartIdx > newEndIdx) {
789
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
790
+ // in the new array, so lets remove them (which entails cleaning up the
791
+ // relevant DOM nodes)
552
792
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
553
793
  }
554
794
  };
555
- const isSameVnode = (vnode1, vnode2) => {
795
+ /**
796
+ * Compare two VNodes to determine if they are the same
797
+ *
798
+ * **NB**: This function is an equality _heuristic_ based on the available
799
+ * information set on the two VNodes and can be misleading under certain
800
+ * circumstances. In particular, if the two nodes do not have `key` attrs
801
+ * (available under `$key$` on VNodes) then the function falls back on merely
802
+ * checking that they have the same tag.
803
+ *
804
+ * So, in other words, if `key` attrs are not set on VNodes which may be
805
+ * changing order within a `children` array or something along those lines then
806
+ * we could obtain a false negative and then have to do needless re-rendering
807
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
808
+ *
809
+ * @param leftVNode the first VNode to check
810
+ * @param rightVNode the second VNode to check
811
+ * @returns whether they're equal or not
812
+ */
813
+ const isSameVnode = (leftVNode, rightVNode) => {
556
814
  // compare if two vnode to see if they're "technically" the same
557
815
  // need to have the same element tag, and same key to be the same
558
- if (vnode1.$tag$ === vnode2.$tag$) {
816
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
817
+ // this will be set if components in the build have `key` attrs set on them
559
818
  {
560
- return vnode1.$key$ === vnode2.$key$;
819
+ return leftVNode.$key$ === rightVNode.$key$;
561
820
  }
562
821
  }
563
822
  return false;
564
823
  };
824
+ /**
825
+ * Handle reconciling an outdated VNode with a new one which corresponds to
826
+ * it. This function handles flushing updates to the DOM and reconciling the
827
+ * children of the two nodes (if any).
828
+ *
829
+ * @param oldVNode an old VNode whose DOM element and children we want to update
830
+ * @param newVNode a new VNode representing an updated version of the old one
831
+ */
565
832
  const patch = (oldVNode, newVNode) => {
566
833
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
567
834
  const oldChildren = oldVNode.$children$;
@@ -574,7 +841,6 @@ const patch = (oldVNode, newVNode) => {
574
841
  // only add this to the when the compiler sees we're using an svg somewhere
575
842
  isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
576
843
  }
577
- // element node
578
844
  {
579
845
  {
580
846
  // either this is the first render of an element OR it's an update
@@ -585,6 +851,7 @@ const patch = (oldVNode, newVNode) => {
585
851
  }
586
852
  if (oldChildren !== null && newChildren !== null) {
587
853
  // looks like there's child vnodes for both the old and new vnodes
854
+ // so we need to call `updateChildren` to reconcile them
588
855
  updateChildren(elm, oldChildren, newVNode, newChildren);
589
856
  }
590
857
  else if (newChildren !== null) {
@@ -616,29 +883,29 @@ const callNodeRefs = (vNode) => {
616
883
  vNode.$children$ && vNode.$children$.map(callNodeRefs);
617
884
  }
618
885
  };
886
+ /**
887
+ * The main entry point for Stencil's virtual DOM-based rendering engine
888
+ *
889
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
890
+ * function will handle creating a virtual DOM tree with a single root, patching
891
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
892
+ * relocation, and reflecting attributes.
893
+ *
894
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
895
+ * the DOM node into which it should be rendered.
896
+ * @param renderFnResults the virtual DOM nodes to be rendered
897
+ */
619
898
  const renderVdom = (hostRef, renderFnResults) => {
620
899
  const hostElm = hostRef.$hostElement$;
621
900
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
622
901
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
623
902
  rootVnode.$tag$ = null;
624
- rootVnode.$flags$ |= 4 /* isHost */;
903
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
625
904
  hostRef.$vnode$ = rootVnode;
626
905
  rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
627
906
  // synchronous patch
628
907
  patch(oldVNode, rootVnode);
629
908
  };
630
- /**
631
- * Helper function to create & dispatch a custom Event on a provided target
632
- * @param elm the target of the Event
633
- * @param name the name to give the custom Event
634
- * @param opts options for configuring a custom Event
635
- * @returns the custom Event
636
- */
637
- const emitEvent = (elm, name, opts) => {
638
- const ev = plt.ce(name, opts);
639
- elm.dispatchEvent(ev);
640
- return ev;
641
- };
642
909
  const attachToAncestor = (hostRef, ancestorComponent) => {
643
910
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
644
911
  ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
@@ -646,10 +913,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
646
913
  };
647
914
  const scheduleUpdate = (hostRef, isInitialLoad) => {
648
915
  {
649
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
916
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
650
917
  }
651
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
652
- hostRef.$flags$ |= 512 /* needsRerender */;
918
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
919
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
653
920
  return;
654
921
  }
655
922
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
@@ -668,6 +935,11 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
668
935
  promise = safeCall(instance, 'componentWillLoad');
669
936
  }
670
937
  }
938
+ else {
939
+ {
940
+ promise = safeCall(instance, 'componentWillUpdate');
941
+ }
942
+ }
671
943
  endSchedule();
672
944
  return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
673
945
  };
@@ -701,7 +973,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
701
973
  }
702
974
  else {
703
975
  Promise.all(childrenPromises).then(postUpdate);
704
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
976
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
705
977
  childrenPromises.length = 0;
706
978
  }
707
979
  }
@@ -710,10 +982,10 @@ const callRender = (hostRef, instance, elm) => {
710
982
  try {
711
983
  instance = instance.render() ;
712
984
  {
713
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
985
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
714
986
  }
715
987
  {
716
- hostRef.$flags$ |= 2 /* hasRendered */;
988
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
717
989
  }
718
990
  {
719
991
  {
@@ -740,8 +1012,8 @@ const postUpdateComponent = (hostRef) => {
740
1012
  {
741
1013
  safeCall(instance, 'componentDidRender');
742
1014
  }
743
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
744
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1015
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1016
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
745
1017
  {
746
1018
  // DOM WRITE!
747
1019
  addHydratedFlag(elm);
@@ -770,10 +1042,10 @@ const postUpdateComponent = (hostRef) => {
770
1042
  hostRef.$onRenderResolve$();
771
1043
  hostRef.$onRenderResolve$ = undefined;
772
1044
  }
773
- if (hostRef.$flags$ & 512 /* needsRerender */) {
1045
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
774
1046
  nextTick(() => scheduleUpdate(hostRef, false));
775
1047
  }
776
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1048
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
777
1049
  }
778
1050
  // ( •_•)
779
1051
  // ( •_•)>⌐■-■
@@ -803,25 +1075,6 @@ const then = (promise, thenFn) => {
803
1075
  };
804
1076
  const addHydratedFlag = (elm) => elm.classList.add('hydrated')
805
1077
  ;
806
- const parsePropertyValue = (propValue, propType) => {
807
- // ensure this value is of the correct prop type
808
- if (propValue != null && !isComplexType(propValue)) {
809
- if (propType & 2 /* Number */) {
810
- // force it to be a number
811
- return parseFloat(propValue);
812
- }
813
- if (propType & 1 /* String */) {
814
- // could have been passed as a number or boolean
815
- // but we still want it as a string
816
- return String(propValue);
817
- }
818
- // redundant return here for better minification
819
- return propValue;
820
- }
821
- // not sure exactly what type we want
822
- // so no need to change to a different type
823
- return propValue;
824
- };
825
1078
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
826
1079
  const setValue = (ref, propName, newVal, cmpMeta) => {
827
1080
  // check our new property value against our internal value
@@ -830,12 +1083,15 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
830
1083
  const flags = hostRef.$flags$;
831
1084
  const instance = hostRef.$lazyInstance$ ;
832
1085
  newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
833
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
1086
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1087
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1088
+ const didValueChange = newVal !== oldVal && !areBothNaN;
1089
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
834
1090
  // gadzooks! the property's value has changed!!
835
1091
  // set our new value!
836
1092
  hostRef.$instanceValues$.set(propName, newVal);
837
1093
  if (instance) {
838
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1094
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
839
1095
  // looks like this value actually changed, so we've got work to do!
840
1096
  // but only if we've already rendered, otherwise just chill out
841
1097
  // queue that we need to do an update, but don't worry about queuing
@@ -845,14 +1101,24 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
845
1101
  }
846
1102
  }
847
1103
  };
1104
+ /**
1105
+ * Attach a series of runtime constructs to a compiled Stencil component
1106
+ * constructor, including getters and setters for the `@Prop` and `@State`
1107
+ * decorators, callbacks for when attributes change, and so on.
1108
+ *
1109
+ * @param Cstr the constructor for a component that we need to process
1110
+ * @param cmpMeta metadata collected previously about the component
1111
+ * @param flags a number used to store a series of bit flags
1112
+ * @returns a reference to the same constructor passed in (but now mutated)
1113
+ */
848
1114
  const proxyComponent = (Cstr, cmpMeta, flags) => {
849
1115
  if (cmpMeta.$members$) {
850
1116
  // It's better to have a const than two Object.entries()
851
1117
  const members = Object.entries(cmpMeta.$members$);
852
1118
  const prototype = Cstr.prototype;
853
1119
  members.map(([memberName, [memberFlags]]) => {
854
- if ((memberFlags & 31 /* Prop */ ||
855
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1120
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1121
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
856
1122
  // proxyComponent - prop
857
1123
  Object.defineProperty(prototype, memberName, {
858
1124
  get() {
@@ -867,8 +1133,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
867
1133
  enumerable: true,
868
1134
  });
869
1135
  }
870
- else if (flags & 1 /* isElementConstructor */ &&
871
- memberFlags & 64 /* Method */) {
1136
+ else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1137
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
872
1138
  // proxyComponent - method
873
1139
  Object.defineProperty(prototype, memberName, {
874
1140
  value(...args) {
@@ -878,19 +1144,19 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
878
1144
  });
879
1145
  }
880
1146
  });
881
- if ((flags & 1 /* isElementConstructor */)) {
1147
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
882
1148
  const attrNameToPropName = new Map();
883
1149
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
884
1150
  plt.jmp(() => {
885
1151
  const propName = attrNameToPropName.get(attrName);
886
- // In a webcomponent lifecyle the attributeChangedCallback runs prior to connectedCallback
1152
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
887
1153
  // in the case where an attribute was set inline.
888
1154
  // ```html
889
1155
  // <my-component some-attribute="some-value"></my-component>
890
1156
  // ```
891
1157
  //
892
- // There is an edge case where a developer sets the attribute inline on a custom element and then programatically
893
- // changes it before it has been upgraded as shown below:
1158
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
1159
+ // programmatically changes it before it has been upgraded as shown below:
894
1160
  //
895
1161
  // ```html
896
1162
  // <!-- this component has _not_ been upgraded yet -->
@@ -900,13 +1166,13 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
900
1166
  // el = document.querySelector("#test");
901
1167
  // el.someAttribute = "another-value";
902
1168
  // // upgrade component
903
- // cutsomElements.define('my-component', MyComponent);
1169
+ // customElements.define('my-component', MyComponent);
904
1170
  // </script>
905
1171
  // ```
906
1172
  // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
907
1173
  // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
908
1174
  // to the value that was set inline i.e. "some-value" from above example. When
909
- // the connectedCallback attempts to unshadow it will use "some-value" as the intial value rather than "another-value"
1175
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
910
1176
  //
911
1177
  // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
912
1178
  // by connectedCallback as this attributeChangedCallback will not fire.
@@ -920,13 +1186,21 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
920
1186
  newValue = this[propName];
921
1187
  delete this[propName];
922
1188
  }
1189
+ else if (prototype.hasOwnProperty(propName) &&
1190
+ typeof this[propName] === 'number' &&
1191
+ this[propName] == newValue) {
1192
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1193
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1194
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1195
+ return;
1196
+ }
923
1197
  this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
924
1198
  });
925
1199
  };
926
1200
  // create an array of attributes to observe
927
1201
  // and also create a map of html attribute name to js property name
928
1202
  Cstr.observedAttributes = members
929
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1203
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
930
1204
  .map(([propName, m]) => {
931
1205
  const attrName = m[1] || propName;
932
1206
  attrNameToPropName.set(attrName, propName);
@@ -938,10 +1212,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
938
1212
  };
939
1213
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
940
1214
  // initializeComponent
941
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1215
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
942
1216
  {
943
1217
  // we haven't initialized this element yet
944
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1218
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
945
1219
  // lazy loaded components
946
1220
  // request the component's implementation to be
947
1221
  // wired up with the host element
@@ -953,7 +1227,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
953
1227
  endLoad();
954
1228
  }
955
1229
  if (!Cstr.isProxied) {
956
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1230
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
957
1231
  Cstr.isProxied = true;
958
1232
  }
959
1233
  const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
@@ -961,7 +1235,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
961
1235
  // but let's keep track of when we start and stop
962
1236
  // so that the getters/setters don't incorrectly step on data
963
1237
  {
964
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1238
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
965
1239
  }
966
1240
  // construct the lazy-loaded component implementation
967
1241
  // passing the hostRef is very important during
@@ -974,7 +1248,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
974
1248
  consoleError(e);
975
1249
  }
976
1250
  {
977
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1251
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
978
1252
  }
979
1253
  endNewInstance();
980
1254
  }
@@ -984,7 +1258,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
984
1258
  const scopeId = getScopeId(cmpMeta);
985
1259
  if (!styles.has(scopeId)) {
986
1260
  const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
987
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1261
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
988
1262
  endRegisterStyles();
989
1263
  }
990
1264
  }
@@ -993,7 +1267,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
993
1267
  const ancestorComponent = hostRef.$ancestorComponent$;
994
1268
  const schedule = () => scheduleUpdate(hostRef, true);
995
1269
  if (ancestorComponent && ancestorComponent['s-rc']) {
996
- // this is the intial load and this component it has an ancestor component
1270
+ // this is the initial load and this component it has an ancestor component
997
1271
  // but the ancestor component has NOT fired its will update lifecycle yet
998
1272
  // so let's just cool our jets and wait for the ancestor to continue first
999
1273
  // this will get fired off when the ancestor component
@@ -1006,13 +1280,13 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1006
1280
  }
1007
1281
  };
1008
1282
  const connectedCallback = (elm) => {
1009
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1283
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1010
1284
  const hostRef = getHostRef(elm);
1011
1285
  const cmpMeta = hostRef.$cmpMeta$;
1012
1286
  const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1013
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1287
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1014
1288
  // first time this component has connected
1015
- hostRef.$flags$ |= 1 /* hasConnected */;
1289
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1016
1290
  {
1017
1291
  // find the first ancestor component (if there is one) and register
1018
1292
  // this component as one of the actively loading child components for its ancestor
@@ -1032,7 +1306,7 @@ const connectedCallback = (elm) => {
1032
1306
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1033
1307
  if (cmpMeta.$members$) {
1034
1308
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1035
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1309
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1036
1310
  const value = elm[memberName];
1037
1311
  delete elm[memberName];
1038
1312
  elm[memberName] = value;
@@ -1047,11 +1321,12 @@ const connectedCallback = (elm) => {
1047
1321
  }
1048
1322
  };
1049
1323
  const disconnectedCallback = (elm) => {
1050
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1324
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1051
1325
  getHostRef(elm);
1052
1326
  }
1053
1327
  };
1054
1328
  const bootstrapLazy = (lazyBundles, options = {}) => {
1329
+ var _a;
1055
1330
  const endBootstrap = createTime();
1056
1331
  const cmpTags = [];
1057
1332
  const exclude = options.exclude || [];
@@ -1064,54 +1339,61 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1064
1339
  let isBootstrapping = true;
1065
1340
  Object.assign(plt, options);
1066
1341
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1067
- lazyBundles.map((lazyBundle) => lazyBundle[1].map((compactMeta) => {
1068
- const cmpMeta = {
1069
- $flags$: compactMeta[0],
1070
- $tagName$: compactMeta[1],
1071
- $members$: compactMeta[2],
1072
- $listeners$: compactMeta[3],
1073
- };
1074
- {
1075
- cmpMeta.$members$ = compactMeta[2];
1076
- }
1077
- const tagName = cmpMeta.$tagName$;
1078
- const HostElement = class extends HTMLElement {
1079
- // StencilLazyHost
1080
- constructor(self) {
1081
- // @ts-ignore
1082
- super(self);
1083
- self = this;
1084
- registerHost(self, cmpMeta);
1342
+ lazyBundles.map((lazyBundle) => {
1343
+ lazyBundle[1].map((compactMeta) => {
1344
+ const cmpMeta = {
1345
+ $flags$: compactMeta[0],
1346
+ $tagName$: compactMeta[1],
1347
+ $members$: compactMeta[2],
1348
+ $listeners$: compactMeta[3],
1349
+ };
1350
+ {
1351
+ cmpMeta.$members$ = compactMeta[2];
1085
1352
  }
1086
- connectedCallback() {
1087
- if (appLoadFallback) {
1088
- clearTimeout(appLoadFallback);
1089
- appLoadFallback = null;
1353
+ const tagName = cmpMeta.$tagName$;
1354
+ const HostElement = class extends HTMLElement {
1355
+ // StencilLazyHost
1356
+ constructor(self) {
1357
+ // @ts-ignore
1358
+ super(self);
1359
+ self = this;
1360
+ registerHost(self, cmpMeta);
1090
1361
  }
1091
- if (isBootstrapping) {
1092
- // connectedCallback will be processed once all components have been registered
1093
- deferredConnectedCallbacks.push(this);
1362
+ connectedCallback() {
1363
+ if (appLoadFallback) {
1364
+ clearTimeout(appLoadFallback);
1365
+ appLoadFallback = null;
1366
+ }
1367
+ if (isBootstrapping) {
1368
+ // connectedCallback will be processed once all components have been registered
1369
+ deferredConnectedCallbacks.push(this);
1370
+ }
1371
+ else {
1372
+ plt.jmp(() => connectedCallback(this));
1373
+ }
1094
1374
  }
1095
- else {
1096
- plt.jmp(() => connectedCallback(this));
1375
+ disconnectedCallback() {
1376
+ plt.jmp(() => disconnectedCallback(this));
1097
1377
  }
1378
+ componentOnReady() {
1379
+ return getHostRef(this).$onReadyPromise$;
1380
+ }
1381
+ };
1382
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1383
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1384
+ cmpTags.push(tagName);
1385
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1098
1386
  }
1099
- disconnectedCallback() {
1100
- plt.jmp(() => disconnectedCallback(this));
1101
- }
1102
- componentOnReady() {
1103
- return getHostRef(this).$onReadyPromise$;
1104
- }
1105
- };
1106
- cmpMeta.$lazyBundleId$ = lazyBundle[0];
1107
- if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1108
- cmpTags.push(tagName);
1109
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1110
- }
1111
- }));
1387
+ });
1388
+ });
1112
1389
  {
1113
1390
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1114
1391
  visibilityStyle.setAttribute('data-styles', '');
1392
+ // Apply CSP nonce to the style tag if it exists
1393
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1394
+ if (nonce != null) {
1395
+ visibilityStyle.setAttribute('nonce', nonce);
1396
+ }
1115
1397
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1116
1398
  }
1117
1399
  // Process deferred connectedCallbacks now all components have been registered
@@ -1127,7 +1409,14 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1127
1409
  // Fallback appLoad event
1128
1410
  endBootstrap();
1129
1411
  };
1130
- const hostRefs = new WeakMap();
1412
+ /**
1413
+ * Assigns the given value to the nonce property on the runtime platform object.
1414
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1415
+ * @param nonce The value to be assigned to the platform nonce property.
1416
+ * @returns void
1417
+ */
1418
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1419
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1131
1420
  const getHostRef = (ref) => hostRefs.get(ref);
1132
1421
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1133
1422
  const registerHost = (elm, cmpMeta) => {
@@ -1158,7 +1447,9 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1158
1447
  if (module) {
1159
1448
  return module[exportName];
1160
1449
  }
1450
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1161
1451
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1452
+ /* @vite-ignore */
1162
1453
  /* webpackInclude: /\.entry\.js$/ */
1163
1454
  /* webpackExclude: /\.system\.entry\.js$/ */
1164
1455
  /* webpackMode: "lazy" */
@@ -1169,14 +1460,35 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1169
1460
  return importedModule[exportName];
1170
1461
  }, consoleError);
1171
1462
  };
1172
- const styles = new Map();
1463
+ const styles = /*@__PURE__*/ new Map();
1464
+ const win = typeof window !== 'undefined' ? window : {};
1465
+ const doc = win.document || { head: {} };
1466
+ const plt = {
1467
+ $flags$: 0,
1468
+ $resourcesUrl$: '',
1469
+ jmp: (h) => h(),
1470
+ raf: (h) => requestAnimationFrame(h),
1471
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1472
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1473
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1474
+ };
1475
+ const promiseResolve = (v) => Promise.resolve(v);
1476
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1477
+ try {
1478
+ new CSSStyleSheet();
1479
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1480
+ }
1481
+ catch (e) { }
1482
+ return false;
1483
+ })()
1484
+ ;
1173
1485
  const queueDomReads = [];
1174
1486
  const queueDomWrites = [];
1175
1487
  const queueTask = (queue, write) => (cb) => {
1176
1488
  queue.push(cb);
1177
1489
  if (!queuePending) {
1178
1490
  queuePending = true;
1179
- if (write && plt.$flags$ & 4 /* queueSync */) {
1491
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1180
1492
  nextTick(flush);
1181
1493
  }
1182
1494
  else {
@@ -1214,6 +1526,8 @@ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1214
1526
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1215
1527
 
1216
1528
  exports.bootstrapLazy = bootstrapLazy;
1529
+ exports.getAssetPath = getAssetPath;
1217
1530
  exports.h = h;
1218
1531
  exports.promiseResolve = promiseResolve;
1219
1532
  exports.registerInstance = registerInstance;
1533
+ exports.setNonce = setNonce;