@content-blocks/js 0.3.2

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