@xplortech/apollo-core 1.0.0-beta.8 → 2.4.2

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