@revolist/revogrid 3.6.2 → 3.6.4

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 (451) hide show
  1. package/custom-element/_baseIteratee.js +3 -1
  2. package/custom-element/_baseIteratee.js.map +1 -0
  3. package/custom-element/columnService.js +6 -4
  4. package/custom-element/columnService.js.map +1 -0
  5. package/custom-element/consts.js +3 -1
  6. package/custom-element/consts.js.map +1 -0
  7. package/custom-element/data.store.js +55 -33
  8. package/custom-element/data.store.js.map +1 -0
  9. package/custom-element/debounce.js +3 -1
  10. package/custom-element/debounce.js.map +1 -0
  11. package/custom-element/dimension.helpers.js +3 -1
  12. package/custom-element/dimension.helpers.js.map +1 -0
  13. package/custom-element/each.js +2 -0
  14. package/custom-element/each.js.map +1 -0
  15. package/custom-element/filter.button.js +2 -0
  16. package/custom-element/filter.button.js.map +1 -0
  17. package/custom-element/identity.js +2 -0
  18. package/custom-element/identity.js.map +1 -0
  19. package/custom-element/index.d.ts +9 -16
  20. package/custom-element/index.js +4 -15
  21. package/custom-element/index.js.map +1 -0
  22. package/custom-element/isSymbol.js +3 -1
  23. package/custom-element/isSymbol.js.map +1 -0
  24. package/custom-element/keys.js +3 -1
  25. package/custom-element/keys.js.map +1 -0
  26. package/custom-element/localScrollService.js +2 -0
  27. package/custom-element/localScrollService.js.map +1 -0
  28. package/custom-element/resize-observer.js +5 -3
  29. package/custom-element/resize-observer.js.map +1 -0
  30. package/custom-element/revo-grid.js +39 -159
  31. package/custom-element/revo-grid.js.map +1 -0
  32. package/custom-element/revogr-clipboard.js +4 -4
  33. package/custom-element/revogr-clipboard.js.map +1 -0
  34. package/custom-element/revogr-data.js +2 -0
  35. package/custom-element/revogr-data.js.map +1 -0
  36. package/custom-element/revogr-data2.js +14 -3
  37. package/custom-element/revogr-data2.js.map +1 -0
  38. package/custom-element/revogr-edit.js +2 -0
  39. package/custom-element/revogr-edit.js.map +1 -0
  40. package/custom-element/revogr-edit2.js +7 -3
  41. package/custom-element/revogr-edit2.js.map +1 -0
  42. package/custom-element/revogr-filter-panel.js +10 -6
  43. package/custom-element/revogr-filter-panel.js.map +1 -0
  44. package/custom-element/revogr-focus.js +2 -0
  45. package/custom-element/revogr-focus.js.map +1 -0
  46. package/custom-element/revogr-focus2.js +8 -2
  47. package/custom-element/revogr-focus2.js.map +1 -0
  48. package/custom-element/revogr-header.js +2 -0
  49. package/custom-element/revogr-header.js.map +1 -0
  50. package/custom-element/revogr-header2.js +11 -3
  51. package/custom-element/revogr-header2.js.map +1 -0
  52. package/custom-element/revogr-order-editor.js +2 -0
  53. package/custom-element/revogr-order-editor.js.map +1 -0
  54. package/custom-element/revogr-order-editor2.js +8 -3
  55. package/custom-element/revogr-order-editor2.js.map +1 -0
  56. package/custom-element/revogr-overlay-selection.js +2 -0
  57. package/custom-element/revogr-overlay-selection.js.map +1 -0
  58. package/custom-element/revogr-overlay-selection2.js +15 -3
  59. package/custom-element/revogr-overlay-selection2.js.map +1 -0
  60. package/custom-element/revogr-row-headers.js +2 -0
  61. package/custom-element/revogr-row-headers.js.map +1 -0
  62. package/custom-element/revogr-row-headers2.js +9 -3
  63. package/custom-element/revogr-row-headers2.js.map +1 -0
  64. package/custom-element/revogr-scroll-virtual.js +2 -0
  65. package/custom-element/revogr-scroll-virtual.js.map +1 -0
  66. package/custom-element/revogr-scroll-virtual2.js +5 -2
  67. package/custom-element/revogr-scroll-virtual2.js.map +1 -0
  68. package/custom-element/revogr-temp-range.js +2 -0
  69. package/custom-element/revogr-temp-range.js.map +1 -0
  70. package/custom-element/revogr-temp-range2.js +8 -4
  71. package/custom-element/revogr-temp-range2.js.map +1 -0
  72. package/custom-element/revogr-viewport-scroll.js +2 -0
  73. package/custom-element/revogr-viewport-scroll.js.map +1 -0
  74. package/custom-element/revogr-viewport-scroll2.js +6 -11
  75. package/custom-element/revogr-viewport-scroll2.js.map +1 -0
  76. package/custom-element/selection.utils.js +2 -0
  77. package/custom-element/selection.utils.js.map +1 -0
  78. package/custom-element/themeService.js +65 -0
  79. package/custom-element/themeService.js.map +1 -0
  80. package/custom-element/toInteger.js +2 -0
  81. package/custom-element/toInteger.js.map +1 -0
  82. package/custom-element/toNumber.js +3 -1
  83. package/custom-element/toNumber.js.map +1 -0
  84. package/custom-element/utils.js +2 -0
  85. package/custom-element/utils.js.map +1 -0
  86. package/dist/cjs/{debounce-6cea2774.js → debounce-25dce8a1.js} +3 -1
  87. package/dist/cjs/debounce-25dce8a1.js.map +1 -0
  88. package/dist/cjs/{index-cb904e00.js → index-5f3dfe40.js} +577 -283
  89. package/dist/cjs/index-5f3dfe40.js.map +1 -0
  90. package/dist/cjs/index.cjs.js +2 -0
  91. package/dist/cjs/index.cjs.js.map +1 -0
  92. package/dist/cjs/loader.cjs.js +5 -16
  93. package/dist/cjs/loader.cjs.js.map +1 -0
  94. package/dist/cjs/{resize-observer-bf327d6a.js → resize-observer-7f159b88.js} +5 -3
  95. package/dist/cjs/resize-observer-7f159b88.js.map +1 -0
  96. package/dist/cjs/revo-grid.cjs.js +11 -59
  97. package/dist/cjs/revo-grid.cjs.js.map +1 -0
  98. package/dist/cjs/revo-grid_11.cjs.entry.js +153 -150
  99. package/dist/cjs/revo-grid_11.cjs.entry.js.map +1 -0
  100. package/dist/cjs/revogr-clipboard.cjs.entry.js +4 -3
  101. package/dist/cjs/revogr-clipboard.cjs.entry.js.map +1 -0
  102. package/dist/cjs/revogr-filter-panel.cjs.entry.js +11 -6
  103. package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -0
  104. package/dist/collection/collection-manifest.json +2 -2
  105. package/dist/collection/components/button/button.js +1 -0
  106. package/dist/collection/components/button/button.js.map +1 -0
  107. package/dist/collection/components/clipboard/revogr-clipboard.js +82 -80
  108. package/dist/collection/components/clipboard/revogr-clipboard.js.map +1 -0
  109. package/dist/collection/components/data/cellRenderer.js +2 -2
  110. package/dist/collection/components/data/cellRenderer.js.map +1 -0
  111. package/dist/collection/components/data/columnService.js +4 -3
  112. package/dist/collection/components/data/columnService.js.map +1 -0
  113. package/dist/collection/components/data/revogr-data.js +240 -219
  114. package/dist/collection/components/data/revogr-data.js.map +1 -0
  115. package/dist/collection/components/data/rowRenderer.js +1 -0
  116. package/dist/collection/components/data/rowRenderer.js.map +1 -0
  117. package/dist/collection/components/header/headerCellRenderer.js +2 -3
  118. package/dist/collection/components/header/headerCellRenderer.js.map +1 -0
  119. package/dist/collection/components/header/headerRenderer.js +2 -3
  120. package/dist/collection/components/header/headerRenderer.js.map +1 -0
  121. package/dist/collection/components/header/revogr-header.js +244 -229
  122. package/dist/collection/components/header/revogr-header.js.map +1 -0
  123. package/dist/collection/components/order/orderRenderer.js +2 -5
  124. package/dist/collection/components/order/orderRenderer.js.map +1 -0
  125. package/dist/collection/components/order/revogr-order-editor.js +257 -248
  126. package/dist/collection/components/order/revogr-order-editor.js.map +1 -0
  127. package/dist/collection/components/order/rowOrderService.js +1 -0
  128. package/dist/collection/components/order/rowOrderService.js.map +1 -0
  129. package/dist/collection/components/overlay/autofill.service.js +1 -0
  130. package/dist/collection/components/overlay/autofill.service.js.map +1 -0
  131. package/dist/collection/components/overlay/clipboard.service.js +1 -0
  132. package/dist/collection/components/overlay/clipboard.service.js.map +1 -0
  133. package/dist/collection/components/overlay/editors/edit.utils.js +1 -0
  134. package/dist/collection/components/overlay/editors/edit.utils.js.map +1 -0
  135. package/dist/collection/components/overlay/editors/text.js +1 -0
  136. package/dist/collection/components/overlay/editors/text.js.map +1 -0
  137. package/dist/collection/components/overlay/keyboard.service.js +1 -0
  138. package/dist/collection/components/overlay/keyboard.service.js.map +1 -0
  139. package/dist/collection/components/overlay/revogr-edit.js +106 -94
  140. package/dist/collection/components/overlay/revogr-edit.js.map +1 -0
  141. package/dist/collection/components/overlay/revogr-overlay-selection.js +488 -466
  142. package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -0
  143. package/dist/collection/components/overlay/selection.utils.js +1 -0
  144. package/dist/collection/components/overlay/selection.utils.js.map +1 -0
  145. package/dist/collection/components/revo-grid/revo-grid-style.css +7 -13
  146. package/dist/collection/components/revo-grid/revo-grid.js +1565 -1618
  147. package/dist/collection/components/revo-grid/revo-grid.js.map +1 -0
  148. package/dist/collection/components/revo-grid/viewport.helpers.js +1 -0
  149. package/dist/collection/components/revo-grid/viewport.helpers.js.map +1 -0
  150. package/dist/collection/components/revo-grid/viewport.interfaces.js +1 -3
  151. package/dist/collection/components/revo-grid/viewport.interfaces.js.map +1 -0
  152. package/dist/collection/components/revo-grid/viewport.js +2 -5
  153. package/dist/collection/components/revo-grid/viewport.js.map +1 -0
  154. package/dist/collection/components/revo-grid/viewport.resize.service.js +1 -0
  155. package/dist/collection/components/revo-grid/viewport.resize.service.js.map +1 -0
  156. package/dist/collection/components/revo-grid/viewport.scrolling.service.js +1 -0
  157. package/dist/collection/components/revo-grid/viewport.scrolling.service.js.map +1 -0
  158. package/dist/collection/components/revo-grid/viewport.section.js +2 -4
  159. package/dist/collection/components/revo-grid/viewport.section.js.map +1 -0
  160. package/dist/collection/components/revo-grid/viewport.service.js +8 -2
  161. package/dist/collection/components/revo-grid/viewport.service.js.map +1 -0
  162. package/dist/collection/components/rowHeaders/revogr-row-headers.js +151 -142
  163. package/dist/collection/components/rowHeaders/revogr-row-headers.js.map +1 -0
  164. package/dist/collection/components/rowHeaders/row-header-render.js +1 -0
  165. package/dist/collection/components/rowHeaders/row-header-render.js.map +1 -0
  166. package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +2 -4
  167. package/dist/collection/components/scroll/revogr-viewport-scroll.js +161 -164
  168. package/dist/collection/components/scroll/revogr-viewport-scroll.js.map +1 -0
  169. package/dist/collection/components/scrollable/revogr-scroll-virtual.js +147 -135
  170. package/dist/collection/components/scrollable/revogr-scroll-virtual.js.map +1 -0
  171. package/dist/collection/components/selection-focus/revogr-focus.js +141 -125
  172. package/dist/collection/components/selection-focus/revogr-focus.js.map +1 -0
  173. package/dist/collection/components/selection-temp-range/revogr-temp-range-style.css +1 -1
  174. package/dist/collection/components/selection-temp-range/revogr-temp-range.js +83 -74
  175. package/dist/collection/components/selection-temp-range/revogr-temp-range.js.map +1 -0
  176. package/dist/collection/global/global.js +1 -0
  177. package/dist/collection/global/global.js.map +1 -0
  178. package/dist/collection/index.js +1 -0
  179. package/dist/collection/index.js.map +1 -0
  180. package/dist/collection/plugins/autoSizeColumn.js +1 -0
  181. package/dist/collection/plugins/autoSizeColumn.js.map +1 -0
  182. package/dist/collection/plugins/basePlugin.js +1 -0
  183. package/dist/collection/plugins/basePlugin.js.map +1 -0
  184. package/dist/collection/plugins/dispatcher.js +1 -0
  185. package/dist/collection/plugins/dispatcher.js.map +1 -0
  186. package/dist/collection/plugins/export/csv.js +1 -0
  187. package/dist/collection/plugins/export/csv.js.map +1 -0
  188. package/dist/collection/plugins/export/export.plugin.js +1 -0
  189. package/dist/collection/plugins/export/export.plugin.js.map +1 -0
  190. package/dist/collection/plugins/export/types.js +1 -3
  191. package/dist/collection/plugins/export/types.js.map +1 -0
  192. package/dist/collection/plugins/filter/conditions/equal.js +1 -0
  193. package/dist/collection/plugins/filter/conditions/equal.js.map +1 -0
  194. package/dist/collection/plugins/filter/conditions/number/greaterThan.js +1 -0
  195. package/dist/collection/plugins/filter/conditions/number/greaterThan.js.map +1 -0
  196. package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js +1 -0
  197. package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js.map +1 -0
  198. package/dist/collection/plugins/filter/conditions/number/lessThan.js +1 -0
  199. package/dist/collection/plugins/filter/conditions/number/lessThan.js.map +1 -0
  200. package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js +1 -0
  201. package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js.map +1 -0
  202. package/dist/collection/plugins/filter/conditions/set.js +1 -0
  203. package/dist/collection/plugins/filter/conditions/set.js.map +1 -0
  204. package/dist/collection/plugins/filter/conditions/string/beginswith.js +1 -0
  205. package/dist/collection/plugins/filter/conditions/string/beginswith.js.map +1 -0
  206. package/dist/collection/plugins/filter/conditions/string/contains.js +1 -0
  207. package/dist/collection/plugins/filter/conditions/string/contains.js.map +1 -0
  208. package/dist/collection/plugins/filter/filter.button.js +6 -11
  209. package/dist/collection/plugins/filter/filter.button.js.map +1 -0
  210. package/dist/collection/plugins/filter/filter.plugin.js +1 -0
  211. package/dist/collection/plugins/filter/filter.plugin.js.map +1 -0
  212. package/dist/collection/plugins/filter/filter.pop.js +239 -234
  213. package/dist/collection/plugins/filter/filter.pop.js.map +1 -0
  214. package/dist/collection/plugins/filter/filter.service.js +1 -0
  215. package/dist/collection/plugins/filter/filter.service.js.map +1 -0
  216. package/dist/collection/plugins/filter/filter.style.css +2 -3
  217. package/dist/collection/plugins/filter/filter.types.js +1 -3
  218. package/dist/collection/plugins/filter/filter.types.js.map +1 -0
  219. package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js +1 -0
  220. package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js.map +1 -0
  221. package/dist/collection/plugins/groupingColumn/grouping.col.plugin.js +1 -0
  222. package/dist/collection/plugins/groupingColumn/grouping.col.plugin.js.map +1 -0
  223. package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js +1 -0
  224. package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js.map +1 -0
  225. package/dist/collection/plugins/groupingRow/grouping.const.js +1 -0
  226. package/dist/collection/plugins/groupingRow/grouping.const.js.map +1 -0
  227. package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js +1 -0
  228. package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js.map +1 -0
  229. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +6 -5
  230. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js.map +1 -0
  231. package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +3 -7
  232. package/dist/collection/plugins/groupingRow/grouping.row.renderer.js.map +1 -0
  233. package/dist/collection/plugins/groupingRow/grouping.row.types.js +1 -3
  234. package/dist/collection/plugins/groupingRow/grouping.row.types.js.map +1 -0
  235. package/dist/collection/plugins/groupingRow/grouping.service.js +1 -0
  236. package/dist/collection/plugins/groupingRow/grouping.service.js.map +1 -0
  237. package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +1 -0
  238. package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js.map +1 -0
  239. package/dist/collection/plugins/moveColumn/columnDragPlugin.js +1 -0
  240. package/dist/collection/plugins/moveColumn/columnDragPlugin.js.map +1 -0
  241. package/dist/collection/plugins/moveColumn/columnOrderHandler.js +1 -0
  242. package/dist/collection/plugins/moveColumn/columnOrderHandler.js.map +1 -0
  243. package/dist/collection/plugins/sorting/sorting.plugin.js +4 -3
  244. package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -0
  245. package/dist/collection/plugins/sorting/sorting.sign.js +1 -0
  246. package/dist/collection/plugins/sorting/sorting.sign.js.map +1 -0
  247. package/dist/collection/plugins/stretchPlugin.js +1 -0
  248. package/dist/collection/plugins/stretchPlugin.js.map +1 -0
  249. package/dist/collection/plugins/trimmed/trimmed.plugin.js +1 -0
  250. package/dist/collection/plugins/trimmed/trimmed.plugin.js.map +1 -0
  251. package/dist/collection/services/cell.helpers.js +1 -0
  252. package/dist/collection/services/cell.helpers.js.map +1 -0
  253. package/dist/collection/services/column.data.provider.js +8 -7
  254. package/dist/collection/services/column.data.provider.js.map +1 -0
  255. package/dist/collection/services/data.provider.js +1 -0
  256. package/dist/collection/services/data.provider.js.map +1 -0
  257. package/dist/collection/services/dimension.provider.js +1 -0
  258. package/dist/collection/services/dimension.provider.js.map +1 -0
  259. package/dist/collection/services/localScrollService.js +1 -0
  260. package/dist/collection/services/localScrollService.js.map +1 -0
  261. package/dist/collection/services/resizable.directive.js +2 -3
  262. package/dist/collection/services/resizable.directive.js.map +1 -0
  263. package/dist/collection/services/selection.store.connector.js +1 -0
  264. package/dist/collection/services/selection.store.connector.js.map +1 -0
  265. package/dist/collection/services/viewport.provider.js +1 -0
  266. package/dist/collection/services/viewport.provider.js.map +1 -0
  267. package/dist/collection/store/dataSource/data.proxy.js +1 -0
  268. package/dist/collection/store/dataSource/data.proxy.js.map +1 -0
  269. package/dist/collection/store/dataSource/data.store.js +4 -3
  270. package/dist/collection/store/dataSource/data.store.js.map +1 -0
  271. package/dist/collection/store/dimension/dimension.helpers.js +1 -0
  272. package/dist/collection/store/dimension/dimension.helpers.js.map +1 -0
  273. package/dist/collection/store/dimension/dimension.store.js +5 -3
  274. package/dist/collection/store/dimension/dimension.store.js.map +1 -0
  275. package/dist/collection/store/selection/selection.helpers.js +1 -0
  276. package/dist/collection/store/selection/selection.helpers.js.map +1 -0
  277. package/dist/collection/store/selection/selection.store.js +1 -0
  278. package/dist/collection/store/selection/selection.store.js.map +1 -0
  279. package/dist/collection/store/selection/selection.store.service.js +1 -0
  280. package/dist/collection/store/selection/selection.store.service.js.map +1 -0
  281. package/dist/collection/store/storeTypes.js +1 -0
  282. package/dist/collection/store/storeTypes.js.map +1 -0
  283. package/dist/collection/store/viewPort/viewport.helpers.js +1 -0
  284. package/dist/collection/store/viewPort/viewport.helpers.js.map +1 -0
  285. package/dist/collection/store/viewPort/viewport.store.js +1 -1
  286. package/dist/collection/store/viewPort/viewport.store.js.map +1 -0
  287. package/dist/collection/themeManager/theme.compact.js +1 -0
  288. package/dist/collection/themeManager/theme.compact.js.map +1 -0
  289. package/dist/collection/themeManager/theme.default.js +1 -0
  290. package/dist/collection/themeManager/theme.default.js.map +1 -0
  291. package/dist/collection/themeManager/theme.material.js +1 -0
  292. package/dist/collection/themeManager/theme.material.js.map +1 -0
  293. package/dist/collection/themeManager/themeService.js +6 -5
  294. package/dist/collection/themeManager/themeService.js.map +1 -0
  295. package/dist/collection/utils/closestPolifill.js +1 -0
  296. package/dist/collection/utils/closestPolifill.js.map +1 -0
  297. package/dist/collection/utils/consts.js +1 -0
  298. package/dist/collection/utils/consts.js.map +1 -0
  299. package/dist/collection/utils/generateAlphabetHeader.js +1 -0
  300. package/dist/collection/utils/generateAlphabetHeader.js.map +1 -0
  301. package/dist/collection/utils/keyCodes.js +1 -0
  302. package/dist/collection/utils/keyCodes.js.map +1 -0
  303. package/dist/collection/utils/keyCodes.utils.js +1 -0
  304. package/dist/collection/utils/keyCodes.utils.js.map +1 -0
  305. package/dist/collection/utils/platform.js +1 -0
  306. package/dist/collection/utils/platform.js.map +1 -0
  307. package/dist/collection/utils/resizeObserver.js +1 -0
  308. package/dist/collection/utils/resizeObserver.js.map +1 -0
  309. package/dist/collection/utils/store.utils.js +1 -0
  310. package/dist/collection/utils/store.utils.js.map +1 -0
  311. package/dist/collection/utils/utils.js +1 -0
  312. package/dist/collection/utils/utils.js.map +1 -0
  313. package/dist/esm/{debounce-e4e6dd45.js → debounce-7221834a.js} +3 -1
  314. package/dist/esm/debounce-7221834a.js.map +1 -0
  315. package/dist/esm/{index-6f753b3c.js → index-068eebfc.js} +577 -279
  316. package/dist/esm/index-068eebfc.js.map +1 -0
  317. package/dist/esm/index.js +2 -0
  318. package/dist/esm/index.js.map +1 -0
  319. package/dist/esm/loader.js +5 -16
  320. package/dist/esm/loader.js.map +1 -0
  321. package/dist/esm/polyfills/css-shim.js +1 -1
  322. package/dist/esm/{resize-observer-00c48d78.js → resize-observer-d817c4b6.js} +5 -3
  323. package/dist/esm/resize-observer-d817c4b6.js.map +1 -0
  324. package/dist/esm/revo-grid.js +9 -60
  325. package/dist/esm/revo-grid.js.map +1 -0
  326. package/dist/esm/revo-grid_11.entry.js +153 -150
  327. package/dist/esm/revo-grid_11.entry.js.map +1 -0
  328. package/dist/esm/revogr-clipboard.entry.js +4 -3
  329. package/dist/esm/revogr-clipboard.entry.js.map +1 -0
  330. package/dist/esm/revogr-filter-panel.entry.js +11 -6
  331. package/dist/esm/revogr-filter-panel.entry.js.map +1 -0
  332. package/dist/esm-es5/{debounce-e4e6dd45.js → debounce-7221834a.js} +2 -1
  333. package/dist/esm-es5/debounce-7221834a.js.map +1 -0
  334. package/dist/esm-es5/index-068eebfc.js +5 -0
  335. package/dist/esm-es5/index-068eebfc.js.map +1 -0
  336. package/dist/esm-es5/index.js +1 -0
  337. package/dist/esm-es5/index.js.map +1 -0
  338. package/dist/esm-es5/loader.js +2 -1
  339. package/dist/esm-es5/loader.js.map +1 -0
  340. package/dist/esm-es5/{resize-observer-00c48d78.js → resize-observer-d817c4b6.js} +2 -1
  341. package/dist/esm-es5/resize-observer-d817c4b6.js.map +1 -0
  342. package/dist/esm-es5/revo-grid.js +2 -1
  343. package/dist/esm-es5/revo-grid.js.map +1 -0
  344. package/dist/esm-es5/revo-grid_11.entry.js +3 -2
  345. package/dist/esm-es5/revo-grid_11.entry.js.map +1 -0
  346. package/dist/esm-es5/revogr-clipboard.entry.js +3 -2
  347. package/dist/esm-es5/revogr-clipboard.entry.js.map +1 -0
  348. package/dist/esm-es5/revogr-filter-panel.entry.js +3 -2
  349. package/dist/esm-es5/revogr-filter-panel.entry.js.map +1 -0
  350. package/dist/revo-grid/debounce-7221834a.js +5 -0
  351. package/dist/revo-grid/debounce-7221834a.js.map +1 -0
  352. package/dist/revo-grid/{debounce-5a33c710.system.js → debounce-fa358fc7.system.js} +2 -1
  353. package/dist/revo-grid/debounce-fa358fc7.system.js.map +1 -0
  354. package/dist/revo-grid/index-068eebfc.js +6 -0
  355. package/dist/revo-grid/index-068eebfc.js.map +1 -0
  356. package/dist/revo-grid/index-36847b63.system.js +6 -0
  357. package/dist/revo-grid/index-36847b63.system.js.map +1 -0
  358. package/dist/revo-grid/index.esm.js +2 -0
  359. package/dist/revo-grid/index.esm.js.map +1 -0
  360. package/dist/revo-grid/index.system.js +2 -1
  361. package/dist/revo-grid/index.system.js.map +1 -0
  362. package/dist/revo-grid/{resize-observer-8af0bc0e.system.js → resize-observer-64c845eb.system.js} +2 -1
  363. package/dist/revo-grid/resize-observer-64c845eb.system.js.map +1 -0
  364. package/dist/revo-grid/resize-observer-d817c4b6.js +5 -0
  365. package/dist/revo-grid/resize-observer-d817c4b6.js.map +1 -0
  366. package/dist/revo-grid/revo-grid.esm.js +2 -1
  367. package/dist/revo-grid/revo-grid.esm.js.map +1 -0
  368. package/dist/revo-grid/revo-grid.js +0 -2
  369. package/dist/revo-grid/revo-grid.system.js +2 -1
  370. package/dist/revo-grid/revo-grid.system.js.map +1 -0
  371. package/dist/revo-grid/revo-grid_11.entry.js +2 -1
  372. package/dist/revo-grid/revo-grid_11.entry.js.map +1 -0
  373. package/dist/revo-grid/revo-grid_11.system.entry.js +3 -2
  374. package/dist/revo-grid/revo-grid_11.system.entry.js.map +1 -0
  375. package/dist/revo-grid/revogr-clipboard.entry.js +2 -1
  376. package/dist/revo-grid/revogr-clipboard.entry.js.map +1 -0
  377. package/dist/revo-grid/revogr-clipboard.system.entry.js +3 -2
  378. package/dist/revo-grid/revogr-clipboard.system.entry.js.map +1 -0
  379. package/dist/revo-grid/revogr-filter-panel.entry.js +2 -1
  380. package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -0
  381. package/dist/revo-grid/revogr-filter-panel.system.entry.js +3 -2
  382. package/dist/revo-grid/revogr-filter-panel.system.entry.js.map +1 -0
  383. package/dist/types/components/data/cellRenderer.d.ts +1 -1
  384. package/dist/types/components/data/columnService.d.ts +4 -4
  385. package/dist/types/components/header/headerCellRenderer.d.ts +1 -1
  386. package/dist/types/components/header/headerRenderer.d.ts +1 -1
  387. package/dist/types/components/order/orderRenderer.d.ts +1 -1
  388. package/dist/types/components/order/rowOrderService.d.ts +1 -1
  389. package/dist/types/components/overlay/autofill.service.d.ts +1 -1
  390. package/dist/types/components/overlay/clipboard.service.d.ts +1 -1
  391. package/dist/types/components/overlay/editors/text.d.ts +1 -1
  392. package/dist/types/components/overlay/keyboard.service.d.ts +1 -1
  393. package/dist/types/components/overlay/selection.utils.d.ts +1 -1
  394. package/dist/types/components/revo-grid/viewport.d.ts +1 -1
  395. package/dist/types/components/revo-grid/viewport.interfaces.d.ts +5 -5
  396. package/dist/types/components/revo-grid/viewport.scrolling.service.d.ts +1 -1
  397. package/dist/types/components/revo-grid/viewport.section.d.ts +1 -1
  398. package/dist/types/components/revo-grid/viewport.service.d.ts +6 -3
  399. package/dist/types/components/rowHeaders/row-header-render.d.ts +1 -1
  400. package/dist/types/components.d.ts +26 -0
  401. package/dist/types/plugins/autoSizeColumn.d.ts +1 -1
  402. package/dist/types/plugins/dispatcher.d.ts +1 -1
  403. package/dist/types/plugins/export/csv.d.ts +1 -1
  404. package/dist/types/plugins/export/export.plugin.d.ts +1 -1
  405. package/dist/types/plugins/export/types.d.ts +2 -2
  406. package/dist/types/plugins/filter/filter.button.d.ts +1 -1
  407. package/dist/types/plugins/filter/filter.plugin.d.ts +6 -6
  408. package/dist/types/plugins/filter/filter.pop.d.ts +4 -4
  409. package/dist/types/plugins/filter/filter.service.d.ts +1 -1
  410. package/dist/types/plugins/filter/filter.types.d.ts +5 -5
  411. package/dist/types/plugins/groupingColumn/columnGroupsRenderer.d.ts +1 -1
  412. package/dist/types/plugins/groupingColumn/grouping.col.plugin.d.ts +1 -1
  413. package/dist/types/plugins/groupingColumn/headerGroupRenderer.d.ts +1 -1
  414. package/dist/types/plugins/groupingRow/grouping.row.renderer.d.ts +1 -1
  415. package/dist/types/plugins/groupingRow/grouping.row.types.d.ts +5 -5
  416. package/dist/types/plugins/groupingRow/grouping.service.d.ts +1 -1
  417. package/dist/types/plugins/moveColumn/columnDragPlugin.d.ts +5 -5
  418. package/dist/types/plugins/sorting/sorting.plugin.d.ts +1 -1
  419. package/dist/types/plugins/sorting/sorting.sign.d.ts +1 -1
  420. package/dist/types/plugins/trimmed/trimmed.plugin.d.ts +2 -2
  421. package/dist/types/services/column.data.provider.d.ts +4 -4
  422. package/dist/types/services/data.provider.d.ts +1 -1
  423. package/dist/types/services/dimension.provider.d.ts +2 -2
  424. package/dist/types/services/localScrollService.d.ts +1 -1
  425. package/dist/types/services/resizable.directive.d.ts +2 -2
  426. package/dist/types/services/selection.store.connector.d.ts +2 -2
  427. package/dist/types/services/viewport.provider.d.ts +1 -1
  428. package/dist/types/stencil-public-runtime.d.ts +91 -19
  429. package/dist/types/store/dataSource/data.proxy.d.ts +1 -1
  430. package/dist/types/store/dataSource/data.store.d.ts +4 -4
  431. package/dist/types/store/dimension/dimension.helpers.d.ts +3 -3
  432. package/dist/types/store/selection/selection.store.d.ts +1 -1
  433. package/dist/types/store/viewPort/viewport.helpers.d.ts +2 -2
  434. package/loader/index.d.ts +9 -0
  435. package/loader/package.json +1 -0
  436. package/package.json +1 -1
  437. package/dist/cjs/css-shim-9f5bc84d.js +0 -9
  438. package/dist/cjs/dom-fcb646f0.js +0 -78
  439. package/dist/esm/css-shim-e1e1ea5e.js +0 -7
  440. package/dist/esm/dom-21bd1807.js +0 -76
  441. package/dist/esm-es5/css-shim-e1e1ea5e.js +0 -4
  442. package/dist/esm-es5/dom-21bd1807.js +0 -24
  443. package/dist/esm-es5/index-6f753b3c.js +0 -4
  444. package/dist/revo-grid/css-shim-bcf89cc0.system.js +0 -4
  445. package/dist/revo-grid/css-shim-e1e1ea5e.js +0 -4
  446. package/dist/revo-grid/debounce-726bdadb.js +0 -4
  447. package/dist/revo-grid/dom-21bd1807.js +0 -22
  448. package/dist/revo-grid/dom-726246e2.system.js +0 -24
  449. package/dist/revo-grid/index-f14b41a0.system.js +0 -5
  450. package/dist/revo-grid/index-f30d1de1.js +0 -5
  451. package/dist/revo-grid/resize-observer-00c48d78.js +0 -4
@@ -25,6 +25,14 @@ function _interopNamespace(e) {
25
25
 
26
26
  const NAMESPACE = 'revo-grid';
27
27
 
28
+ /**
29
+ * Virtual DOM patching algorithm based on Snabbdom by
30
+ * Simon Friis Vindum (@paldepind)
31
+ * Licensed under the MIT License
32
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
33
+ *
34
+ * Modified for Stencil's renderer and slot projection
35
+ */
28
36
  let contentRef;
29
37
  let hostTagName;
30
38
  let useNativeShadowDom = false;
@@ -33,64 +41,6 @@ let checkSlotRelocate = false;
33
41
  let isSvgMode = false;
34
42
  let renderingRef = null;
35
43
  let queuePending = false;
36
- const win = typeof window !== 'undefined' ? window : {};
37
- const CSS = win.CSS ;
38
- const doc = win.document || { head: {} };
39
- const plt = {
40
- $flags$: 0,
41
- $resourcesUrl$: '',
42
- jmp: (h) => h(),
43
- raf: (h) => requestAnimationFrame(h),
44
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
45
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
46
- ce: (eventName, opts) => new CustomEvent(eventName, opts),
47
- };
48
- const promiseResolve = (v) => Promise.resolve(v);
49
- const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
50
- try {
51
- new CSSStyleSheet();
52
- return typeof new CSSStyleSheet().replaceSync === 'function';
53
- }
54
- catch (e) { }
55
- return false;
56
- })()
57
- ;
58
- const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
59
- if (listeners) {
60
- listeners.map(([flags, name, method]) => {
61
- const target = getHostListenerTarget(elm, flags) ;
62
- const handler = hostListenerProxy(hostRef, method);
63
- const opts = hostListenerOpts(flags);
64
- plt.ael(target, name, handler, opts);
65
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
66
- });
67
- }
68
- };
69
- const hostListenerProxy = (hostRef, methodName) => (ev) => {
70
- try {
71
- {
72
- if (hostRef.$flags$ & 256 /* isListenReady */) {
73
- // instance is ready, let's call it's member method for this event
74
- hostRef.$lazyInstance$[methodName](ev);
75
- }
76
- else {
77
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
78
- }
79
- }
80
- }
81
- catch (e) {
82
- consoleError(e);
83
- }
84
- };
85
- const getHostListenerTarget = (elm, flags) => {
86
- if (flags & 4 /* TargetDocument */)
87
- return doc;
88
- return elm;
89
- };
90
- // prettier-ignore
91
- const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
92
- const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
93
- const XLINK_NS = 'http://www.w3.org/1999/xlink';
94
44
  const createTime = (fnName, tagName = '') => {
95
45
  {
96
46
  return () => {
@@ -105,75 +55,8 @@ const uniqueTime = (key, measureText) => {
105
55
  };
106
56
  }
107
57
  };
108
- const rootAppliedStyles = new WeakMap();
109
- const registerStyle = (scopeId, cssText, allowCS) => {
110
- let style = styles.get(scopeId);
111
- if (supportsConstructableStylesheets && allowCS) {
112
- style = (style || new CSSStyleSheet());
113
- if (typeof style === 'string') {
114
- style = cssText;
115
- }
116
- else {
117
- style.replaceSync(cssText);
118
- }
119
- }
120
- else {
121
- style = cssText;
122
- }
123
- styles.set(scopeId, style);
124
- };
125
- const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
126
- let scopeId = getScopeId(cmpMeta);
127
- const style = styles.get(scopeId);
128
- // if an element is NOT connected then getRootNode() will return the wrong root node
129
- // so the fallback is to always use the document for the root node in those cases
130
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
131
- if (style) {
132
- if (typeof style === 'string') {
133
- styleContainerNode = styleContainerNode.head || styleContainerNode;
134
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
135
- let styleElm;
136
- if (!appliedStyles) {
137
- rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
138
- }
139
- if (!appliedStyles.has(scopeId)) {
140
- {
141
- if (plt.$cssShim$) {
142
- styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
143
- const newScopeId = styleElm['s-sc'];
144
- if (newScopeId) {
145
- scopeId = newScopeId;
146
- // we don't want to add this styleID to the appliedStyles Set
147
- // since the cssVarShim might need to apply several different
148
- // stylesheets for the same component
149
- appliedStyles = null;
150
- }
151
- }
152
- else {
153
- styleElm = doc.createElement('style');
154
- styleElm.innerHTML = style;
155
- }
156
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
157
- }
158
- if (appliedStyles) {
159
- appliedStyles.add(scopeId);
160
- }
161
- }
162
- }
163
- else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
164
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
165
- }
166
- }
167
- return scopeId;
168
- };
169
- const attachStyles = (hostRef) => {
170
- const cmpMeta = hostRef.$cmpMeta$;
171
- const elm = hostRef.$hostElement$;
172
- const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
173
- addStyle(elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
174
- endAttachStyles();
175
- };
176
- const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
58
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
59
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
177
60
  /**
178
61
  * Default style mode id
179
62
  */
@@ -187,11 +70,30 @@ const EMPTY_OBJ = {};
187
70
  */
188
71
  const SVG_NS = 'http://www.w3.org/2000/svg';
189
72
  const HTML_NS = 'http://www.w3.org/1999/xhtml';
73
+ /**
74
+ * Check whether a value is a 'complex type', defined here as an object or a
75
+ * function.
76
+ *
77
+ * @param o the value to check
78
+ * @returns whether it's a complex type or not
79
+ */
190
80
  const isComplexType = (o) => {
191
81
  // https://jsperf.com/typeof-fn-object/5
192
82
  o = typeof o;
193
83
  return o === 'object' || o === 'function';
194
84
  };
85
+ /**
86
+ * Helper method for querying a `meta` tag that contains a nonce value
87
+ * out of a DOM's head.
88
+ *
89
+ * @param doc The DOM containing the `head` to query against
90
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
91
+ * exists or the tag has no content.
92
+ */
93
+ function queryNonceMetaTagContent(doc) {
94
+ var _a, _b, _c;
95
+ 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;
96
+ }
195
97
  /**
196
98
  * Production h() function based on Preact by
197
99
  * Jason Miller (@developit)
@@ -200,7 +102,6 @@ const isComplexType = (o) => {
200
102
  *
201
103
  * Modified for Stencil's compiler and vdom
202
104
  */
203
- // const stack: any[] = [];
204
105
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
205
106
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
206
107
  const h = (nodeName, vnodeData, ...children) => {
@@ -270,6 +171,14 @@ const h = (nodeName, vnodeData, ...children) => {
270
171
  }
271
172
  return vnode;
272
173
  };
174
+ /**
175
+ * A utility function for creating a virtual DOM node from a tag and some
176
+ * possible text content.
177
+ *
178
+ * @param tag the tag for this element
179
+ * @param text possible text content for the node
180
+ * @returns a newly-minted virtual DOM node
181
+ */
273
182
  const newVNode = (tag, text) => {
274
183
  const vnode = {
275
184
  $flags$: 0,
@@ -290,11 +199,31 @@ const newVNode = (tag, text) => {
290
199
  return vnode;
291
200
  };
292
201
  const Host = {};
202
+ /**
203
+ * Check whether a given node is a Host node or not
204
+ *
205
+ * @param node the virtual DOM node to check
206
+ * @returns whether it's a Host node or not
207
+ */
293
208
  const isHost = (node) => node && node.$tag$ === Host;
209
+ /**
210
+ * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
211
+ *
212
+ * Note that these functions convert from {@link d.VNode} to
213
+ * {@link d.ChildNode} to give functional component developers a friendly
214
+ * interface.
215
+ */
294
216
  const vdomFnUtils = {
295
217
  forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
296
218
  map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
297
219
  };
220
+ /**
221
+ * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
222
+ * friendlier public interface (hence, 'convertToPublic').
223
+ *
224
+ * @param node the virtual DOM node to convert
225
+ * @returns a converted child node
226
+ */
298
227
  const convertToPublic = (node) => ({
299
228
  vattrs: node.$attrs$,
300
229
  vchildren: node.$children$,
@@ -303,6 +232,15 @@ const convertToPublic = (node) => ({
303
232
  vtag: node.$tag$,
304
233
  vtext: node.$text$,
305
234
  });
235
+ /**
236
+ * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
237
+ * order to use the resulting object in the virtual DOM. The initial object was
238
+ * likely created as part of presenting a public API, so converting it back
239
+ * involved making it 'private' again (hence, `convertToPrivate`).
240
+ *
241
+ * @param node the child node to convert
242
+ * @returns a converted virtual DOM node
243
+ */
306
244
  const convertToPrivate = (node) => {
307
245
  if (typeof node.vtag === 'function') {
308
246
  const vnodeData = Object.assign({}, node.vattrs);
@@ -321,6 +259,144 @@ const convertToPrivate = (node) => {
321
259
  vnode.$name$ = node.vname;
322
260
  return vnode;
323
261
  };
262
+ /**
263
+ * Parse a new property value for a given property type.
264
+ *
265
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
266
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
267
+ * 1. `any`, the type given to `propValue` in the function signature
268
+ * 2. the type stored from `propType`.
269
+ *
270
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
271
+ *
272
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
273
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
274
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
275
+ * ```tsx
276
+ * <my-cmp prop-val={0}></my-cmp>
277
+ * ```
278
+ *
279
+ * HTML prop values on the other hand, will always a string
280
+ *
281
+ * @param propValue the new value to coerce to some type
282
+ * @param propType the type of the prop, expressed as a binary number
283
+ * @returns the parsed/coerced value
284
+ */
285
+ const parsePropertyValue = (propValue, propType) => {
286
+ // ensure this value is of the correct prop type
287
+ if (propValue != null && !isComplexType(propValue)) {
288
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
289
+ // per the HTML spec, any string value means it is a boolean true value
290
+ // but we'll cheat here and say that the string "false" is the boolean false
291
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
292
+ }
293
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
294
+ // force it to be a number
295
+ return parseFloat(propValue);
296
+ }
297
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
298
+ // could have been passed as a number or boolean
299
+ // but we still want it as a string
300
+ return String(propValue);
301
+ }
302
+ // redundant return here for better minification
303
+ return propValue;
304
+ }
305
+ // not sure exactly what type we want
306
+ // so no need to change to a different type
307
+ return propValue;
308
+ };
309
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
310
+ const createEvent = (ref, name, flags) => {
311
+ const elm = getElement(ref);
312
+ return {
313
+ emit: (detail) => {
314
+ return emitEvent(elm, name, {
315
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
316
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
317
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
318
+ detail,
319
+ });
320
+ },
321
+ };
322
+ };
323
+ /**
324
+ * Helper function to create & dispatch a custom Event on a provided target
325
+ * @param elm the target of the Event
326
+ * @param name the name to give the custom Event
327
+ * @param opts options for configuring a custom Event
328
+ * @returns the custom Event
329
+ */
330
+ const emitEvent = (elm, name, opts) => {
331
+ const ev = plt.ce(name, opts);
332
+ elm.dispatchEvent(ev);
333
+ return ev;
334
+ };
335
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
336
+ const registerStyle = (scopeId, cssText, allowCS) => {
337
+ let style = styles.get(scopeId);
338
+ if (supportsConstructableStylesheets && allowCS) {
339
+ style = (style || new CSSStyleSheet());
340
+ if (typeof style === 'string') {
341
+ style = cssText;
342
+ }
343
+ else {
344
+ style.replaceSync(cssText);
345
+ }
346
+ }
347
+ else {
348
+ style = cssText;
349
+ }
350
+ styles.set(scopeId, style);
351
+ };
352
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
353
+ var _a;
354
+ let scopeId = getScopeId(cmpMeta);
355
+ const style = styles.get(scopeId);
356
+ // if an element is NOT connected then getRootNode() will return the wrong root node
357
+ // so the fallback is to always use the document for the root node in those cases
358
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
359
+ if (style) {
360
+ if (typeof style === 'string') {
361
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
362
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
363
+ let styleElm;
364
+ if (!appliedStyles) {
365
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
366
+ }
367
+ if (!appliedStyles.has(scopeId)) {
368
+ {
369
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
370
+ {
371
+ styleElm = doc.createElement('style');
372
+ styleElm.innerHTML = style;
373
+ }
374
+ // Apply CSP nonce to the style tag if it exists
375
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
376
+ if (nonce != null) {
377
+ styleElm.setAttribute('nonce', nonce);
378
+ }
379
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
380
+ }
381
+ if (appliedStyles) {
382
+ appliedStyles.add(scopeId);
383
+ }
384
+ }
385
+ }
386
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
387
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
388
+ }
389
+ }
390
+ return scopeId;
391
+ };
392
+ const attachStyles = (hostRef) => {
393
+ const cmpMeta = hostRef.$cmpMeta$;
394
+ const elm = hostRef.$hostElement$;
395
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
396
+ addStyle(elm.getRootNode(), cmpMeta);
397
+ endAttachStyles();
398
+ };
399
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
324
400
  /**
325
401
  * Production setAccessor() function based on Preact by
326
402
  * Jason Miller (@developit)
@@ -457,7 +533,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
457
533
  }
458
534
  }
459
535
  }
460
- else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
536
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
461
537
  newValue = newValue === true ? '' : newValue;
462
538
  if (xlink) {
463
539
  elm.setAttributeNS(XLINK_NS, memberName, newValue);
@@ -475,7 +551,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
475
551
  // if the element passed in is a shadow root, which is a document fragment
476
552
  // then we want to be adding attrs/props to the shadow root's "host" element
477
553
  // if it's not a shadow root, then we add attrs/props to the same element
478
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
554
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
479
555
  ? newVnode.$elm$.host
480
556
  : newVnode.$elm$;
481
557
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
@@ -493,6 +569,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
493
569
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
494
570
  }
495
571
  };
572
+ /**
573
+ * Create a DOM Node corresponding to one of the children of a given VNode.
574
+ *
575
+ * @param oldParentVNode the parent VNode from the previous render
576
+ * @param newParentVNode the parent VNode from the current render
577
+ * @param childIndex the index of the VNode, in the _new_ parent node's
578
+ * children, for which we will create a new DOM node
579
+ * @param parentElm the parent DOM node which our new node will be a child of
580
+ * @returns the newly created node
581
+ */
496
582
  const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
497
583
  // tslint:disable-next-line: prefer-const
498
584
  const newVNode = newParentVNode.$children$[childIndex];
@@ -506,16 +592,16 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
506
592
  if (newVNode.$tag$ === 'slot') {
507
593
  newVNode.$flags$ |= newVNode.$children$
508
594
  ? // slot element has fallback content
509
- 2 /* isSlotFallback */
595
+ 2 /* VNODE_FLAGS.isSlotFallback */
510
596
  : // slot element does not have fallback content
511
- 1 /* isSlotReference */;
597
+ 1 /* VNODE_FLAGS.isSlotReference */;
512
598
  }
513
599
  }
514
600
  if (newVNode.$text$ !== null) {
515
601
  // create text node
516
602
  elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
517
603
  }
518
- else if (newVNode.$flags$ & 1 /* isSlotReference */) {
604
+ else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
519
605
  // create a slot reference node
520
606
  elm = newVNode.$elm$ =
521
607
  doc.createTextNode('');
@@ -525,7 +611,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
525
611
  isSvgMode = newVNode.$tag$ === 'svg';
526
612
  }
527
613
  // create element
528
- elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
614
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
529
615
  ? 'slot-fb'
530
616
  : newVNode.$tag$)
531
617
  );
@@ -560,7 +646,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
560
646
  }
561
647
  {
562
648
  elm['s-hn'] = hostTagName;
563
- if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
649
+ if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
564
650
  // remember the content reference comment
565
651
  elm['s-sr'] = true;
566
652
  // remember the content reference comment
@@ -579,7 +665,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
579
665
  return elm;
580
666
  };
581
667
  const putBackInOriginalLocation = (parentElm, recursive) => {
582
- plt.$flags$ |= 1 /* isTmpDisconnected */;
668
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
583
669
  const oldSlotChildNodes = parentElm.childNodes;
584
670
  for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
585
671
  const childNode = oldSlotChildNodes[i];
@@ -600,8 +686,23 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
600
686
  putBackInOriginalLocation(childNode, recursive);
601
687
  }
602
688
  }
603
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
689
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
604
690
  };
691
+ /**
692
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
693
+ * add them to the DOM in the appropriate place.
694
+ *
695
+ * @param parentElm the DOM node which should be used as a parent for the new
696
+ * DOM nodes
697
+ * @param before a child of the `parentElm` which the new children should be
698
+ * inserted before (optional)
699
+ * @param parentVNode the parent virtual DOM node
700
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
701
+ * @param startIdx the index in the child virtual DOM nodes at which to start
702
+ * creating DOM nodes (inclusive)
703
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
704
+ * creating DOM nodes (inclusive)
705
+ */
605
706
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
606
707
  let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
607
708
  let childNode;
@@ -615,6 +716,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
615
716
  }
616
717
  }
617
718
  };
719
+ /**
720
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
721
+ * This can be used to, for instance, clean up after a list of children which
722
+ * should no longer be shown.
723
+ *
724
+ * This function also handles some of Stencil's slot relocation logic.
725
+ *
726
+ * @param vnodes a list of virtual DOM nodes to remove
727
+ * @param startIdx the index at which to start removing nodes (inclusive)
728
+ * @param endIdx the index at which to stop removing nodes (inclusive)
729
+ * @param vnode a VNode
730
+ * @param elm an element
731
+ */
618
732
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
619
733
  for (; startIdx <= endIdx; ++startIdx) {
620
734
  if ((vnode = vnodes[startIdx])) {
@@ -639,6 +753,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
639
753
  }
640
754
  }
641
755
  };
756
+ /**
757
+ * Reconcile the children of a new VNode with the children of an old VNode by
758
+ * traversing the two collections of children, identifying nodes that are
759
+ * conserved or changed, calling out to `patch` to make any necessary
760
+ * updates to the DOM, and rearranging DOM nodes as needed.
761
+ *
762
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
763
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
764
+ * 'windows' by storing start and end indices and references to the
765
+ * corresponding array entries. Initially the two 'windows' are basically equal
766
+ * to the entire array, but we progressively narrow the windows until there are
767
+ * no children left to update by doing the following:
768
+ *
769
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
770
+ * that if we have an initial array like the following we'll end up dealing
771
+ * only with a window bounded by the highlighted elements:
772
+ *
773
+ * [null, null, VNode1 , ... , VNode2, null, null]
774
+ * ^^^^^^ ^^^^^^
775
+ *
776
+ * 2. Check to see if the elements at the head and tail positions are equal
777
+ * across the windows. This will basically detect elements which haven't
778
+ * been added, removed, or changed position, i.e. if you had the following
779
+ * VNode elements (represented as HTML):
780
+ *
781
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
782
+ * newVNode: `<div><p><span>THERE</span></p></div>`
783
+ *
784
+ * Then when comparing the children of the `<div>` tag we check the equality
785
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
786
+ * same tag in the same position, we'd be able to avoid completely
787
+ * re-rendering the subtree under them with a new DOM element and would just
788
+ * call out to `patch` to handle reconciling their children and so on.
789
+ *
790
+ * 3. Check, for both windows, to see if the element at the beginning of the
791
+ * window corresponds to the element at the end of the other window. This is
792
+ * a heuristic which will let us identify _some_ situations in which
793
+ * elements have changed position, for instance it _should_ detect that the
794
+ * children nodes themselves have not changed but merely moved in the
795
+ * following example:
796
+ *
797
+ * oldVNode: `<div><element-one /><element-two /></div>`
798
+ * newVNode: `<div><element-two /><element-one /></div>`
799
+ *
800
+ * If we find cases like this then we also need to move the concrete DOM
801
+ * elements corresponding to the moved children to write the re-order to the
802
+ * DOM.
803
+ *
804
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
805
+ * nodes in the old children which have the same key as the first element in
806
+ * our window on the new children. If we find such a node we handle calling
807
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
808
+ * what we find.
809
+ *
810
+ * Finally, once we've narrowed our 'windows' to the point that either of them
811
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
812
+ * insertion or deletion that needs to happen to get a DOM state that correctly
813
+ * reflects the new child VNodes. If, for instance, after our window on the old
814
+ * children has collapsed we still have more nodes on the new children that
815
+ * we haven't dealt with yet then we need to add them, or if the new children
816
+ * collapse but we still have unhandled _old_ children then we need to make
817
+ * sure the corresponding DOM nodes are removed.
818
+ *
819
+ * @param parentElm the node into which the parent VNode is rendered
820
+ * @param oldCh the old children of the parent node
821
+ * @param newVNode the new VNode which will replace the parent
822
+ * @param newCh the new children of the parent node
823
+ */
642
824
  const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
643
825
  let oldStartIdx = 0;
644
826
  let newStartIdx = 0;
@@ -654,7 +836,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
654
836
  let elmToMove;
655
837
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
656
838
  if (oldStartVnode == null) {
657
- // Vnode might have been moved left
839
+ // VNode might have been moved left
658
840
  oldStartVnode = oldCh[++oldStartIdx];
659
841
  }
660
842
  else if (oldEndVnode == null) {
@@ -667,37 +849,100 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
667
849
  newEndVnode = newCh[--newEndIdx];
668
850
  }
669
851
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
852
+ // if the start nodes are the same then we should patch the new VNode
853
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
854
+ // indices to reflect that. We don't need to move any DOM Nodes around
855
+ // since things are matched up in order.
670
856
  patch(oldStartVnode, newStartVnode);
671
857
  oldStartVnode = oldCh[++oldStartIdx];
672
858
  newStartVnode = newCh[++newStartIdx];
673
859
  }
674
860
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
861
+ // likewise, if the end nodes are the same we patch new onto old and
862
+ // decrement our end indices, and also likewise in this case we don't
863
+ // need to move any DOM Nodes.
675
864
  patch(oldEndVnode, newEndVnode);
676
865
  oldEndVnode = oldCh[--oldEndIdx];
677
866
  newEndVnode = newCh[--newEndIdx];
678
867
  }
679
868
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
680
- // Vnode moved right
869
+ // case: "Vnode moved right"
870
+ //
871
+ // We've found that the last node in our window on the new children is
872
+ // the same VNode as the _first_ node in our window on the old children
873
+ // we're dealing with now. Visually, this is the layout of these two
874
+ // nodes:
875
+ //
876
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
877
+ // ^^^^^^^^^^^
878
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
879
+ // ^^^^^^^^^^^^^
880
+ //
881
+ // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
882
+ // and move the DOM element for `oldStartVnode`.
681
883
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
682
884
  putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
683
885
  }
684
886
  patch(oldStartVnode, newEndVnode);
887
+ // We need to move the element for `oldStartVnode` into a position which
888
+ // will be appropriate for `newEndVnode`. For this we can use
889
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
890
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
891
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
892
+ //
893
+ // <old-start-node />
894
+ // <some-intervening-node />
895
+ // <old-end-node />
896
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
897
+ // <next-sibling />
898
+ //
899
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
900
+ // the node for `oldStartVnode` at the end of the children of
901
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
902
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
903
+ // append it to the children of the parent element.
685
904
  parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
686
905
  oldStartVnode = oldCh[++oldStartIdx];
687
906
  newEndVnode = newCh[--newEndIdx];
688
907
  }
689
908
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
690
- // Vnode moved left
909
+ // case: "Vnode moved left"
910
+ //
911
+ // We've found that the first node in our window on the new children is
912
+ // the same VNode as the _last_ node in our window on the old children.
913
+ // Visually, this is the layout of these two nodes:
914
+ //
915
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
916
+ // ^^^^^^^^^^^^^
917
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
918
+ // ^^^^^^^^^^^
919
+ //
920
+ // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
921
+ // (which will handle updating any changed attributes, reconciling their
922
+ // children etc) but we also need to move the DOM node to which
923
+ // `oldEndVnode` corresponds.
691
924
  if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
692
925
  putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
693
926
  }
694
927
  patch(oldEndVnode, newStartVnode);
928
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
929
+ // the same node, so since we're here we know that they are not. Thus we
930
+ // can move the element for `oldEndVnode` _before_ the element for
931
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
932
+ // future.
695
933
  parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
696
934
  oldEndVnode = oldCh[--oldEndIdx];
697
935
  newStartVnode = newCh[++newStartIdx];
698
936
  }
699
937
  else {
700
- // createKeyToOldIdx
938
+ // Here we do some checks to match up old and new nodes based on the
939
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
940
+ // in the JSX for a DOM element in the implementation of a Stencil
941
+ // component.
942
+ //
943
+ // First we check to see if there are any nodes in the array of old
944
+ // children which have the same key as the first node in the new
945
+ // children.
701
946
  idxInOld = -1;
702
947
  {
703
948
  for (i = oldStartIdx; i <= oldEndIdx; ++i) {
@@ -708,23 +953,32 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
708
953
  }
709
954
  }
710
955
  if (idxInOld >= 0) {
956
+ // We found a node in the old children which matches up with the first
957
+ // node in the new children! So let's deal with that
711
958
  elmToMove = oldCh[idxInOld];
712
959
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
960
+ // the tag doesn't match so we'll need a new DOM element
713
961
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
714
962
  }
715
963
  else {
716
964
  patch(elmToMove, newStartVnode);
965
+ // invalidate the matching old node so that we won't try to update it
966
+ // again later on
717
967
  oldCh[idxInOld] = undefined;
718
968
  node = elmToMove.$elm$;
719
969
  }
720
970
  newStartVnode = newCh[++newStartIdx];
721
971
  }
722
972
  else {
723
- // new element
973
+ // We either didn't find an element in the old children that matches
974
+ // the key of the first new child OR the build is not using `key`
975
+ // attributes at all. In either case we need to create a new element
976
+ // for the new node.
724
977
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
725
978
  newStartVnode = newCh[++newStartIdx];
726
979
  }
727
980
  if (node) {
981
+ // if we created a new node then handle inserting it to the DOM
728
982
  {
729
983
  parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
730
984
  }
@@ -732,21 +986,44 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
732
986
  }
733
987
  }
734
988
  if (oldStartIdx > oldEndIdx) {
989
+ // we have some more new nodes to add which don't match up with old nodes
735
990
  addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
736
991
  }
737
992
  else if (newStartIdx > newEndIdx) {
993
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
994
+ // in the new array, so lets remove them (which entails cleaning up the
995
+ // relevant DOM nodes)
738
996
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
739
997
  }
740
998
  };
741
- const isSameVnode = (vnode1, vnode2) => {
999
+ /**
1000
+ * Compare two VNodes to determine if they are the same
1001
+ *
1002
+ * **NB**: This function is an equality _heuristic_ based on the available
1003
+ * information set on the two VNodes and can be misleading under certain
1004
+ * circumstances. In particular, if the two nodes do not have `key` attrs
1005
+ * (available under `$key$` on VNodes) then the function falls back on merely
1006
+ * checking that they have the same tag.
1007
+ *
1008
+ * So, in other words, if `key` attrs are not set on VNodes which may be
1009
+ * changing order within a `children` array or something along those lines then
1010
+ * we could obtain a false negative and then have to do needless re-rendering
1011
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
1012
+ *
1013
+ * @param leftVNode the first VNode to check
1014
+ * @param rightVNode the second VNode to check
1015
+ * @returns whether they're equal or not
1016
+ */
1017
+ const isSameVnode = (leftVNode, rightVNode) => {
742
1018
  // compare if two vnode to see if they're "technically" the same
743
1019
  // need to have the same element tag, and same key to be the same
744
- if (vnode1.$tag$ === vnode2.$tag$) {
745
- if (vnode1.$tag$ === 'slot') {
746
- return vnode1.$name$ === vnode2.$name$;
1020
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
1021
+ if (leftVNode.$tag$ === 'slot') {
1022
+ return leftVNode.$name$ === rightVNode.$name$;
747
1023
  }
1024
+ // this will be set if components in the build have `key` attrs set on them
748
1025
  {
749
- return vnode1.$key$ === vnode2.$key$;
1026
+ return leftVNode.$key$ === rightVNode.$key$;
750
1027
  }
751
1028
  }
752
1029
  return false;
@@ -759,6 +1036,14 @@ const referenceNode = (node) => {
759
1036
  return (node && node['s-ol']) || node;
760
1037
  };
761
1038
  const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
1039
+ /**
1040
+ * Handle reconciling an outdated VNode with a new one which corresponds to
1041
+ * it. This function handles flushing updates to the DOM and reconciling the
1042
+ * children of the two nodes (if any).
1043
+ *
1044
+ * @param oldVNode an old VNode whose DOM element and children we want to update
1045
+ * @param newVNode a new VNode representing an updated version of the old one
1046
+ */
762
1047
  const patch = (oldVNode, newVNode) => {
763
1048
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
764
1049
  const oldChildren = oldVNode.$children$;
@@ -772,7 +1057,6 @@ const patch = (oldVNode, newVNode) => {
772
1057
  // only add this to the when the compiler sees we're using an svg somewhere
773
1058
  isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
774
1059
  }
775
- // element node
776
1060
  {
777
1061
  if (tag === 'slot')
778
1062
  ;
@@ -785,6 +1069,7 @@ const patch = (oldVNode, newVNode) => {
785
1069
  }
786
1070
  if (oldChildren !== null && newChildren !== null) {
787
1071
  // looks like there's child vnodes for both the old and new vnodes
1072
+ // so we need to call `updateChildren` to reconcile them
788
1073
  updateChildren(elm, oldChildren, newVNode, newChildren);
789
1074
  }
790
1075
  else if (newChildren !== null) {
@@ -825,7 +1110,7 @@ const updateFallbackSlotVisibility = (elm) => {
825
1110
  let nodeType;
826
1111
  for (i = 0, ilen = childNodes.length; i < ilen; i++) {
827
1112
  childNode = childNodes[i];
828
- if (childNode.nodeType === 1 /* ElementNode */) {
1113
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
829
1114
  if (childNode['s-sr']) {
830
1115
  // this is a slot fallback node
831
1116
  // get the slot name for this slot reference node
@@ -837,7 +1122,7 @@ const updateFallbackSlotVisibility = (elm) => {
837
1122
  nodeType = childNodes[j].nodeType;
838
1123
  if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
839
1124
  // this sibling node is from a different component OR is a named fallback slot node
840
- if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
1125
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
841
1126
  childNode.hidden = true;
842
1127
  break;
843
1128
  }
@@ -846,8 +1131,8 @@ const updateFallbackSlotVisibility = (elm) => {
846
1131
  // this is a default fallback slot node
847
1132
  // any element or text node (with content)
848
1133
  // should hide the default fallback slot node
849
- if (nodeType === 1 /* ElementNode */ ||
850
- (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
1134
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
1135
+ (nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
851
1136
  childNode.hidden = true;
852
1137
  break;
853
1138
  }
@@ -925,13 +1210,13 @@ const relocateSlotContent = (elm) => {
925
1210
  }
926
1211
  }
927
1212
  }
928
- if (childNode.nodeType === 1 /* ElementNode */) {
1213
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
929
1214
  relocateSlotContent(childNode);
930
1215
  }
931
1216
  }
932
1217
  };
933
1218
  const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
934
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1219
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
935
1220
  if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
936
1221
  return true;
937
1222
  }
@@ -951,6 +1236,18 @@ const callNodeRefs = (vNode) => {
951
1236
  vNode.$children$ && vNode.$children$.map(callNodeRefs);
952
1237
  }
953
1238
  };
1239
+ /**
1240
+ * The main entry point for Stencil's virtual DOM-based rendering engine
1241
+ *
1242
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
1243
+ * function will handle creating a virtual DOM tree with a single root, patching
1244
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
1245
+ * relocation, and reflecting attributes.
1246
+ *
1247
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
1248
+ * the DOM node into which it should be rendered.
1249
+ * @param renderFnResults the virtual DOM nodes to be rendered
1250
+ */
954
1251
  const renderVdom = (hostRef, renderFnResults) => {
955
1252
  const hostElm = hostRef.$hostElement$;
956
1253
  const cmpMeta = hostRef.$cmpMeta$;
@@ -962,12 +1259,12 @@ const renderVdom = (hostRef, renderFnResults) => {
962
1259
  cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
963
1260
  }
964
1261
  rootVnode.$tag$ = null;
965
- rootVnode.$flags$ |= 4 /* isHost */;
1262
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
966
1263
  hostRef.$vnode$ = rootVnode;
967
1264
  rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
968
1265
  {
969
1266
  contentRef = hostElm['s-cr'];
970
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1267
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
971
1268
  // always reset
972
1269
  checkSlotFallbackVisibility = false;
973
1270
  }
@@ -976,7 +1273,7 @@ const renderVdom = (hostRef, renderFnResults) => {
976
1273
  {
977
1274
  // while we're moving nodes around existing nodes, temporarily disable
978
1275
  // the disconnectCallback from working
979
- plt.$flags$ |= 1 /* isTmpDisconnected */;
1276
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
980
1277
  if (checkSlotRelocate) {
981
1278
  relocateSlotContent(rootVnode.$elm$);
982
1279
  let relocateData;
@@ -1034,7 +1331,7 @@ const renderVdom = (hostRef, renderFnResults) => {
1034
1331
  }
1035
1332
  else {
1036
1333
  // this node doesn't have a slot home to go to, so let's hide it
1037
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1334
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1038
1335
  nodeToRelocate.hidden = true;
1039
1336
  }
1040
1337
  }
@@ -1045,37 +1342,11 @@ const renderVdom = (hostRef, renderFnResults) => {
1045
1342
  }
1046
1343
  // done moving nodes around
1047
1344
  // allow the disconnect callback to work again
1048
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1345
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1049
1346
  // always reset
1050
1347
  relocateNodes.length = 0;
1051
1348
  }
1052
1349
  };
1053
- const getElement = (ref) => (getHostRef(ref).$hostElement$ );
1054
- const createEvent = (ref, name, flags) => {
1055
- const elm = getElement(ref);
1056
- return {
1057
- emit: (detail) => {
1058
- return emitEvent(elm, name, {
1059
- bubbles: !!(flags & 4 /* Bubbles */),
1060
- composed: !!(flags & 2 /* Composed */),
1061
- cancelable: !!(flags & 1 /* Cancellable */),
1062
- detail,
1063
- });
1064
- },
1065
- };
1066
- };
1067
- /**
1068
- * Helper function to create & dispatch a custom Event on a provided target
1069
- * @param elm the target of the Event
1070
- * @param name the name to give the custom Event
1071
- * @param opts options for configuring a custom Event
1072
- * @returns the custom Event
1073
- */
1074
- const emitEvent = (elm, name, opts) => {
1075
- const ev = plt.ce(name, opts);
1076
- elm.dispatchEvent(ev);
1077
- return ev;
1078
- };
1079
1350
  const attachToAncestor = (hostRef, ancestorComponent) => {
1080
1351
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1081
1352
  ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
@@ -1083,10 +1354,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
1083
1354
  };
1084
1355
  const scheduleUpdate = (hostRef, isInitialLoad) => {
1085
1356
  {
1086
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1357
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1087
1358
  }
1088
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1089
- hostRef.$flags$ |= 512 /* needsRerender */;
1359
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1360
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1090
1361
  return;
1091
1362
  }
1092
1363
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
@@ -1102,7 +1373,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
1102
1373
  let promise;
1103
1374
  if (isInitialLoad) {
1104
1375
  {
1105
- hostRef.$flags$ |= 256 /* isListenReady */;
1376
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1106
1377
  if (hostRef.$queuedListeners$) {
1107
1378
  hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1108
1379
  hostRef.$queuedListeners$ = null;
@@ -1131,9 +1402,6 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1131
1402
  {
1132
1403
  callRender(hostRef, instance);
1133
1404
  }
1134
- if (plt.$cssShim$) {
1135
- plt.$cssShim$.updateHost(elm);
1136
- }
1137
1405
  if (rc) {
1138
1406
  // ok, so turns out there are some child host elements
1139
1407
  // waiting on this parent element to load
@@ -1151,7 +1419,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1151
1419
  }
1152
1420
  else {
1153
1421
  Promise.all(childrenPromises).then(postUpdate);
1154
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1422
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1155
1423
  childrenPromises.length = 0;
1156
1424
  }
1157
1425
  }
@@ -1161,10 +1429,10 @@ const callRender = (hostRef, instance, elm) => {
1161
1429
  renderingRef = instance;
1162
1430
  instance = instance.render && instance.render();
1163
1431
  {
1164
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1432
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1165
1433
  }
1166
1434
  {
1167
- hostRef.$flags$ |= 2 /* hasRendered */;
1435
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1168
1436
  }
1169
1437
  {
1170
1438
  {
@@ -1193,8 +1461,8 @@ const postUpdateComponent = (hostRef) => {
1193
1461
  {
1194
1462
  safeCall(instance, 'componentDidRender');
1195
1463
  }
1196
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1197
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1464
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1465
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1198
1466
  {
1199
1467
  // DOM WRITE!
1200
1468
  addHydratedFlag(elm);
@@ -1223,10 +1491,10 @@ const postUpdateComponent = (hostRef) => {
1223
1491
  hostRef.$onRenderResolve$();
1224
1492
  hostRef.$onRenderResolve$ = undefined;
1225
1493
  }
1226
- if (hostRef.$flags$ & 512 /* needsRerender */) {
1494
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1227
1495
  nextTick(() => scheduleUpdate(hostRef, false));
1228
1496
  }
1229
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1497
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1230
1498
  }
1231
1499
  // ( •_•)
1232
1500
  // ( •_•)>⌐■-■
@@ -1237,7 +1505,7 @@ const forceUpdate = (ref) => {
1237
1505
  const hostRef = getHostRef(ref);
1238
1506
  const isConnected = hostRef.$hostElement$.isConnected;
1239
1507
  if (isConnected &&
1240
- (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1508
+ (hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1241
1509
  scheduleUpdate(hostRef, false);
1242
1510
  }
1243
1511
  // Returns "true" when the forced update was successfully scheduled
@@ -1268,53 +1536,6 @@ const then = (promise, thenFn) => {
1268
1536
  };
1269
1537
  const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1270
1538
  ;
1271
- /**
1272
- * Parse a new property value for a given property type.
1273
- *
1274
- * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
1275
- * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
1276
- * 1. `any`, the type given to `propValue` in the function signature
1277
- * 2. the type stored from `propType`.
1278
- *
1279
- * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
1280
- *
1281
- * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
1282
- * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
1283
- * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
1284
- * ```tsx
1285
- * <my-cmp prop-val={0}></my-cmp>
1286
- * ```
1287
- *
1288
- * HTML prop values on the other hand, will always a string
1289
- *
1290
- * @param propValue the new value to coerce to some type
1291
- * @param propType the type of the prop, expressed as a binary number
1292
- * @returns the parsed/coerced value
1293
- */
1294
- const parsePropertyValue = (propValue, propType) => {
1295
- // ensure this value is of the correct prop type
1296
- if (propValue != null && !isComplexType(propValue)) {
1297
- if (propType & 4 /* Boolean */) {
1298
- // per the HTML spec, any string value means it is a boolean true value
1299
- // but we'll cheat here and say that the string "false" is the boolean false
1300
- return propValue === 'false' ? false : propValue === '' || !!propValue;
1301
- }
1302
- if (propType & 2 /* Number */) {
1303
- // force it to be a number
1304
- return parseFloat(propValue);
1305
- }
1306
- if (propType & 1 /* String */) {
1307
- // could have been passed as a number or boolean
1308
- // but we still want it as a string
1309
- return String(propValue);
1310
- }
1311
- // redundant return here for better minification
1312
- return propValue;
1313
- }
1314
- // not sure exactly what type we want
1315
- // so no need to change to a different type
1316
- return propValue;
1317
- };
1318
1539
  const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1319
1540
  const setValue = (ref, propName, newVal, cmpMeta) => {
1320
1541
  // check our new property value against our internal value
@@ -1327,13 +1548,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1327
1548
  // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1328
1549
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1329
1550
  const didValueChange = newVal !== oldVal && !areBothNaN;
1330
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1551
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1331
1552
  // gadzooks! the property's value has changed!!
1332
1553
  // set our new value!
1333
1554
  hostRef.$instanceValues$.set(propName, newVal);
1334
1555
  if (instance) {
1335
1556
  // get an array of method names of watch functions to call
1336
- if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1557
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1337
1558
  const watchMethods = cmpMeta.$watchers$[propName];
1338
1559
  if (watchMethods) {
1339
1560
  // this instance is watching for when this property changed
@@ -1348,7 +1569,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1348
1569
  });
1349
1570
  }
1350
1571
  }
1351
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1572
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1352
1573
  // looks like this value actually changed, so we've got work to do!
1353
1574
  // but only if we've already rendered, otherwise just chill out
1354
1575
  // queue that we need to do an update, but don't worry about queuing
@@ -1358,6 +1579,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
1358
1579
  }
1359
1580
  }
1360
1581
  };
1582
+ /**
1583
+ * Attach a series of runtime constructs to a compiled Stencil component
1584
+ * constructor, including getters and setters for the `@Prop` and `@State`
1585
+ * decorators, callbacks for when attributes change, and so on.
1586
+ *
1587
+ * @param Cstr the constructor for a component that we need to process
1588
+ * @param cmpMeta metadata collected previously about the component
1589
+ * @param flags a number used to store a series of bit flags
1590
+ * @returns a reference to the same constructor passed in (but now mutated)
1591
+ */
1361
1592
  const proxyComponent = (Cstr, cmpMeta, flags) => {
1362
1593
  if (cmpMeta.$members$) {
1363
1594
  if (Cstr.watchers) {
@@ -1367,8 +1598,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1367
1598
  const members = Object.entries(cmpMeta.$members$);
1368
1599
  const prototype = Cstr.prototype;
1369
1600
  members.map(([memberName, [memberFlags]]) => {
1370
- if ((memberFlags & 31 /* Prop */ ||
1371
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1601
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1602
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1372
1603
  // proxyComponent - prop
1373
1604
  Object.defineProperty(prototype, memberName, {
1374
1605
  get() {
@@ -1383,8 +1614,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1383
1614
  enumerable: true,
1384
1615
  });
1385
1616
  }
1386
- else if (flags & 1 /* isElementConstructor */ &&
1387
- memberFlags & 64 /* Method */) {
1617
+ else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1618
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1388
1619
  // proxyComponent - method
1389
1620
  Object.defineProperty(prototype, memberName, {
1390
1621
  value(...args) {
@@ -1394,7 +1625,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1394
1625
  });
1395
1626
  }
1396
1627
  });
1397
- if ((flags & 1 /* isElementConstructor */)) {
1628
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1398
1629
  const attrNameToPropName = new Map();
1399
1630
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1400
1631
  plt.jmp(() => {
@@ -1450,11 +1681,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1450
1681
  // create an array of attributes to observe
1451
1682
  // and also create a map of html attribute name to js property name
1452
1683
  Cstr.observedAttributes = members
1453
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1684
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1454
1685
  .map(([propName, m]) => {
1455
1686
  const attrName = m[1] || propName;
1456
1687
  attrNameToPropName.set(attrName, propName);
1457
- if (m[0] & 512 /* ReflectAttr */) {
1688
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1458
1689
  cmpMeta.$attrsToReflect$.push([propName, attrName]);
1459
1690
  }
1460
1691
  return attrName;
@@ -1465,10 +1696,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
1465
1696
  };
1466
1697
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1467
1698
  // initializeComponent
1468
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1699
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1469
1700
  {
1470
1701
  // we haven't initialized this element yet
1471
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1702
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1472
1703
  // lazy loaded components
1473
1704
  // request the component's implementation to be
1474
1705
  // wired up with the host element
@@ -1486,7 +1717,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1486
1717
  {
1487
1718
  cmpMeta.$watchers$ = Cstr.watchers;
1488
1719
  }
1489
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1720
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1490
1721
  Cstr.isProxied = true;
1491
1722
  }
1492
1723
  const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
@@ -1494,7 +1725,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1494
1725
  // but let's keep track of when we start and stop
1495
1726
  // so that the getters/setters don't incorrectly step on data
1496
1727
  {
1497
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1728
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1498
1729
  }
1499
1730
  // construct the lazy-loaded component implementation
1500
1731
  // passing the hostRef is very important during
@@ -1507,10 +1738,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1507
1738
  consoleError(e);
1508
1739
  }
1509
1740
  {
1510
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1741
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1511
1742
  }
1512
1743
  {
1513
- hostRef.$flags$ |= 128 /* isWatchReady */;
1744
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1514
1745
  }
1515
1746
  endNewInstance();
1516
1747
  fireConnectedCallback(hostRef.$lazyInstance$);
@@ -1521,7 +1752,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
1521
1752
  const scopeId = getScopeId(cmpMeta);
1522
1753
  if (!styles.has(scopeId)) {
1523
1754
  const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1524
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1755
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1525
1756
  endRegisterStyles();
1526
1757
  }
1527
1758
  }
@@ -1548,19 +1779,20 @@ const fireConnectedCallback = (instance) => {
1548
1779
  }
1549
1780
  };
1550
1781
  const connectedCallback = (elm) => {
1551
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1782
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1552
1783
  const hostRef = getHostRef(elm);
1553
1784
  const cmpMeta = hostRef.$cmpMeta$;
1554
1785
  const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1555
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1786
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1556
1787
  // first time this component has connected
1557
- hostRef.$flags$ |= 1 /* hasConnected */;
1788
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1558
1789
  {
1559
1790
  // initUpdate
1560
1791
  // if the slot polyfill is required we'll need to put some nodes
1561
1792
  // in here to act as original content anchors as we move nodes around
1562
1793
  // host element has been connected to the DOM
1563
- if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1794
+ if ((// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
1795
+ cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
1564
1796
  setContentReference(elm);
1565
1797
  }
1566
1798
  }
@@ -1583,7 +1815,7 @@ const connectedCallback = (elm) => {
1583
1815
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1584
1816
  if (cmpMeta.$members$) {
1585
1817
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1586
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1818
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1587
1819
  const value = elm[memberName];
1588
1820
  delete elm[memberName];
1589
1821
  elm[memberName] = value;
@@ -1621,7 +1853,7 @@ const setContentReference = (elm) => {
1621
1853
  elm.insertBefore(contentRefElm, elm.firstChild);
1622
1854
  };
1623
1855
  const disconnectedCallback = (elm) => {
1624
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1856
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1625
1857
  const hostRef = getHostRef(elm);
1626
1858
  const instance = hostRef.$lazyInstance$ ;
1627
1859
  {
@@ -1630,16 +1862,13 @@ const disconnectedCallback = (elm) => {
1630
1862
  hostRef.$rmListeners$ = undefined;
1631
1863
  }
1632
1864
  }
1633
- // clear CSS var-shim tracking
1634
- if (plt.$cssShim$) {
1635
- plt.$cssShim$.removeHost(elm);
1636
- }
1637
1865
  {
1638
1866
  safeCall(instance, 'disconnectedCallback');
1639
1867
  }
1640
1868
  }
1641
1869
  };
1642
1870
  const bootstrapLazy = (lazyBundles, options = {}) => {
1871
+ var _a;
1643
1872
  const endBootstrap = createTime();
1644
1873
  const cmpTags = [];
1645
1874
  const exclude = options.exclude || [];
@@ -1704,13 +1933,18 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1704
1933
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
1705
1934
  if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1706
1935
  cmpTags.push(tagName);
1707
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1936
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1708
1937
  }
1709
1938
  });
1710
1939
  });
1711
1940
  {
1712
1941
  visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1713
1942
  visibilityStyle.setAttribute('data-styles', '');
1943
+ // Apply CSP nonce to the style tag if it exists
1944
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1945
+ if (nonce != null) {
1946
+ visibilityStyle.setAttribute('nonce', nonce);
1947
+ }
1714
1948
  head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1715
1949
  }
1716
1950
  // Process deferred connectedCallbacks now all components have been registered
@@ -1726,7 +1960,48 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1726
1960
  // Fallback appLoad event
1727
1961
  endBootstrap();
1728
1962
  };
1729
- const hostRefs = new WeakMap();
1963
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1964
+ if (listeners) {
1965
+ listeners.map(([flags, name, method]) => {
1966
+ const target = getHostListenerTarget(elm, flags) ;
1967
+ const handler = hostListenerProxy(hostRef, method);
1968
+ const opts = hostListenerOpts(flags);
1969
+ plt.ael(target, name, handler, opts);
1970
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1971
+ });
1972
+ }
1973
+ };
1974
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1975
+ try {
1976
+ {
1977
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
1978
+ // instance is ready, let's call it's member method for this event
1979
+ hostRef.$lazyInstance$[methodName](ev);
1980
+ }
1981
+ else {
1982
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1983
+ }
1984
+ }
1985
+ }
1986
+ catch (e) {
1987
+ consoleError(e);
1988
+ }
1989
+ };
1990
+ const getHostListenerTarget = (elm, flags) => {
1991
+ if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
1992
+ return doc;
1993
+ return elm;
1994
+ };
1995
+ // prettier-ignore
1996
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1997
+ /**
1998
+ * Assigns the given value to the nonce property on the runtime platform object.
1999
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
2000
+ * @param nonce The value to be assigned to the platform nonce property.
2001
+ * @returns void
2002
+ */
2003
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
2004
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1730
2005
  const getHostRef = (ref) => hostRefs.get(ref);
1731
2006
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1732
2007
  const registerHost = (elm, cmpMeta) => {
@@ -1792,14 +2067,35 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1792
2067
  return importedModule[exportName];
1793
2068
  }, consoleError);
1794
2069
  };
1795
- const styles = new Map();
2070
+ const styles = /*@__PURE__*/ new Map();
2071
+ const win = typeof window !== 'undefined' ? window : {};
2072
+ const doc = win.document || { head: {} };
2073
+ const plt = {
2074
+ $flags$: 0,
2075
+ $resourcesUrl$: '',
2076
+ jmp: (h) => h(),
2077
+ raf: (h) => requestAnimationFrame(h),
2078
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
2079
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
2080
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
2081
+ };
2082
+ const promiseResolve = (v) => Promise.resolve(v);
2083
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
2084
+ try {
2085
+ new CSSStyleSheet();
2086
+ return typeof new CSSStyleSheet().replaceSync === 'function';
2087
+ }
2088
+ catch (e) { }
2089
+ return false;
2090
+ })()
2091
+ ;
1796
2092
  const queueDomReads = [];
1797
2093
  const queueDomWrites = [];
1798
2094
  const queueTask = (queue, write) => (cb) => {
1799
2095
  queue.push(cb);
1800
2096
  if (!queuePending) {
1801
2097
  queuePending = true;
1802
- if (write && plt.$flags$ & 4 /* queueSync */) {
2098
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1803
2099
  nextTick(flush);
1804
2100
  }
1805
2101
  else {
@@ -1836,17 +2132,15 @@ const flush = () => {
1836
2132
  const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1837
2133
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1838
2134
 
1839
- exports.CSS = CSS;
1840
2135
  exports.Host = Host;
1841
- exports.NAMESPACE = NAMESPACE;
1842
2136
  exports.bootstrapLazy = bootstrapLazy;
1843
2137
  exports.createEvent = createEvent;
1844
- exports.doc = doc;
1845
2138
  exports.forceUpdate = forceUpdate;
1846
2139
  exports.getElement = getElement;
1847
2140
  exports.getRenderingRef = getRenderingRef;
1848
2141
  exports.h = h;
1849
- exports.plt = plt;
1850
2142
  exports.promiseResolve = promiseResolve;
1851
2143
  exports.registerInstance = registerInstance;
1852
- exports.win = win;
2144
+ exports.setNonce = setNonce;
2145
+
2146
+ //# sourceMappingURL=index-5f3dfe40.js.map