@revolist/revogrid 4.0.28 → 4.0.30

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 (198) 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-991dda26.js} +3 -3
  4. package/dist/cjs/base.plugin-991dda26.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 +7 -7
  24. package/dist/cjs/revogr-attribution_6.cjs.entry.js.map +1 -1
  25. package/dist/cjs/revogr-clipboard_3.cjs.entry.js +3 -3
  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/header/revogr-header.js +8 -8
  40. package/dist/collection/components/header/revogr-header.js.map +1 -1
  41. package/dist/collection/components/order/revogr-order-editor.js +6 -6
  42. package/dist/collection/components/order/revogr-order-editor.js.map +1 -1
  43. package/dist/collection/components/overlay/autofill.service.js.map +1 -1
  44. package/dist/collection/components/overlay/keyboard.service.js.map +1 -1
  45. package/dist/collection/components/revoGrid/revo-grid.js +9 -9
  46. package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
  47. package/dist/collection/components/revoGrid/viewport.service.js.map +1 -1
  48. package/dist/collection/components/scrollable/revogr-scroll-virtual.js +5 -5
  49. package/dist/collection/components/scrollable/revogr-scroll-virtual.js.map +1 -1
  50. package/dist/collection/components/selectionFocus/revogr-focus.js +10 -10
  51. package/dist/collection/components/selectionFocus/revogr-focus.js.map +1 -1
  52. package/dist/collection/components/selectionTempRange/revogr-temp-range.js +6 -6
  53. package/dist/collection/components/selectionTempRange/revogr-temp-range.js.map +1 -1
  54. package/dist/collection/components/vnode/vnode-converter.js +2 -2
  55. package/dist/collection/store/dataSource/data.proxy.js.map +1 -1
  56. package/dist/collection/store/dataSource/data.store.js +1 -1
  57. package/dist/collection/store/dataSource/data.store.js.map +1 -1
  58. package/dist/collection/store/dataSource/trimmed.plugin.js.map +1 -1
  59. package/dist/collection/store/dimension/dimension.store.js +1 -1
  60. package/dist/collection/store/dimension/dimension.store.js.map +1 -1
  61. package/dist/collection/store/selection/selection.store.js +1 -1
  62. package/dist/collection/store/selection/selection.store.js.map +1 -1
  63. package/dist/collection/store/vp/viewport.store.js +1 -1
  64. package/dist/collection/store/vp/viewport.store.js.map +1 -1
  65. package/dist/collection/types/interfaces.js.map +1 -1
  66. package/dist/collection/types/viewport.interfaces.js.map +1 -1
  67. package/dist/collection/utils/store.types.js +2 -0
  68. package/dist/collection/utils/store.types.js.map +1 -0
  69. package/dist/collection/utils/store.utils.js +1 -2
  70. package/dist/collection/utils/store.utils.js.map +1 -1
  71. package/dist/esm/{app-globals-ef1fca59.js → app-globals-c0b06b03.js} +2 -2
  72. package/dist/esm/{app-globals-ef1fca59.js.map → app-globals-c0b06b03.js.map} +1 -1
  73. package/dist/esm/{base.plugin-d0e589d8.js → base.plugin-454940e3.js} +3 -3
  74. package/dist/esm/base.plugin-454940e3.js.map +1 -0
  75. package/dist/esm/{column.service-a826bbd6.js → column.service-ffe99cfc.js} +4 -4
  76. package/dist/esm/{column.service-a826bbd6.js.map → column.service-ffe99cfc.js.map} +1 -1
  77. package/dist/esm/{dimension.helpers-a3065cb1.js → dimension.helpers-c0c2888f.js} +193 -193
  78. package/dist/esm/dimension.helpers-c0c2888f.js.map +1 -0
  79. package/dist/esm/{filter.button-46ce4f80.js → filter.button-f132c10a.js} +2 -2
  80. package/dist/esm/{filter.button-46ce4f80.js.map → filter.button-f132c10a.js.map} +1 -1
  81. package/dist/esm/{header-cell-renderer-19738045.js → header-cell-renderer-cac333a3.js} +3 -3
  82. package/dist/esm/{header-cell-renderer-19738045.js.map → header-cell-renderer-cac333a3.js.map} +1 -1
  83. package/dist/esm/{index-21436631.js → index-e661aeb5.js} +193 -185
  84. package/dist/esm/index-e661aeb5.js.map +1 -0
  85. package/dist/esm/index.js +5 -5
  86. package/dist/esm/{key.utils-7c5d91dd.js → key.utils-9120fde7.js} +2 -2
  87. package/dist/esm/{key.utils-7c5d91dd.js.map → key.utils-9120fde7.js.map} +1 -1
  88. package/dist/esm/loader.js +3 -3
  89. package/dist/esm/revo-grid.entry.js +11 -11
  90. package/dist/esm/revo-grid.entry.js.map +1 -1
  91. package/dist/esm/revo-grid.js +4 -4
  92. package/dist/esm/revo-grid.js.map +1 -1
  93. package/dist/esm/revogr-attribution_6.entry.js +7 -7
  94. package/dist/esm/revogr-attribution_6.entry.js.map +1 -1
  95. package/dist/esm/revogr-clipboard_3.entry.js +3 -3
  96. package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
  97. package/dist/esm/revogr-data_4.entry.js +8 -8
  98. package/dist/esm/revogr-data_4.entry.js.map +1 -1
  99. package/dist/esm/revogr-filter-panel.entry.js +2 -2
  100. package/dist/esm/{selection.helpers-883ce6bc.js → selection.helpers-0f3ed629.js} +3 -3
  101. package/dist/esm/selection.helpers-0f3ed629.js.map +1 -0
  102. package/dist/esm/{viewport.store-d9e291c5.js → viewport.store-2dc172be.js} +2 -2
  103. package/dist/esm/{viewport.store-d9e291c5.js.map → viewport.store-2dc172be.js.map} +1 -1
  104. package/dist/revo-grid/app-globals-c0b06b03.js +5 -0
  105. package/dist/revo-grid/{base.plugin-d0e589d8.js → base.plugin-454940e3.js} +2 -2
  106. package/dist/revo-grid/base.plugin-454940e3.js.map +1 -0
  107. package/dist/revo-grid/{column.service-a826bbd6.js → column.service-ffe99cfc.js} +2 -2
  108. package/dist/revo-grid/column.service-ffe99cfc.js.map +1 -0
  109. package/dist/revo-grid/dimension.helpers-c0c2888f.js +5 -0
  110. package/dist/revo-grid/dimension.helpers-c0c2888f.js.map +1 -0
  111. package/dist/revo-grid/{filter.button-46ce4f80.js → filter.button-f132c10a.js} +2 -2
  112. package/dist/revo-grid/{header-cell-renderer-19738045.js → header-cell-renderer-cac333a3.js} +2 -2
  113. package/dist/revo-grid/index-e661aeb5.js +6 -0
  114. package/dist/revo-grid/index-e661aeb5.js.map +1 -0
  115. package/dist/revo-grid/index.esm.js +1 -1
  116. package/dist/revo-grid/{key.utils-7c5d91dd.js → key.utils-9120fde7.js} +2 -2
  117. package/dist/revo-grid/revo-grid.entry.js +1 -1
  118. package/dist/revo-grid/revo-grid.entry.js.map +1 -1
  119. package/dist/revo-grid/revo-grid.esm.js +1 -1
  120. package/dist/revo-grid/revo-grid.esm.js.map +1 -1
  121. package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
  122. package/dist/revo-grid/revogr-attribution_6.entry.js.map +1 -1
  123. package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
  124. package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
  125. package/dist/revo-grid/revogr-data_4.entry.js +1 -1
  126. package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
  127. package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
  128. package/dist/revo-grid/{selection.helpers-883ce6bc.js → selection.helpers-0f3ed629.js} +2 -2
  129. package/dist/revo-grid/selection.helpers-0f3ed629.js.map +1 -0
  130. package/dist/revo-grid/{viewport.store-d9e291c5.js → viewport.store-2dc172be.js} +2 -2
  131. package/dist/revo-grid/viewport.store-2dc172be.js.map +1 -0
  132. package/dist/types/components/data/column.service.d.ts +2 -3
  133. package/dist/types/components/data/revogr-data.d.ts +2 -2
  134. package/dist/types/components/header/revogr-header.d.ts +5 -6
  135. package/dist/types/components/order/revogr-order-editor.d.ts +2 -3
  136. package/dist/types/components/overlay/autofill.service.d.ts +2 -1
  137. package/dist/types/components/overlay/keyboard.service.d.ts +1 -1
  138. package/dist/types/components/revoGrid/revo-grid.d.ts +2 -5
  139. package/dist/types/components/scrollable/revogr-scroll-virtual.d.ts +2 -1
  140. package/dist/types/components/selectionFocus/revogr-focus.d.ts +2 -1
  141. package/dist/types/components/selectionTempRange/revogr-temp-range.d.ts +2 -1
  142. package/dist/types/components.d.ts +4 -2
  143. package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +1 -1
  144. package/dist/types/stencil-public-runtime.d.ts +0 -2
  145. package/dist/types/store/dataSource/data.proxy.d.ts +1 -1
  146. package/dist/types/store/dataSource/data.store.d.ts +2 -1
  147. package/dist/types/store/dataSource/trimmed.plugin.d.ts +1 -1
  148. package/dist/types/store/dimension/dimension.store.d.ts +2 -5
  149. package/dist/types/store/selection/selection.store.d.ts +1 -1
  150. package/dist/types/store/vp/viewport.store.d.ts +2 -1
  151. package/dist/types/types/interfaces.d.ts +2 -4
  152. package/dist/types/types/viewport.interfaces.d.ts +2 -1
  153. package/dist/types/utils/store.types.d.ts +97 -0
  154. package/dist/types/utils/store.utils.d.ts +4 -3
  155. package/hydrate/index.d.ts +29 -11
  156. package/hydrate/index.js +545 -541
  157. package/hydrate/index.mjs +32502 -0
  158. package/hydrate/package.json +7 -1
  159. package/loader/index.d.ts +3 -0
  160. package/package.json +3 -3
  161. package/standalone/column.service.js +1 -1
  162. package/standalone/column.service.js.map +1 -1
  163. package/standalone/data.store.js +192 -192
  164. package/standalone/data.store.js.map +1 -1
  165. package/standalone/revo-grid.js +3 -3
  166. package/standalone/revo-grid.js.map +1 -1
  167. package/standalone/revogr-data2.js.map +1 -1
  168. package/standalone/revogr-focus2.js.map +1 -1
  169. package/standalone/revogr-header2.js +2 -2
  170. package/standalone/revogr-header2.js.map +1 -1
  171. package/standalone/revogr-order-editor2.js.map +1 -1
  172. package/standalone/revogr-overlay-selection2.js.map +1 -1
  173. package/standalone/revogr-row-headers2.js.map +1 -1
  174. package/standalone/revogr-scroll-virtual2.js +1 -1
  175. package/standalone/revogr-scroll-virtual2.js.map +1 -1
  176. package/standalone/revogr-temp-range2.js.map +1 -1
  177. package/standalone/selection.utils.js +1 -1
  178. package/dist/cjs/base.plugin-32f80cb5.js.map +0 -1
  179. package/dist/cjs/dimension.helpers-ee39d6c4.js.map +0 -1
  180. package/dist/cjs/index-84e32c2a.js.map +0 -1
  181. package/dist/cjs/selection.helpers-32abb2a9.js.map +0 -1
  182. package/dist/esm/base.plugin-d0e589d8.js.map +0 -1
  183. package/dist/esm/dimension.helpers-a3065cb1.js.map +0 -1
  184. package/dist/esm/index-21436631.js.map +0 -1
  185. package/dist/esm/selection.helpers-883ce6bc.js.map +0 -1
  186. package/dist/revo-grid/app-globals-ef1fca59.js +0 -5
  187. package/dist/revo-grid/base.plugin-d0e589d8.js.map +0 -1
  188. package/dist/revo-grid/column.service-a826bbd6.js.map +0 -1
  189. package/dist/revo-grid/dimension.helpers-a3065cb1.js +0 -5
  190. package/dist/revo-grid/dimension.helpers-a3065cb1.js.map +0 -1
  191. package/dist/revo-grid/index-21436631.js +0 -6
  192. package/dist/revo-grid/index-21436631.js.map +0 -1
  193. package/dist/revo-grid/selection.helpers-883ce6bc.js.map +0 -1
  194. package/dist/revo-grid/viewport.store-d9e291c5.js.map +0 -1
  195. /package/dist/revo-grid/{app-globals-ef1fca59.js.map → app-globals-c0b06b03.js.map} +0 -0
  196. /package/dist/revo-grid/{filter.button-46ce4f80.js.map → filter.button-f132c10a.js.map} +0 -0
  197. /package/dist/revo-grid/{header-cell-renderer-19738045.js.map → header-cell-renderer-cac333a3.js.map} +0 -0
  198. /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
@@ -14698,7 +14724,7 @@ class RevoGridComponent {
14698
14724
  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
14725
  // Column headers
14700
14726
  const dataViews = [
14701
- hAsync("revogr-header", Object.assign({ key: 'f304dcc1c0ef2bc274929ef0982152905d31f761' }, headerProperties, { slot: HEADER_SLOT })),
14727
+ hAsync("revogr-header", Object.assign({ key: 'b3c3ccd088d6a01511b07f66f7dc937617a4786d' }, headerProperties, { slot: HEADER_SLOT })),
14702
14728
  ];
14703
14729
  // Render viewport data (vertical sections)
14704
14730
  view.dataPorts.forEach(data => {
@@ -14720,11 +14746,11 @@ class RevoGridComponent {
14720
14746
  const typeCol = 'rgCol';
14721
14747
  const viewports = this.viewportProvider.stores;
14722
14748
  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) => {
14749
+ 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
14750
  if (e.currentTarget === e.target) {
14725
14751
  this.viewport.clearEdit();
14726
14752
  }
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));
14753
+ } }, 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
14754
  }
14729
14755
  get element() { return getElement(this); }
14730
14756
  static get watchers() { return {
@@ -15685,8 +15711,8 @@ class RevogrHeaderComponent {
15685
15711
  visibleProps[colData === null || colData === void 0 ? void 0 : colData.prop] = rgCol.itemIndex;
15686
15712
  }
15687
15713
  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),
15714
+ 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 })),
15715
+ hAsync("div", { key: 'bf99026e1bb13d1394ddbdca8185761e6642477b', class: `${HEADER_ROW_CLASS} ${HEADER_ACTUAL_ROW_CLASS}` }, cells),
15690
15716
  ];
15691
15717
  }
15692
15718
  get providers() {
@@ -16113,7 +16139,7 @@ class RevogrScrollVirtual {
16113
16139
  }
16114
16140
  render() {
16115
16141
  const sizeType = this.dimension === 'rgRow' ? 'height' : 'width';
16116
- return (hAsync(Host, { key: '9d672a8992b1c13814270537389142ef53d322f9', onScroll: (e) => this.onScroll(e) }, hAsync("div", { key: '250886ee28842f087d815d66cbb046b38c466ebf', style: {
16142
+ return (hAsync(Host, { key: '1bf8d494d6d65ffd27f0a663f5c62c9b60cd35e1', onScroll: (e) => this.onScroll(e) }, hAsync("div", { key: '3f554ca3e7822c9bb20fe830fc4122a0d52919ee', style: {
16117
16143
  [sizeType]: `${getContentSize(this.dimensionStore.get('realSize'), this.size, this.viewportStore.get('virtualSize'))}px`,
16118
16144
  } })));
16119
16145
  }
@@ -16750,7 +16776,7 @@ var gatherActiveObservationsAtDepth = function (depth) {
16750
16776
  });
16751
16777
  };
16752
16778
 
16753
- var process$1 = function () {
16779
+ var process = function () {
16754
16780
  var depth = 0;
16755
16781
  gatherActiveObservationsAtDepth(depth);
16756
16782
  while (hasActiveObservations()) {
@@ -16826,7 +16852,7 @@ var Scheduler = (function () {
16826
16852
  queueResizeObserver(function () {
16827
16853
  var elementsHaveResized = false;
16828
16854
  try {
16829
- elementsHaveResized = process$1();
16855
+ elementsHaveResized = process();
16830
16856
  }
16831
16857
  finally {
16832
16858
  scheduled = false;
@@ -17020,7 +17046,7 @@ exports.hydrateApp = hydrateApp;
17020
17046
  }
17021
17047
 
17022
17048
  /*
17023
- Stencil Hydrate Runner v4.18.3 | MIT Licensed | https://stenciljs.com
17049
+ Stencil Hydrate Runner v4.19.1 | MIT Licensed | https://stenciljs.com
17024
17050
  */
17025
17051
  var __defProp = Object.defineProperty;
17026
17052
  var __export = (target, all) => {
@@ -27418,67 +27444,50 @@ function humanReadableList(items) {
27418
27444
  }
27419
27445
 
27420
27446
  // src/mock-doc/serialize-node.ts
27421
- function serializeNodeToHtml(elm, opts = {}) {
27447
+ function normalizeSerializationOptions(opts = {}) {
27448
+ return {
27449
+ ...opts,
27450
+ outerHtml: typeof opts.outerHtml !== "boolean" ? false : opts.outerHtml,
27451
+ ...opts.prettyHtml ? {
27452
+ indentSpaces: typeof opts.indentSpaces !== "number" ? 2 : opts.indentSpaces,
27453
+ newLines: typeof opts.newLines !== "boolean" ? true : opts.newLines
27454
+ } : {
27455
+ prettyHtml: false,
27456
+ indentSpaces: typeof opts.indentSpaces !== "number" ? 0 : opts.indentSpaces,
27457
+ newLines: typeof opts.newLines !== "boolean" ? false : opts.newLines
27458
+ },
27459
+ approximateLineWidth: typeof opts.approximateLineWidth !== "number" ? -1 : opts.approximateLineWidth,
27460
+ removeEmptyAttributes: typeof opts.removeEmptyAttributes !== "boolean" ? true : opts.removeEmptyAttributes,
27461
+ removeAttributeQuotes: typeof opts.removeAttributeQuotes !== "boolean" ? false : opts.removeAttributeQuotes,
27462
+ removeBooleanAttributeQuotes: typeof opts.removeBooleanAttributeQuotes !== "boolean" ? false : opts.removeBooleanAttributeQuotes,
27463
+ removeHtmlComments: typeof opts.removeHtmlComments !== "boolean" ? false : opts.removeHtmlComments,
27464
+ serializeShadowRoot: typeof opts.serializeShadowRoot !== "boolean" ? false : opts.serializeShadowRoot,
27465
+ fullDocument: typeof opts.fullDocument !== "boolean" ? true : opts.fullDocument
27466
+ };
27467
+ }
27468
+ function serializeNodeToHtml(elm, serializationOptions = {}) {
27469
+ const opts = normalizeSerializationOptions(serializationOptions);
27422
27470
  const output = {
27423
27471
  currentLineWidth: 0,
27424
27472
  indent: 0,
27425
27473
  isWithinBody: false,
27426
27474
  text: []
27427
27475
  };
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();
27476
+ let renderedNode = "";
27477
+ const children = !opts.fullDocument && elm.body ? Array.from(elm.body.childNodes) : opts.outerHtml ? [elm] : Array.from(elm.childNodes);
27478
+ for (let i = 0, ii = children.length; i < ii; i++) {
27479
+ const child = children[i];
27480
+ const chunks = Array.from(streamToHtml(child, opts, output));
27481
+ renderedNode += chunks.join("");
27475
27482
  }
27476
- return output.text.join("");
27483
+ return renderedNode.trim();
27477
27484
  }
27478
- function serializeToHtml(node, opts, output, isShadowRoot) {
27485
+ var shadowRootTag = "mock:shadow-root";
27486
+ function* streamToHtml(node, opts, output) {
27479
27487
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
27488
+ const isShadowRoot = node.nodeType === 11 /* DOCUMENT_FRAGMENT_NODE */;
27480
27489
  if (node.nodeType === 1 /* ELEMENT_NODE */ || isShadowRoot) {
27481
- const tagName = isShadowRoot ? "mock:shadow-root" : getTagName(node);
27490
+ const tagName = isShadowRoot ? shadowRootTag : getTagName(node);
27482
27491
  if (tagName === "body") {
27483
27492
  output.isWithinBody = true;
27484
27493
  }
@@ -27486,17 +27495,23 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
27486
27495
  if (ignoreTag === false) {
27487
27496
  const isWithinWhitespaceSensitiveNode = opts.newLines || ((_a2 = opts.indentSpaces) != null ? _a2 : 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
27488
27497
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
27489
- output.text.push("\n");
27498
+ yield "\n";
27490
27499
  output.currentLineWidth = 0;
27491
27500
  }
27492
27501
  if (((_b = opts.indentSpaces) != null ? _b : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
27493
27502
  for (let i = 0; i < output.indent; i++) {
27494
- output.text.push(" ");
27503
+ yield " ";
27495
27504
  }
27496
27505
  output.currentLineWidth += output.indent;
27497
27506
  }
27498
- output.text.push("<" + tagName);
27499
- output.currentLineWidth += tagName.length + 1;
27507
+ const tag = tagName === shadowRootTag ? "template" : tagName;
27508
+ yield "<" + tag;
27509
+ output.currentLineWidth += tag.length + 1;
27510
+ if (tag === "template") {
27511
+ const mode = ` shadowrootmode="open"`;
27512
+ yield mode;
27513
+ output.currentLineWidth += mode.length;
27514
+ }
27500
27515
  const attrsLength = node.attributes.length;
27501
27516
  const attributes = opts.prettyHtml && attrsLength > 1 ? cloneAttributes(node.attributes, true) : node.attributes;
27502
27517
  for (let i = 0; i < attrsLength; i++) {
@@ -27513,27 +27528,27 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
27513
27528
  if (attrNamespaceURI == null) {
27514
27529
  output.currentLineWidth += attrName.length + 1;
27515
27530
  if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
27516
- output.text.push("\n" + attrName);
27531
+ yield "\n" + attrName;
27517
27532
  output.currentLineWidth = 0;
27518
27533
  } else {
27519
- output.text.push(" " + attrName);
27534
+ yield " " + attrName;
27520
27535
  }
27521
27536
  } else if (attrNamespaceURI === "http://www.w3.org/XML/1998/namespace") {
27522
- output.text.push(" xml:" + attrName);
27537
+ yield " xml:" + attrName;
27523
27538
  output.currentLineWidth += attrName.length + 5;
27524
27539
  } else if (attrNamespaceURI === "http://www.w3.org/2000/xmlns/") {
27525
27540
  if (attrName !== "xmlns") {
27526
- output.text.push(" xmlns:" + attrName);
27541
+ yield " xmlns:" + attrName;
27527
27542
  output.currentLineWidth += attrName.length + 7;
27528
27543
  } else {
27529
- output.text.push(" " + attrName);
27544
+ yield " " + attrName;
27530
27545
  output.currentLineWidth += attrName.length + 1;
27531
27546
  }
27532
27547
  } else if (attrNamespaceURI === XLINK_NS) {
27533
- output.text.push(" xlink:" + attrName);
27548
+ yield " xlink:" + attrName;
27534
27549
  output.currentLineWidth += attrName.length + 7;
27535
27550
  } else {
27536
- output.text.push(" " + attrNamespaceURI + ":" + attrName);
27551
+ yield " " + attrNamespaceURI + ":" + attrName;
27537
27552
  output.currentLineWidth += attrNamespaceURI.length + attrName.length + 2;
27538
27553
  }
27539
27554
  if (opts.prettyHtml && attrName === "class") {
@@ -27548,43 +27563,45 @@ function serializeToHtml(node, opts, output, isShadowRoot) {
27548
27563
  }
27549
27564
  }
27550
27565
  if (opts.removeAttributeQuotes && CAN_REMOVE_ATTR_QUOTES.test(attrValue)) {
27551
- output.text.push("=" + escapeString(attrValue, true));
27566
+ yield "=" + escapeString(attrValue, true);
27552
27567
  output.currentLineWidth += attrValue.length + 1;
27553
27568
  } else {
27554
- output.text.push('="' + escapeString(attrValue, true) + '"');
27569
+ yield '="' + escapeString(attrValue, true) + '"';
27555
27570
  output.currentLineWidth += attrValue.length + 3;
27556
27571
  }
27557
27572
  }
27558
27573
  if (node.hasAttribute("style")) {
27559
27574
  const cssText = node.style.cssText;
27560
27575
  if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth + cssText.length + 10 > opts.approximateLineWidth) {
27561
- output.text.push(`
27562
- style="${cssText}">`);
27576
+ yield `
27577
+ style="${cssText}">`;
27563
27578
  output.currentLineWidth = 0;
27564
27579
  } else {
27565
- output.text.push(` style="${cssText}">`);
27580
+ yield ` style="${cssText}">`;
27566
27581
  output.currentLineWidth += cssText.length + 10;
27567
27582
  }
27568
27583
  } else {
27569
- output.text.push(">");
27584
+ yield ">";
27570
27585
  output.currentLineWidth += 1;
27571
27586
  }
27572
27587
  }
27573
27588
  if (EMPTY_ELEMENTS.has(tagName) === false) {
27574
- if (opts.serializeShadowRoot && node.shadowRoot != null) {
27589
+ const shadowRoot = node.shadowRoot;
27590
+ if (opts.serializeShadowRoot && shadowRoot != null) {
27575
27591
  output.indent = output.indent + ((_c = opts.indentSpaces) != null ? _c : 0);
27576
- serializeToHtml(node.shadowRoot, opts, output, true);
27592
+ yield* streamToHtml(shadowRoot, opts, output);
27577
27593
  output.indent = output.indent - ((_d = opts.indentSpaces) != null ? _d : 0);
27578
27594
  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");
27595
+ yield "\n";
27580
27596
  output.currentLineWidth = 0;
27581
27597
  for (let i = 0; i < output.indent; i++) {
27582
- output.text.push(" ");
27598
+ yield " ";
27583
27599
  }
27584
27600
  output.currentLineWidth += output.indent;
27585
27601
  }
27586
27602
  }
27587
27603
  if (opts.excludeTagContent == null || opts.excludeTagContent.includes(tagName) === false) {
27604
+ const tag = tagName === shadowRootTag ? "template" : tagName;
27588
27605
  const childNodes = tagName === "template" ? node.content.childNodes : node.childNodes;
27589
27606
  const childNodeLength = childNodes.length;
27590
27607
  if (childNodeLength > 0) {
@@ -27595,17 +27612,17 @@ style="${cssText}">`);
27595
27612
  output.indent = output.indent + ((_h = opts.indentSpaces) != null ? _h : 0);
27596
27613
  }
27597
27614
  for (let i = 0; i < childNodeLength; i++) {
27598
- serializeToHtml(childNodes[i], opts, output, false);
27615
+ yield* streamToHtml(childNodes[i], opts, output);
27599
27616
  }
27600
27617
  if (ignoreTag === false) {
27601
27618
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
27602
- output.text.push("\n");
27619
+ yield "\n";
27603
27620
  output.currentLineWidth = 0;
27604
27621
  }
27605
27622
  if (((_i = opts.indentSpaces) != null ? _i : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
27606
27623
  output.indent = output.indent - ((_j = opts.indentSpaces) != null ? _j : 0);
27607
27624
  for (let i = 0; i < output.indent; i++) {
27608
- output.text.push(" ");
27625
+ yield " ";
27609
27626
  }
27610
27627
  output.currentLineWidth += output.indent;
27611
27628
  }
@@ -27613,13 +27630,13 @@ style="${cssText}">`);
27613
27630
  }
27614
27631
  }
27615
27632
  if (ignoreTag === false) {
27616
- output.text.push("</" + tagName + ">");
27617
- output.currentLineWidth += tagName.length + 3;
27633
+ yield "</" + tag + ">";
27634
+ output.currentLineWidth += tag.length + 3;
27618
27635
  }
27619
27636
  }
27620
27637
  }
27621
27638
  if (((_k = opts.approximateLineWidth) != null ? _k : 0) > 0 && STRUCTURE_ELEMENTS.has(tagName)) {
27622
- output.text.push("\n");
27639
+ yield "\n";
27623
27640
  output.currentLineWidth = 0;
27624
27641
  }
27625
27642
  if (tagName === "body") {
@@ -27631,27 +27648,27 @@ style="${cssText}">`);
27631
27648
  const trimmedTextContent = textContent.trim();
27632
27649
  if (trimmedTextContent === "") {
27633
27650
  if (isWithinWhitespaceSensitive(node)) {
27634
- output.text.push(textContent);
27651
+ yield textContent;
27635
27652
  output.currentLineWidth += textContent.length;
27636
27653
  } else if (((_l = opts.approximateLineWidth) != null ? _l : 0) > 0 && !output.isWithinBody) {
27637
27654
  } else if (!opts.prettyHtml) {
27638
27655
  output.currentLineWidth += 1;
27639
27656
  if (opts.approximateLineWidth && opts.approximateLineWidth > 0 && output.currentLineWidth > opts.approximateLineWidth) {
27640
- output.text.push("\n");
27657
+ yield "\n";
27641
27658
  output.currentLineWidth = 0;
27642
27659
  } else {
27643
- output.text.push(" ");
27660
+ yield " ";
27644
27661
  }
27645
27662
  }
27646
27663
  } else {
27647
27664
  const isWithinWhitespaceSensitiveNode = opts.newLines || ((_m = opts.indentSpaces) != null ? _m : 0) > 0 || opts.prettyHtml ? isWithinWhitespaceSensitive(node) : false;
27648
27665
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
27649
- output.text.push("\n");
27666
+ yield "\n";
27650
27667
  output.currentLineWidth = 0;
27651
27668
  }
27652
27669
  if (((_n = opts.indentSpaces) != null ? _n : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
27653
27670
  for (let i = 0; i < output.indent; i++) {
27654
- output.text.push(" ");
27671
+ yield " ";
27655
27672
  }
27656
27673
  output.currentLineWidth += output.indent;
27657
27674
  }
@@ -27660,15 +27677,15 @@ style="${cssText}">`);
27660
27677
  const parentTagName = node.parentNode != null && node.parentNode.nodeType === 1 /* ELEMENT_NODE */ ? node.parentNode.nodeName : null;
27661
27678
  if (typeof parentTagName === "string" && NON_ESCAPABLE_CONTENT.has(parentTagName)) {
27662
27679
  if (isWithinWhitespaceSensitive(node)) {
27663
- output.text.push(textContent);
27680
+ yield textContent;
27664
27681
  } else {
27665
- output.text.push(trimmedTextContent);
27682
+ yield trimmedTextContent;
27666
27683
  textContentLength = trimmedTextContent.length;
27667
27684
  }
27668
27685
  output.currentLineWidth += textContentLength;
27669
27686
  } else {
27670
27687
  if (opts.prettyHtml && !isWithinWhitespaceSensitiveNode) {
27671
- output.text.push(escapeString(textContent.replace(/\s\s+/g, " ").trim(), false));
27688
+ yield escapeString(textContent.replace(/\s\s+/g, " ").trim(), false);
27672
27689
  output.currentLineWidth += textContentLength;
27673
27690
  } else {
27674
27691
  if (isWithinWhitespaceSensitive(node)) {
@@ -27690,7 +27707,7 @@ style="${cssText}">`);
27690
27707
  }
27691
27708
  output.currentLineWidth += textContentLength;
27692
27709
  }
27693
- output.text.push(escapeString(textContent, false));
27710
+ yield escapeString(textContent, false);
27694
27711
  }
27695
27712
  }
27696
27713
  }
@@ -27698,27 +27715,27 @@ style="${cssText}">`);
27698
27715
  }
27699
27716
  } else if (node.nodeType === 8 /* COMMENT_NODE */) {
27700
27717
  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
- }
27718
+ 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 + "."));
27719
+ if (opts.removeHtmlComments && !isHydrateAnnotation) {
27720
+ return;
27706
27721
  }
27707
27722
  const isWithinWhitespaceSensitiveNode = opts.newLines || ((_o = opts.indentSpaces) != null ? _o : 0) > 0 ? isWithinWhitespaceSensitive(node) : false;
27708
27723
  if (opts.newLines && !isWithinWhitespaceSensitiveNode) {
27709
- output.text.push("\n");
27724
+ yield "\n";
27710
27725
  output.currentLineWidth = 0;
27711
27726
  }
27712
27727
  if (((_p = opts.indentSpaces) != null ? _p : 0) > 0 && !isWithinWhitespaceSensitiveNode) {
27713
27728
  for (let i = 0; i < output.indent; i++) {
27714
- output.text.push(" ");
27729
+ yield " ";
27715
27730
  }
27716
27731
  output.currentLineWidth += output.indent;
27717
27732
  }
27718
- output.text.push("<!--" + nodeValue + "-->");
27719
- output.currentLineWidth += nodeValue.length + 7;
27733
+ yield "<!--" + nodeValue + "-->";
27734
+ if (nodeValue) {
27735
+ output.currentLineWidth += nodeValue.length + 7;
27736
+ }
27720
27737
  } else if (node.nodeType === 10 /* DOCUMENT_TYPE_NODE */) {
27721
- output.text.push("<!doctype html>");
27738
+ yield "<!doctype html>";
27722
27739
  }
27723
27740
  }
27724
27741
  var AMP_REGEX = /&/g;
@@ -27743,7 +27760,7 @@ function escapeString(str, attrMode) {
27743
27760
  }
27744
27761
  function isWithinWhitespaceSensitive(node) {
27745
27762
  let _node = node;
27746
- while (_node != null) {
27763
+ while (_node == null ? void 0 : _node.nodeName) {
27747
27764
  if (WHITESPACE_SENSITIVE.has(_node.nodeName)) {
27748
27765
  return true;
27749
27766
  }
@@ -28059,6 +28076,10 @@ Testing components with ElementInternals is fully supported in e2e tests.`
28059
28076
  get shadowRoot() {
28060
28077
  return this.__shadowRoot || null;
28061
28078
  }
28079
+ /**
28080
+ * Set shadow root for element
28081
+ * @param shadowRoot - ShadowRoot to set
28082
+ */
28062
28083
  set shadowRoot(shadowRoot) {
28063
28084
  if (shadowRoot != null) {
28064
28085
  shadowRoot.host = this;
@@ -29845,14 +29866,16 @@ var WINDOW_PROPS = [
29845
29866
  ];
29846
29867
  var GLOBAL_CONSTRUCTORS = [
29847
29868
  ["CustomEvent", MockCustomEvent],
29869
+ ["DocumentFragment", MockDocumentFragment],
29870
+ ["DOMParser", MockDOMParser],
29848
29871
  ["Event", MockEvent],
29849
- ["Headers", MockHeaders],
29850
29872
  ["FocusEvent", MockFocusEvent],
29873
+ ["Headers", MockHeaders],
29851
29874
  ["KeyboardEvent", MockKeyboardEvent],
29852
29875
  ["MouseEvent", MockMouseEvent],
29853
29876
  ["Request", MockRequest],
29854
29877
  ["Response", MockResponse],
29855
- ["DOMParser", MockDOMParser],
29878
+ ["ShadowRoot", MockDocumentFragment],
29856
29879
  ["HTMLAnchorElement", MockAnchorElement],
29857
29880
  ["HTMLBaseElement", MockBaseElement],
29858
29881
  ["HTMLButtonElement", MockButtonElement],
@@ -30063,6 +30086,7 @@ var nativeClearTimeout = clearTimeout;
30063
30086
  var nativeSetInterval = setInterval;
30064
30087
  var nativeSetTimeout = setTimeout;
30065
30088
  var nativeURL = URL;
30089
+ var nativeWindow = globalThis.window;
30066
30090
  var MockWindow = class {
30067
30091
  constructor(html = null) {
30068
30092
  if (html !== false) {
@@ -30089,10 +30113,10 @@ var MockWindow = class {
30089
30113
  blur() {
30090
30114
  }
30091
30115
  cancelAnimationFrame(id) {
30092
- this.__clearTimeout(id);
30116
+ this.__clearTimeout.call(nativeWindow || this, id);
30093
30117
  }
30094
30118
  cancelIdleCallback(id) {
30095
- this.__clearTimeout(id);
30119
+ this.__clearTimeout.call(nativeWindow || this, id);
30096
30120
  }
30097
30121
  get CharacterData() {
30098
30122
  if (this.__charDataCstr == null) {
@@ -30110,10 +30134,10 @@ var MockWindow = class {
30110
30134
  this.__charDataCstr = charDataCstr;
30111
30135
  }
30112
30136
  clearInterval(id) {
30113
- this.__clearInterval(id);
30137
+ this.__clearInterval.call(nativeWindow || this, id);
30114
30138
  }
30115
30139
  clearTimeout(id) {
30116
- this.__clearTimeout(id);
30140
+ this.__clearTimeout.call(nativeWindow || this, id);
30117
30141
  }
30118
30142
  close() {
30119
30143
  resetWindow(this);
@@ -30413,20 +30437,24 @@ var MockWindow = class {
30413
30437
  }
30414
30438
  return intervalId;
30415
30439
  }
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);
30440
+ const timeoutId = this.__setTimeout.call(
30441
+ nativeWindow || this,
30442
+ () => {
30443
+ if (this.__timeouts) {
30444
+ this.__timeouts.delete(timeoutId);
30445
+ try {
30446
+ callback(...args);
30447
+ } catch (e) {
30448
+ if (this.console) {
30449
+ this.console.error(e);
30450
+ } else {
30451
+ console.error(e);
30452
+ }
30426
30453
  }
30427
30454
  }
30428
- }
30429
- }, ms);
30455
+ },
30456
+ ms
30457
+ );
30430
30458
  if (this.__timeouts) {
30431
30459
  this.__timeouts.add(timeoutId);
30432
30460
  }
@@ -30437,20 +30465,24 @@ var MockWindow = class {
30437
30465
  this.__timeouts = /* @__PURE__ */ new Set();
30438
30466
  }
30439
30467
  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);
30468
+ const timeoutId = this.__setTimeout.call(
30469
+ nativeWindow || this,
30470
+ () => {
30471
+ if (this.__timeouts) {
30472
+ this.__timeouts.delete(timeoutId);
30473
+ try {
30474
+ callback(...args);
30475
+ } catch (e) {
30476
+ if (this.console) {
30477
+ this.console.error(e);
30478
+ } else {
30479
+ console.error(e);
30480
+ }
30450
30481
  }
30451
30482
  }
30452
- }
30453
- }, ms);
30483
+ },
30484
+ ms
30485
+ );
30454
30486
  if (this.__timeouts) {
30455
30487
  this.__timeouts.add(timeoutId);
30456
30488
  }
@@ -31025,7 +31057,6 @@ function createWindowFromHtml(templateHtml, uniqueId) {
31025
31057
 
31026
31058
  // src/utils/helpers.ts
31027
31059
  var isString = (v) => typeof v === "string";
31028
- var isPromise = (v) => !!v && (typeof v === "object" || typeof v === "function") && typeof v.then === "function";
31029
31060
 
31030
31061
  // src/utils/message-utils.ts
31031
31062
  var catchError = (diagnostics, err2, msg) => {
@@ -31116,6 +31147,7 @@ var unwrapErr = (result) => {
31116
31147
 
31117
31148
  // src/compiler/html/canonical-link.ts
31118
31149
  var updateCanonicalLink = (doc, href) => {
31150
+ var _a2;
31119
31151
  let canonicalLinkElm = doc.head.querySelector('link[rel="canonical"]');
31120
31152
  if (typeof href === "string") {
31121
31153
  if (canonicalLinkElm == null) {
@@ -31128,7 +31160,7 @@ var updateCanonicalLink = (doc, href) => {
31128
31160
  if (canonicalLinkElm != null) {
31129
31161
  const existingHref = canonicalLinkElm.getAttribute("href");
31130
31162
  if (!existingHref) {
31131
- canonicalLinkElm.parentNode.removeChild(canonicalLinkElm);
31163
+ (_a2 = canonicalLinkElm.parentNode) == null ? void 0 : _a2.removeChild(canonicalLinkElm);
31132
31164
  }
31133
31165
  }
31134
31166
  }
@@ -32162,10 +32194,10 @@ function renderBuildDiagnostic(results, level, header, msg) {
32162
32194
  return diagnostic;
32163
32195
  }
32164
32196
  function renderBuildError(results, msg) {
32165
- return renderBuildDiagnostic(results, "error", "Hydrate Error", msg);
32197
+ return renderBuildDiagnostic(results, "error", "Hydrate Error", msg || "");
32166
32198
  }
32167
32199
  function renderCatchError(results, err2) {
32168
- const diagnostic = renderBuildError(results, null);
32200
+ const diagnostic = renderBuildError(results);
32169
32201
  if (err2 != null) {
32170
32202
  if (err2.stack != null) {
32171
32203
  diagnostic.messageText = err2.stack.toString();
@@ -32227,10 +32259,11 @@ function runtimeLog(pathname, type, msgs) {
32227
32259
 
32228
32260
  // src/hydrate/runner/window-initialize.ts
32229
32261
  function initializeWindow(win, doc, opts, results) {
32230
- try {
32231
- win.location.href = opts.url;
32232
- } catch (e) {
32233
- renderCatchError(results, e);
32262
+ if (typeof opts.url === "string") {
32263
+ try {
32264
+ win.location.href = opts.url;
32265
+ } catch (e) {
32266
+ }
32234
32267
  }
32235
32268
  if (typeof opts.userAgent === "string") {
32236
32269
  try {
@@ -32280,134 +32313,99 @@ function initializeWindow(win, doc, opts, results) {
32280
32313
  }
32281
32314
 
32282
32315
  // src/hydrate/runner/render.ts
32283
- function renderToString(html, options) {
32316
+ var NOOP = () => {
32317
+ };
32318
+ function streamToString(html, option) {
32319
+ return renderToString(html, option, true);
32320
+ }
32321
+ function renderToString(html, options, asStream) {
32284
32322
  const opts = normalizeHydrateOptions(options);
32285
32323
  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);
32324
+ opts.fullDocument = typeof opts.fullDocument === "boolean" ? opts.fullDocument : true;
32325
+ opts.serializeShadowRoot = Boolean(opts.serializeShadowRoot);
32326
+ opts.constrainTimeouts = false;
32327
+ return hydrateDocument(html, opts, asStream);
32328
+ }
32329
+ function hydrateDocument(doc, options, asStream) {
32330
+ const opts = normalizeHydrateOptions(options);
32331
+ let win = null;
32332
+ const results = generateHydrateResults(opts);
32333
+ if (hasError(results.diagnostics)) {
32334
+ return Promise.resolve(results);
32335
+ }
32336
+ if (typeof doc === "string") {
32337
+ try {
32338
+ opts.destroyWindow = true;
32339
+ opts.destroyDocument = true;
32340
+ win = new MockWindow(doc);
32341
+ if (!asStream) {
32342
+ return render(win, opts, results).then(() => results);
32304
32343
  }
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);
32344
+ return renderStream(win, opts, results);
32345
+ } catch (e) {
32346
+ if (win && win.close) {
32347
+ win.close();
32317
32348
  }
32318
- } else {
32319
- renderBuildError(results, `Invalid html or document. Must be either a valid "html" string, or DOM "document".`);
32320
- resolve(results);
32349
+ win = null;
32350
+ renderCatchError(results, e);
32351
+ return Promise.resolve(results);
32321
32352
  }
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);
32353
+ }
32354
+ if (isValidDocument(doc)) {
32355
+ try {
32356
+ opts.destroyDocument = false;
32357
+ win = patchDomImplementation(doc, opts);
32358
+ if (!asStream) {
32359
+ return render(win, opts, results).then(() => results);
32345
32360
  }
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);
32361
+ return renderStream(win, opts, results);
32362
+ } catch (e) {
32363
+ if (win && win.close) {
32364
+ win.close();
32358
32365
  }
32359
- } else {
32360
- renderBuildError(results, `Invalid html or document. Must be either a valid "html" string, or DOM "document".`);
32361
- resolve(results);
32366
+ win = null;
32367
+ renderCatchError(results, e);
32368
+ return Promise.resolve(results);
32362
32369
  }
32363
- });
32370
+ }
32371
+ renderBuildError(results, `Invalid html or document. Must be either a valid "html" string, or DOM "document".`);
32372
+ return Promise.resolve(results);
32364
32373
  }
32365
- function render(win, opts, results, resolve) {
32366
- if (!process.__stencilErrors) {
32374
+ async function render(win, opts, results) {
32375
+ if ("process" in globalThis && typeof process.on === "function" && !process.__stencilErrors) {
32367
32376
  process.__stencilErrors = true;
32368
32377
  process.on("unhandledRejection", (e) => {
32369
32378
  console.log("unhandledRejection", e);
32370
32379
  });
32371
32380
  }
32372
32381
  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);
32382
+ const beforeHydrateFn = typeof opts.beforeHydrate === "function" ? opts.beforeHydrate(win.document) : NOOP;
32383
+ try {
32384
+ await Promise.resolve(beforeHydrateFn(win.document));
32385
+ return new Promise((resolve) => hydrateFactory(win, opts, results, afterHydrate, resolve));
32386
+ } catch (e) {
32387
+ renderCatchError(results, e);
32388
+ return finalizeHydrate(win, win.document, opts, results);
32389
32389
  }
32390
32390
  }
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);
32391
+ function renderStream(win, opts, results) {
32392
+ async function* processRender() {
32393
+ const renderResult = await render(win, opts, results);
32394
+ yield renderResult.html;
32395
+ }
32396
+ return stream.Readable.from(processRender());
32397
+ }
32398
+ async function afterHydrate(win, opts, results, resolve) {
32399
+ const afterHydrateFn = typeof opts.afterHydrate === "function" ? opts.afterHydrate(win.document) : NOOP;
32400
+ try {
32401
+ await Promise.resolve(afterHydrateFn(win.document));
32402
+ return resolve(finalizeHydrate(win, win.document, opts, results));
32403
+ } catch (e) {
32404
+ renderCatchError(results, e);
32405
+ return resolve(finalizeHydrate(win, win.document, opts, results));
32408
32406
  }
32409
32407
  }
32410
- function finalizeHydrate(win, doc, opts, results, resolve) {
32408
+ function finalizeHydrate(win, doc, opts, results) {
32411
32409
  try {
32412
32410
  inspectElement(results, doc.documentElement, 0);
32413
32411
  if (opts.removeUnusedStyles !== false) {
@@ -32459,20 +32457,24 @@ function finalizeHydrate(win, doc, opts, results, resolve) {
32459
32457
  } catch (e) {
32460
32458
  renderCatchError(results, e);
32461
32459
  }
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);
32460
+ destroyWindow(win, doc, opts, results);
32461
+ return results;
32462
+ }
32463
+ function destroyWindow(win, doc, opts, results) {
32464
+ if (!opts.destroyWindow) {
32465
+ return;
32466
+ }
32467
+ try {
32468
+ if (!opts.destroyDocument) {
32469
+ win.document = null;
32470
+ doc.defaultView = null;
32471
+ }
32472
+ if (win.close) {
32473
+ win.close();
32473
32474
  }
32475
+ } catch (e) {
32476
+ renderCatchError(results, e);
32474
32477
  }
32475
- resolve(results);
32476
32478
  }
32477
32479
  function serializeDocumentToString(doc, opts) {
32478
32480
  return serializeNodeToHtml(doc, {
@@ -32483,7 +32485,8 @@ function serializeDocumentToString(doc, opts) {
32483
32485
  removeBooleanAttributeQuotes: opts.removeBooleanAttributeQuotes,
32484
32486
  removeEmptyAttributes: opts.removeEmptyAttributes,
32485
32487
  removeHtmlComments: opts.removeHtmlComments,
32486
- serializeShadowRoot: false
32488
+ serializeShadowRoot: opts.serializeShadowRoot,
32489
+ fullDocument: opts.fullDocument
32487
32490
  });
32488
32491
  }
32489
32492
  function isValidDocument(doc) {
@@ -32504,3 +32507,4 @@ exports.createWindowFromHtml = createWindowFromHtml;
32504
32507
  exports.hydrateDocument = hydrateDocument;
32505
32508
  exports.renderToString = renderToString;
32506
32509
  exports.serializeDocumentToString = serializeDocumentToString;
32510
+ exports.streamToString = streamToString;