@scania/tegel 0.0.1-beta

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