@measured/puck 0.16.0-canary.f761e5f → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{actions-DDAd8cys.d.mts → actions-9pHbVtMU.d.mts} +32 -7
- package/dist/{actions-DDAd8cys.d.ts → actions-9pHbVtMU.d.ts} +32 -7
- package/dist/index.css +96 -77
- package/dist/index.d.mts +48 -50
- package/dist/index.d.ts +48 -50
- package/dist/index.js +817 -676
- package/dist/index.mjs +790 -650
- package/dist/rsc.d.mts +1 -1
- package/dist/rsc.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -138,11 +138,11 @@ var get_class_name_factory_default = getClassNameFactory;
|
|
138
138
|
|
139
139
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ActionBar/styles.module.css#css-module
|
140
140
|
init_react_import();
|
141
|
-
var styles_module_default = { "
|
141
|
+
var styles_module_default = { "ActionBar": "_ActionBar_fp58q_1", "ActionBar-actionsLabel": "_ActionBar-actionsLabel_fp58q_16", "ActionBar-group": "_ActionBar-group_fp58q_29", "ActionBar-action": "_ActionBar-action_fp58q_16" };
|
142
142
|
|
143
143
|
// components/ActionBar/index.tsx
|
144
144
|
import { jsx, jsxs } from "react/jsx-runtime";
|
145
|
-
var getClassName = get_class_name_factory_default("
|
145
|
+
var getClassName = get_class_name_factory_default("ActionBar", styles_module_default);
|
146
146
|
var ActionBar = ({
|
147
147
|
label,
|
148
148
|
children
|
@@ -164,7 +164,9 @@ var Action = ({
|
|
164
164
|
children
|
165
165
|
}
|
166
166
|
);
|
167
|
+
var Group = ({ children }) => /* @__PURE__ */ jsx("div", { className: getClassName("group"), children });
|
167
168
|
ActionBar.Action = Action;
|
169
|
+
ActionBar.Group = Group;
|
168
170
|
|
169
171
|
// components/AutoField/index.tsx
|
170
172
|
init_react_import();
|
@@ -175,10 +177,10 @@ var styles_module_default2 = { "Input": "_Input_3pq3z_1", "Input-label": "_Input
|
|
175
177
|
|
176
178
|
// components/AutoField/index.tsx
|
177
179
|
import {
|
178
|
-
useCallback as
|
179
|
-
useEffect as
|
180
|
+
useCallback as useCallback5,
|
181
|
+
useEffect as useEffect9,
|
180
182
|
useMemo as useMemo2,
|
181
|
-
useState as
|
183
|
+
useState as useState10
|
182
184
|
} from "react";
|
183
185
|
|
184
186
|
// components/AutoField/fields/index.tsx
|
@@ -592,8 +594,8 @@ init_react_import();
|
|
592
594
|
import {
|
593
595
|
createContext,
|
594
596
|
useContext,
|
595
|
-
useEffect,
|
596
|
-
useState as
|
597
|
+
useEffect as useEffect3,
|
598
|
+
useState as useState4
|
597
599
|
} from "react";
|
598
600
|
|
599
601
|
// lib/get-item.ts
|
@@ -617,6 +619,332 @@ var defaultViewports = [
|
|
617
619
|
|
618
620
|
// components/Puck/context.tsx
|
619
621
|
import { UAParser } from "ua-parser-js";
|
622
|
+
|
623
|
+
// lib/use-resolved-permissions.ts
|
624
|
+
init_react_import();
|
625
|
+
import { useCallback, useEffect, useState as useState2 } from "react";
|
626
|
+
|
627
|
+
// lib/flatten-data.ts
|
628
|
+
init_react_import();
|
629
|
+
var flattenData = (data) => {
|
630
|
+
return Object.keys(data.zones || {}).reduce(
|
631
|
+
(acc, zone) => [...acc, ...data.zones[zone]],
|
632
|
+
data.content
|
633
|
+
);
|
634
|
+
};
|
635
|
+
|
636
|
+
// lib/get-changed.ts
|
637
|
+
init_react_import();
|
638
|
+
var getChanged = (newItem, oldItem) => {
|
639
|
+
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
640
|
+
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
641
|
+
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
642
|
+
return __spreadProps(__spreadValues({}, acc), {
|
643
|
+
[item]: oldItemProps[item] !== newItemProps[item]
|
644
|
+
});
|
645
|
+
}, {}) : {};
|
646
|
+
};
|
647
|
+
|
648
|
+
// lib/use-resolved-permissions.ts
|
649
|
+
var useResolvedPermissions = (config, appState, globalPermissions, setComponentLoading, unsetComponentLoading) => {
|
650
|
+
const [cache3, setCache] = useState2({});
|
651
|
+
const [resolvedPermissions, setResolvedPermissions] = useState2({});
|
652
|
+
const resolveDataForItem = useCallback(
|
653
|
+
(item, force = false) => __async(void 0, null, function* () {
|
654
|
+
var _a, _b, _c;
|
655
|
+
setComponentLoading == null ? void 0 : setComponentLoading(item.props.id);
|
656
|
+
const componentConfig = item.type === "root" ? config.root : config.components[item.type];
|
657
|
+
if (!componentConfig) {
|
658
|
+
unsetComponentLoading == null ? void 0 : unsetComponentLoading(item.props.id);
|
659
|
+
return;
|
660
|
+
}
|
661
|
+
const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
|
662
|
+
if (componentConfig.resolvePermissions) {
|
663
|
+
const changed = getChanged(item, (_a = cache3[item.props.id]) == null ? void 0 : _a.lastData);
|
664
|
+
if (Object.values(changed).some((el) => el === true) || force) {
|
665
|
+
const resolvedPermissions2 = yield componentConfig.resolvePermissions(
|
666
|
+
item,
|
667
|
+
{
|
668
|
+
changed,
|
669
|
+
lastPermissions: ((_b = cache3[item.props.id]) == null ? void 0 : _b.lastPermissions) || null,
|
670
|
+
permissions: initialPermissions,
|
671
|
+
appState,
|
672
|
+
lastData: ((_c = cache3[item.props.id]) == null ? void 0 : _c.lastData) || null
|
673
|
+
}
|
674
|
+
);
|
675
|
+
setCache((_cache) => __spreadProps(__spreadValues({}, _cache), {
|
676
|
+
[item.props.id]: {
|
677
|
+
lastData: item,
|
678
|
+
lastPermissions: resolvedPermissions2
|
679
|
+
}
|
680
|
+
}));
|
681
|
+
setResolvedPermissions((p) => __spreadProps(__spreadValues({}, p), {
|
682
|
+
[item.props.id]: resolvedPermissions2
|
683
|
+
}));
|
684
|
+
}
|
685
|
+
}
|
686
|
+
unsetComponentLoading == null ? void 0 : unsetComponentLoading(item.props.id);
|
687
|
+
}),
|
688
|
+
[config, globalPermissions, appState, cache3]
|
689
|
+
);
|
690
|
+
const resolveDataForRoot = (force = false) => {
|
691
|
+
resolveDataForItem(
|
692
|
+
// Shim the root data in by conforming to component data shape
|
693
|
+
{
|
694
|
+
type: "root",
|
695
|
+
props: __spreadProps(__spreadValues({}, appState.data.root.props), { id: "puck-root" })
|
696
|
+
},
|
697
|
+
force
|
698
|
+
);
|
699
|
+
};
|
700
|
+
const resolvePermissions = useCallback(
|
701
|
+
(..._0) => __async(void 0, [..._0], function* ({ item, type, root } = {}, force = false) {
|
702
|
+
if (item) {
|
703
|
+
yield resolveDataForItem(item, force);
|
704
|
+
} else if (type) {
|
705
|
+
flattenData(appState.data).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
|
706
|
+
yield resolveDataForItem(item2, force);
|
707
|
+
}));
|
708
|
+
} else if (root) {
|
709
|
+
resolveDataForRoot(force);
|
710
|
+
} else {
|
711
|
+
resolveDataForRoot(force);
|
712
|
+
flattenData(appState.data).map((item2) => __async(void 0, null, function* () {
|
713
|
+
yield resolveDataForItem(item2, force);
|
714
|
+
}));
|
715
|
+
}
|
716
|
+
}),
|
717
|
+
[config, appState]
|
718
|
+
);
|
719
|
+
const refreshPermissions = useCallback(
|
720
|
+
(params) => __async(void 0, null, function* () {
|
721
|
+
resolvePermissions(params, true);
|
722
|
+
}),
|
723
|
+
[config, appState]
|
724
|
+
);
|
725
|
+
useEffect(() => {
|
726
|
+
resolvePermissions();
|
727
|
+
}, [config, appState.data]);
|
728
|
+
const getPermissions = useCallback(
|
729
|
+
({ item, type, root } = {}) => {
|
730
|
+
if (item) {
|
731
|
+
const componentConfig = config.components[item.type];
|
732
|
+
const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
|
733
|
+
const resolvedForItem = resolvedPermissions[item.props.id];
|
734
|
+
return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
|
735
|
+
} else if (type) {
|
736
|
+
const componentConfig = config.components[type];
|
737
|
+
return __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
|
738
|
+
} else if (root) {
|
739
|
+
const rootConfig = config.root;
|
740
|
+
const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), rootConfig == null ? void 0 : rootConfig.permissions);
|
741
|
+
const resolvedForItem = resolvedPermissions["puck-root"];
|
742
|
+
return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
|
743
|
+
}
|
744
|
+
return globalPermissions;
|
745
|
+
},
|
746
|
+
[config, resolvedPermissions]
|
747
|
+
);
|
748
|
+
return {
|
749
|
+
getPermissions,
|
750
|
+
refreshPermissions
|
751
|
+
};
|
752
|
+
};
|
753
|
+
|
754
|
+
// lib/use-resolved-data.ts
|
755
|
+
init_react_import();
|
756
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useState as useState3 } from "react";
|
757
|
+
|
758
|
+
// lib/resolve-component-data.ts
|
759
|
+
init_react_import();
|
760
|
+
var cache = { lastChange: {} };
|
761
|
+
var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
|
762
|
+
return yield Promise.all(
|
763
|
+
content.map((item) => __async(void 0, null, function* () {
|
764
|
+
return yield resolveComponentData(
|
765
|
+
item,
|
766
|
+
config,
|
767
|
+
onResolveStart,
|
768
|
+
onResolveEnd
|
769
|
+
);
|
770
|
+
}))
|
771
|
+
);
|
772
|
+
});
|
773
|
+
var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
|
774
|
+
const configForItem = config.components[item.type];
|
775
|
+
if (configForItem.resolveData) {
|
776
|
+
const { item: oldItem = null, resolved = {} } = cache.lastChange[item.props.id] || {};
|
777
|
+
if (item && item === oldItem) {
|
778
|
+
return resolved;
|
779
|
+
}
|
780
|
+
const changed = getChanged(item, oldItem);
|
781
|
+
if (onResolveStart) {
|
782
|
+
onResolveStart(item);
|
783
|
+
}
|
784
|
+
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, { changed, lastData: oldItem });
|
785
|
+
const { readOnly: existingReadOnly = {} } = item || {};
|
786
|
+
const newReadOnly = __spreadValues(__spreadValues({}, existingReadOnly), readOnly);
|
787
|
+
const resolvedItem = __spreadProps(__spreadValues({}, item), {
|
788
|
+
props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
|
789
|
+
});
|
790
|
+
if (Object.keys(newReadOnly).length) {
|
791
|
+
resolvedItem.readOnly = newReadOnly;
|
792
|
+
}
|
793
|
+
cache.lastChange[item.props.id] = {
|
794
|
+
item,
|
795
|
+
resolved: resolvedItem
|
796
|
+
};
|
797
|
+
if (onResolveEnd) {
|
798
|
+
onResolveEnd(resolvedItem);
|
799
|
+
}
|
800
|
+
return resolvedItem;
|
801
|
+
}
|
802
|
+
return item;
|
803
|
+
});
|
804
|
+
|
805
|
+
// lib/apply-dynamic-props.ts
|
806
|
+
init_react_import();
|
807
|
+
var applyDynamicProps = (data, dynamicProps, rootData) => {
|
808
|
+
return __spreadProps(__spreadValues({}, data), {
|
809
|
+
root: __spreadValues(__spreadValues({}, data.root), rootData ? rootData : {}),
|
810
|
+
content: data.content.map((item) => {
|
811
|
+
return dynamicProps[item.props.id] ? __spreadValues(__spreadValues({}, item), dynamicProps[item.props.id]) : item;
|
812
|
+
}),
|
813
|
+
zones: Object.keys(data.zones || {}).reduce((acc, zoneKey) => {
|
814
|
+
return __spreadProps(__spreadValues({}, acc), {
|
815
|
+
[zoneKey]: data.zones[zoneKey].map((item) => {
|
816
|
+
return dynamicProps[item.props.id] ? __spreadValues(__spreadValues({}, item), dynamicProps[item.props.id]) : item;
|
817
|
+
})
|
818
|
+
});
|
819
|
+
}, {})
|
820
|
+
});
|
821
|
+
};
|
822
|
+
|
823
|
+
// lib/resolve-root-data.ts
|
824
|
+
init_react_import();
|
825
|
+
var cache2 = {};
|
826
|
+
function resolveRootData(data, config) {
|
827
|
+
return __async(this, null, function* () {
|
828
|
+
var _a, _b, _c, _d, _e;
|
829
|
+
if (((_a = config.root) == null ? void 0 : _a.resolveData) && data.root.props) {
|
830
|
+
if (((_b = cache2.lastChange) == null ? void 0 : _b.original) === data.root) {
|
831
|
+
return cache2.lastChange.resolved;
|
832
|
+
}
|
833
|
+
const changed = getChanged(data.root, (_c = cache2.lastChange) == null ? void 0 : _c.original);
|
834
|
+
const rootWithProps = data.root;
|
835
|
+
const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
|
836
|
+
changed,
|
837
|
+
lastData: ((_d = cache2.lastChange) == null ? void 0 : _d.original) || {}
|
838
|
+
});
|
839
|
+
cache2.lastChange = {
|
840
|
+
original: data.root,
|
841
|
+
resolved: resolvedRoot
|
842
|
+
};
|
843
|
+
return __spreadProps(__spreadValues(__spreadValues({}, data.root), resolvedRoot), {
|
844
|
+
props: __spreadValues(__spreadValues({}, data.root.props), resolvedRoot.props)
|
845
|
+
});
|
846
|
+
}
|
847
|
+
return data.root;
|
848
|
+
});
|
849
|
+
}
|
850
|
+
|
851
|
+
// lib/use-resolved-data.ts
|
852
|
+
var useResolvedData = (appState, config, dispatch, setComponentLoading, unsetComponentLoading, refreshPermissions) => {
|
853
|
+
const [{ resolverKey, newAppState }, setResolverState] = useState3({
|
854
|
+
resolverKey: 0,
|
855
|
+
newAppState: appState
|
856
|
+
});
|
857
|
+
const deferredSetStates = {};
|
858
|
+
const _setComponentLoading = useCallback2(
|
859
|
+
(id, loading, defer2 = 0) => {
|
860
|
+
if (deferredSetStates[id]) {
|
861
|
+
clearTimeout(deferredSetStates[id]);
|
862
|
+
delete deferredSetStates[id];
|
863
|
+
}
|
864
|
+
deferredSetStates[id] = setTimeout(() => {
|
865
|
+
if (loading) {
|
866
|
+
setComponentLoading(id);
|
867
|
+
} else {
|
868
|
+
unsetComponentLoading(id);
|
869
|
+
}
|
870
|
+
delete deferredSetStates[id];
|
871
|
+
}, defer2);
|
872
|
+
},
|
873
|
+
[]
|
874
|
+
);
|
875
|
+
const runResolvers = () => __async(void 0, null, function* () {
|
876
|
+
const newData = newAppState.data;
|
877
|
+
const flatContent = flattenData(newData).filter(
|
878
|
+
(item) => {
|
879
|
+
var _a;
|
880
|
+
return !!((_a = config.components[item.type]) == null ? void 0 : _a.resolveData);
|
881
|
+
}
|
882
|
+
);
|
883
|
+
const applyIfChange = (dynamicDataMap, dynamicRoot) => {
|
884
|
+
const processed = applyDynamicProps(
|
885
|
+
appState.data,
|
886
|
+
dynamicDataMap,
|
887
|
+
dynamicRoot
|
888
|
+
);
|
889
|
+
const processedAppState = __spreadProps(__spreadValues({}, appState), { data: processed });
|
890
|
+
const containsChanges = JSON.stringify(appState) !== JSON.stringify(processedAppState);
|
891
|
+
if (containsChanges) {
|
892
|
+
dispatch({
|
893
|
+
type: "set",
|
894
|
+
state: (prev) => __spreadProps(__spreadValues({}, prev), {
|
895
|
+
data: applyDynamicProps(prev.data, dynamicDataMap, dynamicRoot),
|
896
|
+
ui: resolverKey > 0 ? __spreadValues(__spreadValues({}, prev.ui), newAppState.ui) : prev.ui
|
897
|
+
}),
|
898
|
+
recordHistory: resolverKey > 0
|
899
|
+
});
|
900
|
+
}
|
901
|
+
};
|
902
|
+
const promises = [];
|
903
|
+
promises.push(
|
904
|
+
(() => __async(void 0, null, function* () {
|
905
|
+
_setComponentLoading("puck-root", true, 50);
|
906
|
+
const dynamicRoot = yield resolveRootData(newData, config);
|
907
|
+
applyIfChange({}, dynamicRoot);
|
908
|
+
_setComponentLoading("puck-root", false);
|
909
|
+
}))()
|
910
|
+
);
|
911
|
+
flatContent.forEach((item) => {
|
912
|
+
promises.push(
|
913
|
+
(() => __async(void 0, null, function* () {
|
914
|
+
refreshPermissions({ item });
|
915
|
+
const dynamicData = yield resolveComponentData(
|
916
|
+
item,
|
917
|
+
config,
|
918
|
+
(item2) => {
|
919
|
+
_setComponentLoading(item2.props.id, true, 50);
|
920
|
+
},
|
921
|
+
(item2) => {
|
922
|
+
deferredSetStates[item2.props.id];
|
923
|
+
_setComponentLoading(item2.props.id, false);
|
924
|
+
}
|
925
|
+
);
|
926
|
+
const dynamicDataMap = { [item.props.id]: dynamicData };
|
927
|
+
applyIfChange(dynamicDataMap);
|
928
|
+
}))()
|
929
|
+
);
|
930
|
+
});
|
931
|
+
yield Promise.all(promises);
|
932
|
+
});
|
933
|
+
useEffect2(() => {
|
934
|
+
runResolvers();
|
935
|
+
}, [resolverKey]);
|
936
|
+
const resolveData = useCallback2((newAppState2 = appState) => {
|
937
|
+
setResolverState((curr) => ({
|
938
|
+
resolverKey: curr.resolverKey + 1,
|
939
|
+
newAppState: newAppState2
|
940
|
+
}));
|
941
|
+
}, []);
|
942
|
+
return {
|
943
|
+
resolveData
|
944
|
+
};
|
945
|
+
};
|
946
|
+
|
947
|
+
// components/Puck/context.tsx
|
620
948
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
621
949
|
var defaultAppState = {
|
622
950
|
data: { content: [], root: {} },
|
@@ -642,6 +970,8 @@ var defaultContext = {
|
|
642
970
|
dispatch: () => null,
|
643
971
|
config: { components: {} },
|
644
972
|
componentState: {},
|
973
|
+
setComponentState: () => {
|
974
|
+
},
|
645
975
|
resolveData: () => {
|
646
976
|
},
|
647
977
|
plugins: [],
|
@@ -658,20 +988,22 @@ var defaultContext = {
|
|
658
988
|
setStatus: () => null,
|
659
989
|
iframe: {},
|
660
990
|
safariFallbackMode: false,
|
661
|
-
globalPermissions: {}
|
991
|
+
globalPermissions: {},
|
992
|
+
getPermissions: () => ({}),
|
993
|
+
refreshPermissions: () => null
|
662
994
|
};
|
663
995
|
var appContext = createContext(defaultContext);
|
664
996
|
var AppProvider = ({
|
665
997
|
children,
|
666
998
|
value
|
667
999
|
}) => {
|
668
|
-
const [zoomConfig, setZoomConfig] =
|
669
|
-
const [status, setStatus] =
|
670
|
-
|
1000
|
+
const [zoomConfig, setZoomConfig] = useState4(defaultContext.zoomConfig);
|
1001
|
+
const [status, setStatus] = useState4("LOADING");
|
1002
|
+
useEffect3(() => {
|
671
1003
|
setStatus("MOUNTED");
|
672
1004
|
}, []);
|
673
|
-
const [safariFallbackMode, setSafariFallbackMode] =
|
674
|
-
|
1005
|
+
const [safariFallbackMode, setSafariFallbackMode] = useState4(false);
|
1006
|
+
useEffect3(() => {
|
675
1007
|
var _a, _b, _c;
|
676
1008
|
const ua = new UAParser(navigator.userAgent);
|
677
1009
|
const { browser } = ua.getResult();
|
@@ -688,15 +1020,58 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
688
1020
|
setSafariFallbackMode(true);
|
689
1021
|
}
|
690
1022
|
}, []);
|
1023
|
+
const selectedItem = value.state.ui.itemSelector ? getItem(value.state.ui.itemSelector, value.state.data) : void 0;
|
1024
|
+
const [componentState, setComponentState] = useState4({});
|
1025
|
+
const setComponentLoading = (id) => {
|
1026
|
+
setComponentState((prev) => {
|
1027
|
+
var _a;
|
1028
|
+
return __spreadProps(__spreadValues({}, prev), {
|
1029
|
+
[id]: __spreadProps(__spreadValues({}, prev[id]), {
|
1030
|
+
loadingCount: (((_a = prev[id]) == null ? void 0 : _a.loadingCount) || 0) + 1
|
1031
|
+
})
|
1032
|
+
});
|
1033
|
+
});
|
1034
|
+
};
|
1035
|
+
const unsetComponentLoading = (id) => {
|
1036
|
+
setComponentState((prev) => {
|
1037
|
+
var _a;
|
1038
|
+
return __spreadProps(__spreadValues({}, prev), {
|
1039
|
+
[id]: __spreadProps(__spreadValues({}, prev[id]), {
|
1040
|
+
loadingCount: Math.max((((_a = prev[id]) == null ? void 0 : _a.loadingCount) || 0) - 1, 0)
|
1041
|
+
})
|
1042
|
+
});
|
1043
|
+
});
|
1044
|
+
};
|
1045
|
+
const { getPermissions, refreshPermissions } = useResolvedPermissions(
|
1046
|
+
value.config,
|
1047
|
+
value.state,
|
1048
|
+
value.globalPermissions || {},
|
1049
|
+
setComponentLoading,
|
1050
|
+
unsetComponentLoading
|
1051
|
+
);
|
1052
|
+
const { resolveData } = useResolvedData(
|
1053
|
+
value.state,
|
1054
|
+
value.config,
|
1055
|
+
value.dispatch,
|
1056
|
+
setComponentLoading,
|
1057
|
+
unsetComponentLoading,
|
1058
|
+
refreshPermissions
|
1059
|
+
);
|
691
1060
|
return /* @__PURE__ */ jsx4(
|
692
1061
|
appContext.Provider,
|
693
1062
|
{
|
694
1063
|
value: __spreadProps(__spreadValues({}, value), {
|
1064
|
+
selectedItem,
|
695
1065
|
zoomConfig,
|
696
1066
|
setZoomConfig,
|
697
1067
|
status,
|
698
1068
|
setStatus,
|
699
|
-
safariFallbackMode
|
1069
|
+
safariFallbackMode,
|
1070
|
+
getPermissions,
|
1071
|
+
refreshPermissions,
|
1072
|
+
componentState,
|
1073
|
+
setComponentState,
|
1074
|
+
resolveData
|
700
1075
|
}),
|
701
1076
|
children
|
702
1077
|
}
|
@@ -704,10 +1079,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
704
1079
|
};
|
705
1080
|
function useAppContext() {
|
706
1081
|
const mainContext = useContext(appContext);
|
707
|
-
const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
|
708
1082
|
return __spreadProps(__spreadValues({}, mainContext), {
|
709
1083
|
// Helpers
|
710
|
-
selectedItem,
|
711
1084
|
setUi: (ui, recordHistory) => {
|
712
1085
|
return mainContext.dispatch({
|
713
1086
|
type: "setUi",
|
@@ -811,7 +1184,7 @@ var Draggable = ({
|
|
811
1184
|
};
|
812
1185
|
|
813
1186
|
// components/AutoField/fields/ArrayField/index.tsx
|
814
|
-
import { useCallback, useEffect as
|
1187
|
+
import { useCallback as useCallback3, useEffect as useEffect4, useState as useState5 } from "react";
|
815
1188
|
|
816
1189
|
// components/DragIcon/index.tsx
|
817
1190
|
init_react_import();
|
@@ -852,7 +1225,7 @@ var ArrayField = ({
|
|
852
1225
|
id,
|
853
1226
|
Label = (props) => /* @__PURE__ */ jsx9("div", __spreadValues({}, props))
|
854
1227
|
}) => {
|
855
|
-
const { state, setUi, selectedItem } = useAppContext();
|
1228
|
+
const { state, setUi, selectedItem, getPermissions } = useAppContext();
|
856
1229
|
const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
|
857
1230
|
const value = _value;
|
858
1231
|
const arrayState = state.ui.arrayState[id] || {
|
@@ -864,11 +1237,11 @@ var ArrayField = ({
|
|
864
1237
|
}),
|
865
1238
|
openId: ""
|
866
1239
|
};
|
867
|
-
const [localState, setLocalState] =
|
868
|
-
|
1240
|
+
const [localState, setLocalState] = useState5({ arrayState, value });
|
1241
|
+
useEffect4(() => {
|
869
1242
|
setLocalState({ arrayState, value });
|
870
1243
|
}, [value, state.ui.arrayState[id]]);
|
871
|
-
const mapArrayStateToUi =
|
1244
|
+
const mapArrayStateToUi = useCallback3(
|
872
1245
|
(partialArrayState) => {
|
873
1246
|
return {
|
874
1247
|
arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
|
@@ -878,13 +1251,13 @@ var ArrayField = ({
|
|
878
1251
|
},
|
879
1252
|
[arrayState]
|
880
1253
|
);
|
881
|
-
const getHighestIndex =
|
1254
|
+
const getHighestIndex = useCallback3(() => {
|
882
1255
|
return arrayState.items.reduce(
|
883
1256
|
(acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
|
884
1257
|
-1
|
885
1258
|
);
|
886
1259
|
}, [arrayState]);
|
887
|
-
const regenerateArrayState =
|
1260
|
+
const regenerateArrayState = useCallback3(
|
888
1261
|
(value2) => {
|
889
1262
|
let highestIndex = getHighestIndex();
|
890
1263
|
const newItems = Array.from(value2 || []).map((item, idx) => {
|
@@ -903,12 +1276,13 @@ var ArrayField = ({
|
|
903
1276
|
},
|
904
1277
|
[arrayState]
|
905
1278
|
);
|
906
|
-
|
1279
|
+
useEffect4(() => {
|
907
1280
|
if (arrayState.items.length > 0) {
|
908
1281
|
setUi(mapArrayStateToUi(arrayState));
|
909
1282
|
}
|
910
1283
|
}, []);
|
911
|
-
const [hovering, setHovering] =
|
1284
|
+
const [hovering, setHovering] = useState5(false);
|
1285
|
+
const forceReadOnly = getPermissions({ item: selectedItem }).edit === false;
|
912
1286
|
if (field.type !== "array" || !field.arrayFields) {
|
913
1287
|
return null;
|
914
1288
|
}
|
@@ -1039,13 +1413,14 @@ var ArrayField = ({
|
|
1039
1413
|
const subField = field.arrayFields[fieldName];
|
1040
1414
|
const subFieldName = `${name}[${i}].${fieldName}`;
|
1041
1415
|
const wildcardFieldName = `${name}[*].${fieldName}`;
|
1416
|
+
const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName];
|
1042
1417
|
return /* @__PURE__ */ jsx9(
|
1043
1418
|
AutoFieldPrivate,
|
1044
1419
|
{
|
1045
1420
|
name: subFieldName,
|
1046
1421
|
label: subField.label || fieldName,
|
1047
1422
|
id: `${_arrayId}_${fieldName}`,
|
1048
|
-
readOnly:
|
1423
|
+
readOnly: subReadOnly,
|
1049
1424
|
field: subField,
|
1050
1425
|
value: data[fieldName],
|
1051
1426
|
onChange: (val, ui) => {
|
@@ -1145,19 +1520,19 @@ var DefaultField = ({
|
|
1145
1520
|
|
1146
1521
|
// components/AutoField/fields/ExternalField/index.tsx
|
1147
1522
|
init_react_import();
|
1148
|
-
import { useEffect as
|
1523
|
+
import { useEffect as useEffect8 } from "react";
|
1149
1524
|
|
1150
1525
|
// components/ExternalInput/index.tsx
|
1151
1526
|
init_react_import();
|
1152
|
-
import { useMemo, useEffect as
|
1527
|
+
import { useMemo, useEffect as useEffect7, useState as useState8, useCallback as useCallback4 } from "react";
|
1153
1528
|
|
1154
1529
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
1155
1530
|
init_react_import();
|
1156
|
-
var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-
|
1531
|
+
var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_wprq3_1", "ExternalInput-button": "_ExternalInput-button_wprq3_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_wprq3_24", "ExternalInput--readOnly": "_ExternalInput--readOnly_wprq3_31", "ExternalInput-detachButton": "_ExternalInput-detachButton_wprq3_35", "ExternalInput": "_ExternalInput_wprq3_1", "ExternalInputModal": "_ExternalInputModal_wprq3_79", "ExternalInputModal-grid": "_ExternalInputModal-grid_wprq3_89", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_wprq3_100", "ExternalInputModal-filters": "_ExternalInputModal-filters_wprq3_105", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_wprq3_124", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_wprq3_133", "ExternalInputModal-table": "_ExternalInputModal-table_wprq3_133", "ExternalInputModal-thead": "_ExternalInputModal-thead_wprq3_149", "ExternalInputModal-th": "_ExternalInputModal-th_wprq3_149", "ExternalInputModal-td": "_ExternalInputModal-td_wprq3_164", "ExternalInputModal-tr": "_ExternalInputModal-tr_wprq3_169", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_wprq3_176", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_wprq3_202", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_wprq3_206", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_wprq3_223", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_wprq3_227", "ExternalInputModal-search": "_ExternalInputModal-search_wprq3_227", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_wprq3_264", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_wprq3_289", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_wprq3_299", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_wprq3_313", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_wprq3_326", "ExternalInputModal-footer": "_ExternalInputModal-footer_wprq3_330" };
|
1157
1532
|
|
1158
1533
|
// components/Modal/index.tsx
|
1159
1534
|
init_react_import();
|
1160
|
-
import { useEffect as
|
1535
|
+
import { useEffect as useEffect5, useState as useState6 } from "react";
|
1161
1536
|
|
1162
1537
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
1163
1538
|
init_react_import();
|
@@ -1172,8 +1547,8 @@ var Modal = ({
|
|
1172
1547
|
onClose,
|
1173
1548
|
isOpen
|
1174
1549
|
}) => {
|
1175
|
-
const [rootEl, setRootEl] =
|
1176
|
-
|
1550
|
+
const [rootEl, setRootEl] = useState6(null);
|
1551
|
+
useEffect5(() => {
|
1177
1552
|
setRootEl(document.getElementById("puck-portal-root"));
|
1178
1553
|
}, []);
|
1179
1554
|
if (!rootEl) {
|
@@ -1220,7 +1595,7 @@ init_react_import();
|
|
1220
1595
|
|
1221
1596
|
// components/Button/Button.tsx
|
1222
1597
|
init_react_import();
|
1223
|
-
import { useEffect as
|
1598
|
+
import { useEffect as useEffect6, useState as useState7 } from "react";
|
1224
1599
|
|
1225
1600
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
|
1226
1601
|
init_react_import();
|
@@ -1243,8 +1618,8 @@ var Button = ({
|
|
1243
1618
|
size = "medium",
|
1244
1619
|
loading: loadingProp = false
|
1245
1620
|
}) => {
|
1246
|
-
const [loading, setLoading] =
|
1247
|
-
|
1621
|
+
const [loading, setLoading] = useState7(loadingProp);
|
1622
|
+
useEffect6(() => setLoading(loadingProp), [loadingProp]);
|
1248
1623
|
const ElementType = href ? "a" : type ? "button" : "span";
|
1249
1624
|
const el = /* @__PURE__ */ jsxs6(
|
1250
1625
|
ElementType,
|
@@ -1289,19 +1664,20 @@ var ExternalInput = ({
|
|
1289
1664
|
onChange,
|
1290
1665
|
value = null,
|
1291
1666
|
name,
|
1292
|
-
id
|
1667
|
+
id,
|
1668
|
+
readOnly
|
1293
1669
|
}) => {
|
1294
1670
|
const {
|
1295
1671
|
mapProp = (val) => val,
|
1296
1672
|
mapRow = (val) => val,
|
1297
1673
|
filterFields
|
1298
1674
|
} = field || {};
|
1299
|
-
const [data, setData] =
|
1300
|
-
const [isOpen, setOpen] =
|
1301
|
-
const [isLoading, setIsLoading] =
|
1675
|
+
const [data, setData] = useState8([]);
|
1676
|
+
const [isOpen, setOpen] = useState8(false);
|
1677
|
+
const [isLoading, setIsLoading] = useState8(true);
|
1302
1678
|
const hasFilterFields = !!filterFields;
|
1303
|
-
const [filters, setFilters] =
|
1304
|
-
const [filtersToggled, setFiltersToggled] =
|
1679
|
+
const [filters, setFilters] = useState8(field.initialFilters || {});
|
1680
|
+
const [filtersToggled, setFiltersToggled] = useState8(hasFilterFields);
|
1305
1681
|
const mappedData = useMemo(() => {
|
1306
1682
|
return data.map(mapRow);
|
1307
1683
|
}, [data]);
|
@@ -1316,8 +1692,8 @@ var ExternalInput = ({
|
|
1316
1692
|
}
|
1317
1693
|
return Array.from(validKeys);
|
1318
1694
|
}, [mappedData]);
|
1319
|
-
const [searchQuery, setSearchQuery] =
|
1320
|
-
const search =
|
1695
|
+
const [searchQuery, setSearchQuery] = useState8(field.initialQuery || "");
|
1696
|
+
const search = useCallback4(
|
1321
1697
|
(query, filters2) => __async(void 0, null, function* () {
|
1322
1698
|
setIsLoading(true);
|
1323
1699
|
const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
|
@@ -1330,7 +1706,7 @@ var ExternalInput = ({
|
|
1330
1706
|
}),
|
1331
1707
|
[id, field]
|
1332
1708
|
);
|
1333
|
-
|
1709
|
+
useEffect7(() => {
|
1334
1710
|
search(searchQuery, filters);
|
1335
1711
|
}, []);
|
1336
1712
|
return /* @__PURE__ */ jsxs7(
|
@@ -1338,7 +1714,8 @@ var ExternalInput = ({
|
|
1338
1714
|
{
|
1339
1715
|
className: getClassName10({
|
1340
1716
|
dataSelected: !!value,
|
1341
|
-
modalVisible: isOpen
|
1717
|
+
modalVisible: isOpen,
|
1718
|
+
readOnly
|
1342
1719
|
}),
|
1343
1720
|
id,
|
1344
1721
|
children: [
|
@@ -1349,6 +1726,7 @@ var ExternalInput = ({
|
|
1349
1726
|
type: "button",
|
1350
1727
|
onClick: () => setOpen(true),
|
1351
1728
|
className: getClassName10("button"),
|
1729
|
+
disabled: readOnly,
|
1352
1730
|
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ jsxs7(Fragment7, { children: [
|
1353
1731
|
/* @__PURE__ */ jsx14(Link, { size: "16" }),
|
1354
1732
|
/* @__PURE__ */ jsx14("span", { children: field.placeholder })
|
@@ -1363,6 +1741,7 @@ var ExternalInput = ({
|
|
1363
1741
|
onClick: () => {
|
1364
1742
|
onChange(null);
|
1365
1743
|
},
|
1744
|
+
disabled: readOnly,
|
1366
1745
|
children: /* @__PURE__ */ jsx14(Unlock, { size: 16 })
|
1367
1746
|
}
|
1368
1747
|
)
|
@@ -1488,12 +1867,13 @@ var ExternalField = ({
|
|
1488
1867
|
name,
|
1489
1868
|
label,
|
1490
1869
|
Label,
|
1491
|
-
id
|
1870
|
+
id,
|
1871
|
+
readOnly
|
1492
1872
|
}) => {
|
1493
1873
|
var _a, _b, _c;
|
1494
1874
|
const validField = field;
|
1495
1875
|
const deprecatedField = field;
|
1496
|
-
|
1876
|
+
useEffect8(() => {
|
1497
1877
|
if (deprecatedField.adaptor) {
|
1498
1878
|
console.error(
|
1499
1879
|
"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."
|
@@ -1520,7 +1900,8 @@ var ExternalField = ({
|
|
1520
1900
|
}),
|
1521
1901
|
onChange,
|
1522
1902
|
value,
|
1523
|
-
id
|
1903
|
+
id,
|
1904
|
+
readOnly
|
1524
1905
|
}
|
1525
1906
|
) });
|
1526
1907
|
};
|
@@ -1701,13 +2082,14 @@ var ObjectField = ({
|
|
1701
2082
|
const subField = field.objectFields[fieldName];
|
1702
2083
|
const subFieldName = `${name}.${fieldName}`;
|
1703
2084
|
const wildcardFieldName = `${name}.${fieldName}`;
|
2085
|
+
const subReadOnly = readOnly ? readOnly : typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName];
|
1704
2086
|
return /* @__PURE__ */ jsx19(
|
1705
2087
|
AutoFieldPrivate,
|
1706
2088
|
{
|
1707
2089
|
name: subFieldName,
|
1708
2090
|
label: subField.label || fieldName,
|
1709
2091
|
id: `${id}_${fieldName}`,
|
1710
|
-
readOnly:
|
2092
|
+
readOnly: subReadOnly,
|
1711
2093
|
field: subField,
|
1712
2094
|
value: data[fieldName],
|
1713
2095
|
onChange: (val, ui) => {
|
@@ -1728,7 +2110,7 @@ var ObjectField = ({
|
|
1728
2110
|
|
1729
2111
|
// lib/use-safe-id.ts
|
1730
2112
|
init_react_import();
|
1731
|
-
import React2, { useState as
|
2113
|
+
import React2, { useState as useState9 } from "react";
|
1732
2114
|
|
1733
2115
|
// lib/generate-id.ts
|
1734
2116
|
init_react_import();
|
@@ -1740,7 +2122,7 @@ var useSafeId = () => {
|
|
1740
2122
|
if (typeof React2.useId !== "undefined") {
|
1741
2123
|
return React2.useId();
|
1742
2124
|
}
|
1743
|
-
const [id] =
|
2125
|
+
const [id] = useState9(generateId());
|
1744
2126
|
return id;
|
1745
2127
|
};
|
1746
2128
|
|
@@ -1837,7 +2219,7 @@ function AutoFieldInternal(props) {
|
|
1837
2219
|
}
|
1838
2220
|
function AutoFieldPrivate(props) {
|
1839
2221
|
const { value, onChange } = props;
|
1840
|
-
const [localValue, setLocalValue] =
|
2222
|
+
const [localValue, setLocalValue] = useState10(value);
|
1841
2223
|
const onChangeDb = useDebouncedCallback(
|
1842
2224
|
(val, ui) => {
|
1843
2225
|
onChange(val, ui);
|
@@ -1845,11 +2227,11 @@ function AutoFieldPrivate(props) {
|
|
1845
2227
|
50,
|
1846
2228
|
{ leading: true }
|
1847
2229
|
);
|
1848
|
-
const onChangeLocal =
|
2230
|
+
const onChangeLocal = useCallback5((val, ui) => {
|
1849
2231
|
setLocalValue(val);
|
1850
2232
|
onChangeDb(val, ui);
|
1851
2233
|
}, []);
|
1852
|
-
|
2234
|
+
useEffect9(() => {
|
1853
2235
|
setLocalValue(value);
|
1854
2236
|
}, [value]);
|
1855
2237
|
const localProps = {
|
@@ -1868,7 +2250,7 @@ init_react_import();
|
|
1868
2250
|
|
1869
2251
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
|
1870
2252
|
init_react_import();
|
1871
|
-
var styles_module_default10 = { "Drawer": "
|
2253
|
+
var styles_module_default10 = { "Drawer": "_Drawer_1oa7v_1", "DrawerItem--disabled": "_DrawerItem--disabled_1oa7v_5", "DrawerItem-draggable": "_DrawerItem-draggable_1oa7v_5", "DrawerItem-default": "_DrawerItem-default_1oa7v_11", "DrawerItem-draggableWrapper": "_DrawerItem-draggableWrapper_1oa7v_11", "DrawerItem": "_DrawerItem_1oa7v_5", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_1oa7v_36", "DrawerItem-name": "_DrawerItem-name_1oa7v_54" };
|
1872
2254
|
|
1873
2255
|
// components/Drawer/index.tsx
|
1874
2256
|
import {
|
@@ -1953,14 +2335,14 @@ Drawer.Item = DrawerItem;
|
|
1953
2335
|
|
1954
2336
|
// components/DropZone/index.tsx
|
1955
2337
|
init_react_import();
|
1956
|
-
import { useContext as useContext3, useEffect as
|
2338
|
+
import { useContext as useContext3, useEffect as useEffect12 } from "react";
|
1957
2339
|
|
1958
2340
|
// components/DraggableComponent/index.tsx
|
1959
2341
|
init_react_import();
|
1960
2342
|
import {
|
1961
|
-
useEffect as
|
2343
|
+
useEffect as useEffect11,
|
1962
2344
|
useMemo as useMemo4,
|
1963
|
-
useState as
|
2345
|
+
useState as useState12
|
1964
2346
|
} from "react";
|
1965
2347
|
import { Draggable as Draggable2 } from "@measured/dnd";
|
1966
2348
|
|
@@ -1970,10 +2352,10 @@ var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_1bhad
|
|
1970
2352
|
|
1971
2353
|
// lib/use-modifier-held.ts
|
1972
2354
|
init_react_import();
|
1973
|
-
import { useEffect as
|
2355
|
+
import { useEffect as useEffect10, useState as useState11 } from "react";
|
1974
2356
|
var useModifierHeld = (modifier) => {
|
1975
|
-
const [modifierHeld, setModifierHeld] =
|
1976
|
-
|
2357
|
+
const [modifierHeld, setModifierHeld] = useState11(false);
|
2358
|
+
useEffect10(() => {
|
1977
2359
|
function downHandler({ key }) {
|
1978
2360
|
if (key === modifier) {
|
1979
2361
|
setModifierHeld(true);
|
@@ -2011,90 +2393,6 @@ init_react_import();
|
|
2011
2393
|
import { Fragment as Fragment9, jsx as jsx22 } from "react/jsx-runtime";
|
2012
2394
|
var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx22(Fragment9, { children });
|
2013
2395
|
|
2014
|
-
// lib/get-permissions.ts
|
2015
|
-
init_react_import();
|
2016
|
-
|
2017
|
-
// lib/get-changed.ts
|
2018
|
-
init_react_import();
|
2019
|
-
var getChanged = (newItem, oldItem) => {
|
2020
|
-
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
2021
|
-
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
2022
|
-
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
2023
|
-
return __spreadProps(__spreadValues({}, acc), {
|
2024
|
-
[item]: oldItemProps[item] !== newItemProps[item]
|
2025
|
-
});
|
2026
|
-
}, {}) : {};
|
2027
|
-
};
|
2028
|
-
|
2029
|
-
// lib/resolve-permissions.ts
|
2030
|
-
init_react_import();
|
2031
|
-
var resolvePermissions = ({
|
2032
|
-
selectedItem,
|
2033
|
-
config,
|
2034
|
-
changed,
|
2035
|
-
lastPermissions,
|
2036
|
-
initialPermissions,
|
2037
|
-
appState
|
2038
|
-
}) => {
|
2039
|
-
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
2040
|
-
if (selectedItem && (componentConfig == null ? void 0 : componentConfig.resolvePermissions)) {
|
2041
|
-
return componentConfig.resolvePermissions(selectedItem, {
|
2042
|
-
changed,
|
2043
|
-
lastPermissions,
|
2044
|
-
initialPermissions,
|
2045
|
-
appState
|
2046
|
-
});
|
2047
|
-
}
|
2048
|
-
return {};
|
2049
|
-
};
|
2050
|
-
|
2051
|
-
// lib/get-permissions.ts
|
2052
|
-
var cache = { lastPermissions: {}, lastSelected: {} };
|
2053
|
-
var getPermissions = ({
|
2054
|
-
selectedItem,
|
2055
|
-
type,
|
2056
|
-
globalPermissions,
|
2057
|
-
config,
|
2058
|
-
appState
|
2059
|
-
}) => {
|
2060
|
-
const componentType = type || selectedItem && selectedItem.type || "";
|
2061
|
-
const componentId = selectedItem && selectedItem.props.id || "";
|
2062
|
-
let componentPermissions = getInitialPermissions({
|
2063
|
-
componentType,
|
2064
|
-
config,
|
2065
|
-
globalPermissions
|
2066
|
-
});
|
2067
|
-
const changed = getChanged(selectedItem, cache.lastSelected);
|
2068
|
-
if (Object.values(changed).some((el) => el === true)) {
|
2069
|
-
const resolvedPermissions = resolvePermissions({
|
2070
|
-
selectedItem,
|
2071
|
-
config,
|
2072
|
-
changed,
|
2073
|
-
lastPermissions: cache.lastPermissions[componentId] || componentPermissions,
|
2074
|
-
initialPermissions: componentPermissions,
|
2075
|
-
appState
|
2076
|
-
});
|
2077
|
-
if (resolvedPermissions !== void 0) {
|
2078
|
-
componentPermissions = __spreadValues(__spreadValues({}, componentPermissions), resolvedPermissions);
|
2079
|
-
}
|
2080
|
-
cache.lastSelected = selectedItem;
|
2081
|
-
cache.lastPermissions[componentId] = componentPermissions;
|
2082
|
-
return componentPermissions;
|
2083
|
-
}
|
2084
|
-
if (Object.keys(componentId && cache.lastPermissions[componentId]).length !== 0) {
|
2085
|
-
componentPermissions = cache.lastPermissions[componentId];
|
2086
|
-
}
|
2087
|
-
return componentPermissions;
|
2088
|
-
};
|
2089
|
-
var getInitialPermissions = ({
|
2090
|
-
componentType,
|
2091
|
-
globalPermissions,
|
2092
|
-
config
|
2093
|
-
}) => {
|
2094
|
-
var _a;
|
2095
|
-
return __spreadValues(__spreadValues({}, globalPermissions), (_a = config.components[componentType]) == null ? void 0 : _a.permissions);
|
2096
|
-
};
|
2097
|
-
|
2098
2396
|
// components/DraggableComponent/index.tsx
|
2099
2397
|
import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
|
2100
2398
|
var getClassName17 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
|
@@ -2105,7 +2403,7 @@ var actionsRight = space;
|
|
2105
2403
|
var DefaultActionBar = ({
|
2106
2404
|
label,
|
2107
2405
|
children
|
2108
|
-
}) => /* @__PURE__ */ jsx23(ActionBar, { label, children: /* @__PURE__ */ jsx23(DefaultOverride, { children }) });
|
2406
|
+
}) => /* @__PURE__ */ jsx23(ActionBar, { label, children: /* @__PURE__ */ jsx23(ActionBar.Group, { children: /* @__PURE__ */ jsx23(DefaultOverride, { children }) }) });
|
2109
2407
|
var DraggableComponent = ({
|
2110
2408
|
children,
|
2111
2409
|
id,
|
@@ -2128,21 +2426,12 @@ var DraggableComponent = ({
|
|
2128
2426
|
indicativeHover = false,
|
2129
2427
|
style
|
2130
2428
|
}) => {
|
2131
|
-
const {
|
2132
|
-
zoomConfig,
|
2133
|
-
status,
|
2134
|
-
overrides,
|
2135
|
-
plugins,
|
2136
|
-
selectedItem,
|
2137
|
-
config,
|
2138
|
-
globalPermissions,
|
2139
|
-
state
|
2140
|
-
} = useAppContext();
|
2429
|
+
const { zoomConfig, status, overrides, selectedItem, getPermissions } = useAppContext();
|
2141
2430
|
const isModifierHeld = useModifierHeld("Alt");
|
2142
2431
|
const El = status !== "LOADING" ? Draggable2 : DefaultDraggable;
|
2143
|
-
|
2144
|
-
const [disableSecondaryAnimation, setDisableSecondaryAnimation] =
|
2145
|
-
|
2432
|
+
useEffect11(onMount, []);
|
2433
|
+
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = useState12(false);
|
2434
|
+
useEffect11(() => {
|
2146
2435
|
if (isIos()) {
|
2147
2436
|
setDisableSecondaryAnimation(true);
|
2148
2437
|
}
|
@@ -2151,11 +2440,8 @@ var DraggableComponent = ({
|
|
2151
2440
|
() => overrides.actionBar || DefaultActionBar,
|
2152
2441
|
[overrides.actionBar]
|
2153
2442
|
);
|
2154
|
-
const permissions =
|
2155
|
-
selectedItem
|
2156
|
-
globalPermissions: globalPermissions || {},
|
2157
|
-
config,
|
2158
|
-
appState: state
|
2443
|
+
const permissions = getPermissions({
|
2444
|
+
item: selectedItem
|
2159
2445
|
});
|
2160
2446
|
return /* @__PURE__ */ jsx23(
|
2161
2447
|
El,
|
@@ -2178,7 +2464,7 @@ var DraggableComponent = ({
|
|
2178
2464
|
indicativeHover
|
2179
2465
|
}),
|
2180
2466
|
style: __spreadProps(__spreadValues(__spreadValues({}, style), provided.draggableProps.style), {
|
2181
|
-
cursor: isModifierHeld || isDragDisabled ? "
|
2467
|
+
cursor: isModifierHeld || isDragDisabled ? "pointer" : "grab"
|
2182
2468
|
}),
|
2183
2469
|
onMouseOver,
|
2184
2470
|
onMouseOut,
|
@@ -2205,8 +2491,8 @@ var DraggableComponent = ({
|
|
2205
2491
|
right: actionsRight / zoomConfig.zoom
|
2206
2492
|
},
|
2207
2493
|
children: /* @__PURE__ */ jsxs11(CustomActionBar, { label, children: [
|
2208
|
-
permissions
|
2209
|
-
permissions
|
2494
|
+
permissions.duplicate && /* @__PURE__ */ jsx23(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ jsx23(Copy, { size: 16 }) }),
|
2495
|
+
permissions.delete && /* @__PURE__ */ jsx23(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ jsx23(Trash, { size: 16 }) })
|
2210
2496
|
] })
|
2211
2497
|
}
|
2212
2498
|
)
|
@@ -2230,8 +2516,8 @@ var styles_module_default12 = { "DropZone": "_DropZone_djoti_1", "DropZone-conte
|
|
2230
2516
|
init_react_import();
|
2231
2517
|
import {
|
2232
2518
|
createContext as createContext3,
|
2233
|
-
useCallback as
|
2234
|
-
useState as
|
2519
|
+
useCallback as useCallback6,
|
2520
|
+
useState as useState13
|
2235
2521
|
} from "react";
|
2236
2522
|
import { useDebounce } from "use-debounce";
|
2237
2523
|
|
@@ -2254,24 +2540,24 @@ var DropZoneProvider = ({
|
|
2254
2540
|
children,
|
2255
2541
|
value
|
2256
2542
|
}) => {
|
2257
|
-
const [hoveringArea, setHoveringArea] =
|
2258
|
-
const [hoveringZone, setHoveringZone] =
|
2543
|
+
const [hoveringArea, setHoveringArea] = useState13(null);
|
2544
|
+
const [hoveringZone, setHoveringZone] = useState13(
|
2259
2545
|
rootDroppableId
|
2260
2546
|
);
|
2261
|
-
const [hoveringComponent, setHoveringComponent] =
|
2547
|
+
const [hoveringComponent, setHoveringComponent] = useState13();
|
2262
2548
|
const [hoveringAreaDb] = useDebounce(hoveringArea, 75, { leading: false });
|
2263
|
-
const [areasWithZones, setAreasWithZones] =
|
2549
|
+
const [areasWithZones, setAreasWithZones] = useState13(
|
2264
2550
|
{}
|
2265
2551
|
);
|
2266
|
-
const [activeZones, setActiveZones] =
|
2552
|
+
const [activeZones, setActiveZones] = useState13({});
|
2267
2553
|
const { dispatch = null } = value ? value : {};
|
2268
|
-
const registerZoneArea =
|
2554
|
+
const registerZoneArea = useCallback6(
|
2269
2555
|
(area) => {
|
2270
2556
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
2271
2557
|
},
|
2272
2558
|
[setAreasWithZones]
|
2273
2559
|
);
|
2274
|
-
const registerZone =
|
2560
|
+
const registerZone = useCallback6(
|
2275
2561
|
(zoneCompound) => {
|
2276
2562
|
if (!dispatch) {
|
2277
2563
|
return;
|
@@ -2284,7 +2570,7 @@ var DropZoneProvider = ({
|
|
2284
2570
|
},
|
2285
2571
|
[setActiveZones, dispatch]
|
2286
2572
|
);
|
2287
|
-
const unregisterZone =
|
2573
|
+
const unregisterZone = useCallback6(
|
2288
2574
|
(zoneCompound) => {
|
2289
2575
|
if (!dispatch) {
|
2290
2576
|
return;
|
@@ -2299,8 +2585,8 @@ var DropZoneProvider = ({
|
|
2299
2585
|
},
|
2300
2586
|
[setActiveZones, dispatch]
|
2301
2587
|
);
|
2302
|
-
const [pathData, setPathData] =
|
2303
|
-
const registerPath =
|
2588
|
+
const [pathData, setPathData] = useState13();
|
2589
|
+
const registerPath = useCallback6(
|
2304
2590
|
(selector) => {
|
2305
2591
|
if (!(value == null ? void 0 : value.data)) {
|
2306
2592
|
return;
|
@@ -2325,7 +2611,7 @@ var DropZoneProvider = ({
|
|
2325
2611
|
},
|
2326
2612
|
[value, setPathData]
|
2327
2613
|
);
|
2328
|
-
const [zoneWillDrag, setZoneWillDrag] =
|
2614
|
+
const [zoneWillDrag, setZoneWillDrag] = useState13("");
|
2329
2615
|
return /* @__PURE__ */ jsx24(Fragment10, { children: value && /* @__PURE__ */ jsx24(
|
2330
2616
|
dropZoneContext.Provider,
|
2331
2617
|
{
|
@@ -2376,12 +2662,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
2376
2662
|
} = ctx || {};
|
2377
2663
|
let content = data.content || [];
|
2378
2664
|
let zoneCompound = rootDroppableId;
|
2379
|
-
|
2665
|
+
useEffect12(() => {
|
2380
2666
|
if (areaId && registerZoneArea) {
|
2381
2667
|
registerZoneArea(areaId);
|
2382
2668
|
}
|
2383
2669
|
}, [areaId]);
|
2384
|
-
|
2670
|
+
useEffect12(() => {
|
2385
2671
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
2386
2672
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
2387
2673
|
}
|
@@ -2508,14 +2794,11 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
2508
2794
|
] });
|
2509
2795
|
const componentConfig = config.components[item.type];
|
2510
2796
|
const label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
|
2511
|
-
const canDrag = getPermissions({
|
2512
|
-
|
2797
|
+
const canDrag = appContext2.getPermissions({
|
2798
|
+
item: getItem(
|
2513
2799
|
{ index: i, zone: zoneCompound },
|
2514
2800
|
appContext2.state.data
|
2515
|
-
)
|
2516
|
-
config: appContext2.config,
|
2517
|
-
globalPermissions: appContext2.globalPermissions || {},
|
2518
|
-
appState: appContext2.state
|
2801
|
+
)
|
2519
2802
|
}).drag;
|
2520
2803
|
return /* @__PURE__ */ jsxs12(
|
2521
2804
|
"div",
|
@@ -2540,7 +2823,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
2540
2823
|
forceHover: hoveringComponent === componentId && !userIsDragging,
|
2541
2824
|
isDragDisabled: !canDrag,
|
2542
2825
|
indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
|
2543
|
-
isLoading: (_c = appContext2.componentState[componentId]) == null ? void 0 : _c.
|
2826
|
+
isLoading: ((_c = appContext2.componentState[componentId]) == null ? void 0 : _c.loadingCount) > 0,
|
2544
2827
|
onMount: () => {
|
2545
2828
|
ctx.registerPath({
|
2546
2829
|
index: i,
|
@@ -2682,16 +2965,16 @@ function DropZone(props) {
|
|
2682
2965
|
// components/Puck/index.tsx
|
2683
2966
|
init_react_import();
|
2684
2967
|
import {
|
2685
|
-
useCallback as
|
2686
|
-
useEffect as
|
2968
|
+
useCallback as useCallback11,
|
2969
|
+
useEffect as useEffect18,
|
2687
2970
|
useMemo as useMemo13,
|
2688
2971
|
useReducer,
|
2689
|
-
useState as
|
2972
|
+
useState as useState21
|
2690
2973
|
} from "react";
|
2691
2974
|
|
2692
2975
|
// lib/use-placeholder-style.ts
|
2693
2976
|
init_react_import();
|
2694
|
-
import { useState as
|
2977
|
+
import { useState as useState14 } from "react";
|
2695
2978
|
|
2696
2979
|
// lib/get-frame.ts
|
2697
2980
|
init_react_import();
|
@@ -2706,7 +2989,7 @@ var getFrame = () => {
|
|
2706
2989
|
// lib/use-placeholder-style.ts
|
2707
2990
|
var usePlaceholderStyle = () => {
|
2708
2991
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
2709
|
-
const [placeholderStyle, setPlaceholderStyle] =
|
2992
|
+
const [placeholderStyle, setPlaceholderStyle] = useState14();
|
2710
2993
|
const onDragStartOrUpdate = (draggedItem) => {
|
2711
2994
|
var _a;
|
2712
2995
|
const draggableId = draggedItem.draggableId;
|
@@ -3155,271 +3438,81 @@ function reduceData(data, action, config) {
|
|
3155
3438
|
return __spreadValues(__spreadValues({}, data), action.data(data));
|
3156
3439
|
}
|
3157
3440
|
return data;
|
3158
|
-
}
|
3159
|
-
|
3160
|
-
// reducer/state.ts
|
3161
|
-
init_react_import();
|
3162
|
-
var reduceUi = (ui, action) => {
|
3163
|
-
if (action.type === "setUi") {
|
3164
|
-
if (typeof action.ui === "object") {
|
3165
|
-
return __spreadValues(__spreadValues({}, ui), action.ui);
|
3166
|
-
}
|
3167
|
-
return __spreadValues(__spreadValues({}, ui), action.ui(ui));
|
3168
|
-
}
|
3169
|
-
return ui;
|
3170
|
-
};
|
3171
|
-
|
3172
|
-
// reducer/actions.tsx
|
3173
|
-
init_react_import();
|
3174
|
-
|
3175
|
-
// reducer/index.ts
|
3176
|
-
function storeInterceptor(reducer, record, onAction) {
|
3177
|
-
return (state, action) => {
|
3178
|
-
const newAppState = reducer(state, action);
|
3179
|
-
const isValidType = ![
|
3180
|
-
"registerZone",
|
3181
|
-
"unregisterZone",
|
3182
|
-
"setData",
|
3183
|
-
"setUi",
|
3184
|
-
"set"
|
3185
|
-
].includes(action.type);
|
3186
|
-
if (typeof action.recordHistory !== "undefined" ? action.recordHistory : isValidType) {
|
3187
|
-
if (record) record(newAppState);
|
3188
|
-
}
|
3189
|
-
onAction == null ? void 0 : onAction(action, newAppState, state);
|
3190
|
-
return newAppState;
|
3191
|
-
};
|
3192
|
-
}
|
3193
|
-
var setAction = (state, action) => {
|
3194
|
-
if (typeof action.state === "object") {
|
3195
|
-
return __spreadValues(__spreadValues({}, state), action.state);
|
3196
|
-
}
|
3197
|
-
return __spreadValues(__spreadValues({}, state), action.state(state));
|
3198
|
-
};
|
3199
|
-
function createReducer({
|
3200
|
-
config,
|
3201
|
-
record,
|
3202
|
-
onAction
|
3203
|
-
}) {
|
3204
|
-
return storeInterceptor(
|
3205
|
-
(state, action) => {
|
3206
|
-
const data = reduceData(state.data, action, config);
|
3207
|
-
const ui = reduceUi(state.ui, action);
|
3208
|
-
if (action.type === "set") {
|
3209
|
-
return setAction(state, action);
|
3210
|
-
}
|
3211
|
-
return { data, ui };
|
3212
|
-
},
|
3213
|
-
record,
|
3214
|
-
onAction
|
3215
|
-
);
|
3216
|
-
}
|
3217
|
-
|
3218
|
-
// lib/flush-zones.ts
|
3219
|
-
init_react_import();
|
3220
|
-
var flushZones = (appState) => {
|
3221
|
-
const containsZones = typeof appState.data.zones !== "undefined";
|
3222
|
-
if (containsZones) {
|
3223
|
-
Object.keys(appState.data.zones || {}).forEach((zone) => {
|
3224
|
-
addToZoneCache(zone, appState.data.zones[zone]);
|
3225
|
-
});
|
3226
|
-
return __spreadProps(__spreadValues({}, appState), {
|
3227
|
-
data: __spreadProps(__spreadValues({}, appState.data), {
|
3228
|
-
zones: {}
|
3229
|
-
})
|
3230
|
-
});
|
3231
|
-
}
|
3232
|
-
return appState;
|
3233
|
-
};
|
3234
|
-
|
3235
|
-
// lib/use-resolved-data.ts
|
3236
|
-
init_react_import();
|
3237
|
-
import { useCallback as useCallback5, useEffect as useEffect11, useState as useState13 } from "react";
|
3238
|
-
|
3239
|
-
// lib/resolve-component-data.ts
|
3240
|
-
init_react_import();
|
3241
|
-
var cache2 = { lastChange: {} };
|
3242
|
-
var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
|
3243
|
-
return yield Promise.all(
|
3244
|
-
content.map((item) => __async(void 0, null, function* () {
|
3245
|
-
return yield resolveComponentData(
|
3246
|
-
item,
|
3247
|
-
config,
|
3248
|
-
onResolveStart,
|
3249
|
-
onResolveEnd
|
3250
|
-
);
|
3251
|
-
}))
|
3252
|
-
);
|
3253
|
-
});
|
3254
|
-
var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
|
3255
|
-
const configForItem = config.components[item.type];
|
3256
|
-
if (configForItem.resolveData) {
|
3257
|
-
const { item: oldItem = {}, resolved = {} } = cache2.lastChange[item.props.id] || {};
|
3258
|
-
if (item && item === oldItem) {
|
3259
|
-
return resolved;
|
3260
|
-
}
|
3261
|
-
const changed = getChanged(item, oldItem);
|
3262
|
-
if (onResolveStart) {
|
3263
|
-
onResolveStart(item);
|
3264
|
-
}
|
3265
|
-
const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, { changed, lastData: oldItem });
|
3266
|
-
const { readOnly: existingReadOnly = {} } = item || {};
|
3267
|
-
const newReadOnly = __spreadValues(__spreadValues({}, existingReadOnly), readOnly);
|
3268
|
-
const resolvedItem = __spreadProps(__spreadValues({}, item), {
|
3269
|
-
props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
|
3270
|
-
});
|
3271
|
-
if (Object.keys(newReadOnly).length) {
|
3272
|
-
resolvedItem.readOnly = newReadOnly;
|
3273
|
-
}
|
3274
|
-
cache2.lastChange[item.props.id] = {
|
3275
|
-
item,
|
3276
|
-
resolved: resolvedItem
|
3277
|
-
};
|
3278
|
-
if (onResolveEnd) {
|
3279
|
-
onResolveEnd(resolvedItem);
|
3280
|
-
}
|
3281
|
-
return resolvedItem;
|
3282
|
-
}
|
3283
|
-
return item;
|
3284
|
-
});
|
3285
|
-
|
3286
|
-
// lib/apply-dynamic-props.ts
|
3287
|
-
init_react_import();
|
3288
|
-
var applyDynamicProps = (data, dynamicProps, rootData) => {
|
3289
|
-
return __spreadProps(__spreadValues({}, data), {
|
3290
|
-
root: __spreadValues(__spreadValues({}, data.root), rootData ? rootData : {}),
|
3291
|
-
content: data.content.map((item) => {
|
3292
|
-
return dynamicProps[item.props.id] ? __spreadValues(__spreadValues({}, item), dynamicProps[item.props.id]) : item;
|
3293
|
-
}),
|
3294
|
-
zones: Object.keys(data.zones || {}).reduce((acc, zoneKey) => {
|
3295
|
-
return __spreadProps(__spreadValues({}, acc), {
|
3296
|
-
[zoneKey]: data.zones[zoneKey].map((item) => {
|
3297
|
-
return dynamicProps[item.props.id] ? __spreadValues(__spreadValues({}, item), dynamicProps[item.props.id]) : item;
|
3298
|
-
})
|
3299
|
-
});
|
3300
|
-
}, {})
|
3301
|
-
});
|
3441
|
+
}
|
3442
|
+
|
3443
|
+
// reducer/state.ts
|
3444
|
+
init_react_import();
|
3445
|
+
var reduceUi = (ui, action) => {
|
3446
|
+
if (action.type === "setUi") {
|
3447
|
+
if (typeof action.ui === "object") {
|
3448
|
+
return __spreadValues(__spreadValues({}, ui), action.ui);
|
3449
|
+
}
|
3450
|
+
return __spreadValues(__spreadValues({}, ui), action.ui(ui));
|
3451
|
+
}
|
3452
|
+
return ui;
|
3302
3453
|
};
|
3303
3454
|
|
3304
|
-
//
|
3455
|
+
// reducer/actions.tsx
|
3305
3456
|
init_react_import();
|
3306
|
-
|
3307
|
-
|
3308
|
-
|
3309
|
-
|
3310
|
-
|
3311
|
-
|
3312
|
-
|
3313
|
-
|
3314
|
-
|
3315
|
-
|
3316
|
-
|
3317
|
-
|
3318
|
-
|
3319
|
-
|
3320
|
-
cache3.lastChange = {
|
3321
|
-
original: data.root,
|
3322
|
-
resolved: resolvedRoot
|
3323
|
-
};
|
3324
|
-
return __spreadProps(__spreadValues(__spreadValues({}, data.root), resolvedRoot), {
|
3325
|
-
props: __spreadValues(__spreadValues({}, data.root.props), resolvedRoot.props)
|
3326
|
-
});
|
3457
|
+
|
3458
|
+
// reducer/index.ts
|
3459
|
+
function storeInterceptor(reducer, record, onAction) {
|
3460
|
+
return (state, action) => {
|
3461
|
+
const newAppState = reducer(state, action);
|
3462
|
+
const isValidType = ![
|
3463
|
+
"registerZone",
|
3464
|
+
"unregisterZone",
|
3465
|
+
"setData",
|
3466
|
+
"setUi",
|
3467
|
+
"set"
|
3468
|
+
].includes(action.type);
|
3469
|
+
if (typeof action.recordHistory !== "undefined" ? action.recordHistory : isValidType) {
|
3470
|
+
if (record) record(newAppState);
|
3327
3471
|
}
|
3328
|
-
|
3329
|
-
|
3472
|
+
onAction == null ? void 0 : onAction(action, newAppState, state);
|
3473
|
+
return newAppState;
|
3474
|
+
};
|
3330
3475
|
}
|
3331
|
-
|
3332
|
-
|
3333
|
-
|
3334
|
-
|
3335
|
-
|
3336
|
-
|
3337
|
-
|
3338
|
-
|
3339
|
-
|
3340
|
-
|
3341
|
-
|
3342
|
-
|
3343
|
-
|
3344
|
-
|
3476
|
+
var setAction = (state, action) => {
|
3477
|
+
if (typeof action.state === "object") {
|
3478
|
+
return __spreadValues(__spreadValues({}, state), action.state);
|
3479
|
+
}
|
3480
|
+
return __spreadValues(__spreadValues({}, state), action.state(state));
|
3481
|
+
};
|
3482
|
+
function createReducer({
|
3483
|
+
config,
|
3484
|
+
record,
|
3485
|
+
onAction
|
3486
|
+
}) {
|
3487
|
+
return storeInterceptor(
|
3488
|
+
(state, action) => {
|
3489
|
+
const data = reduceData(state.data, action, config);
|
3490
|
+
const ui = reduceUi(state.ui, action);
|
3491
|
+
if (action.type === "set") {
|
3492
|
+
return setAction(state, action);
|
3345
3493
|
}
|
3346
|
-
|
3347
|
-
setComponentState((prev) => __spreadProps(__spreadValues({}, prev), {
|
3348
|
-
[id]: __spreadProps(__spreadValues({}, prev[id]), { loading })
|
3349
|
-
}));
|
3350
|
-
delete deferredSetStates[id];
|
3351
|
-
}, defer2);
|
3494
|
+
return { data, ui };
|
3352
3495
|
},
|
3353
|
-
|
3496
|
+
record,
|
3497
|
+
onAction
|
3354
3498
|
);
|
3355
|
-
|
3356
|
-
|
3357
|
-
|
3358
|
-
|
3359
|
-
|
3499
|
+
}
|
3500
|
+
|
3501
|
+
// lib/flush-zones.ts
|
3502
|
+
init_react_import();
|
3503
|
+
var flushZones = (appState) => {
|
3504
|
+
const containsZones = typeof appState.data.zones !== "undefined";
|
3505
|
+
if (containsZones) {
|
3506
|
+
Object.keys(appState.data.zones || {}).forEach((zone) => {
|
3507
|
+
addToZoneCache(zone, appState.data.zones[zone]);
|
3360
3508
|
});
|
3361
|
-
|
3362
|
-
|
3363
|
-
|
3364
|
-
|
3365
|
-
dynamicRoot
|
3366
|
-
);
|
3367
|
-
const processedAppState = __spreadProps(__spreadValues({}, appState), { data: processed });
|
3368
|
-
const containsChanges = JSON.stringify(appState) !== JSON.stringify(processedAppState);
|
3369
|
-
if (containsChanges) {
|
3370
|
-
dispatch({
|
3371
|
-
type: "set",
|
3372
|
-
state: (prev) => __spreadProps(__spreadValues({}, prev), {
|
3373
|
-
data: applyDynamicProps(prev.data, dynamicDataMap, dynamicRoot),
|
3374
|
-
ui: resolverKey > 0 ? __spreadValues(__spreadValues({}, prev.ui), newAppState.ui) : prev.ui
|
3375
|
-
}),
|
3376
|
-
recordHistory: resolverKey > 0
|
3377
|
-
});
|
3378
|
-
}
|
3379
|
-
};
|
3380
|
-
const promises = [];
|
3381
|
-
promises.push(
|
3382
|
-
(() => __async(void 0, null, function* () {
|
3383
|
-
setComponentLoading("puck-root", true, 50);
|
3384
|
-
const dynamicRoot = yield resolveRootData(newData, config);
|
3385
|
-
applyIfChange({}, dynamicRoot);
|
3386
|
-
setComponentLoading("puck-root", false);
|
3387
|
-
}))()
|
3388
|
-
);
|
3389
|
-
flatContent.forEach((item) => {
|
3390
|
-
promises.push(
|
3391
|
-
(() => __async(void 0, null, function* () {
|
3392
|
-
const dynamicData = yield resolveComponentData(
|
3393
|
-
item,
|
3394
|
-
config,
|
3395
|
-
(item2) => {
|
3396
|
-
setComponentLoading(item2.props.id, true, 50);
|
3397
|
-
},
|
3398
|
-
(item2) => {
|
3399
|
-
deferredSetStates[item2.props.id];
|
3400
|
-
setComponentLoading(item2.props.id, false);
|
3401
|
-
}
|
3402
|
-
);
|
3403
|
-
const dynamicDataMap = { [item.props.id]: dynamicData };
|
3404
|
-
applyIfChange(dynamicDataMap);
|
3405
|
-
}))()
|
3406
|
-
);
|
3509
|
+
return __spreadProps(__spreadValues({}, appState), {
|
3510
|
+
data: __spreadProps(__spreadValues({}, appState.data), {
|
3511
|
+
zones: {}
|
3512
|
+
})
|
3407
3513
|
});
|
3408
|
-
|
3409
|
-
|
3410
|
-
useEffect11(() => {
|
3411
|
-
runResolvers();
|
3412
|
-
}, [resolverKey]);
|
3413
|
-
const resolveData = useCallback5((newAppState2 = appState) => {
|
3414
|
-
setResolverState((curr) => ({
|
3415
|
-
resolverKey: curr.resolverKey + 1,
|
3416
|
-
newAppState: newAppState2
|
3417
|
-
}));
|
3418
|
-
}, []);
|
3419
|
-
return {
|
3420
|
-
resolveData,
|
3421
|
-
componentState
|
3422
|
-
};
|
3514
|
+
}
|
3515
|
+
return appState;
|
3423
3516
|
};
|
3424
3517
|
|
3425
3518
|
// components/MenuBar/index.tsx
|
@@ -3484,7 +3577,7 @@ init_react_import();
|
|
3484
3577
|
var styles_module_default16 = { "PuckFields": "_PuckFields_jp3lw_1", "PuckFields--isLoading": "_PuckFields--isLoading_jp3lw_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_jp3lw_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_jp3lw_25" };
|
3485
3578
|
|
3486
3579
|
// components/Puck/components/Fields/index.tsx
|
3487
|
-
import { useCallback as
|
3580
|
+
import { useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo6, useState as useState15 } from "react";
|
3488
3581
|
import { Fragment as Fragment13, jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
|
3489
3582
|
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
3490
3583
|
var defaultPageFields = {
|
@@ -3503,15 +3596,15 @@ var useResolvedFields = () => {
|
|
3503
3596
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
3504
3597
|
const defaultFields = selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields;
|
3505
3598
|
const rootProps = data.root.props || data.root;
|
3506
|
-
const [lastSelectedData, setLastSelectedData] =
|
3507
|
-
const [resolvedFields, setResolvedFields] =
|
3508
|
-
const [fieldsLoading, setFieldsLoading] =
|
3599
|
+
const [lastSelectedData, setLastSelectedData] = useState15({});
|
3600
|
+
const [resolvedFields, setResolvedFields] = useState15(defaultFields || {});
|
3601
|
+
const [fieldsLoading, setFieldsLoading] = useState15(false);
|
3509
3602
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
3510
3603
|
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
3511
|
-
const resolveFields =
|
3604
|
+
const resolveFields = useCallback7(
|
3512
3605
|
(..._0) => __async(void 0, [..._0], function* (fields = {}) {
|
3513
3606
|
var _a2, _b, _c;
|
3514
|
-
const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData :
|
3607
|
+
const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : null;
|
3515
3608
|
const changed = getChanged(componentData, lastData);
|
3516
3609
|
setLastSelectedData(componentData);
|
3517
3610
|
if (selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields)) {
|
@@ -3544,13 +3637,13 @@ var useResolvedFields = () => {
|
|
3544
3637
|
}),
|
3545
3638
|
[data, config, componentData, selectedItem, resolvedFields, state]
|
3546
3639
|
);
|
3547
|
-
|
3640
|
+
useEffect13(() => {
|
3548
3641
|
setFieldsLoading(true);
|
3549
3642
|
resolveFields(defaultFields).then((fields) => {
|
3550
3643
|
setResolvedFields(fields || {});
|
3551
3644
|
setFieldsLoading(false);
|
3552
3645
|
});
|
3553
|
-
}, [data, defaultFields]);
|
3646
|
+
}, [data, defaultFields, state.ui.itemSelector]);
|
3554
3647
|
return [resolvedFields, fieldsLoading];
|
3555
3648
|
};
|
3556
3649
|
var Fields = () => {
|
@@ -3562,13 +3655,13 @@ var Fields = () => {
|
|
3562
3655
|
config,
|
3563
3656
|
resolveData,
|
3564
3657
|
componentState,
|
3565
|
-
overrides
|
3566
|
-
globalPermissions
|
3658
|
+
overrides
|
3567
3659
|
} = useAppContext();
|
3568
3660
|
const { data, ui } = state;
|
3569
3661
|
const { itemSelector } = ui;
|
3570
3662
|
const [fields, fieldsResolving] = useResolvedFields();
|
3571
|
-
const
|
3663
|
+
const { getPermissions } = useAppContext();
|
3664
|
+
const componentResolving = selectedItem ? ((_a = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a.loadingCount) > 0 : ((_b = componentState["puck-root"]) == null ? void 0 : _b.loadingCount) > 0;
|
3572
3665
|
const isLoading = fieldsResolving || componentResolving;
|
3573
3666
|
const rootProps = data.root.props || data.root;
|
3574
3667
|
const Wrapper = useMemo6(() => overrides.fields || DefaultFields, [overrides]);
|
@@ -3648,10 +3741,7 @@ var Fields = () => {
|
|
3648
3741
|
if (selectedItem && itemSelector) {
|
3649
3742
|
const { readOnly = {} } = selectedItem;
|
3650
3743
|
const { edit } = getPermissions({
|
3651
|
-
selectedItem
|
3652
|
-
config,
|
3653
|
-
globalPermissions: globalPermissions || {},
|
3654
|
-
appState: state
|
3744
|
+
item: selectedItem
|
3655
3745
|
});
|
3656
3746
|
return /* @__PURE__ */ jsx28(
|
3657
3747
|
AutoFieldPrivate,
|
@@ -3667,13 +3757,16 @@ var Fields = () => {
|
|
3667
3757
|
);
|
3668
3758
|
} else {
|
3669
3759
|
const readOnly = data.root.readOnly || {};
|
3760
|
+
const { edit } = getPermissions({
|
3761
|
+
root: true
|
3762
|
+
});
|
3670
3763
|
return /* @__PURE__ */ jsx28(
|
3671
3764
|
AutoFieldPrivate,
|
3672
3765
|
{
|
3673
3766
|
field,
|
3674
3767
|
name: fieldName,
|
3675
3768
|
id: `root_${fieldName}`,
|
3676
|
-
readOnly: readOnly[fieldName],
|
3769
|
+
readOnly: !edit || readOnly[fieldName],
|
3677
3770
|
value: rootProps[fieldName],
|
3678
3771
|
onChange
|
3679
3772
|
},
|
@@ -3692,7 +3785,7 @@ init_react_import();
|
|
3692
3785
|
|
3693
3786
|
// lib/use-component-list.tsx
|
3694
3787
|
init_react_import();
|
3695
|
-
import { useEffect as
|
3788
|
+
import { useEffect as useEffect14, useState as useState16 } from "react";
|
3696
3789
|
|
3697
3790
|
// components/ComponentList/index.tsx
|
3698
3791
|
init_react_import();
|
@@ -3709,12 +3802,9 @@ var ComponentListItem = ({
|
|
3709
3802
|
label,
|
3710
3803
|
index
|
3711
3804
|
}) => {
|
3712
|
-
const { overrides,
|
3805
|
+
const { overrides, getPermissions } = useAppContext();
|
3713
3806
|
const canInsert = getPermissions({
|
3714
|
-
type: name
|
3715
|
-
config,
|
3716
|
-
globalPermissions: globalPermissions || {},
|
3717
|
-
appState: state
|
3807
|
+
type: name
|
3718
3808
|
}).insert;
|
3719
3809
|
return /* @__PURE__ */ jsx29(
|
3720
3810
|
Drawer.Item,
|
@@ -3773,8 +3863,8 @@ ComponentList.Item = ComponentListItem;
|
|
3773
3863
|
// lib/use-component-list.tsx
|
3774
3864
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
3775
3865
|
var useComponentList = (config, ui) => {
|
3776
|
-
const [componentList, setComponentList] =
|
3777
|
-
|
3866
|
+
const [componentList, setComponentList] = useState16();
|
3867
|
+
useEffect14(() => {
|
3778
3868
|
var _a, _b, _c;
|
3779
3869
|
if (Object.keys(ui.componentList).length > 0) {
|
3780
3870
|
const matchedComponents = [];
|
@@ -3854,16 +3944,16 @@ var Components = () => {
|
|
3854
3944
|
|
3855
3945
|
// components/Puck/components/Preview/index.tsx
|
3856
3946
|
init_react_import();
|
3857
|
-
import { useCallback as
|
3947
|
+
import { useCallback as useCallback8, useMemo as useMemo8 } from "react";
|
3858
3948
|
|
3859
3949
|
// components/AutoFrame/index.tsx
|
3860
3950
|
init_react_import();
|
3861
3951
|
import {
|
3862
3952
|
createContext as createContext4,
|
3863
3953
|
useContext as useContext5,
|
3864
|
-
useEffect as
|
3865
|
-
useRef,
|
3866
|
-
useState as
|
3954
|
+
useEffect as useEffect15,
|
3955
|
+
useRef as useRef2,
|
3956
|
+
useState as useState17
|
3867
3957
|
} from "react";
|
3868
3958
|
import hash from "object-hash";
|
3869
3959
|
import { createPortal as createPortal2 } from "react-dom";
|
@@ -3910,7 +4000,7 @@ var CopyHostStyles = ({
|
|
3910
4000
|
onStylesLoaded = () => null
|
3911
4001
|
}) => {
|
3912
4002
|
const { document: doc, window: win } = useFrame();
|
3913
|
-
|
4003
|
+
useEffect15(() => {
|
3914
4004
|
if (!win || !doc) {
|
3915
4005
|
return () => {
|
3916
4006
|
};
|
@@ -4085,11 +4175,11 @@ function AutoFrame(_a) {
|
|
4085
4175
|
"id",
|
4086
4176
|
"onStylesLoaded"
|
4087
4177
|
]);
|
4088
|
-
const [loaded, setLoaded] =
|
4089
|
-
const [ctx, setCtx] =
|
4090
|
-
const ref =
|
4091
|
-
const [mountTarget, setMountTarget] =
|
4092
|
-
|
4178
|
+
const [loaded, setLoaded] = useState17(false);
|
4179
|
+
const [ctx, setCtx] = useState17({});
|
4180
|
+
const ref = useRef2(null);
|
4181
|
+
const [mountTarget, setMountTarget] = useState17();
|
4182
|
+
useEffect15(() => {
|
4093
4183
|
var _a2;
|
4094
4184
|
if (ref.current) {
|
4095
4185
|
setCtx({
|
@@ -4125,7 +4215,7 @@ import { Fragment as Fragment15, jsx as jsx33 } from "react/jsx-runtime";
|
|
4125
4215
|
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
4126
4216
|
var Preview = ({ id = "puck-preview" }) => {
|
4127
4217
|
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
|
4128
|
-
const Page =
|
4218
|
+
const Page = useCallback8(
|
4129
4219
|
(pageProps) => {
|
4130
4220
|
var _a, _b;
|
4131
4221
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
|
@@ -4356,13 +4446,13 @@ var LayerTree = ({
|
|
4356
4446
|
};
|
4357
4447
|
|
4358
4448
|
// components/Puck/components/Outline/index.tsx
|
4359
|
-
import { useCallback as
|
4449
|
+
import { useCallback as useCallback9, useMemo as useMemo9 } from "react";
|
4360
4450
|
import { Fragment as Fragment17, jsx as jsx35, jsxs as jsxs18 } from "react/jsx-runtime";
|
4361
4451
|
var Outline = () => {
|
4362
4452
|
const { dispatch, state, overrides, config } = useAppContext();
|
4363
4453
|
const { data, ui } = state;
|
4364
4454
|
const { itemSelector } = ui;
|
4365
|
-
const setItemSelector =
|
4455
|
+
const setItemSelector = useCallback9(
|
4366
4456
|
(newItemSelector) => {
|
4367
4457
|
dispatch({
|
4368
4458
|
type: "setUi",
|
@@ -4417,14 +4507,14 @@ function usePuckHistory({
|
|
4417
4507
|
if (historyStore.hasPast) {
|
4418
4508
|
dispatch({
|
4419
4509
|
type: "set",
|
4420
|
-
state: ((_a = historyStore.prevHistory) == null ? void 0 : _a.
|
4510
|
+
state: ((_a = historyStore.prevHistory) == null ? void 0 : _a.state) || initialAppState
|
4421
4511
|
});
|
4422
4512
|
historyStore.back();
|
4423
4513
|
}
|
4424
4514
|
};
|
4425
4515
|
const forward = () => {
|
4426
4516
|
if (historyStore.nextHistory) {
|
4427
|
-
dispatch({ type: "set", state: historyStore.nextHistory.
|
4517
|
+
dispatch({ type: "set", state: historyStore.nextHistory.state });
|
4428
4518
|
historyStore.forward();
|
4429
4519
|
}
|
4430
4520
|
};
|
@@ -4432,7 +4522,7 @@ function usePuckHistory({
|
|
4432
4522
|
var _a;
|
4433
4523
|
dispatch({
|
4434
4524
|
type: "set",
|
4435
|
-
state: ((_a = histories[histories.length - 1]) == null ? void 0 : _a.
|
4525
|
+
state: ((_a = histories[histories.length - 1]) == null ? void 0 : _a.state) || initialAppState
|
4436
4526
|
});
|
4437
4527
|
historyStore.setHistories(histories);
|
4438
4528
|
};
|
@@ -4441,7 +4531,7 @@ function usePuckHistory({
|
|
4441
4531
|
if (historyStore.histories.length > index) {
|
4442
4532
|
dispatch({
|
4443
4533
|
type: "set",
|
4444
|
-
state: ((_a = historyStore.histories[index]) == null ? void 0 : _a.
|
4534
|
+
state: ((_a = historyStore.histories[index]) == null ? void 0 : _a.state) || initialAppState
|
4445
4535
|
});
|
4446
4536
|
historyStore.setHistoryIndex(index);
|
4447
4537
|
}
|
@@ -4460,19 +4550,19 @@ function usePuckHistory({
|
|
4460
4550
|
|
4461
4551
|
// lib/use-history-store.ts
|
4462
4552
|
init_react_import();
|
4463
|
-
import { useState as
|
4553
|
+
import { useState as useState18 } from "react";
|
4464
4554
|
import { useDebouncedCallback as useDebouncedCallback2 } from "use-debounce";
|
4465
|
-
var EMPTY_HISTORY_INDEX =
|
4555
|
+
var EMPTY_HISTORY_INDEX = 0;
|
4466
4556
|
function useHistoryStore(initialHistory) {
|
4467
4557
|
var _a, _b;
|
4468
|
-
const [histories, setHistories] =
|
4558
|
+
const [histories, setHistories] = useState18(
|
4469
4559
|
(_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
|
4470
4560
|
);
|
4471
4561
|
const updateHistories = (histories2) => {
|
4472
4562
|
setHistories(histories2);
|
4473
4563
|
setIndex(histories2.length - 1);
|
4474
4564
|
};
|
4475
|
-
const [index, setIndex] =
|
4565
|
+
const [index, setIndex] = useState18(
|
4476
4566
|
(_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
|
4477
4567
|
);
|
4478
4568
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -4480,9 +4570,9 @@ function useHistoryStore(initialHistory) {
|
|
4480
4570
|
const currentHistory = histories[index];
|
4481
4571
|
const nextHistory = hasFuture ? histories[index + 1] : null;
|
4482
4572
|
const prevHistory = hasPast ? histories[index - 1] : null;
|
4483
|
-
const record = useDebouncedCallback2((
|
4573
|
+
const record = useDebouncedCallback2((state) => {
|
4484
4574
|
const history = {
|
4485
|
-
|
4575
|
+
state,
|
4486
4576
|
id: generateId("history")
|
4487
4577
|
};
|
4488
4578
|
updateHistories([...histories.slice(0, index + 1), history]);
|
@@ -4633,16 +4723,16 @@ var getBox = function getBox2(el) {
|
|
4633
4723
|
|
4634
4724
|
// components/Puck/components/Canvas/index.tsx
|
4635
4725
|
import {
|
4636
|
-
useCallback as
|
4637
|
-
useEffect as
|
4726
|
+
useCallback as useCallback10,
|
4727
|
+
useEffect as useEffect17,
|
4638
4728
|
useMemo as useMemo11,
|
4639
|
-
useRef as
|
4640
|
-
useState as
|
4729
|
+
useRef as useRef3,
|
4730
|
+
useState as useState20
|
4641
4731
|
} from "react";
|
4642
4732
|
|
4643
4733
|
// components/ViewportControls/index.tsx
|
4644
4734
|
init_react_import();
|
4645
|
-
import { useEffect as
|
4735
|
+
import { useEffect as useEffect16, useMemo as useMemo10, useState as useState19 } from "react";
|
4646
4736
|
|
4647
4737
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
4648
4738
|
init_react_import();
|
@@ -4665,8 +4755,8 @@ var ViewportButton = ({
|
|
4665
4755
|
onClick
|
4666
4756
|
}) => {
|
4667
4757
|
const { state } = useAppContext();
|
4668
|
-
const [isActive, setIsActive] =
|
4669
|
-
|
4758
|
+
const [isActive, setIsActive] = useState19(false);
|
4759
|
+
useEffect16(() => {
|
4670
4760
|
setIsActive(width === state.ui.viewports.current.width);
|
4671
4761
|
}, [width, state.ui.viewports.current.width]);
|
4672
4762
|
return /* @__PURE__ */ jsx36("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ jsx36(
|
@@ -4785,7 +4875,7 @@ var ViewportControls = ({
|
|
4785
4875
|
|
4786
4876
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
|
4787
4877
|
init_react_import();
|
4788
|
-
var styles_module_default21 = { "PuckCanvas": "
|
4878
|
+
var styles_module_default21 = { "PuckCanvas": "_PuckCanvas_esbg1_1", "PuckCanvas-controls": "_PuckCanvas-controls_esbg1_16", "PuckCanvas-inner": "_PuckCanvas-inner_esbg1_21", "PuckCanvas-root": "_PuckCanvas-root_esbg1_32", "PuckCanvas--ready": "_PuckCanvas--ready_esbg1_56", "PuckCanvas-loader": "_PuckCanvas-loader_esbg1_60", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_esbg1_70" };
|
4789
4879
|
|
4790
4880
|
// lib/get-zoom-config.ts
|
4791
4881
|
init_react_import();
|
@@ -4825,8 +4915,8 @@ var Canvas = () => {
|
|
4825
4915
|
const { status, iframe } = useAppContext();
|
4826
4916
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
4827
4917
|
const { ui } = state;
|
4828
|
-
const frameRef =
|
4829
|
-
const [showTransition, setShowTransition] =
|
4918
|
+
const frameRef = useRef3(null);
|
4919
|
+
const [showTransition, setShowTransition] = useState20(false);
|
4830
4920
|
const defaultRender = useMemo11(() => {
|
4831
4921
|
const PuckDefault = ({ children }) => /* @__PURE__ */ jsx37(Fragment18, { children });
|
4832
4922
|
return PuckDefault;
|
@@ -4835,7 +4925,7 @@ var Canvas = () => {
|
|
4835
4925
|
() => overrides.preview || defaultRender,
|
4836
4926
|
[overrides]
|
4837
4927
|
);
|
4838
|
-
const getFrameDimensions =
|
4928
|
+
const getFrameDimensions = useCallback10(() => {
|
4839
4929
|
if (frameRef.current) {
|
4840
4930
|
const frame = frameRef.current;
|
4841
4931
|
const box = getBox(frame);
|
@@ -4843,7 +4933,7 @@ var Canvas = () => {
|
|
4843
4933
|
}
|
4844
4934
|
return { width: 0, height: 0 };
|
4845
4935
|
}, [frameRef]);
|
4846
|
-
const resetAutoZoom =
|
4936
|
+
const resetAutoZoom = useCallback10(
|
4847
4937
|
(ui2 = state.ui) => {
|
4848
4938
|
if (frameRef.current) {
|
4849
4939
|
setZoomConfig(
|
@@ -4853,11 +4943,11 @@ var Canvas = () => {
|
|
4853
4943
|
},
|
4854
4944
|
[frameRef, zoomConfig, state.ui]
|
4855
4945
|
);
|
4856
|
-
|
4946
|
+
useEffect17(() => {
|
4857
4947
|
setShowTransition(false);
|
4858
4948
|
resetAutoZoom();
|
4859
4949
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
4860
|
-
|
4950
|
+
useEffect17(() => {
|
4861
4951
|
const { height: frameHeight } = getFrameDimensions();
|
4862
4952
|
if (ui.viewports.current.height === "auto") {
|
4863
4953
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
@@ -4865,7 +4955,13 @@ var Canvas = () => {
|
|
4865
4955
|
}));
|
4866
4956
|
}
|
4867
4957
|
}, [zoomConfig.zoom]);
|
4868
|
-
|
4958
|
+
useEffect17(() => {
|
4959
|
+
if (ZOOM_ON_CHANGE) {
|
4960
|
+
setShowTransition(true);
|
4961
|
+
resetAutoZoom(ui);
|
4962
|
+
}
|
4963
|
+
}, [ui.viewports.current.width]);
|
4964
|
+
useEffect17(() => {
|
4869
4965
|
const observer = new ResizeObserver(() => {
|
4870
4966
|
setShowTransition(false);
|
4871
4967
|
resetAutoZoom();
|
@@ -4877,11 +4973,18 @@ var Canvas = () => {
|
|
4877
4973
|
observer.disconnect();
|
4878
4974
|
};
|
4879
4975
|
}, []);
|
4976
|
+
const [showLoader, setShowLoader] = useState20(false);
|
4977
|
+
useEffect17(() => {
|
4978
|
+
setTimeout(() => {
|
4979
|
+
setShowLoader(true);
|
4980
|
+
}, 500);
|
4981
|
+
}, []);
|
4880
4982
|
return /* @__PURE__ */ jsxs20(
|
4881
4983
|
"div",
|
4882
4984
|
{
|
4883
4985
|
className: getClassName26({
|
4884
|
-
ready: status === "READY" || !iframe.enabled
|
4986
|
+
ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
|
4987
|
+
showLoader
|
4885
4988
|
}),
|
4886
4989
|
onClick: () => dispatch({
|
4887
4990
|
type: "setUi",
|
@@ -4914,21 +5017,24 @@ var Canvas = () => {
|
|
4914
5017
|
}
|
4915
5018
|
}
|
4916
5019
|
) }),
|
4917
|
-
/* @__PURE__ */
|
4918
|
-
|
4919
|
-
|
4920
|
-
|
4921
|
-
|
4922
|
-
|
4923
|
-
|
4924
|
-
|
4925
|
-
|
4926
|
-
|
4927
|
-
|
4928
|
-
|
4929
|
-
|
4930
|
-
|
4931
|
-
|
5020
|
+
/* @__PURE__ */ jsxs20("div", { className: getClassName26("inner"), ref: frameRef, children: [
|
5021
|
+
/* @__PURE__ */ jsx37(
|
5022
|
+
"div",
|
5023
|
+
{
|
5024
|
+
className: getClassName26("root"),
|
5025
|
+
style: {
|
5026
|
+
width: iframe.enabled ? ui.viewports.current.width : "100%",
|
5027
|
+
height: zoomConfig.rootHeight,
|
5028
|
+
transform: iframe.enabled ? `scale(${zoomConfig.zoom})` : void 0,
|
5029
|
+
transition: showTransition ? "width 150ms ease-out, height 150ms ease-out, transform 150ms ease-out" : "",
|
5030
|
+
overflow: iframe.enabled ? void 0 : "auto"
|
5031
|
+
},
|
5032
|
+
suppressHydrationWarning: true,
|
5033
|
+
children: /* @__PURE__ */ jsx37(CustomPreview, { children: /* @__PURE__ */ jsx37(Preview, {}) })
|
5034
|
+
}
|
5035
|
+
),
|
5036
|
+
/* @__PURE__ */ jsx37("div", { className: getClassName26("loader"), children: /* @__PURE__ */ jsx37(Loader, { size: 24 }) })
|
5037
|
+
] })
|
4932
5038
|
]
|
4933
5039
|
}
|
4934
5040
|
);
|
@@ -4953,7 +5059,10 @@ var insertComponent = (componentType, zone, index, {
|
|
4953
5059
|
const insertedData = insertAction(state.data, insertActionData, config);
|
4954
5060
|
dispatch(__spreadProps(__spreadValues({}, insertActionData), {
|
4955
5061
|
// Dispatch insert rather set, as user's may rely on this via onAction
|
4956
|
-
|
5062
|
+
// We must always record history here so the insert is added to user history
|
5063
|
+
// If the user has defined a resolveData method, they will end up with 2 history
|
5064
|
+
// entries on insert - one for the initial insert, and one when the data resolves
|
5065
|
+
recordHistory: true
|
4957
5066
|
}));
|
4958
5067
|
const itemSelector = {
|
4959
5068
|
index,
|
@@ -5032,22 +5141,16 @@ function Puck({
|
|
5032
5141
|
headerTitle,
|
5033
5142
|
headerPath,
|
5034
5143
|
viewports = defaultViewports,
|
5035
|
-
iframe
|
5036
|
-
enabled: true
|
5037
|
-
},
|
5144
|
+
iframe: _iframe,
|
5038
5145
|
dnd,
|
5039
|
-
initialHistory
|
5146
|
+
initialHistory: _initialHistory
|
5040
5147
|
}) {
|
5041
5148
|
var _a;
|
5042
|
-
const
|
5043
|
-
|
5044
|
-
|
5045
|
-
|
5046
|
-
|
5047
|
-
onAction
|
5048
|
-
})
|
5049
|
-
);
|
5050
|
-
const [initialAppState] = useState20(() => {
|
5149
|
+
const iframe = __spreadValues({
|
5150
|
+
enabled: true,
|
5151
|
+
waitForStyles: true
|
5152
|
+
}, _iframe);
|
5153
|
+
const [generatedAppState] = useState21(() => {
|
5051
5154
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
|
5052
5155
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
5053
5156
|
let clientUiState = {};
|
@@ -5065,14 +5168,14 @@ function Puck({
|
|
5065
5168
|
})).sort((a, b) => a.diff > b.diff ? 1 : -1);
|
5066
5169
|
const closestViewport = viewportDifferences[0].key;
|
5067
5170
|
if (iframe.enabled) {
|
5068
|
-
clientUiState = {
|
5171
|
+
clientUiState = __spreadProps(__spreadValues({}, clientUiState), {
|
5069
5172
|
viewports: __spreadProps(__spreadValues({}, initial.viewports), {
|
5070
5173
|
current: __spreadProps(__spreadValues({}, initial.viewports.current), {
|
5071
5174
|
height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || ((_c = viewports[closestViewport]) == null ? void 0 : _c.height) || "auto",
|
5072
5175
|
width: ((_e = (_d = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _d.current) == null ? void 0 : _e.width) || ((_f = viewports[closestViewport]) == null ? void 0 : _f.width)
|
5073
5176
|
})
|
5074
5177
|
})
|
5075
|
-
};
|
5178
|
+
});
|
5076
5179
|
}
|
5077
5180
|
}
|
5078
5181
|
if (Object.keys((initialData == null ? void 0 : initialData.root) || {}).length > 0 && !((_g = initialData == null ? void 0 : initialData.root) == null ? void 0 : _g.props)) {
|
@@ -5105,20 +5208,36 @@ function Puck({
|
|
5105
5208
|
})
|
5106
5209
|
});
|
5107
5210
|
});
|
5211
|
+
const { appendData = true } = _initialHistory || {};
|
5212
|
+
const histories = [
|
5213
|
+
...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
|
5214
|
+
...appendData ? [{ state: generatedAppState }] : []
|
5215
|
+
].map((history2) => __spreadProps(__spreadValues({}, history2), {
|
5216
|
+
// Inject default data to enable partial history injections
|
5217
|
+
state: __spreadValues(__spreadValues({}, generatedAppState), history2.state)
|
5218
|
+
}));
|
5219
|
+
const initialHistoryIndex = (_initialHistory == null ? void 0 : _initialHistory.index) || histories.length - 1;
|
5220
|
+
const initialAppState = histories[initialHistoryIndex].state;
|
5221
|
+
const historyStore = useHistoryStore({
|
5222
|
+
histories,
|
5223
|
+
index: initialHistoryIndex
|
5224
|
+
});
|
5225
|
+
const [reducer] = useState21(
|
5226
|
+
() => createReducer({
|
5227
|
+
config,
|
5228
|
+
record: historyStore.record,
|
5229
|
+
onAction
|
5230
|
+
})
|
5231
|
+
);
|
5108
5232
|
const [appState, dispatch] = useReducer(
|
5109
5233
|
reducer,
|
5110
5234
|
flushZones(initialAppState)
|
5111
5235
|
);
|
5112
5236
|
const { data, ui } = appState;
|
5113
5237
|
const history = usePuckHistory({ dispatch, initialAppState, historyStore });
|
5114
|
-
const
|
5115
|
-
appState,
|
5116
|
-
config,
|
5117
|
-
dispatch
|
5118
|
-
);
|
5119
|
-
const [menuOpen, setMenuOpen] = useState20(false);
|
5238
|
+
const [menuOpen, setMenuOpen] = useState21(false);
|
5120
5239
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
5121
|
-
const setItemSelector =
|
5240
|
+
const setItemSelector = useCallback11(
|
5122
5241
|
(newItemSelector) => {
|
5123
5242
|
if (newItemSelector === itemSelector) return;
|
5124
5243
|
dispatch({
|
@@ -5130,13 +5249,13 @@ function Puck({
|
|
5130
5249
|
[itemSelector]
|
5131
5250
|
);
|
5132
5251
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
5133
|
-
|
5252
|
+
useEffect18(() => {
|
5134
5253
|
if (onChange) onChange(data);
|
5135
5254
|
}, [data]);
|
5136
5255
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
5137
|
-
const [draggedItem, setDraggedItem] =
|
5256
|
+
const [draggedItem, setDraggedItem] = useState21();
|
5138
5257
|
const rootProps = data.root.props || data.root;
|
5139
|
-
const toggleSidebars =
|
5258
|
+
const toggleSidebars = useCallback11(
|
5140
5259
|
(sidebar) => {
|
5141
5260
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
5142
5261
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -5150,7 +5269,7 @@ function Puck({
|
|
5150
5269
|
},
|
5151
5270
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
5152
5271
|
);
|
5153
|
-
|
5272
|
+
useEffect18(() => {
|
5154
5273
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
5155
5274
|
dispatch({
|
5156
5275
|
type: "setUi",
|
@@ -5216,8 +5335,8 @@ function Puck({
|
|
5216
5335
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
5217
5336
|
[loadedOverrides]
|
5218
5337
|
);
|
5219
|
-
const [mounted, setMounted] =
|
5220
|
-
|
5338
|
+
const [mounted, setMounted] = useState21(false);
|
5339
|
+
useEffect18(() => {
|
5221
5340
|
setMounted(true);
|
5222
5341
|
}, []);
|
5223
5342
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|
@@ -5230,8 +5349,6 @@ function Puck({
|
|
5230
5349
|
state: appState,
|
5231
5350
|
dispatch,
|
5232
5351
|
config,
|
5233
|
-
componentState,
|
5234
|
-
resolveData,
|
5235
5352
|
plugins: plugins || [],
|
5236
5353
|
overrides: loadedOverrides,
|
5237
5354
|
history,
|
@@ -5243,9 +5360,11 @@ function Puck({
|
|
5243
5360
|
duplicate: true,
|
5244
5361
|
insert: true,
|
5245
5362
|
edit: true
|
5246
|
-
}, permissions)
|
5363
|
+
}, permissions),
|
5364
|
+
getPermissions: () => ({}),
|
5365
|
+
refreshPermissions: () => null
|
5247
5366
|
},
|
5248
|
-
children: /* @__PURE__ */ jsx38(
|
5367
|
+
children: /* @__PURE__ */ jsx38(appContext.Consumer, { children: ({ resolveData }) => /* @__PURE__ */ jsx38(
|
5249
5368
|
DragDropContext,
|
5250
5369
|
{
|
5251
5370
|
autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
|
@@ -5335,89 +5454,115 @@ function Puck({
|
|
5335
5454
|
}
|
5336
5455
|
) }) }),
|
5337
5456
|
children: /* @__PURE__ */ jsx38("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ jsxs21("div", { className: getLayoutClassName("headerInner"), children: [
|
5338
|
-
/* @__PURE__ */ jsxs21(
|
5339
|
-
|
5340
|
-
|
5341
|
-
|
5342
|
-
|
5343
|
-
|
5344
|
-
|
5345
|
-
children: /* @__PURE__ */ jsx38(
|
5346
|
-
IconButton,
|
5457
|
+
/* @__PURE__ */ jsxs21(
|
5458
|
+
"div",
|
5459
|
+
{
|
5460
|
+
className: getLayoutClassName("headerToggle"),
|
5461
|
+
children: [
|
5462
|
+
/* @__PURE__ */ jsx38(
|
5463
|
+
"div",
|
5347
5464
|
{
|
5348
|
-
|
5349
|
-
|
5350
|
-
|
5351
|
-
|
5352
|
-
|
5465
|
+
className: getLayoutClassName(
|
5466
|
+
"leftSideBarToggle"
|
5467
|
+
),
|
5468
|
+
children: /* @__PURE__ */ jsx38(
|
5469
|
+
IconButton,
|
5470
|
+
{
|
5471
|
+
onClick: () => {
|
5472
|
+
toggleSidebars("left");
|
5473
|
+
},
|
5474
|
+
title: "Toggle left sidebar",
|
5475
|
+
children: /* @__PURE__ */ jsx38(PanelLeft, { focusable: "false" })
|
5476
|
+
}
|
5477
|
+
)
|
5353
5478
|
}
|
5354
|
-
)
|
5355
|
-
}
|
5356
|
-
),
|
5357
|
-
/* @__PURE__ */ jsx38(
|
5358
|
-
"div",
|
5359
|
-
{
|
5360
|
-
className: getLayoutClassName(
|
5361
|
-
"rightSideBarToggle"
|
5362
5479
|
),
|
5363
|
-
|
5364
|
-
|
5480
|
+
/* @__PURE__ */ jsx38(
|
5481
|
+
"div",
|
5365
5482
|
{
|
5366
|
-
|
5367
|
-
|
5368
|
-
|
5369
|
-
|
5370
|
-
|
5483
|
+
className: getLayoutClassName(
|
5484
|
+
"rightSideBarToggle"
|
5485
|
+
),
|
5486
|
+
children: /* @__PURE__ */ jsx38(
|
5487
|
+
IconButton,
|
5488
|
+
{
|
5489
|
+
onClick: () => {
|
5490
|
+
toggleSidebars("right");
|
5491
|
+
},
|
5492
|
+
title: "Toggle right sidebar",
|
5493
|
+
children: /* @__PURE__ */ jsx38(PanelRight, { focusable: "false" })
|
5494
|
+
}
|
5495
|
+
)
|
5371
5496
|
}
|
5372
5497
|
)
|
5373
|
-
|
5374
|
-
|
5375
|
-
|
5376
|
-
/* @__PURE__ */ jsx38(
|
5377
|
-
|
5378
|
-
|
5379
|
-
|
5380
|
-
/* @__PURE__ */
|
5381
|
-
"
|
5382
|
-
{
|
5383
|
-
|
5384
|
-
|
5385
|
-
|
5386
|
-
|
5387
|
-
|
5388
|
-
|
5389
|
-
|
5390
|
-
|
5391
|
-
|
5392
|
-
|
5393
|
-
|
5394
|
-
|
5395
|
-
|
5396
|
-
|
5397
|
-
|
5398
|
-
|
5399
|
-
|
5400
|
-
|
5401
|
-
|
5402
|
-
|
5403
|
-
|
5404
|
-
dispatch,
|
5405
|
-
onPublish,
|
5406
|
-
menuOpen,
|
5407
|
-
renderHeaderActions: () => /* @__PURE__ */ jsx38(CustomHeaderActions, { children: /* @__PURE__ */ jsx38(
|
5408
|
-
Button,
|
5498
|
+
]
|
5499
|
+
}
|
5500
|
+
),
|
5501
|
+
/* @__PURE__ */ jsx38(
|
5502
|
+
"div",
|
5503
|
+
{
|
5504
|
+
className: getLayoutClassName("headerTitle"),
|
5505
|
+
children: /* @__PURE__ */ jsxs21(Heading, { rank: "2", size: "xs", children: [
|
5506
|
+
headerTitle || rootProps.title || "Page",
|
5507
|
+
headerPath && /* @__PURE__ */ jsxs21(Fragment19, { children: [
|
5508
|
+
" ",
|
5509
|
+
/* @__PURE__ */ jsx38(
|
5510
|
+
"code",
|
5511
|
+
{
|
5512
|
+
className: getLayoutClassName(
|
5513
|
+
"headerPath"
|
5514
|
+
),
|
5515
|
+
children: headerPath
|
5516
|
+
}
|
5517
|
+
)
|
5518
|
+
] })
|
5519
|
+
] })
|
5520
|
+
}
|
5521
|
+
),
|
5522
|
+
/* @__PURE__ */ jsxs21(
|
5523
|
+
"div",
|
5524
|
+
{
|
5525
|
+
className: getLayoutClassName("headerTools"),
|
5526
|
+
children: [
|
5527
|
+
/* @__PURE__ */ jsx38(
|
5528
|
+
"div",
|
5409
5529
|
{
|
5410
|
-
|
5411
|
-
|
5412
|
-
|
5413
|
-
|
5414
|
-
|
5530
|
+
className: getLayoutClassName("menuButton"),
|
5531
|
+
children: /* @__PURE__ */ jsx38(
|
5532
|
+
IconButton,
|
5533
|
+
{
|
5534
|
+
onClick: () => {
|
5535
|
+
return setMenuOpen(!menuOpen);
|
5536
|
+
},
|
5537
|
+
title: "Toggle menu bar",
|
5538
|
+
children: menuOpen ? /* @__PURE__ */ jsx38(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ jsx38(ChevronDown, { focusable: "false" })
|
5539
|
+
}
|
5540
|
+
)
|
5415
5541
|
}
|
5416
|
-
)
|
5417
|
-
|
5418
|
-
|
5419
|
-
|
5420
|
-
|
5542
|
+
),
|
5543
|
+
/* @__PURE__ */ jsx38(
|
5544
|
+
MenuBar,
|
5545
|
+
{
|
5546
|
+
appState,
|
5547
|
+
dispatch,
|
5548
|
+
onPublish,
|
5549
|
+
menuOpen,
|
5550
|
+
renderHeaderActions: () => /* @__PURE__ */ jsx38(CustomHeaderActions, { children: /* @__PURE__ */ jsx38(
|
5551
|
+
Button,
|
5552
|
+
{
|
5553
|
+
onClick: () => {
|
5554
|
+
onPublish && onPublish(data);
|
5555
|
+
},
|
5556
|
+
icon: /* @__PURE__ */ jsx38(Globe, { size: "14px" }),
|
5557
|
+
children: "Publish"
|
5558
|
+
}
|
5559
|
+
) }),
|
5560
|
+
setMenuOpen
|
5561
|
+
}
|
5562
|
+
)
|
5563
|
+
]
|
5564
|
+
}
|
5565
|
+
)
|
5421
5566
|
] }) })
|
5422
5567
|
}
|
5423
5568
|
),
|
@@ -5442,7 +5587,7 @@ function Puck({
|
|
5442
5587
|
}
|
5443
5588
|
)
|
5444
5589
|
}
|
5445
|
-
)
|
5590
|
+
) })
|
5446
5591
|
}
|
5447
5592
|
),
|
5448
5593
|
/* @__PURE__ */ jsx38("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
@@ -5456,7 +5601,10 @@ Puck.Preview = Preview;
|
|
5456
5601
|
// components/Render/index.tsx
|
5457
5602
|
init_react_import();
|
5458
5603
|
import { jsx as jsx39 } from "react/jsx-runtime";
|
5459
|
-
function Render({
|
5604
|
+
function Render({
|
5605
|
+
config,
|
5606
|
+
data
|
5607
|
+
}) {
|
5460
5608
|
var _a;
|
5461
5609
|
const defaultedData = __spreadProps(__spreadValues({}, data), {
|
5462
5610
|
root: data.root || {},
|
@@ -5588,24 +5736,15 @@ var usePuck = () => {
|
|
5588
5736
|
history,
|
5589
5737
|
dispatch,
|
5590
5738
|
selectedItem: currentItem,
|
5591
|
-
|
5739
|
+
getPermissions,
|
5740
|
+
refreshPermissions
|
5592
5741
|
} = useAppContext();
|
5593
5742
|
return {
|
5594
5743
|
appState,
|
5595
5744
|
config,
|
5596
5745
|
dispatch,
|
5597
|
-
getPermissions
|
5598
|
-
|
5599
|
-
type
|
5600
|
-
} = {}) => {
|
5601
|
-
return getPermissions({
|
5602
|
-
selectedItem: item || currentItem,
|
5603
|
-
type,
|
5604
|
-
globalPermissions: globalPermissions || {},
|
5605
|
-
config,
|
5606
|
-
appState
|
5607
|
-
});
|
5608
|
-
},
|
5746
|
+
getPermissions,
|
5747
|
+
refreshPermissions,
|
5609
5748
|
history: {
|
5610
5749
|
back: history.back,
|
5611
5750
|
forward: history.forward,
|
@@ -5631,6 +5770,7 @@ export {
|
|
5631
5770
|
DropZoneProvider,
|
5632
5771
|
FieldLabel,
|
5633
5772
|
FieldLabelInternal2 as FieldLabelInternal,
|
5773
|
+
Group,
|
5634
5774
|
IconButton,
|
5635
5775
|
Puck,
|
5636
5776
|
Render,
|