@duetds/components 6.2.4 → 6.2.6

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 (645) hide show
  1. package/hydrate/index.d.ts +1 -1
  2. package/hydrate/index.js +2385 -4366
  3. package/lib/cjs/{dom-96576bce.js → dom-bcfa684c.js} +1 -1
  4. package/lib/cjs/duet-action-button.cjs.entry.js +14 -77
  5. package/lib/cjs/duet-alert.cjs.entry.js +10 -42
  6. package/lib/cjs/duet-badge.cjs.entry.js +1 -10
  7. package/lib/cjs/duet-breadcrumb.cjs.entry.js +2 -10
  8. package/lib/cjs/duet-breadcrumbs.cjs.entry.js +2 -4
  9. package/lib/cjs/duet-button_2.cjs.entry.js +30 -119
  10. package/lib/cjs/duet-caption_4.cjs.entry.js +4 -78
  11. package/lib/cjs/duet-card.cjs.entry.js +16 -55
  12. package/lib/cjs/duet-checkbox.cjs.entry.js +21 -49
  13. package/lib/cjs/duet-choice_2.cjs.entry.js +52 -153
  14. package/lib/cjs/duet-collapsible.cjs.entry.js +8 -41
  15. package/lib/cjs/duet-combobox.cjs.entry.js +26 -50
  16. package/lib/cjs/duet-cookie-consent.cjs.entry.js +3 -9
  17. package/lib/cjs/duet-date-picker.cjs.entry.js +37 -108
  18. package/lib/cjs/duet-divider_2.cjs.entry.js +1 -17
  19. package/lib/cjs/duet-editable-table_3.cjs.entry.js +163 -404
  20. package/lib/cjs/duet-empty-state.cjs.entry.js +1 -10
  21. package/lib/cjs/duet-fieldset.cjs.entry.js +8 -14
  22. package/lib/cjs/duet-footer.cjs.entry.js +13 -42
  23. package/lib/cjs/duet-grid_2.cjs.entry.js +3 -43
  24. package/lib/cjs/duet-header_2.cjs.entry.js +56 -163
  25. package/lib/cjs/duet-hero.cjs.entry.js +15 -90
  26. package/lib/cjs/duet-icon.cjs.entry.js +4 -35
  27. package/lib/cjs/duet-input_2.cjs.entry.js +41 -115
  28. package/lib/cjs/duet-layout.cjs.entry.js +1 -24
  29. package/lib/cjs/duet-list_2.cjs.entry.js +1 -23
  30. package/lib/cjs/duet-menu-bar-dropdown-link.cjs.entry.js +15 -11
  31. package/lib/cjs/duet-menu-bar-dropdown.cjs.entry.js +28 -26
  32. package/lib/cjs/duet-menu-bar-link.cjs.entry.js +22 -12
  33. package/lib/cjs/duet-menu-bar.cjs.entry.js +6 -8
  34. package/lib/cjs/duet-modal.cjs.entry.js +4 -59
  35. package/lib/cjs/duet-multiselect.cjs.entry.js +18 -59
  36. package/lib/cjs/duet-nav.cjs.entry.js +2 -83
  37. package/lib/cjs/duet-notification_2.cjs.entry.js +15 -74
  38. package/lib/cjs/duet-number-input.cjs.entry.js +53 -142
  39. package/lib/cjs/duet-pagination_2.cjs.entry.js +51 -125
  40. package/lib/cjs/duet-progress.cjs.entry.js +4 -26
  41. package/lib/cjs/duet-radio_2.cjs.entry.js +36 -84
  42. package/lib/cjs/duet-range-slider.cjs.entry.js +21 -62
  43. package/lib/cjs/duet-scrollable_3.cjs.entry.js +25 -88
  44. package/lib/cjs/duet-section-layout.cjs.entry.js +1 -7
  45. package/lib/cjs/duet-select.cjs.entry.js +25 -65
  46. package/lib/cjs/duet-step_2.cjs.entry.js +8 -34
  47. package/lib/cjs/duet-submenu-bar-dropdown-link.cjs.entry.js +43 -0
  48. package/lib/cjs/duet-submenu-bar-dropdown.cjs.entry.js +51 -0
  49. package/lib/cjs/duet-submenu-bar-link.cjs.entry.js +37 -0
  50. package/lib/cjs/duet-submenu-bar.cjs.entry.js +35 -0
  51. package/lib/cjs/duet-textarea.cjs.entry.js +31 -79
  52. package/lib/cjs/duet-toggle.cjs.entry.js +15 -38
  53. package/lib/cjs/duet-toolbar-dropdown-link.cjs.entry.js +1 -13
  54. package/lib/cjs/duet-toolbar-dropdown.cjs.entry.js +11 -28
  55. package/lib/cjs/duet-toolbar-link.cjs.entry.js +2 -14
  56. package/lib/cjs/duet-toolbar.cjs.entry.js +2 -5
  57. package/lib/cjs/duet-tooltip.cjs.entry.js +25 -77
  58. package/lib/cjs/duet-tray.cjs.entry.js +11 -53
  59. package/lib/cjs/duet-upload-aria-status.cjs.entry.js +8 -29
  60. package/lib/cjs/duet-visually-hidden.cjs.entry.js +1 -1
  61. package/lib/cjs/duet.cjs.js +4 -4
  62. package/lib/cjs/{focus-utils-25247ce1.js → focus-utils-0d18f24e.js} +1 -1
  63. package/lib/cjs/{index-e009343b.js → index-14a34a4b.js} +1438 -1235
  64. package/lib/cjs/loader.cjs.js +3 -3
  65. package/lib/cjs/{shadow-css-38b9e725.js → shadow-css-1ea48714.js} +1 -1
  66. package/lib/collection/collection-manifest.json +8 -8
  67. package/lib/collection/common/a11y-component.js +0 -3
  68. package/lib/collection/common/form-components.js +0 -3
  69. package/lib/collection/components/duet-action-button/duet-action-button.js +403 -461
  70. package/lib/collection/components/duet-alert/duet-alert.js +259 -289
  71. package/lib/collection/components/duet-badge/duet-badge.js +84 -89
  72. package/lib/collection/components/duet-breadcrumbs/duet-breadcrumb.js +96 -101
  73. package/lib/collection/components/duet-breadcrumbs/duet-breadcrumbs.js +47 -48
  74. package/lib/collection/components/duet-button/duet-button.js +838 -912
  75. package/lib/collection/components/duet-caption/duet-caption.js +96 -103
  76. package/lib/collection/components/duet-card/duet-card.js +381 -431
  77. package/lib/collection/components/duet-checkbox/duet-checkbox.js +476 -498
  78. package/lib/collection/components/duet-choice/duet-choice.css +6 -1
  79. package/lib/collection/components/duet-choice/duet-choice.js +731 -819
  80. package/lib/collection/components/duet-choice-group/duet-choice-group.js +282 -308
  81. package/lib/collection/components/duet-collapsible/duet-collapsible.js +208 -237
  82. package/lib/collection/components/duet-combobox/duet-combobox-select-single.js +1 -5
  83. package/lib/collection/components/duet-combobox/duet-combobox-select.js +1 -3
  84. package/lib/collection/components/duet-combobox/duet-combobox.css +47 -14
  85. package/lib/collection/components/duet-combobox/duet-combobox.js +257 -269
  86. package/lib/collection/components/duet-cookie-consent/duet-cookie-consent.js +77 -82
  87. package/lib/collection/components/duet-date-picker/date-picker-day.js +1 -3
  88. package/lib/collection/components/duet-date-picker/date-picker-input.js +1 -12
  89. package/lib/collection/components/duet-date-picker/date-picker-month.js +6 -12
  90. package/lib/collection/components/duet-date-picker/duet-date-picker.js +703 -795
  91. package/lib/collection/components/duet-divider/duet-divider.js +57 -57
  92. package/lib/collection/components/duet-editable-table/duet-editable-table.js +316 -381
  93. package/lib/collection/components/duet-empty-state/duet-empty-state.js +83 -90
  94. package/lib/collection/components/duet-fieldset/duet-fieldset.css +2 -0
  95. package/lib/collection/components/duet-fieldset/duet-fieldset.js +143 -153
  96. package/lib/collection/components/duet-footer/duet-footer.js +337 -378
  97. package/lib/collection/components/duet-grid/duet-grid.js +149 -162
  98. package/lib/collection/components/duet-grid-item/duet-grid-item.js +153 -164
  99. package/lib/collection/components/duet-header/duet-header-dropdown.js +11 -19
  100. package/lib/collection/components/duet-header/duet-header-hamburger.js +1 -5
  101. package/lib/collection/components/duet-header/duet-header-icon.js +1 -2
  102. package/lib/collection/components/duet-header/duet-header.js +872 -1023
  103. package/lib/collection/components/duet-heading/duet-heading.js +183 -200
  104. package/lib/collection/components/duet-hero/duet-hero.js +568 -660
  105. package/lib/collection/components/duet-icon/duet-icon.js +240 -263
  106. package/lib/collection/components/duet-input/duet-input.js +937 -1009
  107. package/lib/collection/components/duet-label/duet-label.js +95 -100
  108. package/lib/collection/components/duet-layout/duet-layout.js +163 -189
  109. package/lib/collection/components/duet-link/duet-link.js +204 -223
  110. package/lib/collection/components/duet-list/duet-list.js +181 -196
  111. package/lib/collection/components/duet-list-item/duet-list-item.js +12 -12
  112. package/lib/collection/components/duet-logo/duet-logo.js +171 -190
  113. package/lib/collection/components/duet-menu-bar/duet-menu-bar.css +8 -1
  114. package/lib/collection/components/duet-menu-bar/duet-menu-bar.js +62 -43
  115. package/lib/collection/components/duet-menu-bar-dropdown/duet-menu-bar-dropdown.css +4 -3
  116. package/lib/collection/components/duet-menu-bar-dropdown/duet-menu-bar-dropdown.js +110 -120
  117. package/lib/collection/components/duet-menu-bar-dropdown-link/duet-menu-bar-dropdown-link.css +10 -2
  118. package/lib/collection/components/duet-menu-bar-dropdown-link/duet-menu-bar-dropdown-link.js +105 -80
  119. package/lib/collection/components/duet-menu-bar-link/duet-menu-bar-link.css +47 -7
  120. package/lib/collection/components/duet-menu-bar-link/duet-menu-bar-link.js +108 -77
  121. package/lib/collection/components/duet-modal/duet-modal.js +466 -520
  122. package/lib/collection/components/duet-multiselect/duet-multiselect.js +411 -454
  123. package/lib/collection/components/duet-nav/duet-nav.css +5 -0
  124. package/lib/collection/components/duet-nav/duet-nav.js +38 -152
  125. package/lib/collection/components/duet-notification/duet-notification.js +201 -231
  126. package/lib/collection/components/duet-notification-drawer/duet-notification-drawer.js +284 -312
  127. package/lib/collection/components/duet-number-input/duet-number-input.js +851 -944
  128. package/lib/collection/components/duet-pagination/duet-pagination.js +374 -439
  129. package/lib/collection/components/duet-paragraph/duet-paragraph.js +140 -154
  130. package/lib/collection/components/duet-progress/duet-progress.js +223 -253
  131. package/lib/collection/components/duet-radio/duet-radio.js +519 -531
  132. package/lib/collection/components/duet-radio-group/duet-radio-group.js +282 -308
  133. package/lib/collection/components/duet-range-slider/duet-range-slider.js +468 -505
  134. package/lib/collection/components/duet-range-stepper/duet-range-stepper.js +187 -204
  135. package/lib/collection/components/duet-scrollable/duet-scrollable.js +98 -106
  136. package/lib/collection/components/duet-section-layout/duet-section-layout.js +58 -61
  137. package/lib/collection/components/duet-select/duet-select.js +565 -606
  138. package/lib/collection/components/duet-spacer/duet-spacer.js +77 -81
  139. package/lib/collection/components/duet-spinner/duet-spinner.js +99 -107
  140. package/lib/collection/components/duet-step/duet-step.js +206 -219
  141. package/lib/collection/components/duet-stepper/duet-stepper.js +148 -156
  142. package/lib/collection/components/duet-submenu-bar/duet-submenu-bar.css +37 -0
  143. package/lib/collection/components/duet-submenu-bar/duet-submenu-bar.js +63 -0
  144. package/lib/collection/components/{duet-menu-bar-menu-dropdown/duet-menu-bar-menu-dropdown.css → duet-submenu-bar-dropdown/duet-submenu-bar-dropdown.css} +28 -18
  145. package/lib/collection/components/duet-submenu-bar-dropdown/duet-submenu-bar-dropdown.js +124 -0
  146. package/lib/collection/components/{duet-menu-bar-menu-dropdown-link/duet-menu-bar-menu-dropdown-link.css → duet-submenu-bar-dropdown-link/duet-submenu-bar-dropdown-link.css} +6 -6
  147. package/lib/collection/components/duet-submenu-bar-dropdown-link/duet-submenu-bar-dropdown-link.js +143 -0
  148. package/lib/collection/components/{duet-menu-bar-menu-link/duet-menu-bar-menu-link.css → duet-submenu-bar-link/duet-submenu-bar-link.css} +5 -17
  149. package/lib/collection/components/duet-submenu-bar-link/duet-submenu-bar-link.js +101 -0
  150. package/lib/collection/components/duet-tab/duet-tab.js +95 -96
  151. package/lib/collection/components/duet-tab-group/duet-tab-group.js +367 -405
  152. package/lib/collection/components/duet-table/duet-table.js +144 -160
  153. package/lib/collection/components/duet-textarea/duet-textarea.js +694 -747
  154. package/lib/collection/components/duet-toggle/duet-toggle.js +388 -404
  155. package/lib/collection/components/duet-toolbar/duet-toolbar.css +1 -0
  156. package/lib/collection/components/duet-toolbar/duet-toolbar.js +38 -38
  157. package/lib/collection/components/duet-toolbar-dropdown/duet-toolbar-dropdown.css +2 -3
  158. package/lib/collection/components/duet-toolbar-dropdown/duet-toolbar-dropdown.js +116 -145
  159. package/lib/collection/components/duet-toolbar-dropdown-link/duet-toolbar-dropdown-link.js +93 -102
  160. package/lib/collection/components/duet-toolbar-link/duet-toolbar-link.js +89 -98
  161. package/lib/collection/components/duet-tooltip/duet-tooltip.js +349 -401
  162. package/lib/collection/components/duet-tray/duet-tray.js +235 -276
  163. package/lib/collection/components/duet-upload/duet-upload.js +1371 -1549
  164. package/lib/collection/components/duet-upload/upload-editable-item-error.js +1 -6
  165. package/lib/collection/components/duet-upload/upload-editable-item-inprogres.js +1 -6
  166. package/lib/collection/components/duet-upload/upload-editable-item-pending.js +1 -4
  167. package/lib/collection/components/duet-upload/upload-editable-item-success.js +5 -21
  168. package/lib/collection/components/duet-upload-aria-status/duet-upload-aria-status.js +137 -153
  169. package/lib/collection/components/duet-visually-hidden/duet-visually-hidden.js +12 -9
  170. package/lib/dist-custom-elements/duet-action-button.js +1 -1
  171. package/lib/dist-custom-elements/duet-alert.js +1 -1
  172. package/lib/dist-custom-elements/duet-badge.js +1 -1
  173. package/lib/dist-custom-elements/duet-breadcrumb.js +3 -11
  174. package/lib/dist-custom-elements/duet-breadcrumbs.js +3 -5
  175. package/lib/dist-custom-elements/duet-button.js +1 -1
  176. package/lib/dist-custom-elements/duet-caption.js +1 -1
  177. package/lib/dist-custom-elements/duet-card.js +19 -58
  178. package/lib/dist-custom-elements/duet-checkbox.js +1 -1
  179. package/lib/dist-custom-elements/duet-choice-group.js +19 -49
  180. package/lib/dist-custom-elements/duet-choice.js +43 -114
  181. package/lib/dist-custom-elements/duet-collapsible.js +10 -43
  182. package/lib/dist-custom-elements/duet-combobox.js +29 -59
  183. package/lib/dist-custom-elements/duet-cookie-consent.js +8 -14
  184. package/lib/dist-custom-elements/duet-date-picker.js +45 -116
  185. package/lib/dist-custom-elements/duet-divider.js +1 -1
  186. package/lib/dist-custom-elements/duet-editable-table.js +1 -1
  187. package/lib/dist-custom-elements/duet-empty-state.js +1 -1
  188. package/lib/dist-custom-elements/duet-fieldset.js +1 -1
  189. package/lib/dist-custom-elements/duet-footer.js +16 -45
  190. package/lib/dist-custom-elements/duet-grid-item.js +1 -1
  191. package/lib/dist-custom-elements/duet-grid.js +1 -1
  192. package/lib/dist-custom-elements/duet-header.js +65 -152
  193. package/lib/dist-custom-elements/duet-heading.js +1 -1
  194. package/lib/dist-custom-elements/duet-hero.js +23 -98
  195. package/lib/dist-custom-elements/duet-icon.js +1 -1
  196. package/lib/dist-custom-elements/duet-input.js +1 -1
  197. package/lib/dist-custom-elements/duet-label.js +1 -1
  198. package/lib/dist-custom-elements/duet-layout.js +1 -24
  199. package/lib/dist-custom-elements/duet-link.js +1 -1
  200. package/lib/dist-custom-elements/duet-list-item.js +1 -1
  201. package/lib/dist-custom-elements/duet-list.js +1 -1
  202. package/lib/dist-custom-elements/duet-logo.js +1 -1
  203. package/lib/dist-custom-elements/duet-menu-bar-dropdown-link.js +18 -13
  204. package/lib/dist-custom-elements/duet-menu-bar-dropdown.js +30 -28
  205. package/lib/dist-custom-elements/duet-menu-bar-link.js +24 -13
  206. package/lib/dist-custom-elements/duet-menu-bar.js +9 -10
  207. package/lib/dist-custom-elements/duet-modal.js +10 -65
  208. package/lib/dist-custom-elements/duet-multiselect.js +25 -66
  209. package/lib/dist-custom-elements/duet-nav.js +3 -84
  210. package/lib/dist-custom-elements/duet-notification-drawer.js +18 -48
  211. package/lib/dist-custom-elements/duet-notification.js +2 -31
  212. package/lib/dist-custom-elements/duet-number-input.js +59 -148
  213. package/lib/dist-custom-elements/duet-pagination.js +51 -101
  214. package/lib/dist-custom-elements/duet-paragraph.js +1 -1
  215. package/lib/dist-custom-elements/duet-progress.js +1 -1
  216. package/lib/dist-custom-elements/duet-radio-group.js +19 -49
  217. package/lib/dist-custom-elements/duet-radio.js +23 -41
  218. package/lib/dist-custom-elements/duet-range-slider.js +23 -64
  219. package/lib/dist-custom-elements/duet-range-stepper.js +10 -34
  220. package/lib/dist-custom-elements/duet-scrollable.js +1 -1
  221. package/lib/dist-custom-elements/duet-section-layout.js +1 -7
  222. package/lib/dist-custom-elements/duet-select.js +1 -1
  223. package/lib/dist-custom-elements/duet-spacer.js +1 -1
  224. package/lib/dist-custom-elements/duet-spinner.js +1 -1
  225. package/lib/dist-custom-elements/duet-step.js +11 -20
  226. package/lib/dist-custom-elements/duet-stepper.js +2 -19
  227. package/lib/dist-custom-elements/duet-submenu-bar-dropdown-link.d.ts +11 -0
  228. package/lib/dist-custom-elements/duet-submenu-bar-dropdown-link.js +69 -0
  229. package/lib/dist-custom-elements/duet-submenu-bar-dropdown.d.ts +11 -0
  230. package/lib/dist-custom-elements/duet-submenu-bar-dropdown.js +75 -0
  231. package/lib/dist-custom-elements/{duet-menu-bar-menu-link.d.ts → duet-submenu-bar-link.d.ts} +4 -4
  232. package/lib/dist-custom-elements/duet-submenu-bar-link.js +61 -0
  233. package/lib/dist-custom-elements/{duet-menu-bar-menu.d.ts → duet-submenu-bar.d.ts} +4 -4
  234. package/lib/dist-custom-elements/duet-submenu-bar.js +51 -0
  235. package/lib/dist-custom-elements/duet-tab-group.js +26 -72
  236. package/lib/dist-custom-elements/duet-tab.js +3 -9
  237. package/lib/dist-custom-elements/duet-table.js +1 -1
  238. package/lib/dist-custom-elements/duet-textarea.js +38 -86
  239. package/lib/dist-custom-elements/duet-toggle.js +16 -39
  240. package/lib/dist-custom-elements/duet-toolbar-dropdown-link.js +2 -14
  241. package/lib/dist-custom-elements/duet-toolbar-dropdown.js +13 -30
  242. package/lib/dist-custom-elements/duet-toolbar-link.js +3 -15
  243. package/lib/dist-custom-elements/duet-toolbar.js +2 -5
  244. package/lib/dist-custom-elements/duet-tooltip.js +1 -1
  245. package/lib/dist-custom-elements/duet-tray.js +14 -56
  246. package/lib/dist-custom-elements/duet-upload-aria-status.js +1 -1
  247. package/lib/dist-custom-elements/duet-upload.js +165 -332
  248. package/lib/dist-custom-elements/duet-visually-hidden.js +1 -1
  249. package/lib/dist-custom-elements/index.d.ts +75 -5
  250. package/lib/dist-custom-elements/index.js +76 -1
  251. package/lib/dist-custom-elements/{p-dcffd5be.js → p-0145dc9f.js} +1 -7
  252. package/lib/dist-custom-elements/{p-0938933e.js → p-029208b5.js} +20 -71
  253. package/lib/dist-custom-elements/{p-f674e164.js → p-076044f7.js} +17 -80
  254. package/lib/dist-custom-elements/{p-c5d74817.js → p-0bc5bea3.js} +2 -22
  255. package/lib/dist-custom-elements/{p-b4b809ff.js → p-11621a52.js} +33 -109
  256. package/lib/dist-custom-elements/{p-bd4ab88c.js → p-1c5a0ab0.js} +21 -49
  257. package/lib/dist-custom-elements/{p-70d1ca9f.js → p-2d3fc462.js} +1 -1
  258. package/lib/dist-custom-elements/{p-396cb7a5.js → p-2f9f54eb.js} +9 -30
  259. package/lib/dist-custom-elements/{p-8c0cf877.js → p-31b3a82e.js} +27 -79
  260. package/lib/dist-custom-elements/{p-29b4f008.js → p-3b1bc8f3.js} +5 -26
  261. package/lib/dist-custom-elements/{p-c4165359.js → p-4905133d.js} +1 -13
  262. package/lib/dist-custom-elements/{p-0347f9ec.js → p-49d5f105.js} +1 -1
  263. package/lib/dist-custom-elements/{p-1302f6e8.js → p-52471a7a.js} +5 -27
  264. package/lib/dist-custom-elements/{p-9ed347f9.js → p-535ce3ec.js} +1 -1
  265. package/lib/dist-custom-elements/{p-33e00967.js → p-55325c49.js} +1 -1
  266. package/lib/dist-custom-elements/{p-279dedcd.js → p-5846a06a.js} +2 -11
  267. package/lib/dist-custom-elements/{p-e57df145.js → p-626f0ed7.js} +2 -25
  268. package/lib/dist-custom-elements/{p-c4d8cad0.js → p-738bd3c5.js} +1 -1
  269. package/lib/dist-custom-elements/{p-862c60cc.js → p-7b1b2eef.js} +3 -16
  270. package/lib/dist-custom-elements/{p-6e81048c.js → p-88b72658.js} +30 -70
  271. package/lib/dist-custom-elements/{p-908c1151.js → p-91098fd5.js} +5 -36
  272. package/lib/dist-custom-elements/{p-0b8f16f1.js → p-9986919d.js} +1 -1
  273. package/lib/dist-custom-elements/{p-3fa8edce.js → p-9d08c707.js} +45 -111
  274. package/lib/dist-custom-elements/{p-4367369a.js → p-a1724291.js} +475 -272
  275. package/lib/dist-custom-elements/{p-b89983b2.js → p-a5f24f49.js} +1 -10
  276. package/lib/dist-custom-elements/{p-ed503468.js → p-ab04760e.js} +3 -20
  277. package/lib/dist-custom-elements/{p-2a509b17.js → p-becb3aa3.js} +2 -21
  278. package/lib/dist-custom-elements/{p-1fef1f90.js → p-cc5bc0c6.js} +9 -15
  279. package/lib/dist-custom-elements/{p-464a80f2.js → p-ce42be86.js} +1 -23
  280. package/lib/dist-custom-elements/{p-e987e04b.js → p-d188f26e.js} +1 -11
  281. package/lib/dist-custom-elements/{p-4bb2e37b.js → p-db985827.js} +6 -17
  282. package/lib/dist-custom-elements/{p-d4c234ed.js → p-e2cd1c98.js} +1 -1
  283. package/lib/dist-custom-elements/{p-b9058029.js → p-e4a60f42.js} +8 -0
  284. package/lib/dist-custom-elements/{p-9cfc3bee.js → p-e4c2e7eb.js} +14 -46
  285. package/lib/dist-custom-elements/{p-1f03397c.js → p-f079cc55.js} +7 -30
  286. package/lib/dist-custom-elements/{p-f51d88cc.js → p-f4d2face.js} +2 -10
  287. package/lib/dist-custom-elements/{p-ca2b02bc.js → p-fe5341bf.js} +3 -25
  288. package/lib/duet/duet.esm.js +1 -1
  289. package/lib/duet/duet.js +2 -1
  290. package/lib/duet/{p-61baccc6.system.entry.js → p-01a95d2f.system.entry.js} +1 -1
  291. package/lib/duet/p-06a4aee0.system.entry.js +4 -0
  292. package/lib/duet/{p-3b31184e.js → p-07970d29.js} +0 -0
  293. package/lib/duet/p-07a46bc0.entry.js +4 -0
  294. package/lib/duet/p-0818ae38.entry.js +4 -0
  295. package/lib/duet/{p-a5dcf047.entry.js → p-08f88403.entry.js} +1 -1
  296. package/lib/duet/{p-2cf9ce9f.system.entry.js → p-140c2b23.system.entry.js} +2 -2
  297. package/lib/duet/{p-e60b3dc2.entry.js → p-16665db1.entry.js} +1 -1
  298. package/lib/duet/{p-a585455c.system.entry.js → p-16803126.system.entry.js} +1 -1
  299. package/lib/duet/{p-71f1a210.system.entry.js → p-18bdd586.system.entry.js} +1 -1
  300. package/lib/duet/p-1bde084c.entry.js +4 -0
  301. package/lib/duet/p-1c8bd070.system.entry.js +4 -0
  302. package/lib/duet/p-1d75f8c8.system.entry.js +4 -0
  303. package/lib/duet/{p-eb94a92c.system.entry.js → p-1f1ce7cb.system.entry.js} +1 -1
  304. package/lib/duet/{p-21e8b3cb.system.entry.js → p-250c73cb.system.entry.js} +1 -1
  305. package/lib/duet/p-25bbc964.system.entry.js +4 -0
  306. package/lib/duet/p-2821969c.system.entry.js +4 -0
  307. package/lib/duet/{p-a5f977bc.system.entry.js → p-2ddfb202.system.entry.js} +2 -2
  308. package/lib/duet/{p-995fe7b5.entry.js → p-2e21973b.entry.js} +1 -1
  309. package/lib/duet/p-321b7e1b.entry.js +4 -0
  310. package/lib/duet/{p-71e54f66.system.entry.js → p-38c7c72f.system.entry.js} +1 -1
  311. package/lib/duet/{p-ace82109.system.entry.js → p-3d2b34f3.system.entry.js} +2 -2
  312. package/lib/duet/{p-4c7ae11f.system.entry.js → p-3e4a074c.system.entry.js} +1 -1
  313. package/lib/duet/p-3e4cfd2d.entry.js +4 -0
  314. package/lib/duet/p-428f4378.entry.js +4 -0
  315. package/lib/duet/p-44fb0cd4.entry.js +4 -0
  316. package/lib/duet/{p-15b79ed1.entry.js → p-453bb082.entry.js} +1 -1
  317. package/lib/duet/{p-465c7f64.system.entry.js → p-476affb5.system.entry.js} +1 -1
  318. package/lib/duet/p-498a337c.entry.js +4 -0
  319. package/lib/duet/p-49f74a78.system.entry.js +4 -0
  320. package/lib/duet/p-4afc265b.entry.js +4 -0
  321. package/lib/duet/p-4bf9ce5d.entry.js +4 -0
  322. package/lib/duet/{p-14e5b2e7.system.entry.js → p-4d7701cf.system.entry.js} +1 -1
  323. package/lib/duet/p-4e5a7d50.entry.js +4 -0
  324. package/lib/duet/{p-32c587da.entry.js → p-4e669043.entry.js} +1 -1
  325. package/lib/duet/p-52b1ae9c.entry.js +4 -0
  326. package/lib/duet/{p-870e88b7.system.entry.js → p-589d18c0.system.entry.js} +1 -1
  327. package/lib/duet/{p-daa920e3.system.entry.js → p-5be0eb10.system.entry.js} +1 -1
  328. package/lib/duet/p-5d2799c7.system.entry.js +4 -0
  329. package/lib/duet/p-5d3d3ef4.entry.js +4 -0
  330. package/lib/duet/p-5ffa7084.entry.js +4 -0
  331. package/lib/duet/p-61208b24.system.entry.js +4 -0
  332. package/lib/duet/p-665fc09a.entry.js +4 -0
  333. package/lib/duet/{p-fe87f458.system.entry.js → p-6801edc9.system.entry.js} +1 -1
  334. package/lib/duet/{p-fc200674.system.entry.js → p-68802a44.system.entry.js} +2 -2
  335. package/lib/duet/p-6ba131a6.entry.js +4 -0
  336. package/lib/duet/{p-d164cdeb.system.entry.js → p-6dcb5ddf.system.entry.js} +1 -1
  337. package/lib/duet/{p-2bcf54bb.entry.js → p-71669602.entry.js} +1 -1
  338. package/lib/duet/p-71b48d4c.entry.js +4 -0
  339. package/lib/duet/{p-b668b67c.system.js → p-73900354.system.js} +0 -0
  340. package/lib/duet/p-73b840aa.entry.js +4 -0
  341. package/lib/duet/{p-caf8cc5f.system.entry.js → p-7758cfac.system.entry.js} +2 -2
  342. package/lib/duet/p-79740f92.entry.js +4 -0
  343. package/lib/duet/p-7aa97a75.js +5 -0
  344. package/lib/duet/{p-66f1bdce.entry.js → p-7c171bac.entry.js} +1 -1
  345. package/lib/duet/p-7d6c1aee.entry.js +4 -0
  346. package/lib/duet/p-7e2dd844.system.entry.js +4 -0
  347. package/lib/duet/p-7e3dd6a8.system.entry.js +4 -0
  348. package/lib/duet/p-80b2336e.entry.js +4 -0
  349. package/lib/duet/p-80e9768b.entry.js +4 -0
  350. package/lib/duet/p-80ee2e1e.entry.js +4 -0
  351. package/lib/duet/p-821b780e.entry.js +4 -0
  352. package/lib/duet/{p-f8133fe1.system.entry.js → p-86cc218e.system.entry.js} +2 -2
  353. package/lib/duet/{p-7ea15c5c.system.entry.js → p-882e9987.system.entry.js} +1 -1
  354. package/lib/duet/p-88cd99ba.entry.js +4 -0
  355. package/lib/duet/{p-eb168145.system.js → p-8b50f74e.system.js} +1 -1
  356. package/lib/duet/p-8bf3f0e9.js +4 -0
  357. package/lib/duet/p-92867eb0.entry.js +4 -0
  358. package/lib/duet/{p-e1dc6e7f.system.entry.js → p-93825b5f.system.entry.js} +1 -1
  359. package/lib/duet/p-9663117c.entry.js +4 -0
  360. package/lib/duet/{p-93138df9.entry.js → p-96c274ff.entry.js} +1 -1
  361. package/lib/duet/p-98821736.entry.js +4 -0
  362. package/lib/duet/{p-1c2bc99b.system.entry.js → p-99577e5e.system.entry.js} +1 -1
  363. package/lib/duet/{p-9ea3b585.system.entry.js → p-9ab64b1c.system.entry.js} +2 -2
  364. package/lib/duet/{p-5a61c374.system.entry.js → p-9adf9ec0.system.entry.js} +1 -1
  365. package/lib/duet/p-9b946c8f.system.entry.js +4 -0
  366. package/lib/duet/p-9ba30a52.system.entry.js +4 -0
  367. package/lib/duet/p-9c0ae091.system.js +5 -0
  368. package/lib/duet/{p-a2d89ed8.system.entry.js → p-9f02fd3a.system.entry.js} +1 -1
  369. package/lib/duet/p-a03ec953.system.entry.js +4 -0
  370. package/lib/duet/{p-aa10446f.system.entry.js → p-a238f10c.system.entry.js} +1 -1
  371. package/lib/duet/p-a259e3da.system.entry.js +4 -0
  372. package/lib/duet/p-a345635b.system.entry.js +4 -0
  373. package/lib/duet/p-a5a7be5e.entry.js +4 -0
  374. package/lib/duet/{p-b09e3f47.system.entry.js → p-a5af4cc5.system.entry.js} +1 -1
  375. package/lib/duet/{p-c8ba8ed5.system.entry.js → p-b20f40db.system.entry.js} +1 -1
  376. package/lib/duet/p-b21e895c.entry.js +4 -0
  377. package/lib/duet/{p-0734bdd5.system.entry.js → p-b31232db.system.entry.js} +1 -1
  378. package/lib/duet/{p-5d9ec5ef.entry.js → p-b3fd554a.entry.js} +1 -1
  379. package/lib/duet/p-b5ee9c33.system.entry.js +4 -0
  380. package/lib/duet/{p-ed024bd6.entry.js → p-b624c8ec.entry.js} +1 -1
  381. package/lib/duet/{p-617872b5.system.entry.js → p-b68e7921.system.entry.js} +1 -1
  382. package/lib/duet/p-b8adb02e.entry.js +4 -0
  383. package/lib/duet/{p-37b5759b.entry.js → p-bb33769c.entry.js} +1 -1
  384. package/lib/duet/p-bfab9d81.entry.js +4 -0
  385. package/lib/duet/{p-fc2cda87.system.entry.js → p-c33cfdf4.system.entry.js} +2 -2
  386. package/lib/duet/p-c346b2c2.system.entry.js +4 -0
  387. package/lib/duet/{p-fe0cb2a5.entry.js → p-ccae1572.entry.js} +1 -1
  388. package/lib/duet/p-cdbad668.system.js +4 -0
  389. package/lib/duet/{p-41110e9b.system.entry.js → p-ce6d729c.system.entry.js} +1 -1
  390. package/lib/duet/{p-ce3fc2bd.entry.js → p-cf202e49.entry.js} +1 -1
  391. package/lib/duet/p-d3a8e2e6.entry.js +4 -0
  392. package/lib/duet/{p-176c64c4.system.entry.js → p-d3b1d4dc.system.entry.js} +1 -1
  393. package/lib/duet/p-d6045a19.entry.js +4 -0
  394. package/lib/duet/{p-a629e72a.system.entry.js → p-d64a3684.system.entry.js} +1 -1
  395. package/lib/duet/{p-ff46ec81.system.js → p-da0d4ee3.system.js} +0 -0
  396. package/lib/duet/p-daa9f332.system.entry.js +4 -0
  397. package/lib/duet/{p-436b415a.system.entry.js → p-dd594b0c.system.entry.js} +1 -1
  398. package/lib/duet/{p-15743dbe.system.entry.js → p-df2f8d6d.system.entry.js} +1 -1
  399. package/lib/duet/{p-d4c234ed.js → p-e2cd1c98.js} +0 -0
  400. package/lib/duet/p-e2f77664.entry.js +4 -0
  401. package/lib/duet/p-e651e225.entry.js +4 -0
  402. package/lib/duet/p-e6f8fb38.entry.js +4 -0
  403. package/lib/duet/p-e78f9d3b.entry.js +4 -0
  404. package/lib/duet/p-e8da082b.entry.js +4 -0
  405. package/lib/duet/{p-fc34b8a0.system.entry.js → p-e9259242.system.entry.js} +1 -1
  406. package/lib/duet/p-ea769354.entry.js +4 -0
  407. package/lib/duet/{p-67a7ac4f.entry.js → p-efbe9082.entry.js} +1 -1
  408. package/lib/duet/{p-8755500b.entry.js → p-f17dd3be.entry.js} +1 -1
  409. package/lib/duet/{p-ad0cf0f5.system.entry.js → p-f1d8bc66.system.entry.js} +2 -2
  410. package/lib/duet/p-f3f652cb.entry.js +4 -0
  411. package/lib/duet/{p-db64d031.system.entry.js → p-f6665a9b.system.entry.js} +1 -1
  412. package/lib/duet/p-fb7e3c61.entry.js +4 -0
  413. package/lib/esm/{dom-3dbcb0d8.js → dom-4d9c03f4.js} +1 -1
  414. package/lib/esm/duet-action-button.entry.js +14 -77
  415. package/lib/esm/duet-alert.entry.js +10 -42
  416. package/lib/esm/duet-badge.entry.js +1 -10
  417. package/lib/esm/duet-breadcrumb.entry.js +2 -10
  418. package/lib/esm/duet-breadcrumbs.entry.js +2 -4
  419. package/lib/esm/duet-button_2.entry.js +30 -119
  420. package/lib/esm/duet-caption_4.entry.js +4 -78
  421. package/lib/esm/duet-card.entry.js +16 -55
  422. package/lib/esm/duet-checkbox.entry.js +21 -49
  423. package/lib/esm/duet-choice_2.entry.js +52 -153
  424. package/lib/esm/duet-collapsible.entry.js +8 -41
  425. package/lib/esm/duet-combobox.entry.js +26 -50
  426. package/lib/esm/duet-cookie-consent.entry.js +3 -9
  427. package/lib/esm/duet-date-picker.entry.js +37 -108
  428. package/lib/esm/duet-divider_2.entry.js +1 -17
  429. package/lib/esm/duet-editable-table_3.entry.js +163 -404
  430. package/lib/esm/duet-empty-state.entry.js +1 -10
  431. package/lib/esm/duet-fieldset.entry.js +8 -14
  432. package/lib/esm/duet-footer.entry.js +13 -42
  433. package/lib/esm/duet-grid_2.entry.js +3 -43
  434. package/lib/esm/duet-header_2.entry.js +56 -163
  435. package/lib/esm/duet-hero.entry.js +15 -90
  436. package/lib/esm/duet-icon.entry.js +4 -35
  437. package/lib/esm/duet-input_2.entry.js +41 -115
  438. package/lib/esm/duet-layout.entry.js +1 -24
  439. package/lib/esm/duet-list_2.entry.js +1 -23
  440. package/lib/esm/duet-menu-bar-dropdown-link.entry.js +15 -11
  441. package/lib/esm/duet-menu-bar-dropdown.entry.js +28 -26
  442. package/lib/esm/duet-menu-bar-link.entry.js +22 -12
  443. package/lib/esm/duet-menu-bar.entry.js +6 -8
  444. package/lib/esm/duet-modal.entry.js +4 -59
  445. package/lib/esm/duet-multiselect.entry.js +18 -59
  446. package/lib/esm/duet-nav.entry.js +2 -83
  447. package/lib/esm/duet-notification_2.entry.js +15 -74
  448. package/lib/esm/duet-number-input.entry.js +53 -142
  449. package/lib/esm/duet-pagination_2.entry.js +51 -125
  450. package/lib/esm/duet-progress.entry.js +4 -26
  451. package/lib/esm/duet-radio_2.entry.js +36 -84
  452. package/lib/esm/duet-range-slider.entry.js +21 -62
  453. package/lib/esm/duet-scrollable_3.entry.js +25 -88
  454. package/lib/esm/duet-section-layout.entry.js +1 -7
  455. package/lib/esm/duet-select.entry.js +25 -65
  456. package/lib/esm/duet-step_2.entry.js +8 -34
  457. package/lib/esm/duet-submenu-bar-dropdown-link.entry.js +39 -0
  458. package/lib/esm/duet-submenu-bar-dropdown.entry.js +47 -0
  459. package/lib/esm/duet-submenu-bar-link.entry.js +33 -0
  460. package/lib/esm/duet-submenu-bar.entry.js +31 -0
  461. package/lib/esm/duet-textarea.entry.js +31 -79
  462. package/lib/esm/duet-toggle.entry.js +15 -38
  463. package/lib/esm/duet-toolbar-dropdown-link.entry.js +1 -13
  464. package/lib/esm/duet-toolbar-dropdown.entry.js +11 -28
  465. package/lib/esm/duet-toolbar-link.entry.js +2 -14
  466. package/lib/esm/duet-toolbar.entry.js +2 -5
  467. package/lib/esm/duet-tooltip.entry.js +25 -77
  468. package/lib/esm/duet-tray.entry.js +11 -53
  469. package/lib/esm/duet-upload-aria-status.entry.js +8 -29
  470. package/lib/esm/duet-visually-hidden.entry.js +1 -1
  471. package/lib/esm/duet.js +4 -4
  472. package/lib/esm/{focus-utils-c6e25a2b.js → focus-utils-25584abb.js} +1 -1
  473. package/lib/esm/{index-adbabdb3.js → index-f74e4d6a.js} +1438 -1235
  474. package/lib/esm/loader.js +3 -3
  475. package/lib/esm/polyfills/css-shim.js +1 -1
  476. package/lib/esm/{shadow-css-501eda9a.js → shadow-css-a011f1fe.js} +1 -1
  477. package/lib/esm-es5/{dom-3dbcb0d8.js → dom-4d9c03f4.js} +0 -0
  478. package/lib/esm-es5/duet-action-button.entry.js +1 -1
  479. package/lib/esm-es5/duet-alert.entry.js +1 -1
  480. package/lib/esm-es5/duet-badge.entry.js +1 -1
  481. package/lib/esm-es5/duet-breadcrumb.entry.js +1 -1
  482. package/lib/esm-es5/duet-breadcrumbs.entry.js +2 -2
  483. package/lib/esm-es5/duet-button_2.entry.js +2 -2
  484. package/lib/esm-es5/duet-caption_4.entry.js +1 -1
  485. package/lib/esm-es5/duet-card.entry.js +1 -1
  486. package/lib/esm-es5/duet-checkbox.entry.js +2 -2
  487. package/lib/esm-es5/duet-choice_2.entry.js +2 -2
  488. package/lib/esm-es5/duet-collapsible.entry.js +2 -2
  489. package/lib/esm-es5/duet-combobox.entry.js +2 -2
  490. package/lib/esm-es5/duet-cookie-consent.entry.js +1 -1
  491. package/lib/esm-es5/duet-date-picker.entry.js +1 -1
  492. package/lib/esm-es5/duet-divider_2.entry.js +1 -1
  493. package/lib/esm-es5/duet-editable-table_3.entry.js +2 -2
  494. package/lib/esm-es5/duet-empty-state.entry.js +1 -1
  495. package/lib/esm-es5/duet-fieldset.entry.js +1 -1
  496. package/lib/esm-es5/duet-footer.entry.js +2 -2
  497. package/lib/esm-es5/duet-grid_2.entry.js +1 -1
  498. package/lib/esm-es5/duet-header_2.entry.js +2 -2
  499. package/lib/esm-es5/duet-hero.entry.js +1 -1
  500. package/lib/esm-es5/duet-icon.entry.js +2 -2
  501. package/lib/esm-es5/duet-input_2.entry.js +1 -1
  502. package/lib/esm-es5/duet-layout.entry.js +1 -1
  503. package/lib/esm-es5/duet-list_2.entry.js +1 -1
  504. package/lib/esm-es5/duet-menu-bar-dropdown-link.entry.js +1 -1
  505. package/lib/esm-es5/duet-menu-bar-dropdown.entry.js +1 -1
  506. package/lib/esm-es5/duet-menu-bar-link.entry.js +1 -1
  507. package/lib/esm-es5/duet-menu-bar.entry.js +1 -1
  508. package/lib/esm-es5/duet-modal.entry.js +2 -2
  509. package/lib/esm-es5/duet-multiselect.entry.js +1 -1
  510. package/lib/esm-es5/duet-nav.entry.js +1 -1
  511. package/lib/esm-es5/duet-notification_2.entry.js +1 -1
  512. package/lib/esm-es5/duet-number-input.entry.js +1 -1
  513. package/lib/esm-es5/duet-pagination_2.entry.js +1 -1
  514. package/lib/esm-es5/duet-progress.entry.js +1 -1
  515. package/lib/esm-es5/duet-radio_2.entry.js +1 -1
  516. package/lib/esm-es5/duet-range-slider.entry.js +1 -1
  517. package/lib/esm-es5/duet-scrollable_3.entry.js +2 -2
  518. package/lib/esm-es5/duet-section-layout.entry.js +1 -1
  519. package/lib/esm-es5/duet-select.entry.js +2 -2
  520. package/lib/esm-es5/duet-step_2.entry.js +1 -1
  521. package/lib/esm-es5/duet-submenu-bar-dropdown-link.entry.js +4 -0
  522. package/lib/esm-es5/duet-submenu-bar-dropdown.entry.js +4 -0
  523. package/lib/esm-es5/duet-submenu-bar-link.entry.js +4 -0
  524. package/lib/esm-es5/duet-submenu-bar.entry.js +4 -0
  525. package/lib/esm-es5/duet-textarea.entry.js +1 -1
  526. package/lib/esm-es5/duet-toggle.entry.js +2 -2
  527. package/lib/esm-es5/duet-toolbar-dropdown-link.entry.js +1 -1
  528. package/lib/esm-es5/duet-toolbar-dropdown.entry.js +1 -1
  529. package/lib/esm-es5/duet-toolbar-link.entry.js +1 -1
  530. package/lib/esm-es5/duet-toolbar.entry.js +1 -1
  531. package/lib/esm-es5/duet-tooltip.entry.js +2 -2
  532. package/lib/esm-es5/duet-tray.entry.js +1 -1
  533. package/lib/esm-es5/duet-upload-aria-status.entry.js +1 -1
  534. package/lib/esm-es5/duet-visually-hidden.entry.js +1 -1
  535. package/lib/esm-es5/duet.js +1 -1
  536. package/lib/esm-es5/focus-utils-25584abb.js +4 -0
  537. package/lib/esm-es5/index-f74e4d6a.js +5 -0
  538. package/lib/esm-es5/loader.js +1 -1
  539. package/lib/esm-es5/{shadow-css-501eda9a.js → shadow-css-a011f1fe.js} +0 -0
  540. package/lib/loader/package.json +1 -0
  541. package/lib/types/components/duet-combobox/duet-combobox.d.ts +1 -2
  542. package/lib/types/components/duet-menu-bar/duet-menu-bar.d.ts +4 -0
  543. package/lib/types/components/duet-menu-bar-dropdown/duet-menu-bar-dropdown.d.ts +2 -16
  544. package/lib/types/components/duet-menu-bar-dropdown-link/duet-menu-bar-dropdown-link.d.ts +5 -0
  545. package/lib/types/components/duet-menu-bar-link/duet-menu-bar-link.d.ts +5 -0
  546. package/lib/types/components/duet-nav/duet-nav.d.ts +0 -18
  547. package/lib/types/components/duet-submenu-bar/duet-submenu-bar.d.ts +24 -0
  548. package/lib/types/components/duet-submenu-bar-dropdown/duet-submenu-bar-dropdown.d.ts +34 -0
  549. package/lib/types/components/{duet-menu-bar-menu-dropdown-link/duet-menu-bar-menu-dropdown-link.d.ts → duet-submenu-bar-dropdown-link/duet-submenu-bar-dropdown-link.d.ts} +1 -1
  550. package/lib/types/components/{duet-menu-bar-menu-link/duet-menu-bar-menu-link.d.ts → duet-submenu-bar-link/duet-submenu-bar-link.d.ts} +1 -5
  551. package/lib/types/components/duet-toolbar-dropdown/duet-toolbar-dropdown.d.ts +1 -16
  552. package/lib/types/components.d.ts +158 -194
  553. package/lib/types/stencil-public-runtime.d.ts +20 -4
  554. package/package.json +8 -10
  555. package/lib/cjs/duet-menu-bar-menu-dropdown-link.cjs.entry.js +0 -58
  556. package/lib/cjs/duet-menu-bar-menu-dropdown.cjs.entry.js +0 -65
  557. package/lib/cjs/duet-menu-bar-menu-link.cjs.entry.js +0 -50
  558. package/lib/cjs/duet-menu-bar-menu.cjs.entry.js +0 -65
  559. package/lib/collection/components/duet-menu-bar-menu/duet-menu-bar-menu.css +0 -113
  560. package/lib/collection/components/duet-menu-bar-menu/duet-menu-bar-menu.js +0 -147
  561. package/lib/collection/components/duet-menu-bar-menu-dropdown/duet-menu-bar-menu-dropdown.js +0 -150
  562. package/lib/collection/components/duet-menu-bar-menu-dropdown-link/duet-menu-bar-menu-dropdown-link.js +0 -156
  563. package/lib/collection/components/duet-menu-bar-menu-link/duet-menu-bar-menu-link.js +0 -129
  564. package/lib/dist-custom-elements/duet-menu-bar-menu-dropdown-link.d.ts +0 -11
  565. package/lib/dist-custom-elements/duet-menu-bar-menu-dropdown-link.js +0 -84
  566. package/lib/dist-custom-elements/duet-menu-bar-menu-dropdown.d.ts +0 -11
  567. package/lib/dist-custom-elements/duet-menu-bar-menu-dropdown.js +0 -89
  568. package/lib/dist-custom-elements/duet-menu-bar-menu-link.js +0 -75
  569. package/lib/dist-custom-elements/duet-menu-bar-menu.js +0 -83
  570. package/lib/duet/p-03ac8c12.entry.js +0 -4
  571. package/lib/duet/p-0b0b1a31.js +0 -4
  572. package/lib/duet/p-1b3fc470.system.entry.js +0 -4
  573. package/lib/duet/p-1b4da2a6.entry.js +0 -4
  574. package/lib/duet/p-22793750.entry.js +0 -4
  575. package/lib/duet/p-2482298d.entry.js +0 -4
  576. package/lib/duet/p-2be7affe.system.entry.js +0 -4
  577. package/lib/duet/p-2e2eca0e.entry.js +0 -4
  578. package/lib/duet/p-2e71b284.system.js +0 -4
  579. package/lib/duet/p-3198246d.system.entry.js +0 -4
  580. package/lib/duet/p-31a8380d.entry.js +0 -4
  581. package/lib/duet/p-3d96bd35.entry.js +0 -4
  582. package/lib/duet/p-48d5c614.entry.js +0 -4
  583. package/lib/duet/p-4fd9fab5.entry.js +0 -4
  584. package/lib/duet/p-526c88d9.system.entry.js +0 -4
  585. package/lib/duet/p-570786a7.system.entry.js +0 -4
  586. package/lib/duet/p-5bbac6e9.system.entry.js +0 -4
  587. package/lib/duet/p-5be11a3f.entry.js +0 -4
  588. package/lib/duet/p-6198dd87.entry.js +0 -4
  589. package/lib/duet/p-6226ebc9.entry.js +0 -4
  590. package/lib/duet/p-6ef4c26f.system.entry.js +0 -4
  591. package/lib/duet/p-73b1bfff.system.js +0 -5
  592. package/lib/duet/p-74a85e06.entry.js +0 -4
  593. package/lib/duet/p-74edab4b.system.entry.js +0 -4
  594. package/lib/duet/p-7ac15184.system.entry.js +0 -4
  595. package/lib/duet/p-7e0d3659.entry.js +0 -4
  596. package/lib/duet/p-8e12f166.entry.js +0 -4
  597. package/lib/duet/p-8e83ab80.entry.js +0 -4
  598. package/lib/duet/p-925f5739.entry.js +0 -4
  599. package/lib/duet/p-9e5192fd.entry.js +0 -4
  600. package/lib/duet/p-a4575910.entry.js +0 -4
  601. package/lib/duet/p-a57f8242.entry.js +0 -4
  602. package/lib/duet/p-aeee20b5.system.entry.js +0 -4
  603. package/lib/duet/p-b0fa24ea.system.entry.js +0 -4
  604. package/lib/duet/p-b252c6c7.entry.js +0 -4
  605. package/lib/duet/p-b28b7458.entry.js +0 -4
  606. package/lib/duet/p-bb2dab53.system.entry.js +0 -4
  607. package/lib/duet/p-bbc7c22c.js +0 -5
  608. package/lib/duet/p-bce4669c.entry.js +0 -4
  609. package/lib/duet/p-bf165746.entry.js +0 -4
  610. package/lib/duet/p-bf4e00b1.system.entry.js +0 -4
  611. package/lib/duet/p-c0732300.system.entry.js +0 -4
  612. package/lib/duet/p-c4375ca3.entry.js +0 -4
  613. package/lib/duet/p-c4f57811.entry.js +0 -4
  614. package/lib/duet/p-cd5358ce.entry.js +0 -4
  615. package/lib/duet/p-d1da9fe1.system.entry.js +0 -4
  616. package/lib/duet/p-d448c7fc.system.entry.js +0 -4
  617. package/lib/duet/p-d770b87e.entry.js +0 -4
  618. package/lib/duet/p-d7d944f5.entry.js +0 -4
  619. package/lib/duet/p-d7fa0c7c.entry.js +0 -4
  620. package/lib/duet/p-d83f8247.entry.js +0 -4
  621. package/lib/duet/p-dc9b21ad.entry.js +0 -4
  622. package/lib/duet/p-dcf2df11.entry.js +0 -4
  623. package/lib/duet/p-de024983.entry.js +0 -4
  624. package/lib/duet/p-e01e9f71.entry.js +0 -4
  625. package/lib/duet/p-e7196c1b.system.entry.js +0 -4
  626. package/lib/duet/p-e7808045.entry.js +0 -4
  627. package/lib/duet/p-e9cf0568.entry.js +0 -4
  628. package/lib/duet/p-ebbe496d.entry.js +0 -4
  629. package/lib/duet/p-f015180c.entry.js +0 -4
  630. package/lib/duet/p-f084d355.system.entry.js +0 -4
  631. package/lib/duet/p-f0e4ccb6.entry.js +0 -4
  632. package/lib/duet/p-f0f8a1fd.entry.js +0 -4
  633. package/lib/duet/p-f5149c67.entry.js +0 -4
  634. package/lib/esm/duet-menu-bar-menu-dropdown-link.entry.js +0 -54
  635. package/lib/esm/duet-menu-bar-menu-dropdown.entry.js +0 -61
  636. package/lib/esm/duet-menu-bar-menu-link.entry.js +0 -46
  637. package/lib/esm/duet-menu-bar-menu.entry.js +0 -61
  638. package/lib/esm-es5/duet-menu-bar-menu-dropdown-link.entry.js +0 -4
  639. package/lib/esm-es5/duet-menu-bar-menu-dropdown.entry.js +0 -4
  640. package/lib/esm-es5/duet-menu-bar-menu-link.entry.js +0 -4
  641. package/lib/esm-es5/duet-menu-bar-menu.entry.js +0 -4
  642. package/lib/esm-es5/focus-utils-c6e25a2b.js +0 -4
  643. package/lib/esm-es5/index-adbabdb3.js +0 -5
  644. package/lib/types/components/duet-menu-bar-menu/duet-menu-bar-menu.d.ts +0 -49
  645. package/lib/types/components/duet-menu-bar-menu-dropdown/duet-menu-bar-menu-dropdown.d.ts +0 -49
@@ -2,8 +2,16 @@
2
2
  * Built with Duet Design System
3
3
  */
4
4
  const NAMESPACE = 'duet';
5
- const Env = /* duet */ {"cdnURILocal":"http://0.0.0.0:3334","cdnURIProd":"https://cdn.duetds.com/api","duetIconVersion":"3.0.12"};
5
+ const Env = /* duet */ {"cdnURILocal":"http://0.0.0.0:3334","cdnURIProd":"https://cdn.duetds.com/api","duetIconVersion":"3.0.14"};
6
6
 
7
+ /**
8
+ * Virtual DOM patching algorithm based on Snabbdom by
9
+ * Simon Friis Vindum (@paldepind)
10
+ * Licensed under the MIT License
11
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
12
+ *
13
+ * Modified for Stencil's renderer and slot projection
14
+ */
7
15
  let scopeId;
8
16
  let contentRef;
9
17
  let hostTagName;
@@ -12,76 +20,12 @@ let checkSlotFallbackVisibility = false;
12
20
  let checkSlotRelocate = false;
13
21
  let isSvgMode = false;
14
22
  let queuePending = false;
15
- const win = typeof window !== 'undefined' ? window : {};
16
- const doc = win.document || { head: {} };
17
- const plt = {
18
- $flags$: 0,
19
- $resourcesUrl$: '',
20
- jmp: (h) => h(),
21
- raf: (h) => requestAnimationFrame(h),
22
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
23
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
24
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
25
- };
26
- const supportsShadow = /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
27
- ;
28
- const promiseResolve = (v) => Promise.resolve(v);
29
- const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
30
- try {
31
- new CSSStyleSheet();
32
- return typeof new CSSStyleSheet().replace === 'function';
33
- }
34
- catch (e) { }
35
- return false;
36
- })()
37
- ;
38
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
39
- if (listeners) {
40
- listeners.map(([flags, name, method]) => {
41
- const target = getHostListenerTarget(elm, flags) ;
42
- const handler = hostListenerProxy(hostRef, method);
43
- const opts = hostListenerOpts(flags);
44
- plt.ael(target, name, handler, opts);
45
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
46
- });
47
- }
48
- };
49
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
50
- try {
51
- {
52
- if (hostRef.$flags$ & 256 /* isListenReady */) {
53
- // instance is ready, let's call it's member method for this event
54
- hostRef.$lazyInstance$[methodName](ev);
55
- }
56
- else {
57
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
58
- }
59
- }
60
- }
61
- catch (e) {
62
- consoleError(e);
63
- }
64
- };
65
- const getHostListenerTarget = (elm, flags) => {
66
- if (flags & 4 /* TargetDocument */)
67
- return doc;
68
- if (flags & 8 /* TargetWindow */)
69
- return win;
70
- if (flags & 16 /* TargetBody */)
71
- return doc.body;
72
- return elm;
23
+ const Build = {
24
+ isDev: false,
25
+ isBrowser: true,
26
+ isServer: false,
27
+ isTesting: false,
73
28
  };
74
- // prettier-ignore
75
- const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
76
- const CONTENT_REF_ID = 'r';
77
- const ORG_LOCATION_ID = 'o';
78
- const SLOT_NODE_ID = 's';
79
- const TEXT_NODE_ID = 't';
80
- const HYDRATE_ID = 's-id';
81
- const HYDRATED_STYLE_ID = 'sty-id';
82
- const HYDRATE_CHILD_ID = 'c-id';
83
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
84
- const XLINK_NS = 'http://www.w3.org/1999/xlink';
85
29
  const createTime = (fnName, tagName = '') => {
86
30
  {
87
31
  return () => {
@@ -96,80 +40,15 @@ const uniqueTime = (key, measureText) => {
96
40
  };
97
41
  }
98
42
  };
99
- const rootAppliedStyles = new WeakMap();
100
- const registerStyle = (scopeId, cssText, allowCS) => {
101
- let style = styles.get(scopeId);
102
- if (supportsConstructibleStylesheets && allowCS) {
103
- style = (style || new CSSStyleSheet());
104
- style.replace(cssText);
105
- }
106
- else {
107
- style = cssText;
108
- }
109
- styles.set(scopeId, style);
110
- };
111
- const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
112
- let scopeId = getScopeId(cmpMeta);
113
- const style = styles.get(scopeId);
114
- // if an element is NOT connected then getRootNode() will return the wrong root node
115
- // so the fallback is to always use the document for the root node in those cases
116
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
117
- if (style) {
118
- if (typeof style === 'string') {
119
- styleContainerNode = styleContainerNode.head || styleContainerNode;
120
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
121
- let styleElm;
122
- if (!appliedStyles) {
123
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
124
- }
125
- if (!appliedStyles.has(scopeId)) {
126
- if (styleContainerNode.host &&
127
- (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
128
- // This is only happening on native shadow-dom, do not needs CSS var shim
129
- styleElm.innerHTML = style;
130
- }
131
- else {
132
- {
133
- styleElm = doc.createElement('style');
134
- styleElm.innerHTML = style;
135
- }
136
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
137
- }
138
- if (appliedStyles) {
139
- appliedStyles.add(scopeId);
140
- }
141
- }
142
- }
143
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
144
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
145
- }
146
- }
147
- return scopeId;
148
- };
149
- const attachStyles = (hostRef) => {
150
- const cmpMeta = hostRef.$cmpMeta$;
151
- const elm = hostRef.$hostElement$;
152
- const flags = cmpMeta.$flags$;
153
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
154
- const scopeId = addStyle(supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
155
- if (flags & 10 /* needsScopedEncapsulation */) {
156
- // only required when we're NOT using native shadow dom (slot)
157
- // or this browser doesn't support native shadow dom
158
- // and this host element was NOT created with SSR
159
- // let's pick out the inner content for slot projection
160
- // create a node to represent where the original
161
- // content was first placed, which is useful later on
162
- // DOM WRITE!!
163
- elm['s-sc'] = scopeId;
164
- elm.classList.add(scopeId + '-h');
165
- if (flags & 2 /* scopedCssEncapsulation */) {
166
- elm.classList.add(scopeId + '-s');
167
- }
168
- }
169
- endAttachStyles();
170
- };
171
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
172
- const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
43
+ const CONTENT_REF_ID = 'r';
44
+ const ORG_LOCATION_ID = 'o';
45
+ const SLOT_NODE_ID = 's';
46
+ const TEXT_NODE_ID = 't';
47
+ const HYDRATE_ID = 's-id';
48
+ const HYDRATED_STYLE_ID = 'sty-id';
49
+ const HYDRATE_CHILD_ID = 'c-id';
50
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
51
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
173
52
  /**
174
53
  * Default style mode id
175
54
  */
@@ -318,1205 +197,1464 @@ const convertToPrivate = (node) => {
318
197
  vnode.$name$ = node.vname;
319
198
  return vnode;
320
199
  };
321
- /**
322
- * Production setAccessor() function based on Preact by
323
- * Jason Miller (@developit)
324
- * Licensed under the MIT License
325
- * https://github.com/developit/preact/blob/master/LICENSE
326
- *
327
- * Modified for Stencil's compiler and vdom
328
- */
329
- const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
330
- if (oldValue !== newValue) {
331
- let isProp = isMemberInElement(elm, memberName);
332
- let ln = memberName.toLowerCase();
333
- if (memberName === 'class') {
334
- const classList = elm.classList;
335
- const oldClasses = parseClassList(oldValue);
336
- const newClasses = parseClassList(newValue);
337
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
338
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
339
- }
340
- else if (memberName === 'style') {
341
- // update style attribute, css properties and values
342
- {
343
- for (const prop in oldValue) {
344
- if (!newValue || newValue[prop] == null) {
345
- if (prop.includes('-')) {
346
- elm.style.removeProperty(prop);
347
- }
348
- else {
349
- elm.style[prop] = '';
350
- }
351
- }
352
- }
353
- }
354
- for (const prop in newValue) {
355
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
356
- if (prop.includes('-')) {
357
- elm.style.setProperty(prop, newValue[prop]);
358
- }
359
- else {
360
- elm.style[prop] = newValue[prop];
361
- }
362
- }
363
- }
200
+ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
201
+ const endHydrate = createTime('hydrateClient', tagName);
202
+ const shadowRoot = hostElm.shadowRoot;
203
+ const childRenderNodes = [];
204
+ const slotNodes = [];
205
+ const shadowRootNodes = shadowRoot ? [] : null;
206
+ const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
207
+ if (!plt.$orgLocNodes$) {
208
+ initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
209
+ }
210
+ hostElm[HYDRATE_ID] = hostId;
211
+ hostElm.removeAttribute(HYDRATE_ID);
212
+ clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
213
+ childRenderNodes.map((c) => {
214
+ const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
215
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
216
+ const node = c.$elm$;
217
+ if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
218
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
364
219
  }
365
- else if (memberName === 'key')
366
- ;
367
- else if (memberName === 'ref') {
368
- // minifier will clean this up
369
- if (newValue) {
370
- newValue(elm);
220
+ if (!shadowRoot) {
221
+ node['s-hn'] = tagName;
222
+ if (orgLocationNode) {
223
+ node['s-ol'] = orgLocationNode;
224
+ node['s-ol']['s-nr'] = node;
371
225
  }
372
226
  }
373
- else if ((!isProp ) &&
374
- memberName[0] === 'o' &&
375
- memberName[1] === 'n') {
376
- // Event Handlers
377
- // so if the member name starts with "on" and the 3rd characters is
378
- // a capital letter, and it's not already a member on the element,
379
- // then we're assuming it's an event listener
380
- if (memberName[2] === '-') {
381
- // on- prefixed events
382
- // allows to be explicit about the dom event to listen without any magic
383
- // under the hood:
384
- // <my-cmp on-click> // listens for "click"
385
- // <my-cmp on-Click> // listens for "Click"
386
- // <my-cmp on-ionChange> // listens for "ionChange"
387
- // <my-cmp on-EVENTS> // listens for "EVENTS"
388
- memberName = memberName.slice(3);
389
- }
390
- else if (isMemberInElement(win, ln)) {
391
- // standard event
392
- // the JSX attribute could have been "onMouseOver" and the
393
- // member name "onmouseover" is on the window's prototype
394
- // so let's add the listener "mouseover", which is all lowercased
395
- memberName = ln.slice(2);
227
+ plt.$orgLocNodes$.delete(orgLocationId);
228
+ });
229
+ if (shadowRoot) {
230
+ shadowRootNodes.map((shadowRootNode) => {
231
+ if (shadowRootNode) {
232
+ shadowRoot.appendChild(shadowRootNode);
396
233
  }
397
- else {
398
- // custom event
399
- // the JSX attribute could have been "onMyCustomEvent"
400
- // so let's trim off the "on" prefix and lowercase the first character
401
- // and add the listener "myCustomEvent"
402
- // except for the first character, we keep the event name case
403
- memberName = ln[2] + memberName.slice(3);
404
- }
405
- if (oldValue) {
406
- plt.rel(elm, memberName, oldValue, false);
234
+ });
235
+ }
236
+ endHydrate();
237
+ };
238
+ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
239
+ let childNodeType;
240
+ let childIdSplt;
241
+ let childVNode;
242
+ let i;
243
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
244
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
245
+ if (childNodeType) {
246
+ // got the node data from the element's attribute
247
+ // `${hostId}.${nodeId}.${depth}.${index}`
248
+ childIdSplt = childNodeType.split('.');
249
+ if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
250
+ childVNode = {
251
+ $flags$: 0,
252
+ $hostId$: childIdSplt[0],
253
+ $nodeId$: childIdSplt[1],
254
+ $depth$: childIdSplt[2],
255
+ $index$: childIdSplt[3],
256
+ $tag$: node.tagName.toLowerCase(),
257
+ $elm$: node,
258
+ $attrs$: null,
259
+ $children$: null,
260
+ $key$: null,
261
+ $name$: null,
262
+ $text$: null,
263
+ };
264
+ childRenderNodes.push(childVNode);
265
+ node.removeAttribute(HYDRATE_CHILD_ID);
266
+ // this is a new child vnode
267
+ // so ensure its parent vnode has the vchildren array
268
+ if (!parentVNode.$children$) {
269
+ parentVNode.$children$ = [];
270
+ }
271
+ // add our child vnode to a specific index of the vnode's children
272
+ parentVNode.$children$[childVNode.$index$] = childVNode;
273
+ // this is now the new parent vnode for all the next child checks
274
+ parentVNode = childVNode;
275
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
276
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
277
+ }
407
278
  }
408
- if (newValue) {
409
- plt.ael(elm, memberName, newValue, false);
279
+ }
280
+ // recursively drill down, end to start so we can remove nodes
281
+ for (i = node.childNodes.length - 1; i >= 0; i--) {
282
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
283
+ }
284
+ if (node.shadowRoot) {
285
+ // keep drilling down through the shadow root nodes
286
+ for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
287
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
410
288
  }
411
289
  }
412
- else {
413
- // Set property if it exists and it's not a SVG
414
- const isComplex = isComplexType(newValue);
415
- if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
416
- try {
417
- if (!elm.tagName.includes('-')) {
418
- const n = newValue == null ? '' : newValue;
419
- // Workaround for Safari, moving the <input> caret when re-assigning the same valued
420
- if (memberName === 'list') {
421
- isProp = false;
422
- }
423
- else if (oldValue == null || elm[memberName] != n) {
424
- elm[memberName] = n;
425
- }
290
+ }
291
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
292
+ // `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
293
+ childIdSplt = node.nodeValue.split('.');
294
+ if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
295
+ // comment node for either the host id or a 0 host id
296
+ childNodeType = childIdSplt[0];
297
+ childVNode = {
298
+ $flags$: 0,
299
+ $hostId$: childIdSplt[1],
300
+ $nodeId$: childIdSplt[2],
301
+ $depth$: childIdSplt[3],
302
+ $index$: childIdSplt[4],
303
+ $elm$: node,
304
+ $attrs$: null,
305
+ $children$: null,
306
+ $key$: null,
307
+ $name$: null,
308
+ $tag$: null,
309
+ $text$: null,
310
+ };
311
+ if (childNodeType === TEXT_NODE_ID) {
312
+ childVNode.$elm$ = node.nextSibling;
313
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* NODE_TYPE.TextNode */) {
314
+ childVNode.$text$ = childVNode.$elm$.textContent;
315
+ childRenderNodes.push(childVNode);
316
+ // remove the text comment since it's no longer needed
317
+ node.remove();
318
+ if (!parentVNode.$children$) {
319
+ parentVNode.$children$ = [];
426
320
  }
427
- else {
428
- elm[memberName] = newValue;
321
+ parentVNode.$children$[childVNode.$index$] = childVNode;
322
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
323
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
429
324
  }
430
325
  }
431
- catch (e) { }
432
- }
433
- /**
434
- * Need to manually update attribute if:
435
- * - memberName is not an attribute
436
- * - if we are rendering the host element in order to reflect attribute
437
- * - if it's a SVG, since properties might not work in <svg>
438
- * - if the newValue is null/undefined or 'false'.
439
- */
440
- let xlink = false;
441
- {
442
- if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
443
- memberName = ln;
444
- xlink = true;
445
- }
446
326
  }
447
- if (newValue == null || newValue === false) {
448
- if (newValue !== false || elm.getAttribute(memberName) === '') {
449
- if (xlink) {
450
- elm.removeAttributeNS(XLINK_NS, memberName);
327
+ else if (childVNode.$hostId$ === hostId) {
328
+ // this comment node is specifcally for this host id
329
+ if (childNodeType === SLOT_NODE_ID) {
330
+ // `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
331
+ childVNode.$tag$ = 'slot';
332
+ if (childIdSplt[5]) {
333
+ node['s-sn'] = childVNode.$name$ = childIdSplt[5];
451
334
  }
452
335
  else {
453
- elm.removeAttribute(memberName);
336
+ node['s-sn'] = '';
454
337
  }
338
+ node['s-sr'] = true;
339
+ if (shadowRootNodes) {
340
+ // browser support shadowRoot and this is a shadow dom component
341
+ // create an actual slot element
342
+ childVNode.$elm$ = doc.createElement(childVNode.$tag$);
343
+ if (childVNode.$name$) {
344
+ // add the slot name attribute
345
+ childVNode.$elm$.setAttribute('name', childVNode.$name$);
346
+ }
347
+ // insert the new slot element before the slot comment
348
+ node.parentNode.insertBefore(childVNode.$elm$, node);
349
+ // remove the slot comment since it's not needed for shadow
350
+ node.remove();
351
+ if (childVNode.$depth$ === '0') {
352
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
353
+ }
354
+ }
355
+ slotNodes.push(childVNode);
356
+ if (!parentVNode.$children$) {
357
+ parentVNode.$children$ = [];
358
+ }
359
+ parentVNode.$children$[childVNode.$index$] = childVNode;
455
360
  }
456
- }
457
- else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
458
- newValue = newValue === true ? '' : newValue;
459
- if (xlink) {
460
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
461
- }
462
- else {
463
- elm.setAttribute(memberName, newValue);
361
+ else if (childNodeType === CONTENT_REF_ID) {
362
+ // `${CONTENT_REF_ID}.${hostId}`;
363
+ if (shadowRootNodes) {
364
+ // remove the content ref comment since it's not needed for shadow
365
+ node.remove();
366
+ }
367
+ else {
368
+ hostElm['s-cr'] = node;
369
+ node['s-cn'] = true;
370
+ }
464
371
  }
465
372
  }
466
373
  }
467
374
  }
468
- };
469
- const parseClassListRegex = /\s/;
470
- const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
471
- const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
472
- // if the element passed in is a shadow root, which is a document fragment
473
- // then we want to be adding attrs/props to the shadow root's "host" element
474
- // if it's not a shadow root, then we add attrs/props to the same element
475
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
476
- ? newVnode.$elm$.host
477
- : newVnode.$elm$;
478
- const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
479
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
480
- {
481
- // remove attributes no longer present on the vnode by setting them to undefined
482
- for (memberName in oldVnodeAttrs) {
483
- if (!(memberName in newVnodeAttrs)) {
484
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
485
- }
486
- }
487
- }
488
- // add new & update changed attributes
489
- for (memberName in newVnodeAttrs) {
490
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
375
+ else if (parentVNode && parentVNode.$tag$ === 'style') {
376
+ const vnode = newVNode(null, node.textContent);
377
+ vnode.$elm$ = node;
378
+ vnode.$index$ = '0';
379
+ parentVNode.$children$ = [vnode];
491
380
  }
492
381
  };
493
- const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
494
- // tslint:disable-next-line: prefer-const
495
- const newVNode = newParentVNode.$children$[childIndex];
496
- let i = 0;
497
- let elm;
498
- let childNode;
499
- let oldVNode;
500
- if (!useNativeShadowDom) {
501
- // remember for later we need to check to relocate nodes
502
- checkSlotRelocate = true;
503
- if (newVNode.$tag$ === 'slot') {
504
- if (scopeId) {
505
- // scoped css needs to add its scoped id to the parent element
506
- parentElm.classList.add(scopeId + '-s');
382
+ const initializeDocumentHydrate = (node, orgLocNodes) => {
383
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
384
+ let i = 0;
385
+ for (; i < node.childNodes.length; i++) {
386
+ initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
387
+ }
388
+ if (node.shadowRoot) {
389
+ for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
390
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
507
391
  }
508
- newVNode.$flags$ |= newVNode.$children$
509
- ? // slot element has fallback content
510
- 2 /* isSlotFallback */
511
- : // slot element does not have fallback content
512
- 1 /* isSlotReference */;
513
392
  }
514
393
  }
515
- if (newVNode.$text$ !== null) {
516
- // create text node
517
- elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
518
- }
519
- else if (newVNode.$flags$ & 1 /* isSlotReference */) {
520
- // create a slot reference node
521
- elm = newVNode.$elm$ =
522
- doc.createTextNode('');
523
- }
524
- else {
525
- if (!isSvgMode) {
526
- isSvgMode = newVNode.$tag$ === 'svg';
527
- }
528
- // create element
529
- elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
530
- ? 'slot-fb'
531
- : newVNode.$tag$)
532
- );
533
- if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
534
- isSvgMode = false;
535
- }
536
- // add css classes, attrs, props, listeners, etc.
537
- {
538
- updateElement(null, newVNode, isSvgMode);
394
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
395
+ const childIdSplt = node.nodeValue.split('.');
396
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
397
+ orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
398
+ node.nodeValue = '';
399
+ // useful to know if the original location is
400
+ // the root light-dom of a shadow dom component
401
+ node['s-en'] = childIdSplt[3];
539
402
  }
540
- if (isDef(scopeId) && elm['s-si'] !== scopeId) {
541
- // if there is a scopeId and this is the initial render
542
- // then let's add the scopeId as a css class
543
- elm.classList.add((elm['s-si'] = scopeId));
544
- }
545
- if (newVNode.$children$) {
546
- for (i = 0; i < newVNode.$children$.length; ++i) {
547
- // create the node
548
- childNode = createElm(oldParentVNode, newVNode, i, elm);
549
- // return node could have been null
550
- if (childNode) {
551
- // append our new node
552
- elm.appendChild(childNode);
553
- }
554
- }
403
+ }
404
+ };
405
+ /**
406
+ * Parse a new property value for a given property type.
407
+ *
408
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
409
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
410
+ * 1. `any`, the type given to `propValue` in the function signature
411
+ * 2. the type stored from `propType`.
412
+ *
413
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
414
+ *
415
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
416
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
417
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
418
+ * ```tsx
419
+ * <my-cmp prop-val={0}></my-cmp>
420
+ * ```
421
+ *
422
+ * HTML prop values on the other hand, will always a string
423
+ *
424
+ * @param propValue the new value to coerce to some type
425
+ * @param propType the type of the prop, expressed as a binary number
426
+ * @returns the parsed/coerced value
427
+ */
428
+ const parsePropertyValue = (propValue, propType) => {
429
+ // ensure this value is of the correct prop type
430
+ if (propValue != null && !isComplexType(propValue)) {
431
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
432
+ // per the HTML spec, any string value means it is a boolean true value
433
+ // but we'll cheat here and say that the string "false" is the boolean false
434
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
555
435
  }
556
- {
557
- if (newVNode.$tag$ === 'svg') {
558
- // Only reset the SVG context when we're exiting <svg> element
559
- isSvgMode = false;
560
- }
561
- else if (elm.tagName === 'foreignObject') {
562
- // Reenter SVG context when we're exiting <foreignObject> element
563
- isSvgMode = true;
564
- }
436
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
437
+ // force it to be a number
438
+ return parseFloat(propValue);
565
439
  }
566
- }
567
- {
568
- elm['s-hn'] = hostTagName;
569
- if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
570
- // remember the content reference comment
571
- elm['s-sr'] = true;
572
- // remember the content reference comment
573
- elm['s-cr'] = contentRef;
574
- // remember the slot name, or empty string for default slot
575
- elm['s-sn'] = newVNode.$name$ || '';
576
- // check if we've got an old vnode for this slot
577
- oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
578
- if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
579
- // we've got an old slot vnode and the wrapper is being replaced
580
- // so let's move the old slot content back to it's original location
581
- putBackInOriginalLocation(oldParentVNode.$elm$, false);
582
- }
440
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
441
+ // could have been passed as a number or boolean
442
+ // but we still want it as a string
443
+ return String(propValue);
583
444
  }
445
+ // redundant return here for better minification
446
+ return propValue;
584
447
  }
585
- return elm;
448
+ // not sure exactly what type we want
449
+ // so no need to change to a different type
450
+ return propValue;
586
451
  };
587
- const putBackInOriginalLocation = (parentElm, recursive) => {
588
- plt.$flags$ |= 1 /* isTmpDisconnected */;
589
- const oldSlotChildNodes = parentElm.childNodes;
590
- for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
591
- const childNode = oldSlotChildNodes[i];
592
- if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
593
- // // this child node in the old element is from another component
594
- // // remove this node from the old slot's parent
595
- // childNode.remove();
596
- // and relocate it back to it's original location
597
- parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
598
- // remove the old original location comment entirely
599
- // later on the patch function will know what to do
600
- // and move this to the correct spot in need be
601
- childNode['s-ol'].remove();
602
- childNode['s-ol'] = undefined;
603
- checkSlotRelocate = true;
452
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
453
+ const createEvent = (ref, name, flags) => {
454
+ const elm = getElement(ref);
455
+ return {
456
+ emit: (detail) => {
457
+ return emitEvent(elm, name, {
458
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
459
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
460
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
461
+ detail,
462
+ });
463
+ },
464
+ };
465
+ };
466
+ /**
467
+ * Helper function to create & dispatch a custom Event on a provided target
468
+ * @param elm the target of the Event
469
+ * @param name the name to give the custom Event
470
+ * @param opts options for configuring a custom Event
471
+ * @returns the custom Event
472
+ */
473
+ const emitEvent = (elm, name, opts) => {
474
+ const ev = plt.ce(name, opts);
475
+ elm.dispatchEvent(ev);
476
+ return ev;
477
+ };
478
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
479
+ const registerStyle = (scopeId, cssText, allowCS) => {
480
+ let style = styles.get(scopeId);
481
+ if (supportsConstructableStylesheets && allowCS) {
482
+ style = (style || new CSSStyleSheet());
483
+ if (typeof style === 'string') {
484
+ style = cssText;
604
485
  }
605
- if (recursive) {
606
- putBackInOriginalLocation(childNode, recursive);
486
+ else {
487
+ style.replaceSync(cssText);
607
488
  }
608
489
  }
609
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
610
- };
611
- const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
612
- let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
613
- let childNode;
614
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
615
- containerElm = containerElm.shadowRoot;
616
- }
617
- for (; startIdx <= endIdx; ++startIdx) {
618
- if (vnodes[startIdx]) {
619
- childNode = createElm(null, parentVNode, startIdx, parentElm);
620
- if (childNode) {
621
- vnodes[startIdx].$elm$ = childNode;
622
- containerElm.insertBefore(childNode, referenceNode(before) );
623
- }
624
- }
490
+ else {
491
+ style = cssText;
625
492
  }
493
+ styles.set(scopeId, style);
626
494
  };
627
- const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
628
- for (; startIdx <= endIdx; ++startIdx) {
629
- if ((vnode = vnodes[startIdx])) {
630
- elm = vnode.$elm$;
631
- callNodeRefs(vnode);
632
- {
633
- // we're removing this element
634
- // so it's possible we need to show slot fallback content now
635
- checkSlotFallbackVisibility = true;
636
- if (elm['s-ol']) {
637
- // remove the original location comment
638
- elm['s-ol'].remove();
495
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
496
+ let scopeId = getScopeId(cmpMeta);
497
+ const style = styles.get(scopeId);
498
+ // if an element is NOT connected then getRootNode() will return the wrong root node
499
+ // so the fallback is to always use the document for the root node in those cases
500
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
501
+ if (style) {
502
+ if (typeof style === 'string') {
503
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
504
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
505
+ let styleElm;
506
+ if (!appliedStyles) {
507
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
508
+ }
509
+ if (!appliedStyles.has(scopeId)) {
510
+ if (styleContainerNode.host &&
511
+ (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
512
+ // This is only happening on native shadow-dom, do not needs CSS var shim
513
+ styleElm.innerHTML = style;
639
514
  }
640
515
  else {
641
- // it's possible that child nodes of the node
642
- // that's being removed are slot nodes
643
- putBackInOriginalLocation(elm, true);
516
+ {
517
+ styleElm = doc.createElement('style');
518
+ styleElm.innerHTML = style;
519
+ }
520
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
521
+ }
522
+ if (appliedStyles) {
523
+ appliedStyles.add(scopeId);
644
524
  }
645
525
  }
646
- // remove the vnode's element from the dom
647
- elm.remove();
526
+ }
527
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
528
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
648
529
  }
649
530
  }
531
+ return scopeId;
650
532
  };
651
- const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
652
- let oldStartIdx = 0;
653
- let newStartIdx = 0;
654
- let idxInOld = 0;
655
- let i = 0;
656
- let oldEndIdx = oldCh.length - 1;
657
- let oldStartVnode = oldCh[0];
658
- let oldEndVnode = oldCh[oldEndIdx];
659
- let newEndIdx = newCh.length - 1;
660
- let newStartVnode = newCh[0];
661
- let newEndVnode = newCh[newEndIdx];
662
- let node;
663
- let elmToMove;
664
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
665
- if (oldStartVnode == null) {
666
- // Vnode might have been moved left
667
- oldStartVnode = oldCh[++oldStartIdx];
668
- }
669
- else if (oldEndVnode == null) {
670
- oldEndVnode = oldCh[--oldEndIdx];
671
- }
672
- else if (newStartVnode == null) {
673
- newStartVnode = newCh[++newStartIdx];
533
+ const attachStyles = (hostRef) => {
534
+ const cmpMeta = hostRef.$cmpMeta$;
535
+ const elm = hostRef.$hostElement$;
536
+ const flags = cmpMeta.$flags$;
537
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
538
+ const scopeId = addStyle(supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
539
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
540
+ // only required when we're NOT using native shadow dom (slot)
541
+ // or this browser doesn't support native shadow dom
542
+ // and this host element was NOT created with SSR
543
+ // let's pick out the inner content for slot projection
544
+ // create a node to represent where the original
545
+ // content was first placed, which is useful later on
546
+ // DOM WRITE!!
547
+ elm['s-sc'] = scopeId;
548
+ elm.classList.add(scopeId + '-h');
549
+ if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
550
+ elm.classList.add(scopeId + '-s');
674
551
  }
675
- else if (newEndVnode == null) {
676
- newEndVnode = newCh[--newEndIdx];
552
+ }
553
+ endAttachStyles();
554
+ };
555
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
556
+ const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
557
+ /**
558
+ * Production setAccessor() function based on Preact by
559
+ * Jason Miller (@developit)
560
+ * Licensed under the MIT License
561
+ * https://github.com/developit/preact/blob/master/LICENSE
562
+ *
563
+ * Modified for Stencil's compiler and vdom
564
+ */
565
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
566
+ if (oldValue !== newValue) {
567
+ let isProp = isMemberInElement(elm, memberName);
568
+ let ln = memberName.toLowerCase();
569
+ if (memberName === 'class') {
570
+ const classList = elm.classList;
571
+ const oldClasses = parseClassList(oldValue);
572
+ const newClasses = parseClassList(newValue);
573
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
574
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
677
575
  }
678
- else if (isSameVnode(oldStartVnode, newStartVnode)) {
679
- patch(oldStartVnode, newStartVnode);
680
- oldStartVnode = oldCh[++oldStartIdx];
681
- newStartVnode = newCh[++newStartIdx];
682
- }
683
- else if (isSameVnode(oldEndVnode, newEndVnode)) {
684
- patch(oldEndVnode, newEndVnode);
685
- oldEndVnode = oldCh[--oldEndIdx];
686
- newEndVnode = newCh[--newEndIdx];
576
+ else if (memberName === 'style') {
577
+ // update style attribute, css properties and values
578
+ {
579
+ for (const prop in oldValue) {
580
+ if (!newValue || newValue[prop] == null) {
581
+ if (prop.includes('-')) {
582
+ elm.style.removeProperty(prop);
583
+ }
584
+ else {
585
+ elm.style[prop] = '';
586
+ }
587
+ }
588
+ }
589
+ }
590
+ for (const prop in newValue) {
591
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
592
+ if (prop.includes('-')) {
593
+ elm.style.setProperty(prop, newValue[prop]);
594
+ }
595
+ else {
596
+ elm.style[prop] = newValue[prop];
597
+ }
598
+ }
599
+ }
687
600
  }
688
- else if (isSameVnode(oldStartVnode, newEndVnode)) {
689
- // Vnode moved right
690
- if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
691
- putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
601
+ else if (memberName === 'key')
602
+ ;
603
+ else if (memberName === 'ref') {
604
+ // minifier will clean this up
605
+ if (newValue) {
606
+ newValue(elm);
692
607
  }
693
- patch(oldStartVnode, newEndVnode);
694
- parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
695
- oldStartVnode = oldCh[++oldStartIdx];
696
- newEndVnode = newCh[--newEndIdx];
697
608
  }
698
- else if (isSameVnode(oldEndVnode, newStartVnode)) {
699
- // Vnode moved left
700
- if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
701
- putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
609
+ else if ((!isProp ) &&
610
+ memberName[0] === 'o' &&
611
+ memberName[1] === 'n') {
612
+ // Event Handlers
613
+ // so if the member name starts with "on" and the 3rd characters is
614
+ // a capital letter, and it's not already a member on the element,
615
+ // then we're assuming it's an event listener
616
+ if (memberName[2] === '-') {
617
+ // on- prefixed events
618
+ // allows to be explicit about the dom event to listen without any magic
619
+ // under the hood:
620
+ // <my-cmp on-click> // listens for "click"
621
+ // <my-cmp on-Click> // listens for "Click"
622
+ // <my-cmp on-ionChange> // listens for "ionChange"
623
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
624
+ memberName = memberName.slice(3);
625
+ }
626
+ else if (isMemberInElement(win, ln)) {
627
+ // standard event
628
+ // the JSX attribute could have been "onMouseOver" and the
629
+ // member name "onmouseover" is on the window's prototype
630
+ // so let's add the listener "mouseover", which is all lowercased
631
+ memberName = ln.slice(2);
632
+ }
633
+ else {
634
+ // custom event
635
+ // the JSX attribute could have been "onMyCustomEvent"
636
+ // so let's trim off the "on" prefix and lowercase the first character
637
+ // and add the listener "myCustomEvent"
638
+ // except for the first character, we keep the event name case
639
+ memberName = ln[2] + memberName.slice(3);
640
+ }
641
+ if (oldValue) {
642
+ plt.rel(elm, memberName, oldValue, false);
643
+ }
644
+ if (newValue) {
645
+ plt.ael(elm, memberName, newValue, false);
702
646
  }
703
- patch(oldEndVnode, newStartVnode);
704
- parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
705
- oldEndVnode = oldCh[--oldEndIdx];
706
- newStartVnode = newCh[++newStartIdx];
707
647
  }
708
648
  else {
709
- // createKeyToOldIdx
710
- idxInOld = -1;
649
+ // Set property if it exists and it's not a SVG
650
+ const isComplex = isComplexType(newValue);
651
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
652
+ try {
653
+ if (!elm.tagName.includes('-')) {
654
+ const n = newValue == null ? '' : newValue;
655
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
656
+ if (memberName === 'list') {
657
+ isProp = false;
658
+ }
659
+ else if (oldValue == null || elm[memberName] != n) {
660
+ elm[memberName] = n;
661
+ }
662
+ }
663
+ else {
664
+ elm[memberName] = newValue;
665
+ }
666
+ }
667
+ catch (e) { }
668
+ }
669
+ /**
670
+ * Need to manually update attribute if:
671
+ * - memberName is not an attribute
672
+ * - if we are rendering the host element in order to reflect attribute
673
+ * - if it's a SVG, since properties might not work in <svg>
674
+ * - if the newValue is null/undefined or 'false'.
675
+ */
676
+ let xlink = false;
711
677
  {
712
- for (i = oldStartIdx; i <= oldEndIdx; ++i) {
713
- if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
714
- idxInOld = i;
715
- break;
678
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
679
+ memberName = ln;
680
+ xlink = true;
681
+ }
682
+ }
683
+ if (newValue == null || newValue === false) {
684
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
685
+ if (xlink) {
686
+ elm.removeAttributeNS(XLINK_NS, memberName);
687
+ }
688
+ else {
689
+ elm.removeAttribute(memberName);
716
690
  }
717
691
  }
718
692
  }
719
- if (idxInOld >= 0) {
720
- elmToMove = oldCh[idxInOld];
721
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
722
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
693
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
694
+ newValue = newValue === true ? '' : newValue;
695
+ if (xlink) {
696
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
723
697
  }
724
698
  else {
725
- patch(elmToMove, newStartVnode);
726
- oldCh[idxInOld] = undefined;
727
- node = elmToMove.$elm$;
699
+ elm.setAttribute(memberName, newValue);
728
700
  }
729
- newStartVnode = newCh[++newStartIdx];
730
701
  }
731
- else {
732
- // new element
733
- node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
734
- newStartVnode = newCh[++newStartIdx];
702
+ }
703
+ }
704
+ };
705
+ const parseClassListRegex = /\s/;
706
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
707
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
708
+ // if the element passed in is a shadow root, which is a document fragment
709
+ // then we want to be adding attrs/props to the shadow root's "host" element
710
+ // if it's not a shadow root, then we add attrs/props to the same element
711
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
712
+ ? newVnode.$elm$.host
713
+ : newVnode.$elm$;
714
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
715
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
716
+ {
717
+ // remove attributes no longer present on the vnode by setting them to undefined
718
+ for (memberName in oldVnodeAttrs) {
719
+ if (!(memberName in newVnodeAttrs)) {
720
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
735
721
  }
736
- if (node) {
737
- {
738
- parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
739
- }
722
+ }
723
+ }
724
+ // add new & update changed attributes
725
+ for (memberName in newVnodeAttrs) {
726
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
727
+ }
728
+ };
729
+ /**
730
+ * Create a DOM Node corresponding to one of the children of a given VNode.
731
+ *
732
+ * @param oldParentVNode the parent VNode from the previous render
733
+ * @param newParentVNode the parent VNode from the current render
734
+ * @param childIndex the index of the VNode, in the _new_ parent node's
735
+ * children, for which we will create a new DOM node
736
+ * @param parentElm the parent DOM node which our new node will be a child of
737
+ * @returns the newly created node
738
+ */
739
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
740
+ // tslint:disable-next-line: prefer-const
741
+ const newVNode = newParentVNode.$children$[childIndex];
742
+ let i = 0;
743
+ let elm;
744
+ let childNode;
745
+ let oldVNode;
746
+ if (!useNativeShadowDom) {
747
+ // remember for later we need to check to relocate nodes
748
+ checkSlotRelocate = true;
749
+ if (newVNode.$tag$ === 'slot') {
750
+ if (scopeId) {
751
+ // scoped css needs to add its scoped id to the parent element
752
+ parentElm.classList.add(scopeId + '-s');
740
753
  }
754
+ newVNode.$flags$ |= newVNode.$children$
755
+ ? // slot element has fallback content
756
+ 2 /* VNODE_FLAGS.isSlotFallback */
757
+ : // slot element does not have fallback content
758
+ 1 /* VNODE_FLAGS.isSlotReference */;
741
759
  }
742
760
  }
743
- if (oldStartIdx > oldEndIdx) {
744
- addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
761
+ if (newVNode.$text$ !== null) {
762
+ // create text node
763
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
745
764
  }
746
- else if (newStartIdx > newEndIdx) {
747
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
765
+ else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
766
+ // create a slot reference node
767
+ elm = newVNode.$elm$ =
768
+ doc.createTextNode('');
748
769
  }
749
- };
750
- const isSameVnode = (vnode1, vnode2) => {
751
- // compare if two vnode to see if they're "technically" the same
752
- // need to have the same element tag, and same key to be the same
753
- if (vnode1.$tag$ === vnode2.$tag$) {
754
- if (vnode1.$tag$ === 'slot') {
755
- return vnode1.$name$ === vnode2.$name$;
770
+ else {
771
+ if (!isSvgMode) {
772
+ isSvgMode = newVNode.$tag$ === 'svg';
756
773
  }
757
- {
758
- return vnode1.$key$ === vnode2.$key$;
774
+ // create element
775
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
776
+ ? 'slot-fb'
777
+ : newVNode.$tag$)
778
+ );
779
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
780
+ isSvgMode = false;
759
781
  }
760
- }
761
- return false;
762
- };
763
- const referenceNode = (node) => {
764
- // this node was relocated to a new location in the dom
765
- // because of some other component's slot
766
- // but we still have an html comment in place of where
767
- // it's original location was according to it's original vdom
768
- return (node && node['s-ol']) || node;
769
- };
770
- const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
771
- const patch = (oldVNode, newVNode) => {
772
- const elm = (newVNode.$elm$ = oldVNode.$elm$);
773
- const oldChildren = oldVNode.$children$;
774
- const newChildren = newVNode.$children$;
775
- const tag = newVNode.$tag$;
776
- const text = newVNode.$text$;
777
- let defaultHolder;
778
- if (text === null) {
782
+ // add css classes, attrs, props, listeners, etc.
779
783
  {
780
- // test if we're rendering an svg element, or still rendering nodes inside of one
781
- // only add this to the when the compiler sees we're using an svg somewhere
782
- isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
784
+ updateElement(null, newVNode, isSvgMode);
783
785
  }
784
- // element node
785
- {
786
- if (tag === 'slot')
787
- ;
788
- else {
789
- // either this is the first render of an element OR it's an update
790
- // AND we already know it's possible it could have changed
791
- // this updates the element's css classes, attrs, props, listeners, etc.
792
- updateElement(oldVNode, newVNode, isSvgMode);
793
- }
786
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
787
+ // if there is a scopeId and this is the initial render
788
+ // then let's add the scopeId as a css class
789
+ elm.classList.add((elm['s-si'] = scopeId));
794
790
  }
795
- if (oldChildren !== null && newChildren !== null) {
796
- // looks like there's child vnodes for both the old and new vnodes
797
- updateChildren(elm, oldChildren, newVNode, newChildren);
798
- }
799
- else if (newChildren !== null) {
800
- // no old child vnodes, but there are new child vnodes to add
801
- if (oldVNode.$text$ !== null) {
802
- // the old vnode was text, so be sure to clear it out
803
- elm.textContent = '';
791
+ if (newVNode.$children$) {
792
+ for (i = 0; i < newVNode.$children$.length; ++i) {
793
+ // create the node
794
+ childNode = createElm(oldParentVNode, newVNode, i, elm);
795
+ // return node could have been null
796
+ if (childNode) {
797
+ // append our new node
798
+ elm.appendChild(childNode);
799
+ }
804
800
  }
805
- // add the new vnode children
806
- addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
807
- }
808
- else if (oldChildren !== null) {
809
- // no new child vnodes, but there are old child vnodes to remove
810
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
811
801
  }
812
- if (isSvgMode && tag === 'svg') {
813
- isSvgMode = false;
802
+ {
803
+ if (newVNode.$tag$ === 'svg') {
804
+ // Only reset the SVG context when we're exiting <svg> element
805
+ isSvgMode = false;
806
+ }
807
+ else if (elm.tagName === 'foreignObject') {
808
+ // Reenter SVG context when we're exiting <foreignObject> element
809
+ isSvgMode = true;
810
+ }
814
811
  }
815
812
  }
816
- else if ((defaultHolder = elm['s-cr'])) {
817
- // this element has slotted content
818
- defaultHolder.parentNode.textContent = text;
813
+ {
814
+ elm['s-hn'] = hostTagName;
815
+ if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
816
+ // remember the content reference comment
817
+ elm['s-sr'] = true;
818
+ // remember the content reference comment
819
+ elm['s-cr'] = contentRef;
820
+ // remember the slot name, or empty string for default slot
821
+ elm['s-sn'] = newVNode.$name$ || '';
822
+ // check if we've got an old vnode for this slot
823
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
824
+ if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
825
+ // we've got an old slot vnode and the wrapper is being replaced
826
+ // so let's move the old slot content back to it's original location
827
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
828
+ }
829
+ }
819
830
  }
820
- else if (oldVNode.$text$ !== text) {
821
- // update the text content for the text only vnode
822
- // and also only if the text is different than before
823
- elm.data = text;
831
+ return elm;
832
+ };
833
+ const putBackInOriginalLocation = (parentElm, recursive) => {
834
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
835
+ const oldSlotChildNodes = parentElm.childNodes;
836
+ for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
837
+ const childNode = oldSlotChildNodes[i];
838
+ if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
839
+ // // this child node in the old element is from another component
840
+ // // remove this node from the old slot's parent
841
+ // childNode.remove();
842
+ // and relocate it back to it's original location
843
+ parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
844
+ // remove the old original location comment entirely
845
+ // later on the patch function will know what to do
846
+ // and move this to the correct spot in need be
847
+ childNode['s-ol'].remove();
848
+ childNode['s-ol'] = undefined;
849
+ checkSlotRelocate = true;
850
+ }
851
+ if (recursive) {
852
+ putBackInOriginalLocation(childNode, recursive);
853
+ }
824
854
  }
855
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
825
856
  };
826
- const updateFallbackSlotVisibility = (elm) => {
827
- // tslint:disable-next-line: prefer-const
828
- const childNodes = elm.childNodes;
857
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
858
+ let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
829
859
  let childNode;
830
- let i;
831
- let ilen;
832
- let j;
833
- let slotNameAttr;
834
- let nodeType;
835
- for (i = 0, ilen = childNodes.length; i < ilen; i++) {
836
- childNode = childNodes[i];
837
- if (childNode.nodeType === 1 /* ElementNode */) {
838
- if (childNode['s-sr']) {
839
- // this is a slot fallback node
840
- // get the slot name for this slot reference node
841
- slotNameAttr = childNode['s-sn'];
842
- // by default always show a fallback slot node
843
- // then hide it if there are other slots in the light dom
844
- childNode.hidden = false;
845
- for (j = 0; j < ilen; j++) {
846
- nodeType = childNodes[j].nodeType;
847
- if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
848
- // this sibling node is from a different component OR is a named fallback slot node
849
- if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
850
- childNode.hidden = true;
851
- break;
852
- }
853
- }
854
- else {
855
- // this is a default fallback slot node
856
- // any element or text node (with content)
857
- // should hide the default fallback slot node
858
- if (nodeType === 1 /* ElementNode */ ||
859
- (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
860
- childNode.hidden = true;
861
- break;
862
- }
863
- }
864
- }
860
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
861
+ containerElm = containerElm.shadowRoot;
862
+ }
863
+ for (; startIdx <= endIdx; ++startIdx) {
864
+ if (vnodes[startIdx]) {
865
+ childNode = createElm(null, parentVNode, startIdx, parentElm);
866
+ if (childNode) {
867
+ vnodes[startIdx].$elm$ = childNode;
868
+ containerElm.insertBefore(childNode, referenceNode(before) );
865
869
  }
866
- // keep drilling down
867
- updateFallbackSlotVisibility(childNode);
868
870
  }
869
871
  }
870
872
  };
871
- const relocateNodes = [];
872
- const relocateSlotContent = (elm) => {
873
- // tslint:disable-next-line: prefer-const
874
- let childNode;
875
- let node;
876
- let hostContentNodes;
877
- let slotNameAttr;
878
- let relocateNodeData;
879
- let j;
880
- let i = 0;
881
- const childNodes = elm.childNodes;
882
- const ilen = childNodes.length;
883
- for (; i < ilen; i++) {
884
- childNode = childNodes[i];
885
- if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
886
- // first got the content reference comment node
887
- // then we got it's parent, which is where all the host content is in now
888
- hostContentNodes = node.parentNode.childNodes;
889
- slotNameAttr = childNode['s-sn'];
890
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
891
- node = hostContentNodes[j];
892
- if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
893
- // let's do some relocating to its new home
894
- // but never relocate a content reference node
895
- // that is suppose to always represent the original content location
896
- if (isNodeLocatedInSlot(node, slotNameAttr)) {
897
- // it's possible we've already decided to relocate this node
898
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
899
- // made some changes to slots
900
- // let's make sure we also double check
901
- // fallbacks are correctly hidden or shown
902
- checkSlotFallbackVisibility = true;
903
- node['s-sn'] = node['s-sn'] || slotNameAttr;
904
- if (relocateNodeData) {
905
- // previously we never found a slot home for this node
906
- // but turns out we did, so let's remember it now
907
- relocateNodeData.$slotRefNode$ = childNode;
908
- }
909
- else {
910
- // add to our list of nodes to relocate
911
- relocateNodes.push({
912
- $slotRefNode$: childNode,
913
- $nodeToRelocate$: node,
914
- });
915
- }
916
- if (node['s-sr']) {
917
- relocateNodes.map((relocateNode) => {
918
- if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
919
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
920
- if (relocateNodeData && !relocateNode.$slotRefNode$) {
921
- relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
922
- }
923
- }
924
- });
925
- }
926
- }
927
- else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
928
- // so far this element does not have a slot home, not setting slotRefNode on purpose
929
- // if we never find a home for this element then we'll need to hide it
930
- relocateNodes.push({
931
- $nodeToRelocate$: node,
932
- });
933
- }
873
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
874
+ for (; startIdx <= endIdx; ++startIdx) {
875
+ if ((vnode = vnodes[startIdx])) {
876
+ elm = vnode.$elm$;
877
+ callNodeRefs(vnode);
878
+ {
879
+ // we're removing this element
880
+ // so it's possible we need to show slot fallback content now
881
+ checkSlotFallbackVisibility = true;
882
+ if (elm['s-ol']) {
883
+ // remove the original location comment
884
+ elm['s-ol'].remove();
885
+ }
886
+ else {
887
+ // it's possible that child nodes of the node
888
+ // that's being removed are slot nodes
889
+ putBackInOriginalLocation(elm, true);
934
890
  }
935
891
  }
936
- }
937
- if (childNode.nodeType === 1 /* ElementNode */) {
938
- relocateSlotContent(childNode);
892
+ // remove the vnode's element from the dom
893
+ elm.remove();
939
894
  }
940
895
  }
941
896
  };
942
- const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
943
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
944
- if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
945
- return true;
897
+ /**
898
+ * Reconcile the children of a new VNode with the children of an old VNode by
899
+ * traversing the two collections of children, identifying nodes that are
900
+ * conserved or changed, calling out to `patch` to make any necessary
901
+ * updates to the DOM, and rearranging DOM nodes as needed.
902
+ *
903
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
904
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
905
+ * 'windows' by storing start and end indices and references to the
906
+ * corresponding array entries. Initially the two 'windows' are basically equal
907
+ * to the entire array, but we progressively narrow the windows until there are
908
+ * no children left to update by doing the following:
909
+ *
910
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
911
+ * that if we have an initial array like the following we'll end up dealing
912
+ * only with a window bounded by the highlighted elements:
913
+ *
914
+ * [null, null, VNode1 , ... , VNode2, null, null]
915
+ * ^^^^^^ ^^^^^^
916
+ *
917
+ * 2. Check to see if the elements at the head and tail positions are equal
918
+ * across the windows. This will basically detect elements which haven't
919
+ * been added, removed, or changed position, i.e. if you had the following
920
+ * VNode elements (represented as HTML):
921
+ *
922
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
923
+ * newVNode: `<div><p><span>THERE</span></p></div>`
924
+ *
925
+ * Then when comparing the children of the `<div>` tag we check the equality
926
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
927
+ * same tag in the same position, we'd be able to avoid completely
928
+ * re-rendering the subtree under them with a new DOM element and would just
929
+ * call out to `patch` to handle reconciling their children and so on.
930
+ *
931
+ * 3. Check, for both windows, to see if the element at the beginning of the
932
+ * window corresponds to the element at the end of the other window. This is
933
+ * a heuristic which will let us identify _some_ situations in which
934
+ * elements have changed position, for instance it _should_ detect that the
935
+ * children nodes themselves have not changed but merely moved in the
936
+ * following example:
937
+ *
938
+ * oldVNode: `<div><element-one /><element-two /></div>`
939
+ * newVNode: `<div><element-two /><element-one /></div>`
940
+ *
941
+ * If we find cases like this then we also need to move the concrete DOM
942
+ * elements corresponding to the moved children to write the re-order to the
943
+ * DOM.
944
+ *
945
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
946
+ * nodes in the old children which have the same key as the first element in
947
+ * our window on the new children. If we find such a node we handle calling
948
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
949
+ * what we find.
950
+ *
951
+ * Finally, once we've narrowed our 'windows' to the point that either of them
952
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
953
+ * insertion or deletion that needs to happen to get a DOM state that correctly
954
+ * reflects the new child VNodes. If, for instance, after our window on the old
955
+ * children has collapsed we still have more nodes on the new children that
956
+ * we haven't dealt with yet then we need to add them, or if the new children
957
+ * collapse but we still have unhandled _old_ children then we need to make
958
+ * sure the corresponding DOM nodes are removed.
959
+ *
960
+ * @param parentElm the node into which the parent VNode is rendered
961
+ * @param oldCh the old children of the parent node
962
+ * @param newVNode the new VNode which will replace the parent
963
+ * @param newCh the new children of the parent node
964
+ */
965
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
966
+ let oldStartIdx = 0;
967
+ let newStartIdx = 0;
968
+ let idxInOld = 0;
969
+ let i = 0;
970
+ let oldEndIdx = oldCh.length - 1;
971
+ let oldStartVnode = oldCh[0];
972
+ let oldEndVnode = oldCh[oldEndIdx];
973
+ let newEndIdx = newCh.length - 1;
974
+ let newStartVnode = newCh[0];
975
+ let newEndVnode = newCh[newEndIdx];
976
+ let node;
977
+ let elmToMove;
978
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
979
+ if (oldStartVnode == null) {
980
+ // VNode might have been moved left
981
+ oldStartVnode = oldCh[++oldStartIdx];
946
982
  }
947
- if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
948
- return true;
983
+ else if (oldEndVnode == null) {
984
+ oldEndVnode = oldCh[--oldEndIdx];
949
985
  }
950
- return false;
951
- }
952
- if (nodeToRelocate['s-sn'] === slotNameAttr) {
953
- return true;
954
- }
955
- return slotNameAttr === '';
956
- };
957
- const callNodeRefs = (vNode) => {
958
- {
959
- vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
960
- vNode.$children$ && vNode.$children$.map(callNodeRefs);
961
- }
962
- };
963
- const renderVdom = (hostRef, renderFnResults) => {
964
- const hostElm = hostRef.$hostElement$;
965
- const cmpMeta = hostRef.$cmpMeta$;
966
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
967
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
968
- hostTagName = hostElm.tagName;
969
- if (cmpMeta.$attrsToReflect$) {
970
- rootVnode.$attrs$ = rootVnode.$attrs$ || {};
971
- cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
972
- }
973
- rootVnode.$tag$ = null;
974
- rootVnode.$flags$ |= 4 /* isHost */;
975
- hostRef.$vnode$ = rootVnode;
976
- rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
977
- {
978
- scopeId = hostElm['s-sc'];
979
- }
980
- {
981
- contentRef = hostElm['s-cr'];
982
- useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
983
- // always reset
984
- checkSlotFallbackVisibility = false;
985
- }
986
- // synchronous patch
987
- patch(oldVNode, rootVnode);
988
- {
989
- // while we're moving nodes around existing nodes, temporarily disable
990
- // the disconnectCallback from working
991
- plt.$flags$ |= 1 /* isTmpDisconnected */;
992
- if (checkSlotRelocate) {
993
- relocateSlotContent(rootVnode.$elm$);
994
- let relocateData;
995
- let nodeToRelocate;
996
- let orgLocationNode;
997
- let parentNodeRef;
998
- let insertBeforeNode;
999
- let refNode;
1000
- let i = 0;
1001
- for (; i < relocateNodes.length; i++) {
1002
- relocateData = relocateNodes[i];
1003
- nodeToRelocate = relocateData.$nodeToRelocate$;
1004
- if (!nodeToRelocate['s-ol']) {
1005
- // add a reference node marking this node's original location
1006
- // keep a reference to this node for later lookups
1007
- orgLocationNode =
1008
- doc.createTextNode('');
1009
- orgLocationNode['s-nr'] = nodeToRelocate;
1010
- nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1011
- }
986
+ else if (newStartVnode == null) {
987
+ newStartVnode = newCh[++newStartIdx];
988
+ }
989
+ else if (newEndVnode == null) {
990
+ newEndVnode = newCh[--newEndIdx];
991
+ }
992
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
993
+ // if the start nodes are the same then we should patch the new VNode
994
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
995
+ // indices to reflect that. We don't need to move any DOM Nodes around
996
+ // since things are matched up in order.
997
+ patch(oldStartVnode, newStartVnode);
998
+ oldStartVnode = oldCh[++oldStartIdx];
999
+ newStartVnode = newCh[++newStartIdx];
1000
+ }
1001
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
1002
+ // likewise, if the end nodes are the same we patch new onto old and
1003
+ // decrement our end indices, and also likewise in this case we don't
1004
+ // need to move any DOM Nodes.
1005
+ patch(oldEndVnode, newEndVnode);
1006
+ oldEndVnode = oldCh[--oldEndIdx];
1007
+ newEndVnode = newCh[--newEndIdx];
1008
+ }
1009
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
1010
+ // case: "Vnode moved right"
1011
+ //
1012
+ // We've found that the last node in our window on the new children is
1013
+ // the same VNode as the _first_ node in our window on the old children
1014
+ // we're dealing with now. Visually, this is the layout of these two
1015
+ // nodes:
1016
+ //
1017
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
1018
+ // ^^^^^^^^^^^
1019
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
1020
+ // ^^^^^^^^^^^^^
1021
+ //
1022
+ // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
1023
+ // and move the DOM element for `oldStartVnode`.
1024
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1025
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
1012
1026
  }
1013
- for (i = 0; i < relocateNodes.length; i++) {
1014
- relocateData = relocateNodes[i];
1015
- nodeToRelocate = relocateData.$nodeToRelocate$;
1016
- if (relocateData.$slotRefNode$) {
1017
- // by default we're just going to insert it directly
1018
- // after the slot reference node
1019
- parentNodeRef = relocateData.$slotRefNode$.parentNode;
1020
- insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
1021
- orgLocationNode = nodeToRelocate['s-ol'];
1022
- while ((orgLocationNode = orgLocationNode.previousSibling)) {
1023
- refNode = orgLocationNode['s-nr'];
1024
- if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1025
- refNode = refNode.nextSibling;
1026
- if (!refNode || !refNode['s-nr']) {
1027
- insertBeforeNode = refNode;
1028
- break;
1029
- }
1030
- }
1031
- }
1032
- if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
1033
- nodeToRelocate.nextSibling !== insertBeforeNode) {
1034
- // we've checked that it's worth while to relocate
1035
- // since that the node to relocate
1036
- // has a different next sibling or parent relocated
1037
- if (nodeToRelocate !== insertBeforeNode) {
1038
- if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
1039
- // probably a component in the index.html that doesn't have it's hostname set
1040
- nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
1041
- }
1042
- // add it back to the dom but in its new home
1043
- parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1044
- }
1027
+ patch(oldStartVnode, newEndVnode);
1028
+ // We need to move the element for `oldStartVnode` into a position which
1029
+ // will be appropriate for `newEndVnode`. For this we can use
1030
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
1031
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
1032
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
1033
+ //
1034
+ // <old-start-node />
1035
+ // <some-intervening-node />
1036
+ // <old-end-node />
1037
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
1038
+ // <next-sibling />
1039
+ //
1040
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
1041
+ // the node for `oldStartVnode` at the end of the children of
1042
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
1043
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
1044
+ // append it to the children of the parent element.
1045
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1046
+ oldStartVnode = oldCh[++oldStartIdx];
1047
+ newEndVnode = newCh[--newEndIdx];
1048
+ }
1049
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
1050
+ // case: "Vnode moved left"
1051
+ //
1052
+ // We've found that the first node in our window on the new children is
1053
+ // the same VNode as the _last_ node in our window on the old children.
1054
+ // Visually, this is the layout of these two nodes:
1055
+ //
1056
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
1057
+ // ^^^^^^^^^^^^^
1058
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
1059
+ // ^^^^^^^^^^^
1060
+ //
1061
+ // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
1062
+ // (which will handle updating any changed attributes, reconciling their
1063
+ // children etc) but we also need to move the DOM node to which
1064
+ // `oldEndVnode` corresponds.
1065
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1066
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1067
+ }
1068
+ patch(oldEndVnode, newStartVnode);
1069
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
1070
+ // the same node, so since we're here we know that they are not. Thus we
1071
+ // can move the element for `oldEndVnode` _before_ the element for
1072
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
1073
+ // future.
1074
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
1075
+ oldEndVnode = oldCh[--oldEndIdx];
1076
+ newStartVnode = newCh[++newStartIdx];
1077
+ }
1078
+ else {
1079
+ // Here we do some checks to match up old and new nodes based on the
1080
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
1081
+ // in the JSX for a DOM element in the implementation of a Stencil
1082
+ // component.
1083
+ //
1084
+ // First we check to see if there are any nodes in the array of old
1085
+ // children which have the same key as the first node in the new
1086
+ // children.
1087
+ idxInOld = -1;
1088
+ {
1089
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
1090
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
1091
+ idxInOld = i;
1092
+ break;
1045
1093
  }
1046
1094
  }
1095
+ }
1096
+ if (idxInOld >= 0) {
1097
+ // We found a node in the old children which matches up with the first
1098
+ // node in the new children! So let's deal with that
1099
+ elmToMove = oldCh[idxInOld];
1100
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1101
+ // the tag doesn't match so we'll need a new DOM element
1102
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
1103
+ }
1047
1104
  else {
1048
- // this node doesn't have a slot home to go to, so let's hide it
1049
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1050
- nodeToRelocate.hidden = true;
1051
- }
1105
+ patch(elmToMove, newStartVnode);
1106
+ // invalidate the matching old node so that we won't try to update it
1107
+ // again later on
1108
+ oldCh[idxInOld] = undefined;
1109
+ node = elmToMove.$elm$;
1110
+ }
1111
+ newStartVnode = newCh[++newStartIdx];
1112
+ }
1113
+ else {
1114
+ // We either didn't find an element in the old children that matches
1115
+ // the key of the first new child OR the build is not using `key`
1116
+ // attributes at all. In either case we need to create a new element
1117
+ // for the new node.
1118
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
1119
+ newStartVnode = newCh[++newStartIdx];
1120
+ }
1121
+ if (node) {
1122
+ // if we created a new node then handle inserting it to the DOM
1123
+ {
1124
+ parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
1052
1125
  }
1053
1126
  }
1054
1127
  }
1055
- if (checkSlotFallbackVisibility) {
1056
- updateFallbackSlotVisibility(rootVnode.$elm$);
1057
- }
1058
- // done moving nodes around
1059
- // allow the disconnect callback to work again
1060
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1061
- // always reset
1062
- relocateNodes.length = 0;
1063
1128
  }
1064
- };
1065
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
1066
- const createEvent = (ref, name, flags) => {
1067
- const elm = getElement(ref);
1068
- return {
1069
- emit: (detail) => {
1070
- return emitEvent(elm, name, {
1071
- bubbles: !!(flags & 4 /* Bubbles */),
1072
- composed: !!(flags & 2 /* Composed */),
1073
- cancelable: !!(flags & 1 /* Cancellable */),
1074
- detail,
1075
- });
1076
- },
1077
- };
1129
+ if (oldStartIdx > oldEndIdx) {
1130
+ // we have some more new nodes to add which don't match up with old nodes
1131
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
1132
+ }
1133
+ else if (newStartIdx > newEndIdx) {
1134
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
1135
+ // in the new array, so lets remove them (which entails cleaning up the
1136
+ // relevant DOM nodes)
1137
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1138
+ }
1078
1139
  };
1079
1140
  /**
1080
- * Helper function to create & dispatch a custom Event on a provided target
1081
- * @param elm the target of the Event
1082
- * @param name the name to give the custom Event
1083
- * @param opts options for configuring a custom Event
1084
- * @returns the custom Event
1141
+ * Compare two VNodes to determine if they are the same
1142
+ *
1143
+ * **NB**: This function is an equality _heuristic_ based on the available
1144
+ * information set on the two VNodes and can be misleading under certain
1145
+ * circumstances. In particular, if the two nodes do not have `key` attrs
1146
+ * (available under `$key$` on VNodes) then the function falls back on merely
1147
+ * checking that they have the same tag.
1148
+ *
1149
+ * So, in other words, if `key` attrs are not set on VNodes which may be
1150
+ * changing order within a `children` array or something along those lines then
1151
+ * we could obtain a false positive and then have to do needless re-rendering.
1152
+ *
1153
+ * @param leftVNode the first VNode to check
1154
+ * @param rightVNode the second VNode to check
1155
+ * @returns whether they're equal or not
1085
1156
  */
1086
- const emitEvent = (elm, name, opts) => {
1087
- const ev = plt.ce(name, opts);
1088
- elm.dispatchEvent(ev);
1089
- return ev;
1090
- };
1091
- const attachToAncestor = (hostRef, ancestorComponent) => {
1092
- if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1093
- ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
1157
+ const isSameVnode = (leftVNode, rightVNode) => {
1158
+ // compare if two vnode to see if they're "technically" the same
1159
+ // need to have the same element tag, and same key to be the same
1160
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
1161
+ if (leftVNode.$tag$ === 'slot') {
1162
+ return leftVNode.$name$ === rightVNode.$name$;
1163
+ }
1164
+ // this will be set if components in the build have `key` attrs set on them
1165
+ {
1166
+ return leftVNode.$key$ === rightVNode.$key$;
1167
+ }
1094
1168
  }
1169
+ return false;
1095
1170
  };
1096
- const scheduleUpdate = (hostRef, isInitialLoad) => {
1097
- {
1098
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1099
- }
1100
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1101
- hostRef.$flags$ |= 512 /* needsRerender */;
1102
- return;
1103
- }
1104
- attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1105
- // there is no ancestor component or the ancestor component
1106
- // has already fired off its lifecycle update then
1107
- // fire off the initial update
1108
- const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1109
- return writeTask(dispatch) ;
1171
+ const referenceNode = (node) => {
1172
+ // this node was relocated to a new location in the dom
1173
+ // because of some other component's slot
1174
+ // but we still have an html comment in place of where
1175
+ // it's original location was according to it's original vdom
1176
+ return (node && node['s-ol']) || node;
1110
1177
  };
1111
- const dispatchHooks = (hostRef, isInitialLoad) => {
1112
- const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1113
- const instance = hostRef.$lazyInstance$ ;
1114
- let promise;
1115
- if (isInitialLoad) {
1178
+ const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
1179
+ /**
1180
+ * Handle reconciling an outdated VNode with a new one which corresponds to
1181
+ * it. This function handles flushing updates to the DOM and reconciling the
1182
+ * children of the two nodes (if any).
1183
+ *
1184
+ * @param oldVNode an old VNode whose DOM element and children we want to update
1185
+ * @param newVNode a new VNode representing an updated version of the old one
1186
+ */
1187
+ const patch = (oldVNode, newVNode) => {
1188
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
1189
+ const oldChildren = oldVNode.$children$;
1190
+ const newChildren = newVNode.$children$;
1191
+ const tag = newVNode.$tag$;
1192
+ const text = newVNode.$text$;
1193
+ let defaultHolder;
1194
+ if (text === null) {
1116
1195
  {
1117
- hostRef.$flags$ |= 256 /* isListenReady */;
1118
- if (hostRef.$queuedListeners$) {
1119
- hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1120
- hostRef.$queuedListeners$ = null;
1121
- }
1196
+ // test if we're rendering an svg element, or still rendering nodes inside of one
1197
+ // only add this to the when the compiler sees we're using an svg somewhere
1198
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
1122
1199
  }
1123
1200
  {
1124
- promise = safeCall(instance, 'componentWillLoad');
1201
+ if (tag === 'slot')
1202
+ ;
1203
+ else {
1204
+ // either this is the first render of an element OR it's an update
1205
+ // AND we already know it's possible it could have changed
1206
+ // this updates the element's css classes, attrs, props, listeners, etc.
1207
+ updateElement(oldVNode, newVNode, isSvgMode);
1208
+ }
1125
1209
  }
1126
- }
1127
- {
1128
- promise = then(promise, () => safeCall(instance, 'componentWillRender'));
1129
- }
1130
- endSchedule();
1131
- return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1132
- };
1133
- const updateComponent = async (hostRef, instance, isInitialLoad) => {
1134
- // updateComponent
1135
- const elm = hostRef.$hostElement$;
1136
- const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1137
- const rc = elm['s-rc'];
1138
- if (isInitialLoad) {
1139
- // DOM WRITE!
1140
- attachStyles(hostRef);
1141
- }
1142
- const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1143
- {
1144
- callRender(hostRef, instance);
1145
- }
1146
- if (rc) {
1147
- // ok, so turns out there are some child host elements
1148
- // waiting on this parent element to load
1149
- // let's fire off all update callbacks waiting
1150
- rc.map((cb) => cb());
1151
- elm['s-rc'] = undefined;
1152
- }
1153
- endRender();
1154
- endUpdate();
1155
- {
1156
- const childrenPromises = elm['s-p'];
1157
- const postUpdate = () => postUpdateComponent(hostRef);
1158
- if (childrenPromises.length === 0) {
1159
- postUpdate();
1210
+ if (oldChildren !== null && newChildren !== null) {
1211
+ // looks like there's child vnodes for both the old and new vnodes
1212
+ // so we need to call `updateChildren` to reconcile them
1213
+ updateChildren(elm, oldChildren, newVNode, newChildren);
1160
1214
  }
1161
- else {
1162
- Promise.all(childrenPromises).then(postUpdate);
1163
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1164
- childrenPromises.length = 0;
1215
+ else if (newChildren !== null) {
1216
+ // no old child vnodes, but there are new child vnodes to add
1217
+ if (oldVNode.$text$ !== null) {
1218
+ // the old vnode was text, so be sure to clear it out
1219
+ elm.textContent = '';
1220
+ }
1221
+ // add the new vnode children
1222
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
1165
1223
  }
1166
- }
1167
- };
1168
- const callRender = (hostRef, instance, elm) => {
1169
- try {
1170
- instance = instance.render() ;
1171
- {
1172
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1224
+ else if (oldChildren !== null) {
1225
+ // no new child vnodes, but there are old child vnodes to remove
1226
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
1173
1227
  }
1174
- {
1175
- hostRef.$flags$ |= 2 /* hasRendered */;
1228
+ if (isSvgMode && tag === 'svg') {
1229
+ isSvgMode = false;
1176
1230
  }
1177
- {
1178
- {
1179
- // looks like we've got child nodes to render into this host element
1180
- // or we need to update the css class/attrs on the host element
1181
- // DOM WRITE!
1182
- {
1183
- renderVdom(hostRef, instance);
1231
+ }
1232
+ else if ((defaultHolder = elm['s-cr'])) {
1233
+ // this element has slotted content
1234
+ defaultHolder.parentNode.textContent = text;
1235
+ }
1236
+ else if (oldVNode.$text$ !== text) {
1237
+ // update the text content for the text only vnode
1238
+ // and also only if the text is different than before
1239
+ elm.data = text;
1240
+ }
1241
+ };
1242
+ const updateFallbackSlotVisibility = (elm) => {
1243
+ // tslint:disable-next-line: prefer-const
1244
+ const childNodes = elm.childNodes;
1245
+ let childNode;
1246
+ let i;
1247
+ let ilen;
1248
+ let j;
1249
+ let slotNameAttr;
1250
+ let nodeType;
1251
+ for (i = 0, ilen = childNodes.length; i < ilen; i++) {
1252
+ childNode = childNodes[i];
1253
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1254
+ if (childNode['s-sr']) {
1255
+ // this is a slot fallback node
1256
+ // get the slot name for this slot reference node
1257
+ slotNameAttr = childNode['s-sn'];
1258
+ // by default always show a fallback slot node
1259
+ // then hide it if there are other slots in the light dom
1260
+ childNode.hidden = false;
1261
+ for (j = 0; j < ilen; j++) {
1262
+ nodeType = childNodes[j].nodeType;
1263
+ if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
1264
+ // this sibling node is from a different component OR is a named fallback slot node
1265
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
1266
+ childNode.hidden = true;
1267
+ break;
1268
+ }
1269
+ }
1270
+ else {
1271
+ // this is a default fallback slot node
1272
+ // any element or text node (with content)
1273
+ // should hide the default fallback slot node
1274
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
1275
+ (nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
1276
+ childNode.hidden = true;
1277
+ break;
1278
+ }
1279
+ }
1184
1280
  }
1185
1281
  }
1282
+ // keep drilling down
1283
+ updateFallbackSlotVisibility(childNode);
1186
1284
  }
1187
1285
  }
1188
- catch (e) {
1189
- consoleError(e, hostRef.$hostElement$);
1190
- }
1191
- return null;
1192
1286
  };
1193
- const postUpdateComponent = (hostRef) => {
1194
- const tagName = hostRef.$cmpMeta$.$tagName$;
1195
- const elm = hostRef.$hostElement$;
1196
- const endPostUpdate = createTime('postUpdate', tagName);
1197
- const instance = hostRef.$lazyInstance$ ;
1198
- const ancestorComponent = hostRef.$ancestorComponent$;
1199
- {
1200
- safeCall(instance, 'componentDidRender');
1201
- }
1202
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1203
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1204
- {
1205
- // DOM WRITE!
1206
- addHydratedFlag(elm);
1207
- }
1208
- {
1209
- safeCall(instance, 'componentDidLoad');
1210
- }
1211
- endPostUpdate();
1212
- {
1213
- hostRef.$onReadyResolve$(elm);
1214
- if (!ancestorComponent) {
1215
- appDidLoad();
1287
+ const relocateNodes = [];
1288
+ const relocateSlotContent = (elm) => {
1289
+ // tslint:disable-next-line: prefer-const
1290
+ let childNode;
1291
+ let node;
1292
+ let hostContentNodes;
1293
+ let slotNameAttr;
1294
+ let relocateNodeData;
1295
+ let j;
1296
+ let i = 0;
1297
+ const childNodes = elm.childNodes;
1298
+ const ilen = childNodes.length;
1299
+ for (; i < ilen; i++) {
1300
+ childNode = childNodes[i];
1301
+ if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
1302
+ // first got the content reference comment node
1303
+ // then we got it's parent, which is where all the host content is in now
1304
+ hostContentNodes = node.parentNode.childNodes;
1305
+ slotNameAttr = childNode['s-sn'];
1306
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
1307
+ node = hostContentNodes[j];
1308
+ if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
1309
+ // let's do some relocating to its new home
1310
+ // but never relocate a content reference node
1311
+ // that is suppose to always represent the original content location
1312
+ if (isNodeLocatedInSlot(node, slotNameAttr)) {
1313
+ // it's possible we've already decided to relocate this node
1314
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1315
+ // made some changes to slots
1316
+ // let's make sure we also double check
1317
+ // fallbacks are correctly hidden or shown
1318
+ checkSlotFallbackVisibility = true;
1319
+ node['s-sn'] = node['s-sn'] || slotNameAttr;
1320
+ if (relocateNodeData) {
1321
+ // previously we never found a slot home for this node
1322
+ // but turns out we did, so let's remember it now
1323
+ relocateNodeData.$slotRefNode$ = childNode;
1324
+ }
1325
+ else {
1326
+ // add to our list of nodes to relocate
1327
+ relocateNodes.push({
1328
+ $slotRefNode$: childNode,
1329
+ $nodeToRelocate$: node,
1330
+ });
1331
+ }
1332
+ if (node['s-sr']) {
1333
+ relocateNodes.map((relocateNode) => {
1334
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
1335
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1336
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
1337
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1338
+ }
1339
+ }
1340
+ });
1341
+ }
1342
+ }
1343
+ else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
1344
+ // so far this element does not have a slot home, not setting slotRefNode on purpose
1345
+ // if we never find a home for this element then we'll need to hide it
1346
+ relocateNodes.push({
1347
+ $nodeToRelocate$: node,
1348
+ });
1349
+ }
1350
+ }
1216
1351
  }
1217
1352
  }
1218
- }
1219
- else {
1220
- {
1221
- safeCall(instance, 'componentDidUpdate');
1353
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1354
+ relocateSlotContent(childNode);
1222
1355
  }
1223
- endPostUpdate();
1224
- }
1225
- {
1226
- hostRef.$onInstanceResolve$(elm);
1227
1356
  }
1228
- // load events fire from bottom to top
1229
- // the deepest elements load first then bubbles up
1230
- {
1231
- if (hostRef.$onRenderResolve$) {
1232
- hostRef.$onRenderResolve$();
1233
- hostRef.$onRenderResolve$ = undefined;
1357
+ };
1358
+ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
1359
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1360
+ if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
1361
+ return true;
1234
1362
  }
1235
- if (hostRef.$flags$ & 512 /* needsRerender */) {
1236
- nextTick(() => scheduleUpdate(hostRef, false));
1363
+ if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
1364
+ return true;
1237
1365
  }
1238
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1366
+ return false;
1239
1367
  }
1240
- // ( •_•)
1241
- // ( •_•)>⌐■-■
1242
- // (⌐■_■)
1243
- };
1244
- const appDidLoad = (who) => {
1245
- // on appload
1246
- // we have finish the first big initial render
1247
- {
1248
- addHydratedFlag(doc.documentElement);
1368
+ if (nodeToRelocate['s-sn'] === slotNameAttr) {
1369
+ return true;
1249
1370
  }
1250
- nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1371
+ return slotNameAttr === '';
1251
1372
  };
1252
- const safeCall = (instance, method, arg) => {
1253
- if (instance && instance[method]) {
1254
- try {
1255
- return instance[method](arg);
1256
- }
1257
- catch (e) {
1258
- consoleError(e);
1259
- }
1373
+ const callNodeRefs = (vNode) => {
1374
+ {
1375
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1376
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
1260
1377
  }
1261
- return undefined;
1262
- };
1263
- const then = (promise, thenFn) => {
1264
- return promise && promise.then ? promise.then(thenFn) : thenFn();
1265
1378
  };
1266
- const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1267
- ;
1268
- const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1269
- const endHydrate = createTime('hydrateClient', tagName);
1270
- const shadowRoot = hostElm.shadowRoot;
1271
- const childRenderNodes = [];
1272
- const slotNodes = [];
1273
- const shadowRootNodes = shadowRoot ? [] : null;
1274
- const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
1275
- if (!plt.$orgLocNodes$) {
1276
- initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
1379
+ const renderVdom = (hostRef, renderFnResults) => {
1380
+ const hostElm = hostRef.$hostElement$;
1381
+ const cmpMeta = hostRef.$cmpMeta$;
1382
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1383
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1384
+ hostTagName = hostElm.tagName;
1385
+ if (cmpMeta.$attrsToReflect$) {
1386
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1387
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
1277
1388
  }
1278
- hostElm[HYDRATE_ID] = hostId;
1279
- hostElm.removeAttribute(HYDRATE_ID);
1280
- clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
1281
- childRenderNodes.map((c) => {
1282
- const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
1283
- const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1284
- const node = c.$elm$;
1285
- if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
1286
- orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1287
- }
1288
- if (!shadowRoot) {
1289
- node['s-hn'] = tagName;
1290
- if (orgLocationNode) {
1291
- node['s-ol'] = orgLocationNode;
1292
- node['s-ol']['s-nr'] = node;
1293
- }
1294
- }
1295
- plt.$orgLocNodes$.delete(orgLocationId);
1296
- });
1297
- if (shadowRoot) {
1298
- shadowRootNodes.map((shadowRootNode) => {
1299
- if (shadowRootNode) {
1300
- shadowRoot.appendChild(shadowRootNode);
1301
- }
1302
- });
1389
+ rootVnode.$tag$ = null;
1390
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
1391
+ hostRef.$vnode$ = rootVnode;
1392
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
1393
+ {
1394
+ scopeId = hostElm['s-sc'];
1303
1395
  }
1304
- endHydrate();
1305
- };
1306
- const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
1307
- let childNodeType;
1308
- let childIdSplt;
1309
- let childVNode;
1310
- let i;
1311
- if (node.nodeType === 1 /* ElementNode */) {
1312
- childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
1313
- if (childNodeType) {
1314
- // got the node data from the element's attribute
1315
- // `${hostId}.${nodeId}.${depth}.${index}`
1316
- childIdSplt = childNodeType.split('.');
1317
- if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
1318
- childVNode = {
1319
- $flags$: 0,
1320
- $hostId$: childIdSplt[0],
1321
- $nodeId$: childIdSplt[1],
1322
- $depth$: childIdSplt[2],
1323
- $index$: childIdSplt[3],
1324
- $tag$: node.tagName.toLowerCase(),
1325
- $elm$: node,
1326
- $attrs$: null,
1327
- $children$: null,
1328
- $key$: null,
1329
- $name$: null,
1330
- $text$: null,
1331
- };
1332
- childRenderNodes.push(childVNode);
1333
- node.removeAttribute(HYDRATE_CHILD_ID);
1334
- // this is a new child vnode
1335
- // so ensure its parent vnode has the vchildren array
1336
- if (!parentVNode.$children$) {
1337
- parentVNode.$children$ = [];
1338
- }
1339
- // add our child vnode to a specific index of the vnode's children
1340
- parentVNode.$children$[childVNode.$index$] = childVNode;
1341
- // this is now the new parent vnode for all the next child checks
1342
- parentVNode = childVNode;
1343
- if (shadowRootNodes && childVNode.$depth$ === '0') {
1344
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1345
- }
1346
- }
1347
- }
1348
- // recursively drill down, end to start so we can remove nodes
1349
- for (i = node.childNodes.length - 1; i >= 0; i--) {
1350
- clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
1351
- }
1352
- if (node.shadowRoot) {
1353
- // keep drilling down through the shadow root nodes
1354
- for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
1355
- clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
1356
- }
1357
- }
1396
+ {
1397
+ contentRef = hostElm['s-cr'];
1398
+ useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
1399
+ // always reset
1400
+ checkSlotFallbackVisibility = false;
1358
1401
  }
1359
- else if (node.nodeType === 8 /* CommentNode */) {
1360
- // `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
1361
- childIdSplt = node.nodeValue.split('.');
1362
- if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
1363
- // comment node for either the host id or a 0 host id
1364
- childNodeType = childIdSplt[0];
1365
- childVNode = {
1366
- $flags$: 0,
1367
- $hostId$: childIdSplt[1],
1368
- $nodeId$: childIdSplt[2],
1369
- $depth$: childIdSplt[3],
1370
- $index$: childIdSplt[4],
1371
- $elm$: node,
1372
- $attrs$: null,
1373
- $children$: null,
1374
- $key$: null,
1375
- $name$: null,
1376
- $tag$: null,
1377
- $text$: null,
1378
- };
1379
- if (childNodeType === TEXT_NODE_ID) {
1380
- childVNode.$elm$ = node.nextSibling;
1381
- if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
1382
- childVNode.$text$ = childVNode.$elm$.textContent;
1383
- childRenderNodes.push(childVNode);
1384
- // remove the text comment since it's no longer needed
1385
- node.remove();
1386
- if (!parentVNode.$children$) {
1387
- parentVNode.$children$ = [];
1388
- }
1389
- parentVNode.$children$[childVNode.$index$] = childVNode;
1390
- if (shadowRootNodes && childVNode.$depth$ === '0') {
1391
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1392
- }
1402
+ // synchronous patch
1403
+ patch(oldVNode, rootVnode);
1404
+ {
1405
+ // while we're moving nodes around existing nodes, temporarily disable
1406
+ // the disconnectCallback from working
1407
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1408
+ if (checkSlotRelocate) {
1409
+ relocateSlotContent(rootVnode.$elm$);
1410
+ let relocateData;
1411
+ let nodeToRelocate;
1412
+ let orgLocationNode;
1413
+ let parentNodeRef;
1414
+ let insertBeforeNode;
1415
+ let refNode;
1416
+ let i = 0;
1417
+ for (; i < relocateNodes.length; i++) {
1418
+ relocateData = relocateNodes[i];
1419
+ nodeToRelocate = relocateData.$nodeToRelocate$;
1420
+ if (!nodeToRelocate['s-ol']) {
1421
+ // add a reference node marking this node's original location
1422
+ // keep a reference to this node for later lookups
1423
+ orgLocationNode =
1424
+ doc.createTextNode('');
1425
+ orgLocationNode['s-nr'] = nodeToRelocate;
1426
+ nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1393
1427
  }
1394
1428
  }
1395
- else if (childVNode.$hostId$ === hostId) {
1396
- // this comment node is specifcally for this host id
1397
- if (childNodeType === SLOT_NODE_ID) {
1398
- // `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
1399
- childVNode.$tag$ = 'slot';
1400
- if (childIdSplt[5]) {
1401
- node['s-sn'] = childVNode.$name$ = childIdSplt[5];
1402
- }
1403
- else {
1404
- node['s-sn'] = '';
1405
- }
1406
- node['s-sr'] = true;
1407
- if (shadowRootNodes) {
1408
- // browser support shadowRoot and this is a shadow dom component
1409
- // create an actual slot element
1410
- childVNode.$elm$ = doc.createElement(childVNode.$tag$);
1411
- if (childVNode.$name$) {
1412
- // add the slot name attribute
1413
- childVNode.$elm$.setAttribute('name', childVNode.$name$);
1414
- }
1415
- // insert the new slot element before the slot comment
1416
- node.parentNode.insertBefore(childVNode.$elm$, node);
1417
- // remove the slot comment since it's not needed for shadow
1418
- node.remove();
1419
- if (childVNode.$depth$ === '0') {
1420
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1429
+ for (i = 0; i < relocateNodes.length; i++) {
1430
+ relocateData = relocateNodes[i];
1431
+ nodeToRelocate = relocateData.$nodeToRelocate$;
1432
+ if (relocateData.$slotRefNode$) {
1433
+ // by default we're just going to insert it directly
1434
+ // after the slot reference node
1435
+ parentNodeRef = relocateData.$slotRefNode$.parentNode;
1436
+ insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
1437
+ orgLocationNode = nodeToRelocate['s-ol'];
1438
+ while ((orgLocationNode = orgLocationNode.previousSibling)) {
1439
+ refNode = orgLocationNode['s-nr'];
1440
+ if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1441
+ refNode = refNode.nextSibling;
1442
+ if (!refNode || !refNode['s-nr']) {
1443
+ insertBeforeNode = refNode;
1444
+ break;
1445
+ }
1421
1446
  }
1422
1447
  }
1423
- slotNodes.push(childVNode);
1424
- if (!parentVNode.$children$) {
1425
- parentVNode.$children$ = [];
1448
+ if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
1449
+ nodeToRelocate.nextSibling !== insertBeforeNode) {
1450
+ // we've checked that it's worth while to relocate
1451
+ // since that the node to relocate
1452
+ // has a different next sibling or parent relocated
1453
+ if (nodeToRelocate !== insertBeforeNode) {
1454
+ if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
1455
+ // probably a component in the index.html that doesn't have it's hostname set
1456
+ nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
1457
+ }
1458
+ // add it back to the dom but in its new home
1459
+ parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1460
+ }
1426
1461
  }
1427
- parentVNode.$children$[childVNode.$index$] = childVNode;
1428
1462
  }
1429
- else if (childNodeType === CONTENT_REF_ID) {
1430
- // `${CONTENT_REF_ID}.${hostId}`;
1431
- if (shadowRootNodes) {
1432
- // remove the content ref comment since it's not needed for shadow
1433
- node.remove();
1434
- }
1435
- else {
1436
- hostElm['s-cr'] = node;
1437
- node['s-cn'] = true;
1463
+ else {
1464
+ // this node doesn't have a slot home to go to, so let's hide it
1465
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1466
+ nodeToRelocate.hidden = true;
1438
1467
  }
1439
1468
  }
1440
1469
  }
1441
1470
  }
1471
+ if (checkSlotFallbackVisibility) {
1472
+ updateFallbackSlotVisibility(rootVnode.$elm$);
1473
+ }
1474
+ // done moving nodes around
1475
+ // allow the disconnect callback to work again
1476
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1477
+ // always reset
1478
+ relocateNodes.length = 0;
1479
+ }
1480
+ };
1481
+ const attachToAncestor = (hostRef, ancestorComponent) => {
1482
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1483
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
1484
+ }
1485
+ };
1486
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
1487
+ {
1488
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1489
+ }
1490
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1491
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1492
+ return;
1493
+ }
1494
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1495
+ // there is no ancestor component or the ancestor component
1496
+ // has already fired off its lifecycle update then
1497
+ // fire off the initial update
1498
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1499
+ return writeTask(dispatch) ;
1500
+ };
1501
+ const dispatchHooks = (hostRef, isInitialLoad) => {
1502
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1503
+ const instance = hostRef.$lazyInstance$ ;
1504
+ let promise;
1505
+ if (isInitialLoad) {
1506
+ {
1507
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1508
+ if (hostRef.$queuedListeners$) {
1509
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1510
+ hostRef.$queuedListeners$ = null;
1511
+ }
1512
+ }
1513
+ {
1514
+ promise = safeCall(instance, 'componentWillLoad');
1515
+ }
1516
+ }
1517
+ {
1518
+ promise = then(promise, () => safeCall(instance, 'componentWillRender'));
1519
+ }
1520
+ endSchedule();
1521
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1522
+ };
1523
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1524
+ // updateComponent
1525
+ const elm = hostRef.$hostElement$;
1526
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1527
+ const rc = elm['s-rc'];
1528
+ if (isInitialLoad) {
1529
+ // DOM WRITE!
1530
+ attachStyles(hostRef);
1531
+ }
1532
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1533
+ {
1534
+ callRender(hostRef, instance);
1535
+ }
1536
+ if (rc) {
1537
+ // ok, so turns out there are some child host elements
1538
+ // waiting on this parent element to load
1539
+ // let's fire off all update callbacks waiting
1540
+ rc.map((cb) => cb());
1541
+ elm['s-rc'] = undefined;
1542
+ }
1543
+ endRender();
1544
+ endUpdate();
1545
+ {
1546
+ const childrenPromises = elm['s-p'];
1547
+ const postUpdate = () => postUpdateComponent(hostRef);
1548
+ if (childrenPromises.length === 0) {
1549
+ postUpdate();
1550
+ }
1551
+ else {
1552
+ Promise.all(childrenPromises).then(postUpdate);
1553
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1554
+ childrenPromises.length = 0;
1555
+ }
1556
+ }
1557
+ };
1558
+ const callRender = (hostRef, instance, elm) => {
1559
+ try {
1560
+ instance = instance.render() ;
1561
+ {
1562
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1563
+ }
1564
+ {
1565
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1566
+ }
1567
+ {
1568
+ {
1569
+ // looks like we've got child nodes to render into this host element
1570
+ // or we need to update the css class/attrs on the host element
1571
+ // DOM WRITE!
1572
+ {
1573
+ renderVdom(hostRef, instance);
1574
+ }
1575
+ }
1576
+ }
1442
1577
  }
1443
- else if (parentVNode && parentVNode.$tag$ === 'style') {
1444
- const vnode = newVNode(null, node.textContent);
1445
- vnode.$elm$ = node;
1446
- vnode.$index$ = '0';
1447
- parentVNode.$children$ = [vnode];
1578
+ catch (e) {
1579
+ consoleError(e, hostRef.$hostElement$);
1448
1580
  }
1581
+ return null;
1449
1582
  };
1450
- const initializeDocumentHydrate = (node, orgLocNodes) => {
1451
- if (node.nodeType === 1 /* ElementNode */) {
1452
- let i = 0;
1453
- for (; i < node.childNodes.length; i++) {
1454
- initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
1583
+ const postUpdateComponent = (hostRef) => {
1584
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1585
+ const elm = hostRef.$hostElement$;
1586
+ const endPostUpdate = createTime('postUpdate', tagName);
1587
+ const instance = hostRef.$lazyInstance$ ;
1588
+ const ancestorComponent = hostRef.$ancestorComponent$;
1589
+ {
1590
+ safeCall(instance, 'componentDidRender');
1591
+ }
1592
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1593
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1594
+ {
1595
+ // DOM WRITE!
1596
+ addHydratedFlag(elm);
1455
1597
  }
1456
- if (node.shadowRoot) {
1457
- for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
1458
- initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
1598
+ {
1599
+ safeCall(instance, 'componentDidLoad');
1600
+ }
1601
+ endPostUpdate();
1602
+ {
1603
+ hostRef.$onReadyResolve$(elm);
1604
+ if (!ancestorComponent) {
1605
+ appDidLoad();
1459
1606
  }
1460
1607
  }
1461
1608
  }
1462
- else if (node.nodeType === 8 /* CommentNode */) {
1463
- const childIdSplt = node.nodeValue.split('.');
1464
- if (childIdSplt[0] === ORG_LOCATION_ID) {
1465
- orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
1466
- node.nodeValue = '';
1467
- // useful to know if the original location is
1468
- // the root light-dom of a shadow dom component
1469
- node['s-en'] = childIdSplt[3];
1609
+ else {
1610
+ {
1611
+ safeCall(instance, 'componentDidUpdate');
1470
1612
  }
1613
+ endPostUpdate();
1471
1614
  }
1472
- };
1473
- /**
1474
- * Parse a new property value for a given property type.
1475
- *
1476
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
1477
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
1478
- * 1. `any`, the type given to `propValue` in the function signature
1479
- * 2. the type stored from `propType`.
1480
- *
1481
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
1482
- *
1483
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
1484
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
1485
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
1486
- * ```tsx
1487
- * <my-cmp prop-val={0}></my-cmp>
1488
- * ```
1489
- *
1490
- * HTML prop values on the other hand, will always a string
1491
- *
1492
- * @param propValue the new value to coerce to some type
1493
- * @param propType the type of the prop, expressed as a binary number
1494
- * @returns the parsed/coerced value
1495
- */
1496
- const parsePropertyValue = (propValue, propType) => {
1497
- // ensure this value is of the correct prop type
1498
- if (propValue != null && !isComplexType(propValue)) {
1499
- if (propType & 4 /* Boolean */) {
1500
- // per the HTML spec, any string value means it is a boolean true value
1501
- // but we'll cheat here and say that the string "false" is the boolean false
1502
- return propValue === 'false' ? false : propValue === '' || !!propValue;
1615
+ {
1616
+ hostRef.$onInstanceResolve$(elm);
1617
+ }
1618
+ // load events fire from bottom to top
1619
+ // the deepest elements load first then bubbles up
1620
+ {
1621
+ if (hostRef.$onRenderResolve$) {
1622
+ hostRef.$onRenderResolve$();
1623
+ hostRef.$onRenderResolve$ = undefined;
1503
1624
  }
1504
- if (propType & 2 /* Number */) {
1505
- // force it to be a number
1506
- return parseFloat(propValue);
1625
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1626
+ nextTick(() => scheduleUpdate(hostRef, false));
1507
1627
  }
1508
- if (propType & 1 /* String */) {
1509
- // could have been passed as a number or boolean
1510
- // but we still want it as a string
1511
- return String(propValue);
1628
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1629
+ }
1630
+ // ( •_•)
1631
+ // ( •_•)>⌐■-■
1632
+ // (⌐■_■)
1633
+ };
1634
+ const appDidLoad = (who) => {
1635
+ // on appload
1636
+ // we have finish the first big initial render
1637
+ {
1638
+ addHydratedFlag(doc.documentElement);
1639
+ }
1640
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1641
+ };
1642
+ const safeCall = (instance, method, arg) => {
1643
+ if (instance && instance[method]) {
1644
+ try {
1645
+ return instance[method](arg);
1646
+ }
1647
+ catch (e) {
1648
+ consoleError(e);
1512
1649
  }
1513
- // redundant return here for better minification
1514
- return propValue;
1515
1650
  }
1516
- // not sure exactly what type we want
1517
- // so no need to change to a different type
1518
- return propValue;
1651
+ return undefined;
1519
1652
  };
1653
+ const then = (promise, thenFn) => {
1654
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
1655
+ };
1656
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1657
+ ;
1520
1658
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1521
1659
  const setValue = (ref, propName, newVal, cmpMeta) => {
1522
1660
  // check our new property value against our internal value
@@ -1529,13 +1667,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1529
1667
  // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1530
1668
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1531
1669
  const didValueChange = newVal !== oldVal && !areBothNaN;
1532
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1670
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1533
1671
  // gadzooks! the property's value has changed!!
1534
1672
  // set our new value!
1535
1673
  hostRef.$instanceValues$.set(propName, newVal);
1536
1674
  if (instance) {
1537
1675
  // get an array of method names of watch functions to call
1538
- if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1676
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1539
1677
  const watchMethods = cmpMeta.$watchers$[propName];
1540
1678
  if (watchMethods) {
1541
1679
  // this instance is watching for when this property changed
@@ -1550,7 +1688,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1550
1688
  });
1551
1689
  }
1552
1690
  }
1553
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1691
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1554
1692
  // looks like this value actually changed, so we've got work to do!
1555
1693
  // but only if we've already rendered, otherwise just chill out
1556
1694
  // queue that we need to do an update, but don't worry about queuing
@@ -1560,6 +1698,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1560
1698
  }
1561
1699
  }
1562
1700
  };
1701
+ /**
1702
+ * Attach a series of runtime constructs to a compiled Stencil component
1703
+ * constructor, including getters and setters for the `@Prop` and `@State`
1704
+ * decorators, callbacks for when attributes change, and so on.
1705
+ *
1706
+ * @param Cstr the constructor for a component that we need to process
1707
+ * @param cmpMeta metadata collected previously about the component
1708
+ * @param flags a number used to store a series of bit flags
1709
+ * @returns a reference to the same constructor passed in (but now mutated)
1710
+ */
1563
1711
  const proxyComponent = (Cstr, cmpMeta, flags) => {
1564
1712
  if (cmpMeta.$members$) {
1565
1713
  if (Cstr.watchers) {
@@ -1569,8 +1717,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1569
1717
  const members = Object.entries(cmpMeta.$members$);
1570
1718
  const prototype = Cstr.prototype;
1571
1719
  members.map(([memberName, [memberFlags]]) => {
1572
- if ((memberFlags & 31 /* Prop */ ||
1573
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1720
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1721
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1574
1722
  // proxyComponent - prop
1575
1723
  Object.defineProperty(prototype, memberName, {
1576
1724
  get() {
@@ -1585,8 +1733,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1585
1733
  enumerable: true,
1586
1734
  });
1587
1735
  }
1588
- else if (flags & 1 /* isElementConstructor */ &&
1589
- memberFlags & 64 /* Method */) {
1736
+ else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1737
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1590
1738
  // proxyComponent - method
1591
1739
  Object.defineProperty(prototype, memberName, {
1592
1740
  value(...args) {
@@ -1596,7 +1744,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1596
1744
  });
1597
1745
  }
1598
1746
  });
1599
- if ((flags & 1 /* isElementConstructor */)) {
1747
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1600
1748
  const attrNameToPropName = new Map();
1601
1749
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1602
1750
  plt.jmp(() => {
@@ -1652,11 +1800,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1652
1800
  // create an array of attributes to observe
1653
1801
  // and also create a map of html attribute name to js property name
1654
1802
  Cstr.observedAttributes = members
1655
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1803
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1656
1804
  .map(([propName, m]) => {
1657
1805
  const attrName = m[1] || propName;
1658
1806
  attrNameToPropName.set(attrName, propName);
1659
- if (m[0] & 512 /* ReflectAttr */) {
1807
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1660
1808
  cmpMeta.$attrsToReflect$.push([propName, attrName]);
1661
1809
  }
1662
1810
  return attrName;
@@ -1667,10 +1815,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1667
1815
  };
1668
1816
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1669
1817
  // initializeComponent
1670
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1818
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1671
1819
  {
1672
1820
  // we haven't initialized this element yet
1673
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1821
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1674
1822
  // lazy loaded components
1675
1823
  // request the component's implementation to be
1676
1824
  // wired up with the host element
@@ -1688,7 +1836,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1688
1836
  {
1689
1837
  cmpMeta.$watchers$ = Cstr.watchers;
1690
1838
  }
1691
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1839
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1692
1840
  Cstr.isProxied = true;
1693
1841
  }
1694
1842
  const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
@@ -1696,7 +1844,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1696
1844
  // but let's keep track of when we start and stop
1697
1845
  // so that the getters/setters don't incorrectly step on data
1698
1846
  {
1699
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1847
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1700
1848
  }
1701
1849
  // construct the lazy-loaded component implementation
1702
1850
  // passing the hostRef is very important during
@@ -1709,10 +1857,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1709
1857
  consoleError(e);
1710
1858
  }
1711
1859
  {
1712
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1860
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1713
1861
  }
1714
1862
  {
1715
- hostRef.$flags$ |= 128 /* isWatchReady */;
1863
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1716
1864
  }
1717
1865
  endNewInstance();
1718
1866
  fireConnectedCallback(hostRef.$lazyInstance$);
@@ -1723,10 +1871,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1723
1871
  const scopeId = getScopeId(cmpMeta);
1724
1872
  if (!styles.has(scopeId)) {
1725
1873
  const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1726
- if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
1727
- style = await import('./shadow-css-501eda9a.js').then((m) => m.scopeCss(style, scopeId, false));
1874
+ if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
1875
+ style = await import('./shadow-css-a011f1fe.js').then((m) => m.scopeCss(style, scopeId, false));
1728
1876
  }
1729
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1877
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1730
1878
  endRegisterStyles();
1731
1879
  }
1732
1880
  }
@@ -1753,18 +1901,18 @@ const fireConnectedCallback = (instance) => {
1753
1901
  }
1754
1902
  };
1755
1903
  const connectedCallback = (elm) => {
1756
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1904
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1757
1905
  const hostRef = getHostRef(elm);
1758
1906
  const cmpMeta = hostRef.$cmpMeta$;
1759
1907
  const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1760
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1908
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1761
1909
  // first time this component has connected
1762
- hostRef.$flags$ |= 1 /* hasConnected */;
1910
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1763
1911
  let hostId;
1764
1912
  {
1765
1913
  hostId = elm.getAttribute(HYDRATE_ID);
1766
1914
  if (hostId) {
1767
- if (supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1915
+ if (supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1768
1916
  const scopeId = addStyle(elm.shadowRoot, cmpMeta);
1769
1917
  elm.classList.remove(scopeId + '-h', scopeId + '-s');
1770
1918
  }
@@ -1776,7 +1924,7 @@ const connectedCallback = (elm) => {
1776
1924
  // if the slot polyfill is required we'll need to put some nodes
1777
1925
  // in here to act as original content anchors as we move nodes around
1778
1926
  // host element has been connected to the DOM
1779
- if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1927
+ if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
1780
1928
  setContentReference(elm);
1781
1929
  }
1782
1930
  }
@@ -1787,7 +1935,7 @@ const connectedCallback = (elm) => {
1787
1935
  while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1788
1936
  // climb up the ancestors looking for the first
1789
1937
  // component that hasn't finished its lifecycle update yet
1790
- if ((ancestorComponent.nodeType === 1 /* ElementNode */ &&
1938
+ if ((ancestorComponent.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
1791
1939
  ancestorComponent.hasAttribute('s-id') &&
1792
1940
  ancestorComponent['s-p']) ||
1793
1941
  ancestorComponent['s-p']) {
@@ -1802,7 +1950,7 @@ const connectedCallback = (elm) => {
1802
1950
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1803
1951
  if (cmpMeta.$members$) {
1804
1952
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1805
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1953
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1806
1954
  const value = elm[memberName];
1807
1955
  delete elm[memberName];
1808
1956
  elm[memberName] = value;
@@ -1840,7 +1988,7 @@ const setContentReference = (elm) => {
1840
1988
  elm.insertBefore(contentRefElm, elm.firstChild);
1841
1989
  };
1842
1990
  const disconnectedCallback = (elm) => {
1843
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1991
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1844
1992
  const hostRef = getHostRef(elm);
1845
1993
  const instance = hostRef.$lazyInstance$ ;
1846
1994
  {
@@ -1860,7 +2008,7 @@ const patchChildSlotNodes = (elm, cmpMeta) => {
1860
2008
  return this[n];
1861
2009
  }
1862
2010
  }
1863
- if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
2011
+ if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
1864
2012
  const childNodesFn = elm.__lookupGetter__('childNodes');
1865
2013
  Object.defineProperty(elm, 'children', {
1866
2014
  get() {
@@ -1875,8 +2023,8 @@ const patchChildSlotNodes = (elm, cmpMeta) => {
1875
2023
  Object.defineProperty(elm, 'childNodes', {
1876
2024
  get() {
1877
2025
  const childNodes = childNodesFn.call(this);
1878
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0 &&
1879
- getHostRef(this).$flags$ & 2 /* hasRendered */) {
2026
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0 &&
2027
+ getHostRef(this).$flags$ & 2 /* HOST_FLAGS.hasRendered */) {
1880
2028
  const result = new FakeNodeList();
1881
2029
  for (let i = 0; i < childNodes.length; i++) {
1882
2030
  const slot = childNodes[i]['s-nr'];
@@ -1909,7 +2057,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1909
2057
  {
1910
2058
  // If the app is already hydrated there is not point to disable the
1911
2059
  // async queue. This will improve the first input delay
1912
- plt.$flags$ |= 2 /* appLoaded */;
2060
+ plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
1913
2061
  }
1914
2062
  {
1915
2063
  for (; i < styles.length; i++) {
@@ -1936,8 +2084,8 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1936
2084
  {
1937
2085
  cmpMeta.$watchers$ = {};
1938
2086
  }
1939
- if (!supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1940
- cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
2087
+ if (!supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2088
+ cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
1941
2089
  }
1942
2090
  const tagName = cmpMeta.$tagName$;
1943
2091
  const HostElement = class extends HTMLElement {
@@ -1947,7 +2095,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1947
2095
  super(self);
1948
2096
  self = this;
1949
2097
  registerHost(self, cmpMeta);
1950
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2098
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1951
2099
  // this component is using shadow dom
1952
2100
  // and this browser supports shadow dom
1953
2101
  // add the read-only property "shadowRoot" to the host element
@@ -1956,7 +2104,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1956
2104
  {
1957
2105
  self.attachShadow({
1958
2106
  mode: 'open',
1959
- delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */),
2107
+ delegatesFocus: !!(cmpMeta.$flags$ & 16 /* CMP_FLAGS.shadowDelegatesFocus */),
1960
2108
  });
1961
2109
  }
1962
2110
  }
@@ -1991,7 +2139,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1991
2139
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
1992
2140
  if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1993
2141
  cmpTags.push(tagName);
1994
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
2142
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1995
2143
  }
1996
2144
  });
1997
2145
  });
@@ -2014,7 +2162,45 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
2014
2162
  endBootstrap();
2015
2163
  };
2016
2164
  const Fragment = (_, children) => children;
2017
- const hostRefs = new WeakMap();
2165
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
2166
+ if (listeners) {
2167
+ listeners.map(([flags, name, method]) => {
2168
+ const target = getHostListenerTarget(elm, flags) ;
2169
+ const handler = hostListenerProxy(hostRef, method);
2170
+ const opts = hostListenerOpts(flags);
2171
+ plt.ael(target, name, handler, opts);
2172
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
2173
+ });
2174
+ }
2175
+ };
2176
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
2177
+ try {
2178
+ {
2179
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
2180
+ // instance is ready, let's call it's member method for this event
2181
+ hostRef.$lazyInstance$[methodName](ev);
2182
+ }
2183
+ else {
2184
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
2185
+ }
2186
+ }
2187
+ }
2188
+ catch (e) {
2189
+ consoleError(e);
2190
+ }
2191
+ };
2192
+ const getHostListenerTarget = (elm, flags) => {
2193
+ if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
2194
+ return doc;
2195
+ if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
2196
+ return win;
2197
+ if (flags & 16 /* LISTENER_FLAGS.TargetBody */)
2198
+ return doc.body;
2199
+ return elm;
2200
+ };
2201
+ // prettier-ignore
2202
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
2203
+ const hostRefs = /*@__PURE__*/ new WeakMap();
2018
2204
  const getHostRef = (ref) => hostRefs.get(ref);
2019
2205
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
2020
2206
  const registerHost = (elm, cmpMeta) => {
@@ -2059,14 +2245,37 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2059
2245
  return importedModule[exportName];
2060
2246
  }, consoleError);
2061
2247
  };
2062
- const styles = new Map();
2248
+ const styles = /*@__PURE__*/ new Map();
2249
+ const win = typeof window !== 'undefined' ? window : {};
2250
+ const doc = win.document || { head: {} };
2251
+ const plt = {
2252
+ $flags$: 0,
2253
+ $resourcesUrl$: '',
2254
+ jmp: (h) => h(),
2255
+ raf: (h) => requestAnimationFrame(h),
2256
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
2257
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
2258
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
2259
+ };
2260
+ const supportsShadow = /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
2261
+ ;
2262
+ const promiseResolve = (v) => Promise.resolve(v);
2263
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
2264
+ try {
2265
+ new CSSStyleSheet();
2266
+ return typeof new CSSStyleSheet().replaceSync === 'function';
2267
+ }
2268
+ catch (e) { }
2269
+ return false;
2270
+ })()
2271
+ ;
2063
2272
  const queueDomReads = [];
2064
2273
  const queueDomWrites = [];
2065
2274
  const queueTask = (queue, write) => (cb) => {
2066
2275
  queue.push(cb);
2067
2276
  if (!queuePending) {
2068
2277
  queuePending = true;
2069
- if (write && plt.$flags$ & 4 /* queueSync */) {
2278
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
2070
2279
  nextTick(flush);
2071
2280
  }
2072
2281
  else {
@@ -2102,11 +2311,5 @@ const flush = () => {
2102
2311
  };
2103
2312
  const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
2104
2313
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
2105
- const Build = {
2106
- isDev: false,
2107
- isBrowser: true,
2108
- isServer: false,
2109
- isTesting: false,
2110
- };
2111
2314
 
2112
2315
  export { Build as B, Env as E, Fragment as F, Host as H, NAMESPACE as N, bootstrapLazy as b, createEvent as c, doc as d, getElement as g, h, promiseResolve as p, registerInstance as r, win as w };