@quartzds/core 1.0.0-beta.9 → 1.0.0-beta.91

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