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