@revolist/revogrid 4.0.29 → 4.0.31

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 (211) hide show
  1. package/dist/cjs/{app-globals-53fde1aa.js → app-globals-067b9262.js} +2 -2
  2. package/dist/cjs/{app-globals-53fde1aa.js.map → app-globals-067b9262.js.map} +1 -1
  3. package/dist/cjs/{base.plugin-32f80cb5.js → base.plugin-75fc9e81.js} +3 -4
  4. package/dist/cjs/base.plugin-75fc9e81.js.map +1 -0
  5. package/dist/cjs/{column.service-52b4cac9.js → column.service-b3b5a4ee.js} +4 -4
  6. package/dist/cjs/{column.service-52b4cac9.js.map → column.service-b3b5a4ee.js.map} +1 -1
  7. package/dist/cjs/{dimension.helpers-ee39d6c4.js → dimension.helpers-8e234f00.js} +193 -193
  8. package/dist/cjs/dimension.helpers-8e234f00.js.map +1 -0
  9. package/dist/cjs/{filter.button-db6cbd2e.js → filter.button-147884a8.js} +2 -2
  10. package/dist/cjs/{filter.button-db6cbd2e.js.map → filter.button-147884a8.js.map} +1 -1
  11. package/dist/cjs/{header-cell-renderer-a3f202a1.js → header-cell-renderer-96a37624.js} +3 -3
  12. package/dist/cjs/{header-cell-renderer-a3f202a1.js.map → header-cell-renderer-96a37624.js.map} +1 -1
  13. package/dist/cjs/{index-84e32c2a.js → index-feb2edd5.js} +193 -185
  14. package/dist/cjs/index-feb2edd5.js.map +1 -0
  15. package/dist/cjs/index.cjs.js +5 -5
  16. package/dist/cjs/{key.utils-ee3d9eab.js → key.utils-be4d0b46.js} +2 -2
  17. package/dist/cjs/{key.utils-ee3d9eab.js.map → key.utils-be4d0b46.js.map} +1 -1
  18. package/dist/cjs/loader.cjs.js +2 -2
  19. package/dist/cjs/revo-grid.cjs.entry.js +11 -11
  20. package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
  21. package/dist/cjs/revo-grid.cjs.js +3 -3
  22. package/dist/cjs/revo-grid.cjs.js.map +1 -1
  23. package/dist/cjs/revogr-attribution_6.cjs.entry.js +8 -8
  24. package/dist/cjs/revogr-attribution_6.cjs.entry.js.map +1 -1
  25. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +4 -4
  26. package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
  27. package/dist/cjs/revogr-data_4.cjs.entry.js +8 -8
  28. package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
  29. package/dist/cjs/revogr-filter-panel.cjs.entry.js +2 -2
  30. package/dist/cjs/{selection.helpers-32abb2a9.js → selection.helpers-032d7192.js} +3 -3
  31. package/dist/cjs/selection.helpers-032d7192.js.map +1 -0
  32. package/dist/cjs/{viewport.store-2ab4e166.js → viewport.store-c4b986f9.js} +2 -2
  33. package/dist/cjs/{viewport.store-2ab4e166.js.map → viewport.store-c4b986f9.js.map} +1 -1
  34. package/dist/collection/collection-manifest.json +1 -1
  35. package/dist/collection/components/data/column.service.js +1 -1
  36. package/dist/collection/components/data/column.service.js.map +1 -1
  37. package/dist/collection/components/data/revogr-data.js +13 -13
  38. package/dist/collection/components/data/revogr-data.js.map +1 -1
  39. package/dist/collection/components/editors/text-editor.js +1 -1
  40. package/dist/collection/components/editors/text-editor.js.map +1 -1
  41. package/dist/collection/components/header/revogr-header.js +8 -8
  42. package/dist/collection/components/header/revogr-header.js.map +1 -1
  43. package/dist/collection/components/order/revogr-order-editor.js +6 -6
  44. package/dist/collection/components/order/revogr-order-editor.js.map +1 -1
  45. package/dist/collection/components/overlay/autofill.service.js.map +1 -1
  46. package/dist/collection/components/overlay/keyboard.service.js.map +1 -1
  47. package/dist/collection/components/overlay/revogr-overlay-selection.js +1 -1
  48. package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -1
  49. package/dist/collection/components/revoGrid/revo-grid.js +9 -9
  50. package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
  51. package/dist/collection/components/revoGrid/viewport.service.js.map +1 -1
  52. package/dist/collection/components/scrollable/revogr-scroll-virtual.js +5 -5
  53. package/dist/collection/components/scrollable/revogr-scroll-virtual.js.map +1 -1
  54. package/dist/collection/components/selectionFocus/revogr-focus.js +10 -10
  55. package/dist/collection/components/selectionFocus/revogr-focus.js.map +1 -1
  56. package/dist/collection/components/selectionTempRange/revogr-temp-range.js +6 -6
  57. package/dist/collection/components/selectionTempRange/revogr-temp-range.js.map +1 -1
  58. package/dist/collection/components/vnode/vnode-converter.js +2 -2
  59. package/dist/collection/components/vnode/vnode.utils.js.map +1 -1
  60. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js.map +1 -1
  61. package/dist/collection/store/dataSource/data.proxy.js.map +1 -1
  62. package/dist/collection/store/dataSource/data.store.js +1 -1
  63. package/dist/collection/store/dataSource/data.store.js.map +1 -1
  64. package/dist/collection/store/dataSource/trimmed.plugin.js.map +1 -1
  65. package/dist/collection/store/dimension/dimension.store.js +1 -2
  66. package/dist/collection/store/dimension/dimension.store.js.map +1 -1
  67. package/dist/collection/store/selection/selection.store.js +1 -1
  68. package/dist/collection/store/selection/selection.store.js.map +1 -1
  69. package/dist/collection/store/vp/viewport.store.js +1 -1
  70. package/dist/collection/store/vp/viewport.store.js.map +1 -1
  71. package/dist/collection/types/interfaces.js.map +1 -1
  72. package/dist/collection/types/viewport.interfaces.js.map +1 -1
  73. package/dist/collection/utils/store.types.js +2 -0
  74. package/dist/collection/utils/store.types.js.map +1 -0
  75. package/dist/collection/utils/store.utils.js +1 -2
  76. package/dist/collection/utils/store.utils.js.map +1 -1
  77. package/dist/esm/{app-globals-ef1fca59.js → app-globals-c0b06b03.js} +2 -2
  78. package/dist/esm/{app-globals-ef1fca59.js.map → app-globals-c0b06b03.js.map} +1 -1
  79. package/dist/esm/{base.plugin-d0e589d8.js → base.plugin-e6e2bac2.js} +3 -4
  80. package/dist/esm/base.plugin-e6e2bac2.js.map +1 -0
  81. package/dist/esm/{column.service-a826bbd6.js → column.service-ffe99cfc.js} +4 -4
  82. package/dist/esm/{column.service-a826bbd6.js.map → column.service-ffe99cfc.js.map} +1 -1
  83. package/dist/esm/{dimension.helpers-a3065cb1.js → dimension.helpers-c0c2888f.js} +193 -193
  84. package/dist/esm/dimension.helpers-c0c2888f.js.map +1 -0
  85. package/dist/esm/{filter.button-46ce4f80.js → filter.button-f132c10a.js} +2 -2
  86. package/dist/esm/{filter.button-46ce4f80.js.map → filter.button-f132c10a.js.map} +1 -1
  87. package/dist/esm/{header-cell-renderer-19738045.js → header-cell-renderer-cac333a3.js} +3 -3
  88. package/dist/esm/{header-cell-renderer-19738045.js.map → header-cell-renderer-cac333a3.js.map} +1 -1
  89. package/dist/esm/{index-21436631.js → index-e661aeb5.js} +193 -185
  90. package/dist/esm/index-e661aeb5.js.map +1 -0
  91. package/dist/esm/index.js +5 -5
  92. package/dist/esm/{key.utils-7c5d91dd.js → key.utils-9120fde7.js} +2 -2
  93. package/dist/esm/{key.utils-7c5d91dd.js.map → key.utils-9120fde7.js.map} +1 -1
  94. package/dist/esm/loader.js +3 -3
  95. package/dist/esm/revo-grid.entry.js +11 -11
  96. package/dist/esm/revo-grid.entry.js.map +1 -1
  97. package/dist/esm/revo-grid.js +4 -4
  98. package/dist/esm/revo-grid.js.map +1 -1
  99. package/dist/esm/revogr-attribution_6.entry.js +8 -8
  100. package/dist/esm/revogr-attribution_6.entry.js.map +1 -1
  101. package/dist/esm/revogr-clipboard_3.entry.js +4 -4
  102. package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
  103. package/dist/esm/revogr-data_4.entry.js +8 -8
  104. package/dist/esm/revogr-data_4.entry.js.map +1 -1
  105. package/dist/esm/revogr-filter-panel.entry.js +2 -2
  106. package/dist/esm/{selection.helpers-883ce6bc.js → selection.helpers-0f3ed629.js} +3 -3
  107. package/dist/esm/selection.helpers-0f3ed629.js.map +1 -0
  108. package/dist/esm/{viewport.store-d9e291c5.js → viewport.store-2dc172be.js} +2 -2
  109. package/dist/esm/{viewport.store-d9e291c5.js.map → viewport.store-2dc172be.js.map} +1 -1
  110. package/dist/revo-grid/app-globals-c0b06b03.js +5 -0
  111. package/dist/revo-grid/base.plugin-e6e2bac2.js +5 -0
  112. package/dist/revo-grid/base.plugin-e6e2bac2.js.map +1 -0
  113. package/dist/revo-grid/{column.service-a826bbd6.js → column.service-ffe99cfc.js} +2 -2
  114. package/dist/revo-grid/column.service-ffe99cfc.js.map +1 -0
  115. package/dist/revo-grid/dimension.helpers-c0c2888f.js +5 -0
  116. package/dist/revo-grid/dimension.helpers-c0c2888f.js.map +1 -0
  117. package/dist/revo-grid/{filter.button-46ce4f80.js → filter.button-f132c10a.js} +2 -2
  118. package/dist/revo-grid/{header-cell-renderer-19738045.js → header-cell-renderer-cac333a3.js} +2 -2
  119. package/dist/revo-grid/index-e661aeb5.js +6 -0
  120. package/dist/revo-grid/index-e661aeb5.js.map +1 -0
  121. package/dist/revo-grid/index.esm.js +1 -1
  122. package/dist/revo-grid/{key.utils-7c5d91dd.js → key.utils-9120fde7.js} +2 -2
  123. package/dist/revo-grid/revo-grid.entry.js +1 -1
  124. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  125. package/dist/revo-grid/revo-grid.esm.js +1 -1
  126. package/dist/revo-grid/revo-grid.esm.js.map +1 -1
  127. package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
  128. package/dist/revo-grid/revogr-attribution_6.entry.js.map +1 -1
  129. package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
  130. package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
  131. package/dist/revo-grid/revogr-data_4.entry.js +1 -1
  132. package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
  133. package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
  134. package/dist/revo-grid/{selection.helpers-883ce6bc.js → selection.helpers-0f3ed629.js} +2 -2
  135. package/dist/revo-grid/selection.helpers-0f3ed629.js.map +1 -0
  136. package/dist/revo-grid/{viewport.store-d9e291c5.js → viewport.store-2dc172be.js} +2 -2
  137. package/dist/revo-grid/viewport.store-2dc172be.js.map +1 -0
  138. package/dist/types/components/data/column.service.d.ts +2 -3
  139. package/dist/types/components/data/revogr-data.d.ts +2 -2
  140. package/dist/types/components/editors/text-editor.d.ts +3 -3
  141. package/dist/types/components/header/revogr-header.d.ts +5 -6
  142. package/dist/types/components/order/revogr-order-editor.d.ts +2 -3
  143. package/dist/types/components/overlay/autofill.service.d.ts +2 -1
  144. package/dist/types/components/overlay/keyboard.service.d.ts +1 -1
  145. package/dist/types/components/overlay/revogr-overlay-selection.d.ts +2 -2
  146. package/dist/types/components/revoGrid/revo-grid.d.ts +2 -5
  147. package/dist/types/components/scrollable/revogr-scroll-virtual.d.ts +2 -1
  148. package/dist/types/components/selectionFocus/revogr-focus.d.ts +2 -1
  149. package/dist/types/components/selectionTempRange/revogr-temp-range.d.ts +2 -1
  150. package/dist/types/components/vnode/vnode.utils.d.ts +2 -1
  151. package/dist/types/components.d.ts +4 -2
  152. package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +4 -2
  153. package/dist/types/stencil-public-runtime.d.ts +0 -2
  154. package/dist/types/store/dataSource/data.proxy.d.ts +1 -1
  155. package/dist/types/store/dataSource/data.store.d.ts +2 -1
  156. package/dist/types/store/dataSource/trimmed.plugin.d.ts +1 -1
  157. package/dist/types/store/dimension/dimension.store.d.ts +3 -18
  158. package/dist/types/store/selection/selection.store.d.ts +1 -1
  159. package/dist/types/store/vp/viewport.store.d.ts +2 -1
  160. package/dist/types/types/interfaces.d.ts +2 -4
  161. package/dist/types/types/viewport.interfaces.d.ts +2 -1
  162. package/dist/types/utils/store.types.d.ts +97 -0
  163. package/dist/types/utils/store.utils.d.ts +4 -3
  164. package/hydrate/index.d.ts +29 -11
  165. package/hydrate/index.js +547 -544
  166. package/hydrate/index.mjs +32501 -0
  167. package/hydrate/package.json +7 -1
  168. package/loader/index.d.ts +3 -0
  169. package/package.json +3 -3
  170. package/standalone/column.service.js +1 -1
  171. package/standalone/column.service.js.map +1 -1
  172. package/standalone/data.store.js +192 -192
  173. package/standalone/data.store.js.map +1 -1
  174. package/standalone/revo-grid.js +3 -4
  175. package/standalone/revo-grid.js.map +1 -1
  176. package/standalone/revogr-data2.js.map +1 -1
  177. package/standalone/revogr-edit2.js +1 -1
  178. package/standalone/revogr-edit2.js.map +1 -1
  179. package/standalone/revogr-focus2.js.map +1 -1
  180. package/standalone/revogr-header2.js +2 -2
  181. package/standalone/revogr-header2.js.map +1 -1
  182. package/standalone/revogr-order-editor2.js.map +1 -1
  183. package/standalone/revogr-overlay-selection2.js +1 -1
  184. package/standalone/revogr-overlay-selection2.js.map +1 -1
  185. package/standalone/revogr-row-headers2.js.map +1 -1
  186. package/standalone/revogr-scroll-virtual2.js +1 -1
  187. package/standalone/revogr-scroll-virtual2.js.map +1 -1
  188. package/standalone/revogr-temp-range2.js.map +1 -1
  189. package/standalone/selection.utils.js +1 -1
  190. package/dist/cjs/base.plugin-32f80cb5.js.map +0 -1
  191. package/dist/cjs/dimension.helpers-ee39d6c4.js.map +0 -1
  192. package/dist/cjs/index-84e32c2a.js.map +0 -1
  193. package/dist/cjs/selection.helpers-32abb2a9.js.map +0 -1
  194. package/dist/esm/base.plugin-d0e589d8.js.map +0 -1
  195. package/dist/esm/dimension.helpers-a3065cb1.js.map +0 -1
  196. package/dist/esm/index-21436631.js.map +0 -1
  197. package/dist/esm/selection.helpers-883ce6bc.js.map +0 -1
  198. package/dist/revo-grid/app-globals-ef1fca59.js +0 -5
  199. package/dist/revo-grid/base.plugin-d0e589d8.js +0 -5
  200. package/dist/revo-grid/base.plugin-d0e589d8.js.map +0 -1
  201. package/dist/revo-grid/column.service-a826bbd6.js.map +0 -1
  202. package/dist/revo-grid/dimension.helpers-a3065cb1.js +0 -5
  203. package/dist/revo-grid/dimension.helpers-a3065cb1.js.map +0 -1
  204. package/dist/revo-grid/index-21436631.js +0 -6
  205. package/dist/revo-grid/index-21436631.js.map +0 -1
  206. package/dist/revo-grid/selection.helpers-883ce6bc.js.map +0 -1
  207. package/dist/revo-grid/viewport.store-d9e291c5.js.map +0 -1
  208. /package/dist/revo-grid/{app-globals-ef1fca59.js.map → app-globals-c0b06b03.js.map} +0 -0
  209. /package/dist/revo-grid/{filter.button-46ce4f80.js.map → filter.button-f132c10a.js.map} +0 -0
  210. /package/dist/revo-grid/{header-cell-renderer-19738045.js.map → header-cell-renderer-cac333a3.js.map} +0 -0
  211. /package/dist/revo-grid/{key.utils-7c5d91dd.js.map → key.utils-9120fde7.js.map} +0 -0
package/hydrate/index.js CHANGED
@@ -5,6 +5,8 @@
5
5
 
6
6
  Object.defineProperty(exports, '__esModule', { value: true });
7
7
 
8
+ var stream = require('stream');
9
+
8
10
  function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydrateResults, $stencilAfterHydrate, $stencilHydrateResolve) {
9
11
  var globalThis = $stencilWindow;
10
12
  var self = $stencilWindow;
@@ -128,7 +130,7 @@ const NAMESPACE = 'revo-grid';
128
130
  const BUILD = /* revo-grid */ { allRenderFn: false, appendChildSlotFix: false, asyncLoading: true, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: true, cmpWillUpdate: false, connectedCallback: true, constructableCSS: false, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: true, hostListenerTarget: true, hostListenerTargetBody: false, hostListenerTargetDocument: true, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: true, hydrateServerSide: true, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", invisiblePrehydration: false, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: false, shadowDomShim: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: true, taskQueue: true, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true };
129
131
 
130
132
  /*
131
- Stencil Hydrate Platform v4.18.3 | MIT Licensed | https://stenciljs.com
133
+ Stencil Hydrate Platform v4.19.1 | MIT Licensed | https://stenciljs.com
132
134
  */
133
135
  var __defProp = Object.defineProperty;
134
136
  var __export = (target, all) => {
@@ -144,7 +146,6 @@ var isComplexType = (o) => {
144
146
  o = typeof o;
145
147
  return o === "object" || o === "function";
146
148
  };
147
- var isPromise = (v) => !!v && (typeof v === "object" || typeof v === "function") && typeof v.then === "function";
148
149
 
149
150
  // src/utils/query-nonce-meta-tag-content.ts
150
151
  function queryNonceMetaTagContent(doc2) {
@@ -556,19 +557,21 @@ var registerStyle = (scopeId2, cssText, allowCS) => {
556
557
  };
557
558
  var addStyle = (styleContainerNode, cmpMeta, mode) => {
558
559
  var _a;
560
+ const styleContainerDocument = styleContainerNode;
561
+ const styleContainerShadowRoot = styleContainerNode;
559
562
  const scopeId2 = getScopeId(cmpMeta);
560
563
  const style = styles.get(scopeId2);
561
564
  styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
562
565
  if (style) {
563
566
  if (typeof style === "string") {
564
- styleContainerNode = styleContainerNode.head || styleContainerNode;
567
+ styleContainerNode = styleContainerDocument.head || styleContainerNode;
565
568
  let appliedStyles = rootAppliedStyles.get(styleContainerNode);
566
569
  let styleElm;
567
570
  if (!appliedStyles) {
568
571
  rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
569
572
  }
570
573
  if (!appliedStyles.has(scopeId2)) {
571
- if (styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
574
+ if (styleContainerShadowRoot.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
572
575
  styleElm.innerHTML = style;
573
576
  } else {
574
577
  styleElm = doc.createElement("style");
@@ -763,7 +766,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
763
766
  }
764
767
  elm = newVNode2.$elm$ = doc.createElementNS(
765
768
  isSvgMode ? SVG_NS : HTML_NS,
766
- newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
769
+ !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
767
770
  ) ;
768
771
  if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
769
772
  isSvgMode = false;
@@ -1253,7 +1256,10 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
1253
1256
  endSchedule();
1254
1257
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1255
1258
  };
1256
- var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
1259
+ var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => {
1260
+ console.error(err2);
1261
+ fn();
1262
+ }) : fn();
1257
1263
  var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
1258
1264
  var updateComponent = async (hostRef, instance, isInitialLoad) => {
1259
1265
  var _a;
@@ -1441,13 +1447,13 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1441
1447
 
1442
1448
  // src/runtime/proxy-component.ts
1443
1449
  var proxyComponent = (Cstr, cmpMeta, flags) => {
1444
- var _a;
1450
+ var _a, _b;
1445
1451
  const prototype = Cstr.prototype;
1446
- if (cmpMeta.$members$) {
1447
- if (Cstr.watchers) {
1452
+ if (cmpMeta.$members$ || (cmpMeta.$watchers$ || Cstr.watchers)) {
1453
+ if (Cstr.watchers && !cmpMeta.$watchers$) {
1448
1454
  cmpMeta.$watchers$ = Cstr.watchers;
1449
1455
  }
1450
- const members = Object.entries(cmpMeta.$members$);
1456
+ const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
1451
1457
  members.map(([memberName, [memberFlags]]) => {
1452
1458
  if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
1453
1459
  Object.defineProperty(prototype, memberName, {
@@ -1503,7 +1509,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1503
1509
  };
1504
1510
  Cstr.observedAttributes = Array.from(
1505
1511
  /* @__PURE__ */ new Set([
1506
- ...Object.keys((_a = cmpMeta.$watchers$) != null ? _a : {}),
1512
+ ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
1507
1513
  ...members.filter(([_, m]) => m[0] & 15 /* HasAttribute */).map(([propName, m]) => {
1508
1514
  var _a2;
1509
1515
  const attrName = m[1] || propName;
@@ -1568,7 +1574,10 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1568
1574
  customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
1569
1575
  }
1570
1576
  if (Cstr && Cstr.style) {
1571
- let style = Cstr.style;
1577
+ let style;
1578
+ if (typeof Cstr.style === "string") {
1579
+ style = Cstr.style;
1580
+ }
1572
1581
  const scopeId2 = getScopeId(cmpMeta);
1573
1582
  if (!styles.has(scopeId2)) {
1574
1583
  const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
@@ -1724,6 +1733,7 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
1724
1733
  }
1725
1734
  };
1726
1735
  var parseVNodeAnnotations = (doc2, node, docData, orgLocationNodes) => {
1736
+ var _a;
1727
1737
  if (node == null) {
1728
1738
  return;
1729
1739
  }
@@ -1731,7 +1741,8 @@ var parseVNodeAnnotations = (doc2, node, docData, orgLocationNodes) => {
1731
1741
  orgLocationNodes.push(node);
1732
1742
  }
1733
1743
  if (node.nodeType === 1 /* ElementNode */) {
1734
- node.childNodes.forEach((childNode) => {
1744
+ const childNodes = [...Array.from(node.childNodes), ...Array.from(((_a = node.shadowRoot) == null ? void 0 : _a.childNodes) || [])];
1745
+ childNodes.forEach((childNode) => {
1735
1746
  const hostRef = getHostRef(childNode);
1736
1747
  if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) {
1737
1748
  const cmpData = {
@@ -1812,44 +1823,53 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
1812
1823
  var hAsync = (nodeName, vnodeData, ...children) => {
1813
1824
  if (Array.isArray(children) && children.length > 0) {
1814
1825
  const flatChildren = children.flat(Infinity);
1815
- if (flatChildren.some(isPromise)) {
1826
+ if (flatChildren.some((child) => child instanceof Promise)) {
1816
1827
  return Promise.all(flatChildren).then((resolvedChildren) => {
1817
1828
  return h(nodeName, vnodeData, ...resolvedChildren);
1818
1829
  }).catch((err2) => {
1819
1830
  return h(nodeName, vnodeData);
1820
1831
  });
1821
1832
  }
1822
- return h(nodeName, vnodeData, ...children);
1833
+ return h(nodeName, vnodeData, ...flatChildren);
1823
1834
  }
1824
1835
  return h(nodeName, vnodeData);
1825
1836
  };
1826
-
1827
- // src/hydrate/platform/proxy-host-element.ts
1828
- function proxyHostElement(elm, cmpMeta) {
1837
+ function proxyHostElement(elm, cmpMeta, opts) {
1829
1838
  if (typeof elm.componentOnReady !== "function") {
1830
1839
  elm.componentOnReady = componentOnReady;
1831
1840
  }
1832
1841
  if (typeof elm.forceUpdate !== "function") {
1833
1842
  elm.forceUpdate = forceUpdate2;
1834
1843
  }
1835
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1836
- elm.shadowRoot = elm;
1844
+ if (!elm.shadowRoot && !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
1845
+ if (opts.serializeShadowRoot) {
1846
+ elm.attachShadow({ mode: "open" });
1847
+ } else {
1848
+ elm.shadowRoot = elm;
1849
+ }
1837
1850
  }
1838
1851
  if (cmpMeta.$members$ != null) {
1839
1852
  const hostRef = getHostRef(elm);
1840
1853
  const members = Object.entries(cmpMeta.$members$);
1841
1854
  members.forEach(([memberName, m]) => {
1855
+ var _a, _b;
1842
1856
  const memberFlags = m[0];
1843
1857
  if (memberFlags & 31 /* Prop */) {
1844
1858
  const attributeName = m[1] || memberName;
1845
- const attrValue = elm.getAttribute(attributeName);
1859
+ let attrValue = elm.getAttribute(attributeName);
1860
+ if ((attrValue == null ? void 0 : attrValue.startsWith("{")) && attrValue.endsWith("}") || (attrValue == null ? void 0 : attrValue.startsWith("[")) && attrValue.endsWith("]")) {
1861
+ try {
1862
+ attrValue = JSON.parse(attrValue);
1863
+ } catch (e) {
1864
+ }
1865
+ }
1846
1866
  if (attrValue != null) {
1847
1867
  const parsedAttrValue = parsePropertyValue(attrValue, memberFlags);
1848
- hostRef.$instanceValues$.set(memberName, parsedAttrValue);
1868
+ (_a = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _a.set(memberName, parsedAttrValue);
1849
1869
  }
1850
1870
  const ownValue = elm[memberName];
1851
1871
  if (ownValue !== void 0) {
1852
- hostRef.$instanceValues$.set(memberName, ownValue);
1872
+ (_b = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b.set(memberName, ownValue);
1853
1873
  delete elm[memberName];
1854
1874
  }
1855
1875
  Object.defineProperty(elm, memberName, {
@@ -1865,8 +1885,12 @@ function proxyHostElement(elm, cmpMeta) {
1865
1885
  } else if (memberFlags & 64 /* Method */) {
1866
1886
  Object.defineProperty(elm, memberName, {
1867
1887
  value(...args) {
1888
+ var _a2;
1868
1889
  const ref = getHostRef(this);
1869
- return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args)).catch(consoleError);
1890
+ return (_a2 = ref == null ? void 0 : ref.$onInstancePromise$) == null ? void 0 : _a2.then(() => {
1891
+ var _a3;
1892
+ return (_a3 = ref == null ? void 0 : ref.$lazyInstance$) == null ? void 0 : _a3[memberName](...args);
1893
+ }).catch(consoleError);
1870
1894
  }
1871
1895
  });
1872
1896
  }
@@ -1874,7 +1898,8 @@ function proxyHostElement(elm, cmpMeta) {
1874
1898
  }
1875
1899
  }
1876
1900
  function componentOnReady() {
1877
- return getHostRef(this).$onReadyPromise$;
1901
+ var _a;
1902
+ return (_a = getHostRef(this)) == null ? void 0 : _a.$onReadyPromise$;
1878
1903
  }
1879
1904
  function forceUpdate2() {
1880
1905
  }
@@ -1890,7 +1915,7 @@ function hydrateApp(win2, opts, results, afterHydrate, resolve) {
1890
1915
  let tmrId;
1891
1916
  let ranCompleted = false;
1892
1917
  function hydratedComplete() {
1893
- global.clearTimeout(tmrId);
1918
+ globalThis.clearTimeout(tmrId);
1894
1919
  createdElements.clear();
1895
1920
  connectedElements.clear();
1896
1921
  if (!ranCompleted) {
@@ -1931,7 +1956,7 @@ function hydrateApp(win2, opts, results, afterHydrate, resolve) {
1931
1956
  createdElements.add(elm);
1932
1957
  elm.connectedCallback = patchedConnectedCallback2;
1933
1958
  registerHost(elm, Cstr.cmpMeta);
1934
- proxyHostElement(elm, Cstr.cmpMeta);
1959
+ proxyHostElement(elm, Cstr.cmpMeta, opts);
1935
1960
  }
1936
1961
  }
1937
1962
  }
@@ -1969,7 +1994,7 @@ function hydrateApp(win2, opts, results, afterHydrate, resolve) {
1969
1994
  patchElement2(elm);
1970
1995
  return elm;
1971
1996
  };
1972
- tmrId = global.setTimeout(timeoutExceeded, opts.timeout);
1997
+ tmrId = globalThis.setTimeout(timeoutExceeded, opts.timeout);
1973
1998
  plt.$resourcesUrl$ = new URL(opts.resourcesUrl || "./", doc.baseURI).href;
1974
1999
  patchChild2(win2.document.body);
1975
2000
  waitLoop2().then(hydratedComplete).catch(hydratedError);
@@ -1988,6 +2013,8 @@ async function hydrateComponent(win2, results, tagName, elm, waitingElements) {
1988
2013
  const cmpMeta = Cstr.cmpMeta;
1989
2014
  if (cmpMeta != null) {
1990
2015
  waitingElements.add(elm);
2016
+ const hostRef = getHostRef(this);
2017
+ addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
1991
2018
  try {
1992
2019
  connectedCallback(elm);
1993
2020
  await elm.componentOnReady();
@@ -2158,7 +2185,7 @@ var registerComponents = (Cstrs) => {
2158
2185
  var win = window;
2159
2186
  var doc = win.document;
2160
2187
  var writeTask = (cb) => {
2161
- process.nextTick(() => {
2188
+ nextTick(() => {
2162
2189
  try {
2163
2190
  cb();
2164
2191
  } catch (e) {
@@ -2183,7 +2210,7 @@ var plt = {
2183
2210
  rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
2184
2211
  ce: (eventName, opts) => new win.CustomEvent(eventName, opts)
2185
2212
  };
2186
- var supportsShadow = false;
2213
+ var supportsShadow = BUILD.shadowDom;
2187
2214
  var hostRefs = /* @__PURE__ */ new WeakMap();
2188
2215
  var getHostRef = (ref) => hostRefs.get(ref);
2189
2216
  var registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
@@ -2199,7 +2226,6 @@ var registerHost = (elm, cmpMeta) => {
2199
2226
  hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
2200
2227
  elm["s-p"] = [];
2201
2228
  elm["s-rc"] = [];
2202
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
2203
2229
  return hostRefs.set(elm, hostRef);
2204
2230
  };
2205
2231
  var styles = /* @__PURE__ */ new Map();
@@ -3281,197 +3307,6 @@ function isProxy(k) {
3281
3307
  return k === 'proxyItems';
3282
3308
  }
3283
3309
 
3284
- const appendToMap = (map, propName, value) => {
3285
- const items = map.get(propName);
3286
- if (!items) {
3287
- map.set(propName, [value]);
3288
- }
3289
- else if (!items.includes(value)) {
3290
- items.push(value);
3291
- }
3292
- };
3293
- const debounce$1 = (fn, ms) => {
3294
- let timeoutId;
3295
- return (...args) => {
3296
- if (timeoutId) {
3297
- clearTimeout(timeoutId);
3298
- }
3299
- timeoutId = setTimeout(() => {
3300
- timeoutId = 0;
3301
- fn(...args);
3302
- }, ms);
3303
- };
3304
- };
3305
-
3306
- /**
3307
- * Check if a possible element isConnected.
3308
- * The property might not be there, so we check for it.
3309
- *
3310
- * We want it to return true if isConnected is not a property,
3311
- * otherwise we would remove these elements and would not update.
3312
- *
3313
- * Better leak in Edge than to be useless.
3314
- */
3315
- const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
3316
- const cleanupElements = debounce$1((map) => {
3317
- for (let key of map.keys()) {
3318
- map.set(key, map.get(key).filter(isConnected));
3319
- }
3320
- }, 2000);
3321
- const stencilSubscription = () => {
3322
- if (typeof getRenderingRef !== 'function') {
3323
- // If we are not in a stencil project, we do nothing.
3324
- // This function is not really exported by @stencil/core.
3325
- return {};
3326
- }
3327
- const elmsToUpdate = new Map();
3328
- return {
3329
- dispose: () => elmsToUpdate.clear(),
3330
- get: (propName) => {
3331
- const elm = getRenderingRef();
3332
- if (elm) {
3333
- appendToMap(elmsToUpdate, propName, elm);
3334
- }
3335
- },
3336
- set: (propName) => {
3337
- const elements = elmsToUpdate.get(propName);
3338
- if (elements) {
3339
- elmsToUpdate.set(propName, elements.filter(forceUpdate));
3340
- }
3341
- cleanupElements(elmsToUpdate);
3342
- },
3343
- reset: () => {
3344
- elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
3345
- cleanupElements(elmsToUpdate);
3346
- },
3347
- };
3348
- };
3349
-
3350
- const unwrap = (val) => (typeof val === 'function' ? val() : val);
3351
- const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
3352
- const unwrappedState = unwrap(defaultState);
3353
- let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
3354
- const handlers = {
3355
- dispose: [],
3356
- get: [],
3357
- set: [],
3358
- reset: [],
3359
- };
3360
- const reset = () => {
3361
- var _a;
3362
- // When resetting the state, the default state may be a function - unwrap it to invoke it.
3363
- // otherwise, the state won't be properly reset
3364
- states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
3365
- handlers.reset.forEach((cb) => cb());
3366
- };
3367
- const dispose = () => {
3368
- // Call first dispose as resetting the state would
3369
- // cause less updates ;)
3370
- handlers.dispose.forEach((cb) => cb());
3371
- reset();
3372
- };
3373
- const get = (propName) => {
3374
- handlers.get.forEach((cb) => cb(propName));
3375
- return states.get(propName);
3376
- };
3377
- const set = (propName, value) => {
3378
- const oldValue = states.get(propName);
3379
- if (shouldUpdate(value, oldValue, propName)) {
3380
- states.set(propName, value);
3381
- handlers.set.forEach((cb) => cb(propName, value, oldValue));
3382
- }
3383
- };
3384
- const state = (typeof Proxy === 'undefined'
3385
- ? {}
3386
- : new Proxy(unwrappedState, {
3387
- get(_, propName) {
3388
- return get(propName);
3389
- },
3390
- ownKeys(_) {
3391
- return Array.from(states.keys());
3392
- },
3393
- getOwnPropertyDescriptor() {
3394
- return {
3395
- enumerable: true,
3396
- configurable: true,
3397
- };
3398
- },
3399
- has(_, propName) {
3400
- return states.has(propName);
3401
- },
3402
- set(_, propName, value) {
3403
- set(propName, value);
3404
- return true;
3405
- },
3406
- }));
3407
- const on = (eventName, callback) => {
3408
- handlers[eventName].push(callback);
3409
- return () => {
3410
- removeFromArray(handlers[eventName], callback);
3411
- };
3412
- };
3413
- const onChange = (propName, cb) => {
3414
- const unSet = on('set', (key, newValue) => {
3415
- if (key === propName) {
3416
- cb(newValue);
3417
- }
3418
- });
3419
- // We need to unwrap the defaultState because it might be a function.
3420
- // Otherwise we might not be sending the right reset value.
3421
- const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
3422
- return () => {
3423
- unSet();
3424
- unReset();
3425
- };
3426
- };
3427
- const use = (...subscriptions) => {
3428
- const unsubs = subscriptions.reduce((unsubs, subscription) => {
3429
- if (subscription.set) {
3430
- unsubs.push(on('set', subscription.set));
3431
- }
3432
- if (subscription.get) {
3433
- unsubs.push(on('get', subscription.get));
3434
- }
3435
- if (subscription.reset) {
3436
- unsubs.push(on('reset', subscription.reset));
3437
- }
3438
- if (subscription.dispose) {
3439
- unsubs.push(on('dispose', subscription.dispose));
3440
- }
3441
- return unsubs;
3442
- }, []);
3443
- return () => unsubs.forEach((unsub) => unsub());
3444
- };
3445
- const forceUpdate = (key) => {
3446
- const oldValue = states.get(key);
3447
- handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
3448
- };
3449
- return {
3450
- state,
3451
- get,
3452
- set,
3453
- on,
3454
- onChange,
3455
- use,
3456
- dispose,
3457
- reset,
3458
- forceUpdate,
3459
- };
3460
- };
3461
- const removeFromArray = (array, item) => {
3462
- const index = array.indexOf(item);
3463
- if (index >= 0) {
3464
- array[index] = array[array.length - 1];
3465
- array.length--;
3466
- }
3467
- };
3468
-
3469
- const createStore = (defaultState, shouldUpdate) => {
3470
- const map = createObservableMap(defaultState, shouldUpdate);
3471
- map.use(stencilSubscription());
3472
- return map;
3473
- };
3474
-
3475
3310
  /**
3476
3311
  * The base implementation of `_.findIndex` and `_.findLastIndex` without
3477
3312
  * support for iteratee shorthands.
@@ -6667,59 +6502,250 @@ function createRange$1(fromRight) {
6667
6502
  } else {
6668
6503
  end = toFinite(end);
6669
6504
  }
6670
- step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
6671
- return baseRange(start, end, step, fromRight);
6672
- };
6673
- }
6674
-
6675
- var _createRange = createRange$1;
6676
-
6677
- var createRange = _createRange;
6678
-
6679
- /**
6680
- * Creates an array of numbers (positive and/or negative) progressing from
6681
- * `start` up to, but not including, `end`. A step of `-1` is used if a negative
6682
- * `start` is specified without an `end` or `step`. If `end` is not specified,
6683
- * it's set to `start` with `start` then set to `0`.
6684
- *
6685
- * **Note:** JavaScript follows the IEEE-754 standard for resolving
6686
- * floating-point values which can produce unexpected results.
6687
- *
6688
- * @static
6689
- * @since 0.1.0
6690
- * @memberOf _
6691
- * @category Util
6692
- * @param {number} [start=0] The start of the range.
6693
- * @param {number} end The end of the range.
6694
- * @param {number} [step=1] The value to increment or decrement by.
6695
- * @returns {Array} Returns the range of numbers.
6696
- * @see _.inRange, _.rangeRight
6697
- * @example
6698
- *
6699
- * _.range(4);
6700
- * // => [0, 1, 2, 3]
6701
- *
6702
- * _.range(-4);
6703
- * // => [0, -1, -2, -3]
6704
- *
6705
- * _.range(1, 5);
6706
- * // => [1, 2, 3, 4]
6707
- *
6708
- * _.range(0, 20, 5);
6709
- * // => [0, 5, 10, 15]
6710
- *
6711
- * _.range(0, -4, -1);
6712
- * // => [0, -1, -2, -3]
6713
- *
6714
- * _.range(1, 4, 0);
6715
- * // => [1, 1, 1]
6716
- *
6717
- * _.range(0);
6718
- * // => []
6719
- */
6720
- var range = createRange();
6505
+ step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
6506
+ return baseRange(start, end, step, fromRight);
6507
+ };
6508
+ }
6509
+
6510
+ var _createRange = createRange$1;
6511
+
6512
+ var createRange = _createRange;
6513
+
6514
+ /**
6515
+ * Creates an array of numbers (positive and/or negative) progressing from
6516
+ * `start` up to, but not including, `end`. A step of `-1` is used if a negative
6517
+ * `start` is specified without an `end` or `step`. If `end` is not specified,
6518
+ * it's set to `start` with `start` then set to `0`.
6519
+ *
6520
+ * **Note:** JavaScript follows the IEEE-754 standard for resolving
6521
+ * floating-point values which can produce unexpected results.
6522
+ *
6523
+ * @static
6524
+ * @since 0.1.0
6525
+ * @memberOf _
6526
+ * @category Util
6527
+ * @param {number} [start=0] The start of the range.
6528
+ * @param {number} end The end of the range.
6529
+ * @param {number} [step=1] The value to increment or decrement by.
6530
+ * @returns {Array} Returns the range of numbers.
6531
+ * @see _.inRange, _.rangeRight
6532
+ * @example
6533
+ *
6534
+ * _.range(4);
6535
+ * // => [0, 1, 2, 3]
6536
+ *
6537
+ * _.range(-4);
6538
+ * // => [0, -1, -2, -3]
6539
+ *
6540
+ * _.range(1, 5);
6541
+ * // => [1, 2, 3, 4]
6542
+ *
6543
+ * _.range(0, 20, 5);
6544
+ * // => [0, 5, 10, 15]
6545
+ *
6546
+ * _.range(0, -4, -1);
6547
+ * // => [0, -1, -2, -3]
6548
+ *
6549
+ * _.range(1, 4, 0);
6550
+ * // => [1, 1, 1]
6551
+ *
6552
+ * _.range(0);
6553
+ * // => []
6554
+ */
6555
+ var range = createRange();
6556
+
6557
+ var range_1 = range;
6558
+
6559
+ const appendToMap = (map, propName, value) => {
6560
+ const items = map.get(propName);
6561
+ if (!items) {
6562
+ map.set(propName, [value]);
6563
+ }
6564
+ else if (!items.includes(value)) {
6565
+ items.push(value);
6566
+ }
6567
+ };
6568
+ const debounce$1 = (fn, ms) => {
6569
+ let timeoutId;
6570
+ return (...args) => {
6571
+ if (timeoutId) {
6572
+ clearTimeout(timeoutId);
6573
+ }
6574
+ timeoutId = setTimeout(() => {
6575
+ timeoutId = 0;
6576
+ fn(...args);
6577
+ }, ms);
6578
+ };
6579
+ };
6580
+
6581
+ /**
6582
+ * Check if a possible element isConnected.
6583
+ * The property might not be there, so we check for it.
6584
+ *
6585
+ * We want it to return true if isConnected is not a property,
6586
+ * otherwise we would remove these elements and would not update.
6587
+ *
6588
+ * Better leak in Edge than to be useless.
6589
+ */
6590
+ const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
6591
+ const cleanupElements = debounce$1((map) => {
6592
+ for (let key of map.keys()) {
6593
+ map.set(key, map.get(key).filter(isConnected));
6594
+ }
6595
+ }, 2000);
6596
+ const stencilSubscription = () => {
6597
+ if (typeof getRenderingRef !== 'function') {
6598
+ // If we are not in a stencil project, we do nothing.
6599
+ // This function is not really exported by @stencil/core.
6600
+ return {};
6601
+ }
6602
+ const elmsToUpdate = new Map();
6603
+ return {
6604
+ dispose: () => elmsToUpdate.clear(),
6605
+ get: (propName) => {
6606
+ const elm = getRenderingRef();
6607
+ if (elm) {
6608
+ appendToMap(elmsToUpdate, propName, elm);
6609
+ }
6610
+ },
6611
+ set: (propName) => {
6612
+ const elements = elmsToUpdate.get(propName);
6613
+ if (elements) {
6614
+ elmsToUpdate.set(propName, elements.filter(forceUpdate));
6615
+ }
6616
+ cleanupElements(elmsToUpdate);
6617
+ },
6618
+ reset: () => {
6619
+ elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
6620
+ cleanupElements(elmsToUpdate);
6621
+ },
6622
+ };
6623
+ };
6624
+
6625
+ const unwrap = (val) => (typeof val === 'function' ? val() : val);
6626
+ const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
6627
+ const unwrappedState = unwrap(defaultState);
6628
+ let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
6629
+ const handlers = {
6630
+ dispose: [],
6631
+ get: [],
6632
+ set: [],
6633
+ reset: [],
6634
+ };
6635
+ const reset = () => {
6636
+ var _a;
6637
+ // When resetting the state, the default state may be a function - unwrap it to invoke it.
6638
+ // otherwise, the state won't be properly reset
6639
+ states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
6640
+ handlers.reset.forEach((cb) => cb());
6641
+ };
6642
+ const dispose = () => {
6643
+ // Call first dispose as resetting the state would
6644
+ // cause less updates ;)
6645
+ handlers.dispose.forEach((cb) => cb());
6646
+ reset();
6647
+ };
6648
+ const get = (propName) => {
6649
+ handlers.get.forEach((cb) => cb(propName));
6650
+ return states.get(propName);
6651
+ };
6652
+ const set = (propName, value) => {
6653
+ const oldValue = states.get(propName);
6654
+ if (shouldUpdate(value, oldValue, propName)) {
6655
+ states.set(propName, value);
6656
+ handlers.set.forEach((cb) => cb(propName, value, oldValue));
6657
+ }
6658
+ };
6659
+ const state = (typeof Proxy === 'undefined'
6660
+ ? {}
6661
+ : new Proxy(unwrappedState, {
6662
+ get(_, propName) {
6663
+ return get(propName);
6664
+ },
6665
+ ownKeys(_) {
6666
+ return Array.from(states.keys());
6667
+ },
6668
+ getOwnPropertyDescriptor() {
6669
+ return {
6670
+ enumerable: true,
6671
+ configurable: true,
6672
+ };
6673
+ },
6674
+ has(_, propName) {
6675
+ return states.has(propName);
6676
+ },
6677
+ set(_, propName, value) {
6678
+ set(propName, value);
6679
+ return true;
6680
+ },
6681
+ }));
6682
+ const on = (eventName, callback) => {
6683
+ handlers[eventName].push(callback);
6684
+ return () => {
6685
+ removeFromArray(handlers[eventName], callback);
6686
+ };
6687
+ };
6688
+ const onChange = (propName, cb) => {
6689
+ const unSet = on('set', (key, newValue) => {
6690
+ if (key === propName) {
6691
+ cb(newValue);
6692
+ }
6693
+ });
6694
+ // We need to unwrap the defaultState because it might be a function.
6695
+ // Otherwise we might not be sending the right reset value.
6696
+ const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
6697
+ return () => {
6698
+ unSet();
6699
+ unReset();
6700
+ };
6701
+ };
6702
+ const use = (...subscriptions) => {
6703
+ const unsubs = subscriptions.reduce((unsubs, subscription) => {
6704
+ if (subscription.set) {
6705
+ unsubs.push(on('set', subscription.set));
6706
+ }
6707
+ if (subscription.get) {
6708
+ unsubs.push(on('get', subscription.get));
6709
+ }
6710
+ if (subscription.reset) {
6711
+ unsubs.push(on('reset', subscription.reset));
6712
+ }
6713
+ if (subscription.dispose) {
6714
+ unsubs.push(on('dispose', subscription.dispose));
6715
+ }
6716
+ return unsubs;
6717
+ }, []);
6718
+ return () => unsubs.forEach((unsub) => unsub());
6719
+ };
6720
+ const forceUpdate = (key) => {
6721
+ const oldValue = states.get(key);
6722
+ handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
6723
+ };
6724
+ return {
6725
+ state,
6726
+ get,
6727
+ set,
6728
+ on,
6729
+ onChange,
6730
+ use,
6731
+ dispose,
6732
+ reset,
6733
+ forceUpdate,
6734
+ };
6735
+ };
6736
+ const removeFromArray = (array, item) => {
6737
+ const index = array.indexOf(item);
6738
+ if (index >= 0) {
6739
+ array[index] = array[array.length - 1];
6740
+ array.length--;
6741
+ }
6742
+ };
6721
6743
 
6722
- var range_1 = range;
6744
+ const createStore = (defaultState, shouldUpdate) => {
6745
+ const map = createObservableMap(defaultState, shouldUpdate);
6746
+ map.use(stencilSubscription());
6747
+ return map;
6748
+ };
6723
6749
 
6724
6750
  /**
6725
6751
  * Hide items from main collection
@@ -7511,7 +7537,6 @@ class DimensionStore {
7511
7537
  setDimensionSize(sizes) {
7512
7538
  const dimensionData = calculateDimensionData(this.store.get('originItemSize'), sizes);
7513
7539
  setStore(this.store, dimensionData);
7514
- return dimensionData;
7515
7540
  }
7516
7541
  }
7517
7542
 
@@ -9973,7 +9998,7 @@ class OverlaySelection {
9973
9998
  nodes.push(hAsync("revogr-order-editor", { ref: e => (this.orderEditor = e), dataStore: this.dataStore, dimensionRow: this.dimensionRow, dimensionCol: this.dimensionCol, parent: this.element, onRowdragstartinit: e => this.rowDragStart(e) }));
9974
9999
  }
9975
10000
  }
9976
- return (hAsync(Host, { key: '3d40ea4ca89197d464bc5b84354e859a7bb9e1fa', class: { mobile: this.isMobileDevice }, onDblClick: (e) => this.onElementDblClick(e), onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true) }, nodes, hAsync("slot", { key: '0d318f6e73fe84efd8d3b621c463bb3700d11eed', name: "data" })));
10001
+ return (hAsync(Host, { key: '676c1ac41a3658f7c2cb93ada69fbf141a51c660', class: { mobile: this.isMobileDevice }, onDblClick: (e) => this.onElementDblClick(e), onMouseDown: (e) => this.onElementMouseDown(e), onTouchStart: (e) => this.onElementMouseDown(e, true) }, nodes, hAsync("slot", { key: '42f4e051d6f531bd92e22106ca0eb1808068e8d0', name: "data" })));
9977
10002
  }
9978
10003
  /**
9979
10004
  * Executes the focus operation on the specified range of cells.
@@ -10240,7 +10265,7 @@ class TextEditor {
10240
10265
  this.column = column;
10241
10266
  this.saveCallback = saveCallback;
10242
10267
  this.element = null;
10243
- this.editCell = null;
10268
+ this.editCell = undefined;
10244
10269
  }
10245
10270
  /**
10246
10271
  * Callback triggered on cell editor render
@@ -14698,7 +14723,7 @@ class RevoGridComponent {
14698
14723
  const headerProperties = Object.assign(Object.assign({}, view.headerProp), { type: view.type, additionalData: this.additionalData, viewportCol: view.viewportCol, selectionStore: view.columnSelectionStore, canResize: this.resize, readonly: this.readonly, columnFilter: !!this.filter });
14699
14724
  // Column headers
14700
14725
  const dataViews = [
14701
- hAsync("revogr-header", Object.assign({ key: 'f304dcc1c0ef2bc274929ef0982152905d31f761' }, headerProperties, { slot: HEADER_SLOT })),
14726
+ hAsync("revogr-header", Object.assign({ key: 'b3c3ccd088d6a01511b07f66f7dc937617a4786d' }, headerProperties, { slot: HEADER_SLOT })),
14702
14727
  ];
14703
14728
  // Render viewport data (vertical sections)
14704
14729
  view.dataPorts.forEach(data => {
@@ -14720,11 +14745,11 @@ class RevoGridComponent {
14720
14745
  const typeCol = 'rgCol';
14721
14746
  const viewports = this.viewportProvider.stores;
14722
14747
  const dimensions = this.dimensionProvider.stores;
14723
- return (hAsync(Host, { key: '5eff6aab67d669ea43e09e3e78b32523ecbfdbe0', [`${UUID}`]: this.uuid }, this.hideAttribution ? null : (hAsync("revogr-attribution", { class: "attribution" })), hAsync("div", { key: '9db44dc1504b6d03273a609f1f68e48e4dc61937', class: "main-viewport", onClick: (e) => {
14748
+ return (hAsync(Host, { key: '6c36df93ae796fbfeee95cb5ab789a1f9b0c42f1', [`${UUID}`]: this.uuid }, this.hideAttribution ? null : (hAsync("revogr-attribution", { class: "attribution" })), hAsync("div", { key: 'e5cd68158497d79d98ce4f92f1e816b60acbf6ac', class: "main-viewport", onClick: (e) => {
14724
14749
  if (e.currentTarget === e.target) {
14725
14750
  this.viewport.clearEdit();
14726
14751
  }
14727
- } }, hAsync("div", { key: 'f07fe5ec8fc46cd071429d66923267f9459888bf', class: "viewports" }, hAsync("slot", { key: 'd030f89592e4e426194e7f2a8ebc0f3c49108bfb', name: "viewport" }), viewportSections, hAsync("revogr-scroll-virtual", { key: '364951111ea2eaeccc816b4b119fe270e77b83bf', class: "vertical", dimension: typeRow, viewportStore: viewports[typeRow].store, dimensionStore: dimensions[typeRow].store, ref: el => this.scrollingService.registerElement(el, 'rowScroll'), onScrollvirtual: e => this.scrollingService.proxyScroll(e.detail) }), hAsync(OrderRenderer, { key: '7ace1eff1dc24d7250cbf1fab943a864586dd9db', ref: e => (this.orderService = e) }))), hAsync("revogr-scroll-virtual", { key: '9fd93540972906cb6b77b5fd31ddf1805e54da4b', class: "horizontal", dimension: typeCol, viewportStore: viewports[typeCol].store, dimensionStore: dimensions[typeCol].store, ref: el => this.scrollingService.registerElement(el, 'colScroll'), onScrollvirtual: e => this.scrollingService.proxyScroll(e.detail) }), this.extraElements));
14752
+ } }, hAsync("div", { key: '9f121f8e4184f38ad0f086eeabb287434dbae101', class: "viewports" }, hAsync("slot", { key: 'e234abc3d5a6b1ddbe1fb1da4e415e754444057d', name: "viewport" }), viewportSections, hAsync("revogr-scroll-virtual", { key: 'c7b915c6117a822cea1fadce5111cd665f5a43d9', class: "vertical", dimension: typeRow, viewportStore: viewports[typeRow].store, dimensionStore: dimensions[typeRow].store, ref: el => this.scrollingService.registerElement(el, 'rowScroll'), onScrollvirtual: e => this.scrollingService.proxyScroll(e.detail) }), hAsync(OrderRenderer, { key: '5e6c259216474164247f2120eb9a16786ce03e6f', ref: e => (this.orderService = e) }))), hAsync("revogr-scroll-virtual", { key: 'ce8e46b6e7913e798b8d1bd094a4c61a54b73a0a', class: "horizontal", dimension: typeCol, viewportStore: viewports[typeCol].store, dimensionStore: dimensions[typeCol].store, ref: el => this.scrollingService.registerElement(el, 'colScroll'), onScrollvirtual: e => this.scrollingService.proxyScroll(e.detail) }), this.extraElements));
14728
14753
  }
14729
14754
  get element() { return getElement(this); }
14730
14755
  static get watchers() { return {
@@ -15685,8 +15710,8 @@ class RevogrHeaderComponent {
15685
15710
  visibleProps[colData === null || colData === void 0 ? void 0 : colData.prop] = rgCol.itemIndex;
15686
15711
  }
15687
15712
  return [
15688
- hAsync("div", { key: '346967e82d0d9d9f7f0310f7e5827a34c0ac4e5e', class: "group-rgRow" }, hAsync(ColumnGroupsRenderer, { key: '82a8d6ad81f6432d26a680680a8b077fea6ba3cc', canResize: this.canResize, active: this.resizeHandler, visibleProps: visibleProps, providers: this.providers, groups: this.groups, dimensionCol: this.dimensionCol.state, depth: this.groupingDepth, onResize: (changedX, startIndex, endIndex) => this.onResizeGroup(changedX, startIndex, endIndex), additionalData: this.additionalData })),
15689
- hAsync("div", { key: '513119463e5e51caaa79a738f856bc3c1540564f', class: `${HEADER_ROW_CLASS} ${HEADER_ACTUAL_ROW_CLASS}` }, cells),
15713
+ hAsync("div", { key: '56559a8f28d2fc0b16aebd1e486ada1e85a09799', class: "group-rgRow" }, hAsync(ColumnGroupsRenderer, { key: 'dda50768589d80ee7246d6cbcd7284356a00e673', canResize: this.canResize, active: this.resizeHandler, visibleProps: visibleProps, providers: this.providers, groups: this.groups, dimensionCol: this.dimensionCol.state, depth: this.groupingDepth, onResize: (changedX, startIndex, endIndex) => this.onResizeGroup(changedX, startIndex, endIndex), additionalData: this.additionalData })),
15714
+ hAsync("div", { key: 'bf99026e1bb13d1394ddbdca8185761e6642477b', class: `${HEADER_ROW_CLASS} ${HEADER_ACTUAL_ROW_CLASS}` }, cells),
15690
15715
  ];
15691
15716
  }
15692
15717
  get providers() {
@@ -16113,7 +16138,7 @@ class RevogrScrollVirtual {
16113
16138
  }
16114
16139
  render() {
16115
16140
  const sizeType = this.dimension === 'rgRow' ? 'height' : 'width';
16116
- return (hAsync(Host, { key: '9d672a8992b1c13814270537389142ef53d322f9', onScroll: (e) => this.onScroll(e) }, hAsync("div", { key: '250886ee28842f087d815d66cbb046b38c466ebf', style: {
16141
+ return (hAsync(Host, { key: '1bf8d494d6d65ffd27f0a663f5c62c9b60cd35e1', onScroll: (e) => this.onScroll(e) }, hAsync("div", { key: '3f554ca3e7822c9bb20fe830fc4122a0d52919ee', style: {
16117
16142
  [sizeType]: `${getContentSize(this.dimensionStore.get('realSize'), this.size, this.viewportStore.get('virtualSize'))}px`,
16118
16143
  } })));
16119
16144
  }
@@ -16750,7 +16775,7 @@ var gatherActiveObservationsAtDepth = function (depth) {
16750
16775
  });
16751
16776
  };
16752
16777
 
16753
- var process$1 = function () {
16778
+ var process = function () {
16754
16779
  var depth = 0;
16755
16780
  gatherActiveObservationsAtDepth(depth);
16756
16781
  while (hasActiveObservations()) {
@@ -16826,7 +16851,7 @@ var Scheduler = (function () {
16826
16851
  queueResizeObserver(function () {
16827
16852
  var elementsHaveResized = false;
16828
16853
  try {
16829
- elementsHaveResized = process$1();
16854
+ elementsHaveResized = process();
16830
16855
  }
16831
16856
  finally {
16832
16857
  scheduled = false;
@@ -17020,7 +17045,7 @@ exports.hydrateApp = hydrateApp;
17020
17045
  }
17021
17046
 
17022
17047
  /*
17023
- Stencil Hydrate Runner v4.18.3 | MIT Licensed | https://stenciljs.com
17048
+ Stencil Hydrate Runner v4.19.1 | MIT Licensed | https://stenciljs.com
17024
17049
  */
17025
17050
  var __defProp = Object.defineProperty;
17026
17051
  var __export = (target, all) => {
@@ -27418,67 +27443,50 @@ function humanReadableList(items) {
27418
27443
  }
27419
27444
 
27420
27445
  // src/mock-doc/serialize-node.ts
27421
- function serializeNodeToHtml(elm, opts = {}) {
27446
+ function normalizeSerializationOptions(opts = {}) {
27447
+ return {
27448
+ ...opts,
27449
+ outerHtml: typeof opts.outerHtml !== "boolean" ? false : opts.outerHtml,
27450
+ ...opts.prettyHtml ? {
27451
+ indentSpaces: typeof opts.indentSpaces !== "number" ? 2 : opts.indentSpaces,
27452
+ newLines: typeof opts.newLines !== "boolean" ? true : opts.newLines
27453
+ } : {
27454
+ prettyHtml: false,
27455
+ indentSpaces: typeof opts.indentSpaces !== "number" ? 0 : opts.indentSpaces,
27456
+ newLines: typeof opts.newLines !== "boolean" ? false : opts.newLines
27457
+ },
27458
+ approximateLineWidth: typeof opts.approximateLineWidth !== "number" ? -1 : opts.approximateLineWidth,
27459
+ removeEmptyAttributes: typeof opts.removeEmptyAttributes !== "boolean" ? true : opts.removeEmptyAttributes,
27460
+ removeAttributeQuotes: typeof opts.removeAttributeQuotes !== "boolean" ? false : opts.removeAttributeQuotes,
27461
+ removeBooleanAttributeQuotes: typeof opts.removeBooleanAttributeQuotes !== "boolean" ? false : opts.removeBooleanAttributeQuotes,
27462
+ removeHtmlComments: typeof opts.removeHtmlComments !== "boolean" ? false : opts.removeHtmlComments,
27463
+ serializeShadowRoot: typeof opts.serializeShadowRoot !== "boolean" ? false : opts.serializeShadowRoot,
27464
+ fullDocument: typeof opts.fullDocument !== "boolean" ? true : opts.fullDocument
27465
+ };
27466
+ }
27467
+ function serializeNodeToHtml(elm, serializationOptions = {}) {
27468
+ const opts = normalizeSerializationOptions(serializationOptions);
27422
27469
  const output = {
27423
27470
  currentLineWidth: 0,
27424
27471
  indent: 0,
27425
27472
  isWithinBody: false,
27426
27473
  text: []
27427
27474
  };
27428
- if (opts.prettyHtml) {
27429
- if (typeof opts.indentSpaces !== "number") {
27430
- opts.indentSpaces = 2;
27431
- }
27432
- if (typeof opts.newLines !== "boolean") {
27433
- opts.newLines = true;
27434
- }
27435
- opts.approximateLineWidth = -1;
27436
- } else {
27437
- opts.prettyHtml = false;
27438
- if (typeof opts.newLines !== "boolean") {
27439
- opts.newLines = false;
27440
- }
27441
- if (typeof opts.indentSpaces !== "number") {
27442
- opts.indentSpaces = 0;
27443
- }
27444
- }
27445
- if (typeof opts.approximateLineWidth !== "number") {
27446
- opts.approximateLineWidth = -1;
27447
- }
27448
- if (typeof opts.removeEmptyAttributes !== "boolean") {
27449
- opts.removeEmptyAttributes = true;
27450
- }
27451
- if (typeof opts.removeAttributeQuotes !== "boolean") {
27452
- opts.removeAttributeQuotes = false;
27453
- }
27454
- if (typeof opts.removeBooleanAttributeQuotes !== "boolean") {
27455
- opts.removeBooleanAttributeQuotes = false;
27456
- }
27457
- if (typeof opts.removeHtmlComments !== "boolean") {
27458
- opts.removeHtmlComments = false;
27459
- }
27460
- if (typeof opts.serializeShadowRoot !== "boolean") {
27461
- opts.serializeShadowRoot = false;
27462
- }
27463
- if (opts.outerHtml) {
27464
- serializeToHtml(elm, opts, output, false);
27465
- } else {
27466
- for (let i = 0, ii = elm.childNodes.length; i < ii; i++) {
27467
- serializeToHtml(elm.childNodes[i], opts, output, false);
27468
- }
27469
- }
27470
- if (output.text[0] === "\n") {
27471
- output.text.shift();
27472
- }
27473
- if (output.text[output.text.length - 1] === "\n") {
27474
- output.text.pop();
27475
+ let renderedNode = "";
27476
+ const children = !opts.fullDocument && elm.body ? Array.from(elm.body.childNodes) : opts.outerHtml ? [elm] : Array.from(elm.childNodes);
27477
+ for (let i = 0, ii = children.length; i < ii; i++) {
27478
+ const child = children[i];
27479
+ const chunks = Array.from(streamToHtml(child, opts, output));
27480
+ renderedNode += chunks.join("");
27475
27481
  }
27476
- return output.text.join("");
27482
+ return renderedNode.trim();
27477
27483
  }
27478
- function serializeToHtml(node, opts, output, isShadowRoot) {
27484
+ var shadowRootTag = "mock:shadow-root";
27485
+ function* streamToHtml(node, opts, output) {
27479
27486
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
27487
+ const isShadowRoot = node.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */;
27480
27488
  if (node.nodeType === 1 /* ELEMENT_NODE */ || isShadowRoot) {
27481
- const tagName = isShadowRoot ? "mock:shadow-root" : getTagName(node);
27489
+ const tagName = isShadowRoot ? shadowRootTag : getTagName(node);
27482
27490
  if (tagName === "body") {
27483
27491
  output.isWithinBody = true;
27484
27492
  }
@@ -27486,17 +27494,23 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
27486
27494
  if (ignoreTag === false) {
27487
27495
  const isWithinWhitespaceSensitiveNode = opts.newLines || ((_a2 = opts.indentSpaces) != null ? _a2 : 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
27488
27496
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
27489
- output.text.push("\n");
27497
+ yield "\n";
27490
27498
  output.currentLineWidth = 0;
27491
27499
  }
27492
27500
  if (((_b = opts.indentSpaces) != null ? _b : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
27493
27501
  for (let i = 0; i < output.indent; i++) {
27494
- output.text.push(" ");
27502
+ yield " ";
27495
27503
  }
27496
27504
  output.currentLineWidth += output.indent;
27497
27505
  }
27498
- output.text.push("<" + tagName);
27499
- output.currentLineWidth += tagName.length + 1;
27506
+ const tag = tagName === shadowRootTag ? "template" : tagName;
27507
+ yield "<" + tag;
27508
+ output.currentLineWidth += tag.length + 1;
27509
+ if (tag === "template") {
27510
+ const mode = ` shadowrootmode="open"`;
27511
+ yield mode;
27512
+ output.currentLineWidth += mode.length;
27513
+ }
27500
27514
  const attrsLength = node.attributes.length;
27501
27515
  const attributes = opts.prettyHtml && attrsLength > 1 ? cloneAttributes(node.attributes, true) : node.attributes;
27502
27516
  for (let i = 0; i < attrsLength; i++) {
@@ -27513,27 +27527,27 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
27513
27527
  if (attrNamespaceURI == null) {
27514
27528
  output.currentLineWidth += attrName.length + 1;
27515
27529
  if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
27516
- output.text.push("\n" + attrName);
27530
+ yield "\n" + attrName;
27517
27531
  output.currentLineWidth = 0;
27518
27532
  } else {
27519
- output.text.push(" " + attrName);
27533
+ yield " " + attrName;
27520
27534
  }
27521
27535
  } else if (attrNamespaceURI === "http://www.w3.org/XML/1998/namespace") {
27522
- output.text.push(" xml:" + attrName);
27536
+ yield " xml:" + attrName;
27523
27537
  output.currentLineWidth += attrName.length + 5;
27524
27538
  } else if (attrNamespaceURI === "http://www.w3.org/2000/xmlns/") {
27525
27539
  if (attrName !== "xmlns") {
27526
- output.text.push(" xmlns:" + attrName);
27540
+ yield " xmlns:" + attrName;
27527
27541
  output.currentLineWidth += attrName.length + 7;
27528
27542
  } else {
27529
- output.text.push(" " + attrName);
27543
+ yield " " + attrName;
27530
27544
  output.currentLineWidth += attrName.length + 1;
27531
27545
  }
27532
27546
  } else if (attrNamespaceURI === XLINK_NS) {
27533
- output.text.push(" xlink:" + attrName);
27547
+ yield " xlink:" + attrName;
27534
27548
  output.currentLineWidth += attrName.length + 7;
27535
27549
  } else {
27536
- output.text.push(" " + attrNamespaceURI + ":" + attrName);
27550
+ yield " " + attrNamespaceURI + ":" + attrName;
27537
27551
  output.currentLineWidth += attrNamespaceURI.length + attrName.length + 2;
27538
27552
  }
27539
27553
  if (opts.prettyHtml && attrName === "class") {
@@ -27548,43 +27562,45 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
27548
27562
  }
27549
27563
  }
27550
27564
  if (opts.removeAttributeQuotes && CAN_REMOVE_ATTR_QUOTES.test(attrValue)) {
27551
- output.text.push("=" + escapeString(attrValue, true));
27565
+ yield "=" + escapeString(attrValue, true);
27552
27566
  output.currentLineWidth += attrValue.length + 1;
27553
27567
  } else {
27554
- output.text.push('="' + escapeString(attrValue, true) + '"');
27568
+ yield '="' + escapeString(attrValue, true) + '"';
27555
27569
  output.currentLineWidth += attrValue.length + 3;
27556
27570
  }
27557
27571
  }
27558
27572
  if (node.hasAttribute("style")) {
27559
27573
  const cssText = node.style.cssText;
27560
27574
  if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth + cssText.length + 10 > opts.approximateLineWidth) {
27561
- output.text.push(`
27562
- style="${cssText}">`);
27575
+ yield `
27576
+ style="${cssText}">`;
27563
27577
  output.currentLineWidth = 0;
27564
27578
  } else {
27565
- output.text.push(` style="${cssText}">`);
27579
+ yield ` style="${cssText}">`;
27566
27580
  output.currentLineWidth += cssText.length + 10;
27567
27581
  }
27568
27582
  } else {
27569
- output.text.push(">");
27583
+ yield ">";
27570
27584
  output.currentLineWidth += 1;
27571
27585
  }
27572
27586
  }
27573
27587
  if (EMPTY_ELEMENTS.has(tagName) === false) {
27574
- if (opts.serializeShadowRoot && node.shadowRoot != null) {
27588
+ const shadowRoot = node.shadowRoot;
27589
+ if (opts.serializeShadowRoot && shadowRoot != null) {
27575
27590
  output.indent = output.indent + ((_c = opts.indentSpaces) != null ? _c : 0);
27576
- serializeToHtml(node.shadowRoot, opts, output, true);
27591
+ yield* streamToHtml(shadowRoot, opts, output);
27577
27592
  output.indent = output.indent - ((_d = opts.indentSpaces) != null ? _d : 0);
27578
27593
  if (opts.newLines && (node.childNodes.length === 0 || node.childNodes.length === 1 && node.childNodes[0].nodeType === 3 /* TEXT_NODE */ && ((_e = node.childNodes[0].nodeValue) == null ? void 0 : _e.trim()) === "")) {
27579
- output.text.push("\n");
27594
+ yield "\n";
27580
27595
  output.currentLineWidth = 0;
27581
27596
  for (let i = 0; i < output.indent; i++) {
27582
- output.text.push(" ");
27597
+ yield " ";
27583
27598
  }
27584
27599
  output.currentLineWidth += output.indent;
27585
27600
  }
27586
27601
  }
27587
27602
  if (opts.excludeTagContent == null || opts.excludeTagContent.includes(tagName) === false) {
27603
+ const tag = tagName === shadowRootTag ? "template" : tagName;
27588
27604
  const childNodes = tagName === "template" ? node.content.childNodes : node.childNodes;
27589
27605
  const childNodeLength = childNodes.length;
27590
27606
  if (childNodeLength > 0) {
@@ -27595,17 +27611,17 @@ style="${cssText}">`);
27595
27611
  output.indent = output.indent + ((_h = opts.indentSpaces) != null ? _h : 0);
27596
27612
  }
27597
27613
  for (let i = 0; i < childNodeLength; i++) {
27598
- serializeToHtml(childNodes[i], opts, output, false);
27614
+ yield* streamToHtml(childNodes[i], opts, output);
27599
27615
  }
27600
27616
  if (ignoreTag === false) {
27601
27617
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
27602
- output.text.push("\n");
27618
+ yield "\n";
27603
27619
  output.currentLineWidth = 0;
27604
27620
  }
27605
27621
  if (((_i = opts.indentSpaces) != null ? _i : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
27606
27622
  output.indent = output.indent - ((_j = opts.indentSpaces) != null ? _j : 0);
27607
27623
  for (let i = 0; i < output.indent; i++) {
27608
- output.text.push(" ");
27624
+ yield " ";
27609
27625
  }
27610
27626
  output.currentLineWidth += output.indent;
27611
27627
  }
@@ -27613,13 +27629,13 @@ style="${cssText}">`);
27613
27629
  }
27614
27630
  }
27615
27631
  if (ignoreTag === false) {
27616
- output.text.push("</" + tagName + ">");
27617
- output.currentLineWidth += tagName.length + 3;
27632
+ yield "</" + tag + ">";
27633
+ output.currentLineWidth += tag.length + 3;
27618
27634
  }
27619
27635
  }
27620
27636
  }
27621
27637
  if (((_k = opts.approximateLineWidth) != null ? _k : 0) > 0 && STRUCTURE_ELEMENTS.has(tagName)) {
27622
- output.text.push("\n");
27638
+ yield "\n";
27623
27639
  output.currentLineWidth = 0;
27624
27640
  }
27625
27641
  if (tagName === "body") {
@@ -27631,27 +27647,27 @@ style="${cssText}">`);
27631
27647
  const trimmedTextContent = textContent.trim();
27632
27648
  if (trimmedTextContent === "") {
27633
27649
  if (isWithinWhitespaceSensitive(node)) {
27634
- output.text.push(textContent);
27650
+ yield textContent;
27635
27651
  output.currentLineWidth += textContent.length;
27636
27652
  } else if (((_l = opts.approximateLineWidth) != null ? _l : 0) > 0 && !output.isWithinBody) {
27637
27653
  } else if (!opts.prettyHtml) {
27638
27654
  output.currentLineWidth += 1;
27639
27655
  if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
27640
- output.text.push("\n");
27656
+ yield "\n";
27641
27657
  output.currentLineWidth = 0;
27642
27658
  } else {
27643
- output.text.push(" ");
27659
+ yield " ";
27644
27660
  }
27645
27661
  }
27646
27662
  } else {
27647
27663
  const isWithinWhitespaceSensitiveNode = opts.newLines || ((_m = opts.indentSpaces) != null ? _m : 0) > 0 || opts.prettyHtml ? isWithinWhitespaceSensitive(node) : false;
27648
27664
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
27649
- output.text.push("\n");
27665
+ yield "\n";
27650
27666
  output.currentLineWidth = 0;
27651
27667
  }
27652
27668
  if (((_n = opts.indentSpaces) != null ? _n : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
27653
27669
  for (let i = 0; i < output.indent; i++) {
27654
- output.text.push(" ");
27670
+ yield " ";
27655
27671
  }
27656
27672
  output.currentLineWidth += output.indent;
27657
27673
  }
@@ -27660,15 +27676,15 @@ style="${cssText}">`);
27660
27676
  const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 /* ELEMENT_NODE */ ? node.parentNode.nodeName : null;
27661
27677
  if (typeof parentTagName === "string" && NON_ESCAPABLE_CONTENT.has(parentTagName)) {
27662
27678
  if (isWithinWhitespaceSensitive(node)) {
27663
- output.text.push(textContent);
27679
+ yield textContent;
27664
27680
  } else {
27665
- output.text.push(trimmedTextContent);
27681
+ yield trimmedTextContent;
27666
27682
  textContentLength = trimmedTextContent.length;
27667
27683
  }
27668
27684
  output.currentLineWidth += textContentLength;
27669
27685
  } else {
27670
27686
  if (opts.prettyHtml && !isWithinWhitespaceSensitiveNode) {
27671
- output.text.push(escapeString(textContent.replace(/\s\s+/g, " ").trim(), false));
27687
+ yield escapeString(textContent.replace(/\s\s+/g, " ").trim(), false);
27672
27688
  output.currentLineWidth += textContentLength;
27673
27689
  } else {
27674
27690
  if (isWithinWhitespaceSensitive(node)) {
@@ -27690,7 +27706,7 @@ style="${cssText}">`);
27690
27706
  }
27691
27707
  output.currentLineWidth += textContentLength;
27692
27708
  }
27693
- output.text.push(escapeString(textContent, false));
27709
+ yield escapeString(textContent, false);
27694
27710
  }
27695
27711
  }
27696
27712
  }
@@ -27698,27 +27714,27 @@ style="${cssText}">`);
27698
27714
  }
27699
27715
  } else if (node.nodeType === 8 /* COMMENT_NODE */) {
27700
27716
  const nodeValue = node.nodeValue;
27701
- if (opts.removeHtmlComments) {
27702
- const isHydrateAnnotation = (nodeValue == null ? void 0 : nodeValue.startsWith(CONTENT_REF_ID + ".")) || (nodeValue == null ? void 0 : nodeValue.startsWith(ORG_LOCATION_ID + ".")) || (nodeValue == null ? void 0 : nodeValue.startsWith(SLOT_NODE_ID + ".")) || (nodeValue == null ? void 0 : nodeValue.startsWith(TEXT_NODE_ID + "."));
27703
- if (!isHydrateAnnotation) {
27704
- return;
27705
- }
27717
+ const isHydrateAnnotation = (nodeValue == null ? void 0 : nodeValue.startsWith(CONTENT_REF_ID + ".")) || (nodeValue == null ? void 0 : nodeValue.startsWith(ORG_LOCATION_ID + ".")) || (nodeValue == null ? void 0 : nodeValue.startsWith(SLOT_NODE_ID + ".")) || (nodeValue == null ? void 0 : nodeValue.startsWith(TEXT_NODE_ID + "."));
27718
+ if (opts.removeHtmlComments && !isHydrateAnnotation) {
27719
+ return;
27706
27720
  }
27707
27721
  const isWithinWhitespaceSensitiveNode = opts.newLines || ((_o = opts.indentSpaces) != null ? _o : 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
27708
27722
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
27709
- output.text.push("\n");
27723
+ yield "\n";
27710
27724
  output.currentLineWidth = 0;
27711
27725
  }
27712
27726
  if (((_p = opts.indentSpaces) != null ? _p : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
27713
27727
  for (let i = 0; i < output.indent; i++) {
27714
- output.text.push(" ");
27728
+ yield " ";
27715
27729
  }
27716
27730
  output.currentLineWidth += output.indent;
27717
27731
  }
27718
- output.text.push("<!--" + nodeValue + "-->");
27719
- output.currentLineWidth += nodeValue.length + 7;
27732
+ yield "<!--" + nodeValue + "-->";
27733
+ if (nodeValue) {
27734
+ output.currentLineWidth += nodeValue.length + 7;
27735
+ }
27720
27736
  } else if (node.nodeType === 10 /* DOCUMENT_TYPE_NODE */) {
27721
- output.text.push("<!doctype html>");
27737
+ yield "<!doctype html>";
27722
27738
  }
27723
27739
  }
27724
27740
  var AMP_REGEX = /&/g;
@@ -27743,7 +27759,7 @@ function escapeString(str, attrMode) {
27743
27759
  }
27744
27760
  function isWithinWhitespaceSensitive(node) {
27745
27761
  let _node = node;
27746
- while (_node != null) {
27762
+ while (_node == null ? void 0 : _node.nodeName) {
27747
27763
  if (WHITESPACE_SENSITIVE.has(_node.nodeName)) {
27748
27764
  return true;
27749
27765
  }
@@ -28059,6 +28075,10 @@ Testing components with ElementInternals is fully supported in e2e tests.`
28059
28075
  get shadowRoot() {
28060
28076
  return this.__shadowRoot || null;
28061
28077
  }
28078
+ /**
28079
+ * Set shadow root for element
28080
+ * @param shadowRoot - ShadowRoot to set
28081
+ */
28062
28082
  set shadowRoot(shadowRoot) {
28063
28083
  if (shadowRoot != null) {
28064
28084
  shadowRoot.host = this;
@@ -29845,14 +29865,16 @@ var WINDOW_PROPS = [
29845
29865
  ];
29846
29866
  var GLOBAL_CONSTRUCTORS = [
29847
29867
  ["CustomEvent", MockCustomEvent],
29868
+ ["DocumentFragment", MockDocumentFragment],
29869
+ ["DOMParser", MockDOMParser],
29848
29870
  ["Event", MockEvent],
29849
- ["Headers", MockHeaders],
29850
29871
  ["FocusEvent", MockFocusEvent],
29872
+ ["Headers", MockHeaders],
29851
29873
  ["KeyboardEvent", MockKeyboardEvent],
29852
29874
  ["MouseEvent", MockMouseEvent],
29853
29875
  ["Request", MockRequest],
29854
29876
  ["Response", MockResponse],
29855
- ["DOMParser", MockDOMParser],
29877
+ ["ShadowRoot", MockDocumentFragment],
29856
29878
  ["HTMLAnchorElement", MockAnchorElement],
29857
29879
  ["HTMLBaseElement", MockBaseElement],
29858
29880
  ["HTMLButtonElement", MockButtonElement],
@@ -30063,6 +30085,7 @@ var nativeClearTimeout = clearTimeout;
30063
30085
  var nativeSetInterval = setInterval;
30064
30086
  var nativeSetTimeout = setTimeout;
30065
30087
  var nativeURL = URL;
30088
+ var nativeWindow = globalThis.window;
30066
30089
  var MockWindow = class {
30067
30090
  constructor(html = null) {
30068
30091
  if (html !== false) {
@@ -30089,10 +30112,10 @@ var MockWindow = class {
30089
30112
  blur() {
30090
30113
  }
30091
30114
  cancelAnimationFrame(id) {
30092
- this.__clearTimeout(id);
30115
+ this.__clearTimeout.call(nativeWindow || this, id);
30093
30116
  }
30094
30117
  cancelIdleCallback(id) {
30095
- this.__clearTimeout(id);
30118
+ this.__clearTimeout.call(nativeWindow || this, id);
30096
30119
  }
30097
30120
  get CharacterData() {
30098
30121
  if (this.__charDataCstr == null) {
@@ -30110,10 +30133,10 @@ var MockWindow = class {
30110
30133
  this.__charDataCstr = charDataCstr;
30111
30134
  }
30112
30135
  clearInterval(id) {
30113
- this.__clearInterval(id);
30136
+ this.__clearInterval.call(nativeWindow || this, id);
30114
30137
  }
30115
30138
  clearTimeout(id) {
30116
- this.__clearTimeout(id);
30139
+ this.__clearTimeout.call(nativeWindow || this, id);
30117
30140
  }
30118
30141
  close() {
30119
30142
  resetWindow(this);
@@ -30413,20 +30436,24 @@ var MockWindow = class {
30413
30436
  }
30414
30437
  return intervalId;
30415
30438
  }
30416
- const timeoutId = this.__setTimeout(() => {
30417
- if (this.__timeouts) {
30418
- this.__timeouts.delete(timeoutId);
30419
- try {
30420
- callback(...args);
30421
- } catch (e) {
30422
- if (this.console) {
30423
- this.console.error(e);
30424
- } else {
30425
- console.error(e);
30439
+ const timeoutId = this.__setTimeout.call(
30440
+ nativeWindow || this,
30441
+ () => {
30442
+ if (this.__timeouts) {
30443
+ this.__timeouts.delete(timeoutId);
30444
+ try {
30445
+ callback(...args);
30446
+ } catch (e) {
30447
+ if (this.console) {
30448
+ this.console.error(e);
30449
+ } else {
30450
+ console.error(e);
30451
+ }
30426
30452
  }
30427
30453
  }
30428
- }
30429
- }, ms);
30454
+ },
30455
+ ms
30456
+ );
30430
30457
  if (this.__timeouts) {
30431
30458
  this.__timeouts.add(timeoutId);
30432
30459
  }
@@ -30437,20 +30464,24 @@ var MockWindow = class {
30437
30464
  this.__timeouts = /* @__PURE__ */ new Set();
30438
30465
  }
30439
30466
  ms = Math.min(ms, this.__maxTimeout);
30440
- const timeoutId = this.__setTimeout(() => {
30441
- if (this.__timeouts) {
30442
- this.__timeouts.delete(timeoutId);
30443
- try {
30444
- callback(...args);
30445
- } catch (e) {
30446
- if (this.console) {
30447
- this.console.error(e);
30448
- } else {
30449
- console.error(e);
30467
+ const timeoutId = this.__setTimeout.call(
30468
+ nativeWindow || this,
30469
+ () => {
30470
+ if (this.__timeouts) {
30471
+ this.__timeouts.delete(timeoutId);
30472
+ try {
30473
+ callback(...args);
30474
+ } catch (e) {
30475
+ if (this.console) {
30476
+ this.console.error(e);
30477
+ } else {
30478
+ console.error(e);
30479
+ }
30450
30480
  }
30451
30481
  }
30452
- }
30453
- }, ms);
30482
+ },
30483
+ ms
30484
+ );
30454
30485
  if (this.__timeouts) {
30455
30486
  this.__timeouts.add(timeoutId);
30456
30487
  }
@@ -31025,7 +31056,6 @@ function createWindowFromHtml(templateHtml, uniqueId) {
31025
31056
 
31026
31057
  // src/utils/helpers.ts
31027
31058
  var isString = (v) => typeof v === "string";
31028
- var isPromise = (v) => !!v && (typeof v === "object" || typeof v === "function") && typeof v.then === "function";
31029
31059
 
31030
31060
  // src/utils/message-utils.ts
31031
31061
  var catchError = (diagnostics, err2, msg) => {
@@ -31116,6 +31146,7 @@ var unwrapErr = (result) => {
31116
31146
 
31117
31147
  // src/compiler/html/canonical-link.ts
31118
31148
  var updateCanonicalLink = (doc, href) => {
31149
+ var _a2;
31119
31150
  let canonicalLinkElm = doc.head.querySelector('link[rel="canonical"]');
31120
31151
  if (typeof href === "string") {
31121
31152
  if (canonicalLinkElm == null) {
@@ -31128,7 +31159,7 @@ var updateCanonicalLink = (doc, href) => {
31128
31159
  if (canonicalLinkElm != null) {
31129
31160
  const existingHref = canonicalLinkElm.getAttribute("href");
31130
31161
  if (!existingHref) {
31131
- canonicalLinkElm.parentNode.removeChild(canonicalLinkElm);
31162
+ (_a2 = canonicalLinkElm.parentNode) == null ? void 0 : _a2.removeChild(canonicalLinkElm);
31132
31163
  }
31133
31164
  }
31134
31165
  }
@@ -32162,10 +32193,10 @@ function renderBuildDiagnostic(results, level, header, msg) {
32162
32193
  return diagnostic;
32163
32194
  }
32164
32195
  function renderBuildError(results, msg) {
32165
- return renderBuildDiagnostic(results, "error", "Hydrate Error", msg);
32196
+ return renderBuildDiagnostic(results, "error", "Hydrate Error", msg || "");
32166
32197
  }
32167
32198
  function renderCatchError(results, err2) {
32168
- const diagnostic = renderBuildError(results, null);
32199
+ const diagnostic = renderBuildError(results);
32169
32200
  if (err2 != null) {
32170
32201
  if (err2.stack != null) {
32171
32202
  diagnostic.messageText = err2.stack.toString();
@@ -32227,10 +32258,11 @@ function runtimeLog(pathname, type, msgs) {
32227
32258
 
32228
32259
  // src/hydrate/runner/window-initialize.ts
32229
32260
  function initializeWindow(win, doc, opts, results) {
32230
- try {
32231
- win.location.href = opts.url;
32232
- } catch (e) {
32233
- renderCatchError(results, e);
32261
+ if (typeof opts.url === "string") {
32262
+ try {
32263
+ win.location.href = opts.url;
32264
+ } catch (e) {
32265
+ }
32234
32266
  }
32235
32267
  if (typeof opts.userAgent === "string") {
32236
32268
  try {
@@ -32280,134 +32312,99 @@ function initializeWindow(win, doc, opts, results) {
32280
32312
  }
32281
32313
 
32282
32314
  // src/hydrate/runner/render.ts
32283
- function renderToString(html, options) {
32315
+ var NOOP = () => {
32316
+ };
32317
+ function streamToString(html, option) {
32318
+ return renderToString(html, option, true);
32319
+ }
32320
+ function renderToString(html, options, asStream) {
32284
32321
  const opts = normalizeHydrateOptions(options);
32285
32322
  opts.serializeToHtml = true;
32286
- return new Promise((resolve) => {
32287
- let win;
32288
- const results = generateHydrateResults(opts);
32289
- if (hasError(results.diagnostics)) {
32290
- resolve(results);
32291
- } else if (typeof html === "string") {
32292
- try {
32293
- opts.destroyWindow = true;
32294
- opts.destroyDocument = true;
32295
- win = new MockWindow(html);
32296
- render(win, opts, results, resolve);
32297
- } catch (e) {
32298
- if (win && win.close) {
32299
- win.close();
32300
- }
32301
- win = null;
32302
- renderCatchError(results, e);
32303
- resolve(results);
32323
+ opts.fullDocument = typeof opts.fullDocument === "boolean" ? opts.fullDocument : true;
32324
+ opts.serializeShadowRoot = Boolean(opts.serializeShadowRoot);
32325
+ opts.constrainTimeouts = false;
32326
+ return hydrateDocument(html, opts, asStream);
32327
+ }
32328
+ function hydrateDocument(doc, options, asStream) {
32329
+ const opts = normalizeHydrateOptions(options);
32330
+ let win = null;
32331
+ const results = generateHydrateResults(opts);
32332
+ if (hasError(results.diagnostics)) {
32333
+ return Promise.resolve(results);
32334
+ }
32335
+ if (typeof doc === "string") {
32336
+ try {
32337
+ opts.destroyWindow = true;
32338
+ opts.destroyDocument = true;
32339
+ win = new MockWindow(doc);
32340
+ if (!asStream) {
32341
+ return render(win, opts, results).then(() => results);
32304
32342
  }
32305
- } else if (isValidDocument(html)) {
32306
- try {
32307
- opts.destroyDocument = false;
32308
- win = patchDomImplementation(html, opts);
32309
- render(win, opts, results, resolve);
32310
- } catch (e) {
32311
- if (win && win.close) {
32312
- win.close();
32313
- }
32314
- win = null;
32315
- renderCatchError(results, e);
32316
- resolve(results);
32343
+ return renderStream(win, opts, results);
32344
+ } catch (e) {
32345
+ if (win && win.close) {
32346
+ win.close();
32317
32347
  }
32318
- } else {
32319
- renderBuildError(results, `Invalid html or document. Must be either a valid "html" string, or DOM "document".`);
32320
- resolve(results);
32348
+ win = null;
32349
+ renderCatchError(results, e);
32350
+ return Promise.resolve(results);
32321
32351
  }
32322
- });
32323
- }
32324
- function hydrateDocument(doc, options) {
32325
- const opts = normalizeHydrateOptions(options);
32326
- opts.serializeToHtml = false;
32327
- return new Promise((resolve) => {
32328
- let win;
32329
- const results = generateHydrateResults(opts);
32330
- if (hasError(results.diagnostics)) {
32331
- resolve(results);
32332
- } else if (typeof doc === "string") {
32333
- try {
32334
- opts.destroyWindow = true;
32335
- opts.destroyDocument = true;
32336
- win = new MockWindow(doc);
32337
- render(win, opts, results, resolve);
32338
- } catch (e) {
32339
- if (win && win.close) {
32340
- win.close();
32341
- }
32342
- win = null;
32343
- renderCatchError(results, e);
32344
- resolve(results);
32352
+ }
32353
+ if (isValidDocument(doc)) {
32354
+ try {
32355
+ opts.destroyDocument = false;
32356
+ win = patchDomImplementation(doc, opts);
32357
+ if (!asStream) {
32358
+ return render(win, opts, results).then(() => results);
32345
32359
  }
32346
- } else if (isValidDocument(doc)) {
32347
- try {
32348
- opts.destroyDocument = false;
32349
- win = patchDomImplementation(doc, opts);
32350
- render(win, opts, results, resolve);
32351
- } catch (e) {
32352
- if (win && win.close) {
32353
- win.close();
32354
- }
32355
- win = null;
32356
- renderCatchError(results, e);
32357
- resolve(results);
32360
+ return renderStream(win, opts, results);
32361
+ } catch (e) {
32362
+ if (win && win.close) {
32363
+ win.close();
32358
32364
  }
32359
- } else {
32360
- renderBuildError(results, `Invalid html or document. Must be either a valid "html" string, or DOM "document".`);
32361
- resolve(results);
32365
+ win = null;
32366
+ renderCatchError(results, e);
32367
+ return Promise.resolve(results);
32362
32368
  }
32363
- });
32369
+ }
32370
+ renderBuildError(results, `Invalid html or document. Must be either a valid "html" string, or DOM "document".`);
32371
+ return Promise.resolve(results);
32364
32372
  }
32365
- function render(win, opts, results, resolve) {
32366
- if (!process.__stencilErrors) {
32373
+ async function render(win, opts, results) {
32374
+ if ("process" in globalThis && typeof process.on === "function" && !process.__stencilErrors) {
32367
32375
  process.__stencilErrors = true;
32368
32376
  process.on("unhandledRejection", (e) => {
32369
32377
  console.log("unhandledRejection", e);
32370
32378
  });
32371
32379
  }
32372
32380
  initializeWindow(win, win.document, opts, results);
32373
- if (typeof opts.beforeHydrate === "function") {
32374
- try {
32375
- const rtn = opts.beforeHydrate(win.document);
32376
- if (isPromise(rtn)) {
32377
- rtn.then(() => {
32378
- hydrateFactory(win, opts, results, afterHydrate, resolve);
32379
- });
32380
- } else {
32381
- hydrateFactory(win, opts, results, afterHydrate, resolve);
32382
- }
32383
- } catch (e) {
32384
- renderCatchError(results, e);
32385
- finalizeHydrate(win, win.document, opts, results, resolve);
32386
- }
32387
- } else {
32388
- hydrateFactory(win, opts, results, afterHydrate, resolve);
32381
+ const beforeHydrateFn = typeof opts.beforeHydrate === "function" ? opts.beforeHydrate(win.document) : NOOP;
32382
+ try {
32383
+ await Promise.resolve(beforeHydrateFn(win.document));
32384
+ return new Promise((resolve) => hydrateFactory(win, opts, results, afterHydrate, resolve));
32385
+ } catch (e) {
32386
+ renderCatchError(results, e);
32387
+ return finalizeHydrate(win, win.document, opts, results);
32389
32388
  }
32390
32389
  }
32391
- function afterHydrate(win, opts, results, resolve) {
32392
- if (typeof opts.afterHydrate === "function") {
32393
- try {
32394
- const rtn = opts.afterHydrate(win.document);
32395
- if (isPromise(rtn)) {
32396
- rtn.then(() => {
32397
- finalizeHydrate(win, win.document, opts, results, resolve);
32398
- });
32399
- } else {
32400
- finalizeHydrate(win, win.document, opts, results, resolve);
32401
- }
32402
- } catch (e) {
32403
- renderCatchError(results, e);
32404
- finalizeHydrate(win, win.document, opts, results, resolve);
32405
- }
32406
- } else {
32407
- finalizeHydrate(win, win.document, opts, results, resolve);
32390
+ function renderStream(win, opts, results) {
32391
+ async function* processRender() {
32392
+ const renderResult = await render(win, opts, results);
32393
+ yield renderResult.html;
32394
+ }
32395
+ return stream.Readable.from(processRender());
32396
+ }
32397
+ async function afterHydrate(win, opts, results, resolve) {
32398
+ const afterHydrateFn = typeof opts.afterHydrate === "function" ? opts.afterHydrate(win.document) : NOOP;
32399
+ try {
32400
+ await Promise.resolve(afterHydrateFn(win.document));
32401
+ return resolve(finalizeHydrate(win, win.document, opts, results));
32402
+ } catch (e) {
32403
+ renderCatchError(results, e);
32404
+ return resolve(finalizeHydrate(win, win.document, opts, results));
32408
32405
  }
32409
32406
  }
32410
- function finalizeHydrate(win, doc, opts, results, resolve) {
32407
+ function finalizeHydrate(win, doc, opts, results) {
32411
32408
  try {
32412
32409
  inspectElement(results, doc.documentElement, 0);
32413
32410
  if (opts.removeUnusedStyles !== false) {
@@ -32459,20 +32456,24 @@ function finalizeHydrate(win, doc, opts, results, resolve) {
32459
32456
  } catch (e) {
32460
32457
  renderCatchError(results, e);
32461
32458
  }
32462
- if (opts.destroyWindow) {
32463
- try {
32464
- if (!opts.destroyDocument) {
32465
- win.document = null;
32466
- doc.defaultView = null;
32467
- }
32468
- if (win.close) {
32469
- win.close();
32470
- }
32471
- } catch (e) {
32472
- renderCatchError(results, e);
32459
+ destroyWindow(win, doc, opts, results);
32460
+ return results;
32461
+ }
32462
+ function destroyWindow(win, doc, opts, results) {
32463
+ if (!opts.destroyWindow) {
32464
+ return;
32465
+ }
32466
+ try {
32467
+ if (!opts.destroyDocument) {
32468
+ win.document = null;
32469
+ doc.defaultView = null;
32470
+ }
32471
+ if (win.close) {
32472
+ win.close();
32473
32473
  }
32474
+ } catch (e) {
32475
+ renderCatchError(results, e);
32474
32476
  }
32475
- resolve(results);
32476
32477
  }
32477
32478
  function serializeDocumentToString(doc, opts) {
32478
32479
  return serializeNodeToHtml(doc, {
@@ -32483,7 +32484,8 @@ function serializeDocumentToString(doc, opts) {
32483
32484
  removeBooleanAttributeQuotes: opts.removeBooleanAttributeQuotes,
32484
32485
  removeEmptyAttributes: opts.removeEmptyAttributes,
32485
32486
  removeHtmlComments: opts.removeHtmlComments,
32486
- serializeShadowRoot: false
32487
+ serializeShadowRoot: opts.serializeShadowRoot,
32488
+ fullDocument: opts.fullDocument
32487
32489
  });
32488
32490
  }
32489
32491
  function isValidDocument(doc) {
@@ -32504,3 +32506,4 @@ exports.createWindowFromHtml = createWindowFromHtml;
32504
32506
  exports.hydrateDocument = hydrateDocument;
32505
32507
  exports.renderToString = renderToString;
32506
32508
  exports.serializeDocumentToString = serializeDocumentToString;
32509
+ exports.streamToString = streamToString;