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