@gurpinderjitsingh/recipe-ui 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/cjs/app-modal_7.cjs.entry.js +7 -3
  2. package/dist/cjs/app-toast.cjs.entry.js +1 -1
  3. package/dist/cjs/{index-CRcwY0Fb.js → index-0Jp0srDV.js} +416 -6
  4. package/dist/cjs/index.cjs.js +1 -1
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/recipe-ui.cjs.js +2 -2
  7. package/dist/collection/components/app-modal/app-modal.css +41 -8
  8. package/dist/collection/components/app-modal/app-modal.js +5 -2
  9. package/dist/components/app-modal.js +1 -1
  10. package/dist/components/app-toast.js +1 -1
  11. package/dist/components/index.js +1 -1
  12. package/dist/components/meal-plan-day.js +1 -1
  13. package/dist/components/p-BioNY75Q.js +1 -0
  14. package/dist/components/{p-BZBToMAv.js → p-BjeRE-Yp.js} +1 -1
  15. package/dist/components/{p-COHQTgKC.js → p-C300pX48.js} +1 -1
  16. package/dist/components/{p-DsyQvPDo.js → p-Cn-9hkL0.js} +1 -1
  17. package/dist/components/{p-BekLK-Pb.js → p-CwBR8qrC.js} +1 -1
  18. package/dist/components/{p-kbrkhGSm.js → p-D4_zWccP.js} +1 -1
  19. package/dist/components/{p-B4H61SFd.js → p-DzNqfLiF.js} +1 -1
  20. package/dist/components/{p-BRKGu69u.js → p-iruuKwXb.js} +1 -1
  21. package/dist/components/p-q8BcbM65.js +1 -0
  22. package/dist/components/recipe-card.js +1 -1
  23. package/dist/components/recipe-filter-bar.js +1 -1
  24. package/dist/components/recipe-form.js +1 -1
  25. package/dist/components/recipe-rating.js +1 -1
  26. package/dist/components/recipe-search-bar.js +1 -1
  27. package/dist/esm/app-modal_7.entry.js +7 -3
  28. package/dist/esm/app-toast.entry.js +1 -1
  29. package/dist/esm/{index-CrZUP9M-.js → index-Cq6PCsWh.js} +416 -6
  30. package/dist/esm/index.js +1 -1
  31. package/dist/esm/loader.js +3 -3
  32. package/dist/esm/recipe-ui.js +3 -3
  33. package/dist/recipe-ui/index.esm.js +1 -1
  34. package/dist/recipe-ui/{p-6ef28048.entry.js → p-47428346.entry.js} +1 -1
  35. package/dist/recipe-ui/{p-e2f3c9b9.entry.js → p-6add6efb.entry.js} +1 -1
  36. package/dist/recipe-ui/p-Cq6PCsWh.js +3 -0
  37. package/dist/recipe-ui/recipe-ui.esm.js +1 -1
  38. package/package.json +1 -1
  39. package/dist/components/p-BJJZH_Cc.js +0 -1
  40. package/dist/components/p-BJU3HdRm.js +0 -1
  41. package/dist/recipe-ui/p-CrZUP9M-.js +0 -3
@@ -1,5 +1,5 @@
1
1
  const NAMESPACE = 'recipe-ui';
2
- const BUILD = /* recipe-ui */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, state: true, updatable: true};
2
+ const BUILD = /* recipe-ui */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, slotRelocation: true, state: true, updatable: true};
3
3
 
4
4
  /*
5
5
  Stencil Client Platform v4.44.0 | MIT Licensed | https://stenciljs.com
@@ -215,6 +215,125 @@ function createShadowRoot(cmpMeta) {
215
215
  }
216
216
  }
217
217
  }
218
+ var updateFallbackSlotVisibility = (elm) => {
219
+ const childNodes = internalCall(elm, "childNodes");
220
+ if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
221
+ getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
222
+ if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
223
+ if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
224
+ slotNode.hidden = true;
225
+ } else {
226
+ slotNode.hidden = false;
227
+ }
228
+ }
229
+ });
230
+ }
231
+ let i2 = 0;
232
+ for (i2 = 0; i2 < childNodes.length; i2++) {
233
+ const childNode = childNodes[i2];
234
+ if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
235
+ updateFallbackSlotVisibility(childNode);
236
+ }
237
+ }
238
+ };
239
+ var getSlottedChildNodes = (childNodes) => {
240
+ const result = [];
241
+ for (let i2 = 0; i2 < childNodes.length; i2++) {
242
+ const slottedNode = childNodes[i2]["s-nr"] || void 0;
243
+ if (slottedNode && slottedNode.isConnected) {
244
+ result.push(slottedNode);
245
+ }
246
+ }
247
+ return result;
248
+ };
249
+ function getHostSlotNodes(childNodes, hostName, slotName) {
250
+ let i2 = 0;
251
+ let slottedNodes = [];
252
+ let childNode;
253
+ for (; i2 < childNodes.length; i2++) {
254
+ childNode = childNodes[i2];
255
+ if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
256
+ slottedNodes.push(childNode);
257
+ if (typeof slotName !== "undefined") return slottedNodes;
258
+ }
259
+ slottedNodes = [...slottedNodes, ...getHostSlotNodes(internalCall(childNode, "childNodes"), hostName, slotName)];
260
+ }
261
+ return slottedNodes;
262
+ }
263
+ var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
264
+ const childNodes = [];
265
+ if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
266
+ let node = slot;
267
+ while (node = node.nextSibling) {
268
+ if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
269
+ }
270
+ return childNodes;
271
+ };
272
+ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
273
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
274
+ if (nodeToRelocate.getAttribute("slot") === null && slotName === "") {
275
+ return true;
276
+ }
277
+ if (nodeToRelocate.getAttribute("slot") === slotName) {
278
+ return true;
279
+ }
280
+ return false;
281
+ }
282
+ if (nodeToRelocate["s-sn"] === slotName) {
283
+ return true;
284
+ }
285
+ return slotName === "";
286
+ };
287
+ var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
288
+ function patchSlotNode(node) {
289
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
290
+ const assignedFactory = (elementsOnly) => (function(opts) {
291
+ const toReturn = [];
292
+ const slotName = this["s-sn"];
293
+ if (opts == null ? void 0 : opts.flatten) {
294
+ console.error(`
295
+ Flattening is not supported for Stencil non-shadow slots.
296
+ You can use \`.childNodes\` to nested slot fallback content.
297
+ If you have a particular use case, please open an issue on the Stencil repo.
298
+ `);
299
+ }
300
+ const parent = this["s-cr"].parentElement;
301
+ const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
302
+ slottedNodes.forEach((n) => {
303
+ if (slotName === getSlotName(n)) {
304
+ toReturn.push(n);
305
+ }
306
+ });
307
+ if (elementsOnly) {
308
+ return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
309
+ }
310
+ return toReturn;
311
+ }).bind(node);
312
+ node.assignedElements = assignedFactory(true);
313
+ node.assignedNodes = assignedFactory(false);
314
+ }
315
+ function dispatchSlotChangeEvent(elm) {
316
+ elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
317
+ }
318
+ function findSlotFromSlottedNode(slottedNode, parentHost) {
319
+ var _a;
320
+ parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
321
+ if (!parentHost) return { slotNode: null, slotName: "" };
322
+ const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
323
+ const childNodes = internalCall(parentHost, "childNodes");
324
+ const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
325
+ return { slotNode, slotName };
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
+ }
218
337
  var createTime = (fnName, tagName = "") => {
219
338
  {
220
339
  return () => {
@@ -369,6 +488,7 @@ var h = (nodeName, vnodeData, ...children) => {
369
488
  }
370
489
  let child = null;
371
490
  let key = null;
491
+ let slotName = null;
372
492
  let simple = false;
373
493
  let lastSimple = false;
374
494
  const vNodeChildren = [];
@@ -400,6 +520,9 @@ var h = (nodeName, vnodeData, ...children) => {
400
520
  if (vnodeData.key) {
401
521
  key = vnodeData.key;
402
522
  }
523
+ if (vnodeData.name) {
524
+ slotName = vnodeData.name;
525
+ }
403
526
  {
404
527
  const classData = vnodeData.className || vnodeData.class;
405
528
  if (classData) {
@@ -415,6 +538,9 @@ var h = (nodeName, vnodeData, ...children) => {
415
538
  {
416
539
  vnode.$key$ = key;
417
540
  }
541
+ {
542
+ vnode.$name$ = slotName;
543
+ }
418
544
  return vnode;
419
545
  };
420
546
  var newVNode = (tag, text) => {
@@ -432,6 +558,9 @@ var newVNode = (tag, text) => {
432
558
  {
433
559
  vnode.$key$ = null;
434
560
  }
561
+ {
562
+ vnode.$name$ = null;
563
+ }
435
564
  return vnode;
436
565
  };
437
566
  var Host = {};
@@ -651,22 +780,47 @@ function sortedAttrNames(attrNames) {
651
780
  attrNames
652
781
  );
653
782
  }
783
+ var contentRef;
654
784
  var hostTagName;
655
785
  var useNativeShadowDom = false;
786
+ var checkSlotFallbackVisibility = false;
787
+ var checkSlotRelocate = false;
656
788
  var isSvgMode = false;
657
789
  var createElm = (oldParentVNode, newParentVNode, childIndex) => {
790
+ var _a;
658
791
  const newVNode2 = newParentVNode.$children$[childIndex];
659
792
  let i2 = 0;
660
793
  let elm;
661
794
  let childNode;
795
+ let oldVNode;
796
+ if (!useNativeShadowDom) {
797
+ checkSlotRelocate = true;
798
+ if (newVNode2.$tag$ === "slot") {
799
+ newVNode2.$flags$ |= newVNode2.$children$ ? (
800
+ // slot element has fallback content
801
+ // still create an element that "mocks" the slot element
802
+ 2 /* isSlotFallback */
803
+ ) : (
804
+ // slot element does not have fallback content
805
+ // create an html comment we'll use to always reference
806
+ // where actual slot content should sit next to
807
+ 1 /* isSlotReference */
808
+ );
809
+ }
810
+ }
662
811
  if (newVNode2.$text$ != null) {
663
812
  elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
813
+ } else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
814
+ elm = newVNode2.$elm$ = win.document.createTextNode("");
815
+ {
816
+ updateElement(null, newVNode2, isSvgMode);
817
+ }
664
818
  } else {
665
819
  if (!win.document) {
666
820
  throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
667
821
  }
668
822
  elm = newVNode2.$elm$ = win.document.createElement(
669
- newVNode2.$tag$
823
+ !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
670
824
  );
671
825
  {
672
826
  updateElement(null, newVNode2, isSvgMode);
@@ -682,6 +836,19 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
682
836
  }
683
837
  }
684
838
  elm["s-hn"] = hostTagName;
839
+ {
840
+ if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
841
+ elm["s-sr"] = true;
842
+ elm["s-cr"] = contentRef;
843
+ elm["s-sn"] = newVNode2.$name$ || "";
844
+ elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
845
+ patchSlotNode(elm);
846
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
847
+ if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
848
+ relocateToHostRoot(oldParentVNode.$elm$);
849
+ }
850
+ }
851
+ }
685
852
  return elm;
686
853
  };
687
854
  var relocateToHostRoot = (parentElm) => {
@@ -698,13 +865,40 @@ var relocateToHostRoot = (parentElm) => {
698
865
  if (childNode["s-sh"] != null) {
699
866
  insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
700
867
  childNode["s-sh"] = void 0;
868
+ checkSlotRelocate = true;
701
869
  }
702
870
  }
703
871
  }
704
872
  plt.$flags$ &= -2 /* isTmpDisconnected */;
705
873
  };
874
+ var putBackInOriginalLocation = (parentElm, recursive) => {
875
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
876
+ const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
877
+ if (parentElm["s-sr"]) {
878
+ let node = parentElm;
879
+ while (node = node.nextSibling) {
880
+ if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
881
+ oldSlotChildNodes.push(node);
882
+ }
883
+ }
884
+ }
885
+ for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
886
+ const childNode = oldSlotChildNodes[i2];
887
+ if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
888
+ insertBefore(referenceNode(childNode).parentNode, childNode, referenceNode(childNode));
889
+ childNode["s-ol"].remove();
890
+ childNode["s-ol"] = void 0;
891
+ childNode["s-sh"] = void 0;
892
+ checkSlotRelocate = true;
893
+ }
894
+ if (recursive) {
895
+ putBackInOriginalLocation(childNode, recursive);
896
+ }
897
+ }
898
+ plt.$flags$ &= -2 /* isTmpDisconnected */;
899
+ };
706
900
  var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
707
- let containerElm = parentElm;
901
+ let containerElm = parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
708
902
  let childNode;
709
903
  if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
710
904
  containerElm = containerElm.shadowRoot;
@@ -717,7 +911,7 @@ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
717
911
  childNode = createElm(null, parentVNode, startIdx);
718
912
  if (childNode) {
719
913
  vnodes[startIdx].$elm$ = childNode;
720
- insertBefore(containerElm, childNode, before);
914
+ insertBefore(containerElm, childNode, referenceNode(before) );
721
915
  }
722
916
  }
723
917
  }
@@ -728,6 +922,14 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
728
922
  if (vnode) {
729
923
  const elm = vnode.$elm$;
730
924
  if (elm) {
925
+ {
926
+ checkSlotFallbackVisibility = true;
927
+ if (elm["s-ol"]) {
928
+ elm["s-ol"].remove();
929
+ } else {
930
+ putBackInOriginalLocation(elm, true);
931
+ }
932
+ }
731
933
  elm.remove();
732
934
  }
733
935
  }
@@ -765,11 +967,17 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
765
967
  oldEndVnode = oldCh[--oldEndIdx];
766
968
  newEndVnode = newCh[--newEndIdx];
767
969
  } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
970
+ if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
971
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
972
+ }
768
973
  patch(oldStartVnode, newEndVnode, isInitialRender);
769
974
  insertBefore(containerElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
770
975
  oldStartVnode = oldCh[++oldStartIdx];
771
976
  newEndVnode = newCh[--newEndIdx];
772
977
  } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
978
+ if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
979
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
980
+ }
773
981
  patch(oldEndVnode, newStartVnode, isInitialRender);
774
982
  insertBefore(containerElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
775
983
  oldEndVnode = oldCh[--oldEndIdx];
@@ -800,7 +1008,11 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
800
1008
  }
801
1009
  if (node) {
802
1010
  {
803
- insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
1011
+ insertBefore(
1012
+ referenceNode(oldStartVnode.$elm$).parentNode,
1013
+ node,
1014
+ referenceNode(oldStartVnode.$elm$)
1015
+ );
804
1016
  }
805
1017
  }
806
1018
  }
@@ -820,6 +1032,9 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
820
1032
  };
821
1033
  var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
822
1034
  if (leftVNode.$tag$ === rightVNode.$tag$) {
1035
+ if (leftVNode.$tag$ === "slot") {
1036
+ return leftVNode.$name$ === rightVNode.$name$;
1037
+ }
823
1038
  if (!isInitialRender) {
824
1039
  return leftVNode.$key$ === rightVNode.$key$;
825
1040
  }
@@ -830,12 +1045,14 @@ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
830
1045
  }
831
1046
  return false;
832
1047
  };
1048
+ var referenceNode = (node) => node && node["s-ol"] || node;
833
1049
  var patch = (oldVNode, newVNode2, isInitialRender = false) => {
834
1050
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
835
1051
  const oldChildren = oldVNode.$children$;
836
1052
  const newChildren = newVNode2.$children$;
837
1053
  const tag = newVNode2.$tag$;
838
1054
  const text = newVNode2.$text$;
1055
+ let defaultHolder;
839
1056
  if (text == null) {
840
1057
  {
841
1058
  if (tag === "slot" && !useNativeShadowDom) {
@@ -859,11 +1076,74 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
859
1076
  ) {
860
1077
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
861
1078
  } else ;
1079
+ } else if ((defaultHolder = elm["s-cr"])) {
1080
+ defaultHolder.parentNode.textContent = text;
862
1081
  } else if (oldVNode.$text$ !== text) {
863
1082
  elm.data = text;
864
1083
  }
865
1084
  };
1085
+ var relocateNodes = [];
1086
+ var markSlotContentForRelocation = (elm) => {
1087
+ let node;
1088
+ let hostContentNodes;
1089
+ let j;
1090
+ const children = elm.__childNodes || elm.childNodes;
1091
+ for (const childNode of children) {
1092
+ if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
1093
+ hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
1094
+ const slotName = childNode["s-sn"];
1095
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
1096
+ node = hostContentNodes[j];
1097
+ if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && // let an exact named-slot match override a stale default-slot claim. Skip this for
1098
+ // `slotName === ''` itself - a matched default node's cached `s-sn` is `''` too, which
1099
+ // would trivially "match" on every re-render and force pointless re-insertion.
1100
+ (!node["s-sh"] || node["s-sh"] !== childNode["s-hn"] || slotName !== "" && getSlotName(node) === slotName)) {
1101
+ if (isNodeLocatedInSlot(node, slotName)) {
1102
+ let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1103
+ checkSlotFallbackVisibility = true;
1104
+ node["s-sn"] = node["s-sn"] || slotName;
1105
+ if (relocateNodeData) {
1106
+ relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
1107
+ relocateNodeData.$slotRefNode$ = childNode;
1108
+ } else {
1109
+ node["s-sh"] = childNode["s-hn"];
1110
+ relocateNodes.push({
1111
+ $slotRefNode$: childNode,
1112
+ $nodeToRelocate$: node
1113
+ });
1114
+ }
1115
+ if (node["s-sr"]) {
1116
+ relocateNodes.map((relocateNode) => {
1117
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
1118
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1119
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
1120
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1121
+ }
1122
+ }
1123
+ });
1124
+ }
1125
+ } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
1126
+ relocateNodes.push({
1127
+ $nodeToRelocate$: node
1128
+ });
1129
+ }
1130
+ }
1131
+ }
1132
+ }
1133
+ if (childNode.nodeType === 1 /* ElementNode */) {
1134
+ markSlotContentForRelocation(childNode);
1135
+ }
1136
+ }
1137
+ };
866
1138
  var insertBefore = (parent, newNode, reference, isInitialLoad) => {
1139
+ {
1140
+ if (typeof newNode["s-sn"] === "string") {
1141
+ parent.insertBefore(newNode, reference);
1142
+ const { slotNode } = findSlotFromSlottedNode(newNode);
1143
+ if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);
1144
+ return newNode;
1145
+ }
1146
+ }
867
1147
  if (parent.__insertBefore) {
868
1148
  return parent.__insertBefore(newNode, reference);
869
1149
  } else {
@@ -871,6 +1151,7 @@ var insertBefore = (parent, newNode, reference, isInitialLoad) => {
871
1151
  }
872
1152
  };
873
1153
  var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1154
+ var _a, _b, _c, _d, _e;
874
1155
  const hostElm = hostRef.$hostElement$;
875
1156
  const cmpMeta = hostRef.$cmpMeta$;
876
1157
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
@@ -889,7 +1170,106 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
889
1170
  hostRef.$vnode$ = rootVnode;
890
1171
  rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
891
1172
  useNativeShadowDom = !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
1173
+ {
1174
+ contentRef = hostElm["s-cr"];
1175
+ checkSlotFallbackVisibility = false;
1176
+ }
892
1177
  patch(oldVNode, rootVnode, isInitialLoad);
1178
+ {
1179
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
1180
+ if (checkSlotRelocate) {
1181
+ markSlotContentForRelocation(rootVnode.$elm$);
1182
+ for (const relocateData of relocateNodes) {
1183
+ const nodeToRelocate = relocateData.$nodeToRelocate$;
1184
+ if (!nodeToRelocate["s-ol"] && win.document) {
1185
+ const orgLocationNode = win.document.createTextNode("");
1186
+ orgLocationNode["s-nr"] = nodeToRelocate;
1187
+ insertBefore(
1188
+ nodeToRelocate.parentNode,
1189
+ nodeToRelocate["s-ol"] = orgLocationNode,
1190
+ nodeToRelocate,
1191
+ isInitialLoad
1192
+ );
1193
+ }
1194
+ }
1195
+ for (const relocateData of relocateNodes) {
1196
+ const nodeToRelocate = relocateData.$nodeToRelocate$;
1197
+ const slotRefNode = relocateData.$slotRefNode$;
1198
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */ && isInitialLoad) {
1199
+ nodeToRelocate["s-ih"] = (_a = nodeToRelocate.hidden) != null ? _a : false;
1200
+ }
1201
+ if (slotRefNode) {
1202
+ const parentNodeRef = slotRefNode.parentNode;
1203
+ let insertBeforeNode = slotRefNode.nextSibling;
1204
+ if (insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */) {
1205
+ let orgLocationNode = (_b = nodeToRelocate["s-ol"]) == null ? void 0 : _b.previousSibling;
1206
+ while (orgLocationNode) {
1207
+ let refNode = (_c = orgLocationNode["s-nr"]) != null ? _c : null;
1208
+ if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === (refNode.__parentNode || refNode.parentNode)) {
1209
+ refNode = refNode.nextSibling;
1210
+ while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
1211
+ refNode = refNode == null ? void 0 : refNode.nextSibling;
1212
+ }
1213
+ if (!refNode || !refNode["s-nr"]) {
1214
+ insertBeforeNode = refNode;
1215
+ break;
1216
+ }
1217
+ }
1218
+ orgLocationNode = orgLocationNode.previousSibling;
1219
+ }
1220
+ }
1221
+ const parent = nodeToRelocate.__parentNode || nodeToRelocate.parentNode;
1222
+ const nextSibling = nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling;
1223
+ if (!insertBeforeNode && parentNodeRef !== parent || nextSibling !== insertBeforeNode) {
1224
+ if (nodeToRelocate !== insertBeforeNode) {
1225
+ insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode, isInitialLoad);
1226
+ if (nodeToRelocate.nodeType === 8 /* CommentNode */ && nodeToRelocate.nodeValue.startsWith("s-nt-")) {
1227
+ const textNode = win.document.createTextNode(nodeToRelocate.nodeValue.replace(/^s-nt-/, ""));
1228
+ textNode["s-hn"] = nodeToRelocate["s-hn"];
1229
+ textNode["s-sn"] = nodeToRelocate["s-sn"];
1230
+ textNode["s-sh"] = nodeToRelocate["s-sh"];
1231
+ textNode["s-sr"] = nodeToRelocate["s-sr"];
1232
+ textNode["s-ol"] = nodeToRelocate["s-ol"];
1233
+ textNode["s-ol"]["s-nr"] = textNode;
1234
+ insertBefore(nodeToRelocate.parentNode, textNode, nodeToRelocate, isInitialLoad);
1235
+ nodeToRelocate.parentNode.removeChild(nodeToRelocate);
1236
+ }
1237
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
1238
+ nodeToRelocate.hidden = (_d = nodeToRelocate["s-ih"]) != null ? _d : false;
1239
+ }
1240
+ }
1241
+ }
1242
+ nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
1243
+ } else if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1244
+ nodeToRelocate.hidden = true;
1245
+ }
1246
+ }
1247
+ }
1248
+ if (checkSlotFallbackVisibility) {
1249
+ updateFallbackSlotVisibility(rootVnode.$elm$);
1250
+ }
1251
+ plt.$flags$ &= -2 /* isTmpDisconnected */;
1252
+ relocateNodes.length = 0;
1253
+ }
1254
+ if (!useNativeShadowDom && !(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && hostElm["s-cr"]) {
1255
+ const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
1256
+ for (const childNode of children) {
1257
+ if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
1258
+ if (isInitialLoad && childNode["s-ih"] == null) {
1259
+ childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
1260
+ }
1261
+ if (childNode.nodeType === 1 /* ElementNode */) {
1262
+ childNode.hidden = true;
1263
+ } else if (childNode.nodeType === 3 /* TextNode */ && !!childNode.nodeValue.trim()) {
1264
+ const textCommentNode = win.document.createComment("s-nt-" + childNode.nodeValue);
1265
+ textCommentNode["s-sn"] = childNode["s-sn"];
1266
+ insertBefore(childNode.parentNode, textCommentNode, childNode, isInitialLoad);
1267
+ childNode.parentNode.removeChild(childNode);
1268
+ }
1269
+ }
1270
+ }
1271
+ }
1272
+ contentRef = void 0;
893
1273
  };
894
1274
 
895
1275
  // src/runtime/update-component.ts
@@ -935,6 +1315,10 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
935
1315
  let maybePromise;
936
1316
  if (isInitialLoad) {
937
1317
  {
1318
+ if (hostRef.$deferredConnectedCallback$) {
1319
+ hostRef.$deferredConnectedCallback$ = false;
1320
+ safeCall(instance, "connectedCallback", void 0, elm);
1321
+ }
938
1322
  if (hostRef.$fetchedCbList$.length) {
939
1323
  hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
940
1324
  }
@@ -1313,8 +1697,11 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1313
1697
  hostRef.$flags$ |= 128 /* isWatchReady */;
1314
1698
  }
1315
1699
  endNewInstance();
1316
- {
1700
+ const needsDeferredCallback = cmpMeta.$flags$ & 4 /* hasSlotRelocation */;
1701
+ if (!needsDeferredCallback) {
1317
1702
  fireConnectedCallback(hostRef.$lazyInstance$, elm);
1703
+ } else {
1704
+ hostRef.$deferredConnectedCallback$ = true;
1318
1705
  }
1319
1706
  } else {
1320
1707
  Cstr = elm.constructor;
@@ -1369,6 +1756,12 @@ var connectedCallback = (elm) => {
1369
1756
  const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1370
1757
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1371
1758
  hostRef.$flags$ |= 1 /* hasConnected */;
1759
+ {
1760
+ if (// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
1761
+ cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
1762
+ setContentReference(elm);
1763
+ }
1764
+ }
1372
1765
  {
1373
1766
  let ancestorComponent = elm;
1374
1767
  while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
@@ -1402,6 +1795,16 @@ var connectedCallback = (elm) => {
1402
1795
  endConnected();
1403
1796
  }
1404
1797
  };
1798
+ var setContentReference = (elm) => {
1799
+ if (!win.document) {
1800
+ return;
1801
+ }
1802
+ const contentRefElm = elm["s-cr"] = win.document.createComment(
1803
+ ""
1804
+ );
1805
+ contentRefElm["s-cn"] = true;
1806
+ insertBefore(elm, contentRefElm, elm.firstChild);
1807
+ };
1405
1808
  var disconnectInstance = (instance, elm) => {
1406
1809
  {
1407
1810
  safeCall(instance, "disconnectedCallback", void 0, elm || instance);
@@ -1443,6 +1846,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1443
1846
  let isBootstrapping = true;
1444
1847
  Object.assign(plt, options);
1445
1848
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
1849
+ let hasSlotRelocation = false;
1446
1850
  lazyBundles.map((lazyBundle) => {
1447
1851
  lazyBundle[1].map((compactMeta) => {
1448
1852
  var _a2, _b;
@@ -1452,6 +1856,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1452
1856
  $members$: compactMeta[2],
1453
1857
  $listeners$: compactMeta[3]
1454
1858
  };
1859
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
1860
+ hasSlotRelocation = true;
1861
+ }
1455
1862
  {
1456
1863
  cmpMeta.$members$ = compactMeta[2];
1457
1864
  }
@@ -1535,6 +1942,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1535
1942
  });
1536
1943
  });
1537
1944
  if (cmpTags.length > 0) {
1945
+ if (hasSlotRelocation) {
1946
+ dataStyles.textContent += SLOT_FB_CSS;
1947
+ }
1538
1948
  {
1539
1949
  dataStyles.textContent += cmpTags.sort() + HYDRATED_CSS;
1540
1950
  }
package/dist/esm/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export { app_modal as AppModal, meal_plan_day as MealPlanDay, recipe_card as RecipeCard, recipe_filter_bar as RecipeFilterBar, recipe_form as RecipeForm, recipe_rating as RecipeRating, recipe_search_bar as RecipeSearchBar } from './app-modal.meal-plan-day.recipe-card.recipe-filter-bar.recipe-form.recipe-rating.recipe-search-bar.entry.js';
2
2
  export { app_toast as AppToast } from './app-toast.entry.js';
3
- import './index-CrZUP9M-.js';
3
+ import './index-Cq6PCsWh.js';
@@ -1,11 +1,11 @@
1
- import { b as bootstrapLazy } from './index-CrZUP9M-.js';
2
- export { s as setNonce } from './index-CrZUP9M-.js';
1
+ import { b as bootstrapLazy } from './index-Cq6PCsWh.js';
2
+ export { s as setNonce } from './index-Cq6PCsWh.js';
3
3
  import { g as globalScripts } from './app-globals-DQuL1Twl.js';
4
4
 
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["app-modal_7",[[257,"app-modal",{"open":[4],"modalTitle":[1,"modal-title"]}],[1,"meal-plan-day",{"day":[1],"meals":[16]}],[257,"recipe-card",{"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"title":[32],"image":[32],"category":[32],"ingredients":[32],"instructions":[32],"errors":[32]},null,{"initialData":[{"onInitialDataChange":0}]}],[1,"recipe-rating",{"value":[2],"readonly":[4],"max":[2]}],[1,"recipe-search-bar",{"placeholder":[1],"value":[1],"debounceMs":[2,"debounce-ms"],"internalValue":[32]},null,{"value":[{"onValuePropChange":0}]}]]],["app-toast",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
8
+ return bootstrapLazy([["app-modal_7",[[260,"app-modal",{"open":[4],"modalTitle":[1,"modal-title"]}],[1,"meal-plan-day",{"day":[1],"meals":[16]}],[257,"recipe-card",{"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"title":[32],"image":[32],"category":[32],"ingredients":[32],"instructions":[32],"errors":[32]},null,{"initialData":[{"onInitialDataChange":0}]}],[1,"recipe-rating",{"value":[2],"readonly":[4],"max":[2]}],[1,"recipe-search-bar",{"placeholder":[1],"value":[1],"debounceMs":[2,"debounce-ms"],"internalValue":[32]},null,{"value":[{"onValuePropChange":0}]}]]],["app-toast",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };
@@ -1,5 +1,5 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-CrZUP9M-.js';
2
- export { s as setNonce } from './index-CrZUP9M-.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-Cq6PCsWh.js';
2
+ export { s as setNonce } from './index-Cq6PCsWh.js';
3
3
  import { g as globalScripts } from './app-globals-DQuL1Twl.js';
4
4
 
5
5
  /*
@@ -17,5 +17,5 @@ var patchBrowser = () => {
17
17
 
18
18
  patchBrowser().then(async (options) => {
19
19
  await globalScripts();
20
- return bootstrapLazy([["app-modal_7",[[257,"app-modal",{"open":[4],"modalTitle":[1,"modal-title"]}],[1,"meal-plan-day",{"day":[1],"meals":[16]}],[257,"recipe-card",{"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"title":[32],"image":[32],"category":[32],"ingredients":[32],"instructions":[32],"errors":[32]},null,{"initialData":[{"onInitialDataChange":0}]}],[1,"recipe-rating",{"value":[2],"readonly":[4],"max":[2]}],[1,"recipe-search-bar",{"placeholder":[1],"value":[1],"debounceMs":[2,"debounce-ms"],"internalValue":[32]},null,{"value":[{"onValuePropChange":0}]}]]],["app-toast",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
20
+ return bootstrapLazy([["app-modal_7",[[260,"app-modal",{"open":[4],"modalTitle":[1,"modal-title"]}],[1,"meal-plan-day",{"day":[1],"meals":[16]}],[257,"recipe-card",{"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"title":[32],"image":[32],"category":[32],"ingredients":[32],"instructions":[32],"errors":[32]},null,{"initialData":[{"onInitialDataChange":0}]}],[1,"recipe-rating",{"value":[2],"readonly":[4],"max":[2]}],[1,"recipe-search-bar",{"placeholder":[1],"value":[1],"debounceMs":[2,"debounce-ms"],"internalValue":[32]},null,{"value":[{"onValuePropChange":0}]}]]],["app-toast",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
21
21
  });
@@ -1 +1 @@
1
- export{app_modal as AppModal,meal_plan_day as MealPlanDay,recipe_card as RecipeCard,recipe_filter_bar as RecipeFilterBar,recipe_form as RecipeForm,recipe_rating as RecipeRating,recipe_search_bar as RecipeSearchBar}from"./app-modal.meal-plan-day.recipe-card.recipe-filter-bar.recipe-form.recipe-rating.recipe-search-bar.entry.esm.js";export{app_toast as AppToast}from"./app-toast.entry.esm.js";import"./p-CrZUP9M-.js";
1
+ export{app_modal as AppModal,meal_plan_day as MealPlanDay,recipe_card as RecipeCard,recipe_filter_bar as RecipeFilterBar,recipe_form as RecipeForm,recipe_rating as RecipeRating,recipe_search_bar as RecipeSearchBar}from"./app-modal.meal-plan-day.recipe-card.recipe-filter-bar.recipe-form.recipe-rating.recipe-search-bar.entry.esm.js";export{app_toast as AppToast}from"./app-toast.entry.esm.js";import"./p-Cq6PCsWh.js";
@@ -1 +1 @@
1
- import{r as s,c as t,h as o}from"./p-CrZUP9M-.js";const a=class{constructor(o){s(this,o),this.dismiss=t(this,"dismiss"),this.message="",this.type="info",this.duration=3e3}componentDidLoad(){this.duration>0&&setTimeout((()=>this.dismiss.emit()),this.duration)}render(){return o("div",{key:"d9dcb405ffd97bfa44fee10fe49103bd021938a2",class:`toast ${this.type}`},o("span",{key:"5fd291b9766dc41189f49c11c836654d6663c8d1"},this.message),o("button",{key:"9f93921f20b17520ce339378c5a1ca66ef6a04bc",onClick:()=>this.dismiss.emit(),"aria-label":"Dismiss"},"✕"))}};a.style=":host{font-family:system-ui, sans-serif;display:block}.toast{display:flex;align-items:center;gap:10px;padding:10px 16px;border-radius:8px;color:#fff;font-size:14px;box-shadow:0 4px 12px rgba(0,0,0,0.15)}.toast.success{background:#2ecc71}.toast.error{background:#e74c3c}.toast.info{background:#3498db}button{border:none;background:none;color:inherit;cursor:pointer;margin-left:auto}";export{a as app_toast}
1
+ import{r as s,c as t,h as o}from"./p-Cq6PCsWh.js";const a=class{constructor(o){s(this,o),this.dismiss=t(this,"dismiss"),this.message="",this.type="info",this.duration=3e3}componentDidLoad(){this.duration>0&&setTimeout((()=>this.dismiss.emit()),this.duration)}render(){return o("div",{key:"d9dcb405ffd97bfa44fee10fe49103bd021938a2",class:`toast ${this.type}`},o("span",{key:"5fd291b9766dc41189f49c11c836654d6663c8d1"},this.message),o("button",{key:"9f93921f20b17520ce339378c5a1ca66ef6a04bc",onClick:()=>this.dismiss.emit(),"aria-label":"Dismiss"},"✕"))}};a.style=":host{font-family:system-ui, sans-serif;display:block}.toast{display:flex;align-items:center;gap:10px;padding:10px 16px;border-radius:8px;color:#fff;font-size:14px;box-shadow:0 4px 12px rgba(0,0,0,0.15)}.toast.success{background:#2ecc71}.toast.error{background:#e74c3c}.toast.info{background:#3498db}button{border:none;background:none;color:inherit;cursor:pointer;margin-left:auto}";export{a as app_toast}