weg-shared-layout 0.0.50 → 0.0.51

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.
@@ -4,13 +4,37 @@ const NAMESPACE = 'weg-shared-layout';
4
4
  const BUILD = /* weg-shared-layout */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, state: true, updatable: true};
5
5
 
6
6
  /*
7
- Stencil Client Platform v4.43.4 | MIT Licensed | https://stenciljs.com
7
+ Stencil Client Platform v4.43.5 | MIT Licensed | https://stenciljs.com
8
8
  */
9
9
 
10
10
 
11
11
  // src/utils/constants.ts
12
12
  var SVG_NS = "http://www.w3.org/2000/svg";
13
13
  var HTML_NS = "http://www.w3.org/1999/xhtml";
14
+ var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
15
+ PrimitiveType2["Undefined"] = "undefined";
16
+ PrimitiveType2["Null"] = "null";
17
+ PrimitiveType2["String"] = "string";
18
+ PrimitiveType2["Number"] = "number";
19
+ PrimitiveType2["SpecialNumber"] = "number";
20
+ PrimitiveType2["Boolean"] = "boolean";
21
+ PrimitiveType2["BigInt"] = "bigint";
22
+ return PrimitiveType2;
23
+ })(PrimitiveType || {});
24
+ var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
25
+ NonPrimitiveType2["Array"] = "array";
26
+ NonPrimitiveType2["Date"] = "date";
27
+ NonPrimitiveType2["Map"] = "map";
28
+ NonPrimitiveType2["Object"] = "object";
29
+ NonPrimitiveType2["RegularExpression"] = "regexp";
30
+ NonPrimitiveType2["Set"] = "set";
31
+ NonPrimitiveType2["Channel"] = "channel";
32
+ NonPrimitiveType2["Symbol"] = "symbol";
33
+ return NonPrimitiveType2;
34
+ })(NonPrimitiveType || {});
35
+ var TYPE_CONSTANT = "type";
36
+ var VALUE_CONSTANT = "value";
37
+ var SERIALIZED_PREFIX = "serialized:";
14
38
 
15
39
  // src/utils/get-prop-descriptor.ts
16
40
  function getPropertyDescriptor(obj, memberName, getOnly) {
@@ -125,6 +149,16 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
125
149
 
126
150
  // src/client/client-style.ts
127
151
  var styles = /* @__PURE__ */ new Map();
152
+
153
+ // src/runtime/runtime-constants.ts
154
+ var CONTENT_REF_ID = "r";
155
+ var ORG_LOCATION_ID = "o";
156
+ var SLOT_NODE_ID = "s";
157
+ var TEXT_NODE_ID = "t";
158
+ var COMMENT_NODE_ID = "c";
159
+ var HYDRATE_ID = "s-id";
160
+ var HYDRATED_STYLE_ID = "sty-id";
161
+ var HYDRATE_CHILD_ID = "c-id";
128
162
  var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
129
163
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
130
164
  var XLINK_NS = "http://www.w3.org/1999/xlink";
@@ -224,6 +258,82 @@ function createShadowRoot(cmpMeta) {
224
258
  }
225
259
  }
226
260
  }
261
+ var getSlottedChildNodes = (childNodes) => {
262
+ const result = [];
263
+ for (let i2 = 0; i2 < childNodes.length; i2++) {
264
+ const slottedNode = childNodes[i2]["s-nr"] || void 0;
265
+ if (slottedNode && slottedNode.isConnected) {
266
+ result.push(slottedNode);
267
+ }
268
+ }
269
+ return result;
270
+ };
271
+ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
272
+ if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
273
+ return;
274
+ }
275
+ const slottedNodeLocation = document.createTextNode("");
276
+ slottedNodeLocation["s-nr"] = newChild;
277
+ if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
278
+ const parent = slotNode["s-cr"].parentNode;
279
+ const appendMethod = internalCall(parent, "appendChild");
280
+ if (typeof position !== "undefined") {
281
+ slottedNodeLocation["s-oo"] = position;
282
+ const childNodes = internalCall(parent, "childNodes");
283
+ const slotRelocateNodes = [slottedNodeLocation];
284
+ childNodes.forEach((n) => {
285
+ if (n["s-nr"]) slotRelocateNodes.push(n);
286
+ });
287
+ slotRelocateNodes.sort((a, b) => {
288
+ if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
289
+ else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
290
+ return 0;
291
+ });
292
+ slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
293
+ } else {
294
+ appendMethod.call(parent, slottedNodeLocation);
295
+ }
296
+ newChild["s-ol"] = slottedNodeLocation;
297
+ newChild["s-sh"] = slotNode["s-hn"];
298
+ };
299
+ var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
300
+ function patchSlotNode(node) {
301
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
302
+ const assignedFactory = (elementsOnly) => (function(opts) {
303
+ const toReturn = [];
304
+ const slotName = this["s-sn"];
305
+ if (opts == null ? void 0 : opts.flatten) {
306
+ console.error(`
307
+ Flattening is not supported for Stencil non-shadow slots.
308
+ You can use \`.childNodes\` to nested slot fallback content.
309
+ If you have a particular use case, please open an issue on the Stencil repo.
310
+ `);
311
+ }
312
+ const parent = this["s-cr"].parentElement;
313
+ const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
314
+ slottedNodes.forEach((n) => {
315
+ if (slotName === getSlotName(n)) {
316
+ toReturn.push(n);
317
+ }
318
+ });
319
+ if (elementsOnly) {
320
+ return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
321
+ }
322
+ return toReturn;
323
+ }).bind(node);
324
+ node.assignedElements = assignedFactory(true);
325
+ node.assignedNodes = assignedFactory(false);
326
+ }
327
+ function internalCall(node, method) {
328
+ if ("__" + method in node) {
329
+ const toReturn = node["__" + method];
330
+ if (typeof toReturn !== "function") return toReturn;
331
+ return toReturn.bind(node);
332
+ } else {
333
+ if (typeof node[method] !== "function") return node[method];
334
+ return node[method].bind(node);
335
+ }
336
+ }
227
337
  var createTime = (fnName, tagName = "") => {
228
338
  {
229
339
  return () => {
@@ -277,7 +387,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
277
387
  if (!appliedStyles) {
278
388
  rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
279
389
  }
280
- if (!appliedStyles.has(scopeId2)) {
390
+ const existingStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
391
+ if (existingStyleElm) {
392
+ existingStyleElm.textContent = style;
393
+ } else if (!appliedStyles.has(scopeId2)) {
281
394
  styleElm = win.document.createElement("style");
282
395
  styleElm.textContent = style;
283
396
  const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
@@ -346,6 +459,12 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
346
459
  styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
347
460
  }
348
461
  appliedStyles.add(scopeId2);
462
+ if ("host" in styleContainerNode) {
463
+ const ssrStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
464
+ if (ssrStyleElm) {
465
+ writeTask(() => ssrStyleElm.remove());
466
+ }
467
+ }
349
468
  }
350
469
  }
351
470
  }
@@ -366,6 +485,17 @@ var attachStyles = (hostRef) => {
366
485
  endAttachStyles();
367
486
  };
368
487
  var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
488
+ var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
489
+ var hydrateScopedToShadow = () => {
490
+ if (!win.document) {
491
+ return;
492
+ }
493
+ const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
494
+ let i2 = 0;
495
+ for (; i2 < styles2.length; i2++) {
496
+ registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
497
+ }
498
+ };
369
499
  var isComplexType = (o) => {
370
500
  o = typeof o;
371
501
  return o === "object" || o === "function";
@@ -478,6 +608,394 @@ var convertToPrivate = (node) => {
478
608
  return vnode;
479
609
  };
480
610
 
611
+ // src/runtime/client-hydrate.ts
612
+ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
613
+ var _a, _b, _c, _d;
614
+ const endHydrate = createTime("hydrateClient", tagName);
615
+ const shadowRoot = hostElm.shadowRoot;
616
+ const childRenderNodes = [];
617
+ const slotNodes = [];
618
+ const slottedNodes = [];
619
+ const shadowRootNodes = shadowRoot ? [] : null;
620
+ const vnode = newVNode(tagName, null);
621
+ vnode.$elm$ = hostElm;
622
+ if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
623
+ initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
624
+ }
625
+ hostElm[HYDRATE_ID] = hostId;
626
+ hostElm.removeAttribute(HYDRATE_ID);
627
+ hostRef.$vnode$ = clientHydrate(
628
+ vnode,
629
+ childRenderNodes,
630
+ slotNodes,
631
+ shadowRootNodes,
632
+ hostElm,
633
+ hostElm,
634
+ hostId,
635
+ slottedNodes
636
+ );
637
+ let crIndex = 0;
638
+ const crLength = childRenderNodes.length;
639
+ let childRenderNode;
640
+ for (crIndex; crIndex < crLength; crIndex++) {
641
+ childRenderNode = childRenderNodes[crIndex];
642
+ const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
643
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
644
+ const node = childRenderNode.$elm$;
645
+ if (!shadowRoot) {
646
+ node["s-hn"] = transformTag(tagName).toUpperCase();
647
+ if (childRenderNode.$tag$ === "slot") {
648
+ node["s-cr"] = hostElm["s-cr"];
649
+ }
650
+ } else if (((_a = childRenderNode.$tag$) == null ? void 0 : _a.toString().includes("-")) && childRenderNode.$tag$ !== "slot-fb" && !childRenderNode.$elm$.shadowRoot) {
651
+ const cmpMeta = getHostRef(childRenderNode.$elm$);
652
+ if (cmpMeta) {
653
+ const scopeId3 = getScopeId(
654
+ cmpMeta.$cmpMeta$);
655
+ const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
656
+ if (styleSheet) {
657
+ shadowRootNodes.unshift(styleSheet.cloneNode(true));
658
+ }
659
+ }
660
+ }
661
+ if (childRenderNode.$tag$ === "slot") {
662
+ childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
663
+ if (childRenderNode.$children$) {
664
+ childRenderNode.$flags$ |= 2 /* isSlotFallback */;
665
+ if (!childRenderNode.$elm$.childNodes.length) {
666
+ childRenderNode.$children$.forEach((c) => {
667
+ childRenderNode.$elm$.appendChild(c.$elm$);
668
+ });
669
+ }
670
+ } else {
671
+ childRenderNode.$flags$ |= 1 /* isSlotReference */;
672
+ }
673
+ }
674
+ if (orgLocationNode && orgLocationNode.isConnected) {
675
+ if (orgLocationNode.parentElement.shadowRoot && orgLocationNode["s-en"] === "") {
676
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
677
+ }
678
+ orgLocationNode.parentNode.removeChild(orgLocationNode);
679
+ if (!shadowRoot) {
680
+ node["s-oo"] = parseInt(childRenderNode.$nodeId$);
681
+ }
682
+ }
683
+ if (orgLocationNode && !orgLocationNode["s-id"]) {
684
+ plt.$orgLocNodes$.delete(orgLocationId);
685
+ }
686
+ }
687
+ const hosts = [];
688
+ const snLen = slottedNodes.length;
689
+ let snIndex = 0;
690
+ let slotGroup;
691
+ let snGroupIdx;
692
+ let snGroupLen;
693
+ let slottedItem;
694
+ let currentPos = 0;
695
+ for (snIndex; snIndex < snLen; snIndex++) {
696
+ slotGroup = slottedNodes[snIndex];
697
+ if (!slotGroup || !slotGroup.length) continue;
698
+ snGroupLen = slotGroup.length;
699
+ snGroupIdx = 0;
700
+ for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
701
+ slottedItem = slotGroup[snGroupIdx];
702
+ if (!hosts[slottedItem.hostId]) {
703
+ hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
704
+ }
705
+ if (!hosts[slottedItem.hostId]) continue;
706
+ const hostEle = hosts[slottedItem.hostId];
707
+ if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
708
+ hostEle.insertBefore(slottedItem.node, (_c = (_b = slotGroup[snGroupIdx - 1]) == null ? void 0 : _b.node) == null ? void 0 : _c.nextSibling);
709
+ }
710
+ if (!hostEle.shadowRoot || !shadowRoot) {
711
+ if (!slottedItem.slot["s-cr"]) {
712
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
713
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
714
+ slottedItem.slot["s-cr"] = hostEle;
715
+ } else {
716
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
717
+ }
718
+ }
719
+ addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"] || currentPos);
720
+ if (((_d = slottedItem.node.parentElement) == null ? void 0 : _d.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) {
721
+ slottedItem.node.removeAttribute("slot");
722
+ }
723
+ }
724
+ currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
725
+ }
726
+ }
727
+ if (shadowRoot && !shadowRoot.childNodes.length) {
728
+ let rnIdex = 0;
729
+ const rnLen = shadowRootNodes.length;
730
+ if (rnLen) {
731
+ for (rnIdex; rnIdex < rnLen; rnIdex++) {
732
+ const node = shadowRootNodes[rnIdex];
733
+ if (node) {
734
+ shadowRoot.appendChild(node);
735
+ }
736
+ }
737
+ Array.from(hostElm.childNodes).forEach((node) => {
738
+ if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
739
+ if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
740
+ node.removeAttribute("hidden");
741
+ } else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue) {
742
+ node.parentNode.removeChild(node);
743
+ }
744
+ }
745
+ });
746
+ }
747
+ }
748
+ hostRef.$hostElement$ = hostElm;
749
+ endHydrate();
750
+ };
751
+ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
752
+ let childNodeType;
753
+ let childIdSplt;
754
+ let childVNode;
755
+ let i2;
756
+ if (node.nodeType === 1 /* ElementNode */) {
757
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
758
+ if (childNodeType) {
759
+ childIdSplt = childNodeType.split(".");
760
+ if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
761
+ childVNode = createSimpleVNode({
762
+ $flags$: 0,
763
+ $hostId$: childIdSplt[0],
764
+ $nodeId$: childIdSplt[1],
765
+ $depth$: childIdSplt[2],
766
+ $index$: childIdSplt[3],
767
+ $tag$: node.tagName.toLowerCase(),
768
+ $elm$: node,
769
+ // If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
770
+ // won't try to reconcile them. Classes set on the node will be blown away.
771
+ $attrs$: { class: node.className || "" }
772
+ });
773
+ childRenderNodes.push(childVNode);
774
+ node.removeAttribute(HYDRATE_CHILD_ID);
775
+ if (!parentVNode.$children$) {
776
+ parentVNode.$children$ = [];
777
+ }
778
+ const slotName = childVNode.$elm$.getAttribute("s-sn");
779
+ if (typeof slotName === "string") {
780
+ if (childVNode.$tag$ === "slot-fb") {
781
+ addSlot(
782
+ slotName,
783
+ childIdSplt[2],
784
+ childVNode,
785
+ node,
786
+ parentVNode,
787
+ childRenderNodes,
788
+ slotNodes,
789
+ shadowRootNodes,
790
+ slottedNodes
791
+ );
792
+ }
793
+ childVNode.$elm$["s-sn"] = slotName;
794
+ childVNode.$elm$.removeAttribute("s-sn");
795
+ }
796
+ if (childVNode.$index$ !== void 0) {
797
+ parentVNode.$children$[childVNode.$index$] = childVNode;
798
+ }
799
+ parentVNode = childVNode;
800
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
801
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
802
+ }
803
+ }
804
+ }
805
+ if (node.shadowRoot) {
806
+ for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
807
+ clientHydrate(
808
+ parentVNode,
809
+ childRenderNodes,
810
+ slotNodes,
811
+ shadowRootNodes,
812
+ hostElm,
813
+ node.shadowRoot.childNodes[i2],
814
+ hostId,
815
+ slottedNodes
816
+ );
817
+ }
818
+ }
819
+ const nonShadowNodes = node.__childNodes || node.childNodes;
820
+ for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
821
+ clientHydrate(
822
+ parentVNode,
823
+ childRenderNodes,
824
+ slotNodes,
825
+ shadowRootNodes,
826
+ hostElm,
827
+ nonShadowNodes[i2],
828
+ hostId,
829
+ slottedNodes
830
+ );
831
+ }
832
+ } else if (node.nodeType === 8 /* CommentNode */) {
833
+ childIdSplt = node.nodeValue.split(".");
834
+ if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
835
+ childNodeType = childIdSplt[0];
836
+ childVNode = createSimpleVNode({
837
+ $hostId$: childIdSplt[1],
838
+ $nodeId$: childIdSplt[2],
839
+ $depth$: childIdSplt[3],
840
+ $index$: childIdSplt[4] || "0",
841
+ $elm$: node,
842
+ $attrs$: null,
843
+ $children$: null,
844
+ $key$: null,
845
+ $name$: null,
846
+ $tag$: null,
847
+ $text$: null
848
+ });
849
+ if (childNodeType === TEXT_NODE_ID) {
850
+ childVNode.$elm$ = findCorrespondingNode(node, 3 /* TextNode */);
851
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
852
+ childVNode.$text$ = childVNode.$elm$.textContent;
853
+ childRenderNodes.push(childVNode);
854
+ node.remove();
855
+ if (hostId === childVNode.$hostId$) {
856
+ if (!parentVNode.$children$) {
857
+ parentVNode.$children$ = [];
858
+ }
859
+ parentVNode.$children$[childVNode.$index$] = childVNode;
860
+ }
861
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
862
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
863
+ }
864
+ }
865
+ } else if (childNodeType === COMMENT_NODE_ID) {
866
+ childVNode.$elm$ = findCorrespondingNode(node, 8 /* CommentNode */);
867
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
868
+ childRenderNodes.push(childVNode);
869
+ node.remove();
870
+ }
871
+ } else if (childVNode.$hostId$ === hostId) {
872
+ if (childNodeType === SLOT_NODE_ID) {
873
+ const slotName = node["s-sn"] = childIdSplt[5] || "";
874
+ addSlot(
875
+ slotName,
876
+ childIdSplt[2],
877
+ childVNode,
878
+ node,
879
+ parentVNode,
880
+ childRenderNodes,
881
+ slotNodes,
882
+ shadowRootNodes,
883
+ slottedNodes
884
+ );
885
+ } else if (childNodeType === CONTENT_REF_ID) {
886
+ if (shadowRootNodes) {
887
+ node.remove();
888
+ }
889
+ }
890
+ }
891
+ }
892
+ } else if (parentVNode && parentVNode.$tag$ === "style") {
893
+ const vnode = newVNode(null, node.textContent);
894
+ vnode.$elm$ = node;
895
+ vnode.$index$ = "0";
896
+ parentVNode.$children$ = [vnode];
897
+ }
898
+ return parentVNode;
899
+ };
900
+ var initializeDocumentHydrate = (node, orgLocNodes) => {
901
+ if (node.nodeType === 1 /* ElementNode */) {
902
+ const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
903
+ if (componentId) {
904
+ orgLocNodes.set(componentId, node);
905
+ }
906
+ let i2 = 0;
907
+ if (node.shadowRoot) {
908
+ for (; i2 < node.shadowRoot.childNodes.length; i2++) {
909
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
910
+ }
911
+ }
912
+ const nonShadowNodes = node.__childNodes || node.childNodes;
913
+ for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
914
+ initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
915
+ }
916
+ } else if (node.nodeType === 8 /* CommentNode */) {
917
+ const childIdSplt = node.nodeValue.split(".");
918
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
919
+ orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
920
+ node.nodeValue = "";
921
+ node["s-en"] = childIdSplt[3];
922
+ }
923
+ }
924
+ };
925
+ var createSimpleVNode = (vnode) => {
926
+ const defaultVNode = {
927
+ $flags$: 0,
928
+ $hostId$: null,
929
+ $nodeId$: null,
930
+ $depth$: null,
931
+ $index$: "0",
932
+ $elm$: null,
933
+ $attrs$: null,
934
+ $children$: null,
935
+ $key$: null,
936
+ $name$: null,
937
+ $tag$: null,
938
+ $text$: null
939
+ };
940
+ return { ...defaultVNode, ...vnode };
941
+ };
942
+ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
943
+ node["s-sr"] = true;
944
+ childVNode.$name$ = slotName || null;
945
+ childVNode.$tag$ = "slot";
946
+ const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
947
+ if (shadowRootNodes && win.document) {
948
+ const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
949
+ if (childVNode.$name$) {
950
+ childVNode.$elm$.setAttribute("name", slotName);
951
+ }
952
+ if (parentVNode.$elm$.shadowRoot && parentNodeId && parentNodeId !== childVNode.$hostId$) {
953
+ internalCall(parentVNode.$elm$, "insertBefore")(slot, internalCall(parentVNode.$elm$, "children")[0]);
954
+ } else {
955
+ internalCall(internalCall(node, "parentNode"), "insertBefore")(slot, node);
956
+ }
957
+ addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
958
+ node.remove();
959
+ if (childVNode.$depth$ === "0") {
960
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
961
+ }
962
+ } else {
963
+ const slot = childVNode.$elm$;
964
+ const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
965
+ addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
966
+ patchSlotNode(node);
967
+ if (shouldMove) {
968
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
969
+ }
970
+ }
971
+ childRenderNodes.push(childVNode);
972
+ slotNodes.push(childVNode);
973
+ if (!parentVNode.$children$) {
974
+ parentVNode.$children$ = [];
975
+ }
976
+ parentVNode.$children$[childVNode.$index$] = childVNode;
977
+ }
978
+ var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
979
+ var _a, _b;
980
+ let slottedNode = slotNode.nextSibling;
981
+ slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
982
+ if (!slottedNode || ((_a = slottedNode.nodeValue) == null ? void 0 : _a.startsWith(SLOT_NODE_ID + "."))) return;
983
+ do {
984
+ if (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (!slottedNode["getAttribute"] || !slottedNode.getAttribute("slot")) && (slottedNode.nodeType === 8 /* CommentNode */ || slottedNode.nodeType === 3 /* TextNode */))) {
985
+ slottedNode["s-sn"] = slotName;
986
+ slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
987
+ }
988
+ slottedNode = slottedNode == null ? void 0 : slottedNode.nextSibling;
989
+ } while (slottedNode && !((_b = slottedNode.nodeValue) == null ? void 0 : _b.startsWith(SLOT_NODE_ID + ".")));
990
+ };
991
+ var findCorrespondingNode = (node, type) => {
992
+ let sibling = node;
993
+ do {
994
+ sibling = sibling.nextSibling;
995
+ } while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
996
+ return sibling;
997
+ };
998
+
481
999
  // src/runtime/normalize-watchers.ts
482
1000
  var normalizeWatchers = (raw) => {
483
1001
  if (!raw) return void 0;
@@ -503,8 +1021,123 @@ var normalizeWatchers = (raw) => {
503
1021
  return out;
504
1022
  };
505
1023
 
1024
+ // src/utils/remote-value.ts
1025
+ var RemoteValue = class _RemoteValue {
1026
+ /**
1027
+ * Deserializes a LocalValue serialized object back to its original JavaScript representation
1028
+ *
1029
+ * @param serialized The serialized LocalValue object
1030
+ * @returns The original JavaScript value/object
1031
+ */
1032
+ static fromLocalValue(serialized) {
1033
+ const type = serialized[TYPE_CONSTANT];
1034
+ const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
1035
+ switch (type) {
1036
+ case "string" /* String */:
1037
+ return value;
1038
+ case "boolean" /* Boolean */:
1039
+ return value;
1040
+ case "bigint" /* BigInt */:
1041
+ return BigInt(value);
1042
+ case "undefined" /* Undefined */:
1043
+ return void 0;
1044
+ case "null" /* Null */:
1045
+ return null;
1046
+ case "number" /* Number */:
1047
+ if (value === "NaN") return NaN;
1048
+ if (value === "-0") return -0;
1049
+ if (value === "Infinity") return Infinity;
1050
+ if (value === "-Infinity") return -Infinity;
1051
+ return value;
1052
+ case "array" /* Array */:
1053
+ return value.map((item) => _RemoteValue.fromLocalValue(item));
1054
+ case "date" /* Date */:
1055
+ return new Date(value);
1056
+ case "map" /* Map */:
1057
+ const map = /* @__PURE__ */ new Map();
1058
+ for (const [key, val] of value) {
1059
+ const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
1060
+ const deserializedValue = _RemoteValue.fromLocalValue(val);
1061
+ map.set(deserializedKey, deserializedValue);
1062
+ }
1063
+ return map;
1064
+ case "object" /* Object */:
1065
+ const obj = {};
1066
+ for (const [key, val] of value) {
1067
+ obj[key] = _RemoteValue.fromLocalValue(val);
1068
+ }
1069
+ return obj;
1070
+ case "regexp" /* RegularExpression */:
1071
+ const { pattern, flags } = value;
1072
+ return new RegExp(pattern, flags);
1073
+ case "set" /* Set */:
1074
+ const set = /* @__PURE__ */ new Set();
1075
+ for (const item of value) {
1076
+ set.add(_RemoteValue.fromLocalValue(item));
1077
+ }
1078
+ return set;
1079
+ case "symbol" /* Symbol */:
1080
+ return Symbol(value);
1081
+ default:
1082
+ throw new Error(`Unsupported type: ${type}`);
1083
+ }
1084
+ }
1085
+ /**
1086
+ * Utility method to deserialize multiple LocalValues at once
1087
+ *
1088
+ * @param serializedValues Array of serialized LocalValue objects
1089
+ * @returns Array of deserialized JavaScript values
1090
+ */
1091
+ static fromLocalValueArray(serializedValues) {
1092
+ return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
1093
+ }
1094
+ /**
1095
+ * Verifies if the given object matches the structure of a serialized LocalValue
1096
+ *
1097
+ * @param obj Object to verify
1098
+ * @returns boolean indicating if the object has LocalValue structure
1099
+ */
1100
+ static isLocalValueObject(obj) {
1101
+ if (typeof obj !== "object" || obj === null) {
1102
+ return false;
1103
+ }
1104
+ if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
1105
+ return false;
1106
+ }
1107
+ const type = obj[TYPE_CONSTANT];
1108
+ const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
1109
+ if (!hasTypeProperty) {
1110
+ return false;
1111
+ }
1112
+ if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
1113
+ return obj.hasOwnProperty(VALUE_CONSTANT);
1114
+ }
1115
+ return true;
1116
+ }
1117
+ };
1118
+
1119
+ // src/utils/serialize.ts
1120
+ function decodeBase64Unicode(base64) {
1121
+ const binary = atob(base64);
1122
+ const bytes = new Uint8Array(binary.length);
1123
+ for (let i2 = 0; i2 < binary.length; i2++) {
1124
+ bytes[i2] = binary.charCodeAt(i2);
1125
+ }
1126
+ return new TextDecoder().decode(bytes);
1127
+ }
1128
+ function deserializeProperty(value) {
1129
+ if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
1130
+ return value;
1131
+ }
1132
+ return RemoteValue.fromLocalValue(JSON.parse(decodeBase64Unicode(value.slice(SERIALIZED_PREFIX.length))));
1133
+ }
1134
+
506
1135
  // src/runtime/parse-property-value.ts
507
1136
  var parsePropertyValue = (propValue, propType, isFormAssociated) => {
1137
+ if (typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
1138
+ propValue = deserializeProperty(propValue);
1139
+ return propValue;
1140
+ }
508
1141
  if (propValue != null && !isComplexType(propValue)) {
509
1142
  if (propType & 4 /* Boolean */) {
510
1143
  {
@@ -552,7 +1185,15 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
552
1185
  const classList = elm.classList;
553
1186
  const oldClasses = parseClassList(oldValue);
554
1187
  let newClasses = parseClassList(newValue);
555
- {
1188
+ if ((elm["s-si"] || elm["s-sc"]) && initialRender) {
1189
+ const scopeId2 = elm["s-sc"] || elm["s-si"];
1190
+ newClasses.push(scopeId2);
1191
+ oldClasses.forEach((c) => {
1192
+ if (c.startsWith(scopeId2)) newClasses.push(c);
1193
+ });
1194
+ newClasses = [...new Set(newClasses)].filter((c) => c);
1195
+ classList.add(...newClasses);
1196
+ } else {
556
1197
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
557
1198
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
558
1199
  }
@@ -702,7 +1343,9 @@ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
702
1343
  oldVnodeAttrs[memberName],
703
1344
  void 0,
704
1345
  isSvgMode2,
705
- newVnode.$flags$);
1346
+ newVnode.$flags$,
1347
+ isInitialRender
1348
+ );
706
1349
  }
707
1350
  }
708
1351
  }
@@ -713,7 +1356,9 @@ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
713
1356
  oldVnodeAttrs[memberName],
714
1357
  newVnodeAttrs[memberName],
715
1358
  isSvgMode2,
716
- newVnode.$flags$);
1359
+ newVnode.$flags$,
1360
+ isInitialRender
1361
+ );
717
1362
  }
718
1363
  };
719
1364
  function sortedAttrNames(attrNames) {
@@ -912,7 +1557,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
912
1557
  isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
913
1558
  }
914
1559
  {
915
- updateElement(oldVNode, newVNode2, isSvgMode);
1560
+ updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
916
1561
  }
917
1562
  if (oldChildren !== null && newChildren !== null) {
918
1563
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -926,7 +1571,9 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
926
1571
  !isInitialRender && BUILD.updatable && oldChildren !== null
927
1572
  ) {
928
1573
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
929
- } else ;
1574
+ } else if (isInitialRender && BUILD.updatable && oldChildren !== null && newChildren === null) {
1575
+ newVNode2.$children$ = oldChildren;
1576
+ }
930
1577
  if (isSvgMode && tag === "svg") {
931
1578
  isSvgMode = false;
932
1579
  }
@@ -1146,7 +1793,13 @@ var postUpdateComponent = (hostRef) => {
1146
1793
  }
1147
1794
  };
1148
1795
  var appDidLoad = (who) => {
1796
+ var _a;
1149
1797
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
1798
+ {
1799
+ if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) {
1800
+ plt.$orgLocNodes$.clear();
1801
+ }
1802
+ }
1150
1803
  };
1151
1804
  var safeCall = (instance, method, arg, elm) => {
1152
1805
  if (instance && instance[method]) {
@@ -1473,10 +2126,21 @@ var connectedCallback = (elm) => {
1473
2126
  const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1474
2127
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1475
2128
  hostRef.$flags$ |= 1 /* hasConnected */;
2129
+ let hostId;
2130
+ {
2131
+ hostId = elm.getAttribute(HYDRATE_ID);
2132
+ if (hostId) {
2133
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2134
+ const scopeId2 = addStyle(elm.shadowRoot, cmpMeta);
2135
+ elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
2136
+ }
2137
+ initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
2138
+ }
2139
+ }
1476
2140
  {
1477
2141
  let ancestorComponent = elm;
1478
2142
  while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
1479
- if (ancestorComponent["s-p"]) {
2143
+ if (ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
1480
2144
  attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
1481
2145
  break;
1482
2146
  }
@@ -1552,6 +2216,12 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1552
2216
  let isBootstrapping = true;
1553
2217
  Object.assign(plt, options);
1554
2218
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
2219
+ {
2220
+ plt.$flags$ |= 2 /* appLoaded */;
2221
+ }
2222
+ {
2223
+ hydrateScopedToShadow();
2224
+ }
1555
2225
  lazyBundles.map((lazyBundle) => {
1556
2226
  lazyBundle[1].map((compactMeta) => {
1557
2227
  var _a2, _b;