@zonos/elements 1.3.15-alpha.2 → 1.3.15

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 (415) hide show
  1. package/dist/cjs/RemoveIcon-6c79a2a1.js +5 -0
  2. package/dist/cjs/{cart-1b1d39af.js → cart-db549f04.js} +976 -138
  3. package/dist/cjs/containsNonLatinChars-2be5129b.js +24 -0
  4. package/dist/cjs/{getBorderRadius-c8cc2bb3.js → getBorderRadius-44b3eca1.js} +4 -6
  5. package/dist/cjs/index-654a6001.js +1361 -0
  6. package/dist/cjs/isCheckoutMobile-f491ca7c.js +8 -0
  7. package/dist/cjs/{isDarkColor-f5473002.js → isDarkColor-01f45d3f.js} +1 -1
  8. package/dist/cjs/loader.cjs.js +2 -2
  9. package/dist/cjs/{submitGtag-ab287a34.js → submitGtag-fd8acad5.js} +21 -2
  10. package/dist/cjs/zonos-address_8.cjs.entry.js +642 -0
  11. package/dist/cjs/zonos-badge_2.cjs.entry.js +9 -9
  12. package/dist/cjs/zonos-banner.cjs.entry.js +3 -3
  13. package/dist/cjs/zonos-button_3.cjs.entry.js +192 -0
  14. package/dist/cjs/zonos-card_2.cjs.entry.js +12 -12
  15. package/dist/cjs/{zonos-cart-items_10.cjs.entry.js → zonos-cart-items_9.cjs.entry.js} +144 -118
  16. package/dist/cjs/zonos-checkout.cjs.entry.js +19 -18
  17. package/dist/cjs/zonos-component.cjs.entry.js +2 -2
  18. package/dist/cjs/zonos-controller.cjs.entry.js +6 -6
  19. package/dist/cjs/zonos-country-flag.cjs.entry.js +5 -5
  20. package/dist/cjs/zonos-country-select_3.cjs.entry.js +14 -14
  21. package/dist/cjs/zonos-elements.cjs.js +10 -10
  22. package/dist/cjs/zonos-hello-dialog.cjs.entry.js +9 -9
  23. package/dist/cjs/zonos-hello.cjs.entry.js +6 -6
  24. package/dist/cjs/zonos-input.cjs.entry.js +57 -0
  25. package/dist/cjs/zonos-link.cjs.entry.js +2 -2
  26. package/dist/cjs/zonos-logo.cjs.entry.js +4 -4
  27. package/dist/cjs/zonos-notification.cjs.entry.js +5 -5
  28. package/dist/cjs/zonos-payment.cjs.entry.js +7 -7
  29. package/dist/cjs/zonos-select-dialog-header_2.cjs.entry.js +7 -7
  30. package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +8 -6
  31. package/dist/cjs/zonos-text.cjs.entry.js +3 -2
  32. package/dist/cjs/{zonosStore-aee974e0.js → zonosStore-d8bb0bda.js} +1 -1
  33. package/dist/collection/collection-manifest.json +5 -1
  34. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-display/zonos-address-display.css +62 -0
  35. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-display/zonos-address-display.js +80 -0
  36. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-form/zonos-address-form.css +59 -0
  37. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-form/zonos-address-form.js +148 -0
  38. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.css +115 -0
  39. package/dist/collection/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.js +429 -0
  40. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.css +1 -1
  41. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.js +1 -1
  42. package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.css +2 -2
  43. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.css +4 -4
  44. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-finish/zonos-checkout-finish.js +5 -3
  45. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/zonos-checkout-footer.css +9 -9
  46. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-footer/zonos-checkout-footer.js +2 -2
  47. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.css +5 -5
  48. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.css +16 -16
  49. package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +6 -4
  50. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.css +8 -8
  51. package/dist/collection/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.js +135 -20
  52. package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.css +5 -5
  53. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.css +7 -7
  54. package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +1 -1
  55. package/dist/collection/components/common/component-template/zonos-link/zonos-link.js +1 -1
  56. package/dist/collection/components/common/zonos-badge/zonos-badge.css +1 -1
  57. package/dist/collection/components/common/zonos-badge/zonos-badge.js +3 -3
  58. package/dist/collection/components/common/zonos-banner/zonos-banner.css +3 -3
  59. package/dist/collection/components/common/zonos-button/zonos-button.css +10 -9
  60. package/dist/collection/components/common/zonos-button/zonos-button.js +17 -8
  61. package/dist/collection/components/common/zonos-card/zonos-card.css +9 -9
  62. package/dist/collection/components/common/zonos-card/zonos-card.js +3 -3
  63. package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.css +2 -1
  64. package/dist/collection/components/common/zonos-checkbox/zonos-checkbox.js +22 -4
  65. package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.css +1 -1
  66. package/dist/collection/components/common/zonos-checkout-progress-tabs/zonos-checkout-progress-tabs.js +3 -3
  67. package/dist/collection/components/common/zonos-collapse/zonos-collapse.js +2 -2
  68. package/dist/collection/components/common/zonos-country-select/zonos-country-select.css +5 -5
  69. package/dist/collection/components/common/zonos-country-select/zonos-country-select.js +2 -2
  70. package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.css +1 -1
  71. package/dist/collection/components/common/zonos-custom-message/zonos-custom-message.js +2 -2
  72. package/dist/collection/components/common/zonos-dialog/zonos-dialog.css +6 -6
  73. package/dist/collection/components/common/zonos-dialog/zonos-dialog.js +6 -4
  74. package/dist/collection/components/common/zonos-input/zonos-input.css +176 -0
  75. package/dist/collection/components/common/zonos-input/zonos-input.js +193 -0
  76. package/dist/collection/components/common/zonos-language-select/zonos-language-select.css +4 -4
  77. package/dist/collection/components/common/zonos-language-select/zonos-language-select.js +2 -2
  78. package/dist/collection/components/common/zonos-logo/zonos-logo.js +2 -2
  79. package/dist/collection/components/common/zonos-notification/zonos-notification.css +3 -3
  80. package/dist/collection/components/common/zonos-notification/zonos-notification.js +2 -2
  81. package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.css +1 -1
  82. package/dist/collection/components/common/zonos-select-dialog-header/zonos-select-dialog-header.js +2 -2
  83. package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.css +2 -2
  84. package/dist/collection/components/common/zonos-shipping-rich-radio/zonos-shipping-rich-radio.js +4 -2
  85. package/dist/collection/components/common/zonos-text/zonos-text.js +1 -0
  86. package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.css +1 -1
  87. package/dist/collection/components/common/zonos-tooltip/zonos-tooltip.js +2 -2
  88. package/dist/collection/components/common/zonos-v-stack/zonos-v-stack.js +2 -2
  89. package/dist/collection/components/component-template/zonos-component/zonos-component.js +1 -1
  90. package/dist/collection/components/hello/zonos-hello/zonos-hello.css +18 -18
  91. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.css +10 -52
  92. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +2 -2
  93. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.css +4 -4
  94. package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +3 -3
  95. package/dist/collection/components/main/zonos-controller.js +2 -2
  96. package/dist/collection/components/store/checkout/stripe.js +153 -14
  97. package/dist/collection/components/store/translationStore/strings.arabic.js +36 -6
  98. package/dist/collection/components/store/translationStore/strings.base.js +36 -6
  99. package/dist/collection/components/store/translationStore/strings.chinese.js +36 -6
  100. package/dist/collection/components/store/translationStore/strings.danish.js +36 -6
  101. package/dist/collection/components/store/translationStore/strings.dutch.js +36 -6
  102. package/dist/collection/components/store/translationStore/strings.french.js +36 -6
  103. package/dist/collection/components/store/translationStore/strings.german.js +36 -6
  104. package/dist/collection/components/store/translationStore/strings.hebrew.js +36 -6
  105. package/dist/collection/components/store/translationStore/strings.indonesian.js +36 -6
  106. package/dist/collection/components/store/translationStore/strings.italian.js +36 -6
  107. package/dist/collection/components/store/translationStore/strings.japanese.js +36 -6
  108. package/dist/collection/components/store/translationStore/strings.korean.js +36 -6
  109. package/dist/collection/components/store/translationStore/strings.norwegian.js +36 -6
  110. package/dist/collection/components/store/translationStore/strings.polish.js +36 -6
  111. package/dist/collection/components/store/translationStore/strings.portuguese.js +36 -6
  112. package/dist/collection/components/store/translationStore/strings.russian.js +36 -6
  113. package/dist/collection/components/store/translationStore/strings.spanish.js +36 -6
  114. package/dist/collection/components/store/translationStore/strings.swedish.js +36 -6
  115. package/dist/collection/components/store/translationStore/strings.turkish.js +36 -6
  116. package/dist/collection/components/store/translationStore/strings.vietnamese.js +36 -6
  117. package/dist/collection/components/stripe/zonos-address/zonos-address.css +2 -2
  118. package/dist/collection/components/stripe/zonos-address/zonos-address.js +3 -71
  119. package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.css +1 -1
  120. package/dist/collection/components/stripe/zonos-link-authentication/zonos-link-authentication.js +29 -5
  121. package/dist/collection/components/stripe/zonos-payment/zonos-payment.css +1 -1
  122. package/dist/collection/components/stripe/zonos-payment/zonos-payment.js +1 -1
  123. package/dist/collection/components/utils/checkout/buildTranslateRequestBody.js +98 -0
  124. package/dist/collection/components/utils/containsNonLatinChars.js +10 -8
  125. package/dist/collection/components/utils/getBorderRadius.js +3 -5
  126. package/dist/collection/styles/stripe/defaultVariable.js +2 -2
  127. package/dist/collection/types/checkout/TranslatedText.js +1 -0
  128. package/dist/collection/types/checkout/api/ValidateAddressRequest.js +1 -0
  129. package/dist/components/containsNonLatinChars.js +21 -0
  130. package/dist/components/getBorderRadius.js +3 -5
  131. package/dist/components/stripe.js +255 -4545
  132. package/dist/components/trackConversionEvent.js +1 -1
  133. package/dist/components/translationStore.js +5131 -0
  134. package/dist/components/zonos-address-display.d.ts +11 -0
  135. package/dist/components/zonos-address-display.js +6 -0
  136. package/dist/components/zonos-address-display2.js +64 -0
  137. package/dist/components/zonos-address-form.d.ts +11 -0
  138. package/dist/components/zonos-address-form.js +6 -0
  139. package/dist/components/zonos-address-form2.js +84 -0
  140. package/dist/components/zonos-address-update-dialog.d.ts +11 -0
  141. package/dist/components/zonos-address-update-dialog.js +6 -0
  142. package/dist/components/zonos-address-update-dialog2.js +264 -0
  143. package/dist/components/zonos-address2.js +4 -94
  144. package/dist/components/zonos-badge2.js +4 -4
  145. package/dist/components/zonos-banner2.js +1 -1
  146. package/dist/components/zonos-button2.js +18 -9
  147. package/dist/components/zonos-card2.js +4 -4
  148. package/dist/components/zonos-cart-items2.js +2 -2
  149. package/dist/components/zonos-cart-subtotal2.js +3 -2
  150. package/dist/components/zonos-checkbox2.js +15 -6
  151. package/dist/components/zonos-checkout-finish2.js +27 -7
  152. package/dist/components/zonos-checkout-footer2.js +3 -3
  153. package/dist/components/zonos-checkout-payment2.js +3 -2
  154. package/dist/components/zonos-checkout-progress-tabs2.js +6 -5
  155. package/dist/components/zonos-checkout.js +72 -42
  156. package/dist/components/zonos-collapse2.js +2 -2
  157. package/dist/components/zonos-component.js +1 -1
  158. package/dist/components/zonos-controller.js +2 -2
  159. package/dist/components/zonos-country-select2.js +3 -3
  160. package/dist/components/zonos-custom-message2.js +3 -3
  161. package/dist/components/zonos-customer-info2.js +171 -30
  162. package/dist/components/zonos-dialog2.js +7 -5
  163. package/dist/components/zonos-hello-dialog-footer2.js +3 -3
  164. package/dist/components/zonos-hello-dialog2.js +6 -5
  165. package/dist/components/zonos-hello.js +3 -2
  166. package/dist/components/zonos-input.d.ts +11 -0
  167. package/dist/components/zonos-input.js +6 -0
  168. package/dist/components/zonos-input2.js +78 -0
  169. package/dist/components/zonos-language-select2.js +5 -4
  170. package/dist/components/zonos-link-authentication2.js +13 -6
  171. package/dist/components/zonos-link.js +1 -1
  172. package/dist/components/zonos-logo.js +2 -2
  173. package/dist/components/zonos-notification2.js +3 -3
  174. package/dist/components/zonos-payment2.js +2 -2
  175. package/dist/components/zonos-review2.js +3 -2
  176. package/dist/components/zonos-select-dialog-header2.js +3 -3
  177. package/dist/components/zonos-shipping-rich-radio2.js +5 -3
  178. package/dist/components/zonos-shipping2.js +4 -3
  179. package/dist/components/zonos-text2.js +1 -0
  180. package/dist/components/zonos-tooltip2.js +3 -3
  181. package/dist/components/zonos-v-stack2.js +2 -2
  182. package/dist/esm/RemoveIcon-f6715b36.js +3 -0
  183. package/dist/esm/{cart-10bcd2e0.js → cart-462e89a6.js} +976 -139
  184. package/dist/esm/containsNonLatinChars-2d8810c3.js +21 -0
  185. package/dist/esm/{getBorderRadius-8129b0cb.js → getBorderRadius-567f1786.js} +4 -6
  186. package/dist/esm/index-e063389c.js +1328 -0
  187. package/dist/esm/isCheckoutMobile-8846dccb.js +6 -0
  188. package/dist/esm/{isDarkColor-7a6d2d14.js → isDarkColor-7f62035a.js} +1 -1
  189. package/dist/esm/loader.js +3 -3
  190. package/dist/esm/{submitGtag-84886899.js → submitGtag-ac7c3c89.js} +21 -3
  191. package/dist/esm/zonos-address_8.entry.js +631 -0
  192. package/dist/esm/zonos-badge_2.entry.js +9 -9
  193. package/dist/esm/zonos-banner.entry.js +3 -3
  194. package/dist/esm/zonos-button_3.entry.js +186 -0
  195. package/dist/esm/zonos-card_2.entry.js +12 -12
  196. package/dist/esm/{zonos-cart-items_10.entry.js → zonos-cart-items_9.entry.js} +140 -113
  197. package/dist/esm/zonos-checkout.entry.js +14 -13
  198. package/dist/esm/zonos-component.entry.js +2 -2
  199. package/dist/esm/zonos-controller.entry.js +6 -6
  200. package/dist/esm/zonos-country-flag.entry.js +5 -5
  201. package/dist/esm/zonos-country-select_3.entry.js +14 -14
  202. package/dist/esm/zonos-elements.js +11 -11
  203. package/dist/esm/zonos-hello-dialog.entry.js +9 -9
  204. package/dist/esm/zonos-hello.entry.js +6 -6
  205. package/dist/esm/zonos-input.entry.js +53 -0
  206. package/dist/esm/zonos-link.entry.js +2 -2
  207. package/dist/esm/zonos-logo.entry.js +4 -4
  208. package/dist/esm/zonos-notification.entry.js +5 -5
  209. package/dist/esm/zonos-payment.entry.js +7 -7
  210. package/dist/esm/zonos-select-dialog-header_2.entry.js +7 -7
  211. package/dist/esm/zonos-shipping-rich-radio.entry.js +8 -6
  212. package/dist/esm/zonos-text.entry.js +3 -2
  213. package/dist/esm/{zonosStore-f3eef64b.js → zonosStore-33ff08ff.js} +1 -1
  214. package/dist/esm-es5/RemoveIcon-f6715b36.js +1 -0
  215. package/dist/esm-es5/cart-462e89a6.js +1 -0
  216. package/dist/esm-es5/containsNonLatinChars-2d8810c3.js +1 -0
  217. package/dist/esm-es5/getBorderRadius-567f1786.js +1 -0
  218. package/dist/esm-es5/index-e063389c.js +2 -0
  219. package/dist/esm-es5/isCheckoutMobile-8846dccb.js +1 -0
  220. package/dist/esm-es5/{isDarkColor-7a6d2d14.js → isDarkColor-7f62035a.js} +1 -1
  221. package/dist/esm-es5/loader.js +1 -1
  222. package/dist/esm-es5/submitGtag-ac7c3c89.js +1 -0
  223. package/dist/esm-es5/zonos-address_8.entry.js +1 -0
  224. package/dist/esm-es5/zonos-badge_2.entry.js +1 -1
  225. package/dist/esm-es5/zonos-banner.entry.js +1 -1
  226. package/dist/esm-es5/zonos-button_3.entry.js +1 -0
  227. package/dist/esm-es5/zonos-card_2.entry.js +1 -1
  228. package/dist/esm-es5/zonos-cart-items_9.entry.js +1 -0
  229. package/dist/esm-es5/zonos-checkout.entry.js +1 -1
  230. package/dist/esm-es5/zonos-component.entry.js +1 -1
  231. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  232. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  233. package/dist/esm-es5/zonos-country-select_3.entry.js +1 -1
  234. package/dist/esm-es5/zonos-elements.js +1 -1
  235. package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
  236. package/dist/esm-es5/zonos-hello.entry.js +1 -1
  237. package/dist/esm-es5/zonos-input.entry.js +1 -0
  238. package/dist/esm-es5/zonos-link.entry.js +1 -1
  239. package/dist/esm-es5/zonos-logo.entry.js +1 -1
  240. package/dist/esm-es5/zonos-notification.entry.js +1 -1
  241. package/dist/esm-es5/zonos-payment.entry.js +1 -1
  242. package/dist/esm-es5/zonos-select-dialog-header_2.entry.js +1 -1
  243. package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
  244. package/dist/esm-es5/zonos-text.entry.js +1 -1
  245. package/dist/esm-es5/{zonosStore-f3eef64b.js → zonosStore-33ff08ff.js} +1 -1
  246. package/dist/scripts/loadStripe.js +1 -1
  247. package/dist/scripts/loadZonos.js +1 -1
  248. package/dist/scripts/stripe.js +1 -1
  249. package/dist/scripts/zonos.js +1 -1
  250. package/dist/scripts/zonosBase.js +1 -1
  251. package/dist/types/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-display/zonos-address-display.d.ts +12 -0
  252. package/dist/types/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-form/zonos-address-form.d.ts +28 -0
  253. package/dist/types/components/checkout/zonos-checkout/zonos-address-update-dialog/zonos-address-update-dialog.d.ts +96 -0
  254. package/dist/types/components/checkout/zonos-checkout/zonos-customer-info/zonos-customer-info.d.ts +22 -2
  255. package/dist/types/components/common/zonos-checkbox/zonos-checkbox.d.ts +1 -0
  256. package/dist/types/components/common/zonos-dialog/zonos-dialog.d.ts +0 -3
  257. package/dist/types/components/common/zonos-input/zonos-input.d.ts +35 -0
  258. package/dist/types/components/store/checkout/stripe.d.ts +25 -1
  259. package/dist/types/components/store/translationStore/strings.arabic.d.ts +35 -5
  260. package/dist/types/components/store/translationStore/strings.base.d.ts +35 -5
  261. package/dist/types/components/store/translationStore/strings.chinese.d.ts +35 -5
  262. package/dist/types/components/store/translationStore/strings.danish.d.ts +35 -5
  263. package/dist/types/components/store/translationStore/strings.dutch.d.ts +35 -5
  264. package/dist/types/components/store/translationStore/strings.french.d.ts +35 -5
  265. package/dist/types/components/store/translationStore/strings.german.d.ts +35 -5
  266. package/dist/types/components/store/translationStore/strings.hebrew.d.ts +35 -5
  267. package/dist/types/components/store/translationStore/strings.indonesian.d.ts +35 -5
  268. package/dist/types/components/store/translationStore/strings.italian.d.ts +35 -5
  269. package/dist/types/components/store/translationStore/strings.japanese.d.ts +35 -5
  270. package/dist/types/components/store/translationStore/strings.korean.d.ts +35 -5
  271. package/dist/types/components/store/translationStore/strings.norwegian.d.ts +35 -5
  272. package/dist/types/components/store/translationStore/strings.polish.d.ts +35 -5
  273. package/dist/types/components/store/translationStore/strings.portuguese.d.ts +35 -5
  274. package/dist/types/components/store/translationStore/strings.russian.d.ts +35 -5
  275. package/dist/types/components/store/translationStore/strings.spanish.d.ts +35 -5
  276. package/dist/types/components/store/translationStore/strings.swedish.d.ts +35 -5
  277. package/dist/types/components/store/translationStore/strings.turkish.d.ts +35 -5
  278. package/dist/types/components/store/translationStore/strings.vietnamese.d.ts +35 -5
  279. package/dist/types/components/store/translationStore.d.ts +1 -1
  280. package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +2 -10
  281. package/dist/types/components/stripe/zonos-link-authentication/zonos-link-authentication.d.ts +4 -0
  282. package/dist/types/components/utils/changeDeepProperty.d.ts +1 -1
  283. package/dist/types/components/utils/changeDeepPropertyAtIndex.d.ts +1 -1
  284. package/dist/types/components/utils/checkout/buildTranslateRequestBody.d.ts +26 -0
  285. package/dist/types/components/utils/containsNonLatinChars.d.ts +1 -0
  286. package/dist/types/components/utils/getBorderRadius.d.ts +7 -1
  287. package/dist/types/components.d.ts +308 -6
  288. package/dist/types/types/checkout/TranslatedText.d.ts +23 -0
  289. package/dist/types/types/checkout/api/ValidateAddressRequest.d.ts +20 -0
  290. package/dist/types/types/generated/graphql.customer.types.d.ts +2 -0
  291. package/dist/types/types/generated/graphql.customer.types.ts +2 -0
  292. package/dist/zonos-elements/p-029f11dd.system.entry.js +1 -0
  293. package/dist/zonos-elements/{p-2ee0d779.entry.js → p-094c0ee8.entry.js} +1 -1
  294. package/dist/zonos-elements/p-0c64dbbb.js +1 -0
  295. package/dist/zonos-elements/p-11504442.entry.js +1 -0
  296. package/dist/zonos-elements/p-11bef836.system.entry.js +1 -0
  297. package/dist/zonos-elements/{p-bc3a0f7c.entry.js → p-11f1b78c.entry.js} +1 -1
  298. package/dist/zonos-elements/p-13ddaf31.js +2 -0
  299. package/dist/zonos-elements/p-154aaf95.system.js +1 -0
  300. package/dist/zonos-elements/p-163ff5b5.system.js +2 -0
  301. package/dist/zonos-elements/{p-32b4e9c3.entry.js → p-1e934274.entry.js} +1 -1
  302. package/dist/zonos-elements/p-20582e58.system.entry.js +1 -0
  303. package/dist/zonos-elements/p-2439c82f.system.entry.js +1 -0
  304. package/dist/zonos-elements/p-2670438c.system.js +1 -0
  305. package/dist/zonos-elements/p-321226b0.entry.js +1 -0
  306. package/dist/zonos-elements/p-3221530d.system.entry.js +1 -0
  307. package/dist/zonos-elements/{p-97534044.entry.js → p-32d27535.entry.js} +1 -1
  308. package/dist/zonos-elements/p-3d10866d.entry.js +1 -0
  309. package/dist/zonos-elements/{p-1a5f8df7.entry.js → p-3d8667a7.entry.js} +1 -1
  310. package/dist/zonos-elements/p-3f05d130.system.entry.js +1 -0
  311. package/dist/zonos-elements/p-430eefd4.entry.js +1 -0
  312. package/dist/zonos-elements/p-49825866.system.entry.js +1 -0
  313. package/dist/zonos-elements/p-5525b740.entry.js +1 -0
  314. package/dist/zonos-elements/p-578f0aad.system.js +1 -0
  315. package/dist/zonos-elements/p-58a8ef6c.entry.js +1 -0
  316. package/dist/zonos-elements/p-5d993965.js +1 -0
  317. package/dist/zonos-elements/{p-262b8e1e.system.entry.js → p-5f9c066d.system.entry.js} +1 -1
  318. package/dist/zonos-elements/p-60e262f0.system.entry.js +1 -0
  319. package/dist/zonos-elements/p-64b594f4.js +1 -0
  320. package/dist/zonos-elements/p-66471df6.entry.js +1 -0
  321. package/dist/zonos-elements/{p-95c864ca.system.entry.js → p-679877b1.system.entry.js} +1 -1
  322. package/dist/zonos-elements/{p-fc4da55c.system.js → p-771fbeb3.system.js} +1 -1
  323. package/dist/zonos-elements/p-79f3c4f5.system.js +1 -0
  324. package/dist/zonos-elements/{p-e1ac5b2a.system.entry.js → p-80d78980.system.entry.js} +1 -1
  325. package/dist/zonos-elements/p-81a54668.js +1 -0
  326. package/dist/zonos-elements/p-83cc2936.js +1 -0
  327. package/dist/zonos-elements/{p-520e8e63.system.js → p-87badea9.system.js} +1 -1
  328. package/dist/zonos-elements/p-8a61a04f.system.entry.js +1 -0
  329. package/dist/zonos-elements/p-8b32f560.system.entry.js +1 -0
  330. package/dist/zonos-elements/{p-d01576d7.js → p-909a331c.js} +1 -1
  331. package/dist/zonos-elements/p-94b15a5e.system.entry.js +1 -0
  332. package/dist/zonos-elements/p-9a45fae5.system.entry.js +1 -0
  333. package/dist/zonos-elements/{p-24fee841.entry.js → p-9ec93319.entry.js} +1 -1
  334. package/dist/zonos-elements/p-a6d7ac46.js +1 -0
  335. package/dist/zonos-elements/p-a6eeb4bd.system.entry.js +1 -0
  336. package/dist/zonos-elements/p-a93f2e84.entry.js +1 -0
  337. package/dist/zonos-elements/p-aed0098c.system.js +1 -0
  338. package/dist/zonos-elements/p-b19d51e0.entry.js +1 -0
  339. package/dist/zonos-elements/{p-46f9c93e.system.entry.js → p-b9652402.system.entry.js} +1 -1
  340. package/dist/zonos-elements/{p-13b55282.entry.js → p-baee62a4.entry.js} +1 -1
  341. package/dist/zonos-elements/{p-eff12c31.system.entry.js → p-bf32179a.system.entry.js} +1 -1
  342. package/dist/zonos-elements/p-cd1cc224.entry.js +1 -0
  343. package/dist/zonos-elements/p-d1b63cec.system.entry.js +1 -0
  344. package/dist/zonos-elements/p-d6b103d5.system.js +1 -0
  345. package/dist/zonos-elements/{p-376bdf70.entry.js → p-da6767d8.entry.js} +1 -1
  346. package/dist/zonos-elements/p-dde1383b.entry.js +1 -0
  347. package/dist/zonos-elements/p-df192668.system.js +1 -0
  348. package/dist/zonos-elements/{p-70ede197.system.entry.js → p-df24d548.system.entry.js} +1 -1
  349. package/dist/zonos-elements/{p-6743734f.entry.js → p-e7b4b756.entry.js} +1 -1
  350. package/dist/zonos-elements/{p-d41b5762.js → p-f1962041.js} +1 -1
  351. package/dist/zonos-elements/p-f3d3c754.system.entry.js +1 -0
  352. package/dist/zonos-elements/p-f79682b5.entry.js +1 -0
  353. package/dist/zonos-elements/zonos-elements.css +3 -3
  354. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  355. package/dist/zonos-elements/zonos-elements.js +1 -1
  356. package/package.json +3 -2
  357. package/dist/cjs/index-3b4816ef.js +0 -2088
  358. package/dist/cjs/sendErrorLog-29e50f7e.js +0 -29
  359. package/dist/cjs/zonos-address_4.cjs.entry.js +0 -388
  360. package/dist/cjs/zonos-button_2.cjs.entry.js +0 -152
  361. package/dist/cjs/zonos-icon.cjs.entry.js +0 -39
  362. package/dist/components/sendErrorLog.js +0 -21
  363. package/dist/esm/index-0e31d804.js +0 -2055
  364. package/dist/esm/sendErrorLog-8642e94a.js +0 -26
  365. package/dist/esm/zonos-address_4.entry.js +0 -381
  366. package/dist/esm/zonos-button_2.entry.js +0 -147
  367. package/dist/esm/zonos-icon.entry.js +0 -35
  368. package/dist/esm-es5/cart-10bcd2e0.js +0 -1
  369. package/dist/esm-es5/getBorderRadius-8129b0cb.js +0 -1
  370. package/dist/esm-es5/index-0e31d804.js +0 -2
  371. package/dist/esm-es5/sendErrorLog-8642e94a.js +0 -1
  372. package/dist/esm-es5/submitGtag-84886899.js +0 -1
  373. package/dist/esm-es5/zonos-address_4.entry.js +0 -1
  374. package/dist/esm-es5/zonos-button_2.entry.js +0 -1
  375. package/dist/esm-es5/zonos-cart-items_10.entry.js +0 -1
  376. package/dist/esm-es5/zonos-icon.entry.js +0 -1
  377. package/dist/scripts/insertTranslations.js +0 -1
  378. package/dist/zonos-elements/p-066b5ca3.entry.js +0 -1
  379. package/dist/zonos-elements/p-0a0d45e9.system.entry.js +0 -1
  380. package/dist/zonos-elements/p-2244534c.js +0 -2
  381. package/dist/zonos-elements/p-2693da50.system.entry.js +0 -1
  382. package/dist/zonos-elements/p-2825570c.system.js +0 -2
  383. package/dist/zonos-elements/p-33abdb30.js +0 -1
  384. package/dist/zonos-elements/p-450942a3.system.js +0 -1
  385. package/dist/zonos-elements/p-46b4010c.entry.js +0 -1
  386. package/dist/zonos-elements/p-509717bc.system.entry.js +0 -1
  387. package/dist/zonos-elements/p-5ca09163.entry.js +0 -1
  388. package/dist/zonos-elements/p-5ff27485.js +0 -1
  389. package/dist/zonos-elements/p-6f5761e8.js +0 -1
  390. package/dist/zonos-elements/p-6fb15797.system.entry.js +0 -1
  391. package/dist/zonos-elements/p-73acb3eb.system.entry.js +0 -1
  392. package/dist/zonos-elements/p-7432179a.system.entry.js +0 -1
  393. package/dist/zonos-elements/p-8126011d.entry.js +0 -1
  394. package/dist/zonos-elements/p-8b44e558.system.js +0 -1
  395. package/dist/zonos-elements/p-8c568b87.entry.js +0 -1
  396. package/dist/zonos-elements/p-92d85125.system.entry.js +0 -1
  397. package/dist/zonos-elements/p-9b385237.entry.js +0 -1
  398. package/dist/zonos-elements/p-9fc92940.entry.js +0 -1
  399. package/dist/zonos-elements/p-a6bbf6de.system.entry.js +0 -1
  400. package/dist/zonos-elements/p-ad0a2581.entry.js +0 -1
  401. package/dist/zonos-elements/p-b4c3dcda.entry.js +0 -1
  402. package/dist/zonos-elements/p-b8e8330b.system.js +0 -1
  403. package/dist/zonos-elements/p-be022d8e.entry.js +0 -1
  404. package/dist/zonos-elements/p-c6170bec.system.js +0 -1
  405. package/dist/zonos-elements/p-c9e137e1.system.entry.js +0 -1
  406. package/dist/zonos-elements/p-d0d78094.system.entry.js +0 -1
  407. package/dist/zonos-elements/p-d1ba7e52.system.entry.js +0 -1
  408. package/dist/zonos-elements/p-d29895ed.system.entry.js +0 -1
  409. package/dist/zonos-elements/p-dac861bb.entry.js +0 -1
  410. package/dist/zonos-elements/p-e010f227.system.entry.js +0 -1
  411. package/dist/zonos-elements/p-e703c902.entry.js +0 -1
  412. package/dist/zonos-elements/p-e8a41797.system.entry.js +0 -1
  413. package/dist/zonos-elements/p-ed2e94d2.js +0 -1
  414. package/dist/zonos-elements/p-f2b60329.system.entry.js +0 -1
  415. package/dist/zonos-elements/p-f4c38bfc.system.js +0 -1
@@ -1,2088 +0,0 @@
1
- 'use strict';
2
-
3
- function _interopNamespace(e) {
4
- if (e && e.__esModule) return e;
5
- var n = Object.create(null);
6
- if (e) {
7
- Object.keys(e).forEach(function (k) {
8
- if (k !== 'default') {
9
- var d = Object.getOwnPropertyDescriptor(e, k);
10
- Object.defineProperty(n, k, d.get ? d : {
11
- enumerable: true,
12
- get: function () {
13
- return e[k];
14
- }
15
- });
16
- }
17
- });
18
- }
19
- n['default'] = e;
20
- return Object.freeze(n);
21
- }
22
-
23
- const NAMESPACE = 'zonos-elements';
24
-
25
- /**
26
- * Virtual DOM patching algorithm based on Snabbdom by
27
- * Simon Friis Vindum (@paldepind)
28
- * Licensed under the MIT License
29
- * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
30
- *
31
- * Modified for Stencil's renderer and slot projection
32
- */
33
- let scopeId;
34
- let hostTagName;
35
- let useNativeShadowDom = false;
36
- let isSvgMode = false;
37
- let renderingRef = null;
38
- let queuePending = false;
39
- const getAssetPath = (path) => {
40
- const assetUrl = new URL(path, plt.$resourcesUrl$);
41
- return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
42
- };
43
- const createTime = (fnName, tagName = '') => {
44
- {
45
- return () => {
46
- return;
47
- };
48
- }
49
- };
50
- const uniqueTime = (key, measureText) => {
51
- {
52
- return () => {
53
- return;
54
- };
55
- }
56
- };
57
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
58
- /**
59
- * Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
60
- *
61
- * Two cascading rules must be used instead of a `:not()` selector due to Stencil browser
62
- * support as of Stencil v4.
63
- */
64
- const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
65
- /**
66
- * Default style mode id
67
- */
68
- /**
69
- * Reusable empty obj/array
70
- * Don't add values to these!!
71
- */
72
- const EMPTY_OBJ = {};
73
- /**
74
- * Namespaces
75
- */
76
- const SVG_NS = 'http://www.w3.org/2000/svg';
77
- const HTML_NS = 'http://www.w3.org/1999/xhtml';
78
- const isDef = (v) => v != null;
79
- /**
80
- * Check whether a value is a 'complex type', defined here as an object or a
81
- * function.
82
- *
83
- * @param o the value to check
84
- * @returns whether it's a complex type or not
85
- */
86
- const isComplexType = (o) => {
87
- // https://jsperf.com/typeof-fn-object/5
88
- o = typeof o;
89
- return o === 'object' || o === 'function';
90
- };
91
- /**
92
- * Helper method for querying a `meta` tag that contains a nonce value
93
- * out of a DOM's head.
94
- *
95
- * @param doc The DOM containing the `head` to query against
96
- * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
97
- * exists or the tag has no content.
98
- */
99
- function queryNonceMetaTagContent(doc) {
100
- var _a, _b, _c;
101
- 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;
102
- }
103
- /**
104
- * Production h() function based on Preact by
105
- * Jason Miller (@developit)
106
- * Licensed under the MIT License
107
- * https://github.com/developit/preact/blob/master/LICENSE
108
- *
109
- * Modified for Stencil's compiler and vdom
110
- */
111
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
112
- // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
113
- const h = (nodeName, vnodeData, ...children) => {
114
- let child = null;
115
- let key = null;
116
- let simple = false;
117
- let lastSimple = false;
118
- const vNodeChildren = [];
119
- const walk = (c) => {
120
- for (let i = 0; i < c.length; i++) {
121
- child = c[i];
122
- if (Array.isArray(child)) {
123
- walk(child);
124
- }
125
- else if (child != null && typeof child !== 'boolean') {
126
- if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
127
- child = String(child);
128
- }
129
- if (simple && lastSimple) {
130
- // If the previous child was simple (string), we merge both
131
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
132
- }
133
- else {
134
- // Append a new vNode, if it's text, we create a text vNode
135
- vNodeChildren.push(simple ? newVNode(null, child) : child);
136
- }
137
- lastSimple = simple;
138
- }
139
- }
140
- };
141
- walk(children);
142
- if (vnodeData) {
143
- if (vnodeData.key) {
144
- key = vnodeData.key;
145
- }
146
- // normalize class / className attributes
147
- {
148
- const classData = vnodeData.className || vnodeData.class;
149
- if (classData) {
150
- vnodeData.class =
151
- typeof classData !== 'object'
152
- ? classData
153
- : Object.keys(classData)
154
- .filter((k) => classData[k])
155
- .join(' ');
156
- }
157
- }
158
- }
159
- if (typeof nodeName === 'function') {
160
- // nodeName is a functional component
161
- return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
162
- }
163
- const vnode = newVNode(nodeName, null);
164
- vnode.$attrs$ = vnodeData;
165
- if (vNodeChildren.length > 0) {
166
- vnode.$children$ = vNodeChildren;
167
- }
168
- {
169
- vnode.$key$ = key;
170
- }
171
- return vnode;
172
- };
173
- /**
174
- * A utility function for creating a virtual DOM node from a tag and some
175
- * possible text content.
176
- *
177
- * @param tag the tag for this element
178
- * @param text possible text content for the node
179
- * @returns a newly-minted virtual DOM node
180
- */
181
- const newVNode = (tag, text) => {
182
- const vnode = {
183
- $flags$: 0,
184
- $tag$: tag,
185
- $text$: text,
186
- $elm$: null,
187
- $children$: null,
188
- };
189
- {
190
- vnode.$attrs$ = null;
191
- }
192
- {
193
- vnode.$key$ = null;
194
- }
195
- return vnode;
196
- };
197
- const Host = {};
198
- /**
199
- * Check whether a given node is a Host node or not
200
- *
201
- * @param node the virtual DOM node to check
202
- * @returns whether it's a Host node or not
203
- */
204
- const isHost = (node) => node && node.$tag$ === Host;
205
- /**
206
- * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
207
- *
208
- * Note that these functions convert from {@link d.VNode} to
209
- * {@link d.ChildNode} to give functional component developers a friendly
210
- * interface.
211
- */
212
- const vdomFnUtils = {
213
- forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
214
- map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
215
- };
216
- /**
217
- * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
218
- * friendlier public interface (hence, 'convertToPublic').
219
- *
220
- * @param node the virtual DOM node to convert
221
- * @returns a converted child node
222
- */
223
- const convertToPublic = (node) => ({
224
- vattrs: node.$attrs$,
225
- vchildren: node.$children$,
226
- vkey: node.$key$,
227
- vname: node.$name$,
228
- vtag: node.$tag$,
229
- vtext: node.$text$,
230
- });
231
- /**
232
- * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
233
- * order to use the resulting object in the virtual DOM. The initial object was
234
- * likely created as part of presenting a public API, so converting it back
235
- * involved making it 'private' again (hence, `convertToPrivate`).
236
- *
237
- * @param node the child node to convert
238
- * @returns a converted virtual DOM node
239
- */
240
- const convertToPrivate = (node) => {
241
- if (typeof node.vtag === 'function') {
242
- const vnodeData = Object.assign({}, node.vattrs);
243
- if (node.vkey) {
244
- vnodeData.key = node.vkey;
245
- }
246
- if (node.vname) {
247
- vnodeData.name = node.vname;
248
- }
249
- return h(node.vtag, vnodeData, ...(node.vchildren || []));
250
- }
251
- const vnode = newVNode(node.vtag, node.vtext);
252
- vnode.$attrs$ = node.vattrs;
253
- vnode.$children$ = node.vchildren;
254
- vnode.$key$ = node.vkey;
255
- vnode.$name$ = node.vname;
256
- return vnode;
257
- };
258
- /**
259
- * Parse a new property value for a given property type.
260
- *
261
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
262
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
263
- * 1. `any`, the type given to `propValue` in the function signature
264
- * 2. the type stored from `propType`.
265
- *
266
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
267
- *
268
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
269
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
270
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
271
- * ```tsx
272
- * <my-cmp prop-val={0}></my-cmp>
273
- * ```
274
- *
275
- * HTML prop values on the other hand, will always a string
276
- *
277
- * @param propValue the new value to coerce to some type
278
- * @param propType the type of the prop, expressed as a binary number
279
- * @returns the parsed/coerced value
280
- */
281
- const parsePropertyValue = (propValue, propType) => {
282
- // ensure this value is of the correct prop type
283
- if (propValue != null && !isComplexType(propValue)) {
284
- if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
285
- // per the HTML spec, any string value means it is a boolean true value
286
- // but we'll cheat here and say that the string "false" is the boolean false
287
- return propValue === 'false' ? false : propValue === '' || !!propValue;
288
- }
289
- if (propType & 2 /* MEMBER_FLAGS.Number */) {
290
- // force it to be a number
291
- return parseFloat(propValue);
292
- }
293
- if (propType & 1 /* MEMBER_FLAGS.String */) {
294
- // could have been passed as a number or boolean
295
- // but we still want it as a string
296
- return String(propValue);
297
- }
298
- // redundant return here for better minification
299
- return propValue;
300
- }
301
- // not sure exactly what type we want
302
- // so no need to change to a different type
303
- return propValue;
304
- };
305
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
306
- const createEvent = (ref, name, flags) => {
307
- const elm = getElement(ref);
308
- return {
309
- emit: (detail) => {
310
- return emitEvent(elm, name, {
311
- bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
312
- composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
313
- cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
314
- detail,
315
- });
316
- },
317
- };
318
- };
319
- /**
320
- * Helper function to create & dispatch a custom Event on a provided target
321
- * @param elm the target of the Event
322
- * @param name the name to give the custom Event
323
- * @param opts options for configuring a custom Event
324
- * @returns the custom Event
325
- */
326
- const emitEvent = (elm, name, opts) => {
327
- const ev = plt.ce(name, opts);
328
- elm.dispatchEvent(ev);
329
- return ev;
330
- };
331
- const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
332
- const registerStyle = (scopeId, cssText, allowCS) => {
333
- let style = styles.get(scopeId);
334
- if (supportsConstructableStylesheets && allowCS) {
335
- style = (style || new CSSStyleSheet());
336
- if (typeof style === 'string') {
337
- style = cssText;
338
- }
339
- else {
340
- style.replaceSync(cssText);
341
- }
342
- }
343
- else {
344
- style = cssText;
345
- }
346
- styles.set(scopeId, style);
347
- };
348
- const addStyle = (styleContainerNode, cmpMeta, mode) => {
349
- var _a;
350
- const scopeId = getScopeId(cmpMeta);
351
- const style = styles.get(scopeId);
352
- // if an element is NOT connected then getRootNode() will return the wrong root node
353
- // so the fallback is to always use the document for the root node in those cases
354
- styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
355
- if (style) {
356
- if (typeof style === 'string') {
357
- styleContainerNode = styleContainerNode.head || styleContainerNode;
358
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
359
- let styleElm;
360
- if (!appliedStyles) {
361
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
362
- }
363
- if (!appliedStyles.has(scopeId)) {
364
- {
365
- styleElm = doc.createElement('style');
366
- styleElm.innerHTML = style;
367
- // Apply CSP nonce to the style tag if it exists
368
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
369
- if (nonce != null) {
370
- styleElm.setAttribute('nonce', nonce);
371
- }
372
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
373
- }
374
- // Add styles for `slot-fb` elements if we're using slots outside the Shadow DOM
375
- if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
376
- styleElm.innerHTML += SLOT_FB_CSS;
377
- }
378
- if (appliedStyles) {
379
- appliedStyles.add(scopeId);
380
- }
381
- }
382
- }
383
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
384
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
385
- }
386
- }
387
- return scopeId;
388
- };
389
- const attachStyles = (hostRef) => {
390
- const cmpMeta = hostRef.$cmpMeta$;
391
- const elm = hostRef.$hostElement$;
392
- const flags = cmpMeta.$flags$;
393
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
394
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
395
- if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
396
- // only required when we're NOT using native shadow dom (slot)
397
- // or this browser doesn't support native shadow dom
398
- // and this host element was NOT created with SSR
399
- // let's pick out the inner content for slot projection
400
- // create a node to represent where the original
401
- // content was first placed, which is useful later on
402
- // DOM WRITE!!
403
- elm['s-sc'] = scopeId;
404
- elm.classList.add(scopeId + '-h');
405
- if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
406
- elm.classList.add(scopeId + '-s');
407
- }
408
- }
409
- endAttachStyles();
410
- };
411
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
412
- /**
413
- * Production setAccessor() function based on Preact by
414
- * Jason Miller (@developit)
415
- * Licensed under the MIT License
416
- * https://github.com/developit/preact/blob/master/LICENSE
417
- *
418
- * Modified for Stencil's compiler and vdom
419
- */
420
- /**
421
- * When running a VDom render set properties present on a VDom node onto the
422
- * corresponding HTML element.
423
- *
424
- * Note that this function has special functionality for the `class`,
425
- * `style`, `key`, and `ref` attributes, as well as event handlers (like
426
- * `onClick`, etc). All others are just passed through as-is.
427
- *
428
- * @param elm the HTMLElement onto which attributes should be set
429
- * @param memberName the name of the attribute to set
430
- * @param oldValue the old value for the attribute
431
- * @param newValue the new value for the attribute
432
- * @param isSvg whether we're in an svg context or not
433
- * @param flags bitflags for Vdom variables
434
- */
435
- const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
436
- if (oldValue !== newValue) {
437
- let isProp = isMemberInElement(elm, memberName);
438
- let ln = memberName.toLowerCase();
439
- if (memberName === 'class') {
440
- const classList = elm.classList;
441
- const oldClasses = parseClassList(oldValue);
442
- const newClasses = parseClassList(newValue);
443
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
444
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
445
- }
446
- else if (memberName === 'style') {
447
- // update style attribute, css properties and values
448
- {
449
- for (const prop in oldValue) {
450
- if (!newValue || newValue[prop] == null) {
451
- if (prop.includes('-')) {
452
- elm.style.removeProperty(prop);
453
- }
454
- else {
455
- elm.style[prop] = '';
456
- }
457
- }
458
- }
459
- }
460
- for (const prop in newValue) {
461
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
462
- if (prop.includes('-')) {
463
- elm.style.setProperty(prop, newValue[prop]);
464
- }
465
- else {
466
- elm.style[prop] = newValue[prop];
467
- }
468
- }
469
- }
470
- }
471
- else if (memberName === 'key')
472
- ;
473
- else if (memberName === 'ref') {
474
- // minifier will clean this up
475
- if (newValue) {
476
- newValue(elm);
477
- }
478
- }
479
- else if ((!isProp ) &&
480
- memberName[0] === 'o' &&
481
- memberName[1] === 'n') {
482
- // Event Handlers
483
- // so if the member name starts with "on" and the 3rd characters is
484
- // a capital letter, and it's not already a member on the element,
485
- // then we're assuming it's an event listener
486
- if (memberName[2] === '-') {
487
- // on- prefixed events
488
- // allows to be explicit about the dom event to listen without any magic
489
- // under the hood:
490
- // <my-cmp on-click> // listens for "click"
491
- // <my-cmp on-Click> // listens for "Click"
492
- // <my-cmp on-ionChange> // listens for "ionChange"
493
- // <my-cmp on-EVENTS> // listens for "EVENTS"
494
- memberName = memberName.slice(3);
495
- }
496
- else if (isMemberInElement(win, ln)) {
497
- // standard event
498
- // the JSX attribute could have been "onMouseOver" and the
499
- // member name "onmouseover" is on the window's prototype
500
- // so let's add the listener "mouseover", which is all lowercased
501
- memberName = ln.slice(2);
502
- }
503
- else {
504
- // custom event
505
- // the JSX attribute could have been "onMyCustomEvent"
506
- // so let's trim off the "on" prefix and lowercase the first character
507
- // and add the listener "myCustomEvent"
508
- // except for the first character, we keep the event name case
509
- memberName = ln[2] + memberName.slice(3);
510
- }
511
- if (oldValue || newValue) {
512
- // Need to account for "capture" events.
513
- // If the event name ends with "Capture", we'll update the name to remove
514
- // the "Capture" suffix and make sure the event listener is setup to handle the capture event.
515
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
516
- // Make sure we only replace the last instance of "Capture"
517
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, '');
518
- if (oldValue) {
519
- plt.rel(elm, memberName, oldValue, capture);
520
- }
521
- if (newValue) {
522
- plt.ael(elm, memberName, newValue, capture);
523
- }
524
- }
525
- }
526
- else {
527
- // Set property if it exists and it's not a SVG
528
- const isComplex = isComplexType(newValue);
529
- if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
530
- try {
531
- if (!elm.tagName.includes('-')) {
532
- const n = newValue == null ? '' : newValue;
533
- // Workaround for Safari, moving the <input> caret when re-assigning the same valued
534
- if (memberName === 'list') {
535
- isProp = false;
536
- }
537
- else if (oldValue == null || elm[memberName] != n) {
538
- elm[memberName] = n;
539
- }
540
- }
541
- else {
542
- elm[memberName] = newValue;
543
- }
544
- }
545
- catch (e) {
546
- /**
547
- * in case someone tries to set a read-only property, e.g. "namespaceURI", we just ignore it
548
- */
549
- }
550
- }
551
- if (newValue == null || newValue === false) {
552
- if (newValue !== false || elm.getAttribute(memberName) === '') {
553
- {
554
- elm.removeAttribute(memberName);
555
- }
556
- }
557
- }
558
- else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
559
- newValue = newValue === true ? '' : newValue;
560
- {
561
- elm.setAttribute(memberName, newValue);
562
- }
563
- }
564
- }
565
- }
566
- };
567
- const parseClassListRegex = /\s/;
568
- /**
569
- * Parsed a string of classnames into an array
570
- * @param value className string, e.g. "foo bar baz"
571
- * @returns list of classes, e.g. ["foo", "bar", "baz"]
572
- */
573
- const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
574
- const CAPTURE_EVENT_SUFFIX = 'Capture';
575
- const CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + '$');
576
- const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
577
- // if the element passed in is a shadow root, which is a document fragment
578
- // then we want to be adding attrs/props to the shadow root's "host" element
579
- // if it's not a shadow root, then we add attrs/props to the same element
580
- const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
581
- ? newVnode.$elm$.host
582
- : newVnode.$elm$;
583
- const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
584
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
585
- {
586
- // remove attributes no longer present on the vnode by setting them to undefined
587
- for (memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
588
- if (!(memberName in newVnodeAttrs)) {
589
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
590
- }
591
- }
592
- }
593
- // add new & update changed attributes
594
- for (memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
595
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
596
- }
597
- };
598
- /**
599
- * Sort a list of attribute names to ensure that all the attribute names which
600
- * are _not_ `"ref"` come before `"ref"`. Preserve the order of the non-ref
601
- * attributes.
602
- *
603
- * **Note**: if the supplied attributes do not include `'ref'` then the same
604
- * (by reference) array will be returned without modification.
605
- *
606
- * @param attrNames attribute names to sort
607
- * @returns a list of attribute names, sorted if they include `"ref"`
608
- */
609
- function sortedAttrNames(attrNames) {
610
- return attrNames.includes('ref')
611
- ? // we need to sort these to ensure that `'ref'` is the last attr
612
- [...attrNames.filter((attr) => attr !== 'ref'), 'ref']
613
- : // no need to sort, return the original array
614
- attrNames;
615
- }
616
- /**
617
- * Create a DOM Node corresponding to one of the children of a given VNode.
618
- *
619
- * @param oldParentVNode the parent VNode from the previous render
620
- * @param newParentVNode the parent VNode from the current render
621
- * @param childIndex the index of the VNode, in the _new_ parent node's
622
- * children, for which we will create a new DOM node
623
- * @param parentElm the parent DOM node which our new node will be a child of
624
- * @returns the newly created node
625
- */
626
- const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
627
- // tslint:disable-next-line: prefer-const
628
- const newVNode = newParentVNode.$children$[childIndex];
629
- let i = 0;
630
- let elm;
631
- let childNode;
632
- if (newVNode.$text$ !== null) {
633
- // create text node
634
- elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
635
- }
636
- else {
637
- if (!isSvgMode) {
638
- isSvgMode = newVNode.$tag$ === 'svg';
639
- }
640
- // create element
641
- elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
642
- );
643
- if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
644
- isSvgMode = false;
645
- }
646
- // add css classes, attrs, props, listeners, etc.
647
- {
648
- updateElement(null, newVNode, isSvgMode);
649
- }
650
- if (isDef(scopeId) && elm['s-si'] !== scopeId) {
651
- // if there is a scopeId and this is the initial render
652
- // then let's add the scopeId as a css class
653
- elm.classList.add((elm['s-si'] = scopeId));
654
- }
655
- if (newVNode.$children$) {
656
- for (i = 0; i < newVNode.$children$.length; ++i) {
657
- // create the node
658
- childNode = createElm(oldParentVNode, newVNode, i);
659
- // return node could have been null
660
- if (childNode) {
661
- // append our new node
662
- elm.appendChild(childNode);
663
- }
664
- }
665
- }
666
- {
667
- if (newVNode.$tag$ === 'svg') {
668
- // Only reset the SVG context when we're exiting <svg> element
669
- isSvgMode = false;
670
- }
671
- else if (elm.tagName === 'foreignObject') {
672
- // Reenter SVG context when we're exiting <foreignObject> element
673
- isSvgMode = true;
674
- }
675
- }
676
- }
677
- // This needs to always happen so we can hide nodes that are projected
678
- // to another component but don't end up in a slot
679
- elm['s-hn'] = hostTagName;
680
- return elm;
681
- };
682
- /**
683
- * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
684
- * add them to the DOM in the appropriate place.
685
- *
686
- * @param parentElm the DOM node which should be used as a parent for the new
687
- * DOM nodes
688
- * @param before a child of the `parentElm` which the new children should be
689
- * inserted before (optional)
690
- * @param parentVNode the parent virtual DOM node
691
- * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
692
- * @param startIdx the index in the child virtual DOM nodes at which to start
693
- * creating DOM nodes (inclusive)
694
- * @param endIdx the index in the child virtual DOM nodes at which to stop
695
- * creating DOM nodes (inclusive)
696
- */
697
- const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
698
- let containerElm = (parentElm);
699
- let childNode;
700
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
701
- containerElm = containerElm.shadowRoot;
702
- }
703
- for (; startIdx <= endIdx; ++startIdx) {
704
- if (vnodes[startIdx]) {
705
- childNode = createElm(null, parentVNode, startIdx);
706
- if (childNode) {
707
- vnodes[startIdx].$elm$ = childNode;
708
- containerElm.insertBefore(childNode, before);
709
- }
710
- }
711
- }
712
- };
713
- /**
714
- * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
715
- * This can be used to, for instance, clean up after a list of children which
716
- * should no longer be shown.
717
- *
718
- * This function also handles some of Stencil's slot relocation logic.
719
- *
720
- * @param vnodes a list of virtual DOM nodes to remove
721
- * @param startIdx the index at which to start removing nodes (inclusive)
722
- * @param endIdx the index at which to stop removing nodes (inclusive)
723
- */
724
- const removeVnodes = (vnodes, startIdx, endIdx) => {
725
- for (let index = startIdx; index <= endIdx; ++index) {
726
- const vnode = vnodes[index];
727
- if (vnode) {
728
- const elm = vnode.$elm$;
729
- nullifyVNodeRefs(vnode);
730
- if (elm) {
731
- // remove the vnode's element from the dom
732
- elm.remove();
733
- }
734
- }
735
- }
736
- };
737
- /**
738
- * Reconcile the children of a new VNode with the children of an old VNode by
739
- * traversing the two collections of children, identifying nodes that are
740
- * conserved or changed, calling out to `patch` to make any necessary
741
- * updates to the DOM, and rearranging DOM nodes as needed.
742
- *
743
- * The algorithm for reconciling children works by analyzing two 'windows' onto
744
- * the two arrays of children (`oldCh` and `newCh`). We keep track of the
745
- * 'windows' by storing start and end indices and references to the
746
- * corresponding array entries. Initially the two 'windows' are basically equal
747
- * to the entire array, but we progressively narrow the windows until there are
748
- * no children left to update by doing the following:
749
- *
750
- * 1. Skip any `null` entries at the beginning or end of the two arrays, so
751
- * that if we have an initial array like the following we'll end up dealing
752
- * only with a window bounded by the highlighted elements:
753
- *
754
- * [null, null, VNode1 , ... , VNode2, null, null]
755
- * ^^^^^^ ^^^^^^
756
- *
757
- * 2. Check to see if the elements at the head and tail positions are equal
758
- * across the windows. This will basically detect elements which haven't
759
- * been added, removed, or changed position, i.e. if you had the following
760
- * VNode elements (represented as HTML):
761
- *
762
- * oldVNode: `<div><p><span>HEY</span></p></div>`
763
- * newVNode: `<div><p><span>THERE</span></p></div>`
764
- *
765
- * Then when comparing the children of the `<div>` tag we check the equality
766
- * of the VNodes corresponding to the `<p>` tags and, since they are the
767
- * same tag in the same position, we'd be able to avoid completely
768
- * re-rendering the subtree under them with a new DOM element and would just
769
- * call out to `patch` to handle reconciling their children and so on.
770
- *
771
- * 3. Check, for both windows, to see if the element at the beginning of the
772
- * window corresponds to the element at the end of the other window. This is
773
- * a heuristic which will let us identify _some_ situations in which
774
- * elements have changed position, for instance it _should_ detect that the
775
- * children nodes themselves have not changed but merely moved in the
776
- * following example:
777
- *
778
- * oldVNode: `<div><element-one /><element-two /></div>`
779
- * newVNode: `<div><element-two /><element-one /></div>`
780
- *
781
- * If we find cases like this then we also need to move the concrete DOM
782
- * elements corresponding to the moved children to write the re-order to the
783
- * DOM.
784
- *
785
- * 4. Finally, if VNodes have the `key` attribute set on them we check for any
786
- * nodes in the old children which have the same key as the first element in
787
- * our window on the new children. If we find such a node we handle calling
788
- * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
789
- * what we find.
790
- *
791
- * Finally, once we've narrowed our 'windows' to the point that either of them
792
- * collapse (i.e. they have length 0) we then handle any remaining VNode
793
- * insertion or deletion that needs to happen to get a DOM state that correctly
794
- * reflects the new child VNodes. If, for instance, after our window on the old
795
- * children has collapsed we still have more nodes on the new children that
796
- * we haven't dealt with yet then we need to add them, or if the new children
797
- * collapse but we still have unhandled _old_ children then we need to make
798
- * sure the corresponding DOM nodes are removed.
799
- *
800
- * @param parentElm the node into which the parent VNode is rendered
801
- * @param oldCh the old children of the parent node
802
- * @param newVNode the new VNode which will replace the parent
803
- * @param newCh the new children of the parent node
804
- * @param isInitialRender whether or not this is the first render of the vdom
805
- */
806
- const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = false) => {
807
- let oldStartIdx = 0;
808
- let newStartIdx = 0;
809
- let idxInOld = 0;
810
- let i = 0;
811
- let oldEndIdx = oldCh.length - 1;
812
- let oldStartVnode = oldCh[0];
813
- let oldEndVnode = oldCh[oldEndIdx];
814
- let newEndIdx = newCh.length - 1;
815
- let newStartVnode = newCh[0];
816
- let newEndVnode = newCh[newEndIdx];
817
- let node;
818
- let elmToMove;
819
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
820
- if (oldStartVnode == null) {
821
- // VNode might have been moved left
822
- oldStartVnode = oldCh[++oldStartIdx];
823
- }
824
- else if (oldEndVnode == null) {
825
- oldEndVnode = oldCh[--oldEndIdx];
826
- }
827
- else if (newStartVnode == null) {
828
- newStartVnode = newCh[++newStartIdx];
829
- }
830
- else if (newEndVnode == null) {
831
- newEndVnode = newCh[--newEndIdx];
832
- }
833
- else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
834
- // if the start nodes are the same then we should patch the new VNode
835
- // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
836
- // indices to reflect that. We don't need to move any DOM Nodes around
837
- // since things are matched up in order.
838
- patch(oldStartVnode, newStartVnode, isInitialRender);
839
- oldStartVnode = oldCh[++oldStartIdx];
840
- newStartVnode = newCh[++newStartIdx];
841
- }
842
- else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
843
- // likewise, if the end nodes are the same we patch new onto old and
844
- // decrement our end indices, and also likewise in this case we don't
845
- // need to move any DOM Nodes.
846
- patch(oldEndVnode, newEndVnode, isInitialRender);
847
- oldEndVnode = oldCh[--oldEndIdx];
848
- newEndVnode = newCh[--newEndIdx];
849
- }
850
- else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
851
- patch(oldStartVnode, newEndVnode, isInitialRender);
852
- // We need to move the element for `oldStartVnode` into a position which
853
- // will be appropriate for `newEndVnode`. For this we can use
854
- // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
855
- // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
856
- // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
857
- //
858
- // <old-start-node />
859
- // <some-intervening-node />
860
- // <old-end-node />
861
- // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
862
- // <next-sibling />
863
- //
864
- // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
865
- // the node for `oldStartVnode` at the end of the children of
866
- // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
867
- // aren't any siblings, and passing `null` to `Node.insertBefore` will
868
- // append it to the children of the parent element.
869
- parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
870
- oldStartVnode = oldCh[++oldStartIdx];
871
- newEndVnode = newCh[--newEndIdx];
872
- }
873
- else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
874
- patch(oldEndVnode, newStartVnode, isInitialRender);
875
- // We've already checked above if `oldStartVnode` and `newStartVnode` are
876
- // the same node, so since we're here we know that they are not. Thus we
877
- // can move the element for `oldEndVnode` _before_ the element for
878
- // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
879
- // future.
880
- parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
881
- oldEndVnode = oldCh[--oldEndIdx];
882
- newStartVnode = newCh[++newStartIdx];
883
- }
884
- else {
885
- // Here we do some checks to match up old and new nodes based on the
886
- // `$key$` attribute, which is set by putting a `key="my-key"` attribute
887
- // in the JSX for a DOM element in the implementation of a Stencil
888
- // component.
889
- //
890
- // First we check to see if there are any nodes in the array of old
891
- // children which have the same key as the first node in the new
892
- // children.
893
- idxInOld = -1;
894
- {
895
- for (i = oldStartIdx; i <= oldEndIdx; ++i) {
896
- if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
897
- idxInOld = i;
898
- break;
899
- }
900
- }
901
- }
902
- if (idxInOld >= 0) {
903
- // We found a node in the old children which matches up with the first
904
- // node in the new children! So let's deal with that
905
- elmToMove = oldCh[idxInOld];
906
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
907
- // the tag doesn't match so we'll need a new DOM element
908
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
909
- }
910
- else {
911
- patch(elmToMove, newStartVnode, isInitialRender);
912
- // invalidate the matching old node so that we won't try to update it
913
- // again later on
914
- oldCh[idxInOld] = undefined;
915
- node = elmToMove.$elm$;
916
- }
917
- newStartVnode = newCh[++newStartIdx];
918
- }
919
- else {
920
- // We either didn't find an element in the old children that matches
921
- // the key of the first new child OR the build is not using `key`
922
- // attributes at all. In either case we need to create a new element
923
- // for the new node.
924
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
925
- newStartVnode = newCh[++newStartIdx];
926
- }
927
- if (node) {
928
- // if we created a new node then handle inserting it to the DOM
929
- {
930
- oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
931
- }
932
- }
933
- }
934
- }
935
- if (oldStartIdx > oldEndIdx) {
936
- // we have some more new nodes to add which don't match up with old nodes
937
- addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
938
- }
939
- else if (newStartIdx > newEndIdx) {
940
- // there are nodes in the `oldCh` array which no longer correspond to nodes
941
- // in the new array, so lets remove them (which entails cleaning up the
942
- // relevant DOM nodes)
943
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
944
- }
945
- };
946
- /**
947
- * Compare two VNodes to determine if they are the same
948
- *
949
- * **NB**: This function is an equality _heuristic_ based on the available
950
- * information set on the two VNodes and can be misleading under certain
951
- * circumstances. In particular, if the two nodes do not have `key` attrs
952
- * (available under `$key$` on VNodes) then the function falls back on merely
953
- * checking that they have the same tag.
954
- *
955
- * So, in other words, if `key` attrs are not set on VNodes which may be
956
- * changing order within a `children` array or something along those lines then
957
- * we could obtain a false negative and then have to do needless re-rendering
958
- * (i.e. we'd say two VNodes aren't equal when in fact they should be).
959
- *
960
- * @param leftVNode the first VNode to check
961
- * @param rightVNode the second VNode to check
962
- * @param isInitialRender whether or not this is the first render of the vdom
963
- * @returns whether they're equal or not
964
- */
965
- const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
966
- // compare if two vnode to see if they're "technically" the same
967
- // need to have the same element tag, and same key to be the same
968
- if (leftVNode.$tag$ === rightVNode.$tag$) {
969
- // this will be set if JSX tags in the build have `key` attrs set on them
970
- // we only want to check this if we're not on the first render since on
971
- // first render `leftVNode.$key$` will always be `null`, so we can be led
972
- // astray and, for instance, accidentally delete a DOM node that we want to
973
- // keep around.
974
- if (!isInitialRender) {
975
- return leftVNode.$key$ === rightVNode.$key$;
976
- }
977
- return true;
978
- }
979
- return false;
980
- };
981
- /**
982
- * Handle reconciling an outdated VNode with a new one which corresponds to
983
- * it. This function handles flushing updates to the DOM and reconciling the
984
- * children of the two nodes (if any).
985
- *
986
- * @param oldVNode an old VNode whose DOM element and children we want to update
987
- * @param newVNode a new VNode representing an updated version of the old one
988
- * @param isInitialRender whether or not this is the first render of the vdom
989
- */
990
- const patch = (oldVNode, newVNode, isInitialRender = false) => {
991
- const elm = (newVNode.$elm$ = oldVNode.$elm$);
992
- const oldChildren = oldVNode.$children$;
993
- const newChildren = newVNode.$children$;
994
- const tag = newVNode.$tag$;
995
- const text = newVNode.$text$;
996
- if (text === null) {
997
- {
998
- // test if we're rendering an svg element, or still rendering nodes inside of one
999
- // only add this to the when the compiler sees we're using an svg somewhere
1000
- isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
1001
- }
1002
- {
1003
- if (tag === 'slot' && !useNativeShadowDom) ;
1004
- else {
1005
- // either this is the first render of an element OR it's an update
1006
- // AND we already know it's possible it could have changed
1007
- // this updates the element's css classes, attrs, props, listeners, etc.
1008
- updateElement(oldVNode, newVNode, isSvgMode);
1009
- }
1010
- }
1011
- if (oldChildren !== null && newChildren !== null) {
1012
- // looks like there's child vnodes for both the old and new vnodes
1013
- // so we need to call `updateChildren` to reconcile them
1014
- updateChildren(elm, oldChildren, newVNode, newChildren, isInitialRender);
1015
- }
1016
- else if (newChildren !== null) {
1017
- // no old child vnodes, but there are new child vnodes to add
1018
- if (oldVNode.$text$ !== null) {
1019
- // the old vnode was text, so be sure to clear it out
1020
- elm.textContent = '';
1021
- }
1022
- // add the new vnode children
1023
- addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
1024
- }
1025
- else if (oldChildren !== null) {
1026
- // no new child vnodes, but there are old child vnodes to remove
1027
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
1028
- }
1029
- if (isSvgMode && tag === 'svg') {
1030
- isSvgMode = false;
1031
- }
1032
- }
1033
- else if (oldVNode.$text$ !== text) {
1034
- // update the text content for the text only vnode
1035
- // and also only if the text is different than before
1036
- elm.data = text;
1037
- }
1038
- };
1039
- /**
1040
- * 'Nullify' any VDom `ref` callbacks on a VDom node or its children by calling
1041
- * them with `null`. This signals that the DOM element corresponding to the VDom
1042
- * node has been removed from the DOM.
1043
- *
1044
- * @param vNode a virtual DOM node
1045
- */
1046
- const nullifyVNodeRefs = (vNode) => {
1047
- {
1048
- vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1049
- vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1050
- }
1051
- };
1052
- /**
1053
- * The main entry point for Stencil's virtual DOM-based rendering engine
1054
- *
1055
- * Given a {@link d.HostRef} container and some virtual DOM nodes, this
1056
- * function will handle creating a virtual DOM tree with a single root, patching
1057
- * the current virtual DOM tree onto an old one (if any), dealing with slot
1058
- * relocation, and reflecting attributes.
1059
- *
1060
- * @param hostRef data needed to root and render the virtual DOM tree, such as
1061
- * the DOM node into which it should be rendered.
1062
- * @param renderFnResults the virtual DOM nodes to be rendered
1063
- * @param isInitialLoad whether or not this is the first call after page load
1064
- */
1065
- const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1066
- const hostElm = hostRef.$hostElement$;
1067
- const cmpMeta = hostRef.$cmpMeta$;
1068
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1069
- // if `renderFnResults` is a Host node then we can use it directly. If not,
1070
- // we need to call `h` again to wrap the children of our component in a
1071
- // 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
1072
- // implicitly that the top-level vdom node is 1) an only child and 2)
1073
- // contains attrs that need to be set on the host element.
1074
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1075
- hostTagName = hostElm.tagName;
1076
- // On the first render and *only* on the first render we want to check for
1077
- // any attributes set on the host element which are also set on the vdom
1078
- // node. If we find them, we override the value on the VDom node attrs with
1079
- // the value from the host element, which allows developers building apps
1080
- // with Stencil components to override e.g. the `role` attribute on a
1081
- // component even if it's already set on the `Host`.
1082
- if (isInitialLoad && rootVnode.$attrs$) {
1083
- for (const key of Object.keys(rootVnode.$attrs$)) {
1084
- // We have a special implementation in `setAccessor` for `style` and
1085
- // `class` which reconciles values coming from the VDom with values
1086
- // already present on the DOM element, so we don't want to override those
1087
- // attributes on the VDom tree with values from the host element if they
1088
- // are present.
1089
- //
1090
- // Likewise, `ref` and `key` are special internal values for the Stencil
1091
- // runtime and we don't want to override those either.
1092
- if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
1093
- rootVnode.$attrs$[key] = hostElm[key];
1094
- }
1095
- }
1096
- }
1097
- rootVnode.$tag$ = null;
1098
- rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
1099
- hostRef.$vnode$ = rootVnode;
1100
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
1101
- {
1102
- scopeId = hostElm['s-sc'];
1103
- }
1104
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
1105
- // synchronous patch
1106
- patch(oldVNode, rootVnode, isInitialLoad);
1107
- };
1108
- const attachToAncestor = (hostRef, ancestorComponent) => {
1109
- if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1110
- ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
1111
- }
1112
- };
1113
- const scheduleUpdate = (hostRef, isInitialLoad) => {
1114
- {
1115
- hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1116
- }
1117
- if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1118
- hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1119
- return;
1120
- }
1121
- attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1122
- // there is no ancestor component or the ancestor component
1123
- // has already fired off its lifecycle update then
1124
- // fire off the initial update
1125
- const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1126
- return writeTask(dispatch) ;
1127
- };
1128
- /**
1129
- * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
1130
- * component lifecycle methods like `componentWillLoad` as well as
1131
- * {@link updateComponent}, which will kick off the virtual DOM re-render.
1132
- *
1133
- * @param hostRef a reference to a host DOM node
1134
- * @param isInitialLoad whether we're on the initial load or not
1135
- * @returns an empty Promise which is used to enqueue a series of operations for
1136
- * the component
1137
- */
1138
- const dispatchHooks = (hostRef, isInitialLoad) => {
1139
- const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1140
- const instance = hostRef.$lazyInstance$ ;
1141
- // We're going to use this variable together with `enqueue` to implement a
1142
- // little promise-based queue. We start out with it `undefined`. When we add
1143
- // the first function to the queue we'll set this variable to be that
1144
- // function's return value. When we attempt to add subsequent values to the
1145
- // queue we'll check that value and, if it was a `Promise`, we'll then chain
1146
- // the new function off of that `Promise` using `.then()`. This will give our
1147
- // queue two nice properties:
1148
- //
1149
- // 1. If all functions added to the queue are synchronous they'll be called
1150
- // synchronously right away.
1151
- // 2. If all functions added to the queue are asynchronous they'll all be
1152
- // called in order after `dispatchHooks` exits.
1153
- let maybePromise;
1154
- if (isInitialLoad) {
1155
- {
1156
- hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1157
- if (hostRef.$queuedListeners$) {
1158
- hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1159
- hostRef.$queuedListeners$ = undefined;
1160
- }
1161
- }
1162
- {
1163
- // If `componentWillLoad` returns a `Promise` then we want to wait on
1164
- // whatever's going on in that `Promise` before we launch into
1165
- // rendering the component, doing other lifecycle stuff, etc. So
1166
- // in that case we assign the returned promise to the variable we
1167
- // declared above to hold a possible 'queueing' Promise
1168
- maybePromise = safeCall(instance, 'componentWillLoad');
1169
- }
1170
- }
1171
- endSchedule();
1172
- return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1173
- };
1174
- /**
1175
- * This function uses a Promise to implement a simple first-in, first-out queue
1176
- * of functions to be called.
1177
- *
1178
- * The queue is ordered on the basis of the first argument. If it's
1179
- * `undefined`, then nothing is on the queue yet, so the provided function can
1180
- * be called synchronously (although note that this function may return a
1181
- * `Promise`). The idea is that then the return value of that enqueueing
1182
- * operation is kept around, so that if it was a `Promise` then subsequent
1183
- * functions can be enqueued by calling this function again with that `Promise`
1184
- * as the first argument.
1185
- *
1186
- * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
1187
- * @param fn a function to enqueue
1188
- * @returns either a `Promise` or the return value of the provided function
1189
- */
1190
- const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
1191
- /**
1192
- * Check that a value is a `Promise`. To check, we first see if the value is an
1193
- * instance of the `Promise` global. In a few circumstances, in particular if
1194
- * the global has been overwritten, this is could be misleading, so we also do
1195
- * a little 'duck typing' check to see if the `.then` property of the value is
1196
- * defined and a function.
1197
- *
1198
- * @param maybePromise it might be a promise!
1199
- * @returns whether it is or not
1200
- */
1201
- const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
1202
- (maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
1203
- /**
1204
- * Update a component given reference to its host elements and so on.
1205
- *
1206
- * @param hostRef an object containing references to the element's host node,
1207
- * VDom nodes, and other metadata
1208
- * @param instance a reference to the underlying host element where it will be
1209
- * rendered
1210
- * @param isInitialLoad whether or not this function is being called as part of
1211
- * the first render cycle
1212
- */
1213
- const updateComponent = async (hostRef, instance, isInitialLoad) => {
1214
- var _a;
1215
- const elm = hostRef.$hostElement$;
1216
- const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1217
- const rc = elm['s-rc'];
1218
- if (isInitialLoad) {
1219
- // DOM WRITE!
1220
- attachStyles(hostRef);
1221
- }
1222
- const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1223
- {
1224
- callRender(hostRef, instance, elm, isInitialLoad);
1225
- }
1226
- if (rc) {
1227
- // ok, so turns out there are some child host elements
1228
- // waiting on this parent element to load
1229
- // let's fire off all update callbacks waiting
1230
- rc.map((cb) => cb());
1231
- elm['s-rc'] = undefined;
1232
- }
1233
- endRender();
1234
- endUpdate();
1235
- {
1236
- const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
1237
- const postUpdate = () => postUpdateComponent(hostRef);
1238
- if (childrenPromises.length === 0) {
1239
- postUpdate();
1240
- }
1241
- else {
1242
- Promise.all(childrenPromises).then(postUpdate);
1243
- hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1244
- childrenPromises.length = 0;
1245
- }
1246
- }
1247
- };
1248
- /**
1249
- * Handle making the call to the VDom renderer with the proper context given
1250
- * various build variables
1251
- *
1252
- * @param hostRef an object containing references to the element's host node,
1253
- * VDom nodes, and other metadata
1254
- * @param instance a reference to the underlying host element where it will be
1255
- * rendered
1256
- * @param elm the Host element for the component
1257
- * @param isInitialLoad whether or not this function is being called as part of
1258
- * @returns an empty promise
1259
- */
1260
- const callRender = (hostRef, instance, elm, isInitialLoad) => {
1261
- try {
1262
- renderingRef = instance;
1263
- /**
1264
- * minification optimization: `allRenderFn` is `true` if all components have a `render`
1265
- * method, so we can call the method immediately. If not, check before calling it.
1266
- */
1267
- instance = instance.render() ;
1268
- {
1269
- hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1270
- }
1271
- {
1272
- hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1273
- }
1274
- {
1275
- {
1276
- // looks like we've got child nodes to render into this host element
1277
- // or we need to update the css class/attrs on the host element
1278
- // DOM WRITE!
1279
- {
1280
- renderVdom(hostRef, instance, isInitialLoad);
1281
- }
1282
- }
1283
- }
1284
- }
1285
- catch (e) {
1286
- consoleError(e, hostRef.$hostElement$);
1287
- }
1288
- renderingRef = null;
1289
- return null;
1290
- };
1291
- const getRenderingRef = () => renderingRef;
1292
- const postUpdateComponent = (hostRef) => {
1293
- const tagName = hostRef.$cmpMeta$.$tagName$;
1294
- const elm = hostRef.$hostElement$;
1295
- const endPostUpdate = createTime('postUpdate', tagName);
1296
- const instance = hostRef.$lazyInstance$ ;
1297
- const ancestorComponent = hostRef.$ancestorComponent$;
1298
- {
1299
- safeCall(instance, 'componentDidRender');
1300
- }
1301
- if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1302
- hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1303
- {
1304
- // DOM WRITE!
1305
- addHydratedFlag(elm);
1306
- }
1307
- {
1308
- safeCall(instance, 'componentDidLoad');
1309
- }
1310
- endPostUpdate();
1311
- {
1312
- hostRef.$onReadyResolve$(elm);
1313
- if (!ancestorComponent) {
1314
- appDidLoad();
1315
- }
1316
- }
1317
- }
1318
- else {
1319
- endPostUpdate();
1320
- }
1321
- {
1322
- hostRef.$onInstanceResolve$(elm);
1323
- }
1324
- // load events fire from bottom to top
1325
- // the deepest elements load first then bubbles up
1326
- {
1327
- if (hostRef.$onRenderResolve$) {
1328
- hostRef.$onRenderResolve$();
1329
- hostRef.$onRenderResolve$ = undefined;
1330
- }
1331
- if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1332
- nextTick(() => scheduleUpdate(hostRef, false));
1333
- }
1334
- hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1335
- }
1336
- // ( •_•)
1337
- // ( •_•)>⌐■-■
1338
- // (⌐■_■)
1339
- };
1340
- const forceUpdate = (ref) => {
1341
- {
1342
- const hostRef = getHostRef(ref);
1343
- const isConnected = hostRef.$hostElement$.isConnected;
1344
- if (isConnected &&
1345
- (hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1346
- scheduleUpdate(hostRef, false);
1347
- }
1348
- // Returns "true" when the forced update was successfully scheduled
1349
- return isConnected;
1350
- }
1351
- };
1352
- const appDidLoad = (who) => {
1353
- // on appload
1354
- // we have finish the first big initial render
1355
- {
1356
- addHydratedFlag(doc.documentElement);
1357
- }
1358
- nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1359
- };
1360
- /**
1361
- * Allows to safely call a method, e.g. `componentDidLoad`, on an instance,
1362
- * e.g. custom element node. If a build figures out that e.g. no component
1363
- * has a `componentDidLoad` method, the instance method gets removed from the
1364
- * output bundle and this function returns `undefined`.
1365
- * @param instance any object that may or may not contain methods
1366
- * @param method method name
1367
- * @param arg single arbitrary argument
1368
- * @returns result of method call if it exists, otherwise `undefined`
1369
- */
1370
- const safeCall = (instance, method, arg) => {
1371
- if (instance && instance[method]) {
1372
- try {
1373
- return instance[method](arg);
1374
- }
1375
- catch (e) {
1376
- consoleError(e);
1377
- }
1378
- }
1379
- return undefined;
1380
- };
1381
- const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1382
- ;
1383
- const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1384
- const setValue = (ref, propName, newVal, cmpMeta) => {
1385
- // check our new property value against our internal value
1386
- const hostRef = getHostRef(ref);
1387
- const elm = hostRef.$hostElement$ ;
1388
- const oldVal = hostRef.$instanceValues$.get(propName);
1389
- const flags = hostRef.$flags$;
1390
- const instance = hostRef.$lazyInstance$ ;
1391
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1392
- // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1393
- const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1394
- const didValueChange = newVal !== oldVal && !areBothNaN;
1395
- if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1396
- // gadzooks! the property's value has changed!!
1397
- // set our new value!
1398
- hostRef.$instanceValues$.set(propName, newVal);
1399
- if (instance) {
1400
- // get an array of method names of watch functions to call
1401
- if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1402
- const watchMethods = cmpMeta.$watchers$[propName];
1403
- if (watchMethods) {
1404
- // this instance is watching for when this property changed
1405
- watchMethods.map((watchMethodName) => {
1406
- try {
1407
- // fire off each of the watch methods that are watching this property
1408
- instance[watchMethodName](newVal, oldVal, propName);
1409
- }
1410
- catch (e) {
1411
- consoleError(e, elm);
1412
- }
1413
- });
1414
- }
1415
- }
1416
- if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1417
- // looks like this value actually changed, so we've got work to do!
1418
- // but only if we've already rendered, otherwise just chill out
1419
- // queue that we need to do an update, but don't worry about queuing
1420
- // up millions cuz this function ensures it only runs once
1421
- scheduleUpdate(hostRef, false);
1422
- }
1423
- }
1424
- }
1425
- };
1426
- /**
1427
- * Attach a series of runtime constructs to a compiled Stencil component
1428
- * constructor, including getters and setters for the `@Prop` and `@State`
1429
- * decorators, callbacks for when attributes change, and so on.
1430
- *
1431
- * @param Cstr the constructor for a component that we need to process
1432
- * @param cmpMeta metadata collected previously about the component
1433
- * @param flags a number used to store a series of bit flags
1434
- * @returns a reference to the same constructor passed in (but now mutated)
1435
- */
1436
- const proxyComponent = (Cstr, cmpMeta, flags) => {
1437
- var _a;
1438
- const prototype = Cstr.prototype;
1439
- if (cmpMeta.$members$) {
1440
- if (Cstr.watchers) {
1441
- cmpMeta.$watchers$ = Cstr.watchers;
1442
- }
1443
- // It's better to have a const than two Object.entries()
1444
- const members = Object.entries(cmpMeta.$members$);
1445
- members.map(([memberName, [memberFlags]]) => {
1446
- if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1447
- ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1448
- // proxyComponent - prop
1449
- Object.defineProperty(prototype, memberName, {
1450
- get() {
1451
- // proxyComponent, get value
1452
- return getValue(this, memberName);
1453
- },
1454
- set(newValue) {
1455
- // proxyComponent, set value
1456
- setValue(this, memberName, newValue, cmpMeta);
1457
- },
1458
- configurable: true,
1459
- enumerable: true,
1460
- });
1461
- }
1462
- else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1463
- memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1464
- // proxyComponent - method
1465
- Object.defineProperty(prototype, memberName, {
1466
- value(...args) {
1467
- var _a;
1468
- const ref = getHostRef(this);
1469
- return (_a = ref === null || ref === void 0 ? void 0 : ref.$onInstancePromise$) === null || _a === void 0 ? void 0 : _a.then(() => { var _a; return (_a = ref.$lazyInstance$) === null || _a === void 0 ? void 0 : _a[memberName](...args); });
1470
- },
1471
- });
1472
- }
1473
- });
1474
- if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1475
- const attrNameToPropName = new Map();
1476
- prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
1477
- plt.jmp(() => {
1478
- var _a;
1479
- const propName = attrNameToPropName.get(attrName);
1480
- // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1481
- // in the case where an attribute was set inline.
1482
- // ```html
1483
- // <my-component some-attribute="some-value"></my-component>
1484
- // ```
1485
- //
1486
- // There is an edge case where a developer sets the attribute inline on a custom element and then
1487
- // programmatically changes it before it has been upgraded as shown below:
1488
- //
1489
- // ```html
1490
- // <!-- this component has _not_ been upgraded yet -->
1491
- // <my-component id="test" some-attribute="some-value"></my-component>
1492
- // <script>
1493
- // // grab non-upgraded component
1494
- // el = document.querySelector("#test");
1495
- // el.someAttribute = "another-value";
1496
- // // upgrade component
1497
- // customElements.define('my-component', MyComponent);
1498
- // </script>
1499
- // ```
1500
- // In this case if we do not un-shadow here and use the value of the shadowing property, attributeChangedCallback
1501
- // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1502
- // to the value that was set inline i.e. "some-value" from above example. When
1503
- // the connectedCallback attempts to un-shadow it will use "some-value" as the initial value rather than "another-value"
1504
- //
1505
- // The case where the attribute was NOT set inline but was not set programmatically shall be handled/un-shadowed
1506
- // by connectedCallback as this attributeChangedCallback will not fire.
1507
- //
1508
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1509
- //
1510
- // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1511
- // properties here given that this goes against best practices outlined here
1512
- // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1513
- if (this.hasOwnProperty(propName)) {
1514
- newValue = this[propName];
1515
- delete this[propName];
1516
- }
1517
- else if (prototype.hasOwnProperty(propName) &&
1518
- typeof this[propName] === 'number' &&
1519
- this[propName] == newValue) {
1520
- // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1521
- // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1522
- // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1523
- return;
1524
- }
1525
- else if (propName == null) {
1526
- // At this point we should know this is not a "member", so we can treat it like watching an attribute
1527
- // on a vanilla web component
1528
- const hostRef = getHostRef(this);
1529
- const flags = hostRef === null || hostRef === void 0 ? void 0 : hostRef.$flags$;
1530
- // We only want to trigger the callback(s) if:
1531
- // 1. The instance is ready
1532
- // 2. The watchers are ready
1533
- // 3. The value has changed
1534
- if (flags &&
1535
- !(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
1536
- flags & 128 /* HOST_FLAGS.isWatchReady */ &&
1537
- newValue !== oldValue) {
1538
- const instance = hostRef.$lazyInstance$ ;
1539
- const entry = (_a = cmpMeta.$watchers$) === null || _a === void 0 ? void 0 : _a[attrName];
1540
- entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
1541
- if (instance[callbackName] != null) {
1542
- instance[callbackName].call(instance, newValue, oldValue, attrName);
1543
- }
1544
- });
1545
- }
1546
- return;
1547
- }
1548
- this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1549
- });
1550
- };
1551
- // Create an array of attributes to observe
1552
- // This list in comprised of all strings used within a `@Watch()` decorator
1553
- // on a component as well as any Stencil-specific "members" (`@Prop()`s and `@State()`s).
1554
- // As such, there is no way to guarantee type-safety here that a user hasn't entered
1555
- // an invalid attribute.
1556
- Cstr.observedAttributes = Array.from(new Set([
1557
- ...Object.keys((_a = cmpMeta.$watchers$) !== null && _a !== void 0 ? _a : {}),
1558
- ...members
1559
- .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */)
1560
- .map(([propName, m]) => {
1561
- const attrName = m[1] || propName;
1562
- attrNameToPropName.set(attrName, propName);
1563
- return attrName;
1564
- }),
1565
- ]));
1566
- }
1567
- }
1568
- return Cstr;
1569
- };
1570
- /**
1571
- * Initialize a Stencil component given a reference to its host element, its
1572
- * runtime bookkeeping data structure, runtime metadata about the component,
1573
- * and (optionally) an HMR version ID.
1574
- *
1575
- * @param elm a host element
1576
- * @param hostRef the element's runtime bookkeeping object
1577
- * @param cmpMeta runtime metadata for the Stencil component
1578
- * @param hmrVersionId an (optional) HMR version ID
1579
- */
1580
- const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1581
- let Cstr;
1582
- // initializeComponent
1583
- if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1584
- // Let the runtime know that the component has been initialized
1585
- hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1586
- const bundleId = cmpMeta.$lazyBundleId$;
1587
- if (bundleId) {
1588
- // lazy loaded components
1589
- // request the component's implementation to be
1590
- // wired up with the host element
1591
- Cstr = loadModule(cmpMeta);
1592
- if (Cstr.then) {
1593
- // Await creates a micro-task avoid if possible
1594
- const endLoad = uniqueTime();
1595
- Cstr = await Cstr;
1596
- endLoad();
1597
- }
1598
- if (!Cstr.isProxied) {
1599
- // we've never proxied this Constructor before
1600
- // let's add the getters/setters to its prototype before
1601
- // the first time we create an instance of the implementation
1602
- {
1603
- cmpMeta.$watchers$ = Cstr.watchers;
1604
- }
1605
- proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1606
- Cstr.isProxied = true;
1607
- }
1608
- const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1609
- // ok, time to construct the instance
1610
- // but let's keep track of when we start and stop
1611
- // so that the getters/setters don't incorrectly step on data
1612
- {
1613
- hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1614
- }
1615
- // construct the lazy-loaded component implementation
1616
- // passing the hostRef is very important during
1617
- // construction in order to directly wire together the
1618
- // host element and the lazy-loaded instance
1619
- try {
1620
- new Cstr(hostRef);
1621
- }
1622
- catch (e) {
1623
- consoleError(e);
1624
- }
1625
- {
1626
- hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1627
- }
1628
- {
1629
- hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1630
- }
1631
- endNewInstance();
1632
- }
1633
- else {
1634
- // sync constructor component
1635
- Cstr = elm.constructor;
1636
- // wait for the CustomElementRegistry to mark the component as ready before setting `isWatchReady`. Otherwise,
1637
- // watchers may fire prematurely if `customElements.get()`/`customElements.whenDefined()` resolves _before_
1638
- // Stencil has completed instantiating the component.
1639
- customElements.whenDefined(cmpMeta.$tagName$).then(() => (hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */));
1640
- }
1641
- if (Cstr.style) {
1642
- // this component has styles but we haven't registered them yet
1643
- let style = Cstr.style;
1644
- const scopeId = getScopeId(cmpMeta);
1645
- if (!styles.has(scopeId)) {
1646
- const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1647
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1648
- endRegisterStyles();
1649
- }
1650
- }
1651
- }
1652
- // we've successfully created a lazy instance
1653
- const ancestorComponent = hostRef.$ancestorComponent$;
1654
- const schedule = () => scheduleUpdate(hostRef, true);
1655
- if (ancestorComponent && ancestorComponent['s-rc']) {
1656
- // this is the initial load and this component it has an ancestor component
1657
- // but the ancestor component has NOT fired its will update lifecycle yet
1658
- // so let's just cool our jets and wait for the ancestor to continue first
1659
- // this will get fired off when the ancestor component
1660
- // finally gets around to rendering its lazy self
1661
- // fire off the initial update
1662
- ancestorComponent['s-rc'].push(schedule);
1663
- }
1664
- else {
1665
- schedule();
1666
- }
1667
- };
1668
- const fireConnectedCallback = (instance) => {
1669
- };
1670
- const connectedCallback = (elm) => {
1671
- if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1672
- const hostRef = getHostRef(elm);
1673
- const cmpMeta = hostRef.$cmpMeta$;
1674
- const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1675
- if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1676
- // first time this component has connected
1677
- hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1678
- {
1679
- // find the first ancestor component (if there is one) and register
1680
- // this component as one of the actively loading child components for its ancestor
1681
- let ancestorComponent = elm;
1682
- while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1683
- // climb up the ancestors looking for the first
1684
- // component that hasn't finished its lifecycle update yet
1685
- if (ancestorComponent['s-p']) {
1686
- // we found this components first ancestor component
1687
- // keep a reference to this component's ancestor component
1688
- attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1689
- break;
1690
- }
1691
- }
1692
- }
1693
- // Lazy properties
1694
- // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1695
- if (cmpMeta.$members$) {
1696
- Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1697
- if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1698
- const value = elm[memberName];
1699
- delete elm[memberName];
1700
- elm[memberName] = value;
1701
- }
1702
- });
1703
- }
1704
- {
1705
- initializeComponent(elm, hostRef, cmpMeta);
1706
- }
1707
- }
1708
- else {
1709
- // not the first time this has connected
1710
- // reattach any event listeners to the host
1711
- // since they would have been removed when disconnected
1712
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1713
- // fire off connectedCallback() on component instance
1714
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
1715
- else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1716
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1717
- }
1718
- }
1719
- endConnected();
1720
- }
1721
- };
1722
- const disconnectInstance = (instance) => {
1723
- {
1724
- safeCall(instance, 'disconnectedCallback');
1725
- }
1726
- };
1727
- const disconnectedCallback = async (elm) => {
1728
- if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1729
- const hostRef = getHostRef(elm);
1730
- {
1731
- if (hostRef.$rmListeners$) {
1732
- hostRef.$rmListeners$.map((rmListener) => rmListener());
1733
- hostRef.$rmListeners$ = undefined;
1734
- }
1735
- }
1736
- if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
1737
- disconnectInstance(hostRef.$lazyInstance$);
1738
- }
1739
- else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1740
- hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
1741
- }
1742
- }
1743
- };
1744
- const bootstrapLazy = (lazyBundles, options = {}) => {
1745
- var _a;
1746
- const endBootstrap = createTime();
1747
- const cmpTags = [];
1748
- const exclude = options.exclude || [];
1749
- const customElements = win.customElements;
1750
- const head = doc.head;
1751
- const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1752
- const dataStyles = /*@__PURE__*/ doc.createElement('style');
1753
- const deferredConnectedCallbacks = [];
1754
- let appLoadFallback;
1755
- let isBootstrapping = true;
1756
- Object.assign(plt, options);
1757
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1758
- let hasSlotRelocation = false;
1759
- lazyBundles.map((lazyBundle) => {
1760
- lazyBundle[1].map((compactMeta) => {
1761
- var _a;
1762
- const cmpMeta = {
1763
- $flags$: compactMeta[0],
1764
- $tagName$: compactMeta[1],
1765
- $members$: compactMeta[2],
1766
- $listeners$: compactMeta[3],
1767
- };
1768
- // Check if we are using slots outside the shadow DOM in this component.
1769
- // We'll use this information later to add styles for `slot-fb` elements
1770
- if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
1771
- hasSlotRelocation = true;
1772
- }
1773
- {
1774
- cmpMeta.$members$ = compactMeta[2];
1775
- }
1776
- {
1777
- cmpMeta.$listeners$ = compactMeta[3];
1778
- }
1779
- {
1780
- cmpMeta.$watchers$ = (_a = compactMeta[4]) !== null && _a !== void 0 ? _a : {};
1781
- }
1782
- const tagName = cmpMeta.$tagName$;
1783
- const HostElement = class extends HTMLElement {
1784
- // StencilLazyHost
1785
- constructor(self) {
1786
- // @ts-ignore
1787
- super(self);
1788
- self = this;
1789
- registerHost(self, cmpMeta);
1790
- if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1791
- // this component is using shadow dom
1792
- // and this browser supports shadow dom
1793
- // add the read-only property "shadowRoot" to the host element
1794
- // adding the shadow root build conditionals to minimize runtime
1795
- {
1796
- {
1797
- self.attachShadow({ mode: 'open' });
1798
- }
1799
- }
1800
- }
1801
- }
1802
- connectedCallback() {
1803
- if (appLoadFallback) {
1804
- clearTimeout(appLoadFallback);
1805
- appLoadFallback = null;
1806
- }
1807
- if (isBootstrapping) {
1808
- // connectedCallback will be processed once all components have been registered
1809
- deferredConnectedCallbacks.push(this);
1810
- }
1811
- else {
1812
- plt.jmp(() => connectedCallback(this));
1813
- }
1814
- }
1815
- disconnectedCallback() {
1816
- plt.jmp(() => disconnectedCallback(this));
1817
- }
1818
- componentOnReady() {
1819
- return getHostRef(this).$onReadyPromise$;
1820
- }
1821
- };
1822
- cmpMeta.$lazyBundleId$ = lazyBundle[0];
1823
- if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1824
- cmpTags.push(tagName);
1825
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1826
- }
1827
- });
1828
- });
1829
- // Only bother generating CSS if we have components
1830
- // TODO(STENCIL-1118): Add test cases for CSS content based on conditionals
1831
- if (cmpTags.length > 0) {
1832
- // Add styles for `slot-fb` elements if any of our components are using slots outside the Shadow DOM
1833
- if (hasSlotRelocation) {
1834
- dataStyles.textContent += SLOT_FB_CSS;
1835
- }
1836
- // Add hydration styles
1837
- {
1838
- dataStyles.textContent += cmpTags + HYDRATED_CSS;
1839
- }
1840
- // If we have styles, add them to the DOM
1841
- if (dataStyles.innerHTML.length) {
1842
- dataStyles.setAttribute('data-styles', '');
1843
- // Apply CSP nonce to the style tag if it exists
1844
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1845
- if (nonce != null) {
1846
- dataStyles.setAttribute('nonce', nonce);
1847
- }
1848
- // Insert the styles into the document head
1849
- // NOTE: this _needs_ to happen last so we can ensure the nonce (and other attributes) are applied
1850
- head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
1851
- }
1852
- }
1853
- // Process deferred connectedCallbacks now all components have been registered
1854
- isBootstrapping = false;
1855
- if (deferredConnectedCallbacks.length) {
1856
- deferredConnectedCallbacks.map((host) => host.connectedCallback());
1857
- }
1858
- else {
1859
- {
1860
- plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1861
- }
1862
- }
1863
- // Fallback appLoad event
1864
- endBootstrap();
1865
- };
1866
- const Fragment = (_, children) => children;
1867
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1868
- if (listeners) {
1869
- listeners.map(([flags, name, method]) => {
1870
- const target = getHostListenerTarget(elm, flags) ;
1871
- const handler = hostListenerProxy(hostRef, method);
1872
- const opts = hostListenerOpts(flags);
1873
- plt.ael(target, name, handler, opts);
1874
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1875
- });
1876
- }
1877
- };
1878
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
1879
- try {
1880
- {
1881
- if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
1882
- // instance is ready, let's call it's member method for this event
1883
- hostRef.$lazyInstance$[methodName](ev);
1884
- }
1885
- else {
1886
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1887
- }
1888
- }
1889
- }
1890
- catch (e) {
1891
- consoleError(e);
1892
- }
1893
- };
1894
- const getHostListenerTarget = (elm, flags) => {
1895
- if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
1896
- return doc;
1897
- if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
1898
- return win;
1899
- if (flags & 16 /* LISTENER_FLAGS.TargetBody */)
1900
- return doc.body;
1901
- return elm;
1902
- };
1903
- // prettier-ignore
1904
- const hostListenerOpts = (flags) => supportsListenerOptions
1905
- ? ({
1906
- passive: (flags & 1 /* LISTENER_FLAGS.Passive */) !== 0,
1907
- capture: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0,
1908
- })
1909
- : (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1910
- /**
1911
- * Assigns the given value to the nonce property on the runtime platform object.
1912
- * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1913
- * @param nonce The value to be assigned to the platform nonce property.
1914
- * @returns void
1915
- */
1916
- const setNonce = (nonce) => (plt.$nonce$ = nonce);
1917
- /**
1918
- * A WeakMap mapping runtime component references to their corresponding host reference
1919
- * instances.
1920
- *
1921
- * **Note**: If we're in an HMR context we need to store a reference to this
1922
- * value on `window` in order to maintain the mapping of {@link d.RuntimeRef}
1923
- * to {@link d.HostRef} across HMR updates.
1924
- *
1925
- * This is necessary because when HMR updates for a component are processed by
1926
- * the browser-side dev server client the JS bundle for that component is
1927
- * re-fetched. Since the module containing {@link hostRefs} is included in
1928
- * that bundle, if we do not store a reference to it the new iteration of the
1929
- * component will not have access to the previous hostRef map, leading to a
1930
- * bug where the new version of the component cannot properly initialize.
1931
- */
1932
- const hostRefs = new WeakMap();
1933
- /**
1934
- * Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
1935
- *
1936
- * @param ref the runtime ref of interest
1937
- * @returns the Host reference (if found) or undefined
1938
- */
1939
- const getHostRef = (ref) => hostRefs.get(ref);
1940
- /**
1941
- * Register a lazy instance with the {@link hostRefs} object so it's
1942
- * corresponding {@link d.HostRef} can be retrieved later.
1943
- *
1944
- * @param lazyInstance the lazy instance of interest
1945
- * @param hostRef that instances `HostRef` object
1946
- * @returns a reference to the host ref WeakMap
1947
- */
1948
- const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1949
- /**
1950
- * Register a host element for a Stencil component, setting up various metadata
1951
- * and callbacks based on {@link BUILD} flags as well as the component's runtime
1952
- * metadata.
1953
- *
1954
- * @param hostElement the host element to register
1955
- * @param cmpMeta runtime metadata for that component
1956
- * @returns a reference to the host ref WeakMap
1957
- */
1958
- const registerHost = (hostElement, cmpMeta) => {
1959
- const hostRef = {
1960
- $flags$: 0,
1961
- $hostElement$: hostElement,
1962
- $cmpMeta$: cmpMeta,
1963
- $instanceValues$: new Map(),
1964
- };
1965
- {
1966
- hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
1967
- }
1968
- {
1969
- hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1970
- hostElement['s-p'] = [];
1971
- hostElement['s-rc'] = [];
1972
- }
1973
- addHostEventListeners(hostElement, hostRef, cmpMeta.$listeners$);
1974
- return hostRefs.set(hostElement, hostRef);
1975
- };
1976
- const isMemberInElement = (elm, memberName) => memberName in elm;
1977
- const consoleError = (e, el) => (0, console.error)(e, el);
1978
- const cmpModules = /*@__PURE__*/ new Map();
1979
- const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1980
- // loadModuleImport
1981
- const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1982
- const bundleId = cmpMeta.$lazyBundleId$;
1983
- const module = cmpModules.get(bundleId) ;
1984
- if (module) {
1985
- return module[exportName];
1986
- }
1987
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1988
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1989
- /* @vite-ignore */
1990
- /* webpackInclude: /\.entry\.js$/ */
1991
- /* webpackExclude: /\.system\.entry\.js$/ */
1992
- /* webpackMode: "lazy" */
1993
- `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
1994
- {
1995
- cmpModules.set(bundleId, importedModule);
1996
- }
1997
- return importedModule[exportName];
1998
- }, consoleError);
1999
- };
2000
- const styles = /*@__PURE__*/ new Map();
2001
- const win = typeof window !== 'undefined' ? window : {};
2002
- const doc = win.document || { head: {} };
2003
- const plt = {
2004
- $flags$: 0,
2005
- $resourcesUrl$: '',
2006
- jmp: (h) => h(),
2007
- raf: (h) => requestAnimationFrame(h),
2008
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
2009
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
2010
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
2011
- };
2012
- const supportsListenerOptions = /*@__PURE__*/ (() => {
2013
- let supportsListenerOptions = false;
2014
- try {
2015
- doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
2016
- get() {
2017
- supportsListenerOptions = true;
2018
- },
2019
- }));
2020
- }
2021
- catch (e) { }
2022
- return supportsListenerOptions;
2023
- })();
2024
- const promiseResolve = (v) => Promise.resolve(v);
2025
- const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
2026
- try {
2027
- new CSSStyleSheet();
2028
- return typeof new CSSStyleSheet().replaceSync === 'function';
2029
- }
2030
- catch (e) { }
2031
- return false;
2032
- })()
2033
- ;
2034
- const queueDomReads = [];
2035
- const queueDomWrites = [];
2036
- const queueTask = (queue, write) => (cb) => {
2037
- queue.push(cb);
2038
- if (!queuePending) {
2039
- queuePending = true;
2040
- if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
2041
- nextTick(flush);
2042
- }
2043
- else {
2044
- plt.raf(flush);
2045
- }
2046
- }
2047
- };
2048
- const consume = (queue) => {
2049
- for (let i = 0; i < queue.length; i++) {
2050
- try {
2051
- queue[i](performance.now());
2052
- }
2053
- catch (e) {
2054
- consoleError(e);
2055
- }
2056
- }
2057
- queue.length = 0;
2058
- };
2059
- const flush = () => {
2060
- // always force a bunch of medium callbacks to run, but still have
2061
- // a throttle on how many can run in a certain time
2062
- // DOM READS!!!
2063
- consume(queueDomReads);
2064
- // DOM WRITES!!!
2065
- {
2066
- consume(queueDomWrites);
2067
- if ((queuePending = queueDomReads.length > 0)) {
2068
- // still more to do yet, but we've run out of time
2069
- // let's let this thing cool off and try again in the next tick
2070
- plt.raf(flush);
2071
- }
2072
- }
2073
- };
2074
- const nextTick = (cb) => promiseResolve().then(cb);
2075
- const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
2076
-
2077
- exports.Fragment = Fragment;
2078
- exports.Host = Host;
2079
- exports.bootstrapLazy = bootstrapLazy;
2080
- exports.createEvent = createEvent;
2081
- exports.forceUpdate = forceUpdate;
2082
- exports.getAssetPath = getAssetPath;
2083
- exports.getElement = getElement;
2084
- exports.getRenderingRef = getRenderingRef;
2085
- exports.h = h;
2086
- exports.promiseResolve = promiseResolve;
2087
- exports.registerInstance = registerInstance;
2088
- exports.setNonce = setNonce;