@measured/puck 0.20.0-canary.77cef35d → 0.20.0-canary.7ec3c0b9

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.
@@ -2,46 +2,91 @@ import {
2
2
  SlotRender,
3
3
  SlotRenderPure,
4
4
  __async,
5
+ __commonJS,
5
6
  __objRest,
6
7
  __spreadProps,
7
8
  __spreadValues,
8
- appStoreContext,
9
- createAppStore,
9
+ __toESM,
10
10
  defaultAppState,
11
11
  defaultSlots,
12
12
  defaultViewports,
13
13
  expandNode,
14
- generateId,
15
- getBox,
16
- getInlineTextTransform,
17
- getItem,
14
+ getChanged,
18
15
  getSlotTransform,
19
- get_class_name_factory_default,
20
16
  init_react_import,
21
- insert,
22
- insertAction,
23
- makeStatePublic,
24
- monitorHotkeys,
25
- populateIds,
26
- reorder,
27
- replace,
17
+ resolveComponentData,
28
18
  rootAreaId,
29
19
  rootDroppableId,
30
20
  rootZone,
31
21
  setupZone,
32
- useAppStore,
33
- useAppStoreApi,
34
22
  useFieldTransforms,
35
- useHotkey,
36
- useMonitorHotkeys,
37
- useRegisterFieldsSlice,
38
- useRegisterHistorySlice,
39
- useRegisterPermissionsSlice,
40
- useResetAutoZoom,
41
23
  useSlots,
42
24
  walkAppState,
43
- walkField
44
- } from "./chunk-IP64IXIP.mjs";
25
+ walkField,
26
+ walkTree
27
+ } from "./chunk-HUKJ36SA.mjs";
28
+
29
+ // ../../node_modules/classnames/index.js
30
+ var require_classnames = __commonJS({
31
+ "../../node_modules/classnames/index.js"(exports, module) {
32
+ "use strict";
33
+ init_react_import();
34
+ (function() {
35
+ "use strict";
36
+ var hasOwn = {}.hasOwnProperty;
37
+ function classNames() {
38
+ var classes = "";
39
+ for (var i = 0; i < arguments.length; i++) {
40
+ var arg = arguments[i];
41
+ if (arg) {
42
+ classes = appendClass(classes, parseValue(arg));
43
+ }
44
+ }
45
+ return classes;
46
+ }
47
+ function parseValue(arg) {
48
+ if (typeof arg === "string" || typeof arg === "number") {
49
+ return arg;
50
+ }
51
+ if (typeof arg !== "object") {
52
+ return "";
53
+ }
54
+ if (Array.isArray(arg)) {
55
+ return classNames.apply(null, arg);
56
+ }
57
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
58
+ return arg.toString();
59
+ }
60
+ var classes = "";
61
+ for (var key in arg) {
62
+ if (hasOwn.call(arg, key) && arg[key]) {
63
+ classes = appendClass(classes, key);
64
+ }
65
+ }
66
+ return classes;
67
+ }
68
+ function appendClass(value, newClass) {
69
+ if (!newClass) {
70
+ return value;
71
+ }
72
+ if (value) {
73
+ return value + " " + newClass;
74
+ }
75
+ return value + newClass;
76
+ }
77
+ if (typeof module !== "undefined" && module.exports) {
78
+ classNames.default = classNames;
79
+ module.exports = classNames;
80
+ } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
81
+ define("classnames", [], function() {
82
+ return classNames;
83
+ });
84
+ } else {
85
+ window.classNames = classNames;
86
+ }
87
+ })();
88
+ }
89
+ });
45
90
 
46
91
  // bundle/index.ts
47
92
  init_react_import();
@@ -100,6 +145,33 @@ init_react_import();
100
145
  // components/ActionBar/index.tsx
101
146
  init_react_import();
102
147
 
148
+ // lib/get-class-name-factory.ts
149
+ init_react_import();
150
+ var import_classnames = __toESM(require_classnames());
151
+ var getClassNameFactory = (rootClass, styles2, config = { baseClass: "" }) => (options = {}) => {
152
+ if (typeof options === "string") {
153
+ const descendant = options;
154
+ const style = styles2[`${rootClass}-${descendant}`];
155
+ if (style) {
156
+ return config.baseClass + styles2[`${rootClass}-${descendant}`] || "";
157
+ }
158
+ return "";
159
+ } else if (typeof options === "object") {
160
+ const modifiers = options;
161
+ const prefixedModifiers = {};
162
+ for (let modifier in modifiers) {
163
+ prefixedModifiers[styles2[`${rootClass}--${modifier}`]] = modifiers[modifier];
164
+ }
165
+ const c = styles2[rootClass];
166
+ return config.baseClass + (0, import_classnames.default)(__spreadValues({
167
+ [c]: !!c
168
+ }, prefixedModifiers));
169
+ } else {
170
+ return config.baseClass + styles2[rootClass] || "";
171
+ }
172
+ };
173
+ var get_class_name_factory_default = getClassNameFactory;
174
+
103
175
  // css-module:/home/runner/work/puck/puck/packages/core/components/ActionBar/styles.module.css#css-module
104
176
  init_react_import();
105
177
  var styles_module_default = { "ActionBar": "_ActionBar_rvadt_1", "ActionBar-label": "_ActionBar-label_rvadt_18", "ActionBar-action": "_ActionBar-action_rvadt_30", "ActionBar-group": "_ActionBar-group_rvadt_38" };
@@ -152,9 +224,9 @@ var styles_module_default2 = { "InputWrapper": "_InputWrapper_bsxfo_1", "Input-l
152
224
 
153
225
  // components/AutoField/index.tsx
154
226
  import {
155
- useCallback as useCallback4,
156
- useContext as useContext2,
157
- useEffect as useEffect6,
227
+ useCallback as useCallback5,
228
+ useContext as useContext3,
229
+ useEffect as useEffect10,
158
230
  useMemo as useMemo3,
159
231
  useState as useState8
160
232
  } from "react";
@@ -501,36 +573,1454 @@ var Undo2 = createLucideIcon("Undo2", [
501
573
  ["path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11", key: "f3b9sd" }]
502
574
  ]);
503
575
 
504
- // ../../node_modules/lucide-react/dist/esm/icons/zoom-in.js
576
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-in.js
577
+ init_react_import();
578
+ var ZoomIn = createLucideIcon("ZoomIn", [
579
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
580
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
581
+ ["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
582
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
583
+ ]);
584
+
585
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-out.js
586
+ init_react_import();
587
+ var ZoomOut = createLucideIcon("ZoomOut", [
588
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
589
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
590
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
591
+ ]);
592
+
593
+ // components/IconButton/index.ts
594
+ init_react_import();
595
+
596
+ // components/IconButton/IconButton.tsx
597
+ init_react_import();
598
+ import { useState } from "react";
599
+
600
+ // css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
601
+ init_react_import();
602
+ var IconButton_module_default = { "IconButton": "_IconButton_swpni_1", "IconButton--disabled": "_IconButton--disabled_swpni_20", "IconButton-title": "_IconButton-title_swpni_33" };
603
+
604
+ // components/Loader/index.tsx
605
+ init_react_import();
606
+
607
+ // lib/index.ts
608
+ init_react_import();
609
+
610
+ // lib/filter.ts
611
+ init_react_import();
612
+
613
+ // lib/data/reorder.ts
614
+ init_react_import();
615
+ var reorder = (list, startIndex, endIndex) => {
616
+ const result = Array.from(list);
617
+ const [removed] = result.splice(startIndex, 1);
618
+ result.splice(endIndex, 0, removed);
619
+ return result;
620
+ };
621
+
622
+ // lib/data/replace.ts
623
+ init_react_import();
624
+ var replace = (list, index, newItem) => {
625
+ const result = Array.from(list);
626
+ result.splice(index, 1);
627
+ result.splice(index, 0, newItem);
628
+ return result;
629
+ };
630
+
631
+ // lib/use-reset-auto-zoom.ts
632
+ init_react_import();
633
+
634
+ // store/index.ts
635
+ init_react_import();
636
+
637
+ // reducer/index.ts
638
+ init_react_import();
639
+
640
+ // reducer/actions/set.ts
641
+ init_react_import();
642
+ var setAction = (state, action, appStore) => {
643
+ if (typeof action.state === "object") {
644
+ const newState = __spreadValues(__spreadValues({}, state), action.state);
645
+ if (action.state.indexes) {
646
+ return newState;
647
+ }
648
+ console.warn(
649
+ "`set` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
650
+ );
651
+ return walkAppState(newState, appStore.config);
652
+ }
653
+ return __spreadValues(__spreadValues({}, state), action.state(state));
654
+ };
655
+
656
+ // reducer/actions/insert.ts
657
+ init_react_import();
658
+
659
+ // lib/data/insert.ts
660
+ init_react_import();
661
+ var insert = (list, index, item) => {
662
+ const result = Array.from(list || []);
663
+ result.splice(index, 0, item);
664
+ return result;
665
+ };
666
+
667
+ // lib/generate-id.ts
668
+ init_react_import();
669
+ import { v4 as uuidv4 } from "uuid";
670
+ var generateId = (type) => type ? `${type}-${uuidv4()}` : uuidv4();
671
+
672
+ // lib/data/get-ids-for-parent.ts
673
+ init_react_import();
674
+ var getIdsForParent = (zoneCompound, state) => {
675
+ const [parentId] = zoneCompound.split(":");
676
+ const node = state.indexes.nodes[parentId];
677
+ return ((node == null ? void 0 : node.path) || []).map((p) => p.split(":")[0]);
678
+ };
679
+
680
+ // lib/data/populate-ids.ts
681
+ init_react_import();
682
+ var populateIds = (data, config, override = false) => {
683
+ const id = generateId(data.type);
684
+ return walkTree(
685
+ __spreadProps(__spreadValues({}, data), {
686
+ props: override ? __spreadProps(__spreadValues({}, data.props), { id }) : __spreadValues({}, data.props)
687
+ }),
688
+ config,
689
+ (contents) => contents.map((item) => {
690
+ const id2 = generateId(item.type);
691
+ return __spreadProps(__spreadValues({}, item), {
692
+ props: override ? __spreadProps(__spreadValues({}, item.props), { id: id2 }) : __spreadValues({ id: id2 }, item.props)
693
+ });
694
+ })
695
+ );
696
+ };
697
+
698
+ // reducer/actions/insert.ts
699
+ function insertAction(state, action, appStore) {
700
+ const id = action.id || generateId(action.componentType);
701
+ const emptyComponentData = populateIds(
702
+ {
703
+ type: action.componentType,
704
+ props: __spreadProps(__spreadValues({}, appStore.config.components[action.componentType].defaultProps || {}), {
705
+ id
706
+ })
707
+ },
708
+ appStore.config
709
+ );
710
+ const [parentId] = action.destinationZone.split(":");
711
+ const idsInPath = getIdsForParent(action.destinationZone, state);
712
+ return walkAppState(
713
+ state,
714
+ appStore.config,
715
+ (content, zoneCompound) => {
716
+ if (zoneCompound === action.destinationZone) {
717
+ return insert(
718
+ content || [],
719
+ action.destinationIndex,
720
+ emptyComponentData
721
+ );
722
+ }
723
+ return content;
724
+ },
725
+ (childItem, path) => {
726
+ if (childItem.props.id === id || childItem.props.id === parentId) {
727
+ return childItem;
728
+ } else if (idsInPath.includes(childItem.props.id)) {
729
+ return childItem;
730
+ } else if (path.includes(action.destinationZone)) {
731
+ return childItem;
732
+ }
733
+ return null;
734
+ }
735
+ );
736
+ }
737
+
738
+ // reducer/actions/replace.ts
739
+ init_react_import();
740
+ var replaceAction = (state, action, appStore) => {
741
+ const [parentId] = action.destinationZone.split(":");
742
+ const idsInPath = getIdsForParent(action.destinationZone, state);
743
+ const originalId = state.indexes.zones[action.destinationZone].contentIds[action.destinationIndex];
744
+ const idChanged = originalId !== action.data.props.id;
745
+ if (idChanged) {
746
+ throw new Error(
747
+ `Can't change the id during a replace action. Please us "remove" and "insert" to define a new node.`
748
+ );
749
+ }
750
+ const newSlotIds = [];
751
+ const data = walkTree(action.data, appStore.config, (contents, opts) => {
752
+ newSlotIds.push(`${opts.parentId}:${opts.propName}`);
753
+ return contents.map((item) => {
754
+ const id = generateId(item.type);
755
+ return __spreadProps(__spreadValues({}, item), {
756
+ props: __spreadValues({ id }, item.props)
757
+ });
758
+ });
759
+ });
760
+ const stateWithDeepSlotsRemoved = __spreadValues({}, state);
761
+ Object.keys(state.indexes.zones).forEach((zoneCompound) => {
762
+ const id = zoneCompound.split(":")[0];
763
+ if (id === originalId) {
764
+ if (!newSlotIds.includes(zoneCompound)) {
765
+ delete stateWithDeepSlotsRemoved.indexes.zones[zoneCompound];
766
+ }
767
+ }
768
+ });
769
+ return walkAppState(
770
+ stateWithDeepSlotsRemoved,
771
+ appStore.config,
772
+ (content, zoneCompound) => {
773
+ const newContent = [...content];
774
+ if (zoneCompound === action.destinationZone) {
775
+ newContent[action.destinationIndex] = data;
776
+ }
777
+ return newContent;
778
+ },
779
+ (childItem, path) => {
780
+ const pathIds = path.map((p) => p.split(":")[0]);
781
+ if (childItem.props.id === data.props.id) {
782
+ return data;
783
+ } else if (childItem.props.id === parentId) {
784
+ return childItem;
785
+ } else if (idsInPath.indexOf(childItem.props.id) > -1) {
786
+ return childItem;
787
+ } else if (pathIds.indexOf(data.props.id) > -1) {
788
+ return childItem;
789
+ }
790
+ return null;
791
+ }
792
+ );
793
+ };
794
+
795
+ // reducer/actions/replace-root.ts
796
+ init_react_import();
797
+ var replaceRootAction = (state, action, appStore) => {
798
+ return walkAppState(
799
+ state,
800
+ appStore.config,
801
+ (content) => content,
802
+ (childItem) => {
803
+ if (childItem.props.id === "root") {
804
+ return __spreadProps(__spreadValues({}, childItem), {
805
+ props: __spreadValues(__spreadValues({}, childItem.props), action.root.props),
806
+ readOnly: action.root.readOnly
807
+ });
808
+ }
809
+ return childItem;
810
+ }
811
+ );
812
+ };
813
+
814
+ // reducer/actions/duplicate.ts
815
+ init_react_import();
816
+
817
+ // lib/data/get-item.ts
818
+ init_react_import();
819
+ function getItem(selector, state) {
820
+ var _a, _b;
821
+ const zone = (_a = state.indexes.zones) == null ? void 0 : _a[selector.zone || rootDroppableId];
822
+ return zone ? (_b = state.indexes.nodes[zone.contentIds[selector.index]]) == null ? void 0 : _b.data : void 0;
823
+ }
824
+
825
+ // reducer/actions/duplicate.ts
826
+ function duplicateAction(state, action, appStore) {
827
+ const item = getItem(
828
+ { index: action.sourceIndex, zone: action.sourceZone },
829
+ state
830
+ );
831
+ const idsInPath = getIdsForParent(action.sourceZone, state);
832
+ const newItem = __spreadProps(__spreadValues({}, item), {
833
+ props: __spreadProps(__spreadValues({}, item.props), {
834
+ id: generateId(item.type)
835
+ })
836
+ });
837
+ const modified = walkAppState(
838
+ state,
839
+ appStore.config,
840
+ (content, zoneCompound) => {
841
+ if (zoneCompound === action.sourceZone) {
842
+ return insert(content, action.sourceIndex + 1, item);
843
+ }
844
+ return content;
845
+ },
846
+ (childItem, path, index) => {
847
+ const zoneCompound = path[path.length - 1];
848
+ const parents = path.map((p) => p.split(":")[0]);
849
+ if (parents.indexOf(newItem.props.id) > -1) {
850
+ return __spreadProps(__spreadValues({}, childItem), {
851
+ props: __spreadProps(__spreadValues({}, childItem.props), {
852
+ id: generateId(childItem.type)
853
+ })
854
+ });
855
+ }
856
+ if (zoneCompound === action.sourceZone && index === action.sourceIndex + 1) {
857
+ return newItem;
858
+ }
859
+ const [sourceZoneParent] = action.sourceZone.split(":");
860
+ if (sourceZoneParent === childItem.props.id || idsInPath.indexOf(childItem.props.id) > -1) {
861
+ return childItem;
862
+ }
863
+ return null;
864
+ }
865
+ );
866
+ return __spreadProps(__spreadValues({}, modified), {
867
+ ui: __spreadProps(__spreadValues({}, modified.ui), {
868
+ itemSelector: {
869
+ index: action.sourceIndex + 1,
870
+ zone: action.sourceZone
871
+ }
872
+ })
873
+ });
874
+ }
875
+
876
+ // reducer/actions/reorder.ts
877
+ init_react_import();
878
+
879
+ // reducer/actions/move.ts
880
+ init_react_import();
881
+
882
+ // lib/data/remove.ts
883
+ init_react_import();
884
+ var remove = (list, index) => {
885
+ const result = Array.from(list);
886
+ result.splice(index, 1);
887
+ return result;
888
+ };
889
+
890
+ // reducer/actions/move.ts
891
+ var moveAction = (state, action, appStore) => {
892
+ if (action.sourceZone === action.destinationZone && action.sourceIndex === action.destinationIndex) {
893
+ return state;
894
+ }
895
+ const item = getItem(
896
+ { zone: action.sourceZone, index: action.sourceIndex },
897
+ state
898
+ );
899
+ if (!item) return state;
900
+ const idsInSourcePath = getIdsForParent(action.sourceZone, state);
901
+ const idsInDestinationPath = getIdsForParent(action.destinationZone, state);
902
+ return walkAppState(
903
+ state,
904
+ appStore.config,
905
+ (content, zoneCompound) => {
906
+ if (zoneCompound === action.sourceZone && zoneCompound === action.destinationZone) {
907
+ return insert(
908
+ remove(content, action.sourceIndex),
909
+ action.destinationIndex,
910
+ item
911
+ );
912
+ } else if (zoneCompound === action.sourceZone) {
913
+ return remove(content, action.sourceIndex);
914
+ } else if (zoneCompound === action.destinationZone) {
915
+ return insert(content, action.destinationIndex, item);
916
+ }
917
+ return content;
918
+ },
919
+ (childItem, path) => {
920
+ const [sourceZoneParent] = action.sourceZone.split(":");
921
+ const [destinationZoneParent] = action.destinationZone.split(":");
922
+ const childId = childItem.props.id;
923
+ if (sourceZoneParent === childId || destinationZoneParent === childId || item.props.id === childId || idsInSourcePath.indexOf(childId) > -1 || idsInDestinationPath.indexOf(childId) > -1 || path.includes(action.destinationZone)) {
924
+ return childItem;
925
+ }
926
+ return null;
927
+ }
928
+ );
929
+ };
930
+
931
+ // reducer/actions/reorder.ts
932
+ var reorderAction = (state, action, appStore) => {
933
+ return moveAction(
934
+ state,
935
+ {
936
+ type: "move",
937
+ sourceIndex: action.sourceIndex,
938
+ sourceZone: action.destinationZone,
939
+ destinationIndex: action.destinationIndex,
940
+ destinationZone: action.destinationZone
941
+ },
942
+ appStore
943
+ );
944
+ };
945
+
946
+ // reducer/actions/remove.ts
947
+ init_react_import();
948
+ var removeAction = (state, action, appStore) => {
949
+ const item = getItem({ index: action.index, zone: action.zone }, state);
950
+ const nodesToDelete = Object.entries(state.indexes.nodes).reduce(
951
+ (acc, [nodeId, nodeData]) => {
952
+ const pathIds = nodeData.path.map((p) => p.split(":")[0]);
953
+ if (pathIds.includes(item.props.id)) {
954
+ return [...acc, nodeId];
955
+ }
956
+ return acc;
957
+ },
958
+ [item.props.id]
959
+ );
960
+ const newState = walkAppState(
961
+ state,
962
+ appStore.config,
963
+ (content, zoneCompound) => {
964
+ if (zoneCompound === action.zone) {
965
+ return remove(content, action.index);
966
+ }
967
+ return content;
968
+ }
969
+ );
970
+ Object.keys(newState.data.zones || {}).forEach((zoneCompound) => {
971
+ const parentId = zoneCompound.split(":")[0];
972
+ if (nodesToDelete.includes(parentId) && newState.data.zones) {
973
+ delete newState.data.zones[zoneCompound];
974
+ }
975
+ });
976
+ Object.keys(newState.indexes.zones).forEach((zoneCompound) => {
977
+ const parentId = zoneCompound.split(":")[0];
978
+ if (nodesToDelete.includes(parentId)) {
979
+ delete newState.indexes.zones[zoneCompound];
980
+ }
981
+ });
982
+ nodesToDelete.forEach((id) => {
983
+ delete newState.indexes.nodes[id];
984
+ });
985
+ return newState;
986
+ };
987
+
988
+ // reducer/actions/register-zone.ts
989
+ init_react_import();
990
+ var zoneCache = {};
991
+ function registerZoneAction(state, action) {
992
+ if (zoneCache[action.zone]) {
993
+ return __spreadProps(__spreadValues({}, state), {
994
+ data: __spreadProps(__spreadValues({}, state.data), {
995
+ zones: __spreadProps(__spreadValues({}, state.data.zones), {
996
+ [action.zone]: zoneCache[action.zone]
997
+ })
998
+ }),
999
+ indexes: __spreadProps(__spreadValues({}, state.indexes), {
1000
+ zones: __spreadProps(__spreadValues({}, state.indexes.zones), {
1001
+ [action.zone]: __spreadProps(__spreadValues({}, state.indexes.zones[action.zone]), {
1002
+ contentIds: zoneCache[action.zone].map((item) => item.props.id),
1003
+ type: "dropzone"
1004
+ })
1005
+ })
1006
+ })
1007
+ });
1008
+ }
1009
+ return __spreadProps(__spreadValues({}, state), { data: setupZone(state.data, action.zone) });
1010
+ }
1011
+ function unregisterZoneAction(state, action) {
1012
+ const _zones = __spreadValues({}, state.data.zones || {});
1013
+ const zoneIndex = __spreadValues({}, state.indexes.zones || {});
1014
+ if (_zones[action.zone]) {
1015
+ zoneCache[action.zone] = _zones[action.zone];
1016
+ delete _zones[action.zone];
1017
+ }
1018
+ delete zoneIndex[action.zone];
1019
+ return __spreadProps(__spreadValues({}, state), {
1020
+ data: __spreadProps(__spreadValues({}, state.data), {
1021
+ zones: _zones
1022
+ }),
1023
+ indexes: __spreadProps(__spreadValues({}, state.indexes), {
1024
+ zones: zoneIndex
1025
+ })
1026
+ });
1027
+ }
1028
+
1029
+ // reducer/actions/set-data.ts
1030
+ init_react_import();
1031
+ var setDataAction = (state, action, appStore) => {
1032
+ if (typeof action.data === "object") {
1033
+ console.warn(
1034
+ "`setData` is expensive and may cause unnecessary re-renders. Consider using a more atomic action instead."
1035
+ );
1036
+ return walkAppState(
1037
+ __spreadProps(__spreadValues({}, state), {
1038
+ data: __spreadValues(__spreadValues({}, state.data), action.data)
1039
+ }),
1040
+ appStore.config
1041
+ );
1042
+ }
1043
+ return walkAppState(
1044
+ __spreadProps(__spreadValues({}, state), {
1045
+ data: __spreadValues(__spreadValues({}, state.data), action.data(state.data))
1046
+ }),
1047
+ appStore.config
1048
+ );
1049
+ };
1050
+
1051
+ // reducer/actions/set-ui.ts
1052
+ init_react_import();
1053
+ var setUiAction = (state, action) => {
1054
+ if (typeof action.ui === "object") {
1055
+ return __spreadProps(__spreadValues({}, state), {
1056
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui)
1057
+ });
1058
+ }
1059
+ return __spreadProps(__spreadValues({}, state), {
1060
+ ui: __spreadValues(__spreadValues({}, state.ui), action.ui(state.ui))
1061
+ });
1062
+ };
1063
+
1064
+ // lib/data/make-state-public.ts
1065
+ init_react_import();
1066
+ var makeStatePublic = (state) => {
1067
+ const { data, ui } = state;
1068
+ return { data, ui };
1069
+ };
1070
+
1071
+ // reducer/actions.tsx
1072
+ init_react_import();
1073
+
1074
+ // reducer/index.ts
1075
+ function storeInterceptor(reducer, record, onAction) {
1076
+ return (state, action) => {
1077
+ const newAppState = reducer(state, action);
1078
+ const isValidType = ![
1079
+ "registerZone",
1080
+ "unregisterZone",
1081
+ "setData",
1082
+ "setUi",
1083
+ "set"
1084
+ ].includes(action.type);
1085
+ if (typeof action.recordHistory !== "undefined" ? action.recordHistory : isValidType) {
1086
+ if (record) record(newAppState);
1087
+ }
1088
+ onAction == null ? void 0 : onAction(action, makeStatePublic(newAppState), makeStatePublic(state));
1089
+ return newAppState;
1090
+ };
1091
+ }
1092
+ function createReducer({
1093
+ record,
1094
+ onAction,
1095
+ appStore
1096
+ }) {
1097
+ return storeInterceptor(
1098
+ (state, action) => {
1099
+ if (action.type === "set") {
1100
+ return setAction(state, action, appStore);
1101
+ }
1102
+ if (action.type === "insert") {
1103
+ return insertAction(state, action, appStore);
1104
+ }
1105
+ if (action.type === "replace") {
1106
+ return replaceAction(state, action, appStore);
1107
+ }
1108
+ if (action.type === "replaceRoot") {
1109
+ return replaceRootAction(state, action, appStore);
1110
+ }
1111
+ if (action.type === "duplicate") {
1112
+ return duplicateAction(state, action, appStore);
1113
+ }
1114
+ if (action.type === "reorder") {
1115
+ return reorderAction(state, action, appStore);
1116
+ }
1117
+ if (action.type === "move") {
1118
+ return moveAction(state, action, appStore);
1119
+ }
1120
+ if (action.type === "remove") {
1121
+ return removeAction(state, action, appStore);
1122
+ }
1123
+ if (action.type === "registerZone") {
1124
+ return registerZoneAction(state, action);
1125
+ }
1126
+ if (action.type === "unregisterZone") {
1127
+ return unregisterZoneAction(state, action);
1128
+ }
1129
+ if (action.type === "setData") {
1130
+ return setDataAction(state, action, appStore);
1131
+ }
1132
+ if (action.type === "setUi") {
1133
+ return setUiAction(state, action);
1134
+ }
1135
+ return state;
1136
+ },
1137
+ record,
1138
+ onAction
1139
+ );
1140
+ }
1141
+
1142
+ // store/index.ts
1143
+ import { create as create2, useStore } from "zustand";
1144
+ import { subscribeWithSelector as subscribeWithSelector2 } from "zustand/middleware";
1145
+ import { createContext, useContext } from "react";
1146
+
1147
+ // store/slices/history.ts
1148
+ init_react_import();
1149
+ import { useEffect as useEffect2 } from "react";
1150
+
1151
+ // lib/use-hotkey.ts
1152
+ init_react_import();
1153
+ import { useEffect } from "react";
1154
+ import { create } from "zustand";
1155
+ import { subscribeWithSelector } from "zustand/middleware";
1156
+ var keyCodeMap = {
1157
+ ControlLeft: "ctrl",
1158
+ ControlRight: "ctrl",
1159
+ MetaLeft: "meta",
1160
+ MetaRight: "meta",
1161
+ ShiftLeft: "shift",
1162
+ ShiftRight: "shift",
1163
+ KeyA: "a",
1164
+ KeyB: "b",
1165
+ KeyC: "c",
1166
+ KeyD: "d",
1167
+ KeyE: "e",
1168
+ KeyF: "f",
1169
+ KeyG: "g",
1170
+ KeyH: "h",
1171
+ KeyI: "i",
1172
+ KeyJ: "j",
1173
+ KeyK: "k",
1174
+ KeyL: "l",
1175
+ KeyM: "m",
1176
+ KeyN: "n",
1177
+ KeyO: "o",
1178
+ KeyP: "p",
1179
+ KeyQ: "q",
1180
+ KeyR: "r",
1181
+ KeyS: "s",
1182
+ KeyT: "t",
1183
+ KeyU: "u",
1184
+ KeyV: "v",
1185
+ KeyW: "w",
1186
+ KeyX: "x",
1187
+ KeyY: "y",
1188
+ KeyZ: "z"
1189
+ };
1190
+ var useHotkeyStore = create()(
1191
+ subscribeWithSelector((set) => ({
1192
+ held: {},
1193
+ hold: (key) => set((s) => s.held[key] ? s : { held: __spreadProps(__spreadValues({}, s.held), { [key]: true }) }),
1194
+ release: (key) => set((s) => s.held[key] ? { held: __spreadProps(__spreadValues({}, s.held), { [key]: false }) } : s),
1195
+ reset: (held = {}) => set(() => ({ held })),
1196
+ triggers: {}
1197
+ }))
1198
+ );
1199
+ var monitorHotkeys = (doc) => {
1200
+ const onKeyDown = (e) => {
1201
+ const key = keyCodeMap[e.code];
1202
+ if (key) {
1203
+ useHotkeyStore.getState().hold(key);
1204
+ const { held, triggers } = useHotkeyStore.getState();
1205
+ Object.values(triggers).forEach(({ combo, cb }) => {
1206
+ const conditionMet = Object.entries(combo).every(
1207
+ ([key2, value]) => value === !!held[key2]
1208
+ ) && Object.entries(held).every(
1209
+ ([key2, value]) => value === !!combo[key2]
1210
+ );
1211
+ if (conditionMet) {
1212
+ e.preventDefault();
1213
+ cb();
1214
+ }
1215
+ });
1216
+ if (key !== "meta" && key !== "ctrl" && key !== "shift") {
1217
+ useHotkeyStore.getState().release(key);
1218
+ }
1219
+ }
1220
+ };
1221
+ const onKeyUp = (e) => {
1222
+ const key = keyCodeMap[e.code];
1223
+ if (key) {
1224
+ if (key === "meta") {
1225
+ useHotkeyStore.getState().reset();
1226
+ } else {
1227
+ useHotkeyStore.getState().release(key);
1228
+ }
1229
+ }
1230
+ };
1231
+ const onVisibilityChanged = (e) => {
1232
+ if (document.visibilityState === "hidden") {
1233
+ useHotkeyStore.getState().reset();
1234
+ }
1235
+ };
1236
+ doc.addEventListener("keydown", onKeyDown);
1237
+ doc.addEventListener("keyup", onKeyUp);
1238
+ doc.addEventListener("visibilitychange", onVisibilityChanged);
1239
+ return () => {
1240
+ doc.removeEventListener("keydown", onKeyDown);
1241
+ doc.removeEventListener("keyup", onKeyUp);
1242
+ doc.removeEventListener("visibilitychange", onVisibilityChanged);
1243
+ };
1244
+ };
1245
+ var useMonitorHotkeys = () => {
1246
+ useEffect(() => monitorHotkeys(document), []);
1247
+ };
1248
+ var useHotkey = (combo, cb) => {
1249
+ useEffect(
1250
+ () => useHotkeyStore.setState((s) => ({
1251
+ triggers: __spreadProps(__spreadValues({}, s.triggers), {
1252
+ [`${Object.keys(combo).join("+")}`]: { combo, cb }
1253
+ })
1254
+ })),
1255
+ []
1256
+ );
1257
+ };
1258
+
1259
+ // store/slices/history.ts
1260
+ var EMPTY_HISTORY_INDEX = 0;
1261
+ function debounce(func, timeout3 = 300) {
1262
+ let timer;
1263
+ return (...args) => {
1264
+ clearTimeout(timer);
1265
+ timer = setTimeout(() => {
1266
+ func(...args);
1267
+ }, timeout3);
1268
+ };
1269
+ }
1270
+ var tidyState = (state) => {
1271
+ return __spreadProps(__spreadValues({}, state), {
1272
+ ui: __spreadProps(__spreadValues({}, state.ui), {
1273
+ field: {
1274
+ focus: null
1275
+ }
1276
+ })
1277
+ });
1278
+ };
1279
+ var createHistorySlice = (set, get) => {
1280
+ const record = debounce((state) => {
1281
+ const { histories, index } = get().history;
1282
+ const history = {
1283
+ state,
1284
+ id: generateId("history")
1285
+ };
1286
+ const newHistories = [...histories.slice(0, index + 1), history];
1287
+ set({
1288
+ history: __spreadProps(__spreadValues({}, get().history), {
1289
+ histories: newHistories,
1290
+ index: newHistories.length - 1
1291
+ })
1292
+ });
1293
+ }, 250);
1294
+ return {
1295
+ initialAppState: {},
1296
+ index: EMPTY_HISTORY_INDEX,
1297
+ histories: [],
1298
+ hasPast: () => get().history.index > EMPTY_HISTORY_INDEX,
1299
+ hasFuture: () => get().history.index < get().history.histories.length - 1,
1300
+ prevHistory: () => {
1301
+ const { history } = get();
1302
+ return history.hasPast() ? history.histories[history.index - 1] : null;
1303
+ },
1304
+ nextHistory: () => {
1305
+ const s = get().history;
1306
+ return s.hasFuture() ? s.histories[s.index + 1] : null;
1307
+ },
1308
+ currentHistory: () => get().history.histories[get().history.index],
1309
+ back: () => {
1310
+ var _a;
1311
+ const { history, dispatch } = get();
1312
+ if (history.hasPast()) {
1313
+ const state = tidyState(
1314
+ ((_a = history.prevHistory()) == null ? void 0 : _a.state) || history.initialAppState
1315
+ );
1316
+ dispatch({
1317
+ type: "set",
1318
+ state
1319
+ });
1320
+ set({ history: __spreadProps(__spreadValues({}, history), { index: history.index - 1 }) });
1321
+ }
1322
+ },
1323
+ forward: () => {
1324
+ var _a;
1325
+ const { history, dispatch } = get();
1326
+ if (history.hasFuture()) {
1327
+ const state = (_a = history.nextHistory()) == null ? void 0 : _a.state;
1328
+ dispatch({ type: "set", state: state ? tidyState(state) : {} });
1329
+ set({ history: __spreadProps(__spreadValues({}, history), { index: history.index + 1 }) });
1330
+ }
1331
+ },
1332
+ setHistories: (histories) => {
1333
+ var _a;
1334
+ const { dispatch, history } = get();
1335
+ dispatch({
1336
+ type: "set",
1337
+ state: ((_a = histories[histories.length - 1]) == null ? void 0 : _a.state) || history.initialAppState
1338
+ });
1339
+ set({ history: __spreadProps(__spreadValues({}, history), { histories, index: histories.length - 1 }) });
1340
+ },
1341
+ setHistoryIndex: (index) => {
1342
+ var _a;
1343
+ const { dispatch, history } = get();
1344
+ dispatch({
1345
+ type: "set",
1346
+ state: ((_a = history.histories[index]) == null ? void 0 : _a.state) || history.initialAppState
1347
+ });
1348
+ set({ history: __spreadProps(__spreadValues({}, history), { index }) });
1349
+ },
1350
+ record
1351
+ };
1352
+ };
1353
+ function useRegisterHistorySlice(appStore, {
1354
+ histories,
1355
+ index,
1356
+ initialAppState
1357
+ }) {
1358
+ useEffect2(
1359
+ () => appStore.setState({
1360
+ history: __spreadProps(__spreadValues({}, appStore.getState().history), {
1361
+ histories,
1362
+ index,
1363
+ initialAppState
1364
+ })
1365
+ }),
1366
+ [histories, index, initialAppState]
1367
+ );
1368
+ const back = () => {
1369
+ appStore.getState().history.back();
1370
+ };
1371
+ const forward = () => {
1372
+ appStore.getState().history.forward();
1373
+ };
1374
+ useHotkey({ meta: true, z: true }, back);
1375
+ useHotkey({ meta: true, shift: true, z: true }, forward);
1376
+ useHotkey({ meta: true, y: true }, forward);
1377
+ useHotkey({ ctrl: true, z: true }, back);
1378
+ useHotkey({ ctrl: true, shift: true, z: true }, forward);
1379
+ useHotkey({ ctrl: true, y: true }, forward);
1380
+ }
1381
+
1382
+ // store/slices/nodes.ts
1383
+ init_react_import();
1384
+ var createNodesSlice = (set, get) => ({
1385
+ nodes: {},
1386
+ registerNode: (id, node) => {
1387
+ const s = get().nodes;
1388
+ const emptyNode = {
1389
+ id,
1390
+ methods: {
1391
+ sync: () => null,
1392
+ hideOverlay: () => null,
1393
+ showOverlay: () => null
1394
+ },
1395
+ element: null
1396
+ };
1397
+ const existingNode = s.nodes[id];
1398
+ set({
1399
+ nodes: __spreadProps(__spreadValues({}, s), {
1400
+ nodes: __spreadProps(__spreadValues({}, s.nodes), {
1401
+ [id]: __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, emptyNode), existingNode), node), {
1402
+ id
1403
+ })
1404
+ })
1405
+ })
1406
+ });
1407
+ },
1408
+ unregisterNode: (id) => {
1409
+ const s = get().nodes;
1410
+ const existingNode = s.nodes[id];
1411
+ if (existingNode) {
1412
+ const newNodes = __spreadValues({}, s.nodes);
1413
+ delete newNodes[id];
1414
+ set({
1415
+ nodes: __spreadProps(__spreadValues({}, s), {
1416
+ nodes: newNodes
1417
+ })
1418
+ });
1419
+ }
1420
+ }
1421
+ });
1422
+
1423
+ // store/slices/permissions.ts
1424
+ init_react_import();
1425
+ import { useEffect as useEffect3 } from "react";
1426
+
1427
+ // lib/data/flatten-data.ts
1428
+ init_react_import();
1429
+ var flattenData = (state, config) => {
1430
+ const data = [];
1431
+ walkAppState(
1432
+ state,
1433
+ config,
1434
+ (content) => content,
1435
+ (item) => {
1436
+ data.push(item);
1437
+ return null;
1438
+ }
1439
+ );
1440
+ return data;
1441
+ };
1442
+
1443
+ // store/slices/permissions.ts
1444
+ var createPermissionsSlice = (set, get) => {
1445
+ const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
1446
+ const { state, permissions, config } = get();
1447
+ const { cache, globalPermissions } = permissions;
1448
+ const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
1449
+ var _a, _b, _c;
1450
+ const { config: config2, state: appState, setComponentLoading } = get();
1451
+ const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
1452
+ if (!componentConfig) {
1453
+ return;
1454
+ }
1455
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
1456
+ if (componentConfig.resolvePermissions) {
1457
+ const changed = getChanged(item2, (_a = cache[item2.props.id]) == null ? void 0 : _a.lastData);
1458
+ if (Object.values(changed).some((el) => el === true) || force2) {
1459
+ const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
1460
+ const resolvedPermissions = yield componentConfig.resolvePermissions(
1461
+ item2,
1462
+ {
1463
+ changed,
1464
+ lastPermissions: ((_b = cache[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
1465
+ permissions: initialPermissions,
1466
+ appState: makeStatePublic(appState),
1467
+ lastData: ((_c = cache[item2.props.id]) == null ? void 0 : _c.lastData) || null
1468
+ }
1469
+ );
1470
+ const latest = get().permissions;
1471
+ set({
1472
+ permissions: __spreadProps(__spreadValues({}, latest), {
1473
+ cache: __spreadProps(__spreadValues({}, latest.cache), {
1474
+ [item2.props.id]: {
1475
+ lastData: item2,
1476
+ lastPermissions: resolvedPermissions
1477
+ }
1478
+ }),
1479
+ resolvedPermissions: __spreadProps(__spreadValues({}, latest.resolvedPermissions), {
1480
+ [item2.props.id]: resolvedPermissions
1481
+ })
1482
+ })
1483
+ });
1484
+ clearTimeout2();
1485
+ }
1486
+ }
1487
+ });
1488
+ const resolveDataForRoot = (force2 = false) => {
1489
+ const { state: appState } = get();
1490
+ resolveDataForItem(
1491
+ // Shim the root data in by conforming to component data shape
1492
+ {
1493
+ type: "root",
1494
+ props: __spreadProps(__spreadValues({}, appState.data.root.props), { id: "root" })
1495
+ },
1496
+ force2
1497
+ );
1498
+ };
1499
+ const { item, type, root } = params;
1500
+ if (item) {
1501
+ yield resolveDataForItem(item, force);
1502
+ } else if (type) {
1503
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
1504
+ yield resolveDataForItem(item2, force);
1505
+ }));
1506
+ } else if (root) {
1507
+ resolveDataForRoot(force);
1508
+ } else {
1509
+ flattenData(state, config).map((item2) => __async(void 0, null, function* () {
1510
+ yield resolveDataForItem(item2, force);
1511
+ }));
1512
+ }
1513
+ });
1514
+ const refreshPermissions = (params) => resolvePermissions(params, true);
1515
+ return {
1516
+ cache: {},
1517
+ globalPermissions: {
1518
+ drag: true,
1519
+ edit: true,
1520
+ delete: true,
1521
+ duplicate: true,
1522
+ insert: true
1523
+ },
1524
+ resolvedPermissions: {},
1525
+ getPermissions: ({ item, type, root } = {}) => {
1526
+ const { config, permissions } = get();
1527
+ const { globalPermissions, resolvedPermissions } = permissions;
1528
+ if (item) {
1529
+ const componentConfig = config.components[item.type];
1530
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
1531
+ const resolvedForItem = resolvedPermissions[item.props.id];
1532
+ return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
1533
+ } else if (type) {
1534
+ const componentConfig = config.components[type];
1535
+ return __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
1536
+ } else if (root) {
1537
+ const rootConfig = config.root;
1538
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), rootConfig == null ? void 0 : rootConfig.permissions);
1539
+ const resolvedForItem = resolvedPermissions["root"];
1540
+ return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
1541
+ }
1542
+ return globalPermissions;
1543
+ },
1544
+ resolvePermissions,
1545
+ refreshPermissions
1546
+ };
1547
+ };
1548
+ var useRegisterPermissionsSlice = (appStore, globalPermissions) => {
1549
+ useEffect3(() => {
1550
+ const { permissions } = appStore.getState();
1551
+ const { globalPermissions: existingGlobalPermissions } = permissions;
1552
+ appStore.setState({
1553
+ permissions: __spreadProps(__spreadValues({}, permissions), {
1554
+ globalPermissions: __spreadValues(__spreadValues({}, existingGlobalPermissions), globalPermissions)
1555
+ })
1556
+ });
1557
+ permissions.resolvePermissions();
1558
+ }, [globalPermissions]);
1559
+ useEffect3(() => {
1560
+ return appStore.subscribe(
1561
+ (s) => s.state.data,
1562
+ () => {
1563
+ appStore.getState().permissions.resolvePermissions();
1564
+ }
1565
+ );
1566
+ }, []);
1567
+ useEffect3(() => {
1568
+ return appStore.subscribe(
1569
+ (s) => s.config,
1570
+ () => {
1571
+ appStore.getState().permissions.resolvePermissions();
1572
+ }
1573
+ );
1574
+ }, []);
1575
+ };
1576
+
1577
+ // store/slices/fields.ts
1578
+ init_react_import();
1579
+ import { useCallback, useEffect as useEffect4 } from "react";
1580
+ var createFieldsSlice = (_set, _get) => {
1581
+ return {
1582
+ fields: {},
1583
+ loading: false,
1584
+ lastResolvedData: {},
1585
+ id: void 0
1586
+ };
1587
+ };
1588
+ var useRegisterFieldsSlice = (appStore, id) => {
1589
+ const resolveFields = useCallback(
1590
+ (reset) => __async(void 0, null, function* () {
1591
+ var _a, _b;
1592
+ const { fields, lastResolvedData } = appStore.getState().fields;
1593
+ const nodes = appStore.getState().state.indexes.nodes;
1594
+ const node = nodes[id || "root"];
1595
+ const componentData = node == null ? void 0 : node.data;
1596
+ const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node.parentId] : null;
1597
+ const parent = (parentNode == null ? void 0 : parentNode.data) || null;
1598
+ const { getComponentConfig, state } = appStore.getState();
1599
+ const componentConfig = getComponentConfig(componentData == null ? void 0 : componentData.type);
1600
+ if (!componentData || !componentConfig) return;
1601
+ const defaultFields2 = componentConfig.fields || {};
1602
+ const resolver = componentConfig.resolveFields;
1603
+ let lastFields = fields;
1604
+ if (reset) {
1605
+ appStore.setState((s) => ({
1606
+ fields: __spreadProps(__spreadValues({}, s.fields), { fields: defaultFields2, id })
1607
+ }));
1608
+ lastFields = defaultFields2;
1609
+ }
1610
+ if (resolver) {
1611
+ const timeout3 = setTimeout(() => {
1612
+ appStore.setState((s) => ({
1613
+ fields: __spreadProps(__spreadValues({}, s.fields), { loading: true })
1614
+ }));
1615
+ }, 50);
1616
+ const lastData = ((_a = lastResolvedData.props) == null ? void 0 : _a.id) === id ? lastResolvedData : null;
1617
+ const changed = getChanged(componentData, lastData);
1618
+ const newFields = yield resolver(componentData, {
1619
+ changed,
1620
+ fields: defaultFields2,
1621
+ lastFields,
1622
+ lastData,
1623
+ appState: makeStatePublic(state),
1624
+ parent
1625
+ });
1626
+ clearTimeout(timeout3);
1627
+ if (((_b = appStore.getState().selectedItem) == null ? void 0 : _b.props.id) !== id) {
1628
+ return;
1629
+ }
1630
+ appStore.setState({
1631
+ fields: {
1632
+ fields: newFields,
1633
+ loading: false,
1634
+ lastResolvedData: componentData,
1635
+ id
1636
+ }
1637
+ });
1638
+ } else {
1639
+ appStore.setState((s) => ({
1640
+ fields: __spreadProps(__spreadValues({}, s.fields), { fields: defaultFields2, id })
1641
+ }));
1642
+ }
1643
+ }),
1644
+ [id]
1645
+ );
1646
+ useEffect4(() => {
1647
+ resolveFields(true);
1648
+ return appStore.subscribe(
1649
+ (s) => s.state.indexes.nodes[id || "root"],
1650
+ () => resolveFields()
1651
+ );
1652
+ }, [id]);
1653
+ };
1654
+
1655
+ // lib/data/to-root.ts
1656
+ init_react_import();
1657
+ var toRoot = (item) => {
1658
+ if ("type" in item && item.type !== "root") {
1659
+ throw new Error("Converting non-root item to root.");
1660
+ }
1661
+ const { readOnly } = item;
1662
+ if (item.props) {
1663
+ if ("id" in item.props) {
1664
+ const _a = item.props, { id } = _a, props = __objRest(_a, ["id"]);
1665
+ return { props, readOnly };
1666
+ }
1667
+ return { props: item.props, readOnly };
1668
+ }
1669
+ return { props: {}, readOnly };
1670
+ };
1671
+
1672
+ // store/index.ts
1673
+ var defaultPageFields = {
1674
+ title: { type: "text" }
1675
+ };
1676
+ var createAppStore = (initialAppStore) => create2()(
1677
+ subscribeWithSelector2((set, get) => {
1678
+ var _a, _b;
1679
+ return __spreadProps(__spreadValues({
1680
+ state: defaultAppState,
1681
+ config: { components: {} },
1682
+ componentState: {},
1683
+ plugins: [],
1684
+ overrides: {},
1685
+ viewports: defaultViewports,
1686
+ zoomConfig: {
1687
+ autoZoom: 1,
1688
+ rootHeight: 0,
1689
+ zoom: 1
1690
+ },
1691
+ status: "LOADING",
1692
+ iframe: {},
1693
+ metadata: {},
1694
+ fieldTransforms: {}
1695
+ }, initialAppStore), {
1696
+ fields: createFieldsSlice(set, get),
1697
+ history: createHistorySlice(set, get),
1698
+ nodes: createNodesSlice(set, get),
1699
+ permissions: createPermissionsSlice(set, get),
1700
+ getComponentConfig: (type) => {
1701
+ var _a2;
1702
+ const { config, selectedItem } = get();
1703
+ const rootFields = ((_a2 = config.root) == null ? void 0 : _a2.fields) || defaultPageFields;
1704
+ return type && type !== "root" ? config.components[type] : selectedItem ? config.components[selectedItem.type] : __spreadProps(__spreadValues({}, config.root), { fields: rootFields });
1705
+ },
1706
+ selectedItem: ((_a = initialAppStore == null ? void 0 : initialAppStore.state) == null ? void 0 : _a.ui.itemSelector) ? getItem(
1707
+ (_b = initialAppStore == null ? void 0 : initialAppStore.state) == null ? void 0 : _b.ui.itemSelector,
1708
+ initialAppStore.state
1709
+ ) : null,
1710
+ dispatch: (action) => set((s) => {
1711
+ var _a2, _b2;
1712
+ const { record } = get().history;
1713
+ const dispatch = createReducer({
1714
+ record,
1715
+ appStore: s
1716
+ });
1717
+ const state = dispatch(s.state, action);
1718
+ const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
1719
+ (_b2 = (_a2 = get()).onAction) == null ? void 0 : _b2.call(_a2, action, state, get().state);
1720
+ return __spreadProps(__spreadValues({}, s), { state, selectedItem });
1721
+ }),
1722
+ setZoomConfig: (zoomConfig) => set({ zoomConfig }),
1723
+ setStatus: (status) => set({ status }),
1724
+ setComponentState: (componentState) => set({ componentState }),
1725
+ pendingLoadTimeouts: {},
1726
+ setComponentLoading: (id, loading = true, defer2 = 0) => {
1727
+ const { setComponentState, pendingLoadTimeouts } = get();
1728
+ const loadId = generateId();
1729
+ const setLoading = () => {
1730
+ var _a2;
1731
+ const { componentState } = get();
1732
+ setComponentState(__spreadProps(__spreadValues({}, componentState), {
1733
+ [id]: __spreadProps(__spreadValues({}, componentState[id]), {
1734
+ loadingCount: (((_a2 = componentState[id]) == null ? void 0 : _a2.loadingCount) || 0) + 1
1735
+ })
1736
+ }));
1737
+ };
1738
+ const unsetLoading = () => {
1739
+ var _a2;
1740
+ const { componentState } = get();
1741
+ clearTimeout(timeout3);
1742
+ delete pendingLoadTimeouts[loadId];
1743
+ set({ pendingLoadTimeouts });
1744
+ setComponentState(__spreadProps(__spreadValues({}, componentState), {
1745
+ [id]: __spreadProps(__spreadValues({}, componentState[id]), {
1746
+ loadingCount: Math.max(
1747
+ (((_a2 = componentState[id]) == null ? void 0 : _a2.loadingCount) || 0) - 1,
1748
+ 0
1749
+ )
1750
+ })
1751
+ }));
1752
+ };
1753
+ const timeout3 = setTimeout(() => {
1754
+ if (loading) {
1755
+ setLoading();
1756
+ } else {
1757
+ unsetLoading();
1758
+ }
1759
+ delete pendingLoadTimeouts[loadId];
1760
+ set({ pendingLoadTimeouts });
1761
+ }, defer2);
1762
+ set({
1763
+ pendingLoadTimeouts: __spreadProps(__spreadValues({}, pendingLoadTimeouts), {
1764
+ [id]: timeout3
1765
+ })
1766
+ });
1767
+ return unsetLoading;
1768
+ },
1769
+ unsetComponentLoading: (id) => {
1770
+ const { setComponentLoading } = get();
1771
+ setComponentLoading(id, false);
1772
+ },
1773
+ // Helper
1774
+ setUi: (ui, recordHistory) => set((s) => {
1775
+ const dispatch = createReducer({
1776
+ record: () => {
1777
+ },
1778
+ appStore: s
1779
+ });
1780
+ const state = dispatch(s.state, {
1781
+ type: "setUi",
1782
+ ui,
1783
+ recordHistory
1784
+ });
1785
+ const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
1786
+ return __spreadProps(__spreadValues({}, s), { state, selectedItem });
1787
+ }),
1788
+ resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
1789
+ const { config, metadata, setComponentLoading, permissions } = get();
1790
+ const timeouts = {};
1791
+ return yield resolveComponentData(
1792
+ componentData,
1793
+ config,
1794
+ metadata,
1795
+ (item) => {
1796
+ const id = "id" in item.props ? item.props.id : "root";
1797
+ timeouts[id] = setComponentLoading(id, true, 50);
1798
+ },
1799
+ (item) => __async(void 0, null, function* () {
1800
+ const id = "id" in item.props ? item.props.id : "root";
1801
+ if ("type" in item) {
1802
+ yield permissions.refreshPermissions({ item });
1803
+ } else {
1804
+ yield permissions.refreshPermissions({ root: true });
1805
+ }
1806
+ timeouts[id]();
1807
+ }),
1808
+ trigger
1809
+ );
1810
+ }),
1811
+ resolveAndCommitData: () => __async(void 0, null, function* () {
1812
+ const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
1813
+ walkAppState(
1814
+ state,
1815
+ config,
1816
+ (content) => content,
1817
+ (childItem) => {
1818
+ resolveComponentData2(childItem, "load").then((resolved) => {
1819
+ const { state: state2 } = get();
1820
+ const node = state2.indexes.nodes[resolved.node.props.id];
1821
+ if (node && resolved.didChange) {
1822
+ if (resolved.node.props.id === "root") {
1823
+ dispatch({
1824
+ type: "replaceRoot",
1825
+ root: toRoot(resolved.node)
1826
+ });
1827
+ } else {
1828
+ const zoneCompound = `${node.parentId}:${node.zone}`;
1829
+ const parentZone = state2.indexes.zones[zoneCompound];
1830
+ const index = parentZone.contentIds.indexOf(
1831
+ resolved.node.props.id
1832
+ );
1833
+ dispatch({
1834
+ type: "replace",
1835
+ data: resolved.node,
1836
+ destinationIndex: index,
1837
+ destinationZone: zoneCompound
1838
+ });
1839
+ }
1840
+ }
1841
+ });
1842
+ return childItem;
1843
+ }
1844
+ );
1845
+ })
1846
+ });
1847
+ })
1848
+ );
1849
+ var appStoreContext = createContext(createAppStore());
1850
+ function useAppStore(selector) {
1851
+ const context = useContext(appStoreContext);
1852
+ return useStore(context, selector);
1853
+ }
1854
+ function useAppStoreApi() {
1855
+ return useContext(appStoreContext);
1856
+ }
1857
+
1858
+ // lib/get-zoom-config.ts
505
1859
  init_react_import();
506
- var ZoomIn = createLucideIcon("ZoomIn", [
507
- ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
508
- ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
509
- ["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
510
- ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
511
- ]);
512
1860
 
513
- // ../../node_modules/lucide-react/dist/esm/icons/zoom-out.js
1861
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
514
1862
  init_react_import();
515
- var ZoomOut = createLucideIcon("ZoomOut", [
516
- ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
517
- ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
518
- ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
519
- ]);
520
1863
 
521
- // components/IconButton/index.ts
1864
+ // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
522
1865
  init_react_import();
1866
+ var isProduction = process.env.NODE_ENV === "production";
1867
+ var prefix = "Invariant failed";
1868
+ function invariant(condition, message) {
1869
+ if (condition) {
1870
+ return;
1871
+ }
1872
+ if (isProduction) {
1873
+ throw new Error(prefix);
1874
+ }
1875
+ var provided = typeof message === "function" ? message() : message;
1876
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
1877
+ throw new Error(value);
1878
+ }
523
1879
 
524
- // components/IconButton/IconButton.tsx
525
- init_react_import();
526
- import { useState } from "react";
1880
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
1881
+ var getRect = function getRect2(_ref) {
1882
+ var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
1883
+ var width = right - left;
1884
+ var height = bottom - top;
1885
+ var rect = {
1886
+ top,
1887
+ right,
1888
+ bottom,
1889
+ left,
1890
+ width,
1891
+ height,
1892
+ x: left,
1893
+ y: top,
1894
+ center: {
1895
+ x: (right + left) / 2,
1896
+ y: (bottom + top) / 2
1897
+ }
1898
+ };
1899
+ return rect;
1900
+ };
1901
+ var expand = function expand2(target, expandBy) {
1902
+ return {
1903
+ top: target.top - expandBy.top,
1904
+ left: target.left - expandBy.left,
1905
+ bottom: target.bottom + expandBy.bottom,
1906
+ right: target.right + expandBy.right
1907
+ };
1908
+ };
1909
+ var shrink = function shrink2(target, shrinkBy) {
1910
+ return {
1911
+ top: target.top + shrinkBy.top,
1912
+ left: target.left + shrinkBy.left,
1913
+ bottom: target.bottom - shrinkBy.bottom,
1914
+ right: target.right - shrinkBy.right
1915
+ };
1916
+ };
1917
+ var noSpacing = {
1918
+ top: 0,
1919
+ right: 0,
1920
+ bottom: 0,
1921
+ left: 0
1922
+ };
1923
+ var createBox = function createBox2(_ref2) {
1924
+ var borderBox = _ref2.borderBox, _ref2$margin = _ref2.margin, margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin, _ref2$border = _ref2.border, border = _ref2$border === void 0 ? noSpacing : _ref2$border, _ref2$padding = _ref2.padding, padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
1925
+ var marginBox = getRect(expand(borderBox, margin));
1926
+ var paddingBox = getRect(shrink(borderBox, border));
1927
+ var contentBox = getRect(shrink(paddingBox, padding));
1928
+ return {
1929
+ marginBox,
1930
+ borderBox: getRect(borderBox),
1931
+ paddingBox,
1932
+ contentBox,
1933
+ margin,
1934
+ border,
1935
+ padding
1936
+ };
1937
+ };
1938
+ var parse = function parse2(raw) {
1939
+ var value = raw.slice(0, -2);
1940
+ var suffix = raw.slice(-2);
1941
+ if (suffix !== "px") {
1942
+ return 0;
1943
+ }
1944
+ var result = Number(value);
1945
+ !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
1946
+ return result;
1947
+ };
1948
+ var calculateBox = function calculateBox2(borderBox, styles2) {
1949
+ var margin = {
1950
+ top: parse(styles2.marginTop),
1951
+ right: parse(styles2.marginRight),
1952
+ bottom: parse(styles2.marginBottom),
1953
+ left: parse(styles2.marginLeft)
1954
+ };
1955
+ var padding = {
1956
+ top: parse(styles2.paddingTop),
1957
+ right: parse(styles2.paddingRight),
1958
+ bottom: parse(styles2.paddingBottom),
1959
+ left: parse(styles2.paddingLeft)
1960
+ };
1961
+ var border = {
1962
+ top: parse(styles2.borderTopWidth),
1963
+ right: parse(styles2.borderRightWidth),
1964
+ bottom: parse(styles2.borderBottomWidth),
1965
+ left: parse(styles2.borderLeftWidth)
1966
+ };
1967
+ return createBox({
1968
+ borderBox,
1969
+ margin,
1970
+ padding,
1971
+ border
1972
+ });
1973
+ };
1974
+ var getBox = function getBox2(el) {
1975
+ var borderBox = el.getBoundingClientRect();
1976
+ var styles2 = window.getComputedStyle(el);
1977
+ return calculateBox(borderBox, styles2);
1978
+ };
527
1979
 
528
- // css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
529
- init_react_import();
530
- var IconButton_module_default = { "IconButton": "_IconButton_swpni_1", "IconButton--disabled": "_IconButton--disabled_swpni_20", "IconButton-title": "_IconButton-title_swpni_33" };
1980
+ // lib/get-zoom-config.ts
1981
+ var RESET_ZOOM_SMALLER_THAN_FRAME = true;
1982
+ var getZoomConfig = (uiViewport, frame, zoom) => {
1983
+ const box = getBox(frame);
1984
+ const { width: frameWidth, height: frameHeight } = box.contentBox;
1985
+ const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
1986
+ let rootHeight = 0;
1987
+ let autoZoom = 1;
1988
+ if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
1989
+ const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
1990
+ const heightZoom = Math.min(frameHeight / viewportHeight, 1);
1991
+ zoom = widthZoom;
1992
+ if (widthZoom < heightZoom) {
1993
+ rootHeight = viewportHeight / zoom;
1994
+ } else {
1995
+ rootHeight = viewportHeight;
1996
+ zoom = heightZoom;
1997
+ }
1998
+ autoZoom = zoom;
1999
+ } else {
2000
+ if (RESET_ZOOM_SMALLER_THAN_FRAME) {
2001
+ autoZoom = 1;
2002
+ zoom = 1;
2003
+ rootHeight = viewportHeight;
2004
+ }
2005
+ }
2006
+ return { autoZoom, rootHeight, zoom };
2007
+ };
531
2008
 
532
- // components/Loader/index.tsx
533
- init_react_import();
2009
+ // lib/use-reset-auto-zoom.ts
2010
+ var useResetAutoZoom = (frameRef) => {
2011
+ const appStoreApi = useAppStoreApi();
2012
+ const resetAutoZoom = (options) => {
2013
+ const { state, zoomConfig, setZoomConfig } = appStoreApi.getState();
2014
+ const { viewports } = state.ui;
2015
+ const newViewports = (options == null ? void 0 : options.viewports) || viewports;
2016
+ if (frameRef.current) {
2017
+ setZoomConfig(
2018
+ getZoomConfig(newViewports == null ? void 0 : newViewports.current, frameRef.current, zoomConfig.zoom)
2019
+ );
2020
+ }
2021
+ };
2022
+ return resetAutoZoom;
2023
+ };
534
2024
 
535
2025
  // css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
536
2026
  init_react_import();
@@ -617,8 +2107,8 @@ var IconButton = ({
617
2107
  // components/AutoField/fields/ArrayField/index.tsx
618
2108
  import {
619
2109
  memo as memo2,
620
- useCallback,
621
- useEffect,
2110
+ useCallback as useCallback2,
2111
+ useEffect as useEffect5,
622
2112
  useRef,
623
2113
  useState as useState3
624
2114
  } from "react";
@@ -1071,11 +2561,11 @@ var Sortable = ({
1071
2561
 
1072
2562
  // components/AutoField/context.tsx
1073
2563
  init_react_import();
1074
- import { createContext, useContext, useMemo } from "react";
2564
+ import { createContext as createContext2, useContext as useContext2, useMemo } from "react";
1075
2565
  import { jsx as jsx6 } from "react/jsx-runtime";
1076
- var NestedFieldContext = createContext({});
2566
+ var NestedFieldContext = createContext2({});
1077
2567
  var useNestedFieldContext = () => {
1078
- const context = useContext(NestedFieldContext);
2568
+ const context = useContext2(NestedFieldContext);
1079
2569
  return __spreadProps(__spreadValues({}, context), {
1080
2570
  readOnlyFields: context.readOnlyFields || {}
1081
2571
  });
@@ -1283,14 +2773,14 @@ var ArrayField = ({
1283
2773
  const setUi = useAppStore((s) => s.setUi);
1284
2774
  const appStoreApi = useAppStoreApi();
1285
2775
  const { localName = name } = useNestedFieldContext();
1286
- const getValue = useCallback(() => {
2776
+ const getValue = useCallback2(() => {
1287
2777
  var _a;
1288
2778
  if (typeof value !== "undefined") return value;
1289
2779
  const { selectedItem } = appStoreApi.getState();
1290
2780
  const props = (_a = name ? selectedItem == null ? void 0 : selectedItem.props : {}) != null ? _a : {};
1291
2781
  return name ? getDeep(props, name) : [];
1292
2782
  }, [appStoreApi, name, value]);
1293
- const getArrayState = useCallback(() => {
2783
+ const getArrayState = useCallback2(() => {
1294
2784
  const { state } = appStoreApi.getState();
1295
2785
  const value2 = getValue();
1296
2786
  return state.ui.arrayState[id] || {
@@ -1311,7 +2801,7 @@ var ArrayField = ({
1311
2801
  });
1312
2802
  const [mirror, setLocalState] = useState3(getArrayState());
1313
2803
  const appStore = useAppStoreApi();
1314
- const mapArrayStateToUi = useCallback(
2804
+ const mapArrayStateToUi = useCallback2(
1315
2805
  (partialArrayState) => {
1316
2806
  const state = appStore.getState().state;
1317
2807
  return {
@@ -1322,13 +2812,13 @@ var ArrayField = ({
1322
2812
  },
1323
2813
  [appStore]
1324
2814
  );
1325
- const getHighestIndex = useCallback(() => {
2815
+ const getHighestIndex = useCallback2(() => {
1326
2816
  return getArrayState().items.reduce(
1327
2817
  (acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
1328
2818
  -1
1329
2819
  );
1330
2820
  }, []);
1331
- const regenerateArrayState = useCallback((value2) => {
2821
+ const regenerateArrayState = useCallback2((value2) => {
1332
2822
  let highestIndex = getHighestIndex();
1333
2823
  const arrayState = getArrayState();
1334
2824
  const newItems = Array.from(value2 || []).map((item, idx) => {
@@ -1349,10 +2839,10 @@ var ArrayField = ({
1349
2839
  const [draggedItem, setDraggedItem] = useState3("");
1350
2840
  const isDraggingAny = !!draggedItem;
1351
2841
  const valueRef = useRef([]);
1352
- useEffect(() => {
2842
+ useEffect5(() => {
1353
2843
  valueRef.current = getValue();
1354
2844
  }, []);
1355
- const uniqifyItem = useCallback(
2845
+ const uniqifyItem = useCallback2(
1356
2846
  (val) => {
1357
2847
  if (field.type !== "array" || !field.arrayFields) return;
1358
2848
  const config = appStore.getState().config;
@@ -1370,7 +2860,7 @@ var ArrayField = ({
1370
2860
  },
1371
2861
  [appStore, field]
1372
2862
  );
1373
- const syncCurrentIndexes = useCallback(() => {
2863
+ const syncCurrentIndexes = useCallback2(() => {
1374
2864
  const arrayState = getArrayState();
1375
2865
  const newArrayStateItems = arrayState.items.map((item, index) => __spreadProps(__spreadValues({}, item), {
1376
2866
  _currentIndex: index
@@ -1386,7 +2876,7 @@ var ArrayField = ({
1386
2876
  };
1387
2877
  setUi(newUi, false);
1388
2878
  }, []);
1389
- const updateValue = useCallback(
2879
+ const updateValue = useCallback2(
1390
2880
  (newValue) => {
1391
2881
  const newArrayState = regenerateArrayState(newValue);
1392
2882
  setUi(mapArrayStateToUi(newArrayState), false);
@@ -1628,15 +3118,15 @@ var DefaultField = ({
1628
3118
 
1629
3119
  // components/AutoField/fields/ExternalField/index.tsx
1630
3120
  init_react_import();
1631
- import { useEffect as useEffect5 } from "react";
3121
+ import { useEffect as useEffect9 } from "react";
1632
3122
 
1633
3123
  // components/ExternalInput/index.tsx
1634
3124
  init_react_import();
1635
3125
  import {
1636
3126
  useMemo as useMemo2,
1637
- useEffect as useEffect4,
3127
+ useEffect as useEffect8,
1638
3128
  useState as useState6,
1639
- useCallback as useCallback2,
3129
+ useCallback as useCallback3,
1640
3130
  isValidElement
1641
3131
  } from "react";
1642
3132
 
@@ -1646,7 +3136,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
1646
3136
 
1647
3137
  // components/Modal/index.tsx
1648
3138
  init_react_import();
1649
- import { useEffect as useEffect2, useState as useState4 } from "react";
3139
+ import { useEffect as useEffect6, useState as useState4 } from "react";
1650
3140
 
1651
3141
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
1652
3142
  init_react_import();
@@ -1662,7 +3152,7 @@ var Modal = ({
1662
3152
  isOpen
1663
3153
  }) => {
1664
3154
  const [rootEl, setRootEl] = useState4(null);
1665
- useEffect2(() => {
3155
+ useEffect6(() => {
1666
3156
  setRootEl(document.getElementById("puck-portal-root"));
1667
3157
  }, []);
1668
3158
  if (!rootEl) {
@@ -1709,7 +3199,7 @@ init_react_import();
1709
3199
 
1710
3200
  // components/Button/Button.tsx
1711
3201
  init_react_import();
1712
- import { useEffect as useEffect3, useState as useState5 } from "react";
3202
+ import { useEffect as useEffect7, useState as useState5 } from "react";
1713
3203
 
1714
3204
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
1715
3205
  init_react_import();
@@ -1760,7 +3250,7 @@ var Button = (_a) => {
1760
3250
  "loading"
1761
3251
  ]);
1762
3252
  const [loading, setLoading] = useState5(loadingProp);
1763
- useEffect3(() => setLoading(loadingProp), [loadingProp]);
3253
+ useEffect7(() => setLoading(loadingProp), [loadingProp]);
1764
3254
  const ElementType = href ? "a" : type ? "button" : "span";
1765
3255
  const dataAttrs = filterDataAttrs(props);
1766
3256
  const el = /* @__PURE__ */ jsxs5(
@@ -1836,7 +3326,7 @@ var ExternalInput = ({
1836
3326
  return Array.from(validKeys);
1837
3327
  }, [mappedData]);
1838
3328
  const [searchQuery, setSearchQuery] = useState6(field.initialQuery || "");
1839
- const search = useCallback2(
3329
+ const search = useCallback3(
1840
3330
  (query, filters2) => __async(void 0, null, function* () {
1841
3331
  setIsLoading(true);
1842
3332
  const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
@@ -1849,7 +3339,7 @@ var ExternalInput = ({
1849
3339
  }),
1850
3340
  [id, field]
1851
3341
  );
1852
- const Footer = useCallback2(
3342
+ const Footer = useCallback3(
1853
3343
  (props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ jsxs6("span", { className: getClassNameModal("footer"), children: [
1854
3344
  props.items.length,
1855
3345
  " result",
@@ -1857,7 +3347,7 @@ var ExternalInput = ({
1857
3347
  ] }),
1858
3348
  [field.renderFooter]
1859
3349
  );
1860
- useEffect4(() => {
3350
+ useEffect8(() => {
1861
3351
  search(searchQuery, filters);
1862
3352
  }, []);
1863
3353
  return /* @__PURE__ */ jsxs6(
@@ -2033,7 +3523,7 @@ var ExternalField = ({
2033
3523
  var _a, _b, _c;
2034
3524
  const validField = field;
2035
3525
  const deprecatedField = field;
2036
- useEffect5(() => {
3526
+ useEffect9(() => {
2037
3527
  if (deprecatedField.adaptor) {
2038
3528
  console.error(
2039
3529
  "Warning: The `adaptor` API is deprecated. Please use updated APIs on the `external` field instead. This will be a breaking change in a future release."
@@ -2227,7 +3717,7 @@ init_react_import();
2227
3717
  var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
2228
3718
 
2229
3719
  // components/AutoField/fields/ObjectField/index.tsx
2230
- import { useCallback as useCallback3 } from "react";
3720
+ import { useCallback as useCallback4 } from "react";
2231
3721
  import { jsx as jsx18 } from "react/jsx-runtime";
2232
3722
  var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
2233
3723
  var ObjectField = ({
@@ -2246,7 +3736,7 @@ var ObjectField = ({
2246
3736
  const canEdit = useAppStore(
2247
3737
  (s) => s.permissions.getPermissions({ item: s.selectedItem }).edit
2248
3738
  );
2249
- const getValue = useCallback3(() => {
3739
+ const getValue = useCallback4(() => {
2250
3740
  var _a;
2251
3741
  if (typeof value !== "undefined") return value;
2252
3742
  const { selectedItem } = appStoreApi.getState();
@@ -2373,7 +3863,7 @@ function AutoFieldInternal(_a) {
2373
3863
  var _a3;
2374
3864
  return (_a3 = s.selectedItem) == null ? void 0 : _a3.readOnly;
2375
3865
  }));
2376
- const nestedFieldContext = useContext2(NestedFieldContext);
3866
+ const nestedFieldContext = useContext3(NestedFieldContext);
2377
3867
  const { id, Label: Label2 = FieldLabelInternal } = props;
2378
3868
  const field = props.field;
2379
3869
  const label = field.label;
@@ -2406,7 +3896,7 @@ function AutoFieldInternal(_a) {
2406
3896
  }),
2407
3897
  [props, field, label, labelIcon, Label2, resolvedId]
2408
3898
  );
2409
- const onFocus = useCallback4(
3899
+ const onFocus = useCallback5(
2410
3900
  (e) => {
2411
3901
  if (mergedProps.name && (e.target.nodeName === "INPUT" || e.target.nodeName === "TEXTAREA")) {
2412
3902
  e.stopPropagation();
@@ -2420,7 +3910,7 @@ function AutoFieldInternal(_a) {
2420
3910
  },
2421
3911
  [mergedProps.name]
2422
3912
  );
2423
- const onBlur = useCallback4((e) => {
3913
+ const onBlur = useCallback5((e) => {
2424
3914
  if ("name" in e.target) {
2425
3915
  dispatch({
2426
3916
  type: "setUi",
@@ -2494,7 +3984,7 @@ function AutoFieldPrivate(props) {
2494
3984
  }
2495
3985
  });
2496
3986
  const [localValue, setLocalValue] = useState8(value);
2497
- const onChangeLocal = useCallback4(
3987
+ const onChangeLocal = useCallback5(
2498
3988
  (val, ui) => {
2499
3989
  const excludedFields = ["array", "object"];
2500
3990
  if (!excludedFields.includes(props.field.type)) {
@@ -2504,12 +3994,12 @@ function AutoFieldPrivate(props) {
2504
3994
  },
2505
3995
  [props.field.type]
2506
3996
  );
2507
- useEffect6(() => {
3997
+ useEffect10(() => {
2508
3998
  if (!isFocused) {
2509
3999
  setLocalValue(value);
2510
4000
  }
2511
4001
  }, [value]);
2512
- useEffect6(() => {
4002
+ useEffect10(() => {
2513
4003
  if (!isFocused) {
2514
4004
  if (value !== localValue) {
2515
4005
  setLocalValue(value);
@@ -2556,19 +4046,19 @@ init_react_import();
2556
4046
  var styles_module_default10 = { "Drawer": "_Drawer_pl7z0_1", "Drawer-draggable": "_Drawer-draggable_pl7z0_8", "Drawer-draggableBg": "_Drawer-draggableBg_pl7z0_12", "DrawerItem-draggable": "_DrawerItem-draggable_pl7z0_22", "DrawerItem--disabled": "_DrawerItem--disabled_pl7z0_35", "DrawerItem": "_DrawerItem_pl7z0_22", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_pl7z0_45", "DrawerItem-name": "_DrawerItem-name_pl7z0_63" };
2557
4047
 
2558
4048
  // components/Drawer/index.tsx
2559
- import { useMemo as useMemo9, useState as useState15 } from "react";
4049
+ import { useMemo as useMemo9, useState as useState16 } from "react";
2560
4050
 
2561
4051
  // components/DragDropContext/index.tsx
2562
4052
  init_react_import();
2563
4053
  import { DragDropProvider as DragDropProvider2 } from "@dnd-kit/react";
2564
4054
  import {
2565
- createContext as createContext3,
2566
- useCallback as useCallback11,
2567
- useContext as useContext7,
2568
- useEffect as useEffect13,
4055
+ createContext as createContext4,
4056
+ useCallback as useCallback12,
4057
+ useContext as useContext8,
4058
+ useEffect as useEffect18,
2569
4059
  useMemo as useMemo8,
2570
- useRef as useRef5,
2571
- useState as useState14
4060
+ useRef as useRef6,
4061
+ useState as useState15
2572
4062
  } from "react";
2573
4063
  import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
2574
4064
 
@@ -2576,20 +4066,20 @@ import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
2576
4066
  init_react_import();
2577
4067
  import {
2578
4068
  forwardRef as forwardRef3,
2579
- memo as memo3,
2580
- useCallback as useCallback10,
2581
- useContext as useContext6,
2582
- useEffect as useEffect12,
4069
+ memo as memo4,
4070
+ useCallback as useCallback11,
4071
+ useContext as useContext7,
4072
+ useEffect as useEffect17,
2583
4073
  useMemo as useMemo7,
2584
- useRef as useRef4
4074
+ useRef as useRef5
2585
4075
  } from "react";
2586
4076
 
2587
4077
  // components/DraggableComponent/index.tsx
2588
4078
  init_react_import();
2589
4079
  import {
2590
- useCallback as useCallback7,
2591
- useContext as useContext4,
2592
- useEffect as useEffect8,
4080
+ useCallback as useCallback8,
4081
+ useContext as useContext5,
4082
+ useEffect as useEffect12,
2593
4083
  useMemo as useMemo5,
2594
4084
  useRef as useRef2,
2595
4085
  useState as useState10,
@@ -2625,14 +4115,14 @@ function getDeepScrollPosition(element) {
2625
4115
  // components/DropZone/context.tsx
2626
4116
  init_react_import();
2627
4117
  import {
2628
- createContext as createContext2,
2629
- useCallback as useCallback5,
4118
+ createContext as createContext3,
4119
+ useCallback as useCallback6,
2630
4120
  useMemo as useMemo4
2631
4121
  } from "react";
2632
4122
  import { createStore as createStore2 } from "zustand";
2633
4123
  import { Fragment as Fragment6, jsx as jsx20 } from "react/jsx-runtime";
2634
- var dropZoneContext = createContext2(null);
2635
- var ZoneStoreContext = createContext2(
4124
+ var dropZoneContext = createContext3(null);
4125
+ var ZoneStoreContext = createContext3(
2636
4126
  createStore2(() => ({
2637
4127
  zoneDepthIndex: {},
2638
4128
  nextZoneDepthIndex: {},
@@ -2655,7 +4145,7 @@ var DropZoneProvider = ({
2655
4145
  value
2656
4146
  }) => {
2657
4147
  const dispatch = useAppStore((s) => s.dispatch);
2658
- const registerZone = useCallback5(
4148
+ const registerZone = useCallback6(
2659
4149
  (zoneCompound) => {
2660
4150
  dispatch({
2661
4151
  type: "registerZone",
@@ -2694,23 +4184,23 @@ function accumulateTransform(el) {
2694
4184
 
2695
4185
  // lib/use-context-store.ts
2696
4186
  init_react_import();
2697
- import { useContext as useContext3 } from "react";
2698
- import { useStore } from "zustand";
4187
+ import { useContext as useContext4 } from "react";
4188
+ import { useStore as useStore2 } from "zustand";
2699
4189
  import { useShallow as useShallow2 } from "zustand/react/shallow";
2700
4190
  function useContextStore(context, selector) {
2701
- const store = useContext3(context);
4191
+ const store = useContext4(context);
2702
4192
  if (!store) {
2703
4193
  throw new Error("useContextStore must be used inside context");
2704
4194
  }
2705
- return useStore(store, useShallow2(selector));
4195
+ return useStore2(store, useShallow2(selector));
2706
4196
  }
2707
4197
 
2708
4198
  // lib/dnd/use-on-drag-finished.ts
2709
4199
  init_react_import();
2710
- import { useCallback as useCallback6 } from "react";
4200
+ import { useCallback as useCallback7 } from "react";
2711
4201
  var useOnDragFinished = (cb, deps = []) => {
2712
4202
  const appStore = useAppStoreApi();
2713
- return useCallback6(() => {
4203
+ return useCallback7(() => {
2714
4204
  let dispose = () => {
2715
4205
  };
2716
4206
  const processDragging = (isDragging2) => {
@@ -2783,9 +4273,9 @@ var DraggableComponent = ({
2783
4273
  const overrides = useAppStore((s) => s.overrides);
2784
4274
  const dispatch = useAppStore((s) => s.dispatch);
2785
4275
  const iframe = useAppStore((s) => s.iframe);
2786
- const ctx = useContext4(dropZoneContext);
4276
+ const ctx = useContext5(dropZoneContext);
2787
4277
  const [localZones, setLocalZones] = useState10({});
2788
- const registerLocalZone = useCallback7(
4278
+ const registerLocalZone = useCallback8(
2789
4279
  (zoneCompound2, active) => {
2790
4280
  var _a;
2791
4281
  (_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
@@ -2795,7 +4285,7 @@ var DraggableComponent = ({
2795
4285
  },
2796
4286
  [setLocalZones]
2797
4287
  );
2798
- const unregisterLocalZone = useCallback7(
4288
+ const unregisterLocalZone = useCallback8(
2799
4289
  (zoneCompound2) => {
2800
4290
  var _a;
2801
4291
  (_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
@@ -2818,7 +4308,7 @@ var DraggableComponent = ({
2818
4308
  return s.permissions.getPermissions({ item });
2819
4309
  })
2820
4310
  );
2821
- const zoneStore = useContext4(ZoneStoreContext);
4311
+ const zoneStore = useContext5(ZoneStoreContext);
2822
4312
  const [dragAxis, setDragAxis] = useState10(userDragAxis || autoDragAxis);
2823
4313
  const dynamicCollisionDetector = useMemo5(
2824
4314
  () => createDynamicCollisionDetector(dragAxis),
@@ -2852,7 +4342,7 @@ var DraggableComponent = ({
2852
4342
  },
2853
4343
  feedback: "clone"
2854
4344
  });
2855
- useEffect8(() => {
4345
+ useEffect12(() => {
2856
4346
  const isEnabled = zoneStore.getState().enabledIndex[zoneCompound];
2857
4347
  sortable.droppable.disabled = !isEnabled;
2858
4348
  sortable.draggable.disabled = !permissions.drag;
@@ -2870,7 +4360,7 @@ var DraggableComponent = ({
2870
4360
  return cleanup;
2871
4361
  }, [permissions.drag, zoneCompound]);
2872
4362
  const ref = useRef2(null);
2873
- const refSetter = useCallback7(
4363
+ const refSetter = useCallback8(
2874
4364
  (el) => {
2875
4365
  sortableRef(el);
2876
4366
  if (el) {
@@ -2880,13 +4370,13 @@ var DraggableComponent = ({
2880
4370
  [sortableRef]
2881
4371
  );
2882
4372
  const [portalEl, setPortalEl] = useState10();
2883
- useEffect8(() => {
4373
+ useEffect12(() => {
2884
4374
  var _a, _b, _c;
2885
4375
  setPortalEl(
2886
4376
  iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : (_c = (_b = ref.current) == null ? void 0 : _b.closest("[data-puck-preview]")) != null ? _c : document.body
2887
4377
  );
2888
4378
  }, [iframe.enabled, ref.current]);
2889
- const getStyle = useCallback7(() => {
4379
+ const getStyle = useCallback8(() => {
2890
4380
  var _a, _b, _c;
2891
4381
  if (!ref.current) return;
2892
4382
  const rect = ref.current.getBoundingClientRect();
@@ -2912,10 +4402,10 @@ var DraggableComponent = ({
2912
4402
  return style2;
2913
4403
  }, [ref.current]);
2914
4404
  const [style, setStyle] = useState10();
2915
- const sync = useCallback7(() => {
4405
+ const sync = useCallback8(() => {
2916
4406
  setStyle(getStyle());
2917
4407
  }, [ref.current, iframe]);
2918
- useEffect8(() => {
4408
+ useEffect12(() => {
2919
4409
  if (ref.current) {
2920
4410
  const observer = new ResizeObserver(sync);
2921
4411
  observer.observe(ref.current);
@@ -2925,13 +4415,13 @@ var DraggableComponent = ({
2925
4415
  }
2926
4416
  }, [ref.current]);
2927
4417
  const registerNode = useAppStore((s) => s.nodes.registerNode);
2928
- const hideOverlay = useCallback7(() => {
4418
+ const hideOverlay = useCallback8(() => {
2929
4419
  setIsVisible(false);
2930
4420
  }, []);
2931
- const showOverlay = useCallback7(() => {
4421
+ const showOverlay = useCallback8(() => {
2932
4422
  setIsVisible(true);
2933
4423
  }, []);
2934
- useEffect8(() => {
4424
+ useEffect12(() => {
2935
4425
  var _a;
2936
4426
  registerNode(id, {
2937
4427
  methods: { sync, showOverlay, hideOverlay },
@@ -2956,7 +4446,7 @@ var DraggableComponent = ({
2956
4446
  () => overrides.componentOverlay || DefaultOverlay,
2957
4447
  [overrides.componentOverlay]
2958
4448
  );
2959
- const onClick = useCallback7(
4449
+ const onClick = useCallback8(
2960
4450
  (e) => {
2961
4451
  const el = e.target;
2962
4452
  if (!el.closest("[data-puck-overlay-portal]")) {
@@ -2972,7 +4462,7 @@ var DraggableComponent = ({
2972
4462
  [index, zoneCompound, id]
2973
4463
  );
2974
4464
  const appStore = useAppStoreApi();
2975
- const onSelectParent = useCallback7(() => {
4465
+ const onSelectParent = useCallback8(() => {
2976
4466
  const { nodes, zones } = appStore.getState().state.indexes;
2977
4467
  const node = nodes[id];
2978
4468
  const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node == null ? void 0 : node.parentId] : null;
@@ -2993,14 +4483,14 @@ var DraggableComponent = ({
2993
4483
  }
2994
4484
  });
2995
4485
  }, [ctx, path]);
2996
- const onDuplicate = useCallback7(() => {
4486
+ const onDuplicate = useCallback8(() => {
2997
4487
  dispatch({
2998
4488
  type: "duplicate",
2999
4489
  sourceIndex: index,
3000
4490
  sourceZone: zoneCompound
3001
4491
  });
3002
4492
  }, [index, zoneCompound]);
3003
- const onDelete = useCallback7(() => {
4493
+ const onDelete = useCallback8(() => {
3004
4494
  dispatch({
3005
4495
  type: "remove",
3006
4496
  index,
@@ -3012,7 +4502,7 @@ var DraggableComponent = ({
3012
4502
  ZoneStoreContext,
3013
4503
  (s) => s.hoveringComponent === id
3014
4504
  );
3015
- useEffect8(() => {
4505
+ useEffect12(() => {
3016
4506
  if (!ref.current) {
3017
4507
  return;
3018
4508
  }
@@ -3060,7 +4550,7 @@ var DraggableComponent = ({
3060
4550
  const [isVisible, setIsVisible] = useState10(false);
3061
4551
  const [dragFinished, setDragFinished] = useState10(true);
3062
4552
  const [_, startTransition] = useTransition();
3063
- useEffect8(() => {
4553
+ useEffect12(() => {
3064
4554
  startTransition(() => {
3065
4555
  if (hover || indicativeHover || isSelected) {
3066
4556
  sync();
@@ -3082,15 +4572,15 @@ var DraggableComponent = ({
3082
4572
  setDragFinished(false);
3083
4573
  }
3084
4574
  });
3085
- useEffect8(() => {
4575
+ useEffect12(() => {
3086
4576
  if (thisIsDragging) {
3087
4577
  setThisWasDragging(true);
3088
4578
  }
3089
4579
  }, [thisIsDragging]);
3090
- useEffect8(() => {
4580
+ useEffect12(() => {
3091
4581
  if (thisWasDragging) return onDragFinished();
3092
4582
  }, [thisWasDragging, onDragFinished]);
3093
- const syncActionsPosition = useCallback7(
4583
+ const syncActionsPosition = useCallback8(
3094
4584
  (el) => {
3095
4585
  if (el) {
3096
4586
  const view = el.ownerDocument.defaultView;
@@ -3115,7 +4605,7 @@ var DraggableComponent = ({
3115
4605
  },
3116
4606
  [zoom]
3117
4607
  );
3118
- useEffect8(() => {
4608
+ useEffect12(() => {
3119
4609
  if (userDragAxis) {
3120
4610
  setDragAxis(userDragAxis);
3121
4611
  return;
@@ -3229,7 +4719,7 @@ import { useDroppable } from "@dnd-kit/react";
3229
4719
 
3230
4720
  // components/DropZone/lib/use-min-empty-height.ts
3231
4721
  init_react_import();
3232
- import { useEffect as useEffect9, useRef as useRef3, useState as useState11 } from "react";
4722
+ import { useEffect as useEffect13, useRef as useRef3, useState as useState11 } from "react";
3233
4723
  var getNumItems = (appStore, zoneCompound) => appStore.getState().state.indexes.zones[zoneCompound].contentIds.length;
3234
4724
  var useMinEmptyHeight = ({
3235
4725
  zoneCompound,
@@ -3281,7 +4771,7 @@ var useMinEmptyHeight = ({
3281
4771
  },
3282
4772
  [appStore, prevHeight, zoneCompound]
3283
4773
  );
3284
- useEffect9(() => {
4774
+ useEffect13(() => {
3285
4775
  if (draggedItem && ref.current) {
3286
4776
  if (isZone) {
3287
4777
  const rect = ref.current.getBoundingClientRect();
@@ -3312,15 +4802,15 @@ function assignRefs(refs, node) {
3312
4802
 
3313
4803
  // components/DropZone/lib/use-content-with-preview.ts
3314
4804
  init_react_import();
3315
- import { useContext as useContext5, useEffect as useEffect10, useState as useState12 } from "react";
4805
+ import { useContext as useContext6, useEffect as useEffect14, useState as useState12 } from "react";
3316
4806
 
3317
4807
  // lib/dnd/use-rendered-callback.ts
3318
4808
  init_react_import();
3319
4809
  import { useDragDropManager } from "@dnd-kit/react";
3320
- import { useCallback as useCallback8 } from "react";
4810
+ import { useCallback as useCallback9 } from "react";
3321
4811
  function useRenderedCallback(callback, deps) {
3322
4812
  const manager = useDragDropManager();
3323
- return useCallback8(
4813
+ return useCallback9(
3324
4814
  (...args) => __async(this, null, function* () {
3325
4815
  yield manager == null ? void 0 : manager.renderer.rendering;
3326
4816
  return callback(...args);
@@ -3331,7 +4821,7 @@ function useRenderedCallback(callback, deps) {
3331
4821
 
3332
4822
  // components/DropZone/lib/use-content-with-preview.ts
3333
4823
  var useContentIdsWithPreview = (contentIds, zoneCompound) => {
3334
- const zoneStore = useContext5(ZoneStoreContext);
4824
+ const zoneStore = useContext6(ZoneStoreContext);
3335
4825
  const preview = useContextStore(
3336
4826
  ZoneStoreContext,
3337
4827
  (s) => s.previewIndex[zoneCompound]
@@ -3373,7 +4863,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
3373
4863
  },
3374
4864
  []
3375
4865
  );
3376
- useEffect10(() => {
4866
+ useEffect14(() => {
3377
4867
  var _a;
3378
4868
  const s = zoneStore.getState();
3379
4869
  const draggedItemId = (_a = s.draggedItem) == null ? void 0 : _a.id;
@@ -3391,7 +4881,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
3391
4881
 
3392
4882
  // components/DropZone/lib/use-drag-axis.ts
3393
4883
  init_react_import();
3394
- import { useCallback as useCallback9, useEffect as useEffect11, useState as useState13 } from "react";
4884
+ import { useCallback as useCallback10, useEffect as useEffect15, useState as useState13 } from "react";
3395
4885
  var GRID_DRAG_AXIS = "dynamic";
3396
4886
  var FLEX_ROW_DRAG_AXIS = "x";
3397
4887
  var DEFAULT_DRAG_AXIS = "y";
@@ -3400,7 +4890,7 @@ var useDragAxis = (ref, collisionAxis) => {
3400
4890
  const [dragAxis, setDragAxis] = useState13(
3401
4891
  collisionAxis || DEFAULT_DRAG_AXIS
3402
4892
  );
3403
- const calculateDragAxis = useCallback9(() => {
4893
+ const calculateDragAxis = useCallback10(() => {
3404
4894
  if (ref.current) {
3405
4895
  const computedStyle = window.getComputedStyle(ref.current);
3406
4896
  if (computedStyle.display === "grid") {
@@ -3412,7 +4902,7 @@ var useDragAxis = (ref, collisionAxis) => {
3412
4902
  }
3413
4903
  }
3414
4904
  }, [ref.current]);
3415
- useEffect11(() => {
4905
+ useEffect15(() => {
3416
4906
  const onViewportChange = () => {
3417
4907
  calculateDragAxis();
3418
4908
  };
@@ -3421,7 +4911,7 @@ var useDragAxis = (ref, collisionAxis) => {
3421
4911
  window.removeEventListener("viewportchange", onViewportChange);
3422
4912
  };
3423
4913
  }, []);
3424
- useEffect11(calculateDragAxis, [status, collisionAxis]);
4914
+ useEffect15(calculateDragAxis, [status, collisionAxis]);
3425
4915
  return [dragAxis, calculateDragAxis];
3426
4916
  };
3427
4917
 
@@ -3509,12 +4999,239 @@ function Render({
3509
4999
  return /* @__PURE__ */ jsx23(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ jsx23(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx23(DropZoneRenderPure, { zone: rootZone }) }) });
3510
5000
  }
3511
5001
 
5002
+ // lib/field-transforms/default-transforms/inline-text-transform.tsx
5003
+ init_react_import();
5004
+
5005
+ // components/InlineTextField/index.tsx
5006
+ init_react_import();
5007
+ import { memo as memo3, useEffect as useEffect16, useRef as useRef4, useState as useState14 } from "react";
5008
+
5009
+ // lib/overlay-portal/index.tsx
5010
+ init_react_import();
5011
+ var registerOverlayPortal = (el, opts = {}) => {
5012
+ if (!el) return;
5013
+ const { disableDrag = false, disableDragOnFocus = true } = opts;
5014
+ const stopPropagation = (e) => {
5015
+ e.stopPropagation();
5016
+ };
5017
+ el.addEventListener("mouseover", stopPropagation, {
5018
+ capture: true
5019
+ });
5020
+ const onFocus = () => {
5021
+ setTimeout(() => {
5022
+ el.addEventListener("pointerdown", stopPropagation, {
5023
+ capture: true
5024
+ });
5025
+ }, 200);
5026
+ };
5027
+ const onBlur = () => {
5028
+ el.removeEventListener("pointerdown", stopPropagation, {
5029
+ capture: true
5030
+ });
5031
+ };
5032
+ if (disableDragOnFocus) {
5033
+ el.addEventListener("focus", onFocus, { capture: true });
5034
+ el.addEventListener("blur", onBlur, { capture: true });
5035
+ } else if (disableDrag) {
5036
+ el.addEventListener("pointerdown", stopPropagation, {
5037
+ capture: true
5038
+ });
5039
+ }
5040
+ el.setAttribute("data-puck-overlay-portal", "true");
5041
+ return () => {
5042
+ el.removeEventListener("mouseover", stopPropagation, {
5043
+ capture: true
5044
+ });
5045
+ if (disableDragOnFocus) {
5046
+ el.removeEventListener("focus", onFocus, { capture: true });
5047
+ el.removeEventListener("blur", onFocus, { capture: true });
5048
+ } else if (disableDrag) {
5049
+ el.removeEventListener("pointerdown", stopPropagation, {
5050
+ capture: true
5051
+ });
5052
+ }
5053
+ el.removeAttribute("data-puck-overlay-portal");
5054
+ };
5055
+ };
5056
+
5057
+ // css-module:/home/runner/work/puck/puck/packages/core/components/InlineTextField/styles.module.css#css-module
5058
+ init_react_import();
5059
+ var styles_module_default13 = { "InlineTextField": "_InlineTextField_ilw2a_1" };
5060
+
5061
+ // lib/data/set-deep.ts
5062
+ init_react_import();
5063
+ function setDeep(node, path, newVal) {
5064
+ const parts = path.split(".");
5065
+ const newNode = __spreadValues({}, node);
5066
+ let cur = newNode;
5067
+ for (let i = 0; i < parts.length; i++) {
5068
+ const [prop, idxStr] = parts[i].replace("]", "").split("[");
5069
+ const isLast = i === parts.length - 1;
5070
+ if (idxStr !== void 0) {
5071
+ if (!Array.isArray(cur[prop])) {
5072
+ cur[prop] = [];
5073
+ }
5074
+ const idx = Number(idxStr);
5075
+ if (isLast) {
5076
+ cur[prop][idx] = newVal;
5077
+ continue;
5078
+ }
5079
+ if (cur[prop][idx] === void 0) cur[prop][idx] = {};
5080
+ cur = cur[prop][idx];
5081
+ continue;
5082
+ }
5083
+ if (isLast) {
5084
+ cur[prop] = newVal;
5085
+ continue;
5086
+ }
5087
+ if (cur[prop] === void 0) {
5088
+ cur[prop] = {};
5089
+ }
5090
+ cur = cur[prop];
5091
+ }
5092
+ return __spreadValues(__spreadValues({}, node), newNode);
5093
+ }
5094
+
5095
+ // components/InlineTextField/index.tsx
5096
+ import { jsx as jsx24 } from "react/jsx-runtime";
5097
+ var getClassName17 = get_class_name_factory_default("InlineTextField", styles_module_default13);
5098
+ var InlineTextFieldInternal = ({
5099
+ propPath,
5100
+ componentId,
5101
+ value,
5102
+ isReadOnly,
5103
+ opts = {}
5104
+ }) => {
5105
+ var _a;
5106
+ const ref = useRef4(null);
5107
+ const appStoreApi = useAppStoreApi();
5108
+ const disableLineBreaks = (_a = opts.disableLineBreaks) != null ? _a : false;
5109
+ useEffect16(() => {
5110
+ const appStore = appStoreApi.getState();
5111
+ const data = appStore.state.indexes.nodes[componentId].data;
5112
+ const componentConfig = appStore.getComponentConfig(data.type);
5113
+ if (!componentConfig) {
5114
+ throw new Error(
5115
+ `InlineTextField Error: No config defined for ${data.type}`
5116
+ );
5117
+ }
5118
+ if (ref.current) {
5119
+ if (value !== ref.current.innerText) {
5120
+ ref.current.replaceChildren(value);
5121
+ }
5122
+ const cleanupPortal = registerOverlayPortal(ref.current);
5123
+ const handleInput = (e) => __async(void 0, null, function* () {
5124
+ var _a2;
5125
+ const appStore2 = appStoreApi.getState();
5126
+ const node = appStore2.state.indexes.nodes[componentId];
5127
+ const zoneCompound = `${node.parentId}:${node.zone}`;
5128
+ const index = (_a2 = appStore2.state.indexes.zones[zoneCompound]) == null ? void 0 : _a2.contentIds.indexOf(
5129
+ componentId
5130
+ );
5131
+ const newProps = setDeep(node.data.props, propPath, e.target.innerText);
5132
+ const resolvedData = yield appStore2.resolveComponentData(
5133
+ __spreadProps(__spreadValues({}, node.data), { props: newProps }),
5134
+ "replace"
5135
+ );
5136
+ appStore2.dispatch({
5137
+ type: "replace",
5138
+ data: resolvedData.node,
5139
+ destinationIndex: index,
5140
+ destinationZone: zoneCompound
5141
+ });
5142
+ });
5143
+ ref.current.addEventListener("input", handleInput);
5144
+ return () => {
5145
+ var _a2;
5146
+ (_a2 = ref.current) == null ? void 0 : _a2.removeEventListener("input", handleInput);
5147
+ cleanupPortal == null ? void 0 : cleanupPortal();
5148
+ };
5149
+ }
5150
+ }, [appStoreApi, ref.current, value]);
5151
+ const [isHovering, setIsHovering] = useState14(false);
5152
+ const [isFocused, setIsFocused] = useState14(false);
5153
+ return /* @__PURE__ */ jsx24(
5154
+ "span",
5155
+ {
5156
+ className: getClassName17(),
5157
+ ref,
5158
+ contentEditable: isHovering || isFocused ? "plaintext-only" : "false",
5159
+ onClick: (e) => {
5160
+ e.preventDefault();
5161
+ e.stopPropagation();
5162
+ },
5163
+ onClickCapture: (e) => {
5164
+ e.preventDefault();
5165
+ e.stopPropagation();
5166
+ },
5167
+ onKeyDown: (e) => {
5168
+ if (disableLineBreaks && e.key === "Enter" || isReadOnly) {
5169
+ e.preventDefault();
5170
+ }
5171
+ },
5172
+ onMouseOverCapture: () => setIsHovering(true),
5173
+ onMouseOutCapture: () => setIsHovering(false),
5174
+ onFocus: () => setIsFocused(true),
5175
+ onBlur: () => setIsFocused(false)
5176
+ }
5177
+ );
5178
+ };
5179
+ var InlineTextField = memo3(InlineTextFieldInternal);
5180
+
5181
+ // lib/field-transforms/default-transforms/inline-text-transform.tsx
5182
+ import { jsx as jsx25 } from "react/jsx-runtime";
5183
+ var getInlineTextTransform = () => ({
5184
+ text: ({ value, componentId, field, propPath, isReadOnly }) => {
5185
+ if (field.contentEditable) {
5186
+ return /* @__PURE__ */ jsx25(
5187
+ InlineTextField,
5188
+ {
5189
+ propPath,
5190
+ componentId,
5191
+ value,
5192
+ opts: { disableLineBreaks: true },
5193
+ isReadOnly
5194
+ }
5195
+ );
5196
+ }
5197
+ return value;
5198
+ },
5199
+ textarea: ({ value, componentId, field, propPath, isReadOnly }) => {
5200
+ if (field.contentEditable) {
5201
+ return /* @__PURE__ */ jsx25(
5202
+ InlineTextField,
5203
+ {
5204
+ propPath,
5205
+ componentId,
5206
+ value,
5207
+ isReadOnly
5208
+ }
5209
+ );
5210
+ }
5211
+ return value;
5212
+ },
5213
+ custom: ({ value, componentId, field, propPath, isReadOnly }) => {
5214
+ if (field.contentEditable && typeof value === "string") {
5215
+ return /* @__PURE__ */ jsx25(
5216
+ InlineTextField,
5217
+ {
5218
+ propPath,
5219
+ componentId,
5220
+ value,
5221
+ isReadOnly
5222
+ }
5223
+ );
5224
+ }
5225
+ return value;
5226
+ }
5227
+ });
5228
+
3512
5229
  // components/DropZone/index.tsx
3513
- import { Fragment as Fragment8, jsx as jsx24, jsxs as jsxs10 } from "react/jsx-runtime";
3514
- var getClassName17 = get_class_name_factory_default("DropZone", styles_module_default12);
5230
+ import { Fragment as Fragment8, jsx as jsx26, jsxs as jsxs10 } from "react/jsx-runtime";
5231
+ var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default12);
3515
5232
  var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
3516
5233
  var RENDER_DEBUG = false;
3517
- var DropZoneEditPure = (props) => /* @__PURE__ */ jsx24(DropZoneEdit, __spreadValues({}, props));
5234
+ var DropZoneEditPure = (props) => /* @__PURE__ */ jsx26(DropZoneEdit, __spreadValues({}, props));
3518
5235
  var DropZoneChild = ({
3519
5236
  zoneCompound,
3520
5237
  componentId,
@@ -3525,9 +5242,9 @@ var DropZoneChild = ({
3525
5242
  }) => {
3526
5243
  var _a, _b;
3527
5244
  const metadata = useAppStore((s) => s.metadata);
3528
- const ctx = useContext6(dropZoneContext);
5245
+ const ctx = useContext7(dropZoneContext);
3529
5246
  const { depth = 1 } = ctx != null ? ctx : {};
3530
- const zoneStore = useContext6(ZoneStoreContext);
5247
+ const zoneStore = useContext7(ZoneStoreContext);
3531
5248
  const nodeProps = useAppStore(
3532
5249
  useShallow5((s) => {
3533
5250
  var _a2;
@@ -3598,10 +5315,10 @@ var DropZoneChild = ({
3598
5315
  if (item && "element" in item && item.element) {
3599
5316
  return (
3600
5317
  // Safe to use this since the HTML is set by the user
3601
- /* @__PURE__ */ jsx24("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
5318
+ /* @__PURE__ */ jsx26("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
3602
5319
  );
3603
5320
  }
3604
- return /* @__PURE__ */ jsx24(DrawerItemInner, { name: label, children: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem });
5321
+ return /* @__PURE__ */ jsx26(DrawerItemInner, { name: label, children: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem });
3605
5322
  },
3606
5323
  [componentId, label, overrides]
3607
5324
  );
@@ -3624,7 +5341,7 @@ var DropZoneChild = ({
3624
5341
  const plugins = useAppStore((s) => s.plugins);
3625
5342
  const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
3626
5343
  const combinedFieldTransforms = useMemo7(
3627
- () => __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ jsx24(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), plugins.reduce(
5344
+ () => __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ jsx26(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), plugins.reduce(
3628
5345
  (acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
3629
5346
  {}
3630
5347
  )), userFieldTransforms),
@@ -3647,7 +5364,7 @@ var DropZoneChild = ({
3647
5364
  if (isInserting) {
3648
5365
  Render2 = renderPreview;
3649
5366
  }
3650
- return /* @__PURE__ */ jsx24(
5367
+ return /* @__PURE__ */ jsx26(
3651
5368
  DraggableComponent,
3652
5369
  {
3653
5370
  id: componentId,
@@ -3661,18 +5378,18 @@ var DropZoneChild = ({
3661
5378
  autoDragAxis: dragAxis,
3662
5379
  userDragAxis: collisionAxis,
3663
5380
  inDroppableZone,
3664
- children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isInserting ? /* @__PURE__ */ jsx24(Fragment8, { children: /* @__PURE__ */ jsx24(
5381
+ children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isInserting ? /* @__PURE__ */ jsx26(Fragment8, { children: /* @__PURE__ */ jsx26(
3665
5382
  Render2,
3666
5383
  __spreadProps(__spreadValues({}, transformedProps), {
3667
5384
  puck: __spreadProps(__spreadValues({}, transformedProps.puck), {
3668
5385
  dragRef
3669
5386
  })
3670
5387
  })
3671
- ) }) : /* @__PURE__ */ jsx24("div", { ref: dragRef, children: /* @__PURE__ */ jsx24(Render2, __spreadValues({}, transformedProps)) })
5388
+ ) }) : /* @__PURE__ */ jsx26("div", { ref: dragRef, children: /* @__PURE__ */ jsx26(Render2, __spreadValues({}, transformedProps)) })
3672
5389
  }
3673
5390
  );
3674
5391
  };
3675
- var DropZoneChildMemo = memo3(DropZoneChild);
5392
+ var DropZoneChildMemo = memo4(DropZoneChild);
3676
5393
  var DropZoneEdit = forwardRef3(
3677
5394
  function DropZoneEditInternal({
3678
5395
  zone,
@@ -3683,7 +5400,7 @@ var DropZoneEdit = forwardRef3(
3683
5400
  minEmptyHeight: userMinEmptyHeight = 128,
3684
5401
  collisionAxis
3685
5402
  }, userRef) {
3686
- const ctx = useContext6(dropZoneContext);
5403
+ const ctx = useContext7(dropZoneContext);
3687
5404
  const appStoreApi = useAppStoreApi();
3688
5405
  const {
3689
5406
  // These all need setting via context
@@ -3721,14 +5438,14 @@ var DropZoneEdit = forwardRef3(
3721
5438
  return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.type;
3722
5439
  })
3723
5440
  );
3724
- useEffect12(() => {
5441
+ useEffect17(() => {
3725
5442
  if (!zoneType || zoneType === "dropzone") {
3726
5443
  if (ctx == null ? void 0 : ctx.registerZone) {
3727
5444
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
3728
5445
  }
3729
5446
  }
3730
5447
  }, [zoneType, appStoreApi]);
3731
- useEffect12(() => {
5448
+ useEffect17(() => {
3732
5449
  if (zoneType === "dropzone") {
3733
5450
  if (zoneCompound !== rootDroppableId) {
3734
5451
  console.warn(
@@ -3740,8 +5457,8 @@ var DropZoneEdit = forwardRef3(
3740
5457
  const contentIds = useMemo7(() => {
3741
5458
  return zoneContentIds || [];
3742
5459
  }, [zoneContentIds]);
3743
- const ref = useRef4(null);
3744
- const acceptsTarget = useCallback10(
5460
+ const ref = useRef5(null);
5461
+ const acceptsTarget = useCallback11(
3745
5462
  (componentType) => {
3746
5463
  if (!componentType) {
3747
5464
  return true;
@@ -3779,7 +5496,7 @@ var DropZoneEdit = forwardRef3(
3779
5496
  }
3780
5497
  return _isEnabled;
3781
5498
  });
3782
- useEffect12(() => {
5499
+ useEffect17(() => {
3783
5500
  if (registerLocalZone) {
3784
5501
  registerLocalZone(zoneCompound, targetAccepted || isEnabled);
3785
5502
  }
@@ -3794,8 +5511,8 @@ var DropZoneEdit = forwardRef3(
3794
5511
  zoneCompound
3795
5512
  );
3796
5513
  const isDropEnabled = isEnabled && (preview ? contentIdsWithPreview.length === 1 : contentIdsWithPreview.length === 0);
3797
- const zoneStore = useContext6(ZoneStoreContext);
3798
- useEffect12(() => {
5514
+ const zoneStore = useContext7(ZoneStoreContext);
5515
+ useEffect17(() => {
3799
5516
  const { enabledIndex } = zoneStore.getState();
3800
5517
  zoneStore.setState({
3801
5518
  enabledIndex: __spreadProps(__spreadValues({}, enabledIndex), { [zoneCompound]: isEnabled })
@@ -3824,10 +5541,10 @@ var DropZoneEdit = forwardRef3(
3824
5541
  userMinEmptyHeight,
3825
5542
  ref
3826
5543
  });
3827
- return /* @__PURE__ */ jsx24(
5544
+ return /* @__PURE__ */ jsx26(
3828
5545
  "div",
3829
5546
  {
3830
- className: `${getClassName17({
5547
+ className: `${getClassName18({
3831
5548
  isRootZone,
3832
5549
  hoveringOverArea,
3833
5550
  isEnabled,
@@ -3845,7 +5562,7 @@ var DropZoneEdit = forwardRef3(
3845
5562
  backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
3846
5563
  }),
3847
5564
  children: contentIdsWithPreview.map((componentId, i) => {
3848
- return /* @__PURE__ */ jsx24(
5565
+ return /* @__PURE__ */ jsx26(
3849
5566
  DropZoneChildMemo,
3850
5567
  {
3851
5568
  zoneCompound,
@@ -3868,7 +5585,7 @@ var DropZoneRenderItem = ({
3868
5585
  metadata
3869
5586
  }) => {
3870
5587
  const Component = config.components[item.type];
3871
- const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx24(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
5588
+ const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx26(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
3872
5589
  const nextContextValue = useMemo7(
3873
5590
  () => ({
3874
5591
  areaId: props.id,
@@ -3876,7 +5593,7 @@ var DropZoneRenderItem = ({
3876
5593
  }),
3877
5594
  [props]
3878
5595
  );
3879
- return /* @__PURE__ */ jsx24(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx24(
5596
+ return /* @__PURE__ */ jsx26(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx26(
3880
5597
  Component.render,
3881
5598
  __spreadProps(__spreadValues({}, props), {
3882
5599
  puck: __spreadProps(__spreadValues({}, props.puck), {
@@ -3886,15 +5603,15 @@ var DropZoneRenderItem = ({
3886
5603
  })
3887
5604
  ) }, props.id);
3888
5605
  };
3889
- var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx24(DropZoneRender, __spreadValues({}, props));
5606
+ var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx26(DropZoneRender, __spreadValues({}, props));
3890
5607
  var DropZoneRender = forwardRef3(
3891
5608
  function DropZoneRenderInternal({ className, style, zone }, ref) {
3892
- const ctx = useContext6(dropZoneContext);
5609
+ const ctx = useContext7(dropZoneContext);
3893
5610
  const { areaId = "root" } = ctx || {};
3894
- const { config, data, metadata } = useContext6(renderContext);
5611
+ const { config, data, metadata } = useContext7(renderContext);
3895
5612
  let zoneCompound = `${areaId}:${zone}`;
3896
5613
  let content = (data == null ? void 0 : data.content) || [];
3897
- useEffect12(() => {
5614
+ useEffect17(() => {
3898
5615
  if (!content) {
3899
5616
  if (ctx == null ? void 0 : ctx.registerZone) {
3900
5617
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
@@ -3907,10 +5624,10 @@ var DropZoneRender = forwardRef3(
3907
5624
  if (zoneCompound !== rootDroppableId) {
3908
5625
  content = setupZone(data, zoneCompound).zones[zoneCompound];
3909
5626
  }
3910
- return /* @__PURE__ */ jsx24("div", { className, style, ref, children: content.map((item) => {
5627
+ return /* @__PURE__ */ jsx26("div", { className, style, ref, children: content.map((item) => {
3911
5628
  const Component = config.components[item.type];
3912
5629
  if (Component) {
3913
- return /* @__PURE__ */ jsx24(
5630
+ return /* @__PURE__ */ jsx26(
3914
5631
  DropZoneRenderItem,
3915
5632
  {
3916
5633
  config,
@@ -3924,14 +5641,14 @@ var DropZoneRender = forwardRef3(
3924
5641
  }) });
3925
5642
  }
3926
5643
  );
3927
- var DropZonePure = (props) => /* @__PURE__ */ jsx24(DropZone, __spreadValues({}, props));
5644
+ var DropZonePure = (props) => /* @__PURE__ */ jsx26(DropZone, __spreadValues({}, props));
3928
5645
  var DropZone = forwardRef3(
3929
5646
  function DropZone2(props, ref) {
3930
- const ctx = useContext6(dropZoneContext);
5647
+ const ctx = useContext7(dropZoneContext);
3931
5648
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
3932
- return /* @__PURE__ */ jsx24(Fragment8, { children: /* @__PURE__ */ jsx24(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
5649
+ return /* @__PURE__ */ jsx26(Fragment8, { children: /* @__PURE__ */ jsx26(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
3933
5650
  }
3934
- return /* @__PURE__ */ jsx24(Fragment8, { children: /* @__PURE__ */ jsx24(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
5651
+ return /* @__PURE__ */ jsx26(Fragment8, { children: /* @__PURE__ */ jsx26(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
3935
5652
  }
3936
5653
  );
3937
5654
 
@@ -4222,7 +5939,7 @@ var insertComponent = (componentType, zone, index, appStore) => __async(void 0,
4222
5939
  destinationZone: zone,
4223
5940
  id
4224
5941
  };
4225
- const { state, dispatch, resolveComponentData } = appStore;
5942
+ const { state, dispatch, resolveComponentData: resolveComponentData2 } = appStore;
4226
5943
  const insertedState = insertAction(state, insertActionData, appStore);
4227
5944
  dispatch(__spreadProps(__spreadValues({}, insertActionData), {
4228
5945
  // Dispatch insert rather set, as user's may rely on this via onAction
@@ -4238,7 +5955,7 @@ var insertComponent = (componentType, zone, index, appStore) => __async(void 0,
4238
5955
  dispatch({ type: "setUi", ui: { itemSelector } });
4239
5956
  const itemData = getItem(itemSelector, insertedState);
4240
5957
  if (itemData) {
4241
- const resolved = yield resolveComponentData(itemData, "insert");
5958
+ const resolved = yield resolveComponentData2(itemData, "insert");
4242
5959
  if (resolved.didChange) {
4243
5960
  dispatch({
4244
5961
  type: "replace",
@@ -4267,14 +5984,14 @@ function getDeepDir(el) {
4267
5984
 
4268
5985
  // components/DragDropContext/index.tsx
4269
5986
  import { effect } from "@dnd-kit/state";
4270
- import { jsx as jsx25 } from "react/jsx-runtime";
5987
+ import { jsx as jsx27 } from "react/jsx-runtime";
4271
5988
  var DEBUG3 = false;
4272
- var dragListenerContext = createContext3({
5989
+ var dragListenerContext = createContext4({
4273
5990
  dragListeners: {}
4274
5991
  });
4275
5992
  function useDragListener(type, fn, deps = []) {
4276
- const { setDragListeners } = useContext7(dragListenerContext);
4277
- useEffect13(() => {
5993
+ const { setDragListeners } = useContext8(dragListenerContext);
5994
+ useEffect18(() => {
4278
5995
  if (setDragListeners) {
4279
5996
  setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
4280
5997
  [type]: [...old[type] || [], fn]
@@ -4284,8 +6001,8 @@ function useDragListener(type, fn, deps = []) {
4284
6001
  }
4285
6002
  var AREA_CHANGE_DEBOUNCE_MS = 100;
4286
6003
  var useTempDisableFallback = (timeout3) => {
4287
- const lastFallbackDisable = useRef5(null);
4288
- return useCallback11((manager) => {
6004
+ const lastFallbackDisable = useRef6(null);
6005
+ return useCallback12((manager) => {
4289
6006
  collisionStore.setState({ fallbackEnabled: false });
4290
6007
  const fallbackId = generateId();
4291
6008
  lastFallbackDisable.current = fallbackId;
@@ -4304,9 +6021,9 @@ var DragDropContextClient = ({
4304
6021
  const dispatch = useAppStore((s) => s.dispatch);
4305
6022
  const appStore = useAppStoreApi();
4306
6023
  const id = useSafeId();
4307
- const debouncedParamsRef = useRef5(null);
6024
+ const debouncedParamsRef = useRef6(null);
4308
6025
  const tempDisableFallback = useTempDisableFallback(100);
4309
- const [zoneStore] = useState14(
6026
+ const [zoneStore] = useState15(
4310
6027
  () => createStore3(() => ({
4311
6028
  zoneDepthIndex: {},
4312
6029
  nextZoneDepthIndex: {},
@@ -4318,7 +6035,7 @@ var DragDropContextClient = ({
4318
6035
  hoveringComponent: null
4319
6036
  }))
4320
6037
  );
4321
- const getChanged = useCallback11(
6038
+ const getChanged2 = useCallback12(
4322
6039
  (params, id2) => {
4323
6040
  const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
4324
6041
  const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
@@ -4339,9 +6056,9 @@ var DragDropContextClient = ({
4339
6056
  },
4340
6057
  [zoneStore]
4341
6058
  );
4342
- const setDeepestAndCollide = useCallback11(
6059
+ const setDeepestAndCollide = useCallback12(
4343
6060
  (params, manager) => {
4344
- const { zoneChanged, areaChanged } = getChanged(params, id);
6061
+ const { zoneChanged, areaChanged } = getChanged2(params, id);
4345
6062
  if (!zoneChanged && !areaChanged) return;
4346
6063
  zoneStore.setState({
4347
6064
  zoneDepthIndex: params.zone ? { [params.zone]: true } : {},
@@ -4363,7 +6080,7 @@ var DragDropContextClient = ({
4363
6080
  setDeepestDb.cancel();
4364
6081
  debouncedParamsRef.current = null;
4365
6082
  };
4366
- useEffect13(() => {
6083
+ useEffect18(() => {
4367
6084
  if (DEBUG3) {
4368
6085
  zoneStore.subscribe(
4369
6086
  (s) => {
@@ -4377,13 +6094,13 @@ var DragDropContextClient = ({
4377
6094
  );
4378
6095
  }
4379
6096
  }, []);
4380
- const [plugins] = useState14(() => [
6097
+ const [plugins] = useState15(() => [
4381
6098
  ...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
4382
6099
  createNestedDroppablePlugin(
4383
6100
  {
4384
6101
  onChange: (params, manager) => {
4385
6102
  const state = zoneStore.getState();
4386
- const { zoneChanged, areaChanged } = getChanged(params, id);
6103
+ const { zoneChanged, areaChanged } = getChanged2(params, id);
4387
6104
  const isDragging = manager.dragOperation.status.dragging;
4388
6105
  if (areaChanged || zoneChanged) {
4389
6106
  let nextZoneDepthIndex = {};
@@ -4425,9 +6142,9 @@ var DragDropContextClient = ({
4425
6142
  )
4426
6143
  ]);
4427
6144
  const sensors = useSensors();
4428
- const [dragListeners, setDragListeners] = useState14({});
4429
- const dragMode = useRef5(null);
4430
- const initialSelector = useRef5(void 0);
6145
+ const [dragListeners, setDragListeners] = useState15({});
6146
+ const dragMode = useRef6(null);
6147
+ const initialSelector = useRef6(void 0);
4431
6148
  const nextContextValue = useMemo8(
4432
6149
  () => ({
4433
6150
  mode: "edit",
@@ -4436,14 +6153,14 @@ var DragDropContextClient = ({
4436
6153
  }),
4437
6154
  []
4438
6155
  );
4439
- return /* @__PURE__ */ jsx25("div", { id, children: /* @__PURE__ */ jsx25(
6156
+ return /* @__PURE__ */ jsx27("div", { id, children: /* @__PURE__ */ jsx27(
4440
6157
  dragListenerContext.Provider,
4441
6158
  {
4442
6159
  value: {
4443
6160
  dragListeners,
4444
6161
  setDragListeners
4445
6162
  },
4446
- children: /* @__PURE__ */ jsx25(
6163
+ children: /* @__PURE__ */ jsx27(
4447
6164
  DragDropProvider2,
4448
6165
  {
4449
6166
  plugins,
@@ -4659,7 +6376,7 @@ var DragDropContextClient = ({
4659
6376
  const entryEl = (_d = getFrame()) == null ? void 0 : _d.querySelector("[data-puck-entry]");
4660
6377
  entryEl == null ? void 0 : entryEl.setAttribute("data-puck-dragging", "true");
4661
6378
  },
4662
- children: /* @__PURE__ */ jsx25(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ jsx25(DropZoneProvider, { value: nextContextValue, children }) })
6379
+ children: /* @__PURE__ */ jsx27(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ jsx27(DropZoneProvider, { value: nextContextValue, children }) })
4663
6380
  }
4664
6381
  )
4665
6382
  }
@@ -4673,13 +6390,13 @@ var DragDropContext = ({
4673
6390
  if (status === "LOADING") {
4674
6391
  return children;
4675
6392
  }
4676
- return /* @__PURE__ */ jsx25(DragDropContextClient, { disableAutoScroll, children });
6393
+ return /* @__PURE__ */ jsx27(DragDropContextClient, { disableAutoScroll, children });
4677
6394
  };
4678
6395
 
4679
6396
  // components/Drawer/index.tsx
4680
6397
  import { useDraggable, useDroppable as useDroppable2 } from "@dnd-kit/react";
4681
- import { jsx as jsx26, jsxs as jsxs11 } from "react/jsx-runtime";
4682
- var getClassName18 = get_class_name_factory_default("Drawer", styles_module_default10);
6398
+ import { jsx as jsx28, jsxs as jsxs11 } from "react/jsx-runtime";
6399
+ var getClassName19 = get_class_name_factory_default("Drawer", styles_module_default10);
4683
6400
  var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
4684
6401
  var DrawerItemInner = ({
4685
6402
  children,
@@ -4689,10 +6406,10 @@ var DrawerItemInner = ({
4689
6406
  isDragDisabled
4690
6407
  }) => {
4691
6408
  const CustomInner = useMemo9(
4692
- () => children || (({ children: children2 }) => /* @__PURE__ */ jsx26("div", { className: getClassNameItem2("default"), children: children2 })),
6409
+ () => children || (({ children: children2 }) => /* @__PURE__ */ jsx28("div", { className: getClassNameItem2("default"), children: children2 })),
4693
6410
  [children]
4694
6411
  );
4695
- return /* @__PURE__ */ jsx26(
6412
+ return /* @__PURE__ */ jsx28(
4696
6413
  "div",
4697
6414
  {
4698
6415
  className: getClassNameItem2({ disabled: isDragDisabled }),
@@ -4700,9 +6417,9 @@ var DrawerItemInner = ({
4700
6417
  onMouseDown: (e) => e.preventDefault(),
4701
6418
  "data-testid": dragRef ? `drawer-item:${name}` : "",
4702
6419
  "data-puck-drawer-item": true,
4703
- children: /* @__PURE__ */ jsx26(CustomInner, { name, children: /* @__PURE__ */ jsx26("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ jsxs11("div", { className: getClassNameItem2("draggable"), children: [
4704
- /* @__PURE__ */ jsx26("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
4705
- /* @__PURE__ */ jsx26("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ jsx26(DragIcon, {}) })
6420
+ children: /* @__PURE__ */ jsx28(CustomInner, { name, children: /* @__PURE__ */ jsx28("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ jsxs11("div", { className: getClassNameItem2("draggable"), children: [
6421
+ /* @__PURE__ */ jsx28("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
6422
+ /* @__PURE__ */ jsx28("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ jsx28(DragIcon, {}) })
4706
6423
  ] }) }) })
4707
6424
  }
4708
6425
  );
@@ -4720,9 +6437,9 @@ var DrawerItemDraggable = ({
4720
6437
  disabled: isDragDisabled,
4721
6438
  type: "drawer"
4722
6439
  });
4723
- return /* @__PURE__ */ jsxs11("div", { className: getClassName18("draggable"), children: [
4724
- /* @__PURE__ */ jsx26("div", { className: getClassName18("draggableBg"), children: /* @__PURE__ */ jsx26(DrawerItemInner, { name, label, children }) }),
4725
- /* @__PURE__ */ jsx26("div", { className: getClassName18("draggableFg"), children: /* @__PURE__ */ jsx26(
6440
+ return /* @__PURE__ */ jsxs11("div", { className: getClassName19("draggable"), children: [
6441
+ /* @__PURE__ */ jsx28("div", { className: getClassName19("draggableBg"), children: /* @__PURE__ */ jsx28(DrawerItemInner, { name, label, children }) }),
6442
+ /* @__PURE__ */ jsx28("div", { className: getClassName19("draggableFg"), children: /* @__PURE__ */ jsx28(
4726
6443
  DrawerItemInner,
4727
6444
  {
4728
6445
  name,
@@ -4743,7 +6460,7 @@ var DrawerItem = ({
4743
6460
  isDragDisabled
4744
6461
  }) => {
4745
6462
  const resolvedId = id || name;
4746
- const [dynamicId, setDynamicId] = useState15(generateId(resolvedId));
6463
+ const [dynamicId, setDynamicId] = useState16(generateId(resolvedId));
4747
6464
  if (typeof index !== "undefined") {
4748
6465
  console.error(
4749
6466
  "Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
@@ -4756,7 +6473,7 @@ var DrawerItem = ({
4756
6473
  },
4757
6474
  [resolvedId]
4758
6475
  );
4759
- return /* @__PURE__ */ jsx26("div", { children: /* @__PURE__ */ jsx26(
6476
+ return /* @__PURE__ */ jsx28("div", { children: /* @__PURE__ */ jsx28(
4760
6477
  DrawerItemDraggable,
4761
6478
  {
4762
6479
  name,
@@ -4789,10 +6506,10 @@ var Drawer = ({
4789
6506
  collisionPriority: 0
4790
6507
  // Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
4791
6508
  });
4792
- return /* @__PURE__ */ jsx26(
6509
+ return /* @__PURE__ */ jsx28(
4793
6510
  "div",
4794
6511
  {
4795
- className: getClassName18(),
6512
+ className: getClassName19(),
4796
6513
  ref,
4797
6514
  "data-puck-dnd": id,
4798
6515
  "data-puck-drawer": true,
@@ -4806,13 +6523,13 @@ Drawer.Item = DrawerItem;
4806
6523
  // components/Puck/index.tsx
4807
6524
  init_react_import();
4808
6525
  import {
4809
- createContext as createContext7,
4810
- useCallback as useCallback20,
4811
- useContext as useContext12,
4812
- useEffect as useEffect25,
6526
+ createContext as createContext8,
6527
+ useCallback as useCallback21,
6528
+ useContext as useContext13,
6529
+ useEffect as useEffect30,
4813
6530
  useMemo as useMemo21,
4814
- useRef as useRef11,
4815
- useState as useState25
6531
+ useRef as useRef12,
6532
+ useState as useState26
4816
6533
  } from "react";
4817
6534
 
4818
6535
  // components/Puck/components/Fields/index.tsx
@@ -4820,21 +6537,21 @@ init_react_import();
4820
6537
 
4821
6538
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
4822
6539
  init_react_import();
4823
- var styles_module_default13 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields--isLoading": "_PuckFields--isLoading_10bh7_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_10bh7_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_10bh7_25", "PuckFields-field": "_PuckFields-field_10bh7_32", "PuckFields--wrapFields": "_PuckFields--wrapFields_10bh7_36" };
6540
+ var styles_module_default14 = { "PuckFields": "_PuckFields_10bh7_1", "PuckFields--isLoading": "_PuckFields--isLoading_10bh7_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_10bh7_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_10bh7_25", "PuckFields-field": "_PuckFields-field_10bh7_32", "PuckFields--wrapFields": "_PuckFields--wrapFields_10bh7_36" };
4824
6541
 
4825
6542
  // components/Puck/components/Fields/index.tsx
4826
- import { memo as memo4, useCallback as useCallback12, useMemo as useMemo10 } from "react";
6543
+ import { memo as memo5, useCallback as useCallback13, useMemo as useMemo10 } from "react";
4827
6544
  import { useShallow as useShallow6 } from "zustand/react/shallow";
4828
- import { Fragment as Fragment9, jsx as jsx27, jsxs as jsxs12 } from "react/jsx-runtime";
4829
- var getClassName19 = get_class_name_factory_default("PuckFields", styles_module_default13);
6545
+ import { Fragment as Fragment9, jsx as jsx29, jsxs as jsxs12 } from "react/jsx-runtime";
6546
+ var getClassName20 = get_class_name_factory_default("PuckFields", styles_module_default14);
4830
6547
  var DefaultFields = ({
4831
6548
  children
4832
6549
  }) => {
4833
- return /* @__PURE__ */ jsx27(Fragment9, { children });
6550
+ return /* @__PURE__ */ jsx29(Fragment9, { children });
4834
6551
  };
4835
6552
  var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void 0, null, function* () {
4836
6553
  let currentProps;
4837
- const { dispatch, state, selectedItem, resolveComponentData } = appStore.getState();
6554
+ const { dispatch, state, selectedItem, resolveComponentData: resolveComponentData2 } = appStore.getState();
4838
6555
  const { data, ui } = state;
4839
6556
  const { itemSelector } = ui;
4840
6557
  const rootProps = data.root.props || data.root;
@@ -4851,7 +6568,7 @@ var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void
4851
6568
  type: "replace",
4852
6569
  destinationIndex: itemSelector.index,
4853
6570
  destinationZone: itemSelector.zone || rootDroppableId,
4854
- data: (yield resolveComponentData(
6571
+ data: (yield resolveComponentData2(
4855
6572
  __spreadProps(__spreadValues({}, selectedItem), { props: newProps }),
4856
6573
  "replace"
4857
6574
  )).node,
@@ -4861,7 +6578,7 @@ var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void
4861
6578
  if (data.root.props) {
4862
6579
  dispatch({
4863
6580
  type: "replaceRoot",
4864
- root: (yield resolveComponentData(
6581
+ root: (yield resolveComponentData2(
4865
6582
  __spreadProps(__spreadValues({}, data.root), { props: newProps }),
4866
6583
  "replace"
4867
6584
  )).node,
@@ -4892,13 +6609,13 @@ var FieldsChild = ({ fieldName }) => {
4892
6609
  })
4893
6610
  );
4894
6611
  const appStore = useAppStoreApi();
4895
- const onChange = useCallback12(createOnChange(fieldName, appStore), [
6612
+ const onChange = useCallback13(createOnChange(fieldName, appStore), [
4896
6613
  fieldName
4897
6614
  ]);
4898
6615
  const { visible = true } = field != null ? field : {};
4899
6616
  if (!field || !id || !visible) return null;
4900
6617
  if (field.type === "slot") return null;
4901
- return /* @__PURE__ */ jsx27("div", { className: getClassName19("field"), children: /* @__PURE__ */ jsx27(
6618
+ return /* @__PURE__ */ jsx29("div", { className: getClassName20("field"), children: /* @__PURE__ */ jsx29(
4902
6619
  AutoFieldPrivate,
4903
6620
  {
4904
6621
  field,
@@ -4909,7 +6626,7 @@ var FieldsChild = ({ fieldName }) => {
4909
6626
  }
4910
6627
  ) }, id);
4911
6628
  };
4912
- var FieldsChildMemo = memo4(FieldsChild);
6629
+ var FieldsChildMemo = memo5(FieldsChild);
4913
6630
  var FieldsInternal = ({ wrapFields = true }) => {
4914
6631
  const overrides = useAppStore((s) => s.overrides);
4915
6632
  const componentResolving = useAppStore((s) => {
@@ -4938,37 +6655,37 @@ var FieldsInternal = ({ wrapFields = true }) => {
4938
6655
  return /* @__PURE__ */ jsxs12(
4939
6656
  "form",
4940
6657
  {
4941
- className: getClassName19({ wrapFields }),
6658
+ className: getClassName20({ wrapFields }),
4942
6659
  onSubmit: (e) => {
4943
6660
  e.preventDefault();
4944
6661
  },
4945
6662
  children: [
4946
- /* @__PURE__ */ jsx27(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ jsx27(FieldsChildMemo, { fieldName }, fieldName)) }),
4947
- isLoading && /* @__PURE__ */ jsx27("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ jsx27("div", { className: getClassName19("loadingOverlayInner"), children: /* @__PURE__ */ jsx27(Loader, { size: 16 }) }) })
6663
+ /* @__PURE__ */ jsx29(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ jsx29(FieldsChildMemo, { fieldName }, fieldName)) }),
6664
+ isLoading && /* @__PURE__ */ jsx29("div", { className: getClassName20("loadingOverlay"), children: /* @__PURE__ */ jsx29("div", { className: getClassName20("loadingOverlayInner"), children: /* @__PURE__ */ jsx29(Loader, { size: 16 }) }) })
4948
6665
  ]
4949
6666
  }
4950
6667
  );
4951
6668
  };
4952
- var Fields = memo4(FieldsInternal);
6669
+ var Fields = memo5(FieldsInternal);
4953
6670
 
4954
6671
  // components/Puck/components/Components/index.tsx
4955
6672
  init_react_import();
4956
6673
 
4957
6674
  // lib/use-component-list.tsx
4958
6675
  init_react_import();
4959
- import { useEffect as useEffect15, useState as useState16 } from "react";
6676
+ import { useEffect as useEffect20, useState as useState17 } from "react";
4960
6677
 
4961
6678
  // components/ComponentList/index.tsx
4962
6679
  init_react_import();
4963
6680
 
4964
6681
  // css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
4965
6682
  init_react_import();
4966
- var styles_module_default14 = { "ComponentList": "_ComponentList_1rrlt_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_1rrlt_5", "ComponentList-content": "_ComponentList-content_1rrlt_9", "ComponentList-title": "_ComponentList-title_1rrlt_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_1rrlt_53" };
6683
+ var styles_module_default15 = { "ComponentList": "_ComponentList_1rrlt_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_1rrlt_5", "ComponentList-content": "_ComponentList-content_1rrlt_9", "ComponentList-title": "_ComponentList-title_1rrlt_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_1rrlt_53" };
4967
6684
 
4968
6685
  // components/ComponentList/index.tsx
4969
- import { useEffect as useEffect14 } from "react";
4970
- import { jsx as jsx28, jsxs as jsxs13 } from "react/jsx-runtime";
4971
- var getClassName20 = get_class_name_factory_default("ComponentList", styles_module_default14);
6686
+ import { useEffect as useEffect19 } from "react";
6687
+ import { jsx as jsx30, jsxs as jsxs13 } from "react/jsx-runtime";
6688
+ var getClassName21 = get_class_name_factory_default("ComponentList", styles_module_default15);
4972
6689
  var ComponentListItem = ({
4973
6690
  name,
4974
6691
  label
@@ -4980,14 +6697,14 @@ var ComponentListItem = ({
4980
6697
  type: name
4981
6698
  }).insert
4982
6699
  );
4983
- useEffect14(() => {
6700
+ useEffect19(() => {
4984
6701
  if (overrides.componentItem) {
4985
6702
  console.warn(
4986
6703
  "The `componentItem` override has been deprecated and renamed to `drawerItem`"
4987
6704
  );
4988
6705
  }
4989
6706
  }, [overrides]);
4990
- return /* @__PURE__ */ jsx28(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
6707
+ return /* @__PURE__ */ jsx30(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
4991
6708
  };
4992
6709
  var ComponentList = ({
4993
6710
  children,
@@ -4998,12 +6715,12 @@ var ComponentList = ({
4998
6715
  const setUi = useAppStore((s) => s.setUi);
4999
6716
  const componentList = useAppStore((s) => s.state.ui.componentList);
5000
6717
  const { expanded = true } = componentList[id] || {};
5001
- return /* @__PURE__ */ jsxs13("div", { className: getClassName20({ isExpanded: expanded }), children: [
6718
+ return /* @__PURE__ */ jsxs13("div", { className: getClassName21({ isExpanded: expanded }), children: [
5002
6719
  title && /* @__PURE__ */ jsxs13(
5003
6720
  "button",
5004
6721
  {
5005
6722
  type: "button",
5006
- className: getClassName20("title"),
6723
+ className: getClassName21("title"),
5007
6724
  onClick: () => setUi({
5008
6725
  componentList: __spreadProps(__spreadValues({}, componentList), {
5009
6726
  [id]: __spreadProps(__spreadValues({}, componentList[id]), {
@@ -5013,14 +6730,14 @@ var ComponentList = ({
5013
6730
  }),
5014
6731
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
5015
6732
  children: [
5016
- /* @__PURE__ */ jsx28("div", { children: title }),
5017
- /* @__PURE__ */ jsx28("div", { className: getClassName20("titleIcon"), children: expanded ? /* @__PURE__ */ jsx28(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx28(ChevronDown, { size: 12 }) })
6733
+ /* @__PURE__ */ jsx30("div", { children: title }),
6734
+ /* @__PURE__ */ jsx30("div", { className: getClassName21("titleIcon"), children: expanded ? /* @__PURE__ */ jsx30(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx30(ChevronDown, { size: 12 }) })
5018
6735
  ]
5019
6736
  }
5020
6737
  ),
5021
- /* @__PURE__ */ jsx28("div", { className: getClassName20("content"), children: /* @__PURE__ */ jsx28(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
6738
+ /* @__PURE__ */ jsx30("div", { className: getClassName21("content"), children: /* @__PURE__ */ jsx30(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
5022
6739
  var _a;
5023
- return /* @__PURE__ */ jsx28(
6740
+ return /* @__PURE__ */ jsx30(
5024
6741
  ComponentListItem,
5025
6742
  {
5026
6743
  label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
@@ -5034,12 +6751,12 @@ var ComponentList = ({
5034
6751
  ComponentList.Item = ComponentListItem;
5035
6752
 
5036
6753
  // lib/use-component-list.tsx
5037
- import { jsx as jsx29 } from "react/jsx-runtime";
6754
+ import { jsx as jsx31 } from "react/jsx-runtime";
5038
6755
  var useComponentList = () => {
5039
- const [componentList, setComponentList] = useState16();
6756
+ const [componentList, setComponentList] = useState17();
5040
6757
  const config = useAppStore((s) => s.config);
5041
6758
  const uiComponentList = useAppStore((s) => s.state.ui.componentList);
5042
- useEffect15(() => {
6759
+ useEffect20(() => {
5043
6760
  var _a, _b, _c;
5044
6761
  if (Object.keys(uiComponentList).length > 0) {
5045
6762
  const matchedComponents = [];
@@ -5049,7 +6766,7 @@ var useComponentList = () => {
5049
6766
  if (category.visible === false || !category.components) {
5050
6767
  return null;
5051
6768
  }
5052
- return /* @__PURE__ */ jsx29(
6769
+ return /* @__PURE__ */ jsx31(
5053
6770
  ComponentList,
5054
6771
  {
5055
6772
  id: categoryKey,
@@ -5058,7 +6775,7 @@ var useComponentList = () => {
5058
6775
  var _a2;
5059
6776
  matchedComponents.push(componentName);
5060
6777
  const componentConf = config.components[componentName] || {};
5061
- return /* @__PURE__ */ jsx29(
6778
+ return /* @__PURE__ */ jsx31(
5062
6779
  ComponentList.Item,
5063
6780
  {
5064
6781
  label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
@@ -5078,7 +6795,7 @@ var useComponentList = () => {
5078
6795
  );
5079
6796
  if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
5080
6797
  _componentList.push(
5081
- /* @__PURE__ */ jsx29(
6798
+ /* @__PURE__ */ jsx31(
5082
6799
  ComponentList,
5083
6800
  {
5084
6801
  id: "other",
@@ -5086,7 +6803,7 @@ var useComponentList = () => {
5086
6803
  children: remainingComponents.map((componentName, i) => {
5087
6804
  var _a2;
5088
6805
  const componentConf = config.components[componentName] || {};
5089
- return /* @__PURE__ */ jsx29(
6806
+ return /* @__PURE__ */ jsx31(
5090
6807
  ComponentList.Item,
5091
6808
  {
5092
6809
  name: componentName,
@@ -5112,11 +6829,11 @@ import { useMemo as useMemo11 } from "react";
5112
6829
 
5113
6830
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Components/styles.module.css#css-module
5114
6831
  init_react_import();
5115
- var styles_module_default15 = { "Components": "_Components_uwdh8_1" };
6832
+ var styles_module_default16 = { "Components": "_Components_uwdh8_1" };
5116
6833
 
5117
6834
  // components/Puck/components/Components/index.tsx
5118
- import { jsx as jsx30 } from "react/jsx-runtime";
5119
- var getClassName21 = get_class_name_factory_default("Components", styles_module_default15);
6835
+ import { jsx as jsx32 } from "react/jsx-runtime";
6836
+ var getClassName22 = get_class_name_factory_default("Components", styles_module_default16);
5120
6837
  var Components = () => {
5121
6838
  const overrides = useAppStore((s) => s.overrides);
5122
6839
  const componentList = useComponentList();
@@ -5128,24 +6845,24 @@ var Components = () => {
5128
6845
  }
5129
6846
  return overrides.components || overrides.drawer || "div";
5130
6847
  }, [overrides]);
5131
- return /* @__PURE__ */ jsx30("div", { className: getClassName21(), children: /* @__PURE__ */ jsx30(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx30(ComponentList, { id: "all" }) }) });
6848
+ return /* @__PURE__ */ jsx32("div", { className: getClassName22(), children: /* @__PURE__ */ jsx32(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx32(ComponentList, { id: "all" }) }) });
5132
6849
  };
5133
6850
 
5134
6851
  // components/Puck/components/Preview/index.tsx
5135
6852
  init_react_import();
5136
- import { useCallback as useCallback13, useEffect as useEffect17, useRef as useRef6, useMemo as useMemo12 } from "react";
6853
+ import { useCallback as useCallback14, useEffect as useEffect22, useRef as useRef7, useMemo as useMemo12 } from "react";
5137
6854
 
5138
6855
  // components/AutoFrame/index.tsx
5139
6856
  init_react_import();
5140
6857
  import {
5141
- createContext as createContext4,
5142
- useContext as useContext8,
5143
- useEffect as useEffect16,
5144
- useState as useState17
6858
+ createContext as createContext5,
6859
+ useContext as useContext9,
6860
+ useEffect as useEffect21,
6861
+ useState as useState18
5145
6862
  } from "react";
5146
6863
  import hash from "object-hash";
5147
6864
  import { createPortal as createPortal3 } from "react-dom";
5148
- import { Fragment as Fragment10, jsx as jsx31 } from "react/jsx-runtime";
6865
+ import { Fragment as Fragment10, jsx as jsx33 } from "react/jsx-runtime";
5149
6866
  var styleSelector = 'style, link[rel="stylesheet"]';
5150
6867
  var collectStyles = (doc) => {
5151
6868
  const collected = [];
@@ -5195,7 +6912,7 @@ var CopyHostStyles = ({
5195
6912
  onStylesLoaded = () => null
5196
6913
  }) => {
5197
6914
  const { document: doc, window: win } = useFrame();
5198
- useEffect16(() => {
6915
+ useEffect21(() => {
5199
6916
  if (!win || !doc) {
5200
6917
  return () => {
5201
6918
  };
@@ -5352,10 +7069,10 @@ var CopyHostStyles = ({
5352
7069
  observer.disconnect();
5353
7070
  };
5354
7071
  }, []);
5355
- return /* @__PURE__ */ jsx31(Fragment10, { children });
7072
+ return /* @__PURE__ */ jsx33(Fragment10, { children });
5356
7073
  };
5357
- var autoFrameContext = createContext4({});
5358
- var useFrame = () => useContext8(autoFrameContext);
7074
+ var autoFrameContext = createContext5({});
7075
+ var useFrame = () => useContext9(autoFrameContext);
5359
7076
  function AutoFrame(_a) {
5360
7077
  var _b = _a, {
5361
7078
  children,
@@ -5376,11 +7093,11 @@ function AutoFrame(_a) {
5376
7093
  "onNotReady",
5377
7094
  "frameRef"
5378
7095
  ]);
5379
- const [loaded, setLoaded] = useState17(false);
5380
- const [ctx, setCtx] = useState17({});
5381
- const [mountTarget, setMountTarget] = useState17();
5382
- const [stylesLoaded, setStylesLoaded] = useState17(false);
5383
- useEffect16(() => {
7096
+ const [loaded, setLoaded] = useState18(false);
7097
+ const [ctx, setCtx] = useState18({});
7098
+ const [mountTarget, setMountTarget] = useState18();
7099
+ const [stylesLoaded, setStylesLoaded] = useState18(false);
7100
+ useEffect21(() => {
5384
7101
  var _a2;
5385
7102
  if (frameRef.current) {
5386
7103
  const doc = frameRef.current.contentDocument;
@@ -5399,7 +7116,7 @@ function AutoFrame(_a) {
5399
7116
  }
5400
7117
  }
5401
7118
  }, [frameRef, loaded, stylesLoaded]);
5402
- return /* @__PURE__ */ jsx31(
7119
+ return /* @__PURE__ */ jsx33(
5403
7120
  "iframe",
5404
7121
  __spreadProps(__spreadValues({}, props), {
5405
7122
  className,
@@ -5409,7 +7126,7 @@ function AutoFrame(_a) {
5409
7126
  onLoad: () => {
5410
7127
  setLoaded(true);
5411
7128
  },
5412
- children: /* @__PURE__ */ jsx31(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx31(
7129
+ children: /* @__PURE__ */ jsx33(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx33(
5413
7130
  CopyHostStyles,
5414
7131
  {
5415
7132
  debug,
@@ -5425,14 +7142,14 @@ var AutoFrame_default = AutoFrame;
5425
7142
 
5426
7143
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
5427
7144
  init_react_import();
5428
- var styles_module_default16 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
7145
+ var styles_module_default17 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
5429
7146
 
5430
7147
  // components/Puck/components/Preview/index.tsx
5431
- import { Fragment as Fragment11, jsx as jsx32 } from "react/jsx-runtime";
5432
- var getClassName22 = get_class_name_factory_default("PuckPreview", styles_module_default16);
7148
+ import { Fragment as Fragment11, jsx as jsx34 } from "react/jsx-runtime";
7149
+ var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default17);
5433
7150
  var useBubbleIframeEvents = (ref) => {
5434
7151
  const status = useAppStore((s) => s.status);
5435
- useEffect17(() => {
7152
+ useEffect22(() => {
5436
7153
  if (ref.current && status === "READY") {
5437
7154
  const iframe = ref.current;
5438
7155
  const handlePointerMove = (event) => {
@@ -5481,7 +7198,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
5481
7198
  const renderData = useAppStore(
5482
7199
  (s) => s.state.ui.previewMode === "edit" ? null : s.state.data
5483
7200
  );
5484
- const Page = useCallback13(
7201
+ const Page = useCallback14(
5485
7202
  (pageProps) => {
5486
7203
  var _a, _b;
5487
7204
  const propsWithSlots = useSlots(
@@ -5491,15 +7208,15 @@ var Preview2 = ({ id = "puck-preview" }) => {
5491
7208
  );
5492
7209
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
5493
7210
  id: "puck-root"
5494
- }, propsWithSlots)) : /* @__PURE__ */ jsx32(Fragment11, { children: propsWithSlots.children });
7211
+ }, propsWithSlots)) : /* @__PURE__ */ jsx34(Fragment11, { children: propsWithSlots.children });
5495
7212
  },
5496
7213
  [config]
5497
7214
  );
5498
7215
  const Frame = useMemo12(() => overrides.iframe, [overrides]);
5499
7216
  const rootProps = root.props || root;
5500
- const ref = useRef6(null);
7217
+ const ref = useRef7(null);
5501
7218
  useBubbleIframeEvents(ref);
5502
- const inner = !renderData ? /* @__PURE__ */ jsx32(
7219
+ const inner = !renderData ? /* @__PURE__ */ jsx34(
5503
7220
  Page,
5504
7221
  __spreadProps(__spreadValues({}, rootProps), {
5505
7222
  puck: {
@@ -5509,18 +7226,18 @@ var Preview2 = ({ id = "puck-preview" }) => {
5509
7226
  metadata
5510
7227
  },
5511
7228
  editMode: true,
5512
- children: /* @__PURE__ */ jsx32(DropZonePure, { zone: rootDroppableId })
7229
+ children: /* @__PURE__ */ jsx34(DropZonePure, { zone: rootDroppableId })
5513
7230
  })
5514
- ) : /* @__PURE__ */ jsx32(Render, { data: renderData, config, metadata });
5515
- useEffect17(() => {
7231
+ ) : /* @__PURE__ */ jsx34(Render, { data: renderData, config, metadata });
7232
+ useEffect22(() => {
5516
7233
  if (!iframe.enabled) {
5517
7234
  setStatus("READY");
5518
7235
  }
5519
7236
  }, [iframe.enabled]);
5520
- return /* @__PURE__ */ jsx32(
7237
+ return /* @__PURE__ */ jsx34(
5521
7238
  "div",
5522
7239
  {
5523
- className: getClassName22(),
7240
+ className: getClassName23(),
5524
7241
  id,
5525
7242
  "data-puck-preview": true,
5526
7243
  onClick: (e) => {
@@ -5529,11 +7246,11 @@ var Preview2 = ({ id = "puck-preview" }) => {
5529
7246
  dispatch({ type: "setUi", ui: { itemSelector: null } });
5530
7247
  }
5531
7248
  },
5532
- children: iframe.enabled ? /* @__PURE__ */ jsx32(
7249
+ children: iframe.enabled ? /* @__PURE__ */ jsx34(
5533
7250
  AutoFrame_default,
5534
7251
  {
5535
7252
  id: "preview-frame",
5536
- className: getClassName22("frame"),
7253
+ className: getClassName23("frame"),
5537
7254
  "data-rfd-iframe": true,
5538
7255
  onReady: () => {
5539
7256
  setStatus("READY");
@@ -5542,18 +7259,18 @@ var Preview2 = ({ id = "puck-preview" }) => {
5542
7259
  setStatus("MOUNTED");
5543
7260
  },
5544
7261
  frameRef: ref,
5545
- children: /* @__PURE__ */ jsx32(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
7262
+ children: /* @__PURE__ */ jsx34(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
5546
7263
  if (Frame) {
5547
- return /* @__PURE__ */ jsx32(Frame, { document: document2, children: inner });
7264
+ return /* @__PURE__ */ jsx34(Frame, { document: document2, children: inner });
5548
7265
  }
5549
7266
  return inner;
5550
7267
  } })
5551
7268
  }
5552
- ) : /* @__PURE__ */ jsx32(
7269
+ ) : /* @__PURE__ */ jsx34(
5553
7270
  "div",
5554
7271
  {
5555
7272
  id: "preview-frame",
5556
- className: getClassName22("frame"),
7273
+ className: getClassName23("frame"),
5557
7274
  ref,
5558
7275
  "data-puck-entry": true,
5559
7276
  children: inner
@@ -5571,7 +7288,7 @@ init_react_import();
5571
7288
 
5572
7289
  // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
5573
7290
  init_react_import();
5574
- var styles_module_default17 = { "LayerTree": "_LayerTree_7rx04_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_7rx04_11", "LayerTree-helper": "_LayerTree-helper_7rx04_17", "Layer": "_Layer_7rx04_1", "Layer-inner": "_Layer-inner_7rx04_29", "Layer--containsZone": "_Layer--containsZone_7rx04_35", "Layer-clickable": "_Layer-clickable_7rx04_39", "Layer--isSelected": "_Layer--isSelected_7rx04_61", "Layer-chevron": "_Layer-chevron_7rx04_77", "Layer--childIsSelected": "_Layer--childIsSelected_7rx04_78", "Layer-zones": "_Layer-zones_7rx04_82", "Layer-title": "_Layer-title_7rx04_96", "Layer-name": "_Layer-name_7rx04_105", "Layer-icon": "_Layer-icon_7rx04_111", "Layer-zoneIcon": "_Layer-zoneIcon_7rx04_116" };
7291
+ var styles_module_default18 = { "LayerTree": "_LayerTree_7rx04_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_7rx04_11", "LayerTree-helper": "_LayerTree-helper_7rx04_17", "Layer": "_Layer_7rx04_1", "Layer-inner": "_Layer-inner_7rx04_29", "Layer--containsZone": "_Layer--containsZone_7rx04_35", "Layer-clickable": "_Layer-clickable_7rx04_39", "Layer--isSelected": "_Layer--isSelected_7rx04_61", "Layer-chevron": "_Layer-chevron_7rx04_77", "Layer--childIsSelected": "_Layer--childIsSelected_7rx04_78", "Layer-zones": "_Layer-zones_7rx04_82", "Layer-title": "_Layer-title_7rx04_96", "Layer-name": "_Layer-name_7rx04_105", "Layer-icon": "_Layer-icon_7rx04_111", "Layer-zoneIcon": "_Layer-zoneIcon_7rx04_116" };
5575
7292
 
5576
7293
  // lib/scroll-into-view.ts
5577
7294
  init_react_import();
@@ -5585,7 +7302,7 @@ var scrollIntoView = (el) => {
5585
7302
  };
5586
7303
 
5587
7304
  // components/LayerTree/index.tsx
5588
- import { useCallback as useCallback14, useContext as useContext9 } from "react";
7305
+ import { useCallback as useCallback15, useContext as useContext10 } from "react";
5589
7306
 
5590
7307
  // lib/on-scroll-end.ts
5591
7308
  init_react_import();
@@ -5608,9 +7325,9 @@ var onScrollEnd = (frame, cb) => {
5608
7325
 
5609
7326
  // components/LayerTree/index.tsx
5610
7327
  import { useShallow as useShallow7 } from "zustand/react/shallow";
5611
- import { Fragment as Fragment12, jsx as jsx33, jsxs as jsxs14 } from "react/jsx-runtime";
5612
- var getClassName23 = get_class_name_factory_default("LayerTree", styles_module_default17);
5613
- var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default17);
7328
+ import { Fragment as Fragment12, jsx as jsx35, jsxs as jsxs14 } from "react/jsx-runtime";
7329
+ var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default18);
7330
+ var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default18);
5614
7331
  var Layer = ({
5615
7332
  index,
5616
7333
  itemId,
@@ -5620,7 +7337,7 @@ var Layer = ({
5620
7337
  const config = useAppStore((s) => s.config);
5621
7338
  const itemSelector = useAppStore((s) => s.state.ui.itemSelector);
5622
7339
  const dispatch = useAppStore((s) => s.dispatch);
5623
- const setItemSelector = useCallback14(
7340
+ const setItemSelector = useCallback15(
5624
7341
  (itemSelector2) => {
5625
7342
  dispatch({ type: "setUi", ui: { itemSelector: itemSelector2 } });
5626
7343
  },
@@ -5640,7 +7357,7 @@ var Layer = ({
5640
7357
  )
5641
7358
  );
5642
7359
  const containsZone = zonesForItem.length > 0;
5643
- const zoneStore = useContext9(ZoneStoreContext);
7360
+ const zoneStore = useContext10(ZoneStoreContext);
5644
7361
  const isHovering = useContextStore(
5645
7362
  ZoneStoreContext,
5646
7363
  (s) => s.hoveringComponent === itemId
@@ -5665,7 +7382,7 @@ var Layer = ({
5665
7382
  childIsSelected
5666
7383
  }),
5667
7384
  children: [
5668
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs14(
7385
+ /* @__PURE__ */ jsx35("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs14(
5669
7386
  "button",
5670
7387
  {
5671
7388
  type: "button",
@@ -5703,22 +7420,22 @@ var Layer = ({
5703
7420
  zoneStore.setState({ hoveringComponent: null });
5704
7421
  },
5705
7422
  children: [
5706
- containsZone && /* @__PURE__ */ jsx33(
7423
+ containsZone && /* @__PURE__ */ jsx35(
5707
7424
  "div",
5708
7425
  {
5709
7426
  className: getClassNameLayer("chevron"),
5710
7427
  title: isSelected ? "Collapse" : "Expand",
5711
- children: /* @__PURE__ */ jsx33(ChevronDown, { size: "12" })
7428
+ children: /* @__PURE__ */ jsx35(ChevronDown, { size: "12" })
5712
7429
  }
5713
7430
  ),
5714
7431
  /* @__PURE__ */ jsxs14("div", { className: getClassNameLayer("title"), children: [
5715
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("icon"), children: nodeData.data.type === "Text" || nodeData.data.type === "Heading" ? /* @__PURE__ */ jsx33(Type, { size: "16" }) : /* @__PURE__ */ jsx33(LayoutGrid, { size: "16" }) }),
5716
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("name"), children: label })
7432
+ /* @__PURE__ */ jsx35("div", { className: getClassNameLayer("icon"), children: nodeData.data.type === "Text" || nodeData.data.type === "Heading" ? /* @__PURE__ */ jsx35(Type, { size: "16" }) : /* @__PURE__ */ jsx35(LayoutGrid, { size: "16" }) }),
7433
+ /* @__PURE__ */ jsx35("div", { className: getClassNameLayer("name"), children: label })
5717
7434
  ] })
5718
7435
  ]
5719
7436
  }
5720
7437
  ) }),
5721
- containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx33(LayerTree, { zoneCompound: subzone }) }, subzone))
7438
+ containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ jsx35("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx35(LayerTree, { zoneCompound: subzone }) }, subzone))
5722
7439
  ]
5723
7440
  }
5724
7441
  );
@@ -5745,14 +7462,14 @@ var LayerTree = ({
5745
7462
  )
5746
7463
  );
5747
7464
  return /* @__PURE__ */ jsxs14(Fragment12, { children: [
5748
- label && /* @__PURE__ */ jsxs14("div", { className: getClassName23("zoneTitle"), children: [
5749
- /* @__PURE__ */ jsx33("div", { className: getClassName23("zoneIcon"), children: /* @__PURE__ */ jsx33(Layers, { size: "16" }) }),
7465
+ label && /* @__PURE__ */ jsxs14("div", { className: getClassName24("zoneTitle"), children: [
7466
+ /* @__PURE__ */ jsx35("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx35(Layers, { size: "16" }) }),
5750
7467
  label
5751
7468
  ] }),
5752
- /* @__PURE__ */ jsxs14("ul", { className: getClassName23(), children: [
5753
- contentIds.length === 0 && /* @__PURE__ */ jsx33("div", { className: getClassName23("helper"), children: "No items" }),
7469
+ /* @__PURE__ */ jsxs14("ul", { className: getClassName24(), children: [
7470
+ contentIds.length === 0 && /* @__PURE__ */ jsx35("div", { className: getClassName24("helper"), children: "No items" }),
5754
7471
  contentIds.map((itemId, i) => {
5755
- return /* @__PURE__ */ jsx33(
7472
+ return /* @__PURE__ */ jsx35(
5756
7473
  Layer,
5757
7474
  {
5758
7475
  index: i,
@@ -5782,18 +7499,18 @@ import { useShallow as useShallow8 } from "zustand/react/shallow";
5782
7499
 
5783
7500
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Outline/styles.module.css#css-module
5784
7501
  init_react_import();
5785
- var styles_module_default18 = { "Outline": "_Outline_1rrni_1" };
7502
+ var styles_module_default19 = { "Outline": "_Outline_1rrni_1" };
5786
7503
 
5787
7504
  // components/Puck/components/Outline/index.tsx
5788
- import { jsx as jsx34 } from "react/jsx-runtime";
5789
- var getClassName24 = get_class_name_factory_default("Outline", styles_module_default18);
7505
+ import { jsx as jsx36 } from "react/jsx-runtime";
7506
+ var getClassName25 = get_class_name_factory_default("Outline", styles_module_default19);
5790
7507
  var Outline = () => {
5791
7508
  const outlineOverride = useAppStore((s) => s.overrides.outline);
5792
7509
  const rootZones = useAppStore(
5793
7510
  useShallow8((s) => findZonesForArea(s.state, "root"))
5794
7511
  );
5795
7512
  const Wrapper = useMemo13(() => outlineOverride || "div", [outlineOverride]);
5796
- return /* @__PURE__ */ jsx34("div", { className: getClassName24(), children: /* @__PURE__ */ jsx34(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ jsx34(
7513
+ return /* @__PURE__ */ jsx36("div", { className: getClassName25(), children: /* @__PURE__ */ jsx36(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ jsx36(
5797
7514
  LayerTree,
5798
7515
  {
5799
7516
  label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
@@ -5854,8 +7571,8 @@ var useLoadedOverrides = ({
5854
7571
 
5855
7572
  // lib/use-puck.ts
5856
7573
  init_react_import();
5857
- import { createContext as createContext5, useContext as useContext10, useEffect as useEffect18, useState as useState18 } from "react";
5858
- import { createStore as createStore4, useStore as useStore2 } from "zustand";
7574
+ import { createContext as createContext6, useContext as useContext11, useEffect as useEffect23, useState as useState19 } from "react";
7575
+ import { createStore as createStore4, useStore as useStore3 } from "zustand";
5859
7576
  var generateUsePuck = (store) => {
5860
7577
  const history = {
5861
7578
  back: store.history.back,
@@ -5887,7 +7604,7 @@ var generateUsePuck = (store) => {
5887
7604
  };
5888
7605
  return storeData;
5889
7606
  };
5890
- var UsePuckStoreContext = createContext5(
7607
+ var UsePuckStoreContext = createContext6(
5891
7608
  null
5892
7609
  );
5893
7610
  var convertToPickedStore = (store) => {
@@ -5901,12 +7618,12 @@ var convertToPickedStore = (store) => {
5901
7618
  };
5902
7619
  };
5903
7620
  var useRegisterUsePuckStore = (appStore) => {
5904
- const [usePuckStore] = useState18(
7621
+ const [usePuckStore] = useState19(
5905
7622
  () => createStore4(
5906
7623
  () => generateUsePuck(convertToPickedStore(appStore.getState()))
5907
7624
  )
5908
7625
  );
5909
- useEffect18(() => {
7626
+ useEffect23(() => {
5910
7627
  return appStore.subscribe(
5911
7628
  (store) => convertToPickedStore(store),
5912
7629
  (pickedStore) => {
@@ -5918,11 +7635,11 @@ var useRegisterUsePuckStore = (appStore) => {
5918
7635
  };
5919
7636
  function createUsePuck() {
5920
7637
  return function usePuck2(selector) {
5921
- const usePuckApi = useContext10(UsePuckStoreContext);
7638
+ const usePuckApi = useContext11(UsePuckStoreContext);
5922
7639
  if (!usePuckApi) {
5923
7640
  throw new Error("usePuck must be used inside <Puck>.");
5924
7641
  }
5925
- const result = useStore2(
7642
+ const result = useStore3(
5926
7643
  usePuckApi,
5927
7644
  selector != null ? selector : (s) => s
5928
7645
  );
@@ -5930,7 +7647,7 @@ function createUsePuck() {
5930
7647
  };
5931
7648
  }
5932
7649
  function usePuck() {
5933
- useEffect18(() => {
7650
+ useEffect23(() => {
5934
7651
  console.warn(
5935
7652
  "You're using the `usePuck` method without a selector, which may cause unnecessary re-renders. Replace with `createUsePuck` and provide a selector for improved performance."
5936
7653
  );
@@ -5938,7 +7655,7 @@ function usePuck() {
5938
7655
  return createUsePuck()((s) => s);
5939
7656
  }
5940
7657
  function useGetPuck() {
5941
- const usePuckApi = useContext10(UsePuckStoreContext);
7658
+ const usePuckApi = useContext11(UsePuckStoreContext);
5942
7659
  if (!usePuckApi) {
5943
7660
  throw new Error("usePuckGet must be used inside <Puck>.");
5944
7661
  }
@@ -5950,22 +7667,22 @@ import fdeq from "fast-deep-equal";
5950
7667
 
5951
7668
  // components/Puck/components/Layout/index.tsx
5952
7669
  init_react_import();
5953
- import { useEffect as useEffect24, useMemo as useMemo20, useState as useState24 } from "react";
7670
+ import { useEffect as useEffect29, useMemo as useMemo20, useState as useState25 } from "react";
5954
7671
 
5955
7672
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Layout/styles.module.css#css-module
5956
7673
  init_react_import();
5957
- var styles_module_default19 = { "Puck": "_Puck_1q3wx_19", "Puck-portal": "_Puck-portal_1q3wx_31", "PuckLayout-inner": "_PuckLayout-inner_1q3wx_36", "PuckLayout--mounted": "_PuckLayout--mounted_1q3wx_49", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_1q3wx_61", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_1q3wx_69", "PuckLayout-mounted": "_PuckLayout-mounted_1q3wx_85", "PuckLayout": "_PuckLayout_1q3wx_36", "PuckLayout-nav": "_PuckLayout-nav_1q3wx_126", "PuckPluginTab": "_PuckPluginTab_1q3wx_131", "PuckPluginTab--visible": "_PuckPluginTab--visible_1q3wx_135" };
7674
+ var styles_module_default20 = { "Puck": "_Puck_1pcou_19", "Puck-portal": "_Puck-portal_1pcou_31", "PuckLayout-inner": "_PuckLayout-inner_1pcou_36", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_1pcou_59", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_1pcou_67", "PuckLayout": "_PuckLayout_1pcou_36", "PuckLayout-nav": "_PuckLayout-nav_1pcou_124", "PuckPluginTab": "_PuckPluginTab_1pcou_129", "PuckPluginTab--visible": "_PuckPluginTab--visible_1pcou_134" };
5958
7675
 
5959
7676
  // lib/use-inject-css.ts
5960
7677
  init_react_import();
5961
- import { useEffect as useEffect19, useState as useState19 } from "react";
7678
+ import { useEffect as useEffect24, useState as useState20 } from "react";
5962
7679
  var styles = ``;
5963
7680
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
5964
- const [el, setEl] = useState19();
5965
- useEffect19(() => {
7681
+ const [el, setEl] = useState20();
7682
+ useEffect24(() => {
5966
7683
  setEl(document.createElement("style"));
5967
7684
  }, []);
5968
- useEffect19(() => {
7685
+ useEffect24(() => {
5969
7686
  var _a;
5970
7687
  if (!el || typeof window === "undefined") {
5971
7688
  return;
@@ -5985,15 +7702,15 @@ var useInjectGlobalCss = (iframeEnabled) => {
5985
7702
 
5986
7703
  // components/DefaultOverride/index.tsx
5987
7704
  init_react_import();
5988
- import { Fragment as Fragment13, jsx as jsx35 } from "react/jsx-runtime";
5989
- var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx35(Fragment13, { children });
7705
+ import { Fragment as Fragment13, jsx as jsx37 } from "react/jsx-runtime";
7706
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx37(Fragment13, { children });
5990
7707
 
5991
7708
  // lib/use-preview-mode-hotkeys.ts
5992
7709
  init_react_import();
5993
- import { useCallback as useCallback15 } from "react";
7710
+ import { useCallback as useCallback16 } from "react";
5994
7711
  var usePreviewModeHotkeys = () => {
5995
7712
  const appStore = useAppStoreApi();
5996
- const toggleInteractive = useCallback15(() => {
7713
+ const toggleInteractive = useCallback16(() => {
5997
7714
  const dispatch = appStore.getState().dispatch;
5998
7715
  dispatch({
5999
7716
  type: "setUi",
@@ -6008,18 +7725,18 @@ var usePreviewModeHotkeys = () => {
6008
7725
 
6009
7726
  // components/Puck/components/Header/index.tsx
6010
7727
  init_react_import();
6011
- import { memo as memo5, useCallback as useCallback16, useMemo as useMemo15, useState as useState20 } from "react";
7728
+ import { memo as memo6, useCallback as useCallback17, useMemo as useMemo15, useState as useState21 } from "react";
6012
7729
 
6013
7730
  // components/MenuBar/index.tsx
6014
7731
  init_react_import();
6015
7732
 
6016
7733
  // css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
6017
7734
  init_react_import();
6018
- var styles_module_default20 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
7735
+ var styles_module_default21 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
6019
7736
 
6020
7737
  // components/MenuBar/index.tsx
6021
- import { Fragment as Fragment14, jsx as jsx36, jsxs as jsxs15 } from "react/jsx-runtime";
6022
- var getClassName25 = get_class_name_factory_default("MenuBar", styles_module_default20);
7738
+ import { Fragment as Fragment14, jsx as jsx38, jsxs as jsxs15 } from "react/jsx-runtime";
7739
+ var getClassName26 = get_class_name_factory_default("MenuBar", styles_module_default21);
6023
7740
  function MenuBar({
6024
7741
  menuOpen = false,
6025
7742
  renderHeaderActions,
@@ -6029,10 +7746,10 @@ function MenuBar({
6029
7746
  const forward = useAppStore((s) => s.history.forward);
6030
7747
  const hasFuture = useAppStore((s) => s.history.hasFuture());
6031
7748
  const hasPast = useAppStore((s) => s.history.hasPast());
6032
- return /* @__PURE__ */ jsx36(
7749
+ return /* @__PURE__ */ jsx38(
6033
7750
  "div",
6034
7751
  {
6035
- className: getClassName25({ menuOpen }),
7752
+ className: getClassName26({ menuOpen }),
6036
7753
  onClick: (event) => {
6037
7754
  var _a;
6038
7755
  const element = event.target;
@@ -6043,30 +7760,30 @@ function MenuBar({
6043
7760
  setMenuOpen(false);
6044
7761
  }
6045
7762
  },
6046
- children: /* @__PURE__ */ jsxs15("div", { className: getClassName25("inner"), children: [
6047
- /* @__PURE__ */ jsxs15("div", { className: getClassName25("history"), children: [
6048
- /* @__PURE__ */ jsx36(
7763
+ children: /* @__PURE__ */ jsxs15("div", { className: getClassName26("inner"), children: [
7764
+ /* @__PURE__ */ jsxs15("div", { className: getClassName26("history"), children: [
7765
+ /* @__PURE__ */ jsx38(
6049
7766
  IconButton,
6050
7767
  {
6051
7768
  type: "button",
6052
7769
  title: "undo",
6053
7770
  disabled: !hasPast,
6054
7771
  onClick: back,
6055
- children: /* @__PURE__ */ jsx36(Undo2, { size: 21 })
7772
+ children: /* @__PURE__ */ jsx38(Undo2, { size: 21 })
6056
7773
  }
6057
7774
  ),
6058
- /* @__PURE__ */ jsx36(
7775
+ /* @__PURE__ */ jsx38(
6059
7776
  IconButton,
6060
7777
  {
6061
7778
  type: "button",
6062
7779
  title: "redo",
6063
7780
  disabled: !hasFuture,
6064
7781
  onClick: forward,
6065
- children: /* @__PURE__ */ jsx36(Redo2, { size: 21 })
7782
+ children: /* @__PURE__ */ jsx38(Redo2, { size: 21 })
6066
7783
  }
6067
7784
  )
6068
7785
  ] }),
6069
- /* @__PURE__ */ jsx36(Fragment14, { children: renderHeaderActions && renderHeaderActions() })
7786
+ /* @__PURE__ */ jsx38(Fragment14, { children: renderHeaderActions && renderHeaderActions() })
6070
7787
  ] })
6071
7788
  }
6072
7789
  );
@@ -6074,11 +7791,11 @@ function MenuBar({
6074
7791
 
6075
7792
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Header/styles.module.css#css-module
6076
7793
  init_react_import();
6077
- var styles_module_default21 = { "PuckHeader": "_PuckHeader_1ehbp_1", "PuckHeader-inner": "_PuckHeader-inner_1ehbp_16", "PuckHeader-toggle": "_PuckHeader-toggle_1ehbp_33", "PuckHeader--rightSideBarVisible": "_PuckHeader--rightSideBarVisible_1ehbp_40", "PuckHeader-rightSideBarToggle": "_PuckHeader-rightSideBarToggle_1ehbp_40", "PuckHeader--leftSideBarVisible": "_PuckHeader--leftSideBarVisible_1ehbp_41", "PuckHeader-leftSideBarToggle": "_PuckHeader-leftSideBarToggle_1ehbp_41", "PuckHeader-title": "_PuckHeader-title_1ehbp_45", "PuckHeader-path": "_PuckHeader-path_1ehbp_49", "PuckHeader-tools": "_PuckHeader-tools_1ehbp_56", "PuckHeader-menuButton": "_PuckHeader-menuButton_1ehbp_62", "PuckHeader--menuOpen": "_PuckHeader--menuOpen_1ehbp_67" };
7794
+ var styles_module_default22 = { "PuckHeader": "_PuckHeader_1ehbp_1", "PuckHeader-inner": "_PuckHeader-inner_1ehbp_16", "PuckHeader-toggle": "_PuckHeader-toggle_1ehbp_33", "PuckHeader--rightSideBarVisible": "_PuckHeader--rightSideBarVisible_1ehbp_40", "PuckHeader-rightSideBarToggle": "_PuckHeader-rightSideBarToggle_1ehbp_40", "PuckHeader--leftSideBarVisible": "_PuckHeader--leftSideBarVisible_1ehbp_41", "PuckHeader-leftSideBarToggle": "_PuckHeader-leftSideBarToggle_1ehbp_41", "PuckHeader-title": "_PuckHeader-title_1ehbp_45", "PuckHeader-path": "_PuckHeader-path_1ehbp_49", "PuckHeader-tools": "_PuckHeader-tools_1ehbp_56", "PuckHeader-menuButton": "_PuckHeader-menuButton_1ehbp_62", "PuckHeader--menuOpen": "_PuckHeader--menuOpen_1ehbp_67" };
6078
7795
 
6079
7796
  // components/Puck/components/Header/index.tsx
6080
- import { Fragment as Fragment15, jsx as jsx37, jsxs as jsxs16 } from "react/jsx-runtime";
6081
- var getClassName26 = get_class_name_factory_default("PuckHeader", styles_module_default21);
7797
+ import { Fragment as Fragment15, jsx as jsx39, jsxs as jsxs16 } from "react/jsx-runtime";
7798
+ var getClassName27 = get_class_name_factory_default("PuckHeader", styles_module_default22);
6082
7799
  var HeaderInner = () => {
6083
7800
  const {
6084
7801
  onPublish,
@@ -6099,7 +7816,7 @@ var HeaderInner = () => {
6099
7816
  var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
6100
7817
  const Comp = renderHeader;
6101
7818
  const appState = useAppStore((s) => s.state);
6102
- return /* @__PURE__ */ jsx37(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
7819
+ return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
6103
7820
  };
6104
7821
  return RenderHeader;
6105
7822
  }
@@ -6113,7 +7830,7 @@ var HeaderInner = () => {
6113
7830
  const RenderHeader = (props) => {
6114
7831
  const Comp = renderHeaderActions;
6115
7832
  const appState = useAppStore((s) => s.state);
6116
- return /* @__PURE__ */ jsx37(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
7833
+ return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
6117
7834
  };
6118
7835
  return RenderHeader;
6119
7836
  }
@@ -6125,7 +7842,7 @@ var HeaderInner = () => {
6125
7842
  const CustomHeaderActions = useAppStore(
6126
7843
  (s) => s.overrides.headerActions || defaultHeaderActionsRender
6127
7844
  );
6128
- const [menuOpen, setMenuOpen] = useState20(false);
7845
+ const [menuOpen, setMenuOpen] = useState21(false);
6129
7846
  const rootTitle = useAppStore((s) => {
6130
7847
  var _a, _b;
6131
7848
  const rootData = (_a = s.state.indexes.nodes["root"]) == null ? void 0 : _a.data;
@@ -6135,7 +7852,7 @@ var HeaderInner = () => {
6135
7852
  const rightSideBarVisible = useAppStore(
6136
7853
  (s) => s.state.ui.rightSideBarVisible
6137
7854
  );
6138
- const toggleSidebars = useCallback16(
7855
+ const toggleSidebars = useCallback17(
6139
7856
  (sidebar) => {
6140
7857
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
6141
7858
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -6149,27 +7866,27 @@ var HeaderInner = () => {
6149
7866
  },
6150
7867
  [dispatch, leftSideBarVisible, rightSideBarVisible]
6151
7868
  );
6152
- return /* @__PURE__ */ jsx37(
7869
+ return /* @__PURE__ */ jsx39(
6153
7870
  CustomHeader,
6154
7871
  {
6155
- actions: /* @__PURE__ */ jsx37(Fragment15, { children: /* @__PURE__ */ jsx37(CustomHeaderActions, { children: /* @__PURE__ */ jsx37(
7872
+ actions: /* @__PURE__ */ jsx39(Fragment15, { children: /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
6156
7873
  Button,
6157
7874
  {
6158
7875
  onClick: () => {
6159
7876
  const data = appStore.getState().state.data;
6160
7877
  onPublish && onPublish(data);
6161
7878
  },
6162
- icon: /* @__PURE__ */ jsx37(Globe, { size: "14px" }),
7879
+ icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
6163
7880
  children: "Publish"
6164
7881
  }
6165
7882
  ) }) }),
6166
- children: /* @__PURE__ */ jsx37(
7883
+ children: /* @__PURE__ */ jsx39(
6167
7884
  "header",
6168
7885
  {
6169
- className: getClassName26({ leftSideBarVisible, rightSideBarVisible }),
6170
- children: /* @__PURE__ */ jsxs16("div", { className: getClassName26("inner"), children: [
6171
- /* @__PURE__ */ jsxs16("div", { className: getClassName26("toggle"), children: [
6172
- /* @__PURE__ */ jsx37("div", { className: getClassName26("leftSideBarToggle"), children: /* @__PURE__ */ jsx37(
7886
+ className: getClassName27({ leftSideBarVisible, rightSideBarVisible }),
7887
+ children: /* @__PURE__ */ jsxs16("div", { className: getClassName27("inner"), children: [
7888
+ /* @__PURE__ */ jsxs16("div", { className: getClassName27("toggle"), children: [
7889
+ /* @__PURE__ */ jsx39("div", { className: getClassName27("leftSideBarToggle"), children: /* @__PURE__ */ jsx39(
6173
7890
  IconButton,
6174
7891
  {
6175
7892
  type: "button",
@@ -6177,10 +7894,10 @@ var HeaderInner = () => {
6177
7894
  toggleSidebars("left");
6178
7895
  },
6179
7896
  title: "Toggle left sidebar",
6180
- children: /* @__PURE__ */ jsx37(PanelLeft, { focusable: "false" })
7897
+ children: /* @__PURE__ */ jsx39(PanelLeft, { focusable: "false" })
6181
7898
  }
6182
7899
  ) }),
6183
- /* @__PURE__ */ jsx37("div", { className: getClassName26("rightSideBarToggle"), children: /* @__PURE__ */ jsx37(
7900
+ /* @__PURE__ */ jsx39("div", { className: getClassName27("rightSideBarToggle"), children: /* @__PURE__ */ jsx39(
6184
7901
  IconButton,
6185
7902
  {
6186
7903
  type: "button",
@@ -6188,19 +7905,19 @@ var HeaderInner = () => {
6188
7905
  toggleSidebars("right");
6189
7906
  },
6190
7907
  title: "Toggle right sidebar",
6191
- children: /* @__PURE__ */ jsx37(PanelRight, { focusable: "false" })
7908
+ children: /* @__PURE__ */ jsx39(PanelRight, { focusable: "false" })
6192
7909
  }
6193
7910
  ) })
6194
7911
  ] }),
6195
- /* @__PURE__ */ jsx37("div", { className: getClassName26("title"), children: /* @__PURE__ */ jsxs16(Heading, { rank: "2", size: "xs", children: [
7912
+ /* @__PURE__ */ jsx39("div", { className: getClassName27("title"), children: /* @__PURE__ */ jsxs16(Heading, { rank: "2", size: "xs", children: [
6196
7913
  headerTitle || rootTitle || "Page",
6197
7914
  headerPath && /* @__PURE__ */ jsxs16(Fragment15, { children: [
6198
7915
  " ",
6199
- /* @__PURE__ */ jsx37("code", { className: getClassName26("path"), children: headerPath })
7916
+ /* @__PURE__ */ jsx39("code", { className: getClassName27("path"), children: headerPath })
6200
7917
  ] })
6201
7918
  ] }) }),
6202
- /* @__PURE__ */ jsxs16("div", { className: getClassName26("tools"), children: [
6203
- /* @__PURE__ */ jsx37("div", { className: getClassName26("menuButton"), children: /* @__PURE__ */ jsx37(
7919
+ /* @__PURE__ */ jsxs16("div", { className: getClassName27("tools"), children: [
7920
+ /* @__PURE__ */ jsx39("div", { className: getClassName27("menuButton"), children: /* @__PURE__ */ jsx39(
6204
7921
  IconButton,
6205
7922
  {
6206
7923
  type: "button",
@@ -6208,23 +7925,23 @@ var HeaderInner = () => {
6208
7925
  return setMenuOpen(!menuOpen);
6209
7926
  },
6210
7927
  title: "Toggle menu bar",
6211
- children: menuOpen ? /* @__PURE__ */ jsx37(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx37(ChevronDown, { focusable: "false" })
7928
+ children: menuOpen ? /* @__PURE__ */ jsx39(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx39(ChevronDown, { focusable: "false" })
6212
7929
  }
6213
7930
  ) }),
6214
- /* @__PURE__ */ jsx37(
7931
+ /* @__PURE__ */ jsx39(
6215
7932
  MenuBar,
6216
7933
  {
6217
7934
  dispatch,
6218
7935
  onPublish,
6219
7936
  menuOpen,
6220
- renderHeaderActions: () => /* @__PURE__ */ jsx37(CustomHeaderActions, { children: /* @__PURE__ */ jsx37(
7937
+ renderHeaderActions: () => /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
6221
7938
  Button,
6222
7939
  {
6223
7940
  onClick: () => {
6224
7941
  const data = appStore.getState().state.data;
6225
7942
  onPublish && onPublish(data);
6226
7943
  },
6227
- icon: /* @__PURE__ */ jsx37(Globe, { size: "14px" }),
7944
+ icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
6228
7945
  children: "Publish"
6229
7946
  }
6230
7947
  ) }),
@@ -6238,14 +7955,14 @@ var HeaderInner = () => {
6238
7955
  }
6239
7956
  );
6240
7957
  };
6241
- var Header = memo5(HeaderInner);
7958
+ var Header = memo6(HeaderInner);
6242
7959
 
6243
7960
  // components/SidebarSection/index.tsx
6244
7961
  init_react_import();
6245
7962
 
6246
7963
  // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
6247
7964
  init_react_import();
6248
- var styles_module_default22 = { "SidebarSection": "_SidebarSection_8boj8_1", "SidebarSection-title": "_SidebarSection-title_8boj8_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_8boj8_20", "SidebarSection-content": "_SidebarSection-content_8boj8_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_8boj8_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_8boj8_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_8boj8_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_8boj8_41", "SidebarSection-heading": "_SidebarSection-heading_8boj8_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_8boj8_86" };
7965
+ var styles_module_default23 = { "SidebarSection": "_SidebarSection_8boj8_1", "SidebarSection-title": "_SidebarSection-title_8boj8_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_8boj8_20", "SidebarSection-content": "_SidebarSection-content_8boj8_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_8boj8_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_8boj8_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_8boj8_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_8boj8_41", "SidebarSection-heading": "_SidebarSection-heading_8boj8_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_8boj8_86" };
6249
7966
 
6250
7967
  // lib/use-breadcrumbs.ts
6251
7968
  init_react_import();
@@ -6292,8 +8009,8 @@ var useBreadcrumbs = (renderCount) => {
6292
8009
  };
6293
8010
 
6294
8011
  // components/SidebarSection/index.tsx
6295
- import { jsx as jsx38, jsxs as jsxs17 } from "react/jsx-runtime";
6296
- var getClassName27 = get_class_name_factory_default("SidebarSection", styles_module_default22);
8012
+ import { jsx as jsx40, jsxs as jsxs17 } from "react/jsx-runtime";
8013
+ var getClassName28 = get_class_name_factory_default("SidebarSection", styles_module_default23);
6297
8014
  var SidebarSection = ({
6298
8015
  children,
6299
8016
  title,
@@ -6308,26 +8025,26 @@ var SidebarSection = ({
6308
8025
  return /* @__PURE__ */ jsxs17(
6309
8026
  "div",
6310
8027
  {
6311
- className: getClassName27({ noBorderTop, noPadding }),
8028
+ className: getClassName28({ noBorderTop, noPadding }),
6312
8029
  style: { background },
6313
8030
  children: [
6314
- /* @__PURE__ */ jsx38("div", { className: getClassName27("title"), children: /* @__PURE__ */ jsxs17("div", { className: getClassName27("breadcrumbs"), children: [
6315
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs17("div", { className: getClassName27("breadcrumb"), children: [
6316
- /* @__PURE__ */ jsx38(
8031
+ /* @__PURE__ */ jsx40("div", { className: getClassName28("title"), children: /* @__PURE__ */ jsxs17("div", { className: getClassName28("breadcrumbs"), children: [
8032
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs17("div", { className: getClassName28("breadcrumb"), children: [
8033
+ /* @__PURE__ */ jsx40(
6317
8034
  "button",
6318
8035
  {
6319
8036
  type: "button",
6320
- className: getClassName27("breadcrumbLabel"),
8037
+ className: getClassName28("breadcrumbLabel"),
6321
8038
  onClick: () => setUi({ itemSelector: breadcrumb.selector }),
6322
8039
  children: breadcrumb.label
6323
8040
  }
6324
8041
  ),
6325
- /* @__PURE__ */ jsx38(ChevronRight, { size: 16 })
8042
+ /* @__PURE__ */ jsx40(ChevronRight, { size: 16 })
6326
8043
  ] }, i)) : null,
6327
- /* @__PURE__ */ jsx38("div", { className: getClassName27("heading"), children: /* @__PURE__ */ jsx38(Heading, { rank: "2", size: "xs", children: title }) })
8044
+ /* @__PURE__ */ jsx40("div", { className: getClassName28("heading"), children: /* @__PURE__ */ jsx40(Heading, { rank: "2", size: "xs", children: title }) })
6328
8045
  ] }) }),
6329
- /* @__PURE__ */ jsx38("div", { className: getClassName27("content"), children }),
6330
- isLoading && /* @__PURE__ */ jsx38("div", { className: getClassName27("loadingOverlay"), children: /* @__PURE__ */ jsx38(Loader, { size: 32 }) })
8046
+ /* @__PURE__ */ jsx40("div", { className: getClassName28("content"), children }),
8047
+ isLoading && /* @__PURE__ */ jsx40("div", { className: getClassName28("loadingOverlay"), children: /* @__PURE__ */ jsx40(Loader, { size: 32 }) })
6331
8048
  ]
6332
8049
  }
6333
8050
  );
@@ -6336,30 +8053,30 @@ var SidebarSection = ({
6336
8053
  // components/Puck/components/Canvas/index.tsx
6337
8054
  init_react_import();
6338
8055
  import {
6339
- useCallback as useCallback17,
6340
- useEffect as useEffect21,
8056
+ useCallback as useCallback18,
8057
+ useEffect as useEffect26,
6341
8058
  useMemo as useMemo19,
6342
- useRef as useRef8,
6343
- useState as useState22
8059
+ useRef as useRef9,
8060
+ useState as useState23
6344
8061
  } from "react";
6345
8062
 
6346
8063
  // components/ViewportControls/index.tsx
6347
8064
  init_react_import();
6348
- import { useEffect as useEffect20, useMemo as useMemo17, useState as useState21 } from "react";
8065
+ import { useEffect as useEffect25, useMemo as useMemo17, useState as useState22 } from "react";
6349
8066
 
6350
8067
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
6351
8068
  init_react_import();
6352
- var styles_module_default23 = { "ViewportControls": "_ViewportControls_gejzr_1", "ViewportControls-divider": "_ViewportControls-divider_gejzr_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_gejzr_21", "ViewportButton--isActive": "_ViewportButton--isActive_gejzr_38", "ViewportButton-inner": "_ViewportButton-inner_gejzr_38" };
8069
+ var styles_module_default24 = { "ViewportControls": "_ViewportControls_gejzr_1", "ViewportControls-divider": "_ViewportControls-divider_gejzr_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_gejzr_21", "ViewportButton--isActive": "_ViewportButton--isActive_gejzr_38", "ViewportButton-inner": "_ViewportButton-inner_gejzr_38" };
6353
8070
 
6354
8071
  // components/ViewportControls/index.tsx
6355
- import { jsx as jsx39, jsxs as jsxs18 } from "react/jsx-runtime";
8072
+ import { jsx as jsx41, jsxs as jsxs18 } from "react/jsx-runtime";
6356
8073
  var icons = {
6357
- Smartphone: /* @__PURE__ */ jsx39(Smartphone, { size: 16 }),
6358
- Tablet: /* @__PURE__ */ jsx39(Tablet, { size: 16 }),
6359
- Monitor: /* @__PURE__ */ jsx39(Monitor, { size: 16 })
8074
+ Smartphone: /* @__PURE__ */ jsx41(Smartphone, { size: 16 }),
8075
+ Tablet: /* @__PURE__ */ jsx41(Tablet, { size: 16 }),
8076
+ Monitor: /* @__PURE__ */ jsx41(Monitor, { size: 16 })
6360
8077
  };
6361
- var getClassName28 = get_class_name_factory_default("ViewportControls", styles_module_default23);
6362
- var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default23);
8078
+ var getClassName29 = get_class_name_factory_default("ViewportControls", styles_module_default24);
8079
+ var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default24);
6363
8080
  var ViewportButton = ({
6364
8081
  children,
6365
8082
  height = "auto",
@@ -6368,11 +8085,11 @@ var ViewportButton = ({
6368
8085
  onClick
6369
8086
  }) => {
6370
8087
  const viewports = useAppStore((s) => s.state.ui.viewports);
6371
- const [isActive, setIsActive] = useState21(false);
6372
- useEffect20(() => {
8088
+ const [isActive, setIsActive] = useState22(false);
8089
+ useEffect25(() => {
6373
8090
  setIsActive(width === viewports.current.width);
6374
8091
  }, [width, viewports.current.width]);
6375
- return /* @__PURE__ */ jsx39("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx39(
8092
+ return /* @__PURE__ */ jsx41("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx41(
6376
8093
  IconButton,
6377
8094
  {
6378
8095
  type: "button",
@@ -6382,7 +8099,7 @@ var ViewportButton = ({
6382
8099
  e.stopPropagation();
6383
8100
  onClick({ width, height });
6384
8101
  },
6385
- children: /* @__PURE__ */ jsx39("span", { className: getClassNameButton("inner"), children })
8102
+ children: /* @__PURE__ */ jsx41("span", { className: getClassNameButton("inner"), children })
6386
8103
  }
6387
8104
  ) });
6388
8105
  };
@@ -6418,8 +8135,8 @@ var ViewportControls = ({
6418
8135
  ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
6419
8136
  [autoZoom]
6420
8137
  );
6421
- return /* @__PURE__ */ jsxs18("div", { className: getClassName28(), children: [
6422
- viewports.map((viewport, i) => /* @__PURE__ */ jsx39(
8138
+ return /* @__PURE__ */ jsxs18("div", { className: getClassName29(), children: [
8139
+ viewports.map((viewport, i) => /* @__PURE__ */ jsx41(
6423
8140
  ViewportButton,
6424
8141
  {
6425
8142
  height: viewport.height,
@@ -6430,8 +8147,8 @@ var ViewportControls = ({
6430
8147
  },
6431
8148
  i
6432
8149
  )),
6433
- /* @__PURE__ */ jsx39("div", { className: getClassName28("divider") }),
6434
- /* @__PURE__ */ jsx39(
8150
+ /* @__PURE__ */ jsx41("div", { className: getClassName29("divider") }),
8151
+ /* @__PURE__ */ jsx41(
6435
8152
  IconButton,
6436
8153
  {
6437
8154
  type: "button",
@@ -6446,10 +8163,10 @@ var ViewportControls = ({
6446
8163
  )].value
6447
8164
  );
6448
8165
  },
6449
- children: /* @__PURE__ */ jsx39(ZoomOut, { size: 16 })
8166
+ children: /* @__PURE__ */ jsx41(ZoomOut, { size: 16 })
6450
8167
  }
6451
8168
  ),
6452
- /* @__PURE__ */ jsx39(
8169
+ /* @__PURE__ */ jsx41(
6453
8170
  IconButton,
6454
8171
  {
6455
8172
  type: "button",
@@ -6464,19 +8181,19 @@ var ViewportControls = ({
6464
8181
  )].value
6465
8182
  );
6466
8183
  },
6467
- children: /* @__PURE__ */ jsx39(ZoomIn, { size: 16 })
8184
+ children: /* @__PURE__ */ jsx41(ZoomIn, { size: 16 })
6468
8185
  }
6469
8186
  ),
6470
- /* @__PURE__ */ jsx39("div", { className: getClassName28("divider") }),
6471
- /* @__PURE__ */ jsx39(
8187
+ /* @__PURE__ */ jsx41("div", { className: getClassName29("divider") }),
8188
+ /* @__PURE__ */ jsx41(
6472
8189
  "select",
6473
8190
  {
6474
- className: getClassName28("zoomSelect"),
8191
+ className: getClassName29("zoomSelect"),
6475
8192
  value: zoom.toString(),
6476
8193
  onChange: (e) => {
6477
8194
  onZoom(parseFloat(e.currentTarget.value));
6478
8195
  },
6479
- children: zoomOptions.map((option) => /* @__PURE__ */ jsx39(
8196
+ children: zoomOptions.map((option) => /* @__PURE__ */ jsx41(
6480
8197
  "option",
6481
8198
  {
6482
8199
  value: option.value,
@@ -6491,7 +8208,7 @@ var ViewportControls = ({
6491
8208
 
6492
8209
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
6493
8210
  init_react_import();
6494
- var styles_module_default24 = { "PuckCanvas": "_PuckCanvas_18jay_1", "PuckCanvas-controls": "_PuckCanvas-controls_18jay_16", "PuckCanvas-inner": "_PuckCanvas-inner_18jay_21", "PuckCanvas-root": "_PuckCanvas-root_18jay_30", "PuckCanvas--ready": "_PuckCanvas--ready_18jay_55", "PuckCanvas-loader": "_PuckCanvas-loader_18jay_60", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_18jay_70" };
8211
+ var styles_module_default25 = { "PuckCanvas": "_PuckCanvas_18jay_1", "PuckCanvas-controls": "_PuckCanvas-controls_18jay_16", "PuckCanvas-inner": "_PuckCanvas-inner_18jay_21", "PuckCanvas-root": "_PuckCanvas-root_18jay_30", "PuckCanvas--ready": "_PuckCanvas--ready_18jay_55", "PuckCanvas-loader": "_PuckCanvas-loader_18jay_60", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_18jay_70" };
6495
8212
 
6496
8213
  // components/Puck/components/Canvas/index.tsx
6497
8214
  import { useShallow as useShallow9 } from "zustand/react/shallow";
@@ -6499,27 +8216,27 @@ import { useShallow as useShallow9 } from "zustand/react/shallow";
6499
8216
  // lib/frame-context.tsx
6500
8217
  init_react_import();
6501
8218
  import {
6502
- createContext as createContext6,
6503
- useContext as useContext11,
6504
- useRef as useRef7,
8219
+ createContext as createContext7,
8220
+ useContext as useContext12,
8221
+ useRef as useRef8,
6505
8222
  useMemo as useMemo18
6506
8223
  } from "react";
6507
- import { jsx as jsx40 } from "react/jsx-runtime";
6508
- var FrameContext = createContext6(null);
8224
+ import { jsx as jsx42 } from "react/jsx-runtime";
8225
+ var FrameContext = createContext7(null);
6509
8226
  var FrameProvider = ({
6510
8227
  children
6511
8228
  }) => {
6512
- const frameRef = useRef7(null);
8229
+ const frameRef = useRef8(null);
6513
8230
  const value = useMemo18(
6514
8231
  () => ({
6515
8232
  frameRef
6516
8233
  }),
6517
8234
  []
6518
8235
  );
6519
- return /* @__PURE__ */ jsx40(FrameContext.Provider, { value, children });
8236
+ return /* @__PURE__ */ jsx42(FrameContext.Provider, { value, children });
6520
8237
  };
6521
8238
  var useCanvasFrame = () => {
6522
- const context = useContext11(FrameContext);
8239
+ const context = useContext12(FrameContext);
6523
8240
  if (context === null) {
6524
8241
  throw new Error("useCanvasFrame must be used within a FrameProvider");
6525
8242
  }
@@ -6527,8 +8244,8 @@ var useCanvasFrame = () => {
6527
8244
  };
6528
8245
 
6529
8246
  // components/Puck/components/Canvas/index.tsx
6530
- import { Fragment as Fragment16, jsx as jsx41, jsxs as jsxs19 } from "react/jsx-runtime";
6531
- var getClassName29 = get_class_name_factory_default("PuckCanvas", styles_module_default24);
8247
+ import { Fragment as Fragment16, jsx as jsx43, jsxs as jsxs19 } from "react/jsx-runtime";
8248
+ var getClassName30 = get_class_name_factory_default("PuckCanvas", styles_module_default25);
6532
8249
  var ZOOM_ON_CHANGE = true;
6533
8250
  var TRANSITION_DURATION = 150;
6534
8251
  var Canvas = () => {
@@ -6568,17 +8285,17 @@ var Canvas = () => {
6568
8285
  viewports: s.state.ui.viewports
6569
8286
  }))
6570
8287
  );
6571
- const [showTransition, setShowTransition] = useState22(false);
6572
- const isResizingRef = useRef8(false);
8288
+ const [showTransition, setShowTransition] = useState23(false);
8289
+ const isResizingRef = useRef9(false);
6573
8290
  const defaultRender = useMemo19(() => {
6574
- const PuckDefault = ({ children }) => /* @__PURE__ */ jsx41(Fragment16, { children });
8291
+ const PuckDefault = ({ children }) => /* @__PURE__ */ jsx43(Fragment16, { children });
6575
8292
  return PuckDefault;
6576
8293
  }, []);
6577
8294
  const CustomPreview = useMemo19(
6578
8295
  () => overrides.preview || defaultRender,
6579
8296
  [overrides]
6580
8297
  );
6581
- const getFrameDimensions = useCallback17(() => {
8298
+ const getFrameDimensions = useCallback18(() => {
6582
8299
  if (frameRef.current) {
6583
8300
  const frame = frameRef.current;
6584
8301
  const box = getBox(frame);
@@ -6586,7 +8303,7 @@ var Canvas = () => {
6586
8303
  }
6587
8304
  return { width: 0, height: 0 };
6588
8305
  }, [frameRef]);
6589
- useEffect21(() => {
8306
+ useEffect26(() => {
6590
8307
  resetAutoZoom();
6591
8308
  }, [
6592
8309
  frameRef,
@@ -6596,7 +8313,7 @@ var Canvas = () => {
6596
8313
  rightSideBarWidth,
6597
8314
  viewports
6598
8315
  ]);
6599
- useEffect21(() => {
8316
+ useEffect26(() => {
6600
8317
  const { height: frameHeight } = getFrameDimensions();
6601
8318
  if (viewports.current.height === "auto") {
6602
8319
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
@@ -6604,12 +8321,12 @@ var Canvas = () => {
6604
8321
  }));
6605
8322
  }
6606
8323
  }, [zoomConfig.zoom, getFrameDimensions, setZoomConfig]);
6607
- useEffect21(() => {
8324
+ useEffect26(() => {
6608
8325
  if (ZOOM_ON_CHANGE) {
6609
8326
  resetAutoZoom();
6610
8327
  }
6611
8328
  }, [viewports.current.width, viewports]);
6612
- useEffect21(() => {
8329
+ useEffect26(() => {
6613
8330
  if (!frameRef.current) return;
6614
8331
  const resizeObserver = new ResizeObserver(() => {
6615
8332
  if (!isResizingRef.current) {
@@ -6621,8 +8338,8 @@ var Canvas = () => {
6621
8338
  resizeObserver.disconnect();
6622
8339
  };
6623
8340
  }, [frameRef.current]);
6624
- const [showLoader, setShowLoader] = useState22(false);
6625
- useEffect21(() => {
8341
+ const [showLoader, setShowLoader] = useState23(false);
8342
+ useEffect26(() => {
6626
8343
  setTimeout(() => {
6627
8344
  setShowLoader(true);
6628
8345
  }, 500);
@@ -6630,7 +8347,7 @@ var Canvas = () => {
6630
8347
  return /* @__PURE__ */ jsxs19(
6631
8348
  "div",
6632
8349
  {
6633
- className: getClassName29({
8350
+ className: getClassName30({
6634
8351
  ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
6635
8352
  showLoader
6636
8353
  }),
@@ -6645,7 +8362,7 @@ var Canvas = () => {
6645
8362
  }
6646
8363
  },
6647
8364
  children: [
6648
- viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx41("div", { className: getClassName29("controls"), children: /* @__PURE__ */ jsx41(
8365
+ viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx43("div", { className: getClassName30("controls"), children: /* @__PURE__ */ jsx43(
6649
8366
  ViewportControls,
6650
8367
  {
6651
8368
  autoZoom: zoomConfig.autoZoom,
@@ -6675,11 +8392,11 @@ var Canvas = () => {
6675
8392
  }
6676
8393
  }
6677
8394
  ) }),
6678
- /* @__PURE__ */ jsxs19("div", { className: getClassName29("inner"), ref: frameRef, children: [
6679
- /* @__PURE__ */ jsx41(
8395
+ /* @__PURE__ */ jsxs19("div", { className: getClassName30("inner"), ref: frameRef, children: [
8396
+ /* @__PURE__ */ jsx43(
6680
8397
  "div",
6681
8398
  {
6682
- className: getClassName29("root"),
8399
+ className: getClassName30("root"),
6683
8400
  style: {
6684
8401
  width: iframe.enabled ? viewports.current.width : "100%",
6685
8402
  height: zoomConfig.rootHeight,
@@ -6693,10 +8410,10 @@ var Canvas = () => {
6693
8410
  setShowTransition(false);
6694
8411
  isResizingRef.current = false;
6695
8412
  },
6696
- children: /* @__PURE__ */ jsx41(CustomPreview, { children: /* @__PURE__ */ jsx41(Preview2, {}) })
8413
+ children: /* @__PURE__ */ jsx43(CustomPreview, { children: /* @__PURE__ */ jsx43(Preview2, {}) })
6697
8414
  }
6698
8415
  ),
6699
- /* @__PURE__ */ jsx41("div", { className: getClassName29("loader"), children: /* @__PURE__ */ jsx41(Loader, { size: 24 }) })
8416
+ /* @__PURE__ */ jsx43("div", { className: getClassName30("loader"), children: /* @__PURE__ */ jsx43(Loader, { size: 24 }) })
6700
8417
  ] })
6701
8418
  ]
6702
8419
  }
@@ -6705,14 +8422,14 @@ var Canvas = () => {
6705
8422
 
6706
8423
  // lib/use-sidebar-resize.ts
6707
8424
  init_react_import();
6708
- import { useCallback as useCallback18, useEffect as useEffect22, useRef as useRef9, useState as useState23 } from "react";
8425
+ import { useCallback as useCallback19, useEffect as useEffect27, useRef as useRef10, useState as useState24 } from "react";
6709
8426
  function useSidebarResize(position, dispatch) {
6710
- const [width, setWidth] = useState23(null);
6711
- const sidebarRef = useRef9(null);
8427
+ const [width, setWidth] = useState24(null);
8428
+ const sidebarRef = useRef10(null);
6712
8429
  const storeWidth = useAppStore(
6713
8430
  (s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
6714
8431
  );
6715
- useEffect22(() => {
8432
+ useEffect27(() => {
6716
8433
  if (typeof window !== "undefined" && !storeWidth) {
6717
8434
  try {
6718
8435
  const savedWidths = localStorage.getItem("puck-sidebar-widths");
@@ -6737,12 +8454,12 @@ function useSidebarResize(position, dispatch) {
6737
8454
  }
6738
8455
  }
6739
8456
  }, [dispatch, position, storeWidth]);
6740
- useEffect22(() => {
8457
+ useEffect27(() => {
6741
8458
  if (storeWidth !== void 0) {
6742
8459
  setWidth(storeWidth);
6743
8460
  }
6744
8461
  }, [storeWidth]);
6745
- const handleResizeEnd = useCallback18(
8462
+ const handleResizeEnd = useCallback19(
6746
8463
  (width2) => {
6747
8464
  dispatch({
6748
8465
  type: "setUi",
@@ -6789,15 +8506,15 @@ init_react_import();
6789
8506
 
6790
8507
  // components/Puck/components/ResizeHandle/index.tsx
6791
8508
  init_react_import();
6792
- import { useCallback as useCallback19, useRef as useRef10 } from "react";
8509
+ import { useCallback as useCallback20, useRef as useRef11 } from "react";
6793
8510
 
6794
8511
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/ResizeHandle/styles.module.css#css-module
6795
8512
  init_react_import();
6796
- var styles_module_default25 = { "ResizeHandle": "_ResizeHandle_144bf_2", "ResizeHandle--left": "_ResizeHandle--left_144bf_16", "ResizeHandle--right": "_ResizeHandle--right_144bf_20" };
8513
+ var styles_module_default26 = { "ResizeHandle": "_ResizeHandle_144bf_2", "ResizeHandle--left": "_ResizeHandle--left_144bf_16", "ResizeHandle--right": "_ResizeHandle--right_144bf_20" };
6797
8514
 
6798
8515
  // components/Puck/components/ResizeHandle/index.tsx
6799
- import { jsx as jsx42 } from "react/jsx-runtime";
6800
- var getClassName30 = get_class_name_factory_default("ResizeHandle", styles_module_default25);
8516
+ import { jsx as jsx44 } from "react/jsx-runtime";
8517
+ var getClassName31 = get_class_name_factory_default("ResizeHandle", styles_module_default26);
6801
8518
  var ResizeHandle = ({
6802
8519
  position,
6803
8520
  sidebarRef,
@@ -6806,11 +8523,11 @@ var ResizeHandle = ({
6806
8523
  }) => {
6807
8524
  const { frameRef } = useCanvasFrame();
6808
8525
  const resetAutoZoom = useResetAutoZoom(frameRef);
6809
- const handleRef = useRef10(null);
6810
- const isDragging = useRef10(false);
6811
- const startX = useRef10(0);
6812
- const startWidth = useRef10(0);
6813
- const handleMouseMove = useCallback19(
8526
+ const handleRef = useRef11(null);
8527
+ const isDragging = useRef11(false);
8528
+ const startX = useRef11(0);
8529
+ const startWidth = useRef11(0);
8530
+ const handleMouseMove = useCallback20(
6814
8531
  (e) => {
6815
8532
  if (!isDragging.current) return;
6816
8533
  const delta = e.clientX - startX.current;
@@ -6821,7 +8538,7 @@ var ResizeHandle = ({
6821
8538
  },
6822
8539
  [onResize, position]
6823
8540
  );
6824
- const handleMouseUp = useCallback19(() => {
8541
+ const handleMouseUp = useCallback20(() => {
6825
8542
  var _a;
6826
8543
  if (!isDragging.current) return;
6827
8544
  isDragging.current = false;
@@ -6837,7 +8554,7 @@ var ResizeHandle = ({
6837
8554
  onResizeEnd(finalWidth);
6838
8555
  resetAutoZoom();
6839
8556
  }, [onResizeEnd]);
6840
- const handleMouseDown = useCallback19(
8557
+ const handleMouseDown = useCallback20(
6841
8558
  (e) => {
6842
8559
  var _a;
6843
8560
  isDragging.current = true;
@@ -6855,11 +8572,11 @@ var ResizeHandle = ({
6855
8572
  },
6856
8573
  [position, handleMouseMove, handleMouseUp]
6857
8574
  );
6858
- return /* @__PURE__ */ jsx42(
8575
+ return /* @__PURE__ */ jsx44(
6859
8576
  "div",
6860
8577
  {
6861
8578
  ref: handleRef,
6862
- className: getClassName30({ [position]: true }),
8579
+ className: getClassName31({ [position]: true }),
6863
8580
  onMouseDown: handleMouseDown
6864
8581
  }
6865
8582
  );
@@ -6867,11 +8584,11 @@ var ResizeHandle = ({
6867
8584
 
6868
8585
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Sidebar/styles.module.css#css-module
6869
8586
  init_react_import();
6870
- var styles_module_default26 = { "Sidebar": "_Sidebar_1xksb_1", "Sidebar--left": "_Sidebar--left_1xksb_8", "Sidebar--right": "_Sidebar--right_1xksb_14", "Sidebar-resizeHandle": "_Sidebar-resizeHandle_1xksb_20" };
8587
+ var styles_module_default27 = { "Sidebar": "_Sidebar_1xksb_1", "Sidebar--left": "_Sidebar--left_1xksb_8", "Sidebar--right": "_Sidebar--right_1xksb_14", "Sidebar-resizeHandle": "_Sidebar-resizeHandle_1xksb_20" };
6871
8588
 
6872
8589
  // components/Puck/components/Sidebar/index.tsx
6873
- import { Fragment as Fragment17, jsx as jsx43, jsxs as jsxs20 } from "react/jsx-runtime";
6874
- var getClassName31 = get_class_name_factory_default("Sidebar", styles_module_default26);
8590
+ import { Fragment as Fragment17, jsx as jsx45, jsxs as jsxs20 } from "react/jsx-runtime";
8591
+ var getClassName32 = get_class_name_factory_default("Sidebar", styles_module_default27);
6875
8592
  var Sidebar = ({
6876
8593
  position,
6877
8594
  sidebarRef,
@@ -6883,8 +8600,8 @@ var Sidebar = ({
6883
8600
  }) => {
6884
8601
  if (!isVisible) return null;
6885
8602
  return /* @__PURE__ */ jsxs20(Fragment17, { children: [
6886
- /* @__PURE__ */ jsx43("div", { ref: sidebarRef, className: getClassName31({ [position]: true }), children }),
6887
- /* @__PURE__ */ jsx43("div", { className: `${getClassName31("resizeHandle")}`, children: /* @__PURE__ */ jsx43(
8603
+ /* @__PURE__ */ jsx45("div", { ref: sidebarRef, className: getClassName32({ [position]: true }), children }),
8604
+ /* @__PURE__ */ jsx45("div", { className: `${getClassName32("resizeHandle")}`, children: /* @__PURE__ */ jsx45(
6888
8605
  ResizeHandle,
6889
8606
  {
6890
8607
  position,
@@ -6901,13 +8618,13 @@ init_react_import();
6901
8618
 
6902
8619
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Nav/styles.module.css#css-module
6903
8620
  init_react_import();
6904
- var styles_module_default27 = { "Nav-list": "_Nav-list_b6txo_1", "NavSection": "_NavSection_b6txo_7", "Nav--slim": "_Nav--slim_b6txo_15", "NavSection-list": "_NavSection-list_b6txo_24", "NavSection-title": "_NavSection-title_b6txo_36", "NavItem-link": "_NavItem-link_b6txo_47", "NavItem-linkIcon": "_NavItem-linkIcon_b6txo_67", "NavItem--active": "_NavItem--active_b6txo_72", "NavItem": "_NavItem_b6txo_47", "NavItem-list": "_NavItem-list_b6txo_91" };
8621
+ var styles_module_default28 = { "Nav-list": "_Nav-list_b6txo_1", "NavSection": "_NavSection_b6txo_7", "Nav--slim": "_Nav--slim_b6txo_15", "NavSection-list": "_NavSection-list_b6txo_24", "NavSection-title": "_NavSection-title_b6txo_36", "NavItem-link": "_NavItem-link_b6txo_47", "NavItem-linkIcon": "_NavItem-linkIcon_b6txo_67", "NavItem--active": "_NavItem--active_b6txo_72", "NavItem": "_NavItem_b6txo_47", "NavItem-list": "_NavItem-list_b6txo_91" };
6905
8622
 
6906
8623
  // components/Puck/components/Nav/index.tsx
6907
- import { jsx as jsx44, jsxs as jsxs21 } from "react/jsx-runtime";
6908
- var getClassName32 = get_class_name_factory_default("Nav", styles_module_default27);
6909
- var getClassNameSection = get_class_name_factory_default("NavSection", styles_module_default27);
6910
- var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default27);
8624
+ import { jsx as jsx46, jsxs as jsxs21 } from "react/jsx-runtime";
8625
+ var getClassName33 = get_class_name_factory_default("Nav", styles_module_default28);
8626
+ var getClassNameSection = get_class_name_factory_default("NavSection", styles_module_default28);
8627
+ var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default28);
6911
8628
  var MenuItem = ({
6912
8629
  label,
6913
8630
  icon,
@@ -6918,32 +8635,32 @@ var MenuItem = ({
6918
8635
  const showChildren = isActive;
6919
8636
  return /* @__PURE__ */ jsxs21("li", { className: getClassNameItem3({ active: isActive }), children: [
6920
8637
  onClick && /* @__PURE__ */ jsxs21("div", { className: getClassNameItem3("link"), onClick, children: [
6921
- icon && /* @__PURE__ */ jsx44("span", { className: getClassNameItem3("linkIcon"), children: icon }),
6922
- /* @__PURE__ */ jsx44("span", { className: getClassNameItem3("linkLabel"), children: label })
8638
+ icon && /* @__PURE__ */ jsx46("span", { className: getClassNameItem3("linkIcon"), children: icon }),
8639
+ /* @__PURE__ */ jsx46("span", { className: getClassNameItem3("linkLabel"), children: label })
6923
8640
  ] }),
6924
- items && showChildren && /* @__PURE__ */ jsx44("ul", { className: getClassNameItem3("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx44(MenuItem, __spreadValues({}, item), key)) })
8641
+ items && showChildren && /* @__PURE__ */ jsx46("ul", { className: getClassNameItem3("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx46(MenuItem, __spreadValues({}, item), key)) })
6925
8642
  ] });
6926
8643
  };
6927
8644
  var NavSection = ({ title, items }) => {
6928
8645
  return /* @__PURE__ */ jsxs21("li", { className: getClassNameSection(), children: [
6929
- title && /* @__PURE__ */ jsx44("div", { className: getClassNameSection("title"), children: title }),
6930
- /* @__PURE__ */ jsx44("ul", { className: getClassNameSection("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx44(MenuItem, __spreadValues({}, item), key)) })
8646
+ title && /* @__PURE__ */ jsx46("div", { className: getClassNameSection("title"), children: title }),
8647
+ /* @__PURE__ */ jsx46("ul", { className: getClassNameSection("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx46(MenuItem, __spreadValues({}, item), key)) })
6931
8648
  ] });
6932
8649
  };
6933
8650
  var Nav = ({
6934
8651
  navigation,
6935
8652
  slim
6936
8653
  }) => {
6937
- return /* @__PURE__ */ jsx44("nav", { className: getClassName32({ slim }), children: /* @__PURE__ */ jsx44("ul", { className: getClassName32("list"), children: Object.entries(navigation).map(([key, section]) => {
6938
- return /* @__PURE__ */ jsx44(NavSection, { title: section.title, items: section.items }, key);
8654
+ return /* @__PURE__ */ jsx46("nav", { className: getClassName33({ slim }), children: /* @__PURE__ */ jsx46("ul", { className: getClassName33("list"), children: Object.entries(navigation).map(([key, section]) => {
8655
+ return /* @__PURE__ */ jsx46(NavSection, { title: section.title, items: section.items }, key);
6939
8656
  }) }) });
6940
8657
  };
6941
8658
 
6942
8659
  // components/Puck/components/Layout/index.tsx
6943
- import { jsx as jsx45, jsxs as jsxs22 } from "react/jsx-runtime";
6944
- var getClassName33 = get_class_name_factory_default("Puck", styles_module_default19);
6945
- var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default19);
6946
- var getPluginTabClassName = get_class_name_factory_default("PuckPluginTab", styles_module_default19);
8660
+ import { jsx as jsx47, jsxs as jsxs22 } from "react/jsx-runtime";
8661
+ var getClassName34 = get_class_name_factory_default("Puck", styles_module_default20);
8662
+ var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default20);
8663
+ var getPluginTabClassName = get_class_name_factory_default("PuckPluginTab", styles_module_default20);
6947
8664
  var FieldSideBar = () => {
6948
8665
  const title = useAppStore(
6949
8666
  (s) => {
@@ -6951,13 +8668,13 @@ var FieldSideBar = () => {
6951
8668
  return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
6952
8669
  }
6953
8670
  );
6954
- return /* @__PURE__ */ jsx45(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx45(Fields, {}) });
8671
+ return /* @__PURE__ */ jsx47(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx47(Fields, {}) });
6955
8672
  };
6956
8673
  var PluginTab = ({
6957
8674
  children,
6958
8675
  visible
6959
8676
  }) => {
6960
- return /* @__PURE__ */ jsx45("div", { className: getPluginTabClassName({ visible }), children });
8677
+ return /* @__PURE__ */ jsx47("div", { className: getPluginTabClassName({ visible }), children });
6961
8678
  };
6962
8679
  var Layout = ({ children }) => {
6963
8680
  const {
@@ -6991,7 +8708,7 @@ var Layout = ({ children }) => {
6991
8708
  sidebarRef: rightSidebarRef,
6992
8709
  handleResizeEnd: handleRightSidebarResizeEnd
6993
8710
  } = useSidebarResize("right", dispatch);
6994
- useEffect24(() => {
8711
+ useEffect29(() => {
6995
8712
  if (!window.matchMedia("(min-width: 638px)").matches) {
6996
8713
  dispatch({
6997
8714
  type: "setUi",
@@ -7019,13 +8736,9 @@ var Layout = ({ children }) => {
7019
8736
  () => overrides.puck || DefaultOverride,
7020
8737
  [overrides]
7021
8738
  );
7022
- const [mounted, setMounted] = useState24(false);
7023
- useEffect24(() => {
7024
- setMounted(true);
7025
- }, []);
7026
8739
  const ready = useAppStore((s) => s.status === "READY");
7027
8740
  useMonitorHotkeys();
7028
- useEffect24(() => {
8741
+ useEffect29(() => {
7029
8742
  if (ready && iframe.enabled) {
7030
8743
  const frameDoc = getFrame();
7031
8744
  if (frameDoc) {
@@ -7034,7 +8747,7 @@ var Layout = ({ children }) => {
7034
8747
  }
7035
8748
  }, [ready, iframe.enabled]);
7036
8749
  usePreviewModeHotkeys();
7037
- const [view, setView] = useState24();
8750
+ const [view, setView] = useState25();
7038
8751
  const pluginItems = useMemo20(() => {
7039
8752
  const details = {};
7040
8753
  const defaultPlugins = [blocksPlugin(), outlinePlugin()];
@@ -7047,7 +8760,7 @@ var Layout = ({ children }) => {
7047
8760
  }
7048
8761
  details[plugin.name] = {
7049
8762
  label: (_a = plugin.label) != null ? _a : plugin.name,
7050
- icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ jsx45(ToyBrick, {}),
8763
+ icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ jsx47(ToyBrick, {}),
7051
8764
  onClick: () => {
7052
8765
  setView(plugin.name);
7053
8766
  },
@@ -7058,19 +8771,18 @@ var Layout = ({ children }) => {
7058
8771
  });
7059
8772
  return details;
7060
8773
  }, [plugins, view]);
7061
- useEffect24(() => {
8774
+ useEffect29(() => {
7062
8775
  if (!view) {
7063
8776
  const names = Object.keys(pluginItems);
7064
8777
  setView(names[0]);
7065
8778
  }
7066
8779
  }, [pluginItems, view]);
7067
- return /* @__PURE__ */ jsxs22("div", { className: `Puck ${getClassName33()}`, children: [
7068
- /* @__PURE__ */ jsx45(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx45(CustomPuck, { children: children || /* @__PURE__ */ jsx45(FrameProvider, { children: /* @__PURE__ */ jsx45(
8780
+ return /* @__PURE__ */ jsxs22("div", { className: `Puck ${getClassName34()}`, children: [
8781
+ /* @__PURE__ */ jsx47(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx47(CustomPuck, { children: children || /* @__PURE__ */ jsx47(FrameProvider, { children: /* @__PURE__ */ jsx47(
7069
8782
  "div",
7070
8783
  {
7071
8784
  className: getLayoutClassName({
7072
8785
  leftSideBarVisible,
7073
- mounted,
7074
8786
  rightSideBarVisible
7075
8787
  }),
7076
8788
  children: /* @__PURE__ */ jsxs22(
@@ -7078,12 +8790,12 @@ var Layout = ({ children }) => {
7078
8790
  {
7079
8791
  className: getLayoutClassName("inner"),
7080
8792
  style: {
7081
- "--puck-user-left-side-bar-width": `${leftWidth}px`,
7082
- "--puck-user-right-side-bar-width": `${rightWidth}px`
8793
+ "--puck-user-left-side-bar-width": leftWidth ? `${leftWidth}px` : "auto",
8794
+ "--puck-user-right-side-bar-width": rightWidth ? `${rightWidth}px` : "auto"
7083
8795
  },
7084
8796
  children: [
7085
- /* @__PURE__ */ jsx45(Header, {}),
7086
- /* @__PURE__ */ jsx45("div", { className: getLayoutClassName("nav"), children: /* @__PURE__ */ jsx45(
8797
+ /* @__PURE__ */ jsx47(Header, {}),
8798
+ /* @__PURE__ */ jsx47("div", { className: getLayoutClassName("nav"), children: /* @__PURE__ */ jsx47(
7087
8799
  Nav,
7088
8800
  {
7089
8801
  slim: true,
@@ -7094,7 +8806,7 @@ var Layout = ({ children }) => {
7094
8806
  }
7095
8807
  }
7096
8808
  ) }),
7097
- /* @__PURE__ */ jsx45(
8809
+ /* @__PURE__ */ jsx47(
7098
8810
  Sidebar,
7099
8811
  {
7100
8812
  position: "left",
@@ -7104,12 +8816,12 @@ var Layout = ({ children }) => {
7104
8816
  onResize: setLeftWidth,
7105
8817
  onResizeEnd: handleLeftSidebarResizeEnd,
7106
8818
  children: Object.entries(pluginItems).map(
7107
- ([id, { render: Render2 }]) => /* @__PURE__ */ jsx45(PluginTab, { visible: view === id, children: /* @__PURE__ */ jsx45(Render2, {}) }, id)
8819
+ ([id, { render: Render2 }]) => /* @__PURE__ */ jsx47(PluginTab, { visible: view === id, children: /* @__PURE__ */ jsx47(Render2, {}) }, id)
7108
8820
  )
7109
8821
  }
7110
8822
  ),
7111
- /* @__PURE__ */ jsx45(Canvas, {}),
7112
- /* @__PURE__ */ jsx45(
8823
+ /* @__PURE__ */ jsx47(Canvas, {}),
8824
+ /* @__PURE__ */ jsx47(
7113
8825
  Sidebar,
7114
8826
  {
7115
8827
  position: "right",
@@ -7118,7 +8830,7 @@ var Layout = ({ children }) => {
7118
8830
  width: rightWidth,
7119
8831
  onResize: setRightWidth,
7120
8832
  onResizeEnd: handleRightSidebarResizeEnd,
7121
- children: /* @__PURE__ */ jsx45(FieldSideBar, {})
8833
+ children: /* @__PURE__ */ jsx47(FieldSideBar, {})
7122
8834
  }
7123
8835
  )
7124
8836
  ]
@@ -7126,17 +8838,17 @@ var Layout = ({ children }) => {
7126
8838
  )
7127
8839
  }
7128
8840
  ) }) }) }),
7129
- /* @__PURE__ */ jsx45("div", { id: "puck-portal-root", className: getClassName33("portal") })
8841
+ /* @__PURE__ */ jsx47("div", { id: "puck-portal-root", className: getClassName34("portal") })
7130
8842
  ] });
7131
8843
  };
7132
8844
 
7133
8845
  // components/Puck/index.tsx
7134
- import { jsx as jsx46 } from "react/jsx-runtime";
7135
- var propsContext = createContext7({});
8846
+ import { jsx as jsx48 } from "react/jsx-runtime";
8847
+ var propsContext = createContext8({});
7136
8848
  function PropsProvider(props) {
7137
- return /* @__PURE__ */ jsx46(propsContext.Provider, { value: props, children: props.children });
8849
+ return /* @__PURE__ */ jsx48(propsContext.Provider, { value: props, children: props.children });
7138
8850
  }
7139
- var usePropsContext = () => useContext12(propsContext);
8851
+ var usePropsContext = () => useContext13(propsContext);
7140
8852
  function PuckProvider({ children }) {
7141
8853
  const {
7142
8854
  config,
@@ -7160,7 +8872,7 @@ function PuckProvider({ children }) {
7160
8872
  }, _iframe),
7161
8873
  [_iframe]
7162
8874
  );
7163
- const [generatedAppState] = useState25(() => {
8875
+ const [generatedAppState] = useState26(() => {
7164
8876
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
7165
8877
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
7166
8878
  let clientUiState = {};
@@ -7220,7 +8932,7 @@ function PuckProvider({ children }) {
7220
8932
  return walkAppState(newAppState, config);
7221
8933
  });
7222
8934
  const { appendData = true } = _initialHistory || {};
7223
- const [blendedHistories] = useState25(
8935
+ const [blendedHistories] = useState26(
7224
8936
  [
7225
8937
  ...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
7226
8938
  ...appendData ? [{ state: generatedAppState }] : []
@@ -7248,7 +8960,7 @@ function PuckProvider({ children }) {
7248
8960
  );
7249
8961
  return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
7250
8962
  }, [fieldTransforms, plugins]);
7251
- const generateAppStore = useCallback20(
8963
+ const generateAppStore = useCallback21(
7252
8964
  (state) => {
7253
8965
  return {
7254
8966
  state,
@@ -7274,15 +8986,15 @@ function PuckProvider({ children }) {
7274
8986
  loadedFieldTransforms
7275
8987
  ]
7276
8988
  );
7277
- const [appStore] = useState25(
8989
+ const [appStore] = useState26(
7278
8990
  () => createAppStore(generateAppStore(initialAppState))
7279
8991
  );
7280
- useEffect25(() => {
8992
+ useEffect30(() => {
7281
8993
  if (process.env.NODE_ENV !== "production") {
7282
8994
  window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
7283
8995
  }
7284
8996
  }, [appStore]);
7285
- useEffect25(() => {
8997
+ useEffect30(() => {
7286
8998
  const state = appStore.getState().state;
7287
8999
  appStore.setState(__spreadValues({}, generateAppStore(state)));
7288
9000
  }, [config, plugins, loadedOverrides, viewports, iframe, onAction, metadata]);
@@ -7291,8 +9003,8 @@ function PuckProvider({ children }) {
7291
9003
  index: initialHistoryIndex,
7292
9004
  initialAppState
7293
9005
  });
7294
- const previousData = useRef11(null);
7295
- useEffect25(() => {
9006
+ const previousData = useRef12(null);
9007
+ useEffect30(() => {
7296
9008
  appStore.subscribe(
7297
9009
  (s) => s.state.data,
7298
9010
  (data) => {
@@ -7306,14 +9018,14 @@ function PuckProvider({ children }) {
7306
9018
  }, []);
7307
9019
  useRegisterPermissionsSlice(appStore, permissions);
7308
9020
  const uPuckStore = useRegisterUsePuckStore(appStore);
7309
- useEffect25(() => {
9021
+ useEffect30(() => {
7310
9022
  const { resolveAndCommitData } = appStore.getState();
7311
9023
  resolveAndCommitData();
7312
9024
  }, []);
7313
- return /* @__PURE__ */ jsx46(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx46(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
9025
+ return /* @__PURE__ */ jsx48(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx48(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
7314
9026
  }
7315
9027
  function Puck(props) {
7316
- return /* @__PURE__ */ jsx46(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx46(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx46(Layout, { children: props.children }) })) }));
9028
+ return /* @__PURE__ */ jsx48(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx48(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx48(Layout, { children: props.children }) })) }));
7317
9029
  }
7318
9030
  Puck.Components = Components;
7319
9031
  Puck.Fields = Fields;
@@ -7322,18 +9034,18 @@ Puck.Preview = Preview2;
7322
9034
 
7323
9035
  // lib/default-plugins.tsx
7324
9036
  init_react_import();
7325
- import { jsx as jsx47 } from "react/jsx-runtime";
9037
+ import { jsx as jsx49 } from "react/jsx-runtime";
7326
9038
  var blocksPlugin = () => ({
7327
9039
  name: "blocks",
7328
9040
  label: "Blocks",
7329
9041
  render: Components,
7330
- icon: /* @__PURE__ */ jsx47(Hammer, {})
9042
+ icon: /* @__PURE__ */ jsx49(Hammer, {})
7331
9043
  });
7332
9044
  var outlinePlugin = () => ({
7333
9045
  name: "outline",
7334
9046
  label: "Outline",
7335
9047
  render: Outline,
7336
- icon: /* @__PURE__ */ jsx47(Layers, {})
9048
+ icon: /* @__PURE__ */ jsx49(Layers, {})
7337
9049
  });
7338
9050
 
7339
9051
  export {
@@ -7348,6 +9060,8 @@ export {
7348
9060
  AutoField,
7349
9061
  renderContext,
7350
9062
  Render,
9063
+ registerOverlayPortal,
9064
+ setDeep,
7351
9065
  DropZone,
7352
9066
  Drawer,
7353
9067
  createUsePuck,
@@ -7359,6 +9073,13 @@ export {
7359
9073
  };
7360
9074
  /*! Bundled license information:
7361
9075
 
9076
+ classnames/index.js:
9077
+ (*!
9078
+ Copyright (c) 2018 Jed Watson.
9079
+ Licensed under the MIT License (MIT), see
9080
+ http://jedwatson.github.io/classnames
9081
+ *)
9082
+
7362
9083
  lucide-react/dist/esm/shared/src/utils.js:
7363
9084
  (**
7364
9085
  * @license lucide-react v0.468.0 - ISC