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