@ptcwebops/ptcw-design 0.7.6 → 0.7.8

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 (293) hide show
  1. package/dist/cjs/dropdown-item.cjs.entry.js +2 -2
  2. package/dist/cjs/icon-asset.cjs.entry.js +10 -22
  3. package/dist/cjs/{index-b3fabe79.js → index-8745a0a3.js} +486 -255
  4. package/dist/cjs/list-item.cjs.entry.js +2 -2
  5. package/dist/cjs/loader.cjs.js +3 -3
  6. package/dist/cjs/lottie-player.cjs.entry.js +2 -2
  7. package/dist/cjs/my-component.cjs.entry.js +5 -2
  8. package/dist/cjs/ptc-accordion-item.cjs.entry.js +2 -16
  9. package/dist/cjs/ptc-accordion.cjs.entry.js +2 -5
  10. package/dist/cjs/ptc-announcement.cjs.entry.js +11 -22
  11. package/dist/cjs/ptc-breadcrumb.cjs.entry.js +2 -2
  12. package/dist/cjs/ptc-button.cjs.entry.js +3 -34
  13. package/dist/cjs/ptc-card-bottom.cjs.entry.js +4 -2
  14. package/dist/cjs/ptc-card-content.cjs.entry.js +4 -2
  15. package/dist/cjs/ptc-card-plm.cjs.entry.js +5 -2
  16. package/dist/cjs/ptc-card_6.cjs.entry.js +27 -135
  17. package/dist/cjs/ptc-checkbox.cjs.entry.js +5 -3
  18. package/dist/cjs/ptc-collapse-list.cjs.entry.js +13 -2
  19. package/dist/cjs/ptc-container.cjs.entry.js +2 -5
  20. package/dist/cjs/ptc-dropdown.cjs.entry.js +7 -7
  21. package/dist/cjs/ptc-dynamic-card.cjs.entry.js +32 -25
  22. package/dist/cjs/ptc-ellipsis-dropdown.cjs.entry.js +3 -2
  23. package/dist/cjs/ptc-filter-tag.cjs.entry.js +4 -3
  24. package/dist/cjs/ptc-hero-footer-cta.cjs.entry.js +5 -2
  25. package/dist/cjs/ptc-hero.cjs.entry.js +3 -5
  26. package/dist/cjs/ptc-icon-list.cjs.entry.js +3 -15
  27. package/dist/cjs/ptc-icon-minimize.cjs.entry.js +3 -2
  28. package/dist/cjs/ptc-link.cjs.entry.js +4 -20
  29. package/dist/cjs/ptc-list.cjs.entry.js +2 -2
  30. package/dist/cjs/ptc-lottie.cjs.entry.js +3 -5
  31. package/dist/cjs/ptc-minimized-footer.cjs.entry.js +2 -2
  32. package/dist/cjs/ptc-minimized-header.cjs.entry.js +2 -2
  33. package/dist/cjs/ptc-mobile-select.cjs.entry.js +5 -20
  34. package/dist/cjs/ptc-modal.cjs.entry.js +5 -23
  35. package/dist/cjs/ptc-overlay.cjs.entry.js +5 -5
  36. package/dist/cjs/ptc-pagenation.cjs.entry.js +13 -12
  37. package/dist/cjs/ptc-previous-url.cjs.entry.js +4 -2
  38. package/dist/cjs/ptc-pricing-block.cjs.entry.js +3 -2
  39. package/dist/cjs/ptc-quote.cjs.entry.js +6 -8
  40. package/dist/cjs/ptc-readmore_2.cjs.entry.js +4 -37
  41. package/dist/cjs/ptc-responsive-wrapper.cjs.entry.js +2 -2
  42. package/dist/cjs/ptc-shopping-cart.cjs.entry.js +3 -2
  43. package/dist/cjs/ptc-social-share.cjs.entry.js +8 -13
  44. package/dist/cjs/ptc-span.cjs.entry.js +3 -8
  45. package/dist/cjs/ptc-sticky-icons.cjs.entry.js +43 -0
  46. package/dist/cjs/ptc-svg-btn.cjs.entry.js +3 -5
  47. package/dist/cjs/ptc-tab-list.cjs.entry.js +3 -2
  48. package/dist/cjs/ptc-text-copy-with-background.cjs.entry.js +5 -9
  49. package/dist/cjs/ptc-title.cjs.entry.js +9 -17
  50. package/dist/cjs/ptc-two-column-media.cjs.entry.js +3 -2
  51. package/dist/cjs/ptcw-design.cjs.js +3 -3
  52. package/dist/cjs/tab-content.cjs.entry.js +3 -2
  53. package/dist/cjs/tab-header.cjs.entry.js +3 -2
  54. package/dist/collection/collection-manifest.json +3 -4
  55. package/dist/collection/components/dropdown-item/dropdown-item.js +51 -46
  56. package/dist/collection/components/icon-asset/icon-asset.css +3 -0
  57. package/dist/collection/components/icon-asset/icon-asset.js +167 -185
  58. package/dist/collection/components/list-item/list-item.js +85 -81
  59. package/dist/collection/components/my-component/my-component.js +70 -61
  60. package/dist/collection/components/ptc-accordion/ptc-accordion-item/ptc-accordion-item.js +199 -208
  61. package/dist/collection/components/ptc-accordion/ptc-accordion.js +43 -39
  62. package/dist/collection/components/ptc-announcement/ptc-announcement.js +199 -209
  63. package/dist/collection/components/ptc-breadcrumb/ptc-breadcrumb.js +12 -11
  64. package/dist/collection/components/ptc-button/ptc-button.js +221 -250
  65. package/dist/collection/components/ptc-card/ptc-card.css +167 -6
  66. package/dist/collection/components/ptc-card/ptc-card.js +261 -291
  67. package/dist/collection/components/ptc-card-bottom/ptc-card-bottom.js +85 -76
  68. package/dist/collection/components/ptc-card-content/ptc-card-content.js +85 -76
  69. package/dist/collection/components/ptc-card-plm/ptc-card-plm.js +85 -78
  70. package/dist/collection/components/ptc-checkbox/ptc-checkbox.js +86 -82
  71. package/dist/collection/components/ptc-collapse-list/ptc-collapse-list.js +238 -225
  72. package/dist/collection/components/ptc-container/ptc-container.js +85 -84
  73. package/dist/collection/components/ptc-date/ptc-date.js +160 -171
  74. package/dist/collection/components/ptc-dropdown/ptc-dropdown.js +108 -103
  75. package/dist/collection/components/ptc-dynamic-card/media/nav-active-dotslick.svg +16 -0
  76. package/dist/collection/components/ptc-dynamic-card/ptc-dynamic-card.css +4 -0
  77. package/dist/collection/components/ptc-dynamic-card/ptc-dynamic-card.js +158 -131
  78. package/dist/collection/components/ptc-ellipsis-dropdown/ptc-ellipsis-dropdown.js +89 -82
  79. package/dist/collection/components/ptc-filter-tag/ptc-filter-tag.js +58 -50
  80. package/dist/collection/components/ptc-hero/ptc-hero.js +51 -51
  81. package/dist/collection/components/ptc-hero-footer-cta/ptc-hero-footer-cta.js +70 -69
  82. package/dist/collection/components/ptc-icon-list/ptc-icon-list.css +3 -0
  83. package/dist/collection/components/ptc-icon-list/ptc-icon-list.js +102 -121
  84. package/dist/collection/components/ptc-icon-minimize/ptc-icon-minimize.js +51 -50
  85. package/dist/collection/components/ptc-img/ptc-img.js +162 -179
  86. package/dist/collection/components/ptc-link/ptc-link.js +160 -174
  87. package/dist/collection/components/ptc-list/ptc-list.js +51 -46
  88. package/dist/collection/components/ptc-lottie/ptc-lottie.js +50 -46
  89. package/dist/collection/components/ptc-minimized-footer/ptc-minimized-footer.js +12 -11
  90. package/dist/collection/components/ptc-minimized-header/ptc-minimized-header.js +68 -67
  91. package/dist/collection/components/ptc-mobile-select/ptc-mobile-select.js +156 -168
  92. package/dist/collection/components/ptc-modal/ptc-modal.js +206 -224
  93. package/dist/collection/components/ptc-overlay/ptc-overlay.js +84 -78
  94. package/dist/collection/components/ptc-pagenation/ptc-pagenation.js +221 -216
  95. package/dist/collection/components/ptc-para/ptc-para.js +136 -145
  96. package/dist/collection/components/ptc-picture/ptc-picture.js +319 -340
  97. package/dist/collection/components/ptc-previous-url/ptc-previous-url.js +53 -47
  98. package/dist/collection/components/ptc-pricing-block/ptc-pricing-block.js +36 -32
  99. package/dist/collection/components/ptc-quote/ptc-quote.js +120 -130
  100. package/dist/collection/components/ptc-readmore/ptc-readmore.js +97 -107
  101. package/dist/collection/components/ptc-responsive-wrapper/ptc-responsive-wrapper.js +12 -9
  102. package/dist/collection/components/ptc-shopping-cart/ptc-shopping-cart.js +51 -45
  103. package/dist/collection/components/ptc-social-share/ptc-social-share.js +177 -144
  104. package/dist/collection/components/ptc-spacer/ptc-spacer.js +67 -70
  105. package/dist/collection/components/ptc-span/ptc-span.js +68 -70
  106. package/dist/collection/components/ptc-sticky-icons/ptc-sticky-icons.css +32 -0
  107. package/dist/collection/components/ptc-sticky-icons/ptc-sticky-icons.js +51 -0
  108. package/dist/collection/components/ptc-svg-btn/ptc-svg-btn.js +52 -51
  109. package/dist/collection/components/ptc-tab-list/ptc-tab-list.js +35 -30
  110. package/dist/collection/components/ptc-text-copy-with-background/ptc-text-copy-with-background.js +103 -109
  111. package/dist/collection/components/ptc-title/ptc-title.js +221 -227
  112. package/dist/collection/components/ptc-tooltip/ptc-tooltip.js +119 -136
  113. package/dist/collection/components/ptc-two-column-media/ptc-two-column-media.js +36 -28
  114. package/dist/collection/components/tab-content/tab-content.js +57 -47
  115. package/dist/collection/components/tab-header/tab-header.js +74 -62
  116. package/dist/custom-elements/index.d.ts +6 -12
  117. package/dist/custom-elements/index.js +258 -586
  118. package/dist/esm/dropdown-item.entry.js +2 -2
  119. package/dist/esm/icon-asset.entry.js +10 -22
  120. package/dist/esm/{index-5ff11327.js → index-0c73b51e.js} +486 -255
  121. package/dist/esm/list-item.entry.js +2 -2
  122. package/dist/esm/loader.js +3 -3
  123. package/dist/esm/lottie-player.entry.js +2 -2
  124. package/dist/esm/my-component.entry.js +5 -2
  125. package/dist/esm/polyfills/css-shim.js +1 -1
  126. package/dist/esm/ptc-accordion-item.entry.js +2 -16
  127. package/dist/esm/ptc-accordion.entry.js +2 -5
  128. package/dist/esm/ptc-announcement.entry.js +11 -22
  129. package/dist/esm/ptc-breadcrumb.entry.js +2 -2
  130. package/dist/esm/ptc-button.entry.js +3 -34
  131. package/dist/esm/ptc-card-bottom.entry.js +4 -2
  132. package/dist/esm/ptc-card-content.entry.js +4 -2
  133. package/dist/esm/ptc-card-plm.entry.js +5 -2
  134. package/dist/esm/ptc-card_6.entry.js +27 -135
  135. package/dist/esm/ptc-checkbox.entry.js +5 -3
  136. package/dist/esm/ptc-collapse-list.entry.js +13 -2
  137. package/dist/esm/ptc-container.entry.js +2 -5
  138. package/dist/esm/ptc-dropdown.entry.js +7 -7
  139. package/dist/esm/ptc-dynamic-card.entry.js +32 -25
  140. package/dist/esm/ptc-ellipsis-dropdown.entry.js +3 -2
  141. package/dist/esm/ptc-filter-tag.entry.js +4 -3
  142. package/dist/esm/ptc-hero-footer-cta.entry.js +5 -2
  143. package/dist/esm/ptc-hero.entry.js +3 -5
  144. package/dist/esm/ptc-icon-list.entry.js +3 -15
  145. package/dist/esm/ptc-icon-minimize.entry.js +3 -2
  146. package/dist/esm/ptc-link.entry.js +4 -20
  147. package/dist/esm/ptc-list.entry.js +2 -2
  148. package/dist/esm/ptc-lottie.entry.js +3 -5
  149. package/dist/esm/ptc-minimized-footer.entry.js +2 -2
  150. package/dist/esm/ptc-minimized-header.entry.js +2 -2
  151. package/dist/esm/ptc-mobile-select.entry.js +5 -20
  152. package/dist/esm/ptc-modal.entry.js +5 -23
  153. package/dist/esm/ptc-overlay.entry.js +5 -5
  154. package/dist/esm/ptc-pagenation.entry.js +13 -12
  155. package/dist/esm/ptc-previous-url.entry.js +4 -2
  156. package/dist/esm/ptc-pricing-block.entry.js +3 -2
  157. package/dist/esm/ptc-quote.entry.js +6 -8
  158. package/dist/esm/ptc-readmore_2.entry.js +4 -37
  159. package/dist/esm/ptc-responsive-wrapper.entry.js +2 -2
  160. package/dist/esm/ptc-shopping-cart.entry.js +3 -2
  161. package/dist/esm/ptc-social-share.entry.js +8 -13
  162. package/dist/esm/ptc-span.entry.js +3 -8
  163. package/dist/esm/ptc-sticky-icons.entry.js +39 -0
  164. package/dist/esm/ptc-svg-btn.entry.js +3 -5
  165. package/dist/esm/ptc-tab-list.entry.js +3 -2
  166. package/dist/esm/ptc-text-copy-with-background.entry.js +5 -9
  167. package/dist/esm/ptc-title.entry.js +9 -17
  168. package/dist/esm/ptc-two-column-media.entry.js +3 -2
  169. package/dist/esm/ptcw-design.js +3 -3
  170. package/dist/esm/tab-content.entry.js +3 -2
  171. package/dist/esm/tab-header.entry.js +3 -2
  172. package/dist/ptcw-design/media/nav-active-dotslick.svg +16 -0
  173. package/dist/ptcw-design/p-009001dc.js +2 -0
  174. package/dist/ptcw-design/p-00c1343b.entry.js +1 -0
  175. package/dist/ptcw-design/p-188d69d9.entry.js +1 -0
  176. package/dist/ptcw-design/p-1964f1f4.entry.js +1 -0
  177. package/dist/ptcw-design/p-1e80c01f.entry.js +1 -0
  178. package/dist/ptcw-design/p-21e27f2b.entry.js +1 -0
  179. package/dist/ptcw-design/p-24321c52.entry.js +1 -0
  180. package/dist/ptcw-design/{p-7599491c.entry.js → p-2dcea9db.entry.js} +1 -1
  181. package/dist/ptcw-design/p-36a453d4.entry.js +1 -0
  182. package/dist/ptcw-design/p-3db835e4.entry.js +1 -0
  183. package/dist/ptcw-design/p-3f85b469.entry.js +1 -0
  184. package/dist/ptcw-design/p-482a8bc9.entry.js +1 -0
  185. package/dist/ptcw-design/p-4de70656.entry.js +1 -0
  186. package/dist/ptcw-design/p-5105d9e5.entry.js +1 -0
  187. package/dist/ptcw-design/p-58e06eee.entry.js +1 -0
  188. package/dist/ptcw-design/p-5bb7354a.entry.js +1 -0
  189. package/dist/ptcw-design/p-5d585b54.entry.js +1 -0
  190. package/dist/ptcw-design/p-5dbf98a9.entry.js +1 -0
  191. package/dist/ptcw-design/p-6065a1d1.entry.js +1 -0
  192. package/dist/ptcw-design/p-60843852.entry.js +1 -0
  193. package/dist/ptcw-design/p-6131b9a1.entry.js +1 -0
  194. package/dist/ptcw-design/p-6b1fdce6.entry.js +1 -0
  195. package/dist/ptcw-design/p-6d713986.entry.js +1 -0
  196. package/dist/ptcw-design/p-8637cefc.entry.js +1 -0
  197. package/dist/ptcw-design/p-8808ecc8.entry.js +1 -0
  198. package/dist/ptcw-design/p-88e1778e.entry.js +1 -0
  199. package/dist/ptcw-design/p-8b197833.entry.js +1 -0
  200. package/dist/ptcw-design/p-8b5b5614.entry.js +1 -0
  201. package/dist/ptcw-design/p-8bb41e7c.entry.js +1 -0
  202. package/dist/ptcw-design/p-9311ee3f.entry.js +1 -0
  203. package/dist/ptcw-design/p-97e00dfa.entry.js +1 -0
  204. package/dist/ptcw-design/p-a05fe3d0.entry.js +1 -0
  205. package/dist/ptcw-design/p-a0f25c98.entry.js +1 -0
  206. package/dist/ptcw-design/p-a4900673.entry.js +1 -0
  207. package/dist/ptcw-design/p-a749c353.entry.js +1 -0
  208. package/dist/ptcw-design/p-adcc9906.entry.js +1 -0
  209. package/dist/ptcw-design/p-afea5c1f.entry.js +1 -0
  210. package/dist/ptcw-design/p-b420e81a.entry.js +1 -0
  211. package/dist/ptcw-design/p-b701bbc0.entry.js +1 -0
  212. package/dist/ptcw-design/p-bc033578.entry.js +1 -0
  213. package/dist/ptcw-design/p-c3f73953.entry.js +1 -0
  214. package/dist/ptcw-design/p-c4e20f99.entry.js +1 -0
  215. package/dist/ptcw-design/p-ca9efc42.entry.js +1 -0
  216. package/dist/ptcw-design/p-d56b953e.entry.js +1 -0
  217. package/dist/ptcw-design/{p-5e845a15.entry.js → p-d910c9d6.entry.js} +2 -2
  218. package/dist/ptcw-design/p-e3280772.entry.js +1 -0
  219. package/dist/ptcw-design/p-e34d194d.entry.js +1 -0
  220. package/dist/ptcw-design/p-e87bc2cd.entry.js +1 -0
  221. package/dist/ptcw-design/p-f2cb8bc4.entry.js +1 -0
  222. package/dist/ptcw-design/p-f9694131.entry.js +1 -0
  223. package/dist/ptcw-design/p-fbd43055.entry.js +1 -0
  224. package/dist/ptcw-design/ptcw-design.esm.js +1 -1
  225. package/dist/types/components/icon-asset/icon-asset.d.ts +1 -1
  226. package/dist/types/components/ptc-dynamic-card/ptc-dynamic-card.d.ts +11 -3
  227. package/dist/types/components/ptc-social-share/ptc-social-share.d.ts +8 -0
  228. package/dist/types/components/ptc-sticky-icons/ptc-sticky-icons.d.ts +7 -0
  229. package/dist/types/components.d.ts +117 -113
  230. package/dist/types/stencil-public-runtime.d.ts +20 -4
  231. package/loader/package.json +1 -0
  232. package/package.json +4 -3
  233. package/readme.md +1 -1
  234. package/dist/cjs/ptc-nav-item.cjs.entry.js +0 -94
  235. package/dist/cjs/ptc-nav.cjs.entry.js +0 -19
  236. package/dist/collection/components/ptc-nav/ptc-nav.css +0 -29
  237. package/dist/collection/components/ptc-nav/ptc-nav.js +0 -21
  238. package/dist/collection/components/ptc-nav-item/ptc-nav-item.css +0 -81
  239. package/dist/collection/components/ptc-nav-item/ptc-nav-item.js +0 -252
  240. package/dist/esm/ptc-nav-item.entry.js +0 -90
  241. package/dist/esm/ptc-nav.entry.js +0 -15
  242. package/dist/ptcw-design/p-09351f78.entry.js +0 -1
  243. package/dist/ptcw-design/p-10385027.entry.js +0 -1
  244. package/dist/ptcw-design/p-15ec8469.entry.js +0 -1
  245. package/dist/ptcw-design/p-1743d0ef.entry.js +0 -1
  246. package/dist/ptcw-design/p-1a77a824.entry.js +0 -1
  247. package/dist/ptcw-design/p-1ec512ea.entry.js +0 -1
  248. package/dist/ptcw-design/p-2de688ba.entry.js +0 -1
  249. package/dist/ptcw-design/p-2f6ecdf8.entry.js +0 -1
  250. package/dist/ptcw-design/p-39b8d25b.entry.js +0 -1
  251. package/dist/ptcw-design/p-3a4bb2b1.entry.js +0 -1
  252. package/dist/ptcw-design/p-3b87cd6f.entry.js +0 -1
  253. package/dist/ptcw-design/p-3b994b78.entry.js +0 -1
  254. package/dist/ptcw-design/p-4355ed7c.js +0 -1
  255. package/dist/ptcw-design/p-446423fc.entry.js +0 -1
  256. package/dist/ptcw-design/p-493b2571.entry.js +0 -1
  257. package/dist/ptcw-design/p-4ab335ac.entry.js +0 -1
  258. package/dist/ptcw-design/p-4da25d67.entry.js +0 -1
  259. package/dist/ptcw-design/p-53790fb4.entry.js +0 -1
  260. package/dist/ptcw-design/p-5bf5932c.entry.js +0 -1
  261. package/dist/ptcw-design/p-5c02f876.entry.js +0 -1
  262. package/dist/ptcw-design/p-5c5c8f25.entry.js +0 -1
  263. package/dist/ptcw-design/p-5fd37a0e.entry.js +0 -1
  264. package/dist/ptcw-design/p-5fd60b15.entry.js +0 -1
  265. package/dist/ptcw-design/p-6ab5aee9.entry.js +0 -1
  266. package/dist/ptcw-design/p-70d2c46d.entry.js +0 -1
  267. package/dist/ptcw-design/p-74a31734.entry.js +0 -1
  268. package/dist/ptcw-design/p-7a37d762.entry.js +0 -1
  269. package/dist/ptcw-design/p-83a9720c.entry.js +0 -1
  270. package/dist/ptcw-design/p-85e7bbc3.entry.js +0 -1
  271. package/dist/ptcw-design/p-87f9430f.entry.js +0 -1
  272. package/dist/ptcw-design/p-8ba6cef7.entry.js +0 -1
  273. package/dist/ptcw-design/p-8c0ba2d5.entry.js +0 -1
  274. package/dist/ptcw-design/p-8c594b35.entry.js +0 -1
  275. package/dist/ptcw-design/p-8d46a06e.entry.js +0 -1
  276. package/dist/ptcw-design/p-8e2e81c8.entry.js +0 -1
  277. package/dist/ptcw-design/p-96bfb95b.entry.js +0 -1
  278. package/dist/ptcw-design/p-baa7d351.entry.js +0 -1
  279. package/dist/ptcw-design/p-bcfd05dc.entry.js +0 -1
  280. package/dist/ptcw-design/p-be32e928.entry.js +0 -1
  281. package/dist/ptcw-design/p-c05f0c98.entry.js +0 -1
  282. package/dist/ptcw-design/p-c267b720.entry.js +0 -1
  283. package/dist/ptcw-design/p-c460a62d.entry.js +0 -1
  284. package/dist/ptcw-design/p-c91a875b.entry.js +0 -1
  285. package/dist/ptcw-design/p-cd2404f0.entry.js +0 -1
  286. package/dist/ptcw-design/p-ce5ee58d.entry.js +0 -1
  287. package/dist/ptcw-design/p-d39668ca.entry.js +0 -1
  288. package/dist/ptcw-design/p-e955c833.entry.js +0 -1
  289. package/dist/ptcw-design/p-f0cd0fb4.entry.js +0 -1
  290. package/dist/ptcw-design/p-f7d18b93.entry.js +0 -1
  291. package/dist/ptcw-design/p-fce72f70.entry.js +0 -1
  292. package/dist/types/components/ptc-nav/ptc-nav.d.ts +0 -3
  293. package/dist/types/components/ptc-nav-item/ptc-nav-item.d.ts +0 -53
@@ -1,5 +1,13 @@
1
1
  const NAMESPACE = 'ptcw-design';
2
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
+ */
3
11
  let scopeId;
4
12
  let contentRef;
5
13
  let hostTagName;
@@ -8,65 +16,10 @@ let checkSlotFallbackVisibility = false;
8
16
  let checkSlotRelocate = false;
9
17
  let isSvgMode = false;
10
18
  let queuePending = false;
11
- const win = typeof window !== 'undefined' ? window : {};
12
- const doc = win.document || { head: {} };
13
- const plt = {
14
- $flags$: 0,
15
- $resourcesUrl$: '',
16
- jmp: (h) => h(),
17
- raf: (h) => requestAnimationFrame(h),
18
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
19
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
20
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
21
- };
22
- const promiseResolve = (v) => Promise.resolve(v);
23
- const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
24
- try {
25
- new CSSStyleSheet();
26
- return typeof new CSSStyleSheet().replace === 'function';
27
- }
28
- catch (e) { }
29
- return false;
30
- })()
31
- ;
32
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
33
- if (listeners) {
34
- listeners.map(([flags, name, method]) => {
35
- const target = getHostListenerTarget(elm, flags) ;
36
- const handler = hostListenerProxy(hostRef, method);
37
- const opts = hostListenerOpts(flags);
38
- plt.ael(target, name, handler, opts);
39
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
40
- });
41
- }
42
- };
43
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
44
- try {
45
- {
46
- if (hostRef.$flags$ & 256 /* isListenReady */) {
47
- // instance is ready, let's call it's member method for this event
48
- hostRef.$lazyInstance$[methodName](ev);
49
- }
50
- else {
51
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
52
- }
53
- }
54
- }
55
- catch (e) {
56
- consoleError(e);
57
- }
58
- };
59
- const getHostListenerTarget = (elm, flags) => {
60
- if (flags & 4 /* TargetDocument */)
61
- return doc;
62
- if (flags & 8 /* TargetWindow */)
63
- return win;
64
- return elm;
19
+ const getAssetPath = (path) => {
20
+ const assetUrl = new URL(path, plt.$resourcesUrl$);
21
+ return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
65
22
  };
66
- // prettier-ignore
67
- const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
68
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
69
- const XLINK_NS = 'http://www.w3.org/1999/xlink';
70
23
  const createTime = (fnName, tagName = '') => {
71
24
  {
72
25
  return () => {
@@ -81,74 +34,8 @@ const uniqueTime = (key, measureText) => {
81
34
  };
82
35
  }
83
36
  };
84
- const rootAppliedStyles = new WeakMap();
85
- const registerStyle = (scopeId, cssText, allowCS) => {
86
- let style = styles.get(scopeId);
87
- if (supportsConstructibleStylesheets && allowCS) {
88
- style = (style || new CSSStyleSheet());
89
- style.replace(cssText);
90
- }
91
- else {
92
- style = cssText;
93
- }
94
- styles.set(scopeId, style);
95
- };
96
- const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
97
- let scopeId = getScopeId(cmpMeta);
98
- let style = styles.get(scopeId);
99
- // if an element is NOT connected then getRootNode() will return the wrong root node
100
- // so the fallback is to always use the document for the root node in those cases
101
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
102
- if (style) {
103
- if (typeof style === 'string') {
104
- styleContainerNode = styleContainerNode.head || styleContainerNode;
105
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
106
- let styleElm;
107
- if (!appliedStyles) {
108
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
109
- }
110
- if (!appliedStyles.has(scopeId)) {
111
- {
112
- {
113
- styleElm = doc.createElement('style');
114
- styleElm.innerHTML = style;
115
- }
116
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
117
- }
118
- if (appliedStyles) {
119
- appliedStyles.add(scopeId);
120
- }
121
- }
122
- }
123
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
124
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
125
- }
126
- }
127
- return scopeId;
128
- };
129
- const attachStyles = (hostRef) => {
130
- const cmpMeta = hostRef.$cmpMeta$;
131
- const elm = hostRef.$hostElement$;
132
- const flags = cmpMeta.$flags$;
133
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
134
- const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
135
- if (flags & 10 /* needsScopedEncapsulation */) {
136
- // only required when we're NOT using native shadow dom (slot)
137
- // or this browser doesn't support native shadow dom
138
- // and this host element was NOT created with SSR
139
- // let's pick out the inner content for slot projection
140
- // create a node to represent where the original
141
- // content was first placed, which is useful later on
142
- // DOM WRITE!!
143
- elm['s-sc'] = scopeId;
144
- elm.classList.add(scopeId + '-h');
145
- if (flags & 2 /* scopedCssEncapsulation */) {
146
- elm.classList.add(scopeId + '-s');
147
- }
148
- }
149
- endAttachStyles();
150
- };
151
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
37
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
38
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
152
39
  /**
153
40
  * Default style mode id
154
41
  */
@@ -185,7 +72,7 @@ const h = (nodeName, vnodeData, ...children) => {
185
72
  let slotName = null;
186
73
  let simple = false;
187
74
  let lastSimple = false;
188
- let vNodeChildren = [];
75
+ const vNodeChildren = [];
189
76
  const walk = (c) => {
190
77
  for (let i = 0; i < c.length; i++) {
191
78
  child = c[i];
@@ -297,6 +184,152 @@ const convertToPrivate = (node) => {
297
184
  vnode.$name$ = node.vname;
298
185
  return vnode;
299
186
  };
187
+ /**
188
+ * Parse a new property value for a given property type.
189
+ *
190
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
191
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
192
+ * 1. `any`, the type given to `propValue` in the function signature
193
+ * 2. the type stored from `propType`.
194
+ *
195
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
196
+ *
197
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
198
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
199
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
200
+ * ```tsx
201
+ * <my-cmp prop-val={0}></my-cmp>
202
+ * ```
203
+ *
204
+ * HTML prop values on the other hand, will always a string
205
+ *
206
+ * @param propValue the new value to coerce to some type
207
+ * @param propType the type of the prop, expressed as a binary number
208
+ * @returns the parsed/coerced value
209
+ */
210
+ const parsePropertyValue = (propValue, propType) => {
211
+ // ensure this value is of the correct prop type
212
+ if (propValue != null && !isComplexType(propValue)) {
213
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
214
+ // per the HTML spec, any string value means it is a boolean true value
215
+ // but we'll cheat here and say that the string "false" is the boolean false
216
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
217
+ }
218
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
219
+ // force it to be a number
220
+ return parseFloat(propValue);
221
+ }
222
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
223
+ // could have been passed as a number or boolean
224
+ // but we still want it as a string
225
+ return String(propValue);
226
+ }
227
+ // redundant return here for better minification
228
+ return propValue;
229
+ }
230
+ // not sure exactly what type we want
231
+ // so no need to change to a different type
232
+ return propValue;
233
+ };
234
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
235
+ const createEvent = (ref, name, flags) => {
236
+ const elm = getElement(ref);
237
+ return {
238
+ emit: (detail) => {
239
+ return emitEvent(elm, name, {
240
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
241
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
242
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
243
+ detail,
244
+ });
245
+ },
246
+ };
247
+ };
248
+ /**
249
+ * Helper function to create & dispatch a custom Event on a provided target
250
+ * @param elm the target of the Event
251
+ * @param name the name to give the custom Event
252
+ * @param opts options for configuring a custom Event
253
+ * @returns the custom Event
254
+ */
255
+ const emitEvent = (elm, name, opts) => {
256
+ const ev = plt.ce(name, opts);
257
+ elm.dispatchEvent(ev);
258
+ return ev;
259
+ };
260
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
261
+ const registerStyle = (scopeId, cssText, allowCS) => {
262
+ let style = styles.get(scopeId);
263
+ if (supportsConstructableStylesheets && allowCS) {
264
+ style = (style || new CSSStyleSheet());
265
+ if (typeof style === 'string') {
266
+ style = cssText;
267
+ }
268
+ else {
269
+ style.replaceSync(cssText);
270
+ }
271
+ }
272
+ else {
273
+ style = cssText;
274
+ }
275
+ styles.set(scopeId, style);
276
+ };
277
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
278
+ let scopeId = getScopeId(cmpMeta);
279
+ const style = styles.get(scopeId);
280
+ // if an element is NOT connected then getRootNode() will return the wrong root node
281
+ // so the fallback is to always use the document for the root node in those cases
282
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
283
+ if (style) {
284
+ if (typeof style === 'string') {
285
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
286
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
287
+ let styleElm;
288
+ if (!appliedStyles) {
289
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
290
+ }
291
+ if (!appliedStyles.has(scopeId)) {
292
+ {
293
+ {
294
+ styleElm = doc.createElement('style');
295
+ styleElm.innerHTML = style;
296
+ }
297
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
298
+ }
299
+ if (appliedStyles) {
300
+ appliedStyles.add(scopeId);
301
+ }
302
+ }
303
+ }
304
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
305
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
306
+ }
307
+ }
308
+ return scopeId;
309
+ };
310
+ const attachStyles = (hostRef) => {
311
+ const cmpMeta = hostRef.$cmpMeta$;
312
+ const elm = hostRef.$hostElement$;
313
+ const flags = cmpMeta.$flags$;
314
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
315
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
316
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
317
+ // only required when we're NOT using native shadow dom (slot)
318
+ // or this browser doesn't support native shadow dom
319
+ // and this host element was NOT created with SSR
320
+ // let's pick out the inner content for slot projection
321
+ // create a node to represent where the original
322
+ // content was first placed, which is useful later on
323
+ // DOM WRITE!!
324
+ elm['s-sc'] = scopeId;
325
+ elm.classList.add(scopeId + '-h');
326
+ if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
327
+ elm.classList.add(scopeId + '-s');
328
+ }
329
+ }
330
+ endAttachStyles();
331
+ };
332
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
300
333
  /**
301
334
  * Production setAccessor() function based on Preact by
302
335
  * Jason Miller (@developit)
@@ -394,7 +427,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
394
427
  if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
395
428
  try {
396
429
  if (!elm.tagName.includes('-')) {
397
- let n = newValue == null ? '' : newValue;
430
+ const n = newValue == null ? '' : newValue;
398
431
  // Workaround for Safari, moving the <input> caret when re-assigning the same valued
399
432
  if (memberName === 'list') {
400
433
  isProp = false;
@@ -433,7 +466,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
433
466
  }
434
467
  }
435
468
  }
436
- else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
469
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
437
470
  newValue = newValue === true ? '' : newValue;
438
471
  if (xlink) {
439
472
  elm.setAttributeNS(XLINK_NS, memberName, newValue);
@@ -451,7 +484,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
451
484
  // if the element passed in is a shadow root, which is a document fragment
452
485
  // then we want to be adding attrs/props to the shadow root's "host" element
453
486
  // if it's not a shadow root, then we add attrs/props to the same element
454
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
487
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
455
488
  ? newVnode.$elm$.host
456
489
  : newVnode.$elm$;
457
490
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
@@ -469,9 +502,19 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
469
502
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
470
503
  }
471
504
  };
505
+ /**
506
+ * Create a DOM Node corresponding to one of the children of a given VNode.
507
+ *
508
+ * @param oldParentVNode the parent VNode from the previous render
509
+ * @param newParentVNode the parent VNode from the current render
510
+ * @param childIndex the index of the VNode, in the _new_ parent node's
511
+ * children, for which we will create a new DOM node
512
+ * @param parentElm the parent DOM node which our new node will be a child of
513
+ * @returns the newly created node
514
+ */
472
515
  const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
473
516
  // tslint:disable-next-line: prefer-const
474
- let newVNode = newParentVNode.$children$[childIndex];
517
+ const newVNode = newParentVNode.$children$[childIndex];
475
518
  let i = 0;
476
519
  let elm;
477
520
  let childNode;
@@ -486,16 +529,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
486
529
  }
487
530
  newVNode.$flags$ |= newVNode.$children$
488
531
  ? // slot element has fallback content
489
- 2 /* isSlotFallback */
532
+ 2 /* VNODE_FLAGS.isSlotFallback */
490
533
  : // slot element does not have fallback content
491
- 1 /* isSlotReference */;
534
+ 1 /* VNODE_FLAGS.isSlotReference */;
492
535
  }
493
536
  }
494
537
  if (newVNode.$text$ !== null) {
495
538
  // create text node
496
539
  elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
497
540
  }
498
- else if (newVNode.$flags$ & 1 /* isSlotReference */) {
541
+ else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
499
542
  // create a slot reference node
500
543
  elm = newVNode.$elm$ =
501
544
  doc.createTextNode('');
@@ -505,7 +548,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
505
548
  isSvgMode = newVNode.$tag$ === 'svg';
506
549
  }
507
550
  // create element
508
- elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
551
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
509
552
  ? 'slot-fb'
510
553
  : newVNode.$tag$)
511
554
  );
@@ -545,7 +588,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
545
588
  }
546
589
  {
547
590
  elm['s-hn'] = hostTagName;
548
- if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
591
+ if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
549
592
  // remember the content reference comment
550
593
  elm['s-sr'] = true;
551
594
  // remember the content reference comment
@@ -564,7 +607,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
564
607
  return elm;
565
608
  };
566
609
  const putBackInOriginalLocation = (parentElm, recursive) => {
567
- plt.$flags$ |= 1 /* isTmpDisconnected */;
610
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
568
611
  const oldSlotChildNodes = parentElm.childNodes;
569
612
  for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
570
613
  const childNode = oldSlotChildNodes[i];
@@ -585,7 +628,7 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
585
628
  putBackInOriginalLocation(childNode, recursive);
586
629
  }
587
630
  }
588
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
631
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
589
632
  };
590
633
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
591
634
  let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
@@ -627,6 +670,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
627
670
  }
628
671
  }
629
672
  };
673
+ /**
674
+ * Reconcile the children of a new VNode with the children of an old VNode by
675
+ * traversing the two collections of children, identifying nodes that are
676
+ * conserved or changed, calling out to `patch` to make any necessary
677
+ * updates to the DOM, and rearranging DOM nodes as needed.
678
+ *
679
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
680
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
681
+ * 'windows' by storing start and end indices and references to the
682
+ * corresponding array entries. Initially the two 'windows' are basically equal
683
+ * to the entire array, but we progressively narrow the windows until there are
684
+ * no children left to update by doing the following:
685
+ *
686
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
687
+ * that if we have an initial array like the following we'll end up dealing
688
+ * only with a window bounded by the highlighted elements:
689
+ *
690
+ * [null, null, VNode1 , ... , VNode2, null, null]
691
+ * ^^^^^^ ^^^^^^
692
+ *
693
+ * 2. Check to see if the elements at the head and tail positions are equal
694
+ * across the windows. This will basically detect elements which haven't
695
+ * been added, removed, or changed position, i.e. if you had the following
696
+ * VNode elements (represented as HTML):
697
+ *
698
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
699
+ * newVNode: `<div><p><span>THERE</span></p></div>`
700
+ *
701
+ * Then when comparing the children of the `<div>` tag we check the equality
702
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
703
+ * same tag in the same position, we'd be able to avoid completely
704
+ * re-rendering the subtree under them with a new DOM element and would just
705
+ * call out to `patch` to handle reconciling their children and so on.
706
+ *
707
+ * 3. Check, for both windows, to see if the element at the beginning of the
708
+ * window corresponds to the element at the end of the other window. This is
709
+ * a heuristic which will let us identify _some_ situations in which
710
+ * elements have changed position, for instance it _should_ detect that the
711
+ * children nodes themselves have not changed but merely moved in the
712
+ * following example:
713
+ *
714
+ * oldVNode: `<div><element-one /><element-two /></div>`
715
+ * newVNode: `<div><element-two /><element-one /></div>`
716
+ *
717
+ * If we find cases like this then we also need to move the concrete DOM
718
+ * elements corresponding to the moved children to write the re-order to the
719
+ * DOM.
720
+ *
721
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
722
+ * nodes in the old children which have the same key as the first element in
723
+ * our window on the new children. If we find such a node we handle calling
724
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
725
+ * what we find.
726
+ *
727
+ * Finally, once we've narrowed our 'windows' to the point that either of them
728
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
729
+ * insertion or deletion that needs to happen to get a DOM state that correctly
730
+ * reflects the new child VNodes. If, for instance, after our window on the old
731
+ * children has collapsed we still have more nodes on the new children that
732
+ * we haven't dealt with yet then we need to add them, or if the new children
733
+ * collapse but we still have unhandled _old_ children then we need to make
734
+ * sure the corresponding DOM nodes are removed.
735
+ *
736
+ * @param parentElm the node into which the parent VNode is rendered
737
+ * @param oldCh the old children of the parent node
738
+ * @param newVNode the new VNode which will replace the parent
739
+ * @param newCh the new children of the parent node
740
+ */
630
741
  const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
631
742
  let oldStartIdx = 0;
632
743
  let newStartIdx = 0;
@@ -642,7 +753,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
642
753
  let elmToMove;
643
754
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
644
755
  if (oldStartVnode == null) {
645
- // Vnode might have been moved left
756
+ // VNode might have been moved left
646
757
  oldStartVnode = oldCh[++oldStartIdx];
647
758
  }
648
759
  else if (oldEndVnode == null) {
@@ -655,37 +766,100 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
655
766
  newEndVnode = newCh[--newEndIdx];
656
767
  }
657
768
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
769
+ // if the start nodes are the same then we should patch the new VNode
770
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
771
+ // indices to reflect that. We don't need to move any DOM Nodes around
772
+ // since things are matched up in order.
658
773
  patch(oldStartVnode, newStartVnode);
659
774
  oldStartVnode = oldCh[++oldStartIdx];
660
775
  newStartVnode = newCh[++newStartIdx];
661
776
  }
662
777
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
778
+ // likewise, if the end nodes are the same we patch new onto old and
779
+ // decrement our end indices, and also likewise in this case we don't
780
+ // need to move any DOM Nodes.
663
781
  patch(oldEndVnode, newEndVnode);
664
782
  oldEndVnode = oldCh[--oldEndIdx];
665
783
  newEndVnode = newCh[--newEndIdx];
666
784
  }
667
785
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
668
- // Vnode moved right
786
+ // case: "Vnode moved right"
787
+ //
788
+ // We've found that the last node in our window on the new children is
789
+ // the same VNode as the _first_ node in our window on the old children
790
+ // we're dealing with now. Visually, this is the layout of these two
791
+ // nodes:
792
+ //
793
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
794
+ // ^^^^^^^^^^^
795
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
796
+ // ^^^^^^^^^^^^^
797
+ //
798
+ // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
799
+ // and move the DOM element for `oldStartVnode`.
669
800
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
670
801
  putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
671
802
  }
672
803
  patch(oldStartVnode, newEndVnode);
804
+ // We need to move the element for `oldStartVnode` into a position which
805
+ // will be appropriate for `newEndVnode`. For this we can use
806
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
807
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
808
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
809
+ //
810
+ // <old-start-node />
811
+ // <some-intervening-node />
812
+ // <old-end-node />
813
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
814
+ // <next-sibling />
815
+ //
816
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
817
+ // the node for `oldStartVnode` at the end of the children of
818
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
819
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
820
+ // append it to the children of the parent element.
673
821
  parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
674
822
  oldStartVnode = oldCh[++oldStartIdx];
675
823
  newEndVnode = newCh[--newEndIdx];
676
824
  }
677
825
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
678
- // Vnode moved left
826
+ // case: "Vnode moved left"
827
+ //
828
+ // We've found that the first node in our window on the new children is
829
+ // the same VNode as the _last_ node in our window on the old children.
830
+ // Visually, this is the layout of these two nodes:
831
+ //
832
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
833
+ // ^^^^^^^^^^^^^
834
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
835
+ // ^^^^^^^^^^^
836
+ //
837
+ // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
838
+ // (which will handle updating any changed attributes, reconciling their
839
+ // children etc) but we also need to move the DOM node to which
840
+ // `oldEndVnode` corresponds.
679
841
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
680
842
  putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
681
843
  }
682
844
  patch(oldEndVnode, newStartVnode);
845
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
846
+ // the same node, so since we're here we know that they are not. Thus we
847
+ // can move the element for `oldEndVnode` _before_ the element for
848
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
849
+ // future.
683
850
  parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
684
851
  oldEndVnode = oldCh[--oldEndIdx];
685
852
  newStartVnode = newCh[++newStartIdx];
686
853
  }
687
854
  else {
688
- // createKeyToOldIdx
855
+ // Here we do some checks to match up old and new nodes based on the
856
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
857
+ // in the JSX for a DOM element in the implementation of a Stencil
858
+ // component.
859
+ //
860
+ // First we check to see if there are any nodes in the array of old
861
+ // children which have the same key as the first node in the new
862
+ // children.
689
863
  idxInOld = -1;
690
864
  {
691
865
  for (i = oldStartIdx; i <= oldEndIdx; ++i) {
@@ -696,23 +870,32 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
696
870
  }
697
871
  }
698
872
  if (idxInOld >= 0) {
873
+ // We found a node in the old children which matches up with the first
874
+ // node in the new children! So let's deal with that
699
875
  elmToMove = oldCh[idxInOld];
700
876
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
877
+ // the tag doesn't match so we'll need a new DOM element
701
878
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
702
879
  }
703
880
  else {
704
881
  patch(elmToMove, newStartVnode);
882
+ // invalidate the matching old node so that we won't try to update it
883
+ // again later on
705
884
  oldCh[idxInOld] = undefined;
706
885
  node = elmToMove.$elm$;
707
886
  }
708
887
  newStartVnode = newCh[++newStartIdx];
709
888
  }
710
889
  else {
711
- // new element
890
+ // We either didn't find an element in the old children that matches
891
+ // the key of the first new child OR the build is not using `key`
892
+ // attributes at all. In either case we need to create a new element
893
+ // for the new node.
712
894
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
713
895
  newStartVnode = newCh[++newStartIdx];
714
896
  }
715
897
  if (node) {
898
+ // if we created a new node then handle inserting it to the DOM
716
899
  {
717
900
  parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
718
901
  }
@@ -720,21 +903,43 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
720
903
  }
721
904
  }
722
905
  if (oldStartIdx > oldEndIdx) {
906
+ // we have some more new nodes to add which don't match up with old nodes
723
907
  addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
724
908
  }
725
909
  else if (newStartIdx > newEndIdx) {
910
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
911
+ // in the new array, so lets remove them (which entails cleaning up the
912
+ // relevant DOM nodes)
726
913
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
727
914
  }
728
915
  };
729
- const isSameVnode = (vnode1, vnode2) => {
916
+ /**
917
+ * Compare two VNodes to determine if they are the same
918
+ *
919
+ * **NB**: This function is an equality _heuristic_ based on the available
920
+ * information set on the two VNodes and can be misleading under certain
921
+ * circumstances. In particular, if the two nodes do not have `key` attrs
922
+ * (available under `$key$` on VNodes) then the function falls back on merely
923
+ * checking that they have the same tag.
924
+ *
925
+ * So, in other words, if `key` attrs are not set on VNodes which may be
926
+ * changing order within a `children` array or something along those lines then
927
+ * we could obtain a false positive and then have to do needless re-rendering.
928
+ *
929
+ * @param leftVNode the first VNode to check
930
+ * @param rightVNode the second VNode to check
931
+ * @returns whether they're equal or not
932
+ */
933
+ const isSameVnode = (leftVNode, rightVNode) => {
730
934
  // compare if two vnode to see if they're "technically" the same
731
935
  // need to have the same element tag, and same key to be the same
732
- if (vnode1.$tag$ === vnode2.$tag$) {
733
- if (vnode1.$tag$ === 'slot') {
734
- return vnode1.$name$ === vnode2.$name$;
936
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
937
+ if (leftVNode.$tag$ === 'slot') {
938
+ return leftVNode.$name$ === rightVNode.$name$;
735
939
  }
940
+ // this will be set if components in the build have `key` attrs set on them
736
941
  {
737
- return vnode1.$key$ === vnode2.$key$;
942
+ return leftVNode.$key$ === rightVNode.$key$;
738
943
  }
739
944
  }
740
945
  return false;
@@ -747,6 +952,14 @@ const referenceNode = (node) => {
747
952
  return (node && node['s-ol']) || node;
748
953
  };
749
954
  const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
955
+ /**
956
+ * Handle reconciling an outdated VNode with a new one which corresponds to
957
+ * it. This function handles flushing updates to the DOM and reconciling the
958
+ * children of the two nodes (if any).
959
+ *
960
+ * @param oldVNode an old VNode whose DOM element and children we want to update
961
+ * @param newVNode a new VNode representing an updated version of the old one
962
+ */
750
963
  const patch = (oldVNode, newVNode) => {
751
964
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
752
965
  const oldChildren = oldVNode.$children$;
@@ -760,7 +973,6 @@ const patch = (oldVNode, newVNode) => {
760
973
  // only add this to the when the compiler sees we're using an svg somewhere
761
974
  isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
762
975
  }
763
- // element node
764
976
  {
765
977
  if (tag === 'slot')
766
978
  ;
@@ -773,6 +985,7 @@ const patch = (oldVNode, newVNode) => {
773
985
  }
774
986
  if (oldChildren !== null && newChildren !== null) {
775
987
  // looks like there's child vnodes for both the old and new vnodes
988
+ // so we need to call `updateChildren` to reconcile them
776
989
  updateChildren(elm, oldChildren, newVNode, newChildren);
777
990
  }
778
991
  else if (newChildren !== null) {
@@ -804,7 +1017,7 @@ const patch = (oldVNode, newVNode) => {
804
1017
  };
805
1018
  const updateFallbackSlotVisibility = (elm) => {
806
1019
  // tslint:disable-next-line: prefer-const
807
- let childNodes = elm.childNodes;
1020
+ const childNodes = elm.childNodes;
808
1021
  let childNode;
809
1022
  let i;
810
1023
  let ilen;
@@ -813,7 +1026,7 @@ const updateFallbackSlotVisibility = (elm) => {
813
1026
  let nodeType;
814
1027
  for (i = 0, ilen = childNodes.length; i < ilen; i++) {
815
1028
  childNode = childNodes[i];
816
- if (childNode.nodeType === 1 /* ElementNode */) {
1029
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
817
1030
  if (childNode['s-sr']) {
818
1031
  // this is a slot fallback node
819
1032
  // get the slot name for this slot reference node
@@ -825,7 +1038,7 @@ const updateFallbackSlotVisibility = (elm) => {
825
1038
  nodeType = childNodes[j].nodeType;
826
1039
  if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
827
1040
  // this sibling node is from a different component OR is a named fallback slot node
828
- if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
1041
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
829
1042
  childNode.hidden = true;
830
1043
  break;
831
1044
  }
@@ -834,8 +1047,8 @@ const updateFallbackSlotVisibility = (elm) => {
834
1047
  // this is a default fallback slot node
835
1048
  // any element or text node (with content)
836
1049
  // should hide the default fallback slot node
837
- if (nodeType === 1 /* ElementNode */ ||
838
- (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
1050
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
1051
+ (nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
839
1052
  childNode.hidden = true;
840
1053
  break;
841
1054
  }
@@ -857,8 +1070,8 @@ const relocateSlotContent = (elm) => {
857
1070
  let relocateNodeData;
858
1071
  let j;
859
1072
  let i = 0;
860
- let childNodes = elm.childNodes;
861
- let ilen = childNodes.length;
1073
+ const childNodes = elm.childNodes;
1074
+ const ilen = childNodes.length;
862
1075
  for (; i < ilen; i++) {
863
1076
  childNode = childNodes[i];
864
1077
  if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
@@ -913,13 +1126,13 @@ const relocateSlotContent = (elm) => {
913
1126
  }
914
1127
  }
915
1128
  }
916
- if (childNode.nodeType === 1 /* ElementNode */) {
1129
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
917
1130
  relocateSlotContent(childNode);
918
1131
  }
919
1132
  }
920
1133
  };
921
1134
  const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
922
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1135
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
923
1136
  if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
924
1137
  return true;
925
1138
  }
@@ -950,7 +1163,7 @@ const renderVdom = (hostRef, renderFnResults) => {
950
1163
  cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
951
1164
  }
952
1165
  rootVnode.$tag$ = null;
953
- rootVnode.$flags$ |= 4 /* isHost */;
1166
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
954
1167
  hostRef.$vnode$ = rootVnode;
955
1168
  rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
956
1169
  {
@@ -958,7 +1171,7 @@ const renderVdom = (hostRef, renderFnResults) => {
958
1171
  }
959
1172
  {
960
1173
  contentRef = hostElm['s-cr'];
961
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1174
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
962
1175
  // always reset
963
1176
  checkSlotFallbackVisibility = false;
964
1177
  }
@@ -967,7 +1180,7 @@ const renderVdom = (hostRef, renderFnResults) => {
967
1180
  {
968
1181
  // while we're moving nodes around existing nodes, temporarily disable
969
1182
  // the disconnectCallback from working
970
- plt.$flags$ |= 1 /* isTmpDisconnected */;
1183
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
971
1184
  if (checkSlotRelocate) {
972
1185
  relocateSlotContent(rootVnode.$elm$);
973
1186
  let relocateData;
@@ -1025,7 +1238,7 @@ const renderVdom = (hostRef, renderFnResults) => {
1025
1238
  }
1026
1239
  else {
1027
1240
  // this node doesn't have a slot home to go to, so let's hide it
1028
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1241
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1029
1242
  nodeToRelocate.hidden = true;
1030
1243
  }
1031
1244
  }
@@ -1036,37 +1249,11 @@ const renderVdom = (hostRef, renderFnResults) => {
1036
1249
  }
1037
1250
  // done moving nodes around
1038
1251
  // allow the disconnect callback to work again
1039
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1252
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1040
1253
  // always reset
1041
1254
  relocateNodes.length = 0;
1042
1255
  }
1043
1256
  };
1044
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
1045
- const createEvent = (ref, name, flags) => {
1046
- const elm = getElement(ref);
1047
- return {
1048
- emit: (detail) => {
1049
- return emitEvent(elm, name, {
1050
- bubbles: !!(flags & 4 /* Bubbles */),
1051
- composed: !!(flags & 2 /* Composed */),
1052
- cancelable: !!(flags & 1 /* Cancellable */),
1053
- detail,
1054
- });
1055
- },
1056
- };
1057
- };
1058
- /**
1059
- * Helper function to create & dispatch a custom Event on a provided target
1060
- * @param elm the target of the Event
1061
- * @param name the name to give the custom Event
1062
- * @param opts options for configuring a custom Event
1063
- * @returns the custom Event
1064
- */
1065
- const emitEvent = (elm, name, opts) => {
1066
- const ev = plt.ce(name, opts);
1067
- elm.dispatchEvent(ev);
1068
- return ev;
1069
- };
1070
1257
  const attachToAncestor = (hostRef, ancestorComponent) => {
1071
1258
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1072
1259
  ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
@@ -1074,10 +1261,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
1074
1261
  };
1075
1262
  const scheduleUpdate = (hostRef, isInitialLoad) => {
1076
1263
  {
1077
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1264
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1078
1265
  }
1079
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1080
- hostRef.$flags$ |= 512 /* needsRerender */;
1266
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1267
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1081
1268
  return;
1082
1269
  }
1083
1270
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
@@ -1093,7 +1280,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
1093
1280
  let promise;
1094
1281
  if (isInitialLoad) {
1095
1282
  {
1096
- hostRef.$flags$ |= 256 /* isListenReady */;
1283
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1097
1284
  if (hostRef.$queuedListeners$) {
1098
1285
  hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1099
1286
  hostRef.$queuedListeners$ = null;
@@ -1144,7 +1331,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1144
1331
  }
1145
1332
  else {
1146
1333
  Promise.all(childrenPromises).then(postUpdate);
1147
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1334
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1148
1335
  childrenPromises.length = 0;
1149
1336
  }
1150
1337
  }
@@ -1153,10 +1340,10 @@ const callRender = (hostRef, instance, elm) => {
1153
1340
  try {
1154
1341
  instance = instance.render() ;
1155
1342
  {
1156
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1343
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1157
1344
  }
1158
1345
  {
1159
- hostRef.$flags$ |= 2 /* hasRendered */;
1346
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1160
1347
  }
1161
1348
  {
1162
1349
  {
@@ -1183,8 +1370,8 @@ const postUpdateComponent = (hostRef) => {
1183
1370
  {
1184
1371
  safeCall(instance, 'componentDidRender');
1185
1372
  }
1186
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1187
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1373
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1374
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1188
1375
  {
1189
1376
  // DOM WRITE!
1190
1377
  addHydratedFlag(elm);
@@ -1216,10 +1403,10 @@ const postUpdateComponent = (hostRef) => {
1216
1403
  hostRef.$onRenderResolve$();
1217
1404
  hostRef.$onRenderResolve$ = undefined;
1218
1405
  }
1219
- if (hostRef.$flags$ & 512 /* needsRerender */) {
1406
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1220
1407
  nextTick(() => scheduleUpdate(hostRef, false));
1221
1408
  }
1222
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1409
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1223
1410
  }
1224
1411
  // ( •_•)
1225
1412
  // ( •_•)>⌐■-■
@@ -1249,30 +1436,6 @@ const then = (promise, thenFn) => {
1249
1436
  };
1250
1437
  const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1251
1438
  ;
1252
- const parsePropertyValue = (propValue, propType) => {
1253
- // ensure this value is of the correct prop type
1254
- if (propValue != null && !isComplexType(propValue)) {
1255
- if (propType & 4 /* Boolean */) {
1256
- // per the HTML spec, any string value means it is a boolean true value
1257
- // but we'll cheat here and say that the string "false" is the boolean false
1258
- return propValue === 'false' ? false : propValue === '' || !!propValue;
1259
- }
1260
- if (propType & 2 /* Number */) {
1261
- // force it to be a number
1262
- return parseFloat(propValue);
1263
- }
1264
- if (propType & 1 /* String */) {
1265
- // could have been passed as a number or boolean
1266
- // but we still want it as a string
1267
- return String(propValue);
1268
- }
1269
- // redundant return here for better minification
1270
- return propValue;
1271
- }
1272
- // not sure exactly what type we want
1273
- // so no need to change to a different type
1274
- return propValue;
1275
- };
1276
1439
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1277
1440
  const setValue = (ref, propName, newVal, cmpMeta) => {
1278
1441
  // check our new property value against our internal value
@@ -1282,13 +1445,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1282
1445
  const flags = hostRef.$flags$;
1283
1446
  const instance = hostRef.$lazyInstance$ ;
1284
1447
  newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1285
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
1448
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1449
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1450
+ const didValueChange = newVal !== oldVal && !areBothNaN;
1451
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1286
1452
  // gadzooks! the property's value has changed!!
1287
1453
  // set our new value!
1288
1454
  hostRef.$instanceValues$.set(propName, newVal);
1289
1455
  if (instance) {
1290
1456
  // get an array of method names of watch functions to call
1291
- if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1457
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1292
1458
  const watchMethods = cmpMeta.$watchers$[propName];
1293
1459
  if (watchMethods) {
1294
1460
  // this instance is watching for when this property changed
@@ -1303,7 +1469,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1303
1469
  });
1304
1470
  }
1305
1471
  }
1306
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1472
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1307
1473
  // looks like this value actually changed, so we've got work to do!
1308
1474
  // but only if we've already rendered, otherwise just chill out
1309
1475
  // queue that we need to do an update, but don't worry about queuing
@@ -1313,6 +1479,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1313
1479
  }
1314
1480
  }
1315
1481
  };
1482
+ /**
1483
+ * Attach a series of runtime constructs to a compiled Stencil component
1484
+ * constructor, including getters and setters for the `@Prop` and `@State`
1485
+ * decorators, callbacks for when attributes change, and so on.
1486
+ *
1487
+ * @param Cstr the constructor for a component that we need to process
1488
+ * @param cmpMeta metadata collected previously about the component
1489
+ * @param flags a number used to store a series of bit flags
1490
+ * @returns a reference to the same constructor passed in (but now mutated)
1491
+ */
1316
1492
  const proxyComponent = (Cstr, cmpMeta, flags) => {
1317
1493
  if (cmpMeta.$members$) {
1318
1494
  if (Cstr.watchers) {
@@ -1322,8 +1498,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1322
1498
  const members = Object.entries(cmpMeta.$members$);
1323
1499
  const prototype = Cstr.prototype;
1324
1500
  members.map(([memberName, [memberFlags]]) => {
1325
- if ((memberFlags & 31 /* Prop */ ||
1326
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1501
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1502
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1327
1503
  // proxyComponent - prop
1328
1504
  Object.defineProperty(prototype, memberName, {
1329
1505
  get() {
@@ -1338,8 +1514,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1338
1514
  enumerable: true,
1339
1515
  });
1340
1516
  }
1341
- else if (flags & 1 /* isElementConstructor */ &&
1342
- memberFlags & 64 /* Method */) {
1517
+ else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1518
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1343
1519
  // proxyComponent - method
1344
1520
  Object.defineProperty(prototype, memberName, {
1345
1521
  value(...args) {
@@ -1349,7 +1525,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1349
1525
  });
1350
1526
  }
1351
1527
  });
1352
- if ((flags & 1 /* isElementConstructor */)) {
1528
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1353
1529
  const attrNameToPropName = new Map();
1354
1530
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1355
1531
  plt.jmp(() => {
@@ -1405,11 +1581,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1405
1581
  // create an array of attributes to observe
1406
1582
  // and also create a map of html attribute name to js property name
1407
1583
  Cstr.observedAttributes = members
1408
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1584
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1409
1585
  .map(([propName, m]) => {
1410
1586
  const attrName = m[1] || propName;
1411
1587
  attrNameToPropName.set(attrName, propName);
1412
- if (m[0] & 512 /* ReflectAttr */) {
1588
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1413
1589
  cmpMeta.$attrsToReflect$.push([propName, attrName]);
1414
1590
  }
1415
1591
  return attrName;
@@ -1420,10 +1596,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1420
1596
  };
1421
1597
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1422
1598
  // initializeComponent
1423
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1599
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1424
1600
  {
1425
1601
  // we haven't initialized this element yet
1426
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1602
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1427
1603
  // lazy loaded components
1428
1604
  // request the component's implementation to be
1429
1605
  // wired up with the host element
@@ -1441,7 +1617,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1441
1617
  {
1442
1618
  cmpMeta.$watchers$ = Cstr.watchers;
1443
1619
  }
1444
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1620
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1445
1621
  Cstr.isProxied = true;
1446
1622
  }
1447
1623
  const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
@@ -1449,7 +1625,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1449
1625
  // but let's keep track of when we start and stop
1450
1626
  // so that the getters/setters don't incorrectly step on data
1451
1627
  {
1452
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1628
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1453
1629
  }
1454
1630
  // construct the lazy-loaded component implementation
1455
1631
  // passing the hostRef is very important during
@@ -1462,10 +1638,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1462
1638
  consoleError(e);
1463
1639
  }
1464
1640
  {
1465
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1641
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1466
1642
  }
1467
1643
  {
1468
- hostRef.$flags$ |= 128 /* isWatchReady */;
1644
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1469
1645
  }
1470
1646
  endNewInstance();
1471
1647
  }
@@ -1475,7 +1651,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1475
1651
  const scopeId = getScopeId(cmpMeta);
1476
1652
  if (!styles.has(scopeId)) {
1477
1653
  const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1478
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1654
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1479
1655
  endRegisterStyles();
1480
1656
  }
1481
1657
  }
@@ -1497,19 +1673,19 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1497
1673
  }
1498
1674
  };
1499
1675
  const connectedCallback = (elm) => {
1500
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1676
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1501
1677
  const hostRef = getHostRef(elm);
1502
1678
  const cmpMeta = hostRef.$cmpMeta$;
1503
1679
  const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1504
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1680
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1505
1681
  // first time this component has connected
1506
- hostRef.$flags$ |= 1 /* hasConnected */;
1682
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1507
1683
  {
1508
1684
  // initUpdate
1509
1685
  // if the slot polyfill is required we'll need to put some nodes
1510
1686
  // in here to act as original content anchors as we move nodes around
1511
1687
  // host element has been connected to the DOM
1512
- if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1688
+ if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
1513
1689
  setContentReference(elm);
1514
1690
  }
1515
1691
  }
@@ -1532,7 +1708,7 @@ const connectedCallback = (elm) => {
1532
1708
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1533
1709
  if (cmpMeta.$members$) {
1534
1710
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1535
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1711
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1536
1712
  const value = elm[memberName];
1537
1713
  delete elm[memberName];
1538
1714
  elm[memberName] = value;
@@ -1564,7 +1740,7 @@ const setContentReference = (elm) => {
1564
1740
  elm.insertBefore(contentRefElm, elm.firstChild);
1565
1741
  };
1566
1742
  const disconnectedCallback = (elm) => {
1567
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1743
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1568
1744
  const hostRef = getHostRef(elm);
1569
1745
  const instance = hostRef.$lazyInstance$ ;
1570
1746
  {
@@ -1619,7 +1795,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1619
1795
  super(self);
1620
1796
  self = this;
1621
1797
  registerHost(self, cmpMeta);
1622
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1798
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1623
1799
  // this component is using shadow dom
1624
1800
  // and this browser supports shadow dom
1625
1801
  // add the read-only property "shadowRoot" to the host element
@@ -1654,7 +1830,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1654
1830
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
1655
1831
  if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1656
1832
  cmpTags.push(tagName);
1657
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1833
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1658
1834
  }
1659
1835
  });
1660
1836
  });
@@ -1676,11 +1852,43 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1676
1852
  // Fallback appLoad event
1677
1853
  endBootstrap();
1678
1854
  };
1679
- const getAssetPath = (path) => {
1680
- const assetUrl = new URL(path, plt.$resourcesUrl$);
1681
- return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
1855
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1856
+ if (listeners) {
1857
+ listeners.map(([flags, name, method]) => {
1858
+ const target = getHostListenerTarget(elm, flags) ;
1859
+ const handler = hostListenerProxy(hostRef, method);
1860
+ const opts = hostListenerOpts(flags);
1861
+ plt.ael(target, name, handler, opts);
1862
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1863
+ });
1864
+ }
1682
1865
  };
1683
- const hostRefs = new WeakMap();
1866
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1867
+ try {
1868
+ {
1869
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
1870
+ // instance is ready, let's call it's member method for this event
1871
+ hostRef.$lazyInstance$[methodName](ev);
1872
+ }
1873
+ else {
1874
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1875
+ }
1876
+ }
1877
+ }
1878
+ catch (e) {
1879
+ consoleError(e);
1880
+ }
1881
+ };
1882
+ const getHostListenerTarget = (elm, flags) => {
1883
+ if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
1884
+ return doc;
1885
+ if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
1886
+ return win;
1887
+ return elm;
1888
+ };
1889
+ // prettier-ignore
1890
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1891
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1684
1892
  const getHostRef = (ref) => hostRefs.get(ref);
1685
1893
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1686
1894
  const registerHost = (elm, cmpMeta) => {
@@ -1712,7 +1920,9 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1712
1920
  if (module) {
1713
1921
  return module[exportName];
1714
1922
  }
1923
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1715
1924
  return import(
1925
+ /* @vite-ignore */
1716
1926
  /* webpackInclude: /\.entry\.js$/ */
1717
1927
  /* webpackExclude: /\.system\.entry\.js$/ */
1718
1928
  /* webpackMode: "lazy" */
@@ -1723,14 +1933,35 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1723
1933
  return importedModule[exportName];
1724
1934
  }, consoleError);
1725
1935
  };
1726
- const styles = new Map();
1936
+ const styles = /*@__PURE__*/ new Map();
1937
+ const win = typeof window !== 'undefined' ? window : {};
1938
+ const doc = win.document || { head: {} };
1939
+ const plt = {
1940
+ $flags$: 0,
1941
+ $resourcesUrl$: '',
1942
+ jmp: (h) => h(),
1943
+ raf: (h) => requestAnimationFrame(h),
1944
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1945
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1946
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1947
+ };
1948
+ const promiseResolve = (v) => Promise.resolve(v);
1949
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1950
+ try {
1951
+ new CSSStyleSheet();
1952
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1953
+ }
1954
+ catch (e) { }
1955
+ return false;
1956
+ })()
1957
+ ;
1727
1958
  const queueDomReads = [];
1728
1959
  const queueDomWrites = [];
1729
1960
  const queueTask = (queue, write) => (cb) => {
1730
1961
  queue.push(cb);
1731
1962
  if (!queuePending) {
1732
1963
  queuePending = true;
1733
- if (write && plt.$flags$ & 4 /* queueSync */) {
1964
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1734
1965
  nextTick(flush);
1735
1966
  }
1736
1967
  else {