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