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