@measured/puck 0.20.0-canary.f2447833 → 0.20.0-canary.f73c8fa0

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-BNXRZWNI.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";
@@ -525,12 +597,1430 @@ init_react_import();
525
597
  init_react_import();
526
598
  import { useState } from "react";
527
599
 
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" };
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
1859
+ init_react_import();
1860
+
1861
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
1862
+ init_react_import();
1863
+
1864
+ // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
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
+ }
1879
+
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
+ };
1979
+
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
  });
@@ -1185,6 +2675,7 @@ var SubFieldInternal = ({
1185
2675
  var SubField = memo(SubFieldInternal);
1186
2676
 
1187
2677
  // components/AutoField/fields/ArrayField/index.tsx
2678
+ import fdeq from "fast-deep-equal";
1188
2679
  import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
1189
2680
  var getClassName5 = get_class_name_factory_default("ArrayField", styles_module_default3);
1190
2681
  var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default3);
@@ -1283,14 +2774,14 @@ var ArrayField = ({
1283
2774
  const setUi = useAppStore((s) => s.setUi);
1284
2775
  const appStoreApi = useAppStoreApi();
1285
2776
  const { localName = name } = useNestedFieldContext();
1286
- const getValue = useCallback(() => {
2777
+ const getValue = useCallback2(() => {
1287
2778
  var _a;
1288
2779
  if (typeof value !== "undefined") return value;
1289
2780
  const { selectedItem } = appStoreApi.getState();
1290
2781
  const props = (_a = name ? selectedItem == null ? void 0 : selectedItem.props : {}) != null ? _a : {};
1291
2782
  return name ? getDeep(props, name) : [];
1292
2783
  }, [appStoreApi, name, value]);
1293
- const getArrayState = useCallback(() => {
2784
+ const getArrayState = useCallback2(() => {
1294
2785
  const { state } = appStoreApi.getState();
1295
2786
  const value2 = getValue();
1296
2787
  return state.ui.arrayState[id] || {
@@ -1311,7 +2802,7 @@ var ArrayField = ({
1311
2802
  });
1312
2803
  const [mirror, setLocalState] = useState3(getArrayState());
1313
2804
  const appStore = useAppStoreApi();
1314
- const mapArrayStateToUi = useCallback(
2805
+ const mapArrayStateToUi = useCallback2(
1315
2806
  (partialArrayState) => {
1316
2807
  const state = appStore.getState().state;
1317
2808
  return {
@@ -1322,13 +2813,13 @@ var ArrayField = ({
1322
2813
  },
1323
2814
  [appStore]
1324
2815
  );
1325
- const getHighestIndex = useCallback(() => {
2816
+ const getHighestIndex = useCallback2(() => {
1326
2817
  return getArrayState().items.reduce(
1327
2818
  (acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
1328
2819
  -1
1329
2820
  );
1330
2821
  }, []);
1331
- const regenerateArrayState = useCallback((value2) => {
2822
+ const regenerateArrayState = useCallback2((value2) => {
1332
2823
  let highestIndex = getHighestIndex();
1333
2824
  const arrayState = getArrayState();
1334
2825
  const newItems = Array.from(value2 || []).map((item, idx) => {
@@ -1349,10 +2840,10 @@ var ArrayField = ({
1349
2840
  const [draggedItem, setDraggedItem] = useState3("");
1350
2841
  const isDraggingAny = !!draggedItem;
1351
2842
  const valueRef = useRef([]);
1352
- useEffect(() => {
2843
+ useEffect5(() => {
1353
2844
  valueRef.current = getValue();
1354
2845
  }, []);
1355
- const uniqifyItem = useCallback(
2846
+ const uniqifyItem = useCallback2(
1356
2847
  (val) => {
1357
2848
  if (field.type !== "array" || !field.arrayFields) return;
1358
2849
  const config = appStore.getState().config;
@@ -1370,7 +2861,7 @@ var ArrayField = ({
1370
2861
  },
1371
2862
  [appStore, field]
1372
2863
  );
1373
- const syncCurrentIndexes = useCallback(() => {
2864
+ const syncCurrentIndexes = useCallback2(() => {
1374
2865
  const arrayState = getArrayState();
1375
2866
  const newArrayStateItems = arrayState.items.map((item, index) => __spreadProps(__spreadValues({}, item), {
1376
2867
  _currentIndex: index
@@ -1386,7 +2877,7 @@ var ArrayField = ({
1386
2877
  };
1387
2878
  setUi(newUi, false);
1388
2879
  }, []);
1389
- const updateValue = useCallback(
2880
+ const updateValue = useCallback2(
1390
2881
  (newValue) => {
1391
2882
  const newArrayState = regenerateArrayState(newValue);
1392
2883
  setUi(mapArrayStateToUi(newArrayState), false);
@@ -1395,6 +2886,23 @@ var ArrayField = ({
1395
2886
  },
1396
2887
  [regenerateArrayState, setUi, mapArrayStateToUi, onChange, setLocalState]
1397
2888
  );
2889
+ useEffect5(() => {
2890
+ return appStoreApi.subscribe(
2891
+ ({ selectedItem }) => {
2892
+ var _a;
2893
+ const props = (_a = name ? selectedItem == null ? void 0 : selectedItem.props : {}) != null ? _a : {};
2894
+ return name ? getDeep(props, name) : [];
2895
+ },
2896
+ (val) => {
2897
+ if (!fdeq(val, valueRef.current)) {
2898
+ valueRef.current = val;
2899
+ const newArrayState = regenerateArrayState(valueRef.current);
2900
+ setUi(mapArrayStateToUi(newArrayState), false);
2901
+ setLocalState(newArrayState);
2902
+ }
2903
+ }
2904
+ );
2905
+ }, [appStoreApi]);
1398
2906
  if (field.type !== "array" || !field.arrayFields) {
1399
2907
  return null;
1400
2908
  }
@@ -1410,6 +2918,7 @@ var ArrayField = ({
1410
2918
  SortableProvider,
1411
2919
  {
1412
2920
  onDragStart: (id2) => {
2921
+ valueRef.current = getValue();
1413
2922
  setDraggedItem(id2);
1414
2923
  syncCurrentIndexes();
1415
2924
  },
@@ -1423,8 +2932,7 @@ var ArrayField = ({
1423
2932
  if (arrayState.items[move.source]._arrayId !== draggedItem) {
1424
2933
  return;
1425
2934
  }
1426
- const value2 = getValue();
1427
- const newValue = reorder(value2, move.source, move.target);
2935
+ const newValue = reorder(valueRef.current, move.source, move.target);
1428
2936
  const newArrayStateItems = reorder(
1429
2937
  arrayState.items,
1430
2938
  move.source,
@@ -1628,15 +3136,15 @@ var DefaultField = ({
1628
3136
 
1629
3137
  // components/AutoField/fields/ExternalField/index.tsx
1630
3138
  init_react_import();
1631
- import { useEffect as useEffect5 } from "react";
3139
+ import { useEffect as useEffect9 } from "react";
1632
3140
 
1633
3141
  // components/ExternalInput/index.tsx
1634
3142
  init_react_import();
1635
3143
  import {
1636
3144
  useMemo as useMemo2,
1637
- useEffect as useEffect4,
3145
+ useEffect as useEffect8,
1638
3146
  useState as useState6,
1639
- useCallback as useCallback2,
3147
+ useCallback as useCallback3,
1640
3148
  isValidElement
1641
3149
  } from "react";
1642
3150
 
@@ -1646,7 +3154,7 @@ var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_
1646
3154
 
1647
3155
  // components/Modal/index.tsx
1648
3156
  init_react_import();
1649
- import { useEffect as useEffect2, useState as useState4 } from "react";
3157
+ import { useEffect as useEffect6, useState as useState4 } from "react";
1650
3158
 
1651
3159
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
1652
3160
  init_react_import();
@@ -1662,7 +3170,7 @@ var Modal = ({
1662
3170
  isOpen
1663
3171
  }) => {
1664
3172
  const [rootEl, setRootEl] = useState4(null);
1665
- useEffect2(() => {
3173
+ useEffect6(() => {
1666
3174
  setRootEl(document.getElementById("puck-portal-root"));
1667
3175
  }, []);
1668
3176
  if (!rootEl) {
@@ -1709,7 +3217,7 @@ init_react_import();
1709
3217
 
1710
3218
  // components/Button/Button.tsx
1711
3219
  init_react_import();
1712
- import { useEffect as useEffect3, useState as useState5 } from "react";
3220
+ import { useEffect as useEffect7, useState as useState5 } from "react";
1713
3221
 
1714
3222
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
1715
3223
  init_react_import();
@@ -1760,7 +3268,7 @@ var Button = (_a) => {
1760
3268
  "loading"
1761
3269
  ]);
1762
3270
  const [loading, setLoading] = useState5(loadingProp);
1763
- useEffect3(() => setLoading(loadingProp), [loadingProp]);
3271
+ useEffect7(() => setLoading(loadingProp), [loadingProp]);
1764
3272
  const ElementType = href ? "a" : type ? "button" : "span";
1765
3273
  const dataAttrs = filterDataAttrs(props);
1766
3274
  const el = /* @__PURE__ */ jsxs5(
@@ -1836,7 +3344,7 @@ var ExternalInput = ({
1836
3344
  return Array.from(validKeys);
1837
3345
  }, [mappedData]);
1838
3346
  const [searchQuery, setSearchQuery] = useState6(field.initialQuery || "");
1839
- const search = useCallback2(
3347
+ const search = useCallback3(
1840
3348
  (query, filters2) => __async(void 0, null, function* () {
1841
3349
  setIsLoading(true);
1842
3350
  const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
@@ -1849,7 +3357,7 @@ var ExternalInput = ({
1849
3357
  }),
1850
3358
  [id, field]
1851
3359
  );
1852
- const Footer = useCallback2(
3360
+ const Footer = useCallback3(
1853
3361
  (props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ jsxs6("span", { className: getClassNameModal("footer"), children: [
1854
3362
  props.items.length,
1855
3363
  " result",
@@ -1857,7 +3365,7 @@ var ExternalInput = ({
1857
3365
  ] }),
1858
3366
  [field.renderFooter]
1859
3367
  );
1860
- useEffect4(() => {
3368
+ useEffect8(() => {
1861
3369
  search(searchQuery, filters);
1862
3370
  }, []);
1863
3371
  return /* @__PURE__ */ jsxs6(
@@ -2033,7 +3541,7 @@ var ExternalField = ({
2033
3541
  var _a, _b, _c;
2034
3542
  const validField = field;
2035
3543
  const deprecatedField = field;
2036
- useEffect5(() => {
3544
+ useEffect9(() => {
2037
3545
  if (deprecatedField.adaptor) {
2038
3546
  console.error(
2039
3547
  "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 +3735,7 @@ init_react_import();
2227
3735
  var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
2228
3736
 
2229
3737
  // components/AutoField/fields/ObjectField/index.tsx
2230
- import { useCallback as useCallback3 } from "react";
3738
+ import { useCallback as useCallback4 } from "react";
2231
3739
  import { jsx as jsx18 } from "react/jsx-runtime";
2232
3740
  var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
2233
3741
  var ObjectField = ({
@@ -2246,7 +3754,7 @@ var ObjectField = ({
2246
3754
  const canEdit = useAppStore(
2247
3755
  (s) => s.permissions.getPermissions({ item: s.selectedItem }).edit
2248
3756
  );
2249
- const getValue = useCallback3(() => {
3757
+ const getValue = useCallback4(() => {
2250
3758
  var _a;
2251
3759
  if (typeof value !== "undefined") return value;
2252
3760
  const { selectedItem } = appStoreApi.getState();
@@ -2373,7 +3881,7 @@ function AutoFieldInternal(_a) {
2373
3881
  var _a3;
2374
3882
  return (_a3 = s.selectedItem) == null ? void 0 : _a3.readOnly;
2375
3883
  }));
2376
- const nestedFieldContext = useContext2(NestedFieldContext);
3884
+ const nestedFieldContext = useContext3(NestedFieldContext);
2377
3885
  const { id, Label: Label2 = FieldLabelInternal } = props;
2378
3886
  const field = props.field;
2379
3887
  const label = field.label;
@@ -2394,7 +3902,7 @@ function AutoFieldInternal(_a) {
2394
3902
  number: ((_h = overrides.fieldTypes) == null ? void 0 : _h.number) || defaultFields.number
2395
3903
  });
2396
3904
  },
2397
- [overrides, defaultFields]
3905
+ [overrides]
2398
3906
  );
2399
3907
  const mergedProps = useMemo3(
2400
3908
  () => __spreadProps(__spreadValues({}, props), {
@@ -2406,7 +3914,7 @@ function AutoFieldInternal(_a) {
2406
3914
  }),
2407
3915
  [props, field, label, labelIcon, Label2, resolvedId]
2408
3916
  );
2409
- const onFocus = useCallback4(
3917
+ const onFocus = useCallback5(
2410
3918
  (e) => {
2411
3919
  if (mergedProps.name && (e.target.nodeName === "INPUT" || e.target.nodeName === "TEXTAREA")) {
2412
3920
  e.stopPropagation();
@@ -2420,7 +3928,7 @@ function AutoFieldInternal(_a) {
2420
3928
  },
2421
3929
  [mergedProps.name]
2422
3930
  );
2423
- const onBlur = useCallback4((e) => {
3931
+ const onBlur = useCallback5((e) => {
2424
3932
  if ("name" in e.target) {
2425
3933
  dispatch({
2426
3934
  type: "setUi",
@@ -2430,6 +3938,12 @@ function AutoFieldInternal(_a) {
2430
3938
  });
2431
3939
  }
2432
3940
  }, []);
3941
+ let Children = useMemo3(() => {
3942
+ if (field.type !== "custom" && field.type !== "slot") {
3943
+ return defaultFields[field.type];
3944
+ }
3945
+ return (_props) => null;
3946
+ }, [field.type]);
2433
3947
  let FieldComponent = useMemo3(() => {
2434
3948
  if (field.type === "custom") {
2435
3949
  if (!field.render) {
@@ -2439,14 +3953,8 @@ function AutoFieldInternal(_a) {
2439
3953
  } else {
2440
3954
  return render[field.type];
2441
3955
  }
2442
- }, [field, defaultFields, render]);
3956
+ }, [field.type, render]);
2443
3957
  const { visible = true } = props.field;
2444
- let Children = useMemo3(() => {
2445
- if (field.type !== "custom" && field.type !== "slot") {
2446
- return defaultFields[field.type];
2447
- }
2448
- return () => null;
2449
- }, [field]);
2450
3958
  if (!visible) {
2451
3959
  return null;
2452
3960
  }
@@ -2494,7 +4002,7 @@ function AutoFieldPrivate(props) {
2494
4002
  }
2495
4003
  });
2496
4004
  const [localValue, setLocalValue] = useState8(value);
2497
- const onChangeLocal = useCallback4(
4005
+ const onChangeLocal = useCallback5(
2498
4006
  (val, ui) => {
2499
4007
  const excludedFields = ["array", "object"];
2500
4008
  if (!excludedFields.includes(props.field.type)) {
@@ -2504,12 +4012,12 @@ function AutoFieldPrivate(props) {
2504
4012
  },
2505
4013
  [props.field.type]
2506
4014
  );
2507
- useEffect6(() => {
4015
+ useEffect10(() => {
2508
4016
  if (!isFocused) {
2509
4017
  setLocalValue(value);
2510
4018
  }
2511
4019
  }, [value]);
2512
- useEffect6(() => {
4020
+ useEffect10(() => {
2513
4021
  if (!isFocused) {
2514
4022
  if (value !== localValue) {
2515
4023
  setLocalValue(value);
@@ -2556,19 +4064,19 @@ init_react_import();
2556
4064
  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
4065
 
2558
4066
  // components/Drawer/index.tsx
2559
- import { useMemo as useMemo9, useState as useState15 } from "react";
4067
+ import { useMemo as useMemo9, useState as useState16 } from "react";
2560
4068
 
2561
4069
  // components/DragDropContext/index.tsx
2562
4070
  init_react_import();
2563
4071
  import { DragDropProvider as DragDropProvider2 } from "@dnd-kit/react";
2564
4072
  import {
2565
- createContext as createContext3,
2566
- useCallback as useCallback11,
2567
- useContext as useContext7,
2568
- useEffect as useEffect13,
4073
+ createContext as createContext4,
4074
+ useCallback as useCallback12,
4075
+ useContext as useContext8,
4076
+ useEffect as useEffect18,
2569
4077
  useMemo as useMemo8,
2570
- useRef as useRef5,
2571
- useState as useState14
4078
+ useRef as useRef6,
4079
+ useState as useState15
2572
4080
  } from "react";
2573
4081
  import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
2574
4082
 
@@ -2576,20 +4084,20 @@ import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
2576
4084
  init_react_import();
2577
4085
  import {
2578
4086
  forwardRef as forwardRef3,
2579
- memo as memo3,
2580
- useCallback as useCallback10,
2581
- useContext as useContext6,
2582
- useEffect as useEffect12,
4087
+ memo as memo4,
4088
+ useCallback as useCallback11,
4089
+ useContext as useContext7,
4090
+ useEffect as useEffect17,
2583
4091
  useMemo as useMemo7,
2584
- useRef as useRef4
4092
+ useRef as useRef5
2585
4093
  } from "react";
2586
4094
 
2587
4095
  // components/DraggableComponent/index.tsx
2588
4096
  init_react_import();
2589
4097
  import {
2590
- useCallback as useCallback7,
2591
- useContext as useContext4,
2592
- useEffect as useEffect8,
4098
+ useCallback as useCallback8,
4099
+ useContext as useContext5,
4100
+ useEffect as useEffect12,
2593
4101
  useMemo as useMemo5,
2594
4102
  useRef as useRef2,
2595
4103
  useState as useState10,
@@ -2625,14 +4133,14 @@ function getDeepScrollPosition(element) {
2625
4133
  // components/DropZone/context.tsx
2626
4134
  init_react_import();
2627
4135
  import {
2628
- createContext as createContext2,
2629
- useCallback as useCallback5,
4136
+ createContext as createContext3,
4137
+ useCallback as useCallback6,
2630
4138
  useMemo as useMemo4
2631
4139
  } from "react";
2632
4140
  import { createStore as createStore2 } from "zustand";
2633
4141
  import { Fragment as Fragment6, jsx as jsx20 } from "react/jsx-runtime";
2634
- var dropZoneContext = createContext2(null);
2635
- var ZoneStoreContext = createContext2(
4142
+ var dropZoneContext = createContext3(null);
4143
+ var ZoneStoreContext = createContext3(
2636
4144
  createStore2(() => ({
2637
4145
  zoneDepthIndex: {},
2638
4146
  nextZoneDepthIndex: {},
@@ -2655,7 +4163,7 @@ var DropZoneProvider = ({
2655
4163
  value
2656
4164
  }) => {
2657
4165
  const dispatch = useAppStore((s) => s.dispatch);
2658
- const registerZone = useCallback5(
4166
+ const registerZone = useCallback6(
2659
4167
  (zoneCompound) => {
2660
4168
  dispatch({
2661
4169
  type: "registerZone",
@@ -2694,23 +4202,23 @@ function accumulateTransform(el) {
2694
4202
 
2695
4203
  // lib/use-context-store.ts
2696
4204
  init_react_import();
2697
- import { useContext as useContext3 } from "react";
2698
- import { useStore } from "zustand";
4205
+ import { useContext as useContext4 } from "react";
4206
+ import { useStore as useStore2 } from "zustand";
2699
4207
  import { useShallow as useShallow2 } from "zustand/react/shallow";
2700
4208
  function useContextStore(context, selector) {
2701
- const store = useContext3(context);
4209
+ const store = useContext4(context);
2702
4210
  if (!store) {
2703
4211
  throw new Error("useContextStore must be used inside context");
2704
4212
  }
2705
- return useStore(store, useShallow2(selector));
4213
+ return useStore2(store, useShallow2(selector));
2706
4214
  }
2707
4215
 
2708
4216
  // lib/dnd/use-on-drag-finished.ts
2709
4217
  init_react_import();
2710
- import { useCallback as useCallback6 } from "react";
4218
+ import { useCallback as useCallback7 } from "react";
2711
4219
  var useOnDragFinished = (cb, deps = []) => {
2712
4220
  const appStore = useAppStoreApi();
2713
- return useCallback6(() => {
4221
+ return useCallback7(() => {
2714
4222
  let dispose = () => {
2715
4223
  };
2716
4224
  const processDragging = (isDragging2) => {
@@ -2783,9 +4291,9 @@ var DraggableComponent = ({
2783
4291
  const overrides = useAppStore((s) => s.overrides);
2784
4292
  const dispatch = useAppStore((s) => s.dispatch);
2785
4293
  const iframe = useAppStore((s) => s.iframe);
2786
- const ctx = useContext4(dropZoneContext);
4294
+ const ctx = useContext5(dropZoneContext);
2787
4295
  const [localZones, setLocalZones] = useState10({});
2788
- const registerLocalZone = useCallback7(
4296
+ const registerLocalZone = useCallback8(
2789
4297
  (zoneCompound2, active) => {
2790
4298
  var _a;
2791
4299
  (_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
@@ -2795,7 +4303,7 @@ var DraggableComponent = ({
2795
4303
  },
2796
4304
  [setLocalZones]
2797
4305
  );
2798
- const unregisterLocalZone = useCallback7(
4306
+ const unregisterLocalZone = useCallback8(
2799
4307
  (zoneCompound2) => {
2800
4308
  var _a;
2801
4309
  (_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
@@ -2818,7 +4326,7 @@ var DraggableComponent = ({
2818
4326
  return s.permissions.getPermissions({ item });
2819
4327
  })
2820
4328
  );
2821
- const zoneStore = useContext4(ZoneStoreContext);
4329
+ const zoneStore = useContext5(ZoneStoreContext);
2822
4330
  const [dragAxis, setDragAxis] = useState10(userDragAxis || autoDragAxis);
2823
4331
  const dynamicCollisionDetector = useMemo5(
2824
4332
  () => createDynamicCollisionDetector(dragAxis),
@@ -2852,7 +4360,7 @@ var DraggableComponent = ({
2852
4360
  },
2853
4361
  feedback: "clone"
2854
4362
  });
2855
- useEffect8(() => {
4363
+ useEffect12(() => {
2856
4364
  const isEnabled = zoneStore.getState().enabledIndex[zoneCompound];
2857
4365
  sortable.droppable.disabled = !isEnabled;
2858
4366
  sortable.draggable.disabled = !permissions.drag;
@@ -2870,7 +4378,7 @@ var DraggableComponent = ({
2870
4378
  return cleanup;
2871
4379
  }, [permissions.drag, zoneCompound]);
2872
4380
  const ref = useRef2(null);
2873
- const refSetter = useCallback7(
4381
+ const refSetter = useCallback8(
2874
4382
  (el) => {
2875
4383
  sortableRef(el);
2876
4384
  if (el) {
@@ -2880,13 +4388,13 @@ var DraggableComponent = ({
2880
4388
  [sortableRef]
2881
4389
  );
2882
4390
  const [portalEl, setPortalEl] = useState10();
2883
- useEffect8(() => {
4391
+ useEffect12(() => {
2884
4392
  var _a, _b, _c;
2885
4393
  setPortalEl(
2886
4394
  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
4395
  );
2888
4396
  }, [iframe.enabled, ref.current]);
2889
- const getStyle = useCallback7(() => {
4397
+ const getStyle = useCallback8(() => {
2890
4398
  var _a, _b, _c;
2891
4399
  if (!ref.current) return;
2892
4400
  const rect = ref.current.getBoundingClientRect();
@@ -2912,10 +4420,10 @@ var DraggableComponent = ({
2912
4420
  return style2;
2913
4421
  }, [ref.current]);
2914
4422
  const [style, setStyle] = useState10();
2915
- const sync = useCallback7(() => {
4423
+ const sync = useCallback8(() => {
2916
4424
  setStyle(getStyle());
2917
4425
  }, [ref.current, iframe]);
2918
- useEffect8(() => {
4426
+ useEffect12(() => {
2919
4427
  if (ref.current) {
2920
4428
  const observer = new ResizeObserver(sync);
2921
4429
  observer.observe(ref.current);
@@ -2925,13 +4433,13 @@ var DraggableComponent = ({
2925
4433
  }
2926
4434
  }, [ref.current]);
2927
4435
  const registerNode = useAppStore((s) => s.nodes.registerNode);
2928
- const hideOverlay = useCallback7(() => {
4436
+ const hideOverlay = useCallback8(() => {
2929
4437
  setIsVisible(false);
2930
4438
  }, []);
2931
- const showOverlay = useCallback7(() => {
4439
+ const showOverlay = useCallback8(() => {
2932
4440
  setIsVisible(true);
2933
4441
  }, []);
2934
- useEffect8(() => {
4442
+ useEffect12(() => {
2935
4443
  var _a;
2936
4444
  registerNode(id, {
2937
4445
  methods: { sync, showOverlay, hideOverlay },
@@ -2956,7 +4464,7 @@ var DraggableComponent = ({
2956
4464
  () => overrides.componentOverlay || DefaultOverlay,
2957
4465
  [overrides.componentOverlay]
2958
4466
  );
2959
- const onClick = useCallback7(
4467
+ const onClick = useCallback8(
2960
4468
  (e) => {
2961
4469
  const el = e.target;
2962
4470
  if (!el.closest("[data-puck-overlay-portal]")) {
@@ -2972,7 +4480,7 @@ var DraggableComponent = ({
2972
4480
  [index, zoneCompound, id]
2973
4481
  );
2974
4482
  const appStore = useAppStoreApi();
2975
- const onSelectParent = useCallback7(() => {
4483
+ const onSelectParent = useCallback8(() => {
2976
4484
  const { nodes, zones } = appStore.getState().state.indexes;
2977
4485
  const node = nodes[id];
2978
4486
  const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node == null ? void 0 : node.parentId] : null;
@@ -2993,14 +4501,14 @@ var DraggableComponent = ({
2993
4501
  }
2994
4502
  });
2995
4503
  }, [ctx, path]);
2996
- const onDuplicate = useCallback7(() => {
4504
+ const onDuplicate = useCallback8(() => {
2997
4505
  dispatch({
2998
4506
  type: "duplicate",
2999
4507
  sourceIndex: index,
3000
4508
  sourceZone: zoneCompound
3001
4509
  });
3002
4510
  }, [index, zoneCompound]);
3003
- const onDelete = useCallback7(() => {
4511
+ const onDelete = useCallback8(() => {
3004
4512
  dispatch({
3005
4513
  type: "remove",
3006
4514
  index,
@@ -3012,7 +4520,7 @@ var DraggableComponent = ({
3012
4520
  ZoneStoreContext,
3013
4521
  (s) => s.hoveringComponent === id
3014
4522
  );
3015
- useEffect8(() => {
4523
+ useEffect12(() => {
3016
4524
  if (!ref.current) {
3017
4525
  return;
3018
4526
  }
@@ -3060,7 +4568,7 @@ var DraggableComponent = ({
3060
4568
  const [isVisible, setIsVisible] = useState10(false);
3061
4569
  const [dragFinished, setDragFinished] = useState10(true);
3062
4570
  const [_, startTransition] = useTransition();
3063
- useEffect8(() => {
4571
+ useEffect12(() => {
3064
4572
  startTransition(() => {
3065
4573
  if (hover || indicativeHover || isSelected) {
3066
4574
  sync();
@@ -3082,15 +4590,15 @@ var DraggableComponent = ({
3082
4590
  setDragFinished(false);
3083
4591
  }
3084
4592
  });
3085
- useEffect8(() => {
4593
+ useEffect12(() => {
3086
4594
  if (thisIsDragging) {
3087
4595
  setThisWasDragging(true);
3088
4596
  }
3089
4597
  }, [thisIsDragging]);
3090
- useEffect8(() => {
4598
+ useEffect12(() => {
3091
4599
  if (thisWasDragging) return onDragFinished();
3092
4600
  }, [thisWasDragging, onDragFinished]);
3093
- const syncActionsPosition = useCallback7(
4601
+ const syncActionsPosition = useCallback8(
3094
4602
  (el) => {
3095
4603
  if (el) {
3096
4604
  const view = el.ownerDocument.defaultView;
@@ -3115,7 +4623,7 @@ var DraggableComponent = ({
3115
4623
  },
3116
4624
  [zoom]
3117
4625
  );
3118
- useEffect8(() => {
4626
+ useEffect12(() => {
3119
4627
  if (userDragAxis) {
3120
4628
  setDragAxis(userDragAxis);
3121
4629
  return;
@@ -3229,7 +4737,7 @@ import { useDroppable } from "@dnd-kit/react";
3229
4737
 
3230
4738
  // components/DropZone/lib/use-min-empty-height.ts
3231
4739
  init_react_import();
3232
- import { useEffect as useEffect9, useRef as useRef3, useState as useState11 } from "react";
4740
+ import { useEffect as useEffect13, useRef as useRef3, useState as useState11 } from "react";
3233
4741
  var getNumItems = (appStore, zoneCompound) => appStore.getState().state.indexes.zones[zoneCompound].contentIds.length;
3234
4742
  var useMinEmptyHeight = ({
3235
4743
  zoneCompound,
@@ -3281,7 +4789,7 @@ var useMinEmptyHeight = ({
3281
4789
  },
3282
4790
  [appStore, prevHeight, zoneCompound]
3283
4791
  );
3284
- useEffect9(() => {
4792
+ useEffect13(() => {
3285
4793
  if (draggedItem && ref.current) {
3286
4794
  if (isZone) {
3287
4795
  const rect = ref.current.getBoundingClientRect();
@@ -3312,15 +4820,15 @@ function assignRefs(refs, node) {
3312
4820
 
3313
4821
  // components/DropZone/lib/use-content-with-preview.ts
3314
4822
  init_react_import();
3315
- import { useContext as useContext5, useEffect as useEffect10, useState as useState12 } from "react";
4823
+ import { useContext as useContext6, useEffect as useEffect14, useState as useState12 } from "react";
3316
4824
 
3317
4825
  // lib/dnd/use-rendered-callback.ts
3318
4826
  init_react_import();
3319
4827
  import { useDragDropManager } from "@dnd-kit/react";
3320
- import { useCallback as useCallback8 } from "react";
4828
+ import { useCallback as useCallback9 } from "react";
3321
4829
  function useRenderedCallback(callback, deps) {
3322
4830
  const manager = useDragDropManager();
3323
- return useCallback8(
4831
+ return useCallback9(
3324
4832
  (...args) => __async(this, null, function* () {
3325
4833
  yield manager == null ? void 0 : manager.renderer.rendering;
3326
4834
  return callback(...args);
@@ -3331,7 +4839,7 @@ function useRenderedCallback(callback, deps) {
3331
4839
 
3332
4840
  // components/DropZone/lib/use-content-with-preview.ts
3333
4841
  var useContentIdsWithPreview = (contentIds, zoneCompound) => {
3334
- const zoneStore = useContext5(ZoneStoreContext);
4842
+ const zoneStore = useContext6(ZoneStoreContext);
3335
4843
  const preview = useContextStore(
3336
4844
  ZoneStoreContext,
3337
4845
  (s) => s.previewIndex[zoneCompound]
@@ -3373,7 +4881,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
3373
4881
  },
3374
4882
  []
3375
4883
  );
3376
- useEffect10(() => {
4884
+ useEffect14(() => {
3377
4885
  var _a;
3378
4886
  const s = zoneStore.getState();
3379
4887
  const draggedItemId = (_a = s.draggedItem) == null ? void 0 : _a.id;
@@ -3391,7 +4899,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
3391
4899
 
3392
4900
  // components/DropZone/lib/use-drag-axis.ts
3393
4901
  init_react_import();
3394
- import { useCallback as useCallback9, useEffect as useEffect11, useState as useState13 } from "react";
4902
+ import { useCallback as useCallback10, useEffect as useEffect15, useState as useState13 } from "react";
3395
4903
  var GRID_DRAG_AXIS = "dynamic";
3396
4904
  var FLEX_ROW_DRAG_AXIS = "x";
3397
4905
  var DEFAULT_DRAG_AXIS = "y";
@@ -3400,7 +4908,7 @@ var useDragAxis = (ref, collisionAxis) => {
3400
4908
  const [dragAxis, setDragAxis] = useState13(
3401
4909
  collisionAxis || DEFAULT_DRAG_AXIS
3402
4910
  );
3403
- const calculateDragAxis = useCallback9(() => {
4911
+ const calculateDragAxis = useCallback10(() => {
3404
4912
  if (ref.current) {
3405
4913
  const computedStyle = window.getComputedStyle(ref.current);
3406
4914
  if (computedStyle.display === "grid") {
@@ -3412,7 +4920,7 @@ var useDragAxis = (ref, collisionAxis) => {
3412
4920
  }
3413
4921
  }
3414
4922
  }, [ref.current]);
3415
- useEffect11(() => {
4923
+ useEffect15(() => {
3416
4924
  const onViewportChange = () => {
3417
4925
  calculateDragAxis();
3418
4926
  };
@@ -3421,7 +4929,7 @@ var useDragAxis = (ref, collisionAxis) => {
3421
4929
  window.removeEventListener("viewportchange", onViewportChange);
3422
4930
  };
3423
4931
  }, []);
3424
- useEffect11(calculateDragAxis, [status, collisionAxis]);
4932
+ useEffect15(calculateDragAxis, [status, collisionAxis]);
3425
4933
  return [dragAxis, calculateDragAxis];
3426
4934
  };
3427
4935
 
@@ -3509,12 +5017,259 @@ function Render({
3509
5017
  return /* @__PURE__ */ jsx23(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ jsx23(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx23(DropZoneRenderPure, { zone: rootZone }) }) });
3510
5018
  }
3511
5019
 
5020
+ // lib/field-transforms/default-transforms/inline-text-transform.tsx
5021
+ init_react_import();
5022
+
5023
+ // components/InlineTextField/index.tsx
5024
+ init_react_import();
5025
+ import { memo as memo3, useEffect as useEffect16, useRef as useRef4, useState as useState14 } from "react";
5026
+
5027
+ // lib/overlay-portal/index.tsx
5028
+ init_react_import();
5029
+ var registerOverlayPortal = (el, opts = {}) => {
5030
+ if (!el) return;
5031
+ const { disableDrag = false, disableDragOnFocus = true } = opts;
5032
+ const stopPropagation = (e) => {
5033
+ e.stopPropagation();
5034
+ };
5035
+ el.addEventListener("mouseover", stopPropagation, {
5036
+ capture: true
5037
+ });
5038
+ const onFocus = () => {
5039
+ setTimeout(() => {
5040
+ el.addEventListener("pointerdown", stopPropagation, {
5041
+ capture: true
5042
+ });
5043
+ }, 200);
5044
+ };
5045
+ const onBlur = () => {
5046
+ el.removeEventListener("pointerdown", stopPropagation, {
5047
+ capture: true
5048
+ });
5049
+ };
5050
+ if (disableDragOnFocus) {
5051
+ el.addEventListener("focus", onFocus, { capture: true });
5052
+ el.addEventListener("blur", onBlur, { capture: true });
5053
+ } else if (disableDrag) {
5054
+ el.addEventListener("pointerdown", stopPropagation, {
5055
+ capture: true
5056
+ });
5057
+ }
5058
+ el.setAttribute("data-puck-overlay-portal", "true");
5059
+ return () => {
5060
+ el.removeEventListener("mouseover", stopPropagation, {
5061
+ capture: true
5062
+ });
5063
+ if (disableDragOnFocus) {
5064
+ el.removeEventListener("focus", onFocus, { capture: true });
5065
+ el.removeEventListener("blur", onFocus, { capture: true });
5066
+ } else if (disableDrag) {
5067
+ el.removeEventListener("pointerdown", stopPropagation, {
5068
+ capture: true
5069
+ });
5070
+ }
5071
+ el.removeAttribute("data-puck-overlay-portal");
5072
+ };
5073
+ };
5074
+
5075
+ // css-module:/home/runner/work/puck/puck/packages/core/components/InlineTextField/styles.module.css#css-module
5076
+ init_react_import();
5077
+ var styles_module_default13 = { "InlineTextField": "_InlineTextField_ilw2a_1" };
5078
+
5079
+ // lib/data/set-deep.ts
5080
+ init_react_import();
5081
+ function setDeep(node, path, newVal) {
5082
+ const parts = path.split(".");
5083
+ const newNode = __spreadValues({}, node);
5084
+ let cur = newNode;
5085
+ for (let i = 0; i < parts.length; i++) {
5086
+ const [prop, idxStr] = parts[i].replace("]", "").split("[");
5087
+ const isLast = i === parts.length - 1;
5088
+ if (idxStr !== void 0) {
5089
+ if (!Array.isArray(cur[prop])) {
5090
+ cur[prop] = [];
5091
+ }
5092
+ const idx = Number(idxStr);
5093
+ if (isLast) {
5094
+ cur[prop][idx] = newVal;
5095
+ continue;
5096
+ }
5097
+ if (cur[prop][idx] === void 0) cur[prop][idx] = {};
5098
+ cur = cur[prop][idx];
5099
+ continue;
5100
+ }
5101
+ if (isLast) {
5102
+ cur[prop] = newVal;
5103
+ continue;
5104
+ }
5105
+ if (cur[prop] === void 0) {
5106
+ cur[prop] = {};
5107
+ }
5108
+ cur = cur[prop];
5109
+ }
5110
+ return __spreadValues(__spreadValues({}, node), newNode);
5111
+ }
5112
+
5113
+ // lib/get-selector-for-id.ts
5114
+ init_react_import();
5115
+ var getSelectorForId = (state, id) => {
5116
+ const node = state.indexes.nodes[id];
5117
+ if (!node) return;
5118
+ const zoneCompound = `${node.parentId}:${node.zone}`;
5119
+ const index = state.indexes.zones[zoneCompound].contentIds.indexOf(id);
5120
+ return { zone: zoneCompound, index };
5121
+ };
5122
+
5123
+ // components/InlineTextField/index.tsx
5124
+ import { jsx as jsx24 } from "react/jsx-runtime";
5125
+ var getClassName17 = get_class_name_factory_default("InlineTextField", styles_module_default13);
5126
+ var InlineTextFieldInternal = ({
5127
+ propPath,
5128
+ componentId,
5129
+ value,
5130
+ isReadOnly,
5131
+ opts = {}
5132
+ }) => {
5133
+ var _a;
5134
+ const ref = useRef4(null);
5135
+ const appStoreApi = useAppStoreApi();
5136
+ const disableLineBreaks = (_a = opts.disableLineBreaks) != null ? _a : false;
5137
+ useEffect16(() => {
5138
+ const appStore = appStoreApi.getState();
5139
+ const data = appStore.state.indexes.nodes[componentId].data;
5140
+ const componentConfig = appStore.getComponentConfig(data.type);
5141
+ if (!componentConfig) {
5142
+ throw new Error(
5143
+ `InlineTextField Error: No config defined for ${data.type}`
5144
+ );
5145
+ }
5146
+ if (ref.current) {
5147
+ if (value !== ref.current.innerText) {
5148
+ ref.current.replaceChildren(value);
5149
+ }
5150
+ const cleanupPortal = registerOverlayPortal(ref.current);
5151
+ const handleInput = (e) => __async(void 0, null, function* () {
5152
+ var _a2;
5153
+ const appStore2 = appStoreApi.getState();
5154
+ const node = appStore2.state.indexes.nodes[componentId];
5155
+ const zoneCompound = `${node.parentId}:${node.zone}`;
5156
+ const index = (_a2 = appStore2.state.indexes.zones[zoneCompound]) == null ? void 0 : _a2.contentIds.indexOf(
5157
+ componentId
5158
+ );
5159
+ const newProps = setDeep(node.data.props, propPath, e.target.innerText);
5160
+ const resolvedData = yield appStore2.resolveComponentData(
5161
+ __spreadProps(__spreadValues({}, node.data), { props: newProps }),
5162
+ "replace"
5163
+ );
5164
+ appStore2.dispatch({
5165
+ type: "replace",
5166
+ data: resolvedData.node,
5167
+ destinationIndex: index,
5168
+ destinationZone: zoneCompound
5169
+ });
5170
+ });
5171
+ ref.current.addEventListener("input", handleInput);
5172
+ return () => {
5173
+ var _a2;
5174
+ (_a2 = ref.current) == null ? void 0 : _a2.removeEventListener("input", handleInput);
5175
+ cleanupPortal == null ? void 0 : cleanupPortal();
5176
+ };
5177
+ }
5178
+ }, [appStoreApi, ref.current, value]);
5179
+ const [isHovering, setIsHovering] = useState14(false);
5180
+ const [isFocused, setIsFocused] = useState14(false);
5181
+ return /* @__PURE__ */ jsx24(
5182
+ "span",
5183
+ {
5184
+ className: getClassName17(),
5185
+ ref,
5186
+ contentEditable: isHovering || isFocused ? "plaintext-only" : "false",
5187
+ onClick: (e) => {
5188
+ e.preventDefault();
5189
+ e.stopPropagation();
5190
+ },
5191
+ onClickCapture: (e) => {
5192
+ e.preventDefault();
5193
+ e.stopPropagation();
5194
+ const itemSelector = getSelectorForId(
5195
+ appStoreApi.getState().state,
5196
+ componentId
5197
+ );
5198
+ appStoreApi.getState().setUi({ itemSelector });
5199
+ },
5200
+ onKeyDown: (e) => {
5201
+ e.stopPropagation();
5202
+ if (disableLineBreaks && e.key === "Enter" || isReadOnly) {
5203
+ e.preventDefault();
5204
+ }
5205
+ },
5206
+ onKeyUp: (e) => {
5207
+ e.stopPropagation();
5208
+ e.preventDefault();
5209
+ },
5210
+ onMouseOverCapture: () => setIsHovering(true),
5211
+ onMouseOutCapture: () => setIsHovering(false),
5212
+ onFocus: () => setIsFocused(true),
5213
+ onBlur: () => setIsFocused(false)
5214
+ }
5215
+ );
5216
+ };
5217
+ var InlineTextField = memo3(InlineTextFieldInternal);
5218
+
5219
+ // lib/field-transforms/default-transforms/inline-text-transform.tsx
5220
+ import { jsx as jsx25 } from "react/jsx-runtime";
5221
+ var getInlineTextTransform = () => ({
5222
+ text: ({ value, componentId, field, propPath, isReadOnly }) => {
5223
+ if (field.contentEditable) {
5224
+ return /* @__PURE__ */ jsx25(
5225
+ InlineTextField,
5226
+ {
5227
+ propPath,
5228
+ componentId,
5229
+ value,
5230
+ opts: { disableLineBreaks: true },
5231
+ isReadOnly
5232
+ }
5233
+ );
5234
+ }
5235
+ return value;
5236
+ },
5237
+ textarea: ({ value, componentId, field, propPath, isReadOnly }) => {
5238
+ if (field.contentEditable) {
5239
+ return /* @__PURE__ */ jsx25(
5240
+ InlineTextField,
5241
+ {
5242
+ propPath,
5243
+ componentId,
5244
+ value,
5245
+ isReadOnly
5246
+ }
5247
+ );
5248
+ }
5249
+ return value;
5250
+ },
5251
+ custom: ({ value, componentId, field, propPath, isReadOnly }) => {
5252
+ if (field.contentEditable && typeof value === "string") {
5253
+ return /* @__PURE__ */ jsx25(
5254
+ InlineTextField,
5255
+ {
5256
+ propPath,
5257
+ componentId,
5258
+ value,
5259
+ isReadOnly
5260
+ }
5261
+ );
5262
+ }
5263
+ return value;
5264
+ }
5265
+ });
5266
+
3512
5267
  // 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);
5268
+ import { Fragment as Fragment8, jsx as jsx26, jsxs as jsxs10 } from "react/jsx-runtime";
5269
+ var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default12);
3515
5270
  var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
3516
5271
  var RENDER_DEBUG = false;
3517
- var DropZoneEditPure = (props) => /* @__PURE__ */ jsx24(DropZoneEdit, __spreadValues({}, props));
5272
+ var DropZoneEditPure = (props) => /* @__PURE__ */ jsx26(DropZoneEdit, __spreadValues({}, props));
3518
5273
  var DropZoneChild = ({
3519
5274
  zoneCompound,
3520
5275
  componentId,
@@ -3525,9 +5280,9 @@ var DropZoneChild = ({
3525
5280
  }) => {
3526
5281
  var _a, _b;
3527
5282
  const metadata = useAppStore((s) => s.metadata);
3528
- const ctx = useContext6(dropZoneContext);
5283
+ const ctx = useContext7(dropZoneContext);
3529
5284
  const { depth = 1 } = ctx != null ? ctx : {};
3530
- const zoneStore = useContext6(ZoneStoreContext);
5285
+ const zoneStore = useContext7(ZoneStoreContext);
3531
5286
  const nodeProps = useAppStore(
3532
5287
  useShallow5((s) => {
3533
5288
  var _a2;
@@ -3598,10 +5353,10 @@ var DropZoneChild = ({
3598
5353
  if (item && "element" in item && item.element) {
3599
5354
  return (
3600
5355
  // Safe to use this since the HTML is set by the user
3601
- /* @__PURE__ */ jsx24("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
5356
+ /* @__PURE__ */ jsx26("div", { dangerouslySetInnerHTML: { __html: item.element.outerHTML } })
3602
5357
  );
3603
5358
  }
3604
- return /* @__PURE__ */ jsx24(DrawerItemInner, { name: label, children: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem });
5359
+ return /* @__PURE__ */ jsx26(DrawerItemInner, { name: label, children: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem });
3605
5360
  },
3606
5361
  [componentId, label, overrides]
3607
5362
  );
@@ -3624,7 +5379,7 @@ var DropZoneChild = ({
3624
5379
  const plugins = useAppStore((s) => s.plugins);
3625
5380
  const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
3626
5381
  const combinedFieldTransforms = useMemo7(
3627
- () => __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ jsx24(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), plugins.reduce(
5382
+ () => __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ jsx26(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), plugins.reduce(
3628
5383
  (acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
3629
5384
  {}
3630
5385
  )), userFieldTransforms),
@@ -3647,7 +5402,7 @@ var DropZoneChild = ({
3647
5402
  if (isInserting) {
3648
5403
  Render2 = renderPreview;
3649
5404
  }
3650
- return /* @__PURE__ */ jsx24(
5405
+ return /* @__PURE__ */ jsx26(
3651
5406
  DraggableComponent,
3652
5407
  {
3653
5408
  id: componentId,
@@ -3661,18 +5416,18 @@ var DropZoneChild = ({
3661
5416
  autoDragAxis: dragAxis,
3662
5417
  userDragAxis: collisionAxis,
3663
5418
  inDroppableZone,
3664
- children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isInserting ? /* @__PURE__ */ jsx24(Fragment8, { children: /* @__PURE__ */ jsx24(
5419
+ children: (dragRef) => (componentConfig == null ? void 0 : componentConfig.inline) && !isInserting ? /* @__PURE__ */ jsx26(Fragment8, { children: /* @__PURE__ */ jsx26(
3665
5420
  Render2,
3666
5421
  __spreadProps(__spreadValues({}, transformedProps), {
3667
5422
  puck: __spreadProps(__spreadValues({}, transformedProps.puck), {
3668
5423
  dragRef
3669
5424
  })
3670
5425
  })
3671
- ) }) : /* @__PURE__ */ jsx24("div", { ref: dragRef, children: /* @__PURE__ */ jsx24(Render2, __spreadValues({}, transformedProps)) })
5426
+ ) }) : /* @__PURE__ */ jsx26("div", { ref: dragRef, children: /* @__PURE__ */ jsx26(Render2, __spreadValues({}, transformedProps)) })
3672
5427
  }
3673
5428
  );
3674
5429
  };
3675
- var DropZoneChildMemo = memo3(DropZoneChild);
5430
+ var DropZoneChildMemo = memo4(DropZoneChild);
3676
5431
  var DropZoneEdit = forwardRef3(
3677
5432
  function DropZoneEditInternal({
3678
5433
  zone,
@@ -3683,7 +5438,7 @@ var DropZoneEdit = forwardRef3(
3683
5438
  minEmptyHeight: userMinEmptyHeight = 128,
3684
5439
  collisionAxis
3685
5440
  }, userRef) {
3686
- const ctx = useContext6(dropZoneContext);
5441
+ const ctx = useContext7(dropZoneContext);
3687
5442
  const appStoreApi = useAppStoreApi();
3688
5443
  const {
3689
5444
  // These all need setting via context
@@ -3721,14 +5476,14 @@ var DropZoneEdit = forwardRef3(
3721
5476
  return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.type;
3722
5477
  })
3723
5478
  );
3724
- useEffect12(() => {
5479
+ useEffect17(() => {
3725
5480
  if (!zoneType || zoneType === "dropzone") {
3726
5481
  if (ctx == null ? void 0 : ctx.registerZone) {
3727
5482
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
3728
5483
  }
3729
5484
  }
3730
5485
  }, [zoneType, appStoreApi]);
3731
- useEffect12(() => {
5486
+ useEffect17(() => {
3732
5487
  if (zoneType === "dropzone") {
3733
5488
  if (zoneCompound !== rootDroppableId) {
3734
5489
  console.warn(
@@ -3740,8 +5495,8 @@ var DropZoneEdit = forwardRef3(
3740
5495
  const contentIds = useMemo7(() => {
3741
5496
  return zoneContentIds || [];
3742
5497
  }, [zoneContentIds]);
3743
- const ref = useRef4(null);
3744
- const acceptsTarget = useCallback10(
5498
+ const ref = useRef5(null);
5499
+ const acceptsTarget = useCallback11(
3745
5500
  (componentType) => {
3746
5501
  if (!componentType) {
3747
5502
  return true;
@@ -3779,7 +5534,7 @@ var DropZoneEdit = forwardRef3(
3779
5534
  }
3780
5535
  return _isEnabled;
3781
5536
  });
3782
- useEffect12(() => {
5537
+ useEffect17(() => {
3783
5538
  if (registerLocalZone) {
3784
5539
  registerLocalZone(zoneCompound, targetAccepted || isEnabled);
3785
5540
  }
@@ -3794,8 +5549,8 @@ var DropZoneEdit = forwardRef3(
3794
5549
  zoneCompound
3795
5550
  );
3796
5551
  const isDropEnabled = isEnabled && (preview ? contentIdsWithPreview.length === 1 : contentIdsWithPreview.length === 0);
3797
- const zoneStore = useContext6(ZoneStoreContext);
3798
- useEffect12(() => {
5552
+ const zoneStore = useContext7(ZoneStoreContext);
5553
+ useEffect17(() => {
3799
5554
  const { enabledIndex } = zoneStore.getState();
3800
5555
  zoneStore.setState({
3801
5556
  enabledIndex: __spreadProps(__spreadValues({}, enabledIndex), { [zoneCompound]: isEnabled })
@@ -3824,10 +5579,10 @@ var DropZoneEdit = forwardRef3(
3824
5579
  userMinEmptyHeight,
3825
5580
  ref
3826
5581
  });
3827
- return /* @__PURE__ */ jsx24(
5582
+ return /* @__PURE__ */ jsx26(
3828
5583
  "div",
3829
5584
  {
3830
- className: `${getClassName17({
5585
+ className: `${getClassName18({
3831
5586
  isRootZone,
3832
5587
  hoveringOverArea,
3833
5588
  isEnabled,
@@ -3845,7 +5600,7 @@ var DropZoneEdit = forwardRef3(
3845
5600
  backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
3846
5601
  }),
3847
5602
  children: contentIdsWithPreview.map((componentId, i) => {
3848
- return /* @__PURE__ */ jsx24(
5603
+ return /* @__PURE__ */ jsx26(
3849
5604
  DropZoneChildMemo,
3850
5605
  {
3851
5606
  zoneCompound,
@@ -3868,7 +5623,7 @@ var DropZoneRenderItem = ({
3868
5623
  metadata
3869
5624
  }) => {
3870
5625
  const Component = config.components[item.type];
3871
- const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx24(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
5626
+ const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx26(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
3872
5627
  const nextContextValue = useMemo7(
3873
5628
  () => ({
3874
5629
  areaId: props.id,
@@ -3876,7 +5631,7 @@ var DropZoneRenderItem = ({
3876
5631
  }),
3877
5632
  [props]
3878
5633
  );
3879
- return /* @__PURE__ */ jsx24(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx24(
5634
+ return /* @__PURE__ */ jsx26(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx26(
3880
5635
  Component.render,
3881
5636
  __spreadProps(__spreadValues({}, props), {
3882
5637
  puck: __spreadProps(__spreadValues({}, props.puck), {
@@ -3886,15 +5641,15 @@ var DropZoneRenderItem = ({
3886
5641
  })
3887
5642
  ) }, props.id);
3888
5643
  };
3889
- var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx24(DropZoneRender, __spreadValues({}, props));
5644
+ var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx26(DropZoneRender, __spreadValues({}, props));
3890
5645
  var DropZoneRender = forwardRef3(
3891
5646
  function DropZoneRenderInternal({ className, style, zone }, ref) {
3892
- const ctx = useContext6(dropZoneContext);
5647
+ const ctx = useContext7(dropZoneContext);
3893
5648
  const { areaId = "root" } = ctx || {};
3894
- const { config, data, metadata } = useContext6(renderContext);
5649
+ const { config, data, metadata } = useContext7(renderContext);
3895
5650
  let zoneCompound = `${areaId}:${zone}`;
3896
5651
  let content = (data == null ? void 0 : data.content) || [];
3897
- useEffect12(() => {
5652
+ useEffect17(() => {
3898
5653
  if (!content) {
3899
5654
  if (ctx == null ? void 0 : ctx.registerZone) {
3900
5655
  ctx == null ? void 0 : ctx.registerZone(zoneCompound);
@@ -3907,10 +5662,10 @@ var DropZoneRender = forwardRef3(
3907
5662
  if (zoneCompound !== rootDroppableId) {
3908
5663
  content = setupZone(data, zoneCompound).zones[zoneCompound];
3909
5664
  }
3910
- return /* @__PURE__ */ jsx24("div", { className, style, ref, children: content.map((item) => {
5665
+ return /* @__PURE__ */ jsx26("div", { className, style, ref, children: content.map((item) => {
3911
5666
  const Component = config.components[item.type];
3912
5667
  if (Component) {
3913
- return /* @__PURE__ */ jsx24(
5668
+ return /* @__PURE__ */ jsx26(
3914
5669
  DropZoneRenderItem,
3915
5670
  {
3916
5671
  config,
@@ -3924,14 +5679,14 @@ var DropZoneRender = forwardRef3(
3924
5679
  }) });
3925
5680
  }
3926
5681
  );
3927
- var DropZonePure = (props) => /* @__PURE__ */ jsx24(DropZone, __spreadValues({}, props));
5682
+ var DropZonePure = (props) => /* @__PURE__ */ jsx26(DropZone, __spreadValues({}, props));
3928
5683
  var DropZone = forwardRef3(
3929
5684
  function DropZone2(props, ref) {
3930
- const ctx = useContext6(dropZoneContext);
5685
+ const ctx = useContext7(dropZoneContext);
3931
5686
  if ((ctx == null ? void 0 : ctx.mode) === "edit") {
3932
- return /* @__PURE__ */ jsx24(Fragment8, { children: /* @__PURE__ */ jsx24(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
5687
+ return /* @__PURE__ */ jsx26(Fragment8, { children: /* @__PURE__ */ jsx26(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
3933
5688
  }
3934
- return /* @__PURE__ */ jsx24(Fragment8, { children: /* @__PURE__ */ jsx24(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
5689
+ return /* @__PURE__ */ jsx26(Fragment8, { children: /* @__PURE__ */ jsx26(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
3935
5690
  }
3936
5691
  );
3937
5692
 
@@ -4222,7 +5977,7 @@ var insertComponent = (componentType, zone, index, appStore) => __async(void 0,
4222
5977
  destinationZone: zone,
4223
5978
  id
4224
5979
  };
4225
- const { state, dispatch, resolveComponentData } = appStore;
5980
+ const { state, dispatch, resolveComponentData: resolveComponentData2 } = appStore;
4226
5981
  const insertedState = insertAction(state, insertActionData, appStore);
4227
5982
  dispatch(__spreadProps(__spreadValues({}, insertActionData), {
4228
5983
  // Dispatch insert rather set, as user's may rely on this via onAction
@@ -4238,7 +5993,7 @@ var insertComponent = (componentType, zone, index, appStore) => __async(void 0,
4238
5993
  dispatch({ type: "setUi", ui: { itemSelector } });
4239
5994
  const itemData = getItem(itemSelector, insertedState);
4240
5995
  if (itemData) {
4241
- const resolved = yield resolveComponentData(itemData, "insert");
5996
+ const resolved = yield resolveComponentData2(itemData, "insert");
4242
5997
  if (resolved.didChange) {
4243
5998
  dispatch({
4244
5999
  type: "replace",
@@ -4267,14 +6022,14 @@ function getDeepDir(el) {
4267
6022
 
4268
6023
  // components/DragDropContext/index.tsx
4269
6024
  import { effect } from "@dnd-kit/state";
4270
- import { jsx as jsx25 } from "react/jsx-runtime";
6025
+ import { jsx as jsx27 } from "react/jsx-runtime";
4271
6026
  var DEBUG3 = false;
4272
- var dragListenerContext = createContext3({
6027
+ var dragListenerContext = createContext4({
4273
6028
  dragListeners: {}
4274
6029
  });
4275
6030
  function useDragListener(type, fn, deps = []) {
4276
- const { setDragListeners } = useContext7(dragListenerContext);
4277
- useEffect13(() => {
6031
+ const { setDragListeners } = useContext8(dragListenerContext);
6032
+ useEffect18(() => {
4278
6033
  if (setDragListeners) {
4279
6034
  setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
4280
6035
  [type]: [...old[type] || [], fn]
@@ -4284,8 +6039,8 @@ function useDragListener(type, fn, deps = []) {
4284
6039
  }
4285
6040
  var AREA_CHANGE_DEBOUNCE_MS = 100;
4286
6041
  var useTempDisableFallback = (timeout3) => {
4287
- const lastFallbackDisable = useRef5(null);
4288
- return useCallback11((manager) => {
6042
+ const lastFallbackDisable = useRef6(null);
6043
+ return useCallback12((manager) => {
4289
6044
  collisionStore.setState({ fallbackEnabled: false });
4290
6045
  const fallbackId = generateId();
4291
6046
  lastFallbackDisable.current = fallbackId;
@@ -4304,9 +6059,9 @@ var DragDropContextClient = ({
4304
6059
  const dispatch = useAppStore((s) => s.dispatch);
4305
6060
  const appStore = useAppStoreApi();
4306
6061
  const id = useSafeId();
4307
- const debouncedParamsRef = useRef5(null);
6062
+ const debouncedParamsRef = useRef6(null);
4308
6063
  const tempDisableFallback = useTempDisableFallback(100);
4309
- const [zoneStore] = useState14(
6064
+ const [zoneStore] = useState15(
4310
6065
  () => createStore3(() => ({
4311
6066
  zoneDepthIndex: {},
4312
6067
  nextZoneDepthIndex: {},
@@ -4318,7 +6073,7 @@ var DragDropContextClient = ({
4318
6073
  hoveringComponent: null
4319
6074
  }))
4320
6075
  );
4321
- const getChanged = useCallback11(
6076
+ const getChanged2 = useCallback12(
4322
6077
  (params, id2) => {
4323
6078
  const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
4324
6079
  const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
@@ -4339,9 +6094,9 @@ var DragDropContextClient = ({
4339
6094
  },
4340
6095
  [zoneStore]
4341
6096
  );
4342
- const setDeepestAndCollide = useCallback11(
6097
+ const setDeepestAndCollide = useCallback12(
4343
6098
  (params, manager) => {
4344
- const { zoneChanged, areaChanged } = getChanged(params, id);
6099
+ const { zoneChanged, areaChanged } = getChanged2(params, id);
4345
6100
  if (!zoneChanged && !areaChanged) return;
4346
6101
  zoneStore.setState({
4347
6102
  zoneDepthIndex: params.zone ? { [params.zone]: true } : {},
@@ -4363,7 +6118,7 @@ var DragDropContextClient = ({
4363
6118
  setDeepestDb.cancel();
4364
6119
  debouncedParamsRef.current = null;
4365
6120
  };
4366
- useEffect13(() => {
6121
+ useEffect18(() => {
4367
6122
  if (DEBUG3) {
4368
6123
  zoneStore.subscribe(
4369
6124
  (s) => {
@@ -4377,13 +6132,13 @@ var DragDropContextClient = ({
4377
6132
  );
4378
6133
  }
4379
6134
  }, []);
4380
- const [plugins] = useState14(() => [
6135
+ const [plugins] = useState15(() => [
4381
6136
  ...disableAutoScroll ? defaultPreset.plugins.filter((plugin) => plugin !== AutoScroller) : defaultPreset.plugins,
4382
6137
  createNestedDroppablePlugin(
4383
6138
  {
4384
6139
  onChange: (params, manager) => {
4385
6140
  const state = zoneStore.getState();
4386
- const { zoneChanged, areaChanged } = getChanged(params, id);
6141
+ const { zoneChanged, areaChanged } = getChanged2(params, id);
4387
6142
  const isDragging = manager.dragOperation.status.dragging;
4388
6143
  if (areaChanged || zoneChanged) {
4389
6144
  let nextZoneDepthIndex = {};
@@ -4425,9 +6180,9 @@ var DragDropContextClient = ({
4425
6180
  )
4426
6181
  ]);
4427
6182
  const sensors = useSensors();
4428
- const [dragListeners, setDragListeners] = useState14({});
4429
- const dragMode = useRef5(null);
4430
- const initialSelector = useRef5(void 0);
6183
+ const [dragListeners, setDragListeners] = useState15({});
6184
+ const dragMode = useRef6(null);
6185
+ const initialSelector = useRef6(void 0);
4431
6186
  const nextContextValue = useMemo8(
4432
6187
  () => ({
4433
6188
  mode: "edit",
@@ -4436,14 +6191,14 @@ var DragDropContextClient = ({
4436
6191
  }),
4437
6192
  []
4438
6193
  );
4439
- return /* @__PURE__ */ jsx25("div", { id, children: /* @__PURE__ */ jsx25(
6194
+ return /* @__PURE__ */ jsx27("div", { id, children: /* @__PURE__ */ jsx27(
4440
6195
  dragListenerContext.Provider,
4441
6196
  {
4442
6197
  value: {
4443
6198
  dragListeners,
4444
6199
  setDragListeners
4445
6200
  },
4446
- children: /* @__PURE__ */ jsx25(
6201
+ children: /* @__PURE__ */ jsx27(
4447
6202
  DragDropProvider2,
4448
6203
  {
4449
6204
  plugins,
@@ -4659,7 +6414,7 @@ var DragDropContextClient = ({
4659
6414
  const entryEl = (_d = getFrame()) == null ? void 0 : _d.querySelector("[data-puck-entry]");
4660
6415
  entryEl == null ? void 0 : entryEl.setAttribute("data-puck-dragging", "true");
4661
6416
  },
4662
- children: /* @__PURE__ */ jsx25(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ jsx25(DropZoneProvider, { value: nextContextValue, children }) })
6417
+ children: /* @__PURE__ */ jsx27(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ jsx27(DropZoneProvider, { value: nextContextValue, children }) })
4663
6418
  }
4664
6419
  )
4665
6420
  }
@@ -4673,13 +6428,13 @@ var DragDropContext = ({
4673
6428
  if (status === "LOADING") {
4674
6429
  return children;
4675
6430
  }
4676
- return /* @__PURE__ */ jsx25(DragDropContextClient, { disableAutoScroll, children });
6431
+ return /* @__PURE__ */ jsx27(DragDropContextClient, { disableAutoScroll, children });
4677
6432
  };
4678
6433
 
4679
6434
  // components/Drawer/index.tsx
4680
6435
  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);
6436
+ import { jsx as jsx28, jsxs as jsxs11 } from "react/jsx-runtime";
6437
+ var getClassName19 = get_class_name_factory_default("Drawer", styles_module_default10);
4683
6438
  var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
4684
6439
  var DrawerItemInner = ({
4685
6440
  children,
@@ -4689,10 +6444,10 @@ var DrawerItemInner = ({
4689
6444
  isDragDisabled
4690
6445
  }) => {
4691
6446
  const CustomInner = useMemo9(
4692
- () => children || (({ children: children2 }) => /* @__PURE__ */ jsx26("div", { className: getClassNameItem2("default"), children: children2 })),
6447
+ () => children || (({ children: children2 }) => /* @__PURE__ */ jsx28("div", { className: getClassNameItem2("default"), children: children2 })),
4693
6448
  [children]
4694
6449
  );
4695
- return /* @__PURE__ */ jsx26(
6450
+ return /* @__PURE__ */ jsx28(
4696
6451
  "div",
4697
6452
  {
4698
6453
  className: getClassNameItem2({ disabled: isDragDisabled }),
@@ -4700,9 +6455,9 @@ var DrawerItemInner = ({
4700
6455
  onMouseDown: (e) => e.preventDefault(),
4701
6456
  "data-testid": dragRef ? `drawer-item:${name}` : "",
4702
6457
  "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, {}) })
6458
+ children: /* @__PURE__ */ jsx28(CustomInner, { name, children: /* @__PURE__ */ jsx28("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ jsxs11("div", { className: getClassNameItem2("draggable"), children: [
6459
+ /* @__PURE__ */ jsx28("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
6460
+ /* @__PURE__ */ jsx28("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ jsx28(DragIcon, {}) })
4706
6461
  ] }) }) })
4707
6462
  }
4708
6463
  );
@@ -4720,9 +6475,9 @@ var DrawerItemDraggable = ({
4720
6475
  disabled: isDragDisabled,
4721
6476
  type: "drawer"
4722
6477
  });
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(
6478
+ return /* @__PURE__ */ jsxs11("div", { className: getClassName19("draggable"), children: [
6479
+ /* @__PURE__ */ jsx28("div", { className: getClassName19("draggableBg"), children: /* @__PURE__ */ jsx28(DrawerItemInner, { name, label, children }) }),
6480
+ /* @__PURE__ */ jsx28("div", { className: getClassName19("draggableFg"), children: /* @__PURE__ */ jsx28(
4726
6481
  DrawerItemInner,
4727
6482
  {
4728
6483
  name,
@@ -4743,7 +6498,7 @@ var DrawerItem = ({
4743
6498
  isDragDisabled
4744
6499
  }) => {
4745
6500
  const resolvedId = id || name;
4746
- const [dynamicId, setDynamicId] = useState15(generateId(resolvedId));
6501
+ const [dynamicId, setDynamicId] = useState16(generateId(resolvedId));
4747
6502
  if (typeof index !== "undefined") {
4748
6503
  console.error(
4749
6504
  "Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
@@ -4756,7 +6511,7 @@ var DrawerItem = ({
4756
6511
  },
4757
6512
  [resolvedId]
4758
6513
  );
4759
- return /* @__PURE__ */ jsx26("div", { children: /* @__PURE__ */ jsx26(
6514
+ return /* @__PURE__ */ jsx28("div", { children: /* @__PURE__ */ jsx28(
4760
6515
  DrawerItemDraggable,
4761
6516
  {
4762
6517
  name,
@@ -4789,10 +6544,10 @@ var Drawer = ({
4789
6544
  collisionPriority: 0
4790
6545
  // Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
4791
6546
  });
4792
- return /* @__PURE__ */ jsx26(
6547
+ return /* @__PURE__ */ jsx28(
4793
6548
  "div",
4794
6549
  {
4795
- className: getClassName18(),
6550
+ className: getClassName19(),
4796
6551
  ref,
4797
6552
  "data-puck-dnd": id,
4798
6553
  "data-puck-drawer": true,
@@ -4806,13 +6561,13 @@ Drawer.Item = DrawerItem;
4806
6561
  // components/Puck/index.tsx
4807
6562
  init_react_import();
4808
6563
  import {
4809
- createContext as createContext7,
4810
- useCallback as useCallback20,
4811
- useContext as useContext12,
4812
- useEffect as useEffect25,
6564
+ createContext as createContext8,
6565
+ useCallback as useCallback21,
6566
+ useContext as useContext13,
6567
+ useEffect as useEffect30,
4813
6568
  useMemo as useMemo21,
4814
- useRef as useRef11,
4815
- useState as useState25
6569
+ useRef as useRef12,
6570
+ useState as useState26
4816
6571
  } from "react";
4817
6572
 
4818
6573
  // components/Puck/components/Fields/index.tsx
@@ -4820,21 +6575,21 @@ init_react_import();
4820
6575
 
4821
6576
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
4822
6577
  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" };
6578
+ 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
6579
 
4825
6580
  // components/Puck/components/Fields/index.tsx
4826
- import { memo as memo4, useCallback as useCallback12, useMemo as useMemo10 } from "react";
6581
+ import { memo as memo5, useCallback as useCallback13, useMemo as useMemo10 } from "react";
4827
6582
  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);
6583
+ import { Fragment as Fragment9, jsx as jsx29, jsxs as jsxs12 } from "react/jsx-runtime";
6584
+ var getClassName20 = get_class_name_factory_default("PuckFields", styles_module_default14);
4830
6585
  var DefaultFields = ({
4831
6586
  children
4832
6587
  }) => {
4833
- return /* @__PURE__ */ jsx27(Fragment9, { children });
6588
+ return /* @__PURE__ */ jsx29(Fragment9, { children });
4834
6589
  };
4835
6590
  var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void 0, null, function* () {
4836
6591
  let currentProps;
4837
- const { dispatch, state, selectedItem, resolveComponentData } = appStore.getState();
6592
+ const { dispatch, state, selectedItem, resolveComponentData: resolveComponentData2 } = appStore.getState();
4838
6593
  const { data, ui } = state;
4839
6594
  const { itemSelector } = ui;
4840
6595
  const rootProps = data.root.props || data.root;
@@ -4851,7 +6606,7 @@ var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void
4851
6606
  type: "replace",
4852
6607
  destinationIndex: itemSelector.index,
4853
6608
  destinationZone: itemSelector.zone || rootDroppableId,
4854
- data: (yield resolveComponentData(
6609
+ data: (yield resolveComponentData2(
4855
6610
  __spreadProps(__spreadValues({}, selectedItem), { props: newProps }),
4856
6611
  "replace"
4857
6612
  )).node,
@@ -4861,7 +6616,7 @@ var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(void
4861
6616
  if (data.root.props) {
4862
6617
  dispatch({
4863
6618
  type: "replaceRoot",
4864
- root: (yield resolveComponentData(
6619
+ root: (yield resolveComponentData2(
4865
6620
  __spreadProps(__spreadValues({}, data.root), { props: newProps }),
4866
6621
  "replace"
4867
6622
  )).node,
@@ -4892,13 +6647,13 @@ var FieldsChild = ({ fieldName }) => {
4892
6647
  })
4893
6648
  );
4894
6649
  const appStore = useAppStoreApi();
4895
- const onChange = useCallback12(createOnChange(fieldName, appStore), [
6650
+ const onChange = useCallback13(createOnChange(fieldName, appStore), [
4896
6651
  fieldName
4897
6652
  ]);
4898
6653
  const { visible = true } = field != null ? field : {};
4899
6654
  if (!field || !id || !visible) return null;
4900
6655
  if (field.type === "slot") return null;
4901
- return /* @__PURE__ */ jsx27("div", { className: getClassName19("field"), children: /* @__PURE__ */ jsx27(
6656
+ return /* @__PURE__ */ jsx29("div", { className: getClassName20("field"), children: /* @__PURE__ */ jsx29(
4902
6657
  AutoFieldPrivate,
4903
6658
  {
4904
6659
  field,
@@ -4909,7 +6664,7 @@ var FieldsChild = ({ fieldName }) => {
4909
6664
  }
4910
6665
  ) }, id);
4911
6666
  };
4912
- var FieldsChildMemo = memo4(FieldsChild);
6667
+ var FieldsChildMemo = memo5(FieldsChild);
4913
6668
  var FieldsInternal = ({ wrapFields = true }) => {
4914
6669
  const overrides = useAppStore((s) => s.overrides);
4915
6670
  const componentResolving = useAppStore((s) => {
@@ -4938,37 +6693,37 @@ var FieldsInternal = ({ wrapFields = true }) => {
4938
6693
  return /* @__PURE__ */ jsxs12(
4939
6694
  "form",
4940
6695
  {
4941
- className: getClassName19({ wrapFields }),
6696
+ className: getClassName20({ wrapFields }),
4942
6697
  onSubmit: (e) => {
4943
6698
  e.preventDefault();
4944
6699
  },
4945
6700
  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 }) }) })
6701
+ /* @__PURE__ */ jsx29(Wrapper, { isLoading, itemSelector, children: fieldNames.map((fieldName) => /* @__PURE__ */ jsx29(FieldsChildMemo, { fieldName }, fieldName)) }),
6702
+ isLoading && /* @__PURE__ */ jsx29("div", { className: getClassName20("loadingOverlay"), children: /* @__PURE__ */ jsx29("div", { className: getClassName20("loadingOverlayInner"), children: /* @__PURE__ */ jsx29(Loader, { size: 16 }) }) })
4948
6703
  ]
4949
6704
  }
4950
6705
  );
4951
6706
  };
4952
- var Fields = memo4(FieldsInternal);
6707
+ var Fields = memo5(FieldsInternal);
4953
6708
 
4954
6709
  // components/Puck/components/Components/index.tsx
4955
6710
  init_react_import();
4956
6711
 
4957
6712
  // lib/use-component-list.tsx
4958
6713
  init_react_import();
4959
- import { useEffect as useEffect15, useState as useState16 } from "react";
6714
+ import { useEffect as useEffect20, useState as useState17 } from "react";
4960
6715
 
4961
6716
  // components/ComponentList/index.tsx
4962
6717
  init_react_import();
4963
6718
 
4964
6719
  // css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
4965
6720
  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" };
6721
+ 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
6722
 
4968
6723
  // 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);
6724
+ import { useEffect as useEffect19 } from "react";
6725
+ import { jsx as jsx30, jsxs as jsxs13 } from "react/jsx-runtime";
6726
+ var getClassName21 = get_class_name_factory_default("ComponentList", styles_module_default15);
4972
6727
  var ComponentListItem = ({
4973
6728
  name,
4974
6729
  label
@@ -4980,14 +6735,14 @@ var ComponentListItem = ({
4980
6735
  type: name
4981
6736
  }).insert
4982
6737
  );
4983
- useEffect14(() => {
6738
+ useEffect19(() => {
4984
6739
  if (overrides.componentItem) {
4985
6740
  console.warn(
4986
6741
  "The `componentItem` override has been deprecated and renamed to `drawerItem`"
4987
6742
  );
4988
6743
  }
4989
6744
  }, [overrides]);
4990
- return /* @__PURE__ */ jsx28(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
6745
+ return /* @__PURE__ */ jsx30(Drawer.Item, { label, name, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
4991
6746
  };
4992
6747
  var ComponentList = ({
4993
6748
  children,
@@ -4998,12 +6753,12 @@ var ComponentList = ({
4998
6753
  const setUi = useAppStore((s) => s.setUi);
4999
6754
  const componentList = useAppStore((s) => s.state.ui.componentList);
5000
6755
  const { expanded = true } = componentList[id] || {};
5001
- return /* @__PURE__ */ jsxs13("div", { className: getClassName20({ isExpanded: expanded }), children: [
6756
+ return /* @__PURE__ */ jsxs13("div", { className: getClassName21({ isExpanded: expanded }), children: [
5002
6757
  title && /* @__PURE__ */ jsxs13(
5003
6758
  "button",
5004
6759
  {
5005
6760
  type: "button",
5006
- className: getClassName20("title"),
6761
+ className: getClassName21("title"),
5007
6762
  onClick: () => setUi({
5008
6763
  componentList: __spreadProps(__spreadValues({}, componentList), {
5009
6764
  [id]: __spreadProps(__spreadValues({}, componentList[id]), {
@@ -5013,14 +6768,14 @@ var ComponentList = ({
5013
6768
  }),
5014
6769
  title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
5015
6770
  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 }) })
6771
+ /* @__PURE__ */ jsx30("div", { children: title }),
6772
+ /* @__PURE__ */ jsx30("div", { className: getClassName21("titleIcon"), children: expanded ? /* @__PURE__ */ jsx30(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx30(ChevronDown, { size: 12 }) })
5018
6773
  ]
5019
6774
  }
5020
6775
  ),
5021
- /* @__PURE__ */ jsx28("div", { className: getClassName20("content"), children: /* @__PURE__ */ jsx28(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
6776
+ /* @__PURE__ */ jsx30("div", { className: getClassName21("content"), children: /* @__PURE__ */ jsx30(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
5022
6777
  var _a;
5023
- return /* @__PURE__ */ jsx28(
6778
+ return /* @__PURE__ */ jsx30(
5024
6779
  ComponentListItem,
5025
6780
  {
5026
6781
  label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
@@ -5034,12 +6789,12 @@ var ComponentList = ({
5034
6789
  ComponentList.Item = ComponentListItem;
5035
6790
 
5036
6791
  // lib/use-component-list.tsx
5037
- import { jsx as jsx29 } from "react/jsx-runtime";
6792
+ import { jsx as jsx31 } from "react/jsx-runtime";
5038
6793
  var useComponentList = () => {
5039
- const [componentList, setComponentList] = useState16();
6794
+ const [componentList, setComponentList] = useState17();
5040
6795
  const config = useAppStore((s) => s.config);
5041
6796
  const uiComponentList = useAppStore((s) => s.state.ui.componentList);
5042
- useEffect15(() => {
6797
+ useEffect20(() => {
5043
6798
  var _a, _b, _c;
5044
6799
  if (Object.keys(uiComponentList).length > 0) {
5045
6800
  const matchedComponents = [];
@@ -5049,7 +6804,7 @@ var useComponentList = () => {
5049
6804
  if (category.visible === false || !category.components) {
5050
6805
  return null;
5051
6806
  }
5052
- return /* @__PURE__ */ jsx29(
6807
+ return /* @__PURE__ */ jsx31(
5053
6808
  ComponentList,
5054
6809
  {
5055
6810
  id: categoryKey,
@@ -5058,7 +6813,7 @@ var useComponentList = () => {
5058
6813
  var _a2;
5059
6814
  matchedComponents.push(componentName);
5060
6815
  const componentConf = config.components[componentName] || {};
5061
- return /* @__PURE__ */ jsx29(
6816
+ return /* @__PURE__ */ jsx31(
5062
6817
  ComponentList.Item,
5063
6818
  {
5064
6819
  label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
@@ -5078,7 +6833,7 @@ var useComponentList = () => {
5078
6833
  );
5079
6834
  if (remainingComponents.length > 0 && !((_a = uiComponentList.other) == null ? void 0 : _a.components) && ((_b = uiComponentList.other) == null ? void 0 : _b.visible) !== false) {
5080
6835
  _componentList.push(
5081
- /* @__PURE__ */ jsx29(
6836
+ /* @__PURE__ */ jsx31(
5082
6837
  ComponentList,
5083
6838
  {
5084
6839
  id: "other",
@@ -5086,7 +6841,7 @@ var useComponentList = () => {
5086
6841
  children: remainingComponents.map((componentName, i) => {
5087
6842
  var _a2;
5088
6843
  const componentConf = config.components[componentName] || {};
5089
- return /* @__PURE__ */ jsx29(
6844
+ return /* @__PURE__ */ jsx31(
5090
6845
  ComponentList.Item,
5091
6846
  {
5092
6847
  name: componentName,
@@ -5109,7 +6864,14 @@ var useComponentList = () => {
5109
6864
 
5110
6865
  // components/Puck/components/Components/index.tsx
5111
6866
  import { useMemo as useMemo11 } from "react";
5112
- import { jsx as jsx30 } from "react/jsx-runtime";
6867
+
6868
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Components/styles.module.css#css-module
6869
+ init_react_import();
6870
+ var styles_module_default16 = { "Components": "_Components_uwdh8_1" };
6871
+
6872
+ // components/Puck/components/Components/index.tsx
6873
+ import { jsx as jsx32 } from "react/jsx-runtime";
6874
+ var getClassName22 = get_class_name_factory_default("Components", styles_module_default16);
5113
6875
  var Components = () => {
5114
6876
  const overrides = useAppStore((s) => s.overrides);
5115
6877
  const componentList = useComponentList();
@@ -5121,24 +6883,24 @@ var Components = () => {
5121
6883
  }
5122
6884
  return overrides.components || overrides.drawer || "div";
5123
6885
  }, [overrides]);
5124
- return /* @__PURE__ */ jsx30(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx30(ComponentList, { id: "all" }) });
6886
+ return /* @__PURE__ */ jsx32("div", { className: getClassName22(), children: /* @__PURE__ */ jsx32(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ jsx32(ComponentList, { id: "all" }) }) });
5125
6887
  };
5126
6888
 
5127
6889
  // components/Puck/components/Preview/index.tsx
5128
6890
  init_react_import();
5129
- import { useCallback as useCallback13, useEffect as useEffect17, useRef as useRef6, useMemo as useMemo12 } from "react";
6891
+ import { useCallback as useCallback14, useEffect as useEffect22, useRef as useRef7, useMemo as useMemo12 } from "react";
5130
6892
 
5131
6893
  // components/AutoFrame/index.tsx
5132
6894
  init_react_import();
5133
6895
  import {
5134
- createContext as createContext4,
5135
- useContext as useContext8,
5136
- useEffect as useEffect16,
5137
- useState as useState17
6896
+ createContext as createContext5,
6897
+ useContext as useContext9,
6898
+ useEffect as useEffect21,
6899
+ useState as useState18
5138
6900
  } from "react";
5139
6901
  import hash from "object-hash";
5140
6902
  import { createPortal as createPortal3 } from "react-dom";
5141
- import { Fragment as Fragment10, jsx as jsx31 } from "react/jsx-runtime";
6903
+ import { Fragment as Fragment10, jsx as jsx33 } from "react/jsx-runtime";
5142
6904
  var styleSelector = 'style, link[rel="stylesheet"]';
5143
6905
  var collectStyles = (doc) => {
5144
6906
  const collected = [];
@@ -5188,7 +6950,7 @@ var CopyHostStyles = ({
5188
6950
  onStylesLoaded = () => null
5189
6951
  }) => {
5190
6952
  const { document: doc, window: win } = useFrame();
5191
- useEffect16(() => {
6953
+ useEffect21(() => {
5192
6954
  if (!win || !doc) {
5193
6955
  return () => {
5194
6956
  };
@@ -5345,10 +7107,10 @@ var CopyHostStyles = ({
5345
7107
  observer.disconnect();
5346
7108
  };
5347
7109
  }, []);
5348
- return /* @__PURE__ */ jsx31(Fragment10, { children });
7110
+ return /* @__PURE__ */ jsx33(Fragment10, { children });
5349
7111
  };
5350
- var autoFrameContext = createContext4({});
5351
- var useFrame = () => useContext8(autoFrameContext);
7112
+ var autoFrameContext = createContext5({});
7113
+ var useFrame = () => useContext9(autoFrameContext);
5352
7114
  function AutoFrame(_a) {
5353
7115
  var _b = _a, {
5354
7116
  children,
@@ -5369,11 +7131,11 @@ function AutoFrame(_a) {
5369
7131
  "onNotReady",
5370
7132
  "frameRef"
5371
7133
  ]);
5372
- const [loaded, setLoaded] = useState17(false);
5373
- const [ctx, setCtx] = useState17({});
5374
- const [mountTarget, setMountTarget] = useState17();
5375
- const [stylesLoaded, setStylesLoaded] = useState17(false);
5376
- useEffect16(() => {
7134
+ const [loaded, setLoaded] = useState18(false);
7135
+ const [ctx, setCtx] = useState18({});
7136
+ const [mountTarget, setMountTarget] = useState18();
7137
+ const [stylesLoaded, setStylesLoaded] = useState18(false);
7138
+ useEffect21(() => {
5377
7139
  var _a2;
5378
7140
  if (frameRef.current) {
5379
7141
  const doc = frameRef.current.contentDocument;
@@ -5392,7 +7154,7 @@ function AutoFrame(_a) {
5392
7154
  }
5393
7155
  }
5394
7156
  }, [frameRef, loaded, stylesLoaded]);
5395
- return /* @__PURE__ */ jsx31(
7157
+ return /* @__PURE__ */ jsx33(
5396
7158
  "iframe",
5397
7159
  __spreadProps(__spreadValues({}, props), {
5398
7160
  className,
@@ -5402,7 +7164,7 @@ function AutoFrame(_a) {
5402
7164
  onLoad: () => {
5403
7165
  setLoaded(true);
5404
7166
  },
5405
- children: /* @__PURE__ */ jsx31(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx31(
7167
+ children: /* @__PURE__ */ jsx33(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx33(
5406
7168
  CopyHostStyles,
5407
7169
  {
5408
7170
  debug,
@@ -5418,14 +7180,14 @@ var AutoFrame_default = AutoFrame;
5418
7180
 
5419
7181
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
5420
7182
  init_react_import();
5421
- var styles_module_default15 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
7183
+ var styles_module_default17 = { "PuckPreview": "_PuckPreview_z2rgu_1", "PuckPreview-frame": "_PuckPreview-frame_z2rgu_6" };
5422
7184
 
5423
7185
  // components/Puck/components/Preview/index.tsx
5424
- import { Fragment as Fragment11, jsx as jsx32 } from "react/jsx-runtime";
5425
- var getClassName21 = get_class_name_factory_default("PuckPreview", styles_module_default15);
7186
+ import { Fragment as Fragment11, jsx as jsx34 } from "react/jsx-runtime";
7187
+ var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default17);
5426
7188
  var useBubbleIframeEvents = (ref) => {
5427
7189
  const status = useAppStore((s) => s.status);
5428
- useEffect17(() => {
7190
+ useEffect22(() => {
5429
7191
  if (ref.current && status === "READY") {
5430
7192
  const iframe = ref.current;
5431
7193
  const handlePointerMove = (event) => {
@@ -5474,7 +7236,7 @@ var Preview2 = ({ id = "puck-preview" }) => {
5474
7236
  const renderData = useAppStore(
5475
7237
  (s) => s.state.ui.previewMode === "edit" ? null : s.state.data
5476
7238
  );
5477
- const Page = useCallback13(
7239
+ const Page = useCallback14(
5478
7240
  (pageProps) => {
5479
7241
  var _a, _b;
5480
7242
  const propsWithSlots = useSlots(
@@ -5484,15 +7246,15 @@ var Preview2 = ({ id = "puck-preview" }) => {
5484
7246
  );
5485
7247
  return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
5486
7248
  id: "puck-root"
5487
- }, propsWithSlots)) : /* @__PURE__ */ jsx32(Fragment11, { children: propsWithSlots.children });
7249
+ }, propsWithSlots)) : /* @__PURE__ */ jsx34(Fragment11, { children: propsWithSlots.children });
5488
7250
  },
5489
7251
  [config]
5490
7252
  );
5491
7253
  const Frame = useMemo12(() => overrides.iframe, [overrides]);
5492
7254
  const rootProps = root.props || root;
5493
- const ref = useRef6(null);
7255
+ const ref = useRef7(null);
5494
7256
  useBubbleIframeEvents(ref);
5495
- const inner = !renderData ? /* @__PURE__ */ jsx32(
7257
+ const inner = !renderData ? /* @__PURE__ */ jsx34(
5496
7258
  Page,
5497
7259
  __spreadProps(__spreadValues({}, rootProps), {
5498
7260
  puck: {
@@ -5502,18 +7264,18 @@ var Preview2 = ({ id = "puck-preview" }) => {
5502
7264
  metadata
5503
7265
  },
5504
7266
  editMode: true,
5505
- children: /* @__PURE__ */ jsx32(DropZonePure, { zone: rootDroppableId })
7267
+ children: /* @__PURE__ */ jsx34(DropZonePure, { zone: rootDroppableId })
5506
7268
  })
5507
- ) : /* @__PURE__ */ jsx32(Render, { data: renderData, config, metadata });
5508
- useEffect17(() => {
7269
+ ) : /* @__PURE__ */ jsx34(Render, { data: renderData, config, metadata });
7270
+ useEffect22(() => {
5509
7271
  if (!iframe.enabled) {
5510
7272
  setStatus("READY");
5511
7273
  }
5512
7274
  }, [iframe.enabled]);
5513
- return /* @__PURE__ */ jsx32(
7275
+ return /* @__PURE__ */ jsx34(
5514
7276
  "div",
5515
7277
  {
5516
- className: getClassName21(),
7278
+ className: getClassName23(),
5517
7279
  id,
5518
7280
  "data-puck-preview": true,
5519
7281
  onClick: (e) => {
@@ -5522,11 +7284,11 @@ var Preview2 = ({ id = "puck-preview" }) => {
5522
7284
  dispatch({ type: "setUi", ui: { itemSelector: null } });
5523
7285
  }
5524
7286
  },
5525
- children: iframe.enabled ? /* @__PURE__ */ jsx32(
7287
+ children: iframe.enabled ? /* @__PURE__ */ jsx34(
5526
7288
  AutoFrame_default,
5527
7289
  {
5528
7290
  id: "preview-frame",
5529
- className: getClassName21("frame"),
7291
+ className: getClassName23("frame"),
5530
7292
  "data-rfd-iframe": true,
5531
7293
  onReady: () => {
5532
7294
  setStatus("READY");
@@ -5535,18 +7297,18 @@ var Preview2 = ({ id = "puck-preview" }) => {
5535
7297
  setStatus("MOUNTED");
5536
7298
  },
5537
7299
  frameRef: ref,
5538
- children: /* @__PURE__ */ jsx32(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
7300
+ children: /* @__PURE__ */ jsx34(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
5539
7301
  if (Frame) {
5540
- return /* @__PURE__ */ jsx32(Frame, { document: document2, children: inner });
7302
+ return /* @__PURE__ */ jsx34(Frame, { document: document2, children: inner });
5541
7303
  }
5542
7304
  return inner;
5543
7305
  } })
5544
7306
  }
5545
- ) : /* @__PURE__ */ jsx32(
7307
+ ) : /* @__PURE__ */ jsx34(
5546
7308
  "div",
5547
7309
  {
5548
7310
  id: "preview-frame",
5549
- className: getClassName21("frame"),
7311
+ className: getClassName23("frame"),
5550
7312
  ref,
5551
7313
  "data-puck-entry": true,
5552
7314
  children: inner
@@ -5564,7 +7326,7 @@ init_react_import();
5564
7326
 
5565
7327
  // css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
5566
7328
  init_react_import();
5567
- var styles_module_default16 = { "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" };
7329
+ 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" };
5568
7330
 
5569
7331
  // lib/scroll-into-view.ts
5570
7332
  init_react_import();
@@ -5578,7 +7340,7 @@ var scrollIntoView = (el) => {
5578
7340
  };
5579
7341
 
5580
7342
  // components/LayerTree/index.tsx
5581
- import { useCallback as useCallback14, useContext as useContext9 } from "react";
7343
+ import { useCallback as useCallback15, useContext as useContext10 } from "react";
5582
7344
 
5583
7345
  // lib/on-scroll-end.ts
5584
7346
  init_react_import();
@@ -5601,9 +7363,9 @@ var onScrollEnd = (frame, cb) => {
5601
7363
 
5602
7364
  // components/LayerTree/index.tsx
5603
7365
  import { useShallow as useShallow7 } from "zustand/react/shallow";
5604
- import { Fragment as Fragment12, jsx as jsx33, jsxs as jsxs14 } from "react/jsx-runtime";
5605
- var getClassName22 = get_class_name_factory_default("LayerTree", styles_module_default16);
5606
- var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default16);
7366
+ import { Fragment as Fragment12, jsx as jsx35, jsxs as jsxs14 } from "react/jsx-runtime";
7367
+ var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default18);
7368
+ var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default18);
5607
7369
  var Layer = ({
5608
7370
  index,
5609
7371
  itemId,
@@ -5613,7 +7375,7 @@ var Layer = ({
5613
7375
  const config = useAppStore((s) => s.config);
5614
7376
  const itemSelector = useAppStore((s) => s.state.ui.itemSelector);
5615
7377
  const dispatch = useAppStore((s) => s.dispatch);
5616
- const setItemSelector = useCallback14(
7378
+ const setItemSelector = useCallback15(
5617
7379
  (itemSelector2) => {
5618
7380
  dispatch({ type: "setUi", ui: { itemSelector: itemSelector2 } });
5619
7381
  },
@@ -5633,7 +7395,7 @@ var Layer = ({
5633
7395
  )
5634
7396
  );
5635
7397
  const containsZone = zonesForItem.length > 0;
5636
- const zoneStore = useContext9(ZoneStoreContext);
7398
+ const zoneStore = useContext10(ZoneStoreContext);
5637
7399
  const isHovering = useContextStore(
5638
7400
  ZoneStoreContext,
5639
7401
  (s) => s.hoveringComponent === itemId
@@ -5658,7 +7420,7 @@ var Layer = ({
5658
7420
  childIsSelected
5659
7421
  }),
5660
7422
  children: [
5661
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs14(
7423
+ /* @__PURE__ */ jsx35("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs14(
5662
7424
  "button",
5663
7425
  {
5664
7426
  type: "button",
@@ -5696,22 +7458,22 @@ var Layer = ({
5696
7458
  zoneStore.setState({ hoveringComponent: null });
5697
7459
  },
5698
7460
  children: [
5699
- containsZone && /* @__PURE__ */ jsx33(
7461
+ containsZone && /* @__PURE__ */ jsx35(
5700
7462
  "div",
5701
7463
  {
5702
7464
  className: getClassNameLayer("chevron"),
5703
7465
  title: isSelected ? "Collapse" : "Expand",
5704
- children: /* @__PURE__ */ jsx33(ChevronDown, { size: "12" })
7466
+ children: /* @__PURE__ */ jsx35(ChevronDown, { size: "12" })
5705
7467
  }
5706
7468
  ),
5707
7469
  /* @__PURE__ */ jsxs14("div", { className: getClassNameLayer("title"), children: [
5708
- /* @__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" }) }),
5709
- /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("name"), children: label })
7470
+ /* @__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" }) }),
7471
+ /* @__PURE__ */ jsx35("div", { className: getClassNameLayer("name"), children: label })
5710
7472
  ] })
5711
7473
  ]
5712
7474
  }
5713
7475
  ) }),
5714
- containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ jsx33("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx33(LayerTree, { zoneCompound: subzone }) }, subzone))
7476
+ containsZone && zonesForItem.map((subzone) => /* @__PURE__ */ jsx35("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ jsx35(LayerTree, { zoneCompound: subzone }) }, subzone))
5715
7477
  ]
5716
7478
  }
5717
7479
  );
@@ -5738,14 +7500,14 @@ var LayerTree = ({
5738
7500
  )
5739
7501
  );
5740
7502
  return /* @__PURE__ */ jsxs14(Fragment12, { children: [
5741
- label && /* @__PURE__ */ jsxs14("div", { className: getClassName22("zoneTitle"), children: [
5742
- /* @__PURE__ */ jsx33("div", { className: getClassName22("zoneIcon"), children: /* @__PURE__ */ jsx33(Layers, { size: "16" }) }),
7503
+ label && /* @__PURE__ */ jsxs14("div", { className: getClassName24("zoneTitle"), children: [
7504
+ /* @__PURE__ */ jsx35("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ jsx35(Layers, { size: "16" }) }),
5743
7505
  label
5744
7506
  ] }),
5745
- /* @__PURE__ */ jsxs14("ul", { className: getClassName22(), children: [
5746
- contentIds.length === 0 && /* @__PURE__ */ jsx33("div", { className: getClassName22("helper"), children: "No items" }),
7507
+ /* @__PURE__ */ jsxs14("ul", { className: getClassName24(), children: [
7508
+ contentIds.length === 0 && /* @__PURE__ */ jsx35("div", { className: getClassName24("helper"), children: "No items" }),
5747
7509
  contentIds.map((itemId, i) => {
5748
- return /* @__PURE__ */ jsx33(
7510
+ return /* @__PURE__ */ jsx35(
5749
7511
  Layer,
5750
7512
  {
5751
7513
  index: i,
@@ -5772,21 +7534,28 @@ var findZonesForArea = (state, area) => {
5772
7534
 
5773
7535
  // components/Puck/components/Outline/index.tsx
5774
7536
  import { useShallow as useShallow8 } from "zustand/react/shallow";
5775
- import { jsx as jsx34 } from "react/jsx-runtime";
7537
+
7538
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Outline/styles.module.css#css-module
7539
+ init_react_import();
7540
+ var styles_module_default19 = { "Outline": "_Outline_1rrni_1" };
7541
+
7542
+ // components/Puck/components/Outline/index.tsx
7543
+ import { jsx as jsx36 } from "react/jsx-runtime";
7544
+ var getClassName25 = get_class_name_factory_default("Outline", styles_module_default19);
5776
7545
  var Outline = () => {
5777
7546
  const outlineOverride = useAppStore((s) => s.overrides.outline);
5778
7547
  const rootZones = useAppStore(
5779
7548
  useShallow8((s) => findZonesForArea(s.state, "root"))
5780
7549
  );
5781
7550
  const Wrapper = useMemo13(() => outlineOverride || "div", [outlineOverride]);
5782
- return /* @__PURE__ */ jsx34(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ jsx34(
7551
+ return /* @__PURE__ */ jsx36("div", { className: getClassName25(), children: /* @__PURE__ */ jsx36(Wrapper, { children: rootZones.map((zoneCompound) => /* @__PURE__ */ jsx36(
5783
7552
  LayerTree,
5784
7553
  {
5785
7554
  label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
5786
7555
  zoneCompound
5787
7556
  },
5788
7557
  zoneCompound
5789
- )) });
7558
+ )) }) });
5790
7559
  };
5791
7560
 
5792
7561
  // lib/use-loaded-overrides.ts
@@ -5840,8 +7609,8 @@ var useLoadedOverrides = ({
5840
7609
 
5841
7610
  // lib/use-puck.ts
5842
7611
  init_react_import();
5843
- import { createContext as createContext5, useContext as useContext10, useEffect as useEffect18, useState as useState18 } from "react";
5844
- import { createStore as createStore4, useStore as useStore2 } from "zustand";
7612
+ import { createContext as createContext6, useContext as useContext11, useEffect as useEffect23, useState as useState19 } from "react";
7613
+ import { createStore as createStore4, useStore as useStore3 } from "zustand";
5845
7614
  var generateUsePuck = (store) => {
5846
7615
  const history = {
5847
7616
  back: store.history.back,
@@ -5863,17 +7632,11 @@ var generateUsePuck = (store) => {
5863
7632
  selectedItem: store.selectedItem || null,
5864
7633
  getItemBySelector: (selector) => getItem(selector, store.state),
5865
7634
  getItemById: (id) => store.state.indexes.nodes[id].data,
5866
- getSelectorForId: (id) => {
5867
- const node = store.state.indexes.nodes[id];
5868
- if (!node) return;
5869
- const zoneCompound = `${node.parentId}:${node.zone}`;
5870
- const index = store.state.indexes.zones[zoneCompound].contentIds.indexOf(id);
5871
- return { zone: zoneCompound, index };
5872
- }
7635
+ getSelectorForId: (id) => getSelectorForId(store.state, id)
5873
7636
  };
5874
7637
  return storeData;
5875
7638
  };
5876
- var UsePuckStoreContext = createContext5(
7639
+ var UsePuckStoreContext = createContext6(
5877
7640
  null
5878
7641
  );
5879
7642
  var convertToPickedStore = (store) => {
@@ -5887,12 +7650,12 @@ var convertToPickedStore = (store) => {
5887
7650
  };
5888
7651
  };
5889
7652
  var useRegisterUsePuckStore = (appStore) => {
5890
- const [usePuckStore] = useState18(
7653
+ const [usePuckStore] = useState19(
5891
7654
  () => createStore4(
5892
7655
  () => generateUsePuck(convertToPickedStore(appStore.getState()))
5893
7656
  )
5894
7657
  );
5895
- useEffect18(() => {
7658
+ useEffect23(() => {
5896
7659
  return appStore.subscribe(
5897
7660
  (store) => convertToPickedStore(store),
5898
7661
  (pickedStore) => {
@@ -5904,11 +7667,11 @@ var useRegisterUsePuckStore = (appStore) => {
5904
7667
  };
5905
7668
  function createUsePuck() {
5906
7669
  return function usePuck2(selector) {
5907
- const usePuckApi = useContext10(UsePuckStoreContext);
7670
+ const usePuckApi = useContext11(UsePuckStoreContext);
5908
7671
  if (!usePuckApi) {
5909
7672
  throw new Error("usePuck must be used inside <Puck>.");
5910
7673
  }
5911
- const result = useStore2(
7674
+ const result = useStore3(
5912
7675
  usePuckApi,
5913
7676
  selector != null ? selector : (s) => s
5914
7677
  );
@@ -5916,7 +7679,7 @@ function createUsePuck() {
5916
7679
  };
5917
7680
  }
5918
7681
  function usePuck() {
5919
- useEffect18(() => {
7682
+ useEffect23(() => {
5920
7683
  console.warn(
5921
7684
  "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."
5922
7685
  );
@@ -5924,7 +7687,7 @@ function usePuck() {
5924
7687
  return createUsePuck()((s) => s);
5925
7688
  }
5926
7689
  function useGetPuck() {
5927
- const usePuckApi = useContext10(UsePuckStoreContext);
7690
+ const usePuckApi = useContext11(UsePuckStoreContext);
5928
7691
  if (!usePuckApi) {
5929
7692
  throw new Error("usePuckGet must be used inside <Puck>.");
5930
7693
  }
@@ -5932,26 +7695,26 @@ function useGetPuck() {
5932
7695
  }
5933
7696
 
5934
7697
  // components/Puck/index.tsx
5935
- import fdeq from "fast-deep-equal";
7698
+ import fdeq2 from "fast-deep-equal";
5936
7699
 
5937
7700
  // components/Puck/components/Layout/index.tsx
5938
7701
  init_react_import();
5939
- import { useEffect as useEffect24, useMemo as useMemo20, useState as useState24 } from "react";
7702
+ import { useEffect as useEffect29, useMemo as useMemo20, useState as useState25 } from "react";
5940
7703
 
5941
7704
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Layout/styles.module.css#css-module
5942
7705
  init_react_import();
5943
- var styles_module_default17 = { "Puck": "_Puck_1rc26_19", "Puck-portal": "_Puck-portal_1rc26_31", "PuckLayout-inner": "_PuckLayout-inner_1rc26_36", "PuckLayout--mounted": "_PuckLayout--mounted_1rc26_48", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_1rc26_61", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_1rc26_69", "PuckLayout-mounted": "_PuckLayout-mounted_1rc26_85", "PuckLayout": "_PuckLayout_1rc26_36", "PuckLayout-nav": "_PuckLayout-nav_1rc26_126", "PuckPluginTab": "_PuckPluginTab_1rc26_131", "PuckPluginTab--visible": "_PuckPluginTab--visible_1rc26_135" };
7706
+ var styles_module_default20 = { "Puck": "_Puck_94wda_19", "Puck-portal": "_Puck-portal_94wda_31", "PuckLayout-inner": "_PuckLayout-inner_94wda_36", "PuckLayout--mounted": "_PuckLayout--mounted_94wda_57", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_94wda_61", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_94wda_69", "PuckLayout-mounted": "_PuckLayout-mounted_94wda_85", "PuckLayout": "_PuckLayout_94wda_36", "PuckLayout-nav": "_PuckLayout-nav_94wda_126", "PuckPluginTab": "_PuckPluginTab_94wda_131", "PuckPluginTab--visible": "_PuckPluginTab--visible_94wda_136" };
5944
7707
 
5945
7708
  // lib/use-inject-css.ts
5946
7709
  init_react_import();
5947
- import { useEffect as useEffect19, useState as useState19 } from "react";
7710
+ import { useEffect as useEffect24, useState as useState20 } from "react";
5948
7711
  var styles = ``;
5949
7712
  var useInjectStyleSheet = (initialStyles, iframeEnabled) => {
5950
- const [el, setEl] = useState19();
5951
- useEffect19(() => {
7713
+ const [el, setEl] = useState20();
7714
+ useEffect24(() => {
5952
7715
  setEl(document.createElement("style"));
5953
7716
  }, []);
5954
- useEffect19(() => {
7717
+ useEffect24(() => {
5955
7718
  var _a;
5956
7719
  if (!el || typeof window === "undefined") {
5957
7720
  return;
@@ -5971,15 +7734,15 @@ var useInjectGlobalCss = (iframeEnabled) => {
5971
7734
 
5972
7735
  // components/DefaultOverride/index.tsx
5973
7736
  init_react_import();
5974
- import { Fragment as Fragment13, jsx as jsx35 } from "react/jsx-runtime";
5975
- var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx35(Fragment13, { children });
7737
+ import { Fragment as Fragment13, jsx as jsx37 } from "react/jsx-runtime";
7738
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx37(Fragment13, { children });
5976
7739
 
5977
7740
  // lib/use-preview-mode-hotkeys.ts
5978
7741
  init_react_import();
5979
- import { useCallback as useCallback15 } from "react";
7742
+ import { useCallback as useCallback16 } from "react";
5980
7743
  var usePreviewModeHotkeys = () => {
5981
7744
  const appStore = useAppStoreApi();
5982
- const toggleInteractive = useCallback15(() => {
7745
+ const toggleInteractive = useCallback16(() => {
5983
7746
  const dispatch = appStore.getState().dispatch;
5984
7747
  dispatch({
5985
7748
  type: "setUi",
@@ -5994,18 +7757,18 @@ var usePreviewModeHotkeys = () => {
5994
7757
 
5995
7758
  // components/Puck/components/Header/index.tsx
5996
7759
  init_react_import();
5997
- import { memo as memo5, useCallback as useCallback16, useMemo as useMemo15, useState as useState20 } from "react";
7760
+ import { memo as memo6, useCallback as useCallback17, useMemo as useMemo15, useState as useState21 } from "react";
5998
7761
 
5999
7762
  // components/MenuBar/index.tsx
6000
7763
  init_react_import();
6001
7764
 
6002
7765
  // css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
6003
7766
  init_react_import();
6004
- var styles_module_default18 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
7767
+ 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" };
6005
7768
 
6006
7769
  // components/MenuBar/index.tsx
6007
- import { Fragment as Fragment14, jsx as jsx36, jsxs as jsxs15 } from "react/jsx-runtime";
6008
- var getClassName23 = get_class_name_factory_default("MenuBar", styles_module_default18);
7770
+ import { Fragment as Fragment14, jsx as jsx38, jsxs as jsxs15 } from "react/jsx-runtime";
7771
+ var getClassName26 = get_class_name_factory_default("MenuBar", styles_module_default21);
6009
7772
  function MenuBar({
6010
7773
  menuOpen = false,
6011
7774
  renderHeaderActions,
@@ -6015,10 +7778,10 @@ function MenuBar({
6015
7778
  const forward = useAppStore((s) => s.history.forward);
6016
7779
  const hasFuture = useAppStore((s) => s.history.hasFuture());
6017
7780
  const hasPast = useAppStore((s) => s.history.hasPast());
6018
- return /* @__PURE__ */ jsx36(
7781
+ return /* @__PURE__ */ jsx38(
6019
7782
  "div",
6020
7783
  {
6021
- className: getClassName23({ menuOpen }),
7784
+ className: getClassName26({ menuOpen }),
6022
7785
  onClick: (event) => {
6023
7786
  var _a;
6024
7787
  const element = event.target;
@@ -6029,30 +7792,30 @@ function MenuBar({
6029
7792
  setMenuOpen(false);
6030
7793
  }
6031
7794
  },
6032
- children: /* @__PURE__ */ jsxs15("div", { className: getClassName23("inner"), children: [
6033
- /* @__PURE__ */ jsxs15("div", { className: getClassName23("history"), children: [
6034
- /* @__PURE__ */ jsx36(
7795
+ children: /* @__PURE__ */ jsxs15("div", { className: getClassName26("inner"), children: [
7796
+ /* @__PURE__ */ jsxs15("div", { className: getClassName26("history"), children: [
7797
+ /* @__PURE__ */ jsx38(
6035
7798
  IconButton,
6036
7799
  {
6037
7800
  type: "button",
6038
7801
  title: "undo",
6039
7802
  disabled: !hasPast,
6040
7803
  onClick: back,
6041
- children: /* @__PURE__ */ jsx36(Undo2, { size: 21 })
7804
+ children: /* @__PURE__ */ jsx38(Undo2, { size: 21 })
6042
7805
  }
6043
7806
  ),
6044
- /* @__PURE__ */ jsx36(
7807
+ /* @__PURE__ */ jsx38(
6045
7808
  IconButton,
6046
7809
  {
6047
7810
  type: "button",
6048
7811
  title: "redo",
6049
7812
  disabled: !hasFuture,
6050
7813
  onClick: forward,
6051
- children: /* @__PURE__ */ jsx36(Redo2, { size: 21 })
7814
+ children: /* @__PURE__ */ jsx38(Redo2, { size: 21 })
6052
7815
  }
6053
7816
  )
6054
7817
  ] }),
6055
- /* @__PURE__ */ jsx36(Fragment14, { children: renderHeaderActions && renderHeaderActions() })
7818
+ /* @__PURE__ */ jsx38(Fragment14, { children: renderHeaderActions && renderHeaderActions() })
6056
7819
  ] })
6057
7820
  }
6058
7821
  );
@@ -6060,11 +7823,11 @@ function MenuBar({
6060
7823
 
6061
7824
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Header/styles.module.css#css-module
6062
7825
  init_react_import();
6063
- var styles_module_default19 = { "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" };
7826
+ 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" };
6064
7827
 
6065
7828
  // components/Puck/components/Header/index.tsx
6066
- import { Fragment as Fragment15, jsx as jsx37, jsxs as jsxs16 } from "react/jsx-runtime";
6067
- var getClassName24 = get_class_name_factory_default("PuckHeader", styles_module_default19);
7829
+ import { Fragment as Fragment15, jsx as jsx39, jsxs as jsxs16 } from "react/jsx-runtime";
7830
+ var getClassName27 = get_class_name_factory_default("PuckHeader", styles_module_default22);
6068
7831
  var HeaderInner = () => {
6069
7832
  const {
6070
7833
  onPublish,
@@ -6085,7 +7848,7 @@ var HeaderInner = () => {
6085
7848
  var _b = _a, { actions } = _b, props = __objRest(_b, ["actions"]);
6086
7849
  const Comp = renderHeader;
6087
7850
  const appState = useAppStore((s) => s.state);
6088
- return /* @__PURE__ */ jsx37(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
7851
+ return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
6089
7852
  };
6090
7853
  return RenderHeader;
6091
7854
  }
@@ -6099,19 +7862,19 @@ var HeaderInner = () => {
6099
7862
  const RenderHeader = (props) => {
6100
7863
  const Comp = renderHeaderActions;
6101
7864
  const appState = useAppStore((s) => s.state);
6102
- return /* @__PURE__ */ jsx37(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
7865
+ return /* @__PURE__ */ jsx39(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
6103
7866
  };
6104
7867
  return RenderHeader;
6105
7868
  }
6106
7869
  return DefaultOverride;
6107
- }, [renderHeader]);
7870
+ }, [renderHeaderActions]);
6108
7871
  const CustomHeader = useAppStore(
6109
7872
  (s) => s.overrides.header || defaultHeaderRender
6110
7873
  );
6111
7874
  const CustomHeaderActions = useAppStore(
6112
7875
  (s) => s.overrides.headerActions || defaultHeaderActionsRender
6113
7876
  );
6114
- const [menuOpen, setMenuOpen] = useState20(false);
7877
+ const [menuOpen, setMenuOpen] = useState21(false);
6115
7878
  const rootTitle = useAppStore((s) => {
6116
7879
  var _a, _b;
6117
7880
  const rootData = (_a = s.state.indexes.nodes["root"]) == null ? void 0 : _a.data;
@@ -6121,7 +7884,7 @@ var HeaderInner = () => {
6121
7884
  const rightSideBarVisible = useAppStore(
6122
7885
  (s) => s.state.ui.rightSideBarVisible
6123
7886
  );
6124
- const toggleSidebars = useCallback16(
7887
+ const toggleSidebars = useCallback17(
6125
7888
  (sidebar) => {
6126
7889
  const widerViewport = window.matchMedia("(min-width: 638px)").matches;
6127
7890
  const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
@@ -6135,27 +7898,27 @@ var HeaderInner = () => {
6135
7898
  },
6136
7899
  [dispatch, leftSideBarVisible, rightSideBarVisible]
6137
7900
  );
6138
- return /* @__PURE__ */ jsx37(
7901
+ return /* @__PURE__ */ jsx39(
6139
7902
  CustomHeader,
6140
7903
  {
6141
- actions: /* @__PURE__ */ jsx37(Fragment15, { children: /* @__PURE__ */ jsx37(CustomHeaderActions, { children: /* @__PURE__ */ jsx37(
7904
+ actions: /* @__PURE__ */ jsx39(Fragment15, { children: /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
6142
7905
  Button,
6143
7906
  {
6144
7907
  onClick: () => {
6145
7908
  const data = appStore.getState().state.data;
6146
7909
  onPublish && onPublish(data);
6147
7910
  },
6148
- icon: /* @__PURE__ */ jsx37(Globe, { size: "14px" }),
7911
+ icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
6149
7912
  children: "Publish"
6150
7913
  }
6151
7914
  ) }) }),
6152
- children: /* @__PURE__ */ jsx37(
7915
+ children: /* @__PURE__ */ jsx39(
6153
7916
  "header",
6154
7917
  {
6155
- className: getClassName24({ leftSideBarVisible, rightSideBarVisible }),
6156
- children: /* @__PURE__ */ jsxs16("div", { className: getClassName24("inner"), children: [
6157
- /* @__PURE__ */ jsxs16("div", { className: getClassName24("toggle"), children: [
6158
- /* @__PURE__ */ jsx37("div", { className: getClassName24("leftSideBarToggle"), children: /* @__PURE__ */ jsx37(
7918
+ className: getClassName27({ leftSideBarVisible, rightSideBarVisible }),
7919
+ children: /* @__PURE__ */ jsxs16("div", { className: getClassName27("inner"), children: [
7920
+ /* @__PURE__ */ jsxs16("div", { className: getClassName27("toggle"), children: [
7921
+ /* @__PURE__ */ jsx39("div", { className: getClassName27("leftSideBarToggle"), children: /* @__PURE__ */ jsx39(
6159
7922
  IconButton,
6160
7923
  {
6161
7924
  type: "button",
@@ -6163,10 +7926,10 @@ var HeaderInner = () => {
6163
7926
  toggleSidebars("left");
6164
7927
  },
6165
7928
  title: "Toggle left sidebar",
6166
- children: /* @__PURE__ */ jsx37(PanelLeft, { focusable: "false" })
7929
+ children: /* @__PURE__ */ jsx39(PanelLeft, { focusable: "false" })
6167
7930
  }
6168
7931
  ) }),
6169
- /* @__PURE__ */ jsx37("div", { className: getClassName24("rightSideBarToggle"), children: /* @__PURE__ */ jsx37(
7932
+ /* @__PURE__ */ jsx39("div", { className: getClassName27("rightSideBarToggle"), children: /* @__PURE__ */ jsx39(
6170
7933
  IconButton,
6171
7934
  {
6172
7935
  type: "button",
@@ -6174,19 +7937,19 @@ var HeaderInner = () => {
6174
7937
  toggleSidebars("right");
6175
7938
  },
6176
7939
  title: "Toggle right sidebar",
6177
- children: /* @__PURE__ */ jsx37(PanelRight, { focusable: "false" })
7940
+ children: /* @__PURE__ */ jsx39(PanelRight, { focusable: "false" })
6178
7941
  }
6179
7942
  ) })
6180
7943
  ] }),
6181
- /* @__PURE__ */ jsx37("div", { className: getClassName24("title"), children: /* @__PURE__ */ jsxs16(Heading, { rank: "2", size: "xs", children: [
7944
+ /* @__PURE__ */ jsx39("div", { className: getClassName27("title"), children: /* @__PURE__ */ jsxs16(Heading, { rank: "2", size: "xs", children: [
6182
7945
  headerTitle || rootTitle || "Page",
6183
7946
  headerPath && /* @__PURE__ */ jsxs16(Fragment15, { children: [
6184
7947
  " ",
6185
- /* @__PURE__ */ jsx37("code", { className: getClassName24("path"), children: headerPath })
7948
+ /* @__PURE__ */ jsx39("code", { className: getClassName27("path"), children: headerPath })
6186
7949
  ] })
6187
7950
  ] }) }),
6188
- /* @__PURE__ */ jsxs16("div", { className: getClassName24("tools"), children: [
6189
- /* @__PURE__ */ jsx37("div", { className: getClassName24("menuButton"), children: /* @__PURE__ */ jsx37(
7951
+ /* @__PURE__ */ jsxs16("div", { className: getClassName27("tools"), children: [
7952
+ /* @__PURE__ */ jsx39("div", { className: getClassName27("menuButton"), children: /* @__PURE__ */ jsx39(
6190
7953
  IconButton,
6191
7954
  {
6192
7955
  type: "button",
@@ -6194,23 +7957,23 @@ var HeaderInner = () => {
6194
7957
  return setMenuOpen(!menuOpen);
6195
7958
  },
6196
7959
  title: "Toggle menu bar",
6197
- children: menuOpen ? /* @__PURE__ */ jsx37(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx37(ChevronDown, { focusable: "false" })
7960
+ children: menuOpen ? /* @__PURE__ */ jsx39(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx39(ChevronDown, { focusable: "false" })
6198
7961
  }
6199
7962
  ) }),
6200
- /* @__PURE__ */ jsx37(
7963
+ /* @__PURE__ */ jsx39(
6201
7964
  MenuBar,
6202
7965
  {
6203
7966
  dispatch,
6204
7967
  onPublish,
6205
7968
  menuOpen,
6206
- renderHeaderActions: () => /* @__PURE__ */ jsx37(CustomHeaderActions, { children: /* @__PURE__ */ jsx37(
7969
+ renderHeaderActions: () => /* @__PURE__ */ jsx39(CustomHeaderActions, { children: /* @__PURE__ */ jsx39(
6207
7970
  Button,
6208
7971
  {
6209
7972
  onClick: () => {
6210
7973
  const data = appStore.getState().state.data;
6211
7974
  onPublish && onPublish(data);
6212
7975
  },
6213
- icon: /* @__PURE__ */ jsx37(Globe, { size: "14px" }),
7976
+ icon: /* @__PURE__ */ jsx39(Globe, { size: "14px" }),
6214
7977
  children: "Publish"
6215
7978
  }
6216
7979
  ) }),
@@ -6224,14 +7987,14 @@ var HeaderInner = () => {
6224
7987
  }
6225
7988
  );
6226
7989
  };
6227
- var Header = memo5(HeaderInner);
7990
+ var Header = memo6(HeaderInner);
6228
7991
 
6229
7992
  // components/SidebarSection/index.tsx
6230
7993
  init_react_import();
6231
7994
 
6232
7995
  // css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
6233
7996
  init_react_import();
6234
- var styles_module_default20 = { "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" };
7997
+ 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" };
6235
7998
 
6236
7999
  // lib/use-breadcrumbs.ts
6237
8000
  init_react_import();
@@ -6278,8 +8041,8 @@ var useBreadcrumbs = (renderCount) => {
6278
8041
  };
6279
8042
 
6280
8043
  // components/SidebarSection/index.tsx
6281
- import { jsx as jsx38, jsxs as jsxs17 } from "react/jsx-runtime";
6282
- var getClassName25 = get_class_name_factory_default("SidebarSection", styles_module_default20);
8044
+ import { jsx as jsx40, jsxs as jsxs17 } from "react/jsx-runtime";
8045
+ var getClassName28 = get_class_name_factory_default("SidebarSection", styles_module_default23);
6283
8046
  var SidebarSection = ({
6284
8047
  children,
6285
8048
  title,
@@ -6294,26 +8057,26 @@ var SidebarSection = ({
6294
8057
  return /* @__PURE__ */ jsxs17(
6295
8058
  "div",
6296
8059
  {
6297
- className: getClassName25({ noBorderTop, noPadding }),
8060
+ className: getClassName28({ noBorderTop, noPadding }),
6298
8061
  style: { background },
6299
8062
  children: [
6300
- /* @__PURE__ */ jsx38("div", { className: getClassName25("title"), children: /* @__PURE__ */ jsxs17("div", { className: getClassName25("breadcrumbs"), children: [
6301
- showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs17("div", { className: getClassName25("breadcrumb"), children: [
6302
- /* @__PURE__ */ jsx38(
8063
+ /* @__PURE__ */ jsx40("div", { className: getClassName28("title"), children: /* @__PURE__ */ jsxs17("div", { className: getClassName28("breadcrumbs"), children: [
8064
+ showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs17("div", { className: getClassName28("breadcrumb"), children: [
8065
+ /* @__PURE__ */ jsx40(
6303
8066
  "button",
6304
8067
  {
6305
8068
  type: "button",
6306
- className: getClassName25("breadcrumbLabel"),
8069
+ className: getClassName28("breadcrumbLabel"),
6307
8070
  onClick: () => setUi({ itemSelector: breadcrumb.selector }),
6308
8071
  children: breadcrumb.label
6309
8072
  }
6310
8073
  ),
6311
- /* @__PURE__ */ jsx38(ChevronRight, { size: 16 })
8074
+ /* @__PURE__ */ jsx40(ChevronRight, { size: 16 })
6312
8075
  ] }, i)) : null,
6313
- /* @__PURE__ */ jsx38("div", { className: getClassName25("heading"), children: /* @__PURE__ */ jsx38(Heading, { rank: "2", size: "xs", children: title }) })
8076
+ /* @__PURE__ */ jsx40("div", { className: getClassName28("heading"), children: /* @__PURE__ */ jsx40(Heading, { rank: "2", size: "xs", children: title }) })
6314
8077
  ] }) }),
6315
- /* @__PURE__ */ jsx38("div", { className: getClassName25("content"), children }),
6316
- isLoading && /* @__PURE__ */ jsx38("div", { className: getClassName25("loadingOverlay"), children: /* @__PURE__ */ jsx38(Loader, { size: 32 }) })
8078
+ /* @__PURE__ */ jsx40("div", { className: getClassName28("content"), children }),
8079
+ isLoading && /* @__PURE__ */ jsx40("div", { className: getClassName28("loadingOverlay"), children: /* @__PURE__ */ jsx40(Loader, { size: 32 }) })
6317
8080
  ]
6318
8081
  }
6319
8082
  );
@@ -6322,30 +8085,30 @@ var SidebarSection = ({
6322
8085
  // components/Puck/components/Canvas/index.tsx
6323
8086
  init_react_import();
6324
8087
  import {
6325
- useCallback as useCallback17,
6326
- useEffect as useEffect21,
8088
+ useCallback as useCallback18,
8089
+ useEffect as useEffect26,
6327
8090
  useMemo as useMemo19,
6328
- useRef as useRef8,
6329
- useState as useState22
8091
+ useRef as useRef9,
8092
+ useState as useState23
6330
8093
  } from "react";
6331
8094
 
6332
8095
  // components/ViewportControls/index.tsx
6333
8096
  init_react_import();
6334
- import { useEffect as useEffect20, useMemo as useMemo17, useState as useState21 } from "react";
8097
+ import { useEffect as useEffect25, useMemo as useMemo17, useState as useState22 } from "react";
6335
8098
 
6336
8099
  // css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
6337
8100
  init_react_import();
6338
- var styles_module_default21 = { "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" };
8101
+ 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" };
6339
8102
 
6340
8103
  // components/ViewportControls/index.tsx
6341
- import { jsx as jsx39, jsxs as jsxs18 } from "react/jsx-runtime";
8104
+ import { jsx as jsx41, jsxs as jsxs18 } from "react/jsx-runtime";
6342
8105
  var icons = {
6343
- Smartphone: /* @__PURE__ */ jsx39(Smartphone, { size: 16 }),
6344
- Tablet: /* @__PURE__ */ jsx39(Tablet, { size: 16 }),
6345
- Monitor: /* @__PURE__ */ jsx39(Monitor, { size: 16 })
8106
+ Smartphone: /* @__PURE__ */ jsx41(Smartphone, { size: 16 }),
8107
+ Tablet: /* @__PURE__ */ jsx41(Tablet, { size: 16 }),
8108
+ Monitor: /* @__PURE__ */ jsx41(Monitor, { size: 16 })
6346
8109
  };
6347
- var getClassName26 = get_class_name_factory_default("ViewportControls", styles_module_default21);
6348
- var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default21);
8110
+ var getClassName29 = get_class_name_factory_default("ViewportControls", styles_module_default24);
8111
+ var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default24);
6349
8112
  var ViewportButton = ({
6350
8113
  children,
6351
8114
  height = "auto",
@@ -6354,11 +8117,11 @@ var ViewportButton = ({
6354
8117
  onClick
6355
8118
  }) => {
6356
8119
  const viewports = useAppStore((s) => s.state.ui.viewports);
6357
- const [isActive, setIsActive] = useState21(false);
6358
- useEffect20(() => {
8120
+ const [isActive, setIsActive] = useState22(false);
8121
+ useEffect25(() => {
6359
8122
  setIsActive(width === viewports.current.width);
6360
8123
  }, [width, viewports.current.width]);
6361
- return /* @__PURE__ */ jsx39("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx39(
8124
+ return /* @__PURE__ */ jsx41("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx41(
6362
8125
  IconButton,
6363
8126
  {
6364
8127
  type: "button",
@@ -6368,7 +8131,7 @@ var ViewportButton = ({
6368
8131
  e.stopPropagation();
6369
8132
  onClick({ width, height });
6370
8133
  },
6371
- children: /* @__PURE__ */ jsx39("span", { className: getClassNameButton("inner"), children })
8134
+ children: /* @__PURE__ */ jsx41("span", { className: getClassNameButton("inner"), children })
6372
8135
  }
6373
8136
  ) });
6374
8137
  };
@@ -6404,8 +8167,8 @@ var ViewportControls = ({
6404
8167
  ].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
6405
8168
  [autoZoom]
6406
8169
  );
6407
- return /* @__PURE__ */ jsxs18("div", { className: getClassName26(), children: [
6408
- viewports.map((viewport, i) => /* @__PURE__ */ jsx39(
8170
+ return /* @__PURE__ */ jsxs18("div", { className: getClassName29(), children: [
8171
+ viewports.map((viewport, i) => /* @__PURE__ */ jsx41(
6409
8172
  ViewportButton,
6410
8173
  {
6411
8174
  height: viewport.height,
@@ -6416,8 +8179,8 @@ var ViewportControls = ({
6416
8179
  },
6417
8180
  i
6418
8181
  )),
6419
- /* @__PURE__ */ jsx39("div", { className: getClassName26("divider") }),
6420
- /* @__PURE__ */ jsx39(
8182
+ /* @__PURE__ */ jsx41("div", { className: getClassName29("divider") }),
8183
+ /* @__PURE__ */ jsx41(
6421
8184
  IconButton,
6422
8185
  {
6423
8186
  type: "button",
@@ -6432,10 +8195,10 @@ var ViewportControls = ({
6432
8195
  )].value
6433
8196
  );
6434
8197
  },
6435
- children: /* @__PURE__ */ jsx39(ZoomOut, { size: 16 })
8198
+ children: /* @__PURE__ */ jsx41(ZoomOut, { size: 16 })
6436
8199
  }
6437
8200
  ),
6438
- /* @__PURE__ */ jsx39(
8201
+ /* @__PURE__ */ jsx41(
6439
8202
  IconButton,
6440
8203
  {
6441
8204
  type: "button",
@@ -6450,19 +8213,19 @@ var ViewportControls = ({
6450
8213
  )].value
6451
8214
  );
6452
8215
  },
6453
- children: /* @__PURE__ */ jsx39(ZoomIn, { size: 16 })
8216
+ children: /* @__PURE__ */ jsx41(ZoomIn, { size: 16 })
6454
8217
  }
6455
8218
  ),
6456
- /* @__PURE__ */ jsx39("div", { className: getClassName26("divider") }),
6457
- /* @__PURE__ */ jsx39(
8219
+ /* @__PURE__ */ jsx41("div", { className: getClassName29("divider") }),
8220
+ /* @__PURE__ */ jsx41(
6458
8221
  "select",
6459
8222
  {
6460
- className: getClassName26("zoomSelect"),
8223
+ className: getClassName29("zoomSelect"),
6461
8224
  value: zoom.toString(),
6462
8225
  onChange: (e) => {
6463
8226
  onZoom(parseFloat(e.currentTarget.value));
6464
8227
  },
6465
- children: zoomOptions.map((option) => /* @__PURE__ */ jsx39(
8228
+ children: zoomOptions.map((option) => /* @__PURE__ */ jsx41(
6466
8229
  "option",
6467
8230
  {
6468
8231
  value: option.value,
@@ -6477,7 +8240,7 @@ var ViewportControls = ({
6477
8240
 
6478
8241
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
6479
8242
  init_react_import();
6480
- var styles_module_default22 = { "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" };
8243
+ 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" };
6481
8244
 
6482
8245
  // components/Puck/components/Canvas/index.tsx
6483
8246
  import { useShallow as useShallow9 } from "zustand/react/shallow";
@@ -6485,27 +8248,27 @@ import { useShallow as useShallow9 } from "zustand/react/shallow";
6485
8248
  // lib/frame-context.tsx
6486
8249
  init_react_import();
6487
8250
  import {
6488
- createContext as createContext6,
6489
- useContext as useContext11,
6490
- useRef as useRef7,
8251
+ createContext as createContext7,
8252
+ useContext as useContext12,
8253
+ useRef as useRef8,
6491
8254
  useMemo as useMemo18
6492
8255
  } from "react";
6493
- import { jsx as jsx40 } from "react/jsx-runtime";
6494
- var FrameContext = createContext6(null);
8256
+ import { jsx as jsx42 } from "react/jsx-runtime";
8257
+ var FrameContext = createContext7(null);
6495
8258
  var FrameProvider = ({
6496
8259
  children
6497
8260
  }) => {
6498
- const frameRef = useRef7(null);
8261
+ const frameRef = useRef8(null);
6499
8262
  const value = useMemo18(
6500
8263
  () => ({
6501
8264
  frameRef
6502
8265
  }),
6503
8266
  []
6504
8267
  );
6505
- return /* @__PURE__ */ jsx40(FrameContext.Provider, { value, children });
8268
+ return /* @__PURE__ */ jsx42(FrameContext.Provider, { value, children });
6506
8269
  };
6507
8270
  var useCanvasFrame = () => {
6508
- const context = useContext11(FrameContext);
8271
+ const context = useContext12(FrameContext);
6509
8272
  if (context === null) {
6510
8273
  throw new Error("useCanvasFrame must be used within a FrameProvider");
6511
8274
  }
@@ -6513,8 +8276,8 @@ var useCanvasFrame = () => {
6513
8276
  };
6514
8277
 
6515
8278
  // components/Puck/components/Canvas/index.tsx
6516
- import { Fragment as Fragment16, jsx as jsx41, jsxs as jsxs19 } from "react/jsx-runtime";
6517
- var getClassName27 = get_class_name_factory_default("PuckCanvas", styles_module_default22);
8279
+ import { Fragment as Fragment16, jsx as jsx43, jsxs as jsxs19 } from "react/jsx-runtime";
8280
+ var getClassName30 = get_class_name_factory_default("PuckCanvas", styles_module_default25);
6518
8281
  var ZOOM_ON_CHANGE = true;
6519
8282
  var TRANSITION_DURATION = 150;
6520
8283
  var Canvas = () => {
@@ -6554,17 +8317,17 @@ var Canvas = () => {
6554
8317
  viewports: s.state.ui.viewports
6555
8318
  }))
6556
8319
  );
6557
- const [showTransition, setShowTransition] = useState22(false);
6558
- const isResizingRef = useRef8(false);
8320
+ const [showTransition, setShowTransition] = useState23(false);
8321
+ const isResizingRef = useRef9(false);
6559
8322
  const defaultRender = useMemo19(() => {
6560
- const PuckDefault = ({ children }) => /* @__PURE__ */ jsx41(Fragment16, { children });
8323
+ const PuckDefault = ({ children }) => /* @__PURE__ */ jsx43(Fragment16, { children });
6561
8324
  return PuckDefault;
6562
8325
  }, []);
6563
8326
  const CustomPreview = useMemo19(
6564
8327
  () => overrides.preview || defaultRender,
6565
8328
  [overrides]
6566
8329
  );
6567
- const getFrameDimensions = useCallback17(() => {
8330
+ const getFrameDimensions = useCallback18(() => {
6568
8331
  if (frameRef.current) {
6569
8332
  const frame = frameRef.current;
6570
8333
  const box = getBox(frame);
@@ -6572,7 +8335,7 @@ var Canvas = () => {
6572
8335
  }
6573
8336
  return { width: 0, height: 0 };
6574
8337
  }, [frameRef]);
6575
- useEffect21(() => {
8338
+ useEffect26(() => {
6576
8339
  resetAutoZoom();
6577
8340
  }, [
6578
8341
  frameRef,
@@ -6582,7 +8345,7 @@ var Canvas = () => {
6582
8345
  rightSideBarWidth,
6583
8346
  viewports
6584
8347
  ]);
6585
- useEffect21(() => {
8348
+ useEffect26(() => {
6586
8349
  const { height: frameHeight } = getFrameDimensions();
6587
8350
  if (viewports.current.height === "auto") {
6588
8351
  setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
@@ -6590,12 +8353,12 @@ var Canvas = () => {
6590
8353
  }));
6591
8354
  }
6592
8355
  }, [zoomConfig.zoom, getFrameDimensions, setZoomConfig]);
6593
- useEffect21(() => {
8356
+ useEffect26(() => {
6594
8357
  if (ZOOM_ON_CHANGE) {
6595
8358
  resetAutoZoom();
6596
8359
  }
6597
8360
  }, [viewports.current.width, viewports]);
6598
- useEffect21(() => {
8361
+ useEffect26(() => {
6599
8362
  if (!frameRef.current) return;
6600
8363
  const resizeObserver = new ResizeObserver(() => {
6601
8364
  if (!isResizingRef.current) {
@@ -6607,8 +8370,8 @@ var Canvas = () => {
6607
8370
  resizeObserver.disconnect();
6608
8371
  };
6609
8372
  }, [frameRef.current]);
6610
- const [showLoader, setShowLoader] = useState22(false);
6611
- useEffect21(() => {
8373
+ const [showLoader, setShowLoader] = useState23(false);
8374
+ useEffect26(() => {
6612
8375
  setTimeout(() => {
6613
8376
  setShowLoader(true);
6614
8377
  }, 500);
@@ -6616,7 +8379,7 @@ var Canvas = () => {
6616
8379
  return /* @__PURE__ */ jsxs19(
6617
8380
  "div",
6618
8381
  {
6619
- className: getClassName27({
8382
+ className: getClassName30({
6620
8383
  ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
6621
8384
  showLoader
6622
8385
  }),
@@ -6631,7 +8394,7 @@ var Canvas = () => {
6631
8394
  }
6632
8395
  },
6633
8396
  children: [
6634
- viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx41("div", { className: getClassName27("controls"), children: /* @__PURE__ */ jsx41(
8397
+ viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ jsx43("div", { className: getClassName30("controls"), children: /* @__PURE__ */ jsx43(
6635
8398
  ViewportControls,
6636
8399
  {
6637
8400
  autoZoom: zoomConfig.autoZoom,
@@ -6661,11 +8424,11 @@ var Canvas = () => {
6661
8424
  }
6662
8425
  }
6663
8426
  ) }),
6664
- /* @__PURE__ */ jsxs19("div", { className: getClassName27("inner"), ref: frameRef, children: [
6665
- /* @__PURE__ */ jsx41(
8427
+ /* @__PURE__ */ jsxs19("div", { className: getClassName30("inner"), ref: frameRef, children: [
8428
+ /* @__PURE__ */ jsx43(
6666
8429
  "div",
6667
8430
  {
6668
- className: getClassName27("root"),
8431
+ className: getClassName30("root"),
6669
8432
  style: {
6670
8433
  width: iframe.enabled ? viewports.current.width : "100%",
6671
8434
  height: zoomConfig.rootHeight,
@@ -6679,10 +8442,10 @@ var Canvas = () => {
6679
8442
  setShowTransition(false);
6680
8443
  isResizingRef.current = false;
6681
8444
  },
6682
- children: /* @__PURE__ */ jsx41(CustomPreview, { children: /* @__PURE__ */ jsx41(Preview2, {}) })
8445
+ children: /* @__PURE__ */ jsx43(CustomPreview, { children: /* @__PURE__ */ jsx43(Preview2, {}) })
6683
8446
  }
6684
8447
  ),
6685
- /* @__PURE__ */ jsx41("div", { className: getClassName27("loader"), children: /* @__PURE__ */ jsx41(Loader, { size: 24 }) })
8448
+ /* @__PURE__ */ jsx43("div", { className: getClassName30("loader"), children: /* @__PURE__ */ jsx43(Loader, { size: 24 }) })
6686
8449
  ] })
6687
8450
  ]
6688
8451
  }
@@ -6691,14 +8454,14 @@ var Canvas = () => {
6691
8454
 
6692
8455
  // lib/use-sidebar-resize.ts
6693
8456
  init_react_import();
6694
- import { useCallback as useCallback18, useEffect as useEffect22, useRef as useRef9, useState as useState23 } from "react";
8457
+ import { useCallback as useCallback19, useEffect as useEffect27, useRef as useRef10, useState as useState24 } from "react";
6695
8458
  function useSidebarResize(position, dispatch) {
6696
- const [width, setWidth] = useState23(null);
6697
- const sidebarRef = useRef9(null);
8459
+ const [width, setWidth] = useState24(null);
8460
+ const sidebarRef = useRef10(null);
6698
8461
  const storeWidth = useAppStore(
6699
8462
  (s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
6700
8463
  );
6701
- useEffect22(() => {
8464
+ useEffect27(() => {
6702
8465
  if (typeof window !== "undefined" && !storeWidth) {
6703
8466
  try {
6704
8467
  const savedWidths = localStorage.getItem("puck-sidebar-widths");
@@ -6723,12 +8486,12 @@ function useSidebarResize(position, dispatch) {
6723
8486
  }
6724
8487
  }
6725
8488
  }, [dispatch, position, storeWidth]);
6726
- useEffect22(() => {
8489
+ useEffect27(() => {
6727
8490
  if (storeWidth !== void 0) {
6728
8491
  setWidth(storeWidth);
6729
8492
  }
6730
8493
  }, [storeWidth]);
6731
- const handleResizeEnd = useCallback18(
8494
+ const handleResizeEnd = useCallback19(
6732
8495
  (width2) => {
6733
8496
  dispatch({
6734
8497
  type: "setUi",
@@ -6775,15 +8538,15 @@ init_react_import();
6775
8538
 
6776
8539
  // components/Puck/components/ResizeHandle/index.tsx
6777
8540
  init_react_import();
6778
- import { useCallback as useCallback19, useRef as useRef10 } from "react";
8541
+ import { useCallback as useCallback20, useRef as useRef11 } from "react";
6779
8542
 
6780
8543
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/ResizeHandle/styles.module.css#css-module
6781
8544
  init_react_import();
6782
- var styles_module_default23 = { "ResizeHandle": "_ResizeHandle_144bf_2", "ResizeHandle--left": "_ResizeHandle--left_144bf_16", "ResizeHandle--right": "_ResizeHandle--right_144bf_20" };
8545
+ var styles_module_default26 = { "ResizeHandle": "_ResizeHandle_144bf_2", "ResizeHandle--left": "_ResizeHandle--left_144bf_16", "ResizeHandle--right": "_ResizeHandle--right_144bf_20" };
6783
8546
 
6784
8547
  // components/Puck/components/ResizeHandle/index.tsx
6785
- import { jsx as jsx42 } from "react/jsx-runtime";
6786
- var getClassName28 = get_class_name_factory_default("ResizeHandle", styles_module_default23);
8548
+ import { jsx as jsx44 } from "react/jsx-runtime";
8549
+ var getClassName31 = get_class_name_factory_default("ResizeHandle", styles_module_default26);
6787
8550
  var ResizeHandle = ({
6788
8551
  position,
6789
8552
  sidebarRef,
@@ -6792,11 +8555,11 @@ var ResizeHandle = ({
6792
8555
  }) => {
6793
8556
  const { frameRef } = useCanvasFrame();
6794
8557
  const resetAutoZoom = useResetAutoZoom(frameRef);
6795
- const handleRef = useRef10(null);
6796
- const isDragging = useRef10(false);
6797
- const startX = useRef10(0);
6798
- const startWidth = useRef10(0);
6799
- const handleMouseMove = useCallback19(
8558
+ const handleRef = useRef11(null);
8559
+ const isDragging = useRef11(false);
8560
+ const startX = useRef11(0);
8561
+ const startWidth = useRef11(0);
8562
+ const handleMouseMove = useCallback20(
6800
8563
  (e) => {
6801
8564
  if (!isDragging.current) return;
6802
8565
  const delta = e.clientX - startX.current;
@@ -6807,7 +8570,7 @@ var ResizeHandle = ({
6807
8570
  },
6808
8571
  [onResize, position]
6809
8572
  );
6810
- const handleMouseUp = useCallback19(() => {
8573
+ const handleMouseUp = useCallback20(() => {
6811
8574
  var _a;
6812
8575
  if (!isDragging.current) return;
6813
8576
  isDragging.current = false;
@@ -6823,7 +8586,7 @@ var ResizeHandle = ({
6823
8586
  onResizeEnd(finalWidth);
6824
8587
  resetAutoZoom();
6825
8588
  }, [onResizeEnd]);
6826
- const handleMouseDown = useCallback19(
8589
+ const handleMouseDown = useCallback20(
6827
8590
  (e) => {
6828
8591
  var _a;
6829
8592
  isDragging.current = true;
@@ -6841,11 +8604,11 @@ var ResizeHandle = ({
6841
8604
  },
6842
8605
  [position, handleMouseMove, handleMouseUp]
6843
8606
  );
6844
- return /* @__PURE__ */ jsx42(
8607
+ return /* @__PURE__ */ jsx44(
6845
8608
  "div",
6846
8609
  {
6847
8610
  ref: handleRef,
6848
- className: getClassName28({ [position]: true }),
8611
+ className: getClassName31({ [position]: true }),
6849
8612
  onMouseDown: handleMouseDown
6850
8613
  }
6851
8614
  );
@@ -6853,24 +8616,23 @@ var ResizeHandle = ({
6853
8616
 
6854
8617
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Sidebar/styles.module.css#css-module
6855
8618
  init_react_import();
6856
- var styles_module_default24 = { "Sidebar": "_Sidebar_2pzs4_1", "Sidebar--left": "_Sidebar--left_2pzs4_8", "Sidebar--right": "_Sidebar--right_2pzs4_15", "Sidebar-resizeHandle": "_Sidebar-resizeHandle_2pzs4_21" };
8619
+ 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" };
6857
8620
 
6858
8621
  // components/Puck/components/Sidebar/index.tsx
6859
- import { Fragment as Fragment17, jsx as jsx43, jsxs as jsxs20 } from "react/jsx-runtime";
6860
- var getClassName29 = get_class_name_factory_default("Sidebar", styles_module_default24);
8622
+ import { Fragment as Fragment17, jsx as jsx45, jsxs as jsxs20 } from "react/jsx-runtime";
8623
+ var getClassName32 = get_class_name_factory_default("Sidebar", styles_module_default27);
6861
8624
  var Sidebar = ({
6862
8625
  position,
6863
8626
  sidebarRef,
6864
8627
  isVisible,
6865
- width,
6866
8628
  onResize,
6867
8629
  onResizeEnd,
6868
8630
  children
6869
8631
  }) => {
6870
8632
  if (!isVisible) return null;
6871
8633
  return /* @__PURE__ */ jsxs20(Fragment17, { children: [
6872
- /* @__PURE__ */ jsx43("div", { ref: sidebarRef, className: getClassName29({ [position]: true }), children }),
6873
- /* @__PURE__ */ jsx43("div", { className: `${getClassName29("resizeHandle")}`, children: /* @__PURE__ */ jsx43(
8634
+ /* @__PURE__ */ jsx45("div", { ref: sidebarRef, className: getClassName32({ [position]: true }), children }),
8635
+ /* @__PURE__ */ jsx45("div", { className: `${getClassName32("resizeHandle")}`, children: /* @__PURE__ */ jsx45(
6874
8636
  ResizeHandle,
6875
8637
  {
6876
8638
  position,
@@ -6887,13 +8649,13 @@ init_react_import();
6887
8649
 
6888
8650
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Nav/styles.module.css#css-module
6889
8651
  init_react_import();
6890
- var styles_module_default25 = { "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" };
8652
+ 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" };
6891
8653
 
6892
8654
  // components/Puck/components/Nav/index.tsx
6893
- import { jsx as jsx44, jsxs as jsxs21 } from "react/jsx-runtime";
6894
- var getClassName30 = get_class_name_factory_default("Nav", styles_module_default25);
6895
- var getClassNameSection = get_class_name_factory_default("NavSection", styles_module_default25);
6896
- var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default25);
8655
+ import { jsx as jsx46, jsxs as jsxs21 } from "react/jsx-runtime";
8656
+ var getClassName33 = get_class_name_factory_default("Nav", styles_module_default28);
8657
+ var getClassNameSection = get_class_name_factory_default("NavSection", styles_module_default28);
8658
+ var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default28);
6897
8659
  var MenuItem = ({
6898
8660
  label,
6899
8661
  icon,
@@ -6904,32 +8666,32 @@ var MenuItem = ({
6904
8666
  const showChildren = isActive;
6905
8667
  return /* @__PURE__ */ jsxs21("li", { className: getClassNameItem3({ active: isActive }), children: [
6906
8668
  onClick && /* @__PURE__ */ jsxs21("div", { className: getClassNameItem3("link"), onClick, children: [
6907
- icon && /* @__PURE__ */ jsx44("span", { className: getClassNameItem3("linkIcon"), children: icon }),
6908
- /* @__PURE__ */ jsx44("span", { className: getClassNameItem3("linkLabel"), children: label })
8669
+ icon && /* @__PURE__ */ jsx46("span", { className: getClassNameItem3("linkIcon"), children: icon }),
8670
+ /* @__PURE__ */ jsx46("span", { className: getClassNameItem3("linkLabel"), children: label })
6909
8671
  ] }),
6910
- items && showChildren && /* @__PURE__ */ jsx44("ul", { className: getClassNameItem3("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx44(MenuItem, __spreadValues({}, item), key)) })
8672
+ items && showChildren && /* @__PURE__ */ jsx46("ul", { className: getClassNameItem3("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx46(MenuItem, __spreadValues({}, item), key)) })
6911
8673
  ] });
6912
8674
  };
6913
8675
  var NavSection = ({ title, items }) => {
6914
8676
  return /* @__PURE__ */ jsxs21("li", { className: getClassNameSection(), children: [
6915
- title && /* @__PURE__ */ jsx44("div", { className: getClassNameSection("title"), children: title }),
6916
- /* @__PURE__ */ jsx44("ul", { className: getClassNameSection("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx44(MenuItem, __spreadValues({}, item), key)) })
8677
+ title && /* @__PURE__ */ jsx46("div", { className: getClassNameSection("title"), children: title }),
8678
+ /* @__PURE__ */ jsx46("ul", { className: getClassNameSection("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx46(MenuItem, __spreadValues({}, item), key)) })
6917
8679
  ] });
6918
8680
  };
6919
8681
  var Nav = ({
6920
8682
  navigation,
6921
8683
  slim
6922
8684
  }) => {
6923
- return /* @__PURE__ */ jsx44("nav", { className: getClassName30({ slim }), children: /* @__PURE__ */ jsx44("ul", { className: getClassName30("list"), children: Object.entries(navigation).map(([key, section]) => {
6924
- return /* @__PURE__ */ jsx44(NavSection, { title: section.title, items: section.items }, key);
8685
+ return /* @__PURE__ */ jsx46("nav", { className: getClassName33({ slim }), children: /* @__PURE__ */ jsx46("ul", { className: getClassName33("list"), children: Object.entries(navigation).map(([key, section]) => {
8686
+ return /* @__PURE__ */ jsx46(NavSection, { title: section.title, items: section.items }, key);
6925
8687
  }) }) });
6926
8688
  };
6927
8689
 
6928
8690
  // components/Puck/components/Layout/index.tsx
6929
- import { jsx as jsx45, jsxs as jsxs22 } from "react/jsx-runtime";
6930
- var getClassName31 = get_class_name_factory_default("Puck", styles_module_default17);
6931
- var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default17);
6932
- var getPluginTabClassName = get_class_name_factory_default("PuckPluginTab", styles_module_default17);
8691
+ import { jsx as jsx47, jsxs as jsxs22 } from "react/jsx-runtime";
8692
+ var getClassName34 = get_class_name_factory_default("Puck", styles_module_default20);
8693
+ var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default20);
8694
+ var getPluginTabClassName = get_class_name_factory_default("PuckPluginTab", styles_module_default20);
6933
8695
  var FieldSideBar = () => {
6934
8696
  const title = useAppStore(
6935
8697
  (s) => {
@@ -6937,13 +8699,13 @@ var FieldSideBar = () => {
6937
8699
  return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : "Page";
6938
8700
  }
6939
8701
  );
6940
- return /* @__PURE__ */ jsx45(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx45(Fields, {}) });
8702
+ return /* @__PURE__ */ jsx47(SidebarSection, { noPadding: true, noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx47(Fields, {}) });
6941
8703
  };
6942
8704
  var PluginTab = ({
6943
8705
  children,
6944
8706
  visible
6945
8707
  }) => {
6946
- return /* @__PURE__ */ jsx45("div", { className: getPluginTabClassName({ visible }), children });
8708
+ return /* @__PURE__ */ jsx47("div", { className: getPluginTabClassName({ visible }), children });
6947
8709
  };
6948
8710
  var Layout = ({ children }) => {
6949
8711
  const {
@@ -6977,7 +8739,7 @@ var Layout = ({ children }) => {
6977
8739
  sidebarRef: rightSidebarRef,
6978
8740
  handleResizeEnd: handleRightSidebarResizeEnd
6979
8741
  } = useSidebarResize("right", dispatch);
6980
- useEffect24(() => {
8742
+ useEffect29(() => {
6981
8743
  if (!window.matchMedia("(min-width: 638px)").matches) {
6982
8744
  dispatch({
6983
8745
  type: "setUi",
@@ -7005,13 +8767,13 @@ var Layout = ({ children }) => {
7005
8767
  () => overrides.puck || DefaultOverride,
7006
8768
  [overrides]
7007
8769
  );
7008
- const [mounted, setMounted] = useState24(false);
7009
- useEffect24(() => {
8770
+ const [mounted, setMounted] = useState25(false);
8771
+ useEffect29(() => {
7010
8772
  setMounted(true);
7011
8773
  }, []);
7012
8774
  const ready = useAppStore((s) => s.status === "READY");
7013
8775
  useMonitorHotkeys();
7014
- useEffect24(() => {
8776
+ useEffect29(() => {
7015
8777
  if (ready && iframe.enabled) {
7016
8778
  const frameDoc = getFrame();
7017
8779
  if (frameDoc) {
@@ -7020,7 +8782,19 @@ var Layout = ({ children }) => {
7020
8782
  }
7021
8783
  }, [ready, iframe.enabled]);
7022
8784
  usePreviewModeHotkeys();
7023
- const [view, setView] = useState24();
8785
+ const layoutOptions = {};
8786
+ if (leftWidth) {
8787
+ layoutOptions["--puck-user-left-side-bar-width"] = `${leftWidth}px`;
8788
+ }
8789
+ if (rightWidth) {
8790
+ layoutOptions["--puck-user-right-side-bar-width"] = `${rightWidth}px`;
8791
+ }
8792
+ const setUi = useAppStore((s) => s.setUi);
8793
+ const currentPlugin = useAppStore((s) => {
8794
+ var _a;
8795
+ return (_a = s.state.ui.plugin) == null ? void 0 : _a.current;
8796
+ });
8797
+ const appStoreApi = useAppStoreApi();
7024
8798
  const pluginItems = useMemo20(() => {
7025
8799
  const details = {};
7026
8800
  const defaultPlugins = [blocksPlugin(), outlinePlugin()];
@@ -7033,25 +8807,38 @@ var Layout = ({ children }) => {
7033
8807
  }
7034
8808
  details[plugin.name] = {
7035
8809
  label: (_a = plugin.label) != null ? _a : plugin.name,
7036
- icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ jsx45(ToyBrick, {}),
8810
+ icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ jsx47(ToyBrick, {}),
7037
8811
  onClick: () => {
7038
- setView(plugin.name);
8812
+ if (plugin.name === currentPlugin) {
8813
+ if (leftSideBarVisible) {
8814
+ setUi({ leftSideBarVisible: false });
8815
+ } else {
8816
+ setUi({ leftSideBarVisible: true });
8817
+ }
8818
+ } else {
8819
+ if (plugin.name) {
8820
+ setUi({
8821
+ plugin: { current: plugin.name },
8822
+ leftSideBarVisible: true
8823
+ });
8824
+ }
8825
+ }
7039
8826
  },
7040
- isActive: view === plugin.name,
8827
+ isActive: leftSideBarVisible && currentPlugin === plugin.name,
7041
8828
  render: plugin.render
7042
8829
  };
7043
8830
  }
7044
8831
  });
7045
8832
  return details;
7046
- }, [plugins, view]);
7047
- useEffect24(() => {
7048
- if (!view) {
8833
+ }, [plugins, currentPlugin, appStoreApi, leftSideBarVisible]);
8834
+ useEffect29(() => {
8835
+ if (!currentPlugin) {
7049
8836
  const names = Object.keys(pluginItems);
7050
- setView(names[0]);
8837
+ setUi({ plugin: { current: names[0] } });
7051
8838
  }
7052
- }, [pluginItems, view]);
7053
- return /* @__PURE__ */ jsxs22("div", { className: `Puck ${getClassName31()}`, children: [
7054
- /* @__PURE__ */ jsx45(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx45(CustomPuck, { children: children || /* @__PURE__ */ jsx45(FrameProvider, { children: /* @__PURE__ */ jsx45(
8839
+ }, [pluginItems, currentPlugin]);
8840
+ return /* @__PURE__ */ jsxs22("div", { className: `Puck ${getClassName34()}`, children: [
8841
+ /* @__PURE__ */ jsx47(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx47(CustomPuck, { children: children || /* @__PURE__ */ jsx47(FrameProvider, { children: /* @__PURE__ */ jsx47(
7055
8842
  "div",
7056
8843
  {
7057
8844
  className: getLayoutClassName({
@@ -7063,13 +8850,10 @@ var Layout = ({ children }) => {
7063
8850
  "div",
7064
8851
  {
7065
8852
  className: getLayoutClassName("inner"),
7066
- style: {
7067
- "--puck-user-left-side-bar-width": `${leftWidth}px`,
7068
- "--puck-user-right-side-bar-width": `${rightWidth}px`
7069
- },
8853
+ style: layoutOptions,
7070
8854
  children: [
7071
- /* @__PURE__ */ jsx45(Header, {}),
7072
- /* @__PURE__ */ jsx45("div", { className: getLayoutClassName("nav"), children: /* @__PURE__ */ jsx45(
8855
+ /* @__PURE__ */ jsx47(Header, {}),
8856
+ /* @__PURE__ */ jsx47("div", { className: getLayoutClassName("nav"), children: /* @__PURE__ */ jsx47(
7073
8857
  Nav,
7074
8858
  {
7075
8859
  slim: true,
@@ -7080,31 +8864,29 @@ var Layout = ({ children }) => {
7080
8864
  }
7081
8865
  }
7082
8866
  ) }),
7083
- /* @__PURE__ */ jsx45(
8867
+ /* @__PURE__ */ jsx47(
7084
8868
  Sidebar,
7085
8869
  {
7086
8870
  position: "left",
7087
8871
  sidebarRef: leftSidebarRef,
7088
8872
  isVisible: leftSideBarVisible,
7089
- width: leftWidth,
7090
8873
  onResize: setLeftWidth,
7091
8874
  onResizeEnd: handleLeftSidebarResizeEnd,
7092
8875
  children: Object.entries(pluginItems).map(
7093
- ([id, { render: Render2 }]) => /* @__PURE__ */ jsx45(PluginTab, { visible: view === id, children: /* @__PURE__ */ jsx45(Render2, {}) }, id)
8876
+ ([id, { render: Render2 }]) => /* @__PURE__ */ jsx47(PluginTab, { visible: currentPlugin === id, children: /* @__PURE__ */ jsx47(Render2, {}) }, id)
7094
8877
  )
7095
8878
  }
7096
8879
  ),
7097
- /* @__PURE__ */ jsx45(Canvas, {}),
7098
- /* @__PURE__ */ jsx45(
8880
+ /* @__PURE__ */ jsx47(Canvas, {}),
8881
+ /* @__PURE__ */ jsx47(
7099
8882
  Sidebar,
7100
8883
  {
7101
8884
  position: "right",
7102
8885
  sidebarRef: rightSidebarRef,
7103
8886
  isVisible: rightSideBarVisible,
7104
- width: rightWidth,
7105
8887
  onResize: setRightWidth,
7106
8888
  onResizeEnd: handleRightSidebarResizeEnd,
7107
- children: /* @__PURE__ */ jsx45(FieldSideBar, {})
8889
+ children: /* @__PURE__ */ jsx47(FieldSideBar, {})
7108
8890
  }
7109
8891
  )
7110
8892
  ]
@@ -7112,17 +8894,17 @@ var Layout = ({ children }) => {
7112
8894
  )
7113
8895
  }
7114
8896
  ) }) }) }),
7115
- /* @__PURE__ */ jsx45("div", { id: "puck-portal-root", className: getClassName31("portal") })
8897
+ /* @__PURE__ */ jsx47("div", { id: "puck-portal-root", className: getClassName34("portal") })
7116
8898
  ] });
7117
8899
  };
7118
8900
 
7119
8901
  // components/Puck/index.tsx
7120
- import { jsx as jsx46 } from "react/jsx-runtime";
7121
- var propsContext = createContext7({});
8902
+ import { jsx as jsx48 } from "react/jsx-runtime";
8903
+ var propsContext = createContext8({});
7122
8904
  function PropsProvider(props) {
7123
- return /* @__PURE__ */ jsx46(propsContext.Provider, { value: props, children: props.children });
8905
+ return /* @__PURE__ */ jsx48(propsContext.Provider, { value: props, children: props.children });
7124
8906
  }
7125
- var usePropsContext = () => useContext12(propsContext);
8907
+ var usePropsContext = () => useContext13(propsContext);
7126
8908
  function PuckProvider({ children }) {
7127
8909
  const {
7128
8910
  config,
@@ -7146,7 +8928,7 @@ function PuckProvider({ children }) {
7146
8928
  }, _iframe),
7147
8929
  [_iframe]
7148
8930
  );
7149
- const [generatedAppState] = useState25(() => {
8931
+ const [generatedAppState] = useState26(() => {
7150
8932
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
7151
8933
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
7152
8934
  let clientUiState = {};
@@ -7206,7 +8988,7 @@ function PuckProvider({ children }) {
7206
8988
  return walkAppState(newAppState, config);
7207
8989
  });
7208
8990
  const { appendData = true } = _initialHistory || {};
7209
- const [blendedHistories] = useState25(
8991
+ const [blendedHistories] = useState26(
7210
8992
  [
7211
8993
  ...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
7212
8994
  ...appendData ? [{ state: generatedAppState }] : []
@@ -7234,7 +9016,7 @@ function PuckProvider({ children }) {
7234
9016
  );
7235
9017
  return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
7236
9018
  }, [fieldTransforms, plugins]);
7237
- const generateAppStore = useCallback20(
9019
+ const generateAppStore = useCallback21(
7238
9020
  (state) => {
7239
9021
  return {
7240
9022
  state,
@@ -7260,15 +9042,15 @@ function PuckProvider({ children }) {
7260
9042
  loadedFieldTransforms
7261
9043
  ]
7262
9044
  );
7263
- const [appStore] = useState25(
9045
+ const [appStore] = useState26(
7264
9046
  () => createAppStore(generateAppStore(initialAppState))
7265
9047
  );
7266
- useEffect25(() => {
9048
+ useEffect30(() => {
7267
9049
  if (process.env.NODE_ENV !== "production") {
7268
9050
  window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
7269
9051
  }
7270
9052
  }, [appStore]);
7271
- useEffect25(() => {
9053
+ useEffect30(() => {
7272
9054
  const state = appStore.getState().state;
7273
9055
  appStore.setState(__spreadValues({}, generateAppStore(state)));
7274
9056
  }, [config, plugins, loadedOverrides, viewports, iframe, onAction, metadata]);
@@ -7277,13 +9059,13 @@ function PuckProvider({ children }) {
7277
9059
  index: initialHistoryIndex,
7278
9060
  initialAppState
7279
9061
  });
7280
- const previousData = useRef11(null);
7281
- useEffect25(() => {
9062
+ const previousData = useRef12(null);
9063
+ useEffect30(() => {
7282
9064
  appStore.subscribe(
7283
9065
  (s) => s.state.data,
7284
9066
  (data) => {
7285
9067
  if (onChange) {
7286
- if (fdeq(data, previousData.current)) return;
9068
+ if (fdeq2(data, previousData.current)) return;
7287
9069
  onChange(data);
7288
9070
  previousData.current = data;
7289
9071
  }
@@ -7292,14 +9074,14 @@ function PuckProvider({ children }) {
7292
9074
  }, []);
7293
9075
  useRegisterPermissionsSlice(appStore, permissions);
7294
9076
  const uPuckStore = useRegisterUsePuckStore(appStore);
7295
- useEffect25(() => {
9077
+ useEffect30(() => {
7296
9078
  const { resolveAndCommitData } = appStore.getState();
7297
9079
  resolveAndCommitData();
7298
9080
  }, []);
7299
- return /* @__PURE__ */ jsx46(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx46(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
9081
+ return /* @__PURE__ */ jsx48(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx48(UsePuckStoreContext.Provider, { value: uPuckStore, children }) });
7300
9082
  }
7301
9083
  function Puck(props) {
7302
- return /* @__PURE__ */ jsx46(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx46(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx46(Layout, { children: props.children }) })) }));
9084
+ return /* @__PURE__ */ jsx48(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx48(PuckProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx48(Layout, { children: props.children }) })) }));
7303
9085
  }
7304
9086
  Puck.Components = Components;
7305
9087
  Puck.Fields = Fields;
@@ -7308,18 +9090,18 @@ Puck.Preview = Preview2;
7308
9090
 
7309
9091
  // lib/default-plugins.tsx
7310
9092
  init_react_import();
7311
- import { jsx as jsx47 } from "react/jsx-runtime";
9093
+ import { jsx as jsx49 } from "react/jsx-runtime";
7312
9094
  var blocksPlugin = () => ({
7313
9095
  name: "blocks",
7314
9096
  label: "Blocks",
7315
9097
  render: Components,
7316
- icon: /* @__PURE__ */ jsx47(Hammer, {})
9098
+ icon: /* @__PURE__ */ jsx49(Hammer, {})
7317
9099
  });
7318
9100
  var outlinePlugin = () => ({
7319
9101
  name: "outline",
7320
9102
  label: "Outline",
7321
9103
  render: Outline,
7322
- icon: /* @__PURE__ */ jsx47(Layers, {})
9104
+ icon: /* @__PURE__ */ jsx49(Layers, {})
7323
9105
  });
7324
9106
 
7325
9107
  export {
@@ -7334,6 +9116,8 @@ export {
7334
9116
  AutoField,
7335
9117
  renderContext,
7336
9118
  Render,
9119
+ registerOverlayPortal,
9120
+ setDeep,
7337
9121
  DropZone,
7338
9122
  Drawer,
7339
9123
  createUsePuck,
@@ -7345,6 +9129,13 @@ export {
7345
9129
  };
7346
9130
  /*! Bundled license information:
7347
9131
 
9132
+ classnames/index.js:
9133
+ (*!
9134
+ Copyright (c) 2018 Jed Watson.
9135
+ Licensed under the MIT License (MIT), see
9136
+ http://jedwatson.github.io/classnames
9137
+ *)
9138
+
7348
9139
  lucide-react/dist/esm/shared/src/utils.js:
7349
9140
  (**
7350
9141
  * @license lucide-react v0.468.0 - ISC