@reacteditor/core 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/{Editor-KXEVJBNG.mjs → Editor-GK6JTUPD.mjs} +7 -7
- package/dist/{actions-2L-1hQ7r.d.mts → actions-C0LX6bI4.d.mts} +2 -1
- package/dist/{actions-2L-1hQ7r.d.ts → actions-C0LX6bI4.d.ts} +2 -1
- package/dist/{chunk-LRFRIIKG.mjs → chunk-56I7ST5F.mjs} +1 -1
- package/dist/{chunk-DU757QEH.mjs → chunk-74TOLW7F.mjs} +1561 -1266
- package/dist/{chunk-IIRJMJFU.mjs → chunk-ERNSJXVF.mjs} +1 -0
- package/dist/{chunk-TI3KC54Y.mjs → chunk-II42EKFK.mjs} +47 -1
- package/dist/{chunk-AD7BMXAA.mjs → chunk-MJJPWASL.mjs} +1 -1
- package/dist/{chunk-U7VW3V3W.mjs → chunk-TGVAC3JP.mjs} +9 -9
- package/dist/{chunk-FT6UFK7G.mjs → chunk-X4EUZIHA.mjs} +1 -1
- package/dist/{chunk-OIFPBVSF.mjs → chunk-XLVEWZWT.mjs} +1 -1
- package/dist/{chunk-AJWRDM22.mjs → chunk-YBG2RYVF.mjs} +5 -5
- package/dist/{full-ZFZZ626B.mjs → full-IUPXFMQP.mjs} +6 -6
- package/dist/{index-BXuSeNez.d.mts → index-DMbFEg8G.d.mts} +1 -1
- package/dist/{index-BNsSzMCj.d.ts → index-DmThy7vE.d.ts} +1 -1
- package/dist/index.css +109 -109
- package/dist/index.d.mts +155 -17
- package/dist/index.d.ts +155 -17
- package/dist/index.js +1080 -731
- package/dist/index.mjs +31 -15
- package/dist/internal.d.mts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/{loaded-GLBLMTBL.mjs → loaded-BT7NIVEO.mjs} +3 -3
- package/dist/{loaded-O4QHGE26.mjs → loaded-HVOKDVC3.mjs} +3 -3
- package/dist/{loaded-R34BR6I5.mjs → loaded-YFYCF5F4.mjs} +3 -3
- package/dist/nextjs.d.mts +38 -0
- package/dist/nextjs.d.ts +38 -0
- package/dist/nextjs.js +65 -0
- package/dist/nextjs.mjs +30 -0
- package/dist/no-external.css +109 -109
- package/dist/no-external.d.mts +4 -4
- package/dist/no-external.d.ts +4 -4
- package/dist/no-external.js +1080 -731
- package/dist/no-external.mjs +31 -15
- package/dist/remix.d.mts +33 -0
- package/dist/remix.d.ts +33 -0
- package/dist/remix.js +65 -0
- package/dist/remix.mjs +30 -0
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +49 -0
- package/dist/rsc.mjs +6 -2
- package/dist/{walk-tree-C9GrSWsR.d.ts → walk-tree-5oDs6qOL.d.mts} +33 -2
- package/dist/{walk-tree-4C3ODO3X.d.mts → walk-tree-B1q6t5Jp.d.ts} +33 -2
- package/package.json +17 -6
package/dist/no-external.js
CHANGED
|
@@ -3165,6 +3165,7 @@ var init_default_app_state = __esm({
|
|
|
3165
3165
|
ui: {
|
|
3166
3166
|
leftSideBarVisible: true,
|
|
3167
3167
|
rightSideBarVisible: true,
|
|
3168
|
+
navBarVisible: true,
|
|
3168
3169
|
arrayState: {},
|
|
3169
3170
|
itemSelector: null,
|
|
3170
3171
|
componentList: {},
|
|
@@ -5402,11 +5403,11 @@ function RichTextRender({
|
|
|
5402
5403
|
}) {
|
|
5403
5404
|
const { tiptap = {}, options } = field;
|
|
5404
5405
|
const { extensions = [] } = tiptap;
|
|
5405
|
-
const loadedExtensions = (0,
|
|
5406
|
+
const loadedExtensions = (0, import_react60.useMemo)(
|
|
5406
5407
|
() => [EditorRichText.configure(options), ...extensions],
|
|
5407
5408
|
[field, extensions]
|
|
5408
5409
|
);
|
|
5409
|
-
const normalized = (0,
|
|
5410
|
+
const normalized = (0, import_react60.useMemo)(() => {
|
|
5410
5411
|
if (typeof content === "object" && (content == null ? void 0 : content.type) === "doc") {
|
|
5411
5412
|
return content;
|
|
5412
5413
|
}
|
|
@@ -5424,23 +5425,23 @@ function RichTextRender({
|
|
|
5424
5425
|
}
|
|
5425
5426
|
return { type: "doc", content: [] };
|
|
5426
5427
|
}, [content, loadedExtensions]);
|
|
5427
|
-
const html = (0,
|
|
5428
|
+
const html = (0, import_react60.useMemo)(() => {
|
|
5428
5429
|
return (0, import_html.generateHTML)(normalized, loadedExtensions);
|
|
5429
5430
|
}, [normalized, loadedExtensions]);
|
|
5430
|
-
return /* @__PURE__ */ (0,
|
|
5431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: getClassName25(), children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "rich-text", dangerouslySetInnerHTML: { __html: html } }) });
|
|
5431
5432
|
}
|
|
5432
|
-
var import_html,
|
|
5433
|
+
var import_html, import_react60, import_jsx_runtime61, getClassName25;
|
|
5433
5434
|
var init_Render = __esm({
|
|
5434
5435
|
"components/RichTextEditor/components/Render.tsx"() {
|
|
5435
5436
|
"use strict";
|
|
5436
5437
|
init_react_import();
|
|
5437
5438
|
import_html = require("@tiptap/html");
|
|
5438
|
-
|
|
5439
|
+
import_react60 = require("react");
|
|
5439
5440
|
init_get_class_name_factory();
|
|
5440
5441
|
init_styles_module6();
|
|
5441
5442
|
init_extension();
|
|
5442
|
-
|
|
5443
|
-
|
|
5443
|
+
import_jsx_runtime61 = require("react/jsx-runtime");
|
|
5444
|
+
getClassName25 = get_class_name_factory_default("RichTextEditor", styles_module_default14);
|
|
5444
5445
|
}
|
|
5445
5446
|
});
|
|
5446
5447
|
|
|
@@ -5449,6 +5450,8 @@ var no_external_exports = {};
|
|
|
5449
5450
|
__export(no_external_exports, {
|
|
5450
5451
|
Action: () => Action,
|
|
5451
5452
|
ActionBar: () => ActionBar,
|
|
5453
|
+
App: () => App,
|
|
5454
|
+
AppProvider: () => AppProvider,
|
|
5452
5455
|
AutoField: () => AutoField,
|
|
5453
5456
|
Button: () => Button,
|
|
5454
5457
|
ComponentList: () => ComponentList,
|
|
@@ -5461,9 +5464,11 @@ __export(no_external_exports, {
|
|
|
5461
5464
|
Render: () => Render,
|
|
5462
5465
|
RichTextMenu: () => RichTextMenu,
|
|
5463
5466
|
Separator: () => Separator,
|
|
5467
|
+
appConfigContext: () => appConfigContext,
|
|
5464
5468
|
blocksPlugin: () => blocksPlugin,
|
|
5465
5469
|
createUseEditor: () => createUseEditor,
|
|
5466
5470
|
fieldsPlugin: () => fieldsPlugin,
|
|
5471
|
+
getRouteProps: () => getRouteProps,
|
|
5467
5472
|
legacySideBarPlugin: () => legacySideBarPlugin,
|
|
5468
5473
|
migrate: () => migrate,
|
|
5469
5474
|
outlinePlugin: () => outlinePlugin,
|
|
@@ -5472,11 +5477,15 @@ __export(no_external_exports, {
|
|
|
5472
5477
|
registerOverlayPortal: () => registerOverlayPortal,
|
|
5473
5478
|
renderContext: () => renderContext,
|
|
5474
5479
|
resolveAllData: () => resolveAllData,
|
|
5480
|
+
resolveRouteFromString: () => resolveRouteFromString,
|
|
5475
5481
|
setDeep: () => setDeep,
|
|
5476
5482
|
transformProps: () => transformProps,
|
|
5483
|
+
useApp: () => useApp,
|
|
5477
5484
|
useEditor: () => useEditor2,
|
|
5478
5485
|
useGetEditor: () => useGetEditor,
|
|
5479
5486
|
usePropsContext: () => usePropsContext,
|
|
5487
|
+
useRouteParams: () => useRouteParams,
|
|
5488
|
+
useStableValue: () => useStableValue,
|
|
5480
5489
|
walkTree: () => walkTree
|
|
5481
5490
|
});
|
|
5482
5491
|
module.exports = __toCommonJS(no_external_exports);
|
|
@@ -7904,16 +7913,245 @@ function AutoField(props) {
|
|
|
7904
7913
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(fieldContextStore.Provider, { value: { [id]: props.value }, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(AutoFieldPublicInternal, __spreadProps(__spreadValues({}, props), { id })) });
|
|
7905
7914
|
}
|
|
7906
7915
|
|
|
7916
|
+
// components/App/index.ts
|
|
7917
|
+
init_react_import();
|
|
7918
|
+
|
|
7919
|
+
// components/App/App.tsx
|
|
7920
|
+
init_react_import();
|
|
7921
|
+
var import_react_router3 = require("react-router");
|
|
7922
|
+
|
|
7923
|
+
// components/Editor/index.tsx
|
|
7924
|
+
init_react_import();
|
|
7925
|
+
var import_react95 = require("react");
|
|
7926
|
+
init_store();
|
|
7927
|
+
|
|
7928
|
+
// components/Editor/components/Fields/index.tsx
|
|
7929
|
+
init_react_import();
|
|
7930
|
+
init_Loader();
|
|
7931
|
+
init_root_droppable_id();
|
|
7932
|
+
|
|
7933
|
+
// lib/get-selector-for-id.ts
|
|
7934
|
+
init_react_import();
|
|
7935
|
+
var getSelectorForId = (state, id) => {
|
|
7936
|
+
const node = state.indexes.nodes[id];
|
|
7937
|
+
if (!node) return;
|
|
7938
|
+
const zoneCompound = `${node.parentId}:${node.zone}`;
|
|
7939
|
+
const index = state.indexes.zones[zoneCompound].contentIds.indexOf(id);
|
|
7940
|
+
return { zone: zoneCompound, index };
|
|
7941
|
+
};
|
|
7942
|
+
|
|
7943
|
+
// components/Editor/components/Fields/index.tsx
|
|
7944
|
+
init_store();
|
|
7945
|
+
|
|
7946
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Fields/styles.module.css#css-module
|
|
7947
|
+
init_react_import();
|
|
7948
|
+
var styles_module_default16 = { "EditorFields": "_EditorFields_3dnua_1", "EditorFields--isLoading": "_EditorFields--isLoading_3dnua_6", "EditorFields-loadingOverlay": "_EditorFields-loadingOverlay_3dnua_10", "EditorFields-loadingOverlayInner": "_EditorFields-loadingOverlayInner_3dnua_25", "EditorFields-field": "_EditorFields-field_3dnua_32", "EditorFields--wrapFields": "_EditorFields--wrapFields_3dnua_36", "EditorFields-syncButton": "_EditorFields-syncButton_3dnua_46", "EditorFields-syncButton--unlinked": "_EditorFields-syncButton--unlinked_3dnua_78" };
|
|
7949
|
+
|
|
7950
|
+
// components/Editor/components/Fields/index.tsx
|
|
7951
|
+
init_lib();
|
|
7952
|
+
var import_react50 = require("react");
|
|
7953
|
+
init_fields();
|
|
7954
|
+
var import_shallow4 = require("zustand/react/shallow");
|
|
7955
|
+
init_lucide_react();
|
|
7956
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
7957
|
+
var getClassName22 = get_class_name_factory_default("EditorFields", styles_module_default16);
|
|
7958
|
+
var DefaultFields = ({
|
|
7959
|
+
children
|
|
7960
|
+
}) => {
|
|
7961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children });
|
|
7962
|
+
};
|
|
7963
|
+
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
|
|
7964
|
+
const { dispatch, state, selectedItem, resolveComponentData: resolveComponentData2 } = appStore.getState();
|
|
7965
|
+
const { data, ui } = state;
|
|
7966
|
+
const { itemSelector } = ui;
|
|
7967
|
+
const rootProps = data.root.props || data.root;
|
|
7968
|
+
const currentProps = selectedItem ? selectedItem.props : rootProps;
|
|
7969
|
+
const newProps = __spreadProps(__spreadValues({}, currentProps), { [fieldName]: value });
|
|
7970
|
+
if (selectedItem && itemSelector) {
|
|
7971
|
+
const resolved = yield resolveComponentData2(
|
|
7972
|
+
__spreadProps(__spreadValues({}, selectedItem), { props: newProps }),
|
|
7973
|
+
"replace"
|
|
7974
|
+
);
|
|
7975
|
+
const latestSelector = getSelectorForId(
|
|
7976
|
+
appStore.getState().state,
|
|
7977
|
+
selectedItem.props.id
|
|
7978
|
+
);
|
|
7979
|
+
if (!latestSelector) return;
|
|
7980
|
+
dispatch({
|
|
7981
|
+
type: "replace",
|
|
7982
|
+
destinationIndex: latestSelector.index,
|
|
7983
|
+
destinationZone: latestSelector.zone || rootDroppableId,
|
|
7984
|
+
data: resolved.node,
|
|
7985
|
+
ui: updatedUi
|
|
7986
|
+
});
|
|
7987
|
+
return;
|
|
7988
|
+
}
|
|
7989
|
+
if (data.root.props) {
|
|
7990
|
+
dispatch({
|
|
7991
|
+
type: "replaceRoot",
|
|
7992
|
+
root: (yield resolveComponentData2(
|
|
7993
|
+
__spreadProps(__spreadValues({}, data.root), { props: newProps }),
|
|
7994
|
+
"replace"
|
|
7995
|
+
)).node,
|
|
7996
|
+
ui: __spreadValues(__spreadValues({}, ui), updatedUi),
|
|
7997
|
+
recordHistory: true
|
|
7998
|
+
});
|
|
7999
|
+
return;
|
|
8000
|
+
}
|
|
8001
|
+
dispatch({
|
|
8002
|
+
type: "setData",
|
|
8003
|
+
data: { root: newProps }
|
|
8004
|
+
});
|
|
8005
|
+
});
|
|
8006
|
+
var FieldsChildInner = ({ fieldName }) => {
|
|
8007
|
+
const field = useAppStore((s) => s.fields.fields[fieldName]);
|
|
8008
|
+
const isReadOnly = useAppStore(
|
|
8009
|
+
(s) => ((s.selectedItem ? s.selectedItem.readOnly : s.state.data.root.readOnly) || {})[fieldName]
|
|
8010
|
+
);
|
|
8011
|
+
const id = useAppStore((s) => {
|
|
8012
|
+
if (!field) return null;
|
|
8013
|
+
return s.selectedItem ? `${s.selectedItem.props.id}_${field.type}_${fieldName}` : `root_${field.type}_${fieldName}`;
|
|
8014
|
+
});
|
|
8015
|
+
const permissions = useAppStore(
|
|
8016
|
+
(0, import_shallow4.useShallow)((s) => {
|
|
8017
|
+
const { selectedItem, permissions: permissions2 } = s;
|
|
8018
|
+
return selectedItem ? permissions2.getPermissions({ item: selectedItem }) : permissions2.getPermissions({ root: true });
|
|
8019
|
+
})
|
|
8020
|
+
);
|
|
8021
|
+
const appStore = useAppStoreApi();
|
|
8022
|
+
const onChange = (0, import_react50.useCallback)(createOnChange(fieldName, appStore), [
|
|
8023
|
+
fieldName
|
|
8024
|
+
]);
|
|
8025
|
+
const { visible = true } = field != null ? field : {};
|
|
8026
|
+
const fieldStore = (0, import_react50.useContext)(fieldContextStore.ctx);
|
|
8027
|
+
(0, import_react50.useEffect)(() => {
|
|
8028
|
+
return appStore.subscribe(
|
|
8029
|
+
(s) => {
|
|
8030
|
+
var _a;
|
|
8031
|
+
const data = s.getCurrentData();
|
|
8032
|
+
return (_a = data.props) == null ? void 0 : _a[fieldName];
|
|
8033
|
+
},
|
|
8034
|
+
(value) => {
|
|
8035
|
+
fieldStore.setState({ [fieldName]: value });
|
|
8036
|
+
}
|
|
8037
|
+
);
|
|
8038
|
+
}, [appStore, fieldStore]);
|
|
8039
|
+
if (!field || !id || !visible) return null;
|
|
8040
|
+
if (field.type === "slot") return null;
|
|
8041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: getClassName22("field"), children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
8042
|
+
AutoFieldPrivate,
|
|
8043
|
+
{
|
|
8044
|
+
field,
|
|
8045
|
+
name: fieldName,
|
|
8046
|
+
id,
|
|
8047
|
+
readOnly: !permissions.edit || isReadOnly,
|
|
8048
|
+
onChange
|
|
8049
|
+
}
|
|
8050
|
+
) }, id);
|
|
8051
|
+
};
|
|
8052
|
+
var FieldsChild = ({ fieldName }) => {
|
|
8053
|
+
const appStore = useAppStoreApi();
|
|
8054
|
+
const initialValue = (0, import_react50.useMemo)(() => {
|
|
8055
|
+
var _a;
|
|
8056
|
+
const value = (_a = appStore.getState().getCurrentData().props) == null ? void 0 : _a[fieldName];
|
|
8057
|
+
return { [fieldName]: value };
|
|
8058
|
+
}, []);
|
|
8059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(fieldContextStore.Provider, { value: initialValue, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(FieldsChildInner, { fieldName }) });
|
|
8060
|
+
};
|
|
8061
|
+
var FieldsChildMemo = (0, import_react50.memo)(FieldsChild);
|
|
8062
|
+
var GlobalSyncButton = () => {
|
|
8063
|
+
const appStore = useAppStoreApi();
|
|
8064
|
+
const selectedItem = useAppStore((s) => s.selectedItem);
|
|
8065
|
+
const isGlobalType = useAppStore(
|
|
8066
|
+
(s) => {
|
|
8067
|
+
var _a;
|
|
8068
|
+
return selectedItem ? ((_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.global) === true : false;
|
|
8069
|
+
}
|
|
8070
|
+
);
|
|
8071
|
+
if (!selectedItem || !isGlobalType) return null;
|
|
8072
|
+
const isUnlinked = selectedItem.synced === false;
|
|
8073
|
+
const onClick = () => __async(null, null, function* () {
|
|
8074
|
+
const { dispatch, state, resolveComponentData: resolveComponentData2 } = appStore.getState();
|
|
8075
|
+
const latestSelector = getSelectorForId(state, selectedItem.props.id);
|
|
8076
|
+
if (!latestSelector) return;
|
|
8077
|
+
const resolved = yield resolveComponentData2(
|
|
8078
|
+
__spreadProps(__spreadValues({}, selectedItem), { synced: isUnlinked ? true : false }),
|
|
8079
|
+
"replace"
|
|
8080
|
+
);
|
|
8081
|
+
dispatch({
|
|
8082
|
+
type: "replace",
|
|
8083
|
+
destinationIndex: latestSelector.index,
|
|
8084
|
+
destinationZone: latestSelector.zone || rootDroppableId,
|
|
8085
|
+
data: resolved.node
|
|
8086
|
+
});
|
|
8087
|
+
});
|
|
8088
|
+
const syncButtonClass = [
|
|
8089
|
+
getClassName22("syncButton"),
|
|
8090
|
+
isUnlinked ? styles_module_default16["EditorFields-syncButton--unlinked"] : null
|
|
8091
|
+
].filter(Boolean).join(" ");
|
|
8092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("button", { type: "button", className: syncButtonClass, onClick, children: [
|
|
8093
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Link, { size: 14 }),
|
|
8094
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { children: isUnlinked ? "Link to shared" : "Linked to shared" })
|
|
8095
|
+
] });
|
|
8096
|
+
};
|
|
8097
|
+
var FieldsInternal = ({ wrapFields = true }) => {
|
|
8098
|
+
const overrides = useAppStore((s) => s.overrides);
|
|
8099
|
+
const componentResolving = useAppStore((s) => {
|
|
8100
|
+
var _a, _b;
|
|
8101
|
+
const loadingCount = s.selectedItem ? (_a = s.componentState[s.selectedItem.props.id]) == null ? void 0 : _a.loadingCount : (_b = s.componentState["root"]) == null ? void 0 : _b.loadingCount;
|
|
8102
|
+
return (loadingCount != null ? loadingCount : 0) > 0;
|
|
8103
|
+
});
|
|
8104
|
+
const itemSelector = useAppStore((0, import_shallow4.useShallow)((s) => s.state.ui.itemSelector));
|
|
8105
|
+
const id = useAppStore((s) => {
|
|
8106
|
+
var _a;
|
|
8107
|
+
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
|
8108
|
+
});
|
|
8109
|
+
const appStore = useAppStoreApi();
|
|
8110
|
+
useRegisterFieldsSlice(appStore, id);
|
|
8111
|
+
const fieldsLoading = useAppStore((s) => s.fields.loading);
|
|
8112
|
+
const fieldNames = useAppStore(
|
|
8113
|
+
(0, import_shallow4.useShallow)((s) => {
|
|
8114
|
+
if (s.fields.id === id) {
|
|
8115
|
+
return Object.keys(s.fields.fields);
|
|
8116
|
+
}
|
|
8117
|
+
return [];
|
|
8118
|
+
})
|
|
8119
|
+
);
|
|
8120
|
+
const isLoading = fieldsLoading || componentResolving;
|
|
8121
|
+
const Wrapper = (0, import_react50.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
|
8122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
8123
|
+
"form",
|
|
8124
|
+
{
|
|
8125
|
+
className: getClassName22({ wrapFields }),
|
|
8126
|
+
onSubmit: (e) => {
|
|
8127
|
+
e.preventDefault();
|
|
8128
|
+
},
|
|
8129
|
+
children: [
|
|
8130
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Wrapper, { isLoading, itemSelector, children: [
|
|
8131
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(GlobalSyncButton, {}),
|
|
8132
|
+
fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(FieldsChildMemo, { fieldName }, fieldName))
|
|
8133
|
+
] }),
|
|
8134
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: getClassName22("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: getClassName22("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Loader, { size: 16 }) }) })
|
|
8135
|
+
]
|
|
8136
|
+
}
|
|
8137
|
+
);
|
|
8138
|
+
};
|
|
8139
|
+
var Fields = (0, import_react50.memo)(FieldsInternal);
|
|
8140
|
+
|
|
8141
|
+
// components/Editor/components/Components/index.tsx
|
|
8142
|
+
init_react_import();
|
|
8143
|
+
init_store();
|
|
8144
|
+
|
|
7907
8145
|
// components/ComponentList/index.tsx
|
|
7908
8146
|
init_react_import();
|
|
7909
8147
|
|
|
7910
8148
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ComponentList/styles.module.css#css-module
|
|
7911
8149
|
init_react_import();
|
|
7912
|
-
var
|
|
8150
|
+
var styles_module_default17 = { "ComponentList": "_ComponentList_1mlcu_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_1mlcu_5", "ComponentList-content": "_ComponentList-content_1mlcu_9", "ComponentList-title": "_ComponentList-title_1mlcu_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_1mlcu_54" };
|
|
7913
8151
|
|
|
7914
8152
|
// components/ComponentList/index.tsx
|
|
7915
8153
|
init_get_class_name_factory();
|
|
7916
|
-
var
|
|
8154
|
+
var import_react75 = require("react");
|
|
7917
8155
|
init_lucide_react();
|
|
7918
8156
|
init_store();
|
|
7919
8157
|
|
|
@@ -7922,31 +8160,31 @@ init_react_import();
|
|
|
7922
8160
|
|
|
7923
8161
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Drawer/styles.module.css#css-module
|
|
7924
8162
|
init_react_import();
|
|
7925
|
-
var
|
|
8163
|
+
var styles_module_default18 = { "Drawer": "_Drawer_1h4db_1", "Drawer--tile": "_Drawer--tile_1h4db_8", "Drawer-draggable": "_Drawer-draggable_1h4db_19", "Drawer-draggableBg": "_Drawer-draggableBg_1h4db_23", "DrawerItem-draggable": "_DrawerItem-draggable_1h4db_33", "DrawerItem-icon": "_DrawerItem-icon_1h4db_50", "DrawerItem--disabled": "_DrawerItem--disabled_1h4db_56", "DrawerItem": "_DrawerItem_1h4db_33", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_1h4db_66", "DrawerItem-name": "_DrawerItem-name_1h4db_91" };
|
|
7926
8164
|
|
|
7927
8165
|
// components/Drawer/index.tsx
|
|
7928
8166
|
init_get_class_name_factory();
|
|
7929
|
-
var
|
|
8167
|
+
var import_react73 = require("react");
|
|
7930
8168
|
init_generate_id();
|
|
7931
8169
|
|
|
7932
8170
|
// components/DragDropContext/index.tsx
|
|
7933
8171
|
init_react_import();
|
|
7934
|
-
var
|
|
8172
|
+
var import_react71 = require("@dnd-kit/react");
|
|
7935
8173
|
init_store();
|
|
7936
|
-
var
|
|
8174
|
+
var import_react72 = require("react");
|
|
7937
8175
|
var import_dom4 = require("@dnd-kit/dom");
|
|
7938
8176
|
|
|
7939
8177
|
// components/DropZone/index.tsx
|
|
7940
8178
|
init_react_import();
|
|
7941
|
-
var
|
|
8179
|
+
var import_react69 = require("react");
|
|
7942
8180
|
|
|
7943
8181
|
// components/DraggableComponent/index.tsx
|
|
7944
8182
|
init_react_import();
|
|
7945
|
-
var
|
|
8183
|
+
var import_react53 = require("react");
|
|
7946
8184
|
|
|
7947
8185
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/DraggableComponent/styles.module.css#css-module
|
|
7948
8186
|
init_react_import();
|
|
7949
|
-
var
|
|
8187
|
+
var styles_module_default19 = { "DraggableComponent": "_DraggableComponent_ie0on_1", "DraggableComponent-overlayWrapper": "_DraggableComponent-overlayWrapper_ie0on_12", "DraggableComponent-overlay": "_DraggableComponent-overlay_ie0on_12", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_ie0on_36", "DraggableComponent--hover": "_DraggableComponent--hover_ie0on_53", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_ie0on_60", "DraggableComponent--isGlobal": "_DraggableComponent--isGlobal_ie0on_69", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_ie0on_105", "DraggableComponent-actions": "_DraggableComponent-actions_ie0on_105" };
|
|
7950
8188
|
|
|
7951
8189
|
// components/DraggableComponent/index.tsx
|
|
7952
8190
|
init_get_class_name_factory();
|
|
@@ -7977,12 +8215,12 @@ function getDeepScrollPosition(element) {
|
|
|
7977
8215
|
|
|
7978
8216
|
// components/DropZone/context.tsx
|
|
7979
8217
|
init_react_import();
|
|
7980
|
-
var
|
|
8218
|
+
var import_react51 = require("react");
|
|
7981
8219
|
init_store();
|
|
7982
8220
|
var import_zustand5 = require("zustand");
|
|
7983
|
-
var
|
|
7984
|
-
var dropZoneContext = (0,
|
|
7985
|
-
var ZoneStoreContext = (0,
|
|
8221
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
8222
|
+
var dropZoneContext = (0, import_react51.createContext)(null);
|
|
8223
|
+
var ZoneStoreContext = (0, import_react51.createContext)(
|
|
7986
8224
|
(0, import_zustand5.createStore)(() => ({
|
|
7987
8225
|
zoneDepthIndex: {},
|
|
7988
8226
|
nextZoneDepthIndex: {},
|
|
@@ -8003,14 +8241,14 @@ var ZoneStoreProvider = ({
|
|
|
8003
8241
|
children,
|
|
8004
8242
|
store
|
|
8005
8243
|
}) => {
|
|
8006
|
-
return /* @__PURE__ */ (0,
|
|
8244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ZoneStoreContext.Provider, { value: store, children });
|
|
8007
8245
|
};
|
|
8008
8246
|
var DropZoneProvider = ({
|
|
8009
8247
|
children,
|
|
8010
8248
|
value
|
|
8011
8249
|
}) => {
|
|
8012
8250
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
8013
|
-
const registerZone = (0,
|
|
8251
|
+
const registerZone = (0, import_react51.useCallback)(
|
|
8014
8252
|
(zoneCompound) => {
|
|
8015
8253
|
dispatch({
|
|
8016
8254
|
type: "registerZone",
|
|
@@ -8019,28 +8257,28 @@ var DropZoneProvider = ({
|
|
|
8019
8257
|
},
|
|
8020
8258
|
[dispatch]
|
|
8021
8259
|
);
|
|
8022
|
-
const memoValue = (0,
|
|
8260
|
+
const memoValue = (0, import_react51.useMemo)(
|
|
8023
8261
|
() => __spreadValues({
|
|
8024
8262
|
registerZone
|
|
8025
8263
|
}, value),
|
|
8026
8264
|
[value]
|
|
8027
8265
|
);
|
|
8028
|
-
return /* @__PURE__ */ (0,
|
|
8266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: memoValue && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(dropZoneContext.Provider, { value: memoValue, children }) });
|
|
8029
8267
|
};
|
|
8030
8268
|
|
|
8031
8269
|
// components/DraggableComponent/index.tsx
|
|
8032
|
-
var
|
|
8270
|
+
var import_shallow5 = require("zustand/react/shallow");
|
|
8033
8271
|
init_get_item();
|
|
8034
8272
|
var import_sortable2 = require("@dnd-kit/react/sortable");
|
|
8035
8273
|
var import_dom3 = require("@dnd-kit/dom");
|
|
8036
8274
|
|
|
8037
8275
|
// lib/dnd/use-on-drag-finished.ts
|
|
8038
8276
|
init_react_import();
|
|
8039
|
-
var
|
|
8277
|
+
var import_react52 = require("react");
|
|
8040
8278
|
init_store();
|
|
8041
8279
|
var useOnDragFinished = (cb, deps = []) => {
|
|
8042
8280
|
const appStore = useAppStoreApi();
|
|
8043
|
-
return (0,
|
|
8281
|
+
return (0, import_react52.useCallback)(() => {
|
|
8044
8282
|
let dispose = () => {
|
|
8045
8283
|
};
|
|
8046
8284
|
const processDragging = (isDragging2) => {
|
|
@@ -8086,8 +8324,8 @@ function assignRefs(refs, node) {
|
|
|
8086
8324
|
}
|
|
8087
8325
|
|
|
8088
8326
|
// components/DraggableComponent/index.tsx
|
|
8089
|
-
var
|
|
8090
|
-
var
|
|
8327
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
8328
|
+
var getClassName23 = get_class_name_factory_default("DraggableComponent", styles_module_default19);
|
|
8091
8329
|
var DEBUG2 = false;
|
|
8092
8330
|
var MEASURE_EVERY_MS = 100;
|
|
8093
8331
|
var space = 8;
|
|
@@ -8098,16 +8336,16 @@ var DefaultActionBar = ({
|
|
|
8098
8336
|
label,
|
|
8099
8337
|
children,
|
|
8100
8338
|
parentAction
|
|
8101
|
-
}) => /* @__PURE__ */ (0,
|
|
8102
|
-
/* @__PURE__ */ (0,
|
|
8339
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(ActionBar, { children: [
|
|
8340
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(ActionBar.Group, { children: [
|
|
8103
8341
|
parentAction,
|
|
8104
|
-
label && /* @__PURE__ */ (0,
|
|
8342
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ActionBar.Label, { label })
|
|
8105
8343
|
] }),
|
|
8106
|
-
/* @__PURE__ */ (0,
|
|
8344
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ActionBar.Group, { children })
|
|
8107
8345
|
] });
|
|
8108
8346
|
var DefaultOverlay = ({
|
|
8109
8347
|
children
|
|
8110
|
-
}) => /* @__PURE__ */ (0,
|
|
8348
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_jsx_runtime59.Fragment, { children });
|
|
8111
8349
|
var DraggableComponent = ({
|
|
8112
8350
|
children,
|
|
8113
8351
|
depth,
|
|
@@ -8140,10 +8378,10 @@ var DraggableComponent = ({
|
|
|
8140
8378
|
return ((_a = s.config.components[componentType]) == null ? void 0 : _a.global) === true;
|
|
8141
8379
|
}
|
|
8142
8380
|
);
|
|
8143
|
-
const lastMeasureRef = (0,
|
|
8144
|
-
const ctx = (0,
|
|
8145
|
-
const [localZones, setLocalZones] = (0,
|
|
8146
|
-
const registerLocalZone = (0,
|
|
8381
|
+
const lastMeasureRef = (0, import_react53.useRef)(0);
|
|
8382
|
+
const ctx = (0, import_react53.useContext)(dropZoneContext);
|
|
8383
|
+
const [localZones, setLocalZones] = (0, import_react53.useState)({});
|
|
8384
|
+
const registerLocalZone = (0, import_react53.useCallback)(
|
|
8147
8385
|
(zoneCompound2, active) => {
|
|
8148
8386
|
var _a;
|
|
8149
8387
|
(_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
|
|
@@ -8153,7 +8391,7 @@ var DraggableComponent = ({
|
|
|
8153
8391
|
},
|
|
8154
8392
|
[setLocalZones]
|
|
8155
8393
|
);
|
|
8156
|
-
const unregisterLocalZone = (0,
|
|
8394
|
+
const unregisterLocalZone = (0, import_react53.useCallback)(
|
|
8157
8395
|
(zoneCompound2) => {
|
|
8158
8396
|
var _a;
|
|
8159
8397
|
(_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
|
|
@@ -8166,23 +8404,23 @@ var DraggableComponent = ({
|
|
|
8166
8404
|
[setLocalZones]
|
|
8167
8405
|
);
|
|
8168
8406
|
const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
|
|
8169
|
-
const path = useAppStore((0,
|
|
8407
|
+
const path = useAppStore((0, import_shallow5.useShallow)((s) => {
|
|
8170
8408
|
var _a;
|
|
8171
8409
|
return (_a = s.state.indexes.nodes[id]) == null ? void 0 : _a.path;
|
|
8172
8410
|
}));
|
|
8173
8411
|
const permissions = useAppStore(
|
|
8174
|
-
(0,
|
|
8412
|
+
(0, import_shallow5.useShallow)((s) => {
|
|
8175
8413
|
const item = getItem({ index, zone: zoneCompound }, s.state);
|
|
8176
8414
|
return s.permissions.getPermissions({ item });
|
|
8177
8415
|
})
|
|
8178
8416
|
);
|
|
8179
|
-
const zoneStore = (0,
|
|
8180
|
-
const [dragAxis, setDragAxis] = (0,
|
|
8181
|
-
const dynamicCollisionDetector = (0,
|
|
8417
|
+
const zoneStore = (0, import_react53.useContext)(ZoneStoreContext);
|
|
8418
|
+
const [dragAxis, setDragAxis] = (0, import_react53.useState)(userDragAxis || autoDragAxis);
|
|
8419
|
+
const dynamicCollisionDetector = (0, import_react53.useMemo)(
|
|
8182
8420
|
() => createDynamicCollisionDetector(dragAxis),
|
|
8183
8421
|
[dragAxis]
|
|
8184
8422
|
);
|
|
8185
|
-
const sortablePlugins = (0,
|
|
8423
|
+
const sortablePlugins = (0, import_react53.useMemo)(
|
|
8186
8424
|
() => (defaults) => [
|
|
8187
8425
|
...defaults,
|
|
8188
8426
|
import_dom3.Feedback.configure({ feedback: "clone" })
|
|
@@ -8216,7 +8454,7 @@ var DraggableComponent = ({
|
|
|
8216
8454
|
easing: "cubic-bezier(0.2, 0, 0, 1)"
|
|
8217
8455
|
}
|
|
8218
8456
|
});
|
|
8219
|
-
(0,
|
|
8457
|
+
(0, import_react53.useEffect)(() => {
|
|
8220
8458
|
const isEnabled = zoneStore.getState().enabledIndex[zoneCompound];
|
|
8221
8459
|
sortable.droppable.disabled = !isEnabled;
|
|
8222
8460
|
sortable.draggable.disabled = !permissions.drag;
|
|
@@ -8233,9 +8471,9 @@ var DraggableComponent = ({
|
|
|
8233
8471
|
}
|
|
8234
8472
|
return cleanup;
|
|
8235
8473
|
}, [permissions.drag, zoneCompound]);
|
|
8236
|
-
const [, setRerender] = (0,
|
|
8237
|
-
const ref = (0,
|
|
8238
|
-
const refSetter = (0,
|
|
8474
|
+
const [, setRerender] = (0, import_react53.useState)(0);
|
|
8475
|
+
const ref = (0, import_react53.useRef)(null);
|
|
8476
|
+
const refSetter = (0, import_react53.useCallback)(
|
|
8239
8477
|
(el) => {
|
|
8240
8478
|
sortableRef(el);
|
|
8241
8479
|
if (ref.current !== el) {
|
|
@@ -8248,14 +8486,14 @@ var DraggableComponent = ({
|
|
|
8248
8486
|
},
|
|
8249
8487
|
[itemRef, sortableRef]
|
|
8250
8488
|
);
|
|
8251
|
-
const [portalEl, setPortalEl] = (0,
|
|
8252
|
-
(0,
|
|
8489
|
+
const [portalEl, setPortalEl] = (0, import_react53.useState)();
|
|
8490
|
+
(0, import_react53.useEffect)(() => {
|
|
8253
8491
|
var _a, _b, _c;
|
|
8254
8492
|
setPortalEl(
|
|
8255
8493
|
iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : (_c = (_b = ref.current) == null ? void 0 : _b.closest("[data-editor-preview]")) != null ? _c : document.body
|
|
8256
8494
|
);
|
|
8257
8495
|
}, [iframe.enabled]);
|
|
8258
|
-
const getStyle = (0,
|
|
8496
|
+
const getStyle = (0, import_react53.useCallback)(() => {
|
|
8259
8497
|
var _a, _b;
|
|
8260
8498
|
if (!ref.current) return;
|
|
8261
8499
|
const el = ref.current;
|
|
@@ -8287,23 +8525,23 @@ var DraggableComponent = ({
|
|
|
8287
8525
|
};
|
|
8288
8526
|
return style2;
|
|
8289
8527
|
}, [iframe.enabled]);
|
|
8290
|
-
const [style, setStyle] = (0,
|
|
8291
|
-
const lastRectRef = (0,
|
|
8292
|
-
const syncRafRef = (0,
|
|
8293
|
-
const sync = (0,
|
|
8528
|
+
const [style, setStyle] = (0, import_react53.useState)();
|
|
8529
|
+
const lastRectRef = (0, import_react53.useRef)(null);
|
|
8530
|
+
const syncRafRef = (0, import_react53.useRef)(null);
|
|
8531
|
+
const sync = (0, import_react53.useCallback)(() => {
|
|
8294
8532
|
setStyle(getStyle());
|
|
8295
8533
|
if (itemRef) {
|
|
8296
8534
|
assignRefs([itemRef], ref.current);
|
|
8297
8535
|
}
|
|
8298
8536
|
}, [getStyle, itemRef]);
|
|
8299
|
-
const scheduleSync = (0,
|
|
8537
|
+
const scheduleSync = (0, import_react53.useCallback)(() => {
|
|
8300
8538
|
if (syncRafRef.current != null) return;
|
|
8301
8539
|
syncRafRef.current = requestAnimationFrame(() => {
|
|
8302
8540
|
syncRafRef.current = null;
|
|
8303
8541
|
sync();
|
|
8304
8542
|
});
|
|
8305
8543
|
}, [sync]);
|
|
8306
|
-
(0,
|
|
8544
|
+
(0, import_react53.useEffect)(() => {
|
|
8307
8545
|
return () => {
|
|
8308
8546
|
if (syncRafRef.current != null) {
|
|
8309
8547
|
cancelAnimationFrame(syncRafRef.current);
|
|
@@ -8311,7 +8549,7 @@ var DraggableComponent = ({
|
|
|
8311
8549
|
}
|
|
8312
8550
|
};
|
|
8313
8551
|
}, []);
|
|
8314
|
-
(0,
|
|
8552
|
+
(0, import_react53.useEffect)(() => {
|
|
8315
8553
|
if (ref.current) {
|
|
8316
8554
|
const observer = new ResizeObserver(() => {
|
|
8317
8555
|
scheduleSync();
|
|
@@ -8324,37 +8562,37 @@ var DraggableComponent = ({
|
|
|
8324
8562
|
}, [scheduleSync, itemRef]);
|
|
8325
8563
|
const registerNode = useAppStore((s) => s.nodes.registerNode);
|
|
8326
8564
|
const unregisterNode = useAppStore((s) => s.nodes.unregisterNode);
|
|
8327
|
-
const hideOverlay = (0,
|
|
8565
|
+
const hideOverlay = (0, import_react53.useCallback)(() => {
|
|
8328
8566
|
setIsVisible(false);
|
|
8329
8567
|
}, []);
|
|
8330
|
-
const showOverlay = (0,
|
|
8568
|
+
const showOverlay = (0, import_react53.useCallback)(() => {
|
|
8331
8569
|
setIsVisible(true);
|
|
8332
8570
|
}, []);
|
|
8333
|
-
const nodeHandleRef = (0,
|
|
8571
|
+
const nodeHandleRef = (0, import_react53.useRef)({
|
|
8334
8572
|
sync: () => null,
|
|
8335
8573
|
hideOverlay: () => null,
|
|
8336
8574
|
showOverlay: () => null
|
|
8337
8575
|
});
|
|
8338
|
-
(0,
|
|
8576
|
+
(0, import_react53.useLayoutEffect)(() => {
|
|
8339
8577
|
nodeHandleRef.current.sync = sync;
|
|
8340
8578
|
nodeHandleRef.current.hideOverlay = hideOverlay;
|
|
8341
8579
|
nodeHandleRef.current.showOverlay = showOverlay;
|
|
8342
8580
|
}, [hideOverlay, showOverlay, sync]);
|
|
8343
|
-
(0,
|
|
8581
|
+
(0, import_react53.useEffect)(() => {
|
|
8344
8582
|
registerNode(id, nodeHandleRef.current);
|
|
8345
8583
|
return () => {
|
|
8346
8584
|
unregisterNode(id);
|
|
8347
8585
|
};
|
|
8348
8586
|
}, [id, registerNode, unregisterNode]);
|
|
8349
|
-
const CustomActionBar = (0,
|
|
8587
|
+
const CustomActionBar = (0, import_react53.useMemo)(
|
|
8350
8588
|
() => overrides.actionBar || DefaultActionBar,
|
|
8351
8589
|
[overrides.actionBar]
|
|
8352
8590
|
);
|
|
8353
|
-
const CustomOverlay = (0,
|
|
8591
|
+
const CustomOverlay = (0, import_react53.useMemo)(
|
|
8354
8592
|
() => overrides.componentOverlay || DefaultOverlay,
|
|
8355
8593
|
[overrides.componentOverlay]
|
|
8356
8594
|
);
|
|
8357
|
-
const onClick = (0,
|
|
8595
|
+
const onClick = (0, import_react53.useCallback)(
|
|
8358
8596
|
(e) => {
|
|
8359
8597
|
const userIsDragging = !!zoneStore.getState().draggedItem;
|
|
8360
8598
|
if (userIsDragging) {
|
|
@@ -8383,7 +8621,7 @@ var DraggableComponent = ({
|
|
|
8383
8621
|
[index, zoneCompound, id, isSelected, fullScreenCanvas]
|
|
8384
8622
|
);
|
|
8385
8623
|
const appStore = useAppStoreApi();
|
|
8386
|
-
const onSelectParent = (0,
|
|
8624
|
+
const onSelectParent = (0, import_react53.useCallback)(() => {
|
|
8387
8625
|
const { nodes, zones } = appStore.getState().state.indexes;
|
|
8388
8626
|
const node = nodes[id];
|
|
8389
8627
|
const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node == null ? void 0 : node.parentId] : null;
|
|
@@ -8404,26 +8642,26 @@ var DraggableComponent = ({
|
|
|
8404
8642
|
}
|
|
8405
8643
|
});
|
|
8406
8644
|
}, [ctx, path]);
|
|
8407
|
-
const onDuplicate = (0,
|
|
8645
|
+
const onDuplicate = (0, import_react53.useCallback)(() => {
|
|
8408
8646
|
dispatch({
|
|
8409
8647
|
type: "duplicate",
|
|
8410
8648
|
sourceIndex: index,
|
|
8411
8649
|
sourceZone: zoneCompound
|
|
8412
8650
|
});
|
|
8413
8651
|
}, [index, zoneCompound]);
|
|
8414
|
-
const onDelete = (0,
|
|
8652
|
+
const onDelete = (0, import_react53.useCallback)(() => {
|
|
8415
8653
|
dispatch({
|
|
8416
8654
|
type: "remove",
|
|
8417
8655
|
index,
|
|
8418
8656
|
zone: zoneCompound
|
|
8419
8657
|
});
|
|
8420
8658
|
}, [index, zoneCompound]);
|
|
8421
|
-
const [hover, setHover] = (0,
|
|
8659
|
+
const [hover, setHover] = (0, import_react53.useState)(false);
|
|
8422
8660
|
const indicativeHover = useContextStore(
|
|
8423
8661
|
ZoneStoreContext,
|
|
8424
8662
|
(s) => s.hoveringComponent === id
|
|
8425
8663
|
);
|
|
8426
|
-
(0,
|
|
8664
|
+
(0, import_react53.useEffect)(() => {
|
|
8427
8665
|
if (!ref.current) {
|
|
8428
8666
|
return;
|
|
8429
8667
|
}
|
|
@@ -8468,10 +8706,10 @@ var DraggableComponent = ({
|
|
|
8468
8706
|
thisIsDragging,
|
|
8469
8707
|
inDroppableZone
|
|
8470
8708
|
]);
|
|
8471
|
-
const [isVisible, setIsVisible] = (0,
|
|
8472
|
-
const [dragFinished, setDragFinished] = (0,
|
|
8473
|
-
const [_, startTransition] = (0,
|
|
8474
|
-
(0,
|
|
8709
|
+
const [isVisible, setIsVisible] = (0, import_react53.useState)(false);
|
|
8710
|
+
const [dragFinished, setDragFinished] = (0, import_react53.useState)(true);
|
|
8711
|
+
const [_, startTransition] = (0, import_react53.useTransition)();
|
|
8712
|
+
(0, import_react53.useEffect)(() => {
|
|
8475
8713
|
startTransition(() => {
|
|
8476
8714
|
if (hover || indicativeHover || isSelected) {
|
|
8477
8715
|
scheduleSync();
|
|
@@ -8482,7 +8720,7 @@ var DraggableComponent = ({
|
|
|
8482
8720
|
}
|
|
8483
8721
|
});
|
|
8484
8722
|
}, [hover, indicativeHover, isSelected, iframe]);
|
|
8485
|
-
const [thisWasDragging, setThisWasDragging] = (0,
|
|
8723
|
+
const [thisWasDragging, setThisWasDragging] = (0, import_react53.useState)(false);
|
|
8486
8724
|
const onDragFinished = useOnDragFinished((finished) => {
|
|
8487
8725
|
if (finished) {
|
|
8488
8726
|
startTransition(() => {
|
|
@@ -8493,15 +8731,15 @@ var DraggableComponent = ({
|
|
|
8493
8731
|
setDragFinished(false);
|
|
8494
8732
|
}
|
|
8495
8733
|
});
|
|
8496
|
-
(0,
|
|
8734
|
+
(0, import_react53.useEffect)(() => {
|
|
8497
8735
|
if (thisIsDragging) {
|
|
8498
8736
|
setThisWasDragging(true);
|
|
8499
8737
|
}
|
|
8500
8738
|
}, [thisIsDragging]);
|
|
8501
|
-
(0,
|
|
8739
|
+
(0, import_react53.useEffect)(() => {
|
|
8502
8740
|
if (thisWasDragging) return onDragFinished();
|
|
8503
8741
|
}, [thisWasDragging, onDragFinished]);
|
|
8504
|
-
(0,
|
|
8742
|
+
(0, import_react53.useEffect)(() => {
|
|
8505
8743
|
if (!dragFinished || !(isSelected || thisIsDragging)) return;
|
|
8506
8744
|
const el = ref.current;
|
|
8507
8745
|
if (!el) return;
|
|
@@ -8538,7 +8776,7 @@ var DraggableComponent = ({
|
|
|
8538
8776
|
cancelAnimationFrame(frame);
|
|
8539
8777
|
};
|
|
8540
8778
|
}, [dragFinished, isSelected, thisIsDragging, scheduleSync]);
|
|
8541
|
-
const syncActionsPosition = (0,
|
|
8779
|
+
const syncActionsPosition = (0, import_react53.useCallback)(
|
|
8542
8780
|
(el) => {
|
|
8543
8781
|
if (el) {
|
|
8544
8782
|
const view = el.ownerDocument.defaultView;
|
|
@@ -8563,7 +8801,7 @@ var DraggableComponent = ({
|
|
|
8563
8801
|
},
|
|
8564
8802
|
[zoom]
|
|
8565
8803
|
);
|
|
8566
|
-
(0,
|
|
8804
|
+
(0, import_react53.useEffect)(() => {
|
|
8567
8805
|
if (userDragAxis) {
|
|
8568
8806
|
setDragAxis(userDragAxis);
|
|
8569
8807
|
return;
|
|
@@ -8577,11 +8815,11 @@ var DraggableComponent = ({
|
|
|
8577
8815
|
}
|
|
8578
8816
|
setDragAxis(autoDragAxis);
|
|
8579
8817
|
}, [ref, userDragAxis, autoDragAxis]);
|
|
8580
|
-
const parentAction = (0,
|
|
8581
|
-
() => (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ (0,
|
|
8818
|
+
const parentAction = (0, import_react53.useMemo)(
|
|
8819
|
+
() => (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(CornerLeftUp, { size: 16 }) }),
|
|
8582
8820
|
[ctx == null ? void 0 : ctx.areaId]
|
|
8583
8821
|
);
|
|
8584
|
-
const nextContextValue = (0,
|
|
8822
|
+
const nextContextValue = (0, import_react53.useMemo)(
|
|
8585
8823
|
() => __spreadProps(__spreadValues({}, ctx), {
|
|
8586
8824
|
areaId: id,
|
|
8587
8825
|
zoneCompound,
|
|
@@ -8607,12 +8845,12 @@ var DraggableComponent = ({
|
|
|
8607
8845
|
}
|
|
8608
8846
|
);
|
|
8609
8847
|
const hasNormalActions = permissions.duplicate || permissions.delete;
|
|
8610
|
-
return /* @__PURE__ */ (0,
|
|
8848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(DropZoneProvider, { value: nextContextValue, children: [
|
|
8611
8849
|
dragFinished && isVisible && (0, import_react_dom2.createPortal)(
|
|
8612
|
-
/* @__PURE__ */ (0,
|
|
8850
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
8613
8851
|
"div",
|
|
8614
8852
|
{
|
|
8615
|
-
className:
|
|
8853
|
+
className: getClassName23({
|
|
8616
8854
|
isSelected,
|
|
8617
8855
|
isDragging: thisIsDragging,
|
|
8618
8856
|
hover: hover || indicativeHover,
|
|
@@ -8622,18 +8860,18 @@ var DraggableComponent = ({
|
|
|
8622
8860
|
"data-editor-overlay": true,
|
|
8623
8861
|
children: [
|
|
8624
8862
|
debug,
|
|
8625
|
-
isLoading && /* @__PURE__ */ (0,
|
|
8626
|
-
/* @__PURE__ */ (0,
|
|
8863
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: getClassName23("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Loader, {}) }),
|
|
8864
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8627
8865
|
"div",
|
|
8628
8866
|
{
|
|
8629
|
-
className:
|
|
8867
|
+
className: getClassName23("actionsOverlay"),
|
|
8630
8868
|
style: {
|
|
8631
8869
|
top: actionsOverlayTop / zoom
|
|
8632
8870
|
},
|
|
8633
|
-
children: /* @__PURE__ */ (0,
|
|
8871
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8634
8872
|
"div",
|
|
8635
8873
|
{
|
|
8636
|
-
className:
|
|
8874
|
+
className: getClassName23("actions"),
|
|
8637
8875
|
style: {
|
|
8638
8876
|
transform: `scale(${1 / zoom}`,
|
|
8639
8877
|
top: actionsTop / zoom,
|
|
@@ -8642,14 +8880,14 @@ var DraggableComponent = ({
|
|
|
8642
8880
|
paddingRight: actionsSide
|
|
8643
8881
|
},
|
|
8644
8882
|
ref: syncActionsPosition,
|
|
8645
|
-
children: /* @__PURE__ */ (0,
|
|
8883
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
8646
8884
|
CustomActionBar,
|
|
8647
8885
|
{
|
|
8648
8886
|
parentAction,
|
|
8649
8887
|
label: DEBUG2 ? id : label,
|
|
8650
8888
|
children: [
|
|
8651
|
-
richText && /* @__PURE__ */ (0,
|
|
8652
|
-
/* @__PURE__ */ (0,
|
|
8889
|
+
richText && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
8890
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8653
8891
|
LoadedRichTextMenu,
|
|
8654
8892
|
{
|
|
8655
8893
|
editor: richText.editor,
|
|
@@ -8658,10 +8896,10 @@ var DraggableComponent = ({
|
|
|
8658
8896
|
readOnly: false
|
|
8659
8897
|
}
|
|
8660
8898
|
),
|
|
8661
|
-
hasNormalActions && /* @__PURE__ */ (0,
|
|
8899
|
+
hasNormalActions && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ActionBar.Separator, {})
|
|
8662
8900
|
] }),
|
|
8663
|
-
permissions.duplicate && /* @__PURE__ */ (0,
|
|
8664
|
-
permissions.delete && /* @__PURE__ */ (0,
|
|
8901
|
+
permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Copy, { size: 16 }) }),
|
|
8902
|
+
permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Trash, { size: 16 }) })
|
|
8665
8903
|
]
|
|
8666
8904
|
}
|
|
8667
8905
|
)
|
|
@@ -8669,14 +8907,14 @@ var DraggableComponent = ({
|
|
|
8669
8907
|
)
|
|
8670
8908
|
}
|
|
8671
8909
|
),
|
|
8672
|
-
/* @__PURE__ */ (0,
|
|
8910
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: getClassName23("overlayWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8673
8911
|
CustomOverlay,
|
|
8674
8912
|
{
|
|
8675
8913
|
componentId: id,
|
|
8676
8914
|
componentType,
|
|
8677
8915
|
hover,
|
|
8678
8916
|
isSelected,
|
|
8679
|
-
children: /* @__PURE__ */ (0,
|
|
8917
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: getClassName23("overlay") })
|
|
8680
8918
|
}
|
|
8681
8919
|
) })
|
|
8682
8920
|
]
|
|
@@ -8695,16 +8933,16 @@ init_lib();
|
|
|
8695
8933
|
|
|
8696
8934
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/DropZone/styles.module.css#css-module
|
|
8697
8935
|
init_react_import();
|
|
8698
|
-
var
|
|
8936
|
+
var styles_module_default20 = { "DropZone": "_DropZone_1h108_1", "DropZone--hasChildren": "_DropZone--hasChildren_1h108_11", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_1h108_24", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_1h108_25", "DropZone--isRootZone": "_DropZone--isRootZone_1h108_25", "DropZone--isDestination": "_DropZone--isDestination_1h108_39", "DropZone-item": "_DropZone-item_1h108_48", "DropZone-hitbox": "_DropZone-hitbox_1h108_52", "DropZone--isEnabled": "_DropZone--isEnabled_1h108_60", "DropZone--isAnimating": "_DropZone--isAnimating_1h108_70" };
|
|
8699
8937
|
|
|
8700
8938
|
// components/DropZone/index.tsx
|
|
8701
8939
|
init_store();
|
|
8702
|
-
var
|
|
8940
|
+
var import_react70 = require("@dnd-kit/react");
|
|
8703
8941
|
var import_collision2 = require("@dnd-kit/collision");
|
|
8704
8942
|
|
|
8705
8943
|
// components/DropZone/lib/use-min-empty-height.ts
|
|
8706
8944
|
init_react_import();
|
|
8707
|
-
var
|
|
8945
|
+
var import_react54 = require("react");
|
|
8708
8946
|
init_store();
|
|
8709
8947
|
var getNumItems = (appStore, zoneCompound) => appStore.getState().state.indexes.zones[zoneCompound].contentIds.length;
|
|
8710
8948
|
var useMinEmptyHeight = ({
|
|
@@ -8713,8 +8951,8 @@ var useMinEmptyHeight = ({
|
|
|
8713
8951
|
ref
|
|
8714
8952
|
}) => {
|
|
8715
8953
|
const appStore = useAppStoreApi();
|
|
8716
|
-
const [prevHeight, setPrevHeight] = (0,
|
|
8717
|
-
const [isAnimating, setIsAnimating] = (0,
|
|
8954
|
+
const [prevHeight, setPrevHeight] = (0, import_react54.useState)(0);
|
|
8955
|
+
const [isAnimating, setIsAnimating] = (0, import_react54.useState)(false);
|
|
8718
8956
|
const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
|
|
8719
8957
|
var _a, _b;
|
|
8720
8958
|
return {
|
|
@@ -8722,7 +8960,7 @@ var useMinEmptyHeight = ({
|
|
|
8722
8960
|
isZone: ((_b = s.draggedItem) == null ? void 0 : _b.data.zone) === zoneCompound
|
|
8723
8961
|
};
|
|
8724
8962
|
});
|
|
8725
|
-
const numItems = (0,
|
|
8963
|
+
const numItems = (0, import_react54.useRef)(0);
|
|
8726
8964
|
const onDragFinished = useOnDragFinished(
|
|
8727
8965
|
(finished) => {
|
|
8728
8966
|
if (finished) {
|
|
@@ -8752,7 +8990,7 @@ var useMinEmptyHeight = ({
|
|
|
8752
8990
|
},
|
|
8753
8991
|
[appStore, prevHeight, zoneCompound]
|
|
8754
8992
|
);
|
|
8755
|
-
(0,
|
|
8993
|
+
(0, import_react54.useEffect)(() => {
|
|
8756
8994
|
if (draggedItem && ref.current) {
|
|
8757
8995
|
if (isZone) {
|
|
8758
8996
|
const rect = ref.current.getBoundingClientRect();
|
|
@@ -8769,15 +9007,15 @@ var useMinEmptyHeight = ({
|
|
|
8769
9007
|
|
|
8770
9008
|
// components/DropZone/lib/use-content-with-preview.ts
|
|
8771
9009
|
init_react_import();
|
|
8772
|
-
var
|
|
9010
|
+
var import_react57 = require("react");
|
|
8773
9011
|
|
|
8774
9012
|
// lib/dnd/use-rendered-callback.ts
|
|
8775
9013
|
init_react_import();
|
|
8776
|
-
var
|
|
8777
|
-
var
|
|
9014
|
+
var import_react55 = require("@dnd-kit/react");
|
|
9015
|
+
var import_react56 = require("react");
|
|
8778
9016
|
function useRenderedCallback(callback, deps) {
|
|
8779
|
-
const manager = (0,
|
|
8780
|
-
return (0,
|
|
9017
|
+
const manager = (0, import_react55.useDragDropManager)();
|
|
9018
|
+
return (0, import_react56.useCallback)(
|
|
8781
9019
|
(...args) => __async(null, null, function* () {
|
|
8782
9020
|
yield manager == null ? void 0 : manager.renderer.rendering;
|
|
8783
9021
|
return callback(...args);
|
|
@@ -8790,14 +9028,14 @@ function useRenderedCallback(callback, deps) {
|
|
|
8790
9028
|
init_insert();
|
|
8791
9029
|
init_store();
|
|
8792
9030
|
var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
8793
|
-
const zoneStore = (0,
|
|
9031
|
+
const zoneStore = (0, import_react57.useContext)(ZoneStoreContext);
|
|
8794
9032
|
const preview = useContextStore(
|
|
8795
9033
|
ZoneStoreContext,
|
|
8796
9034
|
(s) => s.previewIndex[zoneCompound]
|
|
8797
9035
|
);
|
|
8798
9036
|
const isDragging = useAppStore((s) => s.state.ui.isDragging);
|
|
8799
|
-
const [contentIdsWithPreview, setContentIdsWithPreview] = (0,
|
|
8800
|
-
const [localPreview, setLocalPreview] = (0,
|
|
9037
|
+
const [contentIdsWithPreview, setContentIdsWithPreview] = (0, import_react57.useState)(contentIds);
|
|
9038
|
+
const [localPreview, setLocalPreview] = (0, import_react57.useState)(
|
|
8801
9039
|
preview
|
|
8802
9040
|
);
|
|
8803
9041
|
const updateContent = useRenderedCallback(
|
|
@@ -8832,7 +9070,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
|
8832
9070
|
},
|
|
8833
9071
|
[]
|
|
8834
9072
|
);
|
|
8835
|
-
(0,
|
|
9073
|
+
(0, import_react57.useEffect)(() => {
|
|
8836
9074
|
var _a;
|
|
8837
9075
|
const s = zoneStore.getState();
|
|
8838
9076
|
const draggedItemId = (_a = s.draggedItem) == null ? void 0 : _a.id;
|
|
@@ -8850,17 +9088,17 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
|
8850
9088
|
|
|
8851
9089
|
// components/DropZone/lib/use-drag-axis.ts
|
|
8852
9090
|
init_react_import();
|
|
8853
|
-
var
|
|
9091
|
+
var import_react58 = require("react");
|
|
8854
9092
|
init_store();
|
|
8855
9093
|
var GRID_DRAG_AXIS = "dynamic";
|
|
8856
9094
|
var FLEX_ROW_DRAG_AXIS = "x";
|
|
8857
9095
|
var DEFAULT_DRAG_AXIS = "y";
|
|
8858
9096
|
var useDragAxis = (ref, collisionAxis) => {
|
|
8859
9097
|
const status = useAppStore((s) => s.status);
|
|
8860
|
-
const [dragAxis, setDragAxis] = (0,
|
|
9098
|
+
const [dragAxis, setDragAxis] = (0, import_react58.useState)(
|
|
8861
9099
|
collisionAxis || DEFAULT_DRAG_AXIS
|
|
8862
9100
|
);
|
|
8863
|
-
const calculateDragAxis = (0,
|
|
9101
|
+
const calculateDragAxis = (0, import_react58.useCallback)(() => {
|
|
8864
9102
|
if (ref.current) {
|
|
8865
9103
|
const computedStyle = window.getComputedStyle(ref.current);
|
|
8866
9104
|
if (computedStyle.display === "grid") {
|
|
@@ -8872,7 +9110,7 @@ var useDragAxis = (ref, collisionAxis) => {
|
|
|
8872
9110
|
}
|
|
8873
9111
|
}
|
|
8874
9112
|
}, [ref.current]);
|
|
8875
|
-
(0,
|
|
9113
|
+
(0, import_react58.useEffect)(() => {
|
|
8876
9114
|
const onViewportChange = () => {
|
|
8877
9115
|
calculateDragAxis();
|
|
8878
9116
|
};
|
|
@@ -8881,12 +9119,12 @@ var useDragAxis = (ref, collisionAxis) => {
|
|
|
8881
9119
|
window.removeEventListener("viewportchange", onViewportChange);
|
|
8882
9120
|
};
|
|
8883
9121
|
}, []);
|
|
8884
|
-
(0,
|
|
9122
|
+
(0, import_react58.useEffect)(calculateDragAxis, [status, collisionAxis]);
|
|
8885
9123
|
return [dragAxis, calculateDragAxis];
|
|
8886
9124
|
};
|
|
8887
9125
|
|
|
8888
9126
|
// components/DropZone/index.tsx
|
|
8889
|
-
var
|
|
9127
|
+
var import_shallow7 = require("zustand/react/shallow");
|
|
8890
9128
|
|
|
8891
9129
|
// components/Render/index.tsx
|
|
8892
9130
|
init_react_import();
|
|
@@ -8897,7 +9135,7 @@ init_react_import();
|
|
|
8897
9135
|
|
|
8898
9136
|
// lib/field-transforms/use-field-transforms.tsx
|
|
8899
9137
|
init_react_import();
|
|
8900
|
-
var
|
|
9138
|
+
var import_react59 = require("react");
|
|
8901
9139
|
init_map_fields();
|
|
8902
9140
|
|
|
8903
9141
|
// lib/field-transforms/build-mappers.ts
|
|
@@ -8926,14 +9164,14 @@ function buildMappers(transforms, readOnly, forceReadOnly) {
|
|
|
8926
9164
|
|
|
8927
9165
|
// lib/field-transforms/use-field-transforms.tsx
|
|
8928
9166
|
function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
8929
|
-
const mappers = (0,
|
|
9167
|
+
const mappers = (0, import_react59.useMemo)(
|
|
8930
9168
|
() => buildMappers(transforms, readOnly, forceReadOnly),
|
|
8931
9169
|
[transforms, readOnly, forceReadOnly]
|
|
8932
9170
|
);
|
|
8933
|
-
const transformedProps = (0,
|
|
9171
|
+
const transformedProps = (0, import_react59.useMemo)(() => {
|
|
8934
9172
|
return mapFields(item, mappers, config).props;
|
|
8935
9173
|
}, [config, item, mappers]);
|
|
8936
|
-
const mergedProps = (0,
|
|
9174
|
+
const mergedProps = (0, import_react59.useMemo)(
|
|
8937
9175
|
() => __spreadValues(__spreadValues({}, item.props), transformedProps),
|
|
8938
9176
|
[item.props, transformedProps]
|
|
8939
9177
|
);
|
|
@@ -8968,29 +9206,29 @@ function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdi
|
|
|
8968
9206
|
}
|
|
8969
9207
|
|
|
8970
9208
|
// components/Render/index.tsx
|
|
8971
|
-
var
|
|
9209
|
+
var import_react63 = __toESM(require("react"));
|
|
8972
9210
|
|
|
8973
9211
|
// components/SlotRender/index.tsx
|
|
8974
9212
|
init_react_import();
|
|
8975
|
-
var
|
|
9213
|
+
var import_shallow6 = require("zustand/react/shallow");
|
|
8976
9214
|
init_store();
|
|
8977
9215
|
|
|
8978
9216
|
// components/SlotRender/server.tsx
|
|
8979
9217
|
init_react_import();
|
|
8980
|
-
var
|
|
9218
|
+
var import_react62 = require("react");
|
|
8981
9219
|
|
|
8982
9220
|
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
8983
9221
|
init_react_import();
|
|
8984
|
-
var
|
|
9222
|
+
var import_react61 = require("react");
|
|
8985
9223
|
|
|
8986
9224
|
// components/RichTextEditor/components/RenderFallback.tsx
|
|
8987
9225
|
init_react_import();
|
|
8988
9226
|
init_get_class_name_factory();
|
|
8989
9227
|
init_styles_module6();
|
|
8990
|
-
var
|
|
8991
|
-
var
|
|
9228
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
9229
|
+
var getClassName24 = get_class_name_factory_default("RichTextEditor", styles_module_default14);
|
|
8992
9230
|
function RichTextRenderFallback({ content }) {
|
|
8993
|
-
return /* @__PURE__ */ (0,
|
|
9231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: getClassName24(), children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
8994
9232
|
"div",
|
|
8995
9233
|
{
|
|
8996
9234
|
className: "rich-text",
|
|
@@ -9021,7 +9259,7 @@ var mapDeep = (source, path, render) => {
|
|
|
9021
9259
|
};
|
|
9022
9260
|
|
|
9023
9261
|
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
9024
|
-
var
|
|
9262
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
9025
9263
|
function useRichtextProps(fields, props) {
|
|
9026
9264
|
const findAllRichtextKeys = (fields2, path = []) => {
|
|
9027
9265
|
if (!fields2) return [];
|
|
@@ -9043,21 +9281,21 @@ function useRichtextProps(fields, props) {
|
|
|
9043
9281
|
}
|
|
9044
9282
|
return result;
|
|
9045
9283
|
};
|
|
9046
|
-
const richtextKeys = (0,
|
|
9047
|
-
const richtextProps = (0,
|
|
9284
|
+
const richtextKeys = (0, import_react61.useMemo)(() => findAllRichtextKeys(fields), [fields]);
|
|
9285
|
+
const richtextProps = (0, import_react61.useMemo)(() => {
|
|
9048
9286
|
if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
|
|
9049
|
-
const RichTextRender3 = (0,
|
|
9287
|
+
const RichTextRender3 = (0, import_react61.lazy)(
|
|
9050
9288
|
() => Promise.resolve().then(() => (init_Render(), Render_exports)).then((m) => ({
|
|
9051
9289
|
default: m.RichTextRender
|
|
9052
9290
|
}))
|
|
9053
9291
|
);
|
|
9054
9292
|
let result = __spreadValues({}, props);
|
|
9055
9293
|
for (const { path, field } of richtextKeys) {
|
|
9056
|
-
result = mapDeep(result, path, (content) => /* @__PURE__ */ (0,
|
|
9057
|
-
|
|
9294
|
+
result = mapDeep(result, path, (content) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
9295
|
+
import_react61.Suspense,
|
|
9058
9296
|
{
|
|
9059
|
-
fallback: /* @__PURE__ */ (0,
|
|
9060
|
-
children: /* @__PURE__ */ (0,
|
|
9297
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(RichTextRenderFallback, { content }),
|
|
9298
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(RichTextRender3, { content, field })
|
|
9061
9299
|
},
|
|
9062
9300
|
generateId()
|
|
9063
9301
|
));
|
|
@@ -9068,17 +9306,17 @@ function useRichtextProps(fields, props) {
|
|
|
9068
9306
|
}
|
|
9069
9307
|
|
|
9070
9308
|
// components/SlotRender/server.tsx
|
|
9071
|
-
var
|
|
9072
|
-
var SlotRenderPure = (props) => /* @__PURE__ */ (0,
|
|
9309
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
9310
|
+
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(SlotRender, __spreadValues({}, props));
|
|
9073
9311
|
var Item3 = ({
|
|
9074
9312
|
config,
|
|
9075
9313
|
item,
|
|
9076
9314
|
metadata
|
|
9077
9315
|
}) => {
|
|
9078
9316
|
const Component2 = config.components[item.type];
|
|
9079
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0,
|
|
9317
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
9080
9318
|
const richtextProps = useRichtextProps(Component2.fields, props);
|
|
9081
|
-
return /* @__PURE__ */ (0,
|
|
9319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
9082
9320
|
Component2.render,
|
|
9083
9321
|
__spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
|
|
9084
9322
|
editor: __spreadProps(__spreadValues({}, props.editor), {
|
|
@@ -9087,14 +9325,14 @@ var Item3 = ({
|
|
|
9087
9325
|
})
|
|
9088
9326
|
);
|
|
9089
9327
|
};
|
|
9090
|
-
var SlotRender = (0,
|
|
9328
|
+
var SlotRender = (0, import_react62.forwardRef)(
|
|
9091
9329
|
function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
|
|
9092
9330
|
const El = as != null ? as : "div";
|
|
9093
|
-
return /* @__PURE__ */ (0,
|
|
9331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(El, { className, style, ref, children: content.map((item) => {
|
|
9094
9332
|
if (!config.components[item.type]) {
|
|
9095
9333
|
return null;
|
|
9096
9334
|
}
|
|
9097
|
-
return /* @__PURE__ */ (0,
|
|
9335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
9098
9336
|
Item3,
|
|
9099
9337
|
{
|
|
9100
9338
|
config,
|
|
@@ -9108,7 +9346,7 @@ var SlotRender = (0, import_react61.forwardRef)(
|
|
|
9108
9346
|
);
|
|
9109
9347
|
|
|
9110
9348
|
// components/SlotRender/index.tsx
|
|
9111
|
-
var
|
|
9349
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
9112
9350
|
var ContextSlotRender = ({
|
|
9113
9351
|
componentId,
|
|
9114
9352
|
zone
|
|
@@ -9116,14 +9354,14 @@ var ContextSlotRender = ({
|
|
|
9116
9354
|
const config = useAppStore((s) => s.config);
|
|
9117
9355
|
const metadata = useAppStore((s) => s.metadata);
|
|
9118
9356
|
const slotContent = useAppStore(
|
|
9119
|
-
(0,
|
|
9357
|
+
(0, import_shallow6.useShallow)((s) => {
|
|
9120
9358
|
var _a, _b;
|
|
9121
9359
|
const indexes = s.state.indexes;
|
|
9122
9360
|
const contentIds = (_b = (_a = indexes.zones[`${componentId}:${zone}`]) == null ? void 0 : _a.contentIds) != null ? _b : [];
|
|
9123
9361
|
return contentIds.map((contentId) => indexes.nodes[contentId].flatData);
|
|
9124
9362
|
})
|
|
9125
9363
|
);
|
|
9126
|
-
return /* @__PURE__ */ (0,
|
|
9364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9127
9365
|
SlotRenderPure,
|
|
9128
9366
|
{
|
|
9129
9367
|
content: slotContent,
|
|
@@ -9184,8 +9422,8 @@ function resolveGlobals(data, config) {
|
|
|
9184
9422
|
}
|
|
9185
9423
|
|
|
9186
9424
|
// components/Render/index.tsx
|
|
9187
|
-
var
|
|
9188
|
-
var renderContext =
|
|
9425
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
9426
|
+
var renderContext = import_react63.default.createContext({
|
|
9189
9427
|
config: { components: {} },
|
|
9190
9428
|
data: { root: {}, content: [] },
|
|
9191
9429
|
metadata: {}
|
|
@@ -9196,7 +9434,7 @@ function Render({
|
|
|
9196
9434
|
metadata = {}
|
|
9197
9435
|
}) {
|
|
9198
9436
|
var _a, _b;
|
|
9199
|
-
const defaultedData = (0,
|
|
9437
|
+
const defaultedData = (0, import_react63.useMemo)(() => {
|
|
9200
9438
|
const base = __spreadProps(__spreadValues({}, data), {
|
|
9201
9439
|
root: data.root || {},
|
|
9202
9440
|
content: data.content || []
|
|
@@ -9219,10 +9457,10 @@ function Render({
|
|
|
9219
9457
|
const propsWithSlots = useSlots(
|
|
9220
9458
|
config,
|
|
9221
9459
|
{ type: "root", props: pageProps },
|
|
9222
|
-
(props) => /* @__PURE__ */ (0,
|
|
9460
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
|
|
9223
9461
|
);
|
|
9224
9462
|
const richtextProps = useRichtextProps((_a = config.root) == null ? void 0 : _a.fields, pageProps);
|
|
9225
|
-
const nextContextValue = (0,
|
|
9463
|
+
const nextContextValue = (0, import_react63.useMemo)(
|
|
9226
9464
|
() => ({
|
|
9227
9465
|
mode: "render",
|
|
9228
9466
|
depth: 0
|
|
@@ -9230,9 +9468,9 @@ function Render({
|
|
|
9230
9468
|
[]
|
|
9231
9469
|
);
|
|
9232
9470
|
if ((_b = config.root) == null ? void 0 : _b.render) {
|
|
9233
|
-
return /* @__PURE__ */ (0,
|
|
9471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(config.root.render, __spreadProps(__spreadValues(__spreadValues({}, propsWithSlots), richtextProps), { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(DropZoneRenderPure, { zone: rootZone }) })) }) });
|
|
9234
9472
|
}
|
|
9235
|
-
return /* @__PURE__ */ (0,
|
|
9473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(DropZoneRenderPure, { zone: rootZone }) }) });
|
|
9236
9474
|
}
|
|
9237
9475
|
|
|
9238
9476
|
// components/DropZone/index.tsx
|
|
@@ -9240,16 +9478,16 @@ init_flatten_node();
|
|
|
9240
9478
|
|
|
9241
9479
|
// lib/field-transforms/use-field-transforms-tracked.tsx
|
|
9242
9480
|
init_react_import();
|
|
9243
|
-
var
|
|
9481
|
+
var import_react64 = require("react");
|
|
9244
9482
|
init_map_fields();
|
|
9245
9483
|
function useFieldTransformsTracked(config, item, transforms, readOnly, forceReadOnly) {
|
|
9246
|
-
const prevProps = (0,
|
|
9247
|
-
const prevResult = (0,
|
|
9248
|
-
const mappers = (0,
|
|
9484
|
+
const prevProps = (0, import_react64.useRef)(null);
|
|
9485
|
+
const prevResult = (0, import_react64.useRef)(item.props);
|
|
9486
|
+
const mappers = (0, import_react64.useMemo)(
|
|
9249
9487
|
() => buildMappers(transforms, readOnly, forceReadOnly),
|
|
9250
9488
|
[transforms, readOnly, forceReadOnly]
|
|
9251
9489
|
);
|
|
9252
|
-
const transformedProps = (0,
|
|
9490
|
+
const transformedProps = (0, import_react64.useMemo)(() => {
|
|
9253
9491
|
var _a, _b, _c;
|
|
9254
9492
|
const changedProps = {};
|
|
9255
9493
|
const componentConfig = item.type === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[item.type];
|
|
@@ -9275,7 +9513,7 @@ function useFieldTransformsTracked(config, item, transforms, readOnly, forceRead
|
|
|
9275
9513
|
prevResult.current = __spreadValues(__spreadValues({}, prevResult.current), mapped);
|
|
9276
9514
|
return prevResult.current;
|
|
9277
9515
|
}, [config, item, mappers]);
|
|
9278
|
-
const mergedProps = (0,
|
|
9516
|
+
const mergedProps = (0, import_react64.useMemo)(
|
|
9279
9517
|
() => __spreadValues(__spreadValues({}, item.props), transformedProps),
|
|
9280
9518
|
[item.props, transformedProps]
|
|
9281
9519
|
);
|
|
@@ -9287,7 +9525,7 @@ init_react_import();
|
|
|
9287
9525
|
|
|
9288
9526
|
// components/InlineTextField/index.tsx
|
|
9289
9527
|
init_react_import();
|
|
9290
|
-
var
|
|
9528
|
+
var import_react65 = require("react");
|
|
9291
9529
|
|
|
9292
9530
|
// lib/overlay-portal/index.tsx
|
|
9293
9531
|
init_react_import();
|
|
@@ -9342,24 +9580,12 @@ init_store();
|
|
|
9342
9580
|
|
|
9343
9581
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/InlineTextField/styles.module.css#css-module
|
|
9344
9582
|
init_react_import();
|
|
9345
|
-
var
|
|
9583
|
+
var styles_module_default21 = { "InlineTextField": "_InlineTextField_104qp_1" };
|
|
9346
9584
|
|
|
9347
9585
|
// components/InlineTextField/index.tsx
|
|
9348
9586
|
init_lib();
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
init_react_import();
|
|
9352
|
-
var getSelectorForId = (state, id) => {
|
|
9353
|
-
const node = state.indexes.nodes[id];
|
|
9354
|
-
if (!node) return;
|
|
9355
|
-
const zoneCompound = `${node.parentId}:${node.zone}`;
|
|
9356
|
-
const index = state.indexes.zones[zoneCompound].contentIds.indexOf(id);
|
|
9357
|
-
return { zone: zoneCompound, index };
|
|
9358
|
-
};
|
|
9359
|
-
|
|
9360
|
-
// components/InlineTextField/index.tsx
|
|
9361
|
-
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
9362
|
-
var getClassName25 = get_class_name_factory_default("InlineTextField", styles_module_default20);
|
|
9587
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
9588
|
+
var getClassName26 = get_class_name_factory_default("InlineTextField", styles_module_default21);
|
|
9363
9589
|
var InlineTextFieldInternal = ({
|
|
9364
9590
|
propPath,
|
|
9365
9591
|
componentId,
|
|
@@ -9368,10 +9594,10 @@ var InlineTextFieldInternal = ({
|
|
|
9368
9594
|
opts = {}
|
|
9369
9595
|
}) => {
|
|
9370
9596
|
var _a;
|
|
9371
|
-
const ref = (0,
|
|
9597
|
+
const ref = (0, import_react65.useRef)(null);
|
|
9372
9598
|
const appStoreApi = useAppStoreApi();
|
|
9373
9599
|
const disableLineBreaks = (_a = opts.disableLineBreaks) != null ? _a : false;
|
|
9374
|
-
(0,
|
|
9600
|
+
(0, import_react65.useEffect)(() => {
|
|
9375
9601
|
const appStore = appStoreApi.getState();
|
|
9376
9602
|
const data = appStore.state.indexes.nodes[componentId].data;
|
|
9377
9603
|
const componentConfig = appStore.getComponentConfig(data.type);
|
|
@@ -9417,12 +9643,12 @@ var InlineTextFieldInternal = ({
|
|
|
9417
9643
|
};
|
|
9418
9644
|
}
|
|
9419
9645
|
}, [appStoreApi, ref.current, value, disableLineBreaks]);
|
|
9420
|
-
const [isHovering, setIsHovering] = (0,
|
|
9421
|
-
const [isFocused, setIsFocused] = (0,
|
|
9422
|
-
return /* @__PURE__ */ (0,
|
|
9646
|
+
const [isHovering, setIsHovering] = (0, import_react65.useState)(false);
|
|
9647
|
+
const [isFocused, setIsFocused] = (0, import_react65.useState)(false);
|
|
9648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
9423
9649
|
"span",
|
|
9424
9650
|
{
|
|
9425
|
-
className:
|
|
9651
|
+
className: getClassName26(),
|
|
9426
9652
|
ref,
|
|
9427
9653
|
contentEditable: isHovering || isFocused ? "plaintext-only" : "false",
|
|
9428
9654
|
onClick: (e) => {
|
|
@@ -9455,14 +9681,14 @@ var InlineTextFieldInternal = ({
|
|
|
9455
9681
|
}
|
|
9456
9682
|
);
|
|
9457
9683
|
};
|
|
9458
|
-
var InlineTextField = (0,
|
|
9684
|
+
var InlineTextField = (0, import_react65.memo)(InlineTextFieldInternal);
|
|
9459
9685
|
|
|
9460
9686
|
// lib/field-transforms/default-transforms/inline-text-transform.tsx
|
|
9461
|
-
var
|
|
9687
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
9462
9688
|
var getInlineTextTransform = () => ({
|
|
9463
9689
|
text: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
9464
9690
|
if (field.contentEditable) {
|
|
9465
|
-
return /* @__PURE__ */ (0,
|
|
9691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9466
9692
|
InlineTextField,
|
|
9467
9693
|
{
|
|
9468
9694
|
propPath,
|
|
@@ -9477,7 +9703,7 @@ var getInlineTextTransform = () => ({
|
|
|
9477
9703
|
},
|
|
9478
9704
|
textarea: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
9479
9705
|
if (field.contentEditable) {
|
|
9480
|
-
return /* @__PURE__ */ (0,
|
|
9706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9481
9707
|
InlineTextField,
|
|
9482
9708
|
{
|
|
9483
9709
|
propPath,
|
|
@@ -9491,7 +9717,7 @@ var getInlineTextTransform = () => ({
|
|
|
9491
9717
|
},
|
|
9492
9718
|
custom: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
9493
9719
|
if (field.contentEditable && typeof value === "string") {
|
|
9494
|
-
return /* @__PURE__ */ (0,
|
|
9720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9495
9721
|
InlineTextField,
|
|
9496
9722
|
{
|
|
9497
9723
|
propPath,
|
|
@@ -9508,19 +9734,19 @@ var getInlineTextTransform = () => ({
|
|
|
9508
9734
|
// lib/field-transforms/default-transforms/rich-text-transform.tsx
|
|
9509
9735
|
init_react_import();
|
|
9510
9736
|
init_store();
|
|
9511
|
-
var
|
|
9512
|
-
var
|
|
9513
|
-
var Editor3 = (0,
|
|
9737
|
+
var import_react66 = require("react");
|
|
9738
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
9739
|
+
var Editor3 = (0, import_react66.lazy)(
|
|
9514
9740
|
() => Promise.resolve().then(() => (init_Editor(), Editor_exports)).then((m) => ({
|
|
9515
9741
|
default: m.Editor
|
|
9516
9742
|
}))
|
|
9517
9743
|
);
|
|
9518
|
-
var RichTextRender2 = (0,
|
|
9744
|
+
var RichTextRender2 = (0, import_react66.lazy)(
|
|
9519
9745
|
() => Promise.resolve().then(() => (init_Render(), Render_exports)).then((m) => ({
|
|
9520
9746
|
default: m.RichTextRender
|
|
9521
9747
|
}))
|
|
9522
9748
|
);
|
|
9523
|
-
var InlineEditorWrapper = (0,
|
|
9749
|
+
var InlineEditorWrapper = (0, import_react66.memo)(
|
|
9524
9750
|
({
|
|
9525
9751
|
value,
|
|
9526
9752
|
componentId,
|
|
@@ -9528,7 +9754,7 @@ var InlineEditorWrapper = (0, import_react65.memo)(
|
|
|
9528
9754
|
field,
|
|
9529
9755
|
id
|
|
9530
9756
|
}) => {
|
|
9531
|
-
const portalRef = (0,
|
|
9757
|
+
const portalRef = (0, import_react66.useRef)(null);
|
|
9532
9758
|
const appStoreApi = useAppStoreApi();
|
|
9533
9759
|
const onClickHandler = (e) => {
|
|
9534
9760
|
e.preventDefault();
|
|
@@ -9543,14 +9769,14 @@ var InlineEditorWrapper = (0, import_react65.memo)(
|
|
|
9543
9769
|
);
|
|
9544
9770
|
appStoreApi.getState().setUi({ itemSelector });
|
|
9545
9771
|
};
|
|
9546
|
-
(0,
|
|
9772
|
+
(0, import_react66.useEffect)(() => {
|
|
9547
9773
|
if (!portalRef.current) return;
|
|
9548
9774
|
const cleanup = registerOverlayPortal(portalRef.current, {
|
|
9549
9775
|
disableDragOnFocus: true
|
|
9550
9776
|
});
|
|
9551
9777
|
return () => cleanup == null ? void 0 : cleanup();
|
|
9552
9778
|
}, [portalRef.current]);
|
|
9553
|
-
const handleChange = (0,
|
|
9779
|
+
const handleChange = (0, import_react66.useCallback)(
|
|
9554
9780
|
(content, ui) => __async(null, null, function* () {
|
|
9555
9781
|
var _a;
|
|
9556
9782
|
const appStore = appStoreApi.getState();
|
|
@@ -9574,7 +9800,7 @@ var InlineEditorWrapper = (0, import_react65.memo)(
|
|
|
9574
9800
|
}),
|
|
9575
9801
|
[appStoreApi, componentId, propPath]
|
|
9576
9802
|
);
|
|
9577
|
-
const handleFocus = (0,
|
|
9803
|
+
const handleFocus = (0, import_react66.useCallback)(
|
|
9578
9804
|
(editor) => {
|
|
9579
9805
|
appStoreApi.setState({
|
|
9580
9806
|
currentRichText: {
|
|
@@ -9589,7 +9815,7 @@ var InlineEditorWrapper = (0, import_react65.memo)(
|
|
|
9589
9815
|
[field, componentId]
|
|
9590
9816
|
);
|
|
9591
9817
|
if (!field.contentEditable)
|
|
9592
|
-
return /* @__PURE__ */ (0,
|
|
9818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react66.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(RichTextRenderFallback, { content: value }), children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(RichTextRender2, { content: value, field }) });
|
|
9593
9819
|
const editorProps = {
|
|
9594
9820
|
content: value,
|
|
9595
9821
|
onChange: handleChange,
|
|
@@ -9599,13 +9825,13 @@ var InlineEditorWrapper = (0, import_react65.memo)(
|
|
|
9599
9825
|
id,
|
|
9600
9826
|
name: propPath
|
|
9601
9827
|
};
|
|
9602
|
-
return /* @__PURE__ */ (0,
|
|
9828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
9603
9829
|
"div",
|
|
9604
9830
|
{
|
|
9605
9831
|
ref: portalRef,
|
|
9606
9832
|
onClick: onClickHandler,
|
|
9607
9833
|
onClickCapture: onClickCaptureHandler,
|
|
9608
|
-
children: /* @__PURE__ */ (0,
|
|
9834
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react66.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(EditorFallback, __spreadValues({}, editorProps)), children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Editor3, __spreadValues({}, editorProps)) })
|
|
9609
9835
|
}
|
|
9610
9836
|
);
|
|
9611
9837
|
}
|
|
@@ -9615,10 +9841,10 @@ var getRichTextTransform = () => ({
|
|
|
9615
9841
|
richtext: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
9616
9842
|
const { contentEditable = true, tiptap } = field;
|
|
9617
9843
|
if (contentEditable === false || isReadOnly) {
|
|
9618
|
-
return /* @__PURE__ */ (0,
|
|
9844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(RichTextRender2, { content: value, field });
|
|
9619
9845
|
}
|
|
9620
9846
|
const id = `${componentId}_${field.type}_${propPath}`;
|
|
9621
|
-
return /* @__PURE__ */ (0,
|
|
9847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
9622
9848
|
InlineEditorWrapper,
|
|
9623
9849
|
{
|
|
9624
9850
|
value,
|
|
@@ -9635,7 +9861,7 @@ var getRichTextTransform = () => ({
|
|
|
9635
9861
|
// components/MemoizeComponent/index.tsx
|
|
9636
9862
|
init_react_import();
|
|
9637
9863
|
var import_fast_equals3 = require("fast-equals");
|
|
9638
|
-
var
|
|
9864
|
+
var import_react67 = require("react");
|
|
9639
9865
|
|
|
9640
9866
|
// lib/shallow-equal.ts
|
|
9641
9867
|
init_react_import();
|
|
@@ -9662,14 +9888,14 @@ function shallowEqual(obj1, obj2, keysToIgnore = []) {
|
|
|
9662
9888
|
}
|
|
9663
9889
|
|
|
9664
9890
|
// components/MemoizeComponent/index.tsx
|
|
9665
|
-
var
|
|
9891
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
9666
9892
|
var RenderComponent = ({
|
|
9667
9893
|
Component: Component2,
|
|
9668
9894
|
componentProps: renderProps
|
|
9669
9895
|
}) => {
|
|
9670
|
-
return /* @__PURE__ */ (0,
|
|
9896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Component2, __spreadValues({}, renderProps));
|
|
9671
9897
|
};
|
|
9672
|
-
var MemoizeComponent = (0,
|
|
9898
|
+
var MemoizeComponent = (0, import_react67.memo)(RenderComponent, (prev, next) => {
|
|
9673
9899
|
let editorEquals = true;
|
|
9674
9900
|
if ("editor" in prev.componentProps && "editor" in next.componentProps) {
|
|
9675
9901
|
editorEquals = (0, import_fast_equals3.deepEqual)(prev.componentProps.editor, next.componentProps.editor);
|
|
@@ -9679,7 +9905,7 @@ var MemoizeComponent = (0, import_react66.memo)(RenderComponent, (prev, next) =>
|
|
|
9679
9905
|
|
|
9680
9906
|
// components/DropZone/VirtualizedDropZone.tsx
|
|
9681
9907
|
init_react_import();
|
|
9682
|
-
var
|
|
9908
|
+
var import_react68 = require("react");
|
|
9683
9909
|
init_store();
|
|
9684
9910
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
9685
9911
|
|
|
@@ -9695,7 +9921,7 @@ var getFrame = () => {
|
|
|
9695
9921
|
};
|
|
9696
9922
|
|
|
9697
9923
|
// components/DropZone/VirtualizedDropZone.tsx
|
|
9698
|
-
var
|
|
9924
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
9699
9925
|
var ROOT_ZONE_VIRTUALIZATION_OVERSCAN = 5;
|
|
9700
9926
|
var DEFAULT_VIRTUALIZED_ITEM_HEIGHT = 320;
|
|
9701
9927
|
var measuredItemHeights = /* @__PURE__ */ new Map();
|
|
@@ -9719,7 +9945,7 @@ var VirtualizedDropZone = ({
|
|
|
9719
9945
|
return (_b = (_a = s.selectedItem) == null ? void 0 : _a.props.id) != null ? _b : null;
|
|
9720
9946
|
});
|
|
9721
9947
|
const frame = getFrame();
|
|
9722
|
-
const zoneStore = (0,
|
|
9948
|
+
const zoneStore = (0, import_react68.useContext)(ZoneStoreContext);
|
|
9723
9949
|
const draggedItemId = useContextStore(ZoneStoreContext, (s) => {
|
|
9724
9950
|
var _a;
|
|
9725
9951
|
const draggedId = (_a = s.draggedItem) == null ? void 0 : _a.id;
|
|
@@ -9734,9 +9960,9 @@ var VirtualizedDropZone = ({
|
|
|
9734
9960
|
return null;
|
|
9735
9961
|
});
|
|
9736
9962
|
const iframeWindow = frame == null ? void 0 : frame.defaultView;
|
|
9737
|
-
const measureRefsRef = (0,
|
|
9963
|
+
const measureRefsRef = (0, import_react68.useRef)(/* @__PURE__ */ new Map());
|
|
9738
9964
|
const appStoreApi = useAppStoreApi();
|
|
9739
|
-
const resolveIndex = (0,
|
|
9965
|
+
const resolveIndex = (0, import_react68.useCallback)(
|
|
9740
9966
|
(targetId) => {
|
|
9741
9967
|
var _a, _b, _c, _d;
|
|
9742
9968
|
if (!targetId || targetId === "root") {
|
|
@@ -9761,7 +9987,7 @@ var VirtualizedDropZone = ({
|
|
|
9761
9987
|
},
|
|
9762
9988
|
[appStoreApi, contentIds]
|
|
9763
9989
|
);
|
|
9764
|
-
const pinnedIndexes = (0,
|
|
9990
|
+
const pinnedIndexes = (0, import_react68.useMemo)(() => {
|
|
9765
9991
|
const nextPinnedIndexes = /* @__PURE__ */ new Set();
|
|
9766
9992
|
[selectedId, draggedItemId, dragTargetParentId].forEach((targetId) => {
|
|
9767
9993
|
const currentIndex = resolveIndex(targetId);
|
|
@@ -9771,7 +9997,7 @@ var VirtualizedDropZone = ({
|
|
|
9771
9997
|
});
|
|
9772
9998
|
return Array.from(nextPinnedIndexes).sort((a, b) => a - b);
|
|
9773
9999
|
}, [dragTargetParentId, draggedItemId, resolveIndex, selectedId]);
|
|
9774
|
-
const rangeExtractor = (0,
|
|
10000
|
+
const rangeExtractor = (0, import_react68.useCallback)(
|
|
9775
10001
|
(range) => {
|
|
9776
10002
|
const indexes = (0, import_react_virtual.defaultRangeExtractor)(range);
|
|
9777
10003
|
pinnedIndexes.forEach((index) => {
|
|
@@ -9796,7 +10022,7 @@ var VirtualizedDropZone = ({
|
|
|
9796
10022
|
rangeExtractor,
|
|
9797
10023
|
initialOffset: () => iframeWindow ? iframeWindow.scrollY : 0
|
|
9798
10024
|
});
|
|
9799
|
-
(0,
|
|
10025
|
+
(0, import_react68.useEffect)(() => {
|
|
9800
10026
|
zoneStore.getState().registerRootVirtualizer(zoneCompound, {
|
|
9801
10027
|
resolveIndex: (targetId) => resolveIndex(targetId),
|
|
9802
10028
|
virtualizer
|
|
@@ -9805,7 +10031,7 @@ var VirtualizedDropZone = ({
|
|
|
9805
10031
|
zoneStore.getState().unregisterRootVirtualizer(zoneCompound);
|
|
9806
10032
|
};
|
|
9807
10033
|
}, [resolveIndex, virtualizer, zoneCompound, zoneStore]);
|
|
9808
|
-
const getMeasureRef = (0,
|
|
10034
|
+
const getMeasureRef = (0, import_react68.useCallback)((componentId) => {
|
|
9809
10035
|
const cachedRef = measureRefsRef.current.get(componentId);
|
|
9810
10036
|
if (cachedRef) {
|
|
9811
10037
|
return cachedRef;
|
|
@@ -9822,7 +10048,7 @@ var VirtualizedDropZone = ({
|
|
|
9822
10048
|
measureRefsRef.current.set(componentId, measureRef);
|
|
9823
10049
|
return measureRef;
|
|
9824
10050
|
}, []);
|
|
9825
|
-
(0,
|
|
10051
|
+
(0, import_react68.useEffect)(() => {
|
|
9826
10052
|
const validIds = new Set(contentIds);
|
|
9827
10053
|
Array.from(measureRefsRef.current.keys()).forEach((componentId) => {
|
|
9828
10054
|
if (!validIds.has(componentId)) {
|
|
@@ -9832,7 +10058,7 @@ var VirtualizedDropZone = ({
|
|
|
9832
10058
|
}, [contentIds]);
|
|
9833
10059
|
const virtualItems = virtualizer.getVirtualItems();
|
|
9834
10060
|
const totalSize = virtualizer.getTotalSize();
|
|
9835
|
-
const renderedItems = (0,
|
|
10061
|
+
const renderedItems = (0, import_react68.useMemo)(() => {
|
|
9836
10062
|
const items = [];
|
|
9837
10063
|
let previousEnd = 0;
|
|
9838
10064
|
let previousIndex = -1;
|
|
@@ -9842,7 +10068,7 @@ var VirtualizedDropZone = ({
|
|
|
9842
10068
|
const gapSize = Math.max(virtualItem.start - previousEnd, 0);
|
|
9843
10069
|
if (gapSize > 0) {
|
|
9844
10070
|
items.push(
|
|
9845
|
-
/* @__PURE__ */ (0,
|
|
10071
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
9846
10072
|
"div",
|
|
9847
10073
|
{
|
|
9848
10074
|
style: { height: `${gapSize}px` }
|
|
@@ -9864,7 +10090,7 @@ var VirtualizedDropZone = ({
|
|
|
9864
10090
|
const trailingGap = Math.max(totalSize - previousEnd, 0);
|
|
9865
10091
|
if (trailingGap > 0) {
|
|
9866
10092
|
items.push(
|
|
9867
|
-
/* @__PURE__ */ (0,
|
|
10093
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
9868
10094
|
"div",
|
|
9869
10095
|
{
|
|
9870
10096
|
style: { height: `${trailingGap}px` }
|
|
@@ -9875,15 +10101,15 @@ var VirtualizedDropZone = ({
|
|
|
9875
10101
|
}
|
|
9876
10102
|
return items;
|
|
9877
10103
|
}, [totalSize, virtualItems, getMeasureRef]);
|
|
9878
|
-
return /* @__PURE__ */ (0,
|
|
10104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_jsx_runtime70.Fragment, { children: renderedItems });
|
|
9879
10105
|
};
|
|
9880
10106
|
|
|
9881
10107
|
// components/DropZone/index.tsx
|
|
9882
|
-
var
|
|
10108
|
+
var import_jsx_runtime71 = (
|
|
9883
10109
|
// Safe to use this since the HTML is set by the user
|
|
9884
10110
|
require("react/jsx-runtime")
|
|
9885
10111
|
);
|
|
9886
|
-
var
|
|
10112
|
+
var getClassName27 = get_class_name_factory_default("DropZone", styles_module_default20);
|
|
9887
10113
|
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
|
9888
10114
|
var RENDER_DEBUG = false;
|
|
9889
10115
|
var InsertPreview = ({
|
|
@@ -9892,11 +10118,11 @@ var InsertPreview = ({
|
|
|
9892
10118
|
override
|
|
9893
10119
|
}) => {
|
|
9894
10120
|
if (element) {
|
|
9895
|
-
return /* @__PURE__ */ (0,
|
|
10121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { dangerouslySetInnerHTML: { __html: element.outerHTML } });
|
|
9896
10122
|
}
|
|
9897
|
-
return /* @__PURE__ */ (0,
|
|
10123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DrawerItemInner, { name: label, children: override });
|
|
9898
10124
|
};
|
|
9899
|
-
var DropZoneEditPure = (props) => /* @__PURE__ */ (0,
|
|
10125
|
+
var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DropZoneEdit, __spreadValues({}, props));
|
|
9900
10126
|
var DropZoneChild = ({
|
|
9901
10127
|
zoneCompound,
|
|
9902
10128
|
componentId,
|
|
@@ -9908,11 +10134,11 @@ var DropZoneChild = ({
|
|
|
9908
10134
|
}) => {
|
|
9909
10135
|
var _a, _b;
|
|
9910
10136
|
const metadata = useAppStore((s) => s.metadata);
|
|
9911
|
-
const ctx = (0,
|
|
10137
|
+
const ctx = (0, import_react69.useContext)(dropZoneContext);
|
|
9912
10138
|
const { depth = 1 } = ctx != null ? ctx : {};
|
|
9913
|
-
const zoneStore = (0,
|
|
10139
|
+
const zoneStore = (0, import_react69.useContext)(ZoneStoreContext);
|
|
9914
10140
|
const nodeProps = useAppStore(
|
|
9915
|
-
(0,
|
|
10141
|
+
(0, import_shallow7.useShallow)((s) => {
|
|
9916
10142
|
var _a2;
|
|
9917
10143
|
return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.flatData.props;
|
|
9918
10144
|
})
|
|
@@ -9924,13 +10150,13 @@ var DropZoneChild = ({
|
|
|
9924
10150
|
}
|
|
9925
10151
|
);
|
|
9926
10152
|
const nodeReadOnly = useAppStore(
|
|
9927
|
-
(0,
|
|
10153
|
+
(0, import_shallow7.useShallow)((s) => {
|
|
9928
10154
|
var _a2;
|
|
9929
10155
|
return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.data.readOnly;
|
|
9930
10156
|
})
|
|
9931
10157
|
);
|
|
9932
10158
|
const appStore = useAppStoreApi();
|
|
9933
|
-
const item = (0,
|
|
10159
|
+
const item = (0, import_react69.useMemo)(() => {
|
|
9934
10160
|
if (nodeProps) {
|
|
9935
10161
|
const expanded = expandNode({
|
|
9936
10162
|
type: nodeType,
|
|
@@ -9952,7 +10178,7 @@ var DropZoneChild = ({
|
|
|
9952
10178
|
const componentConfig = useAppStore(
|
|
9953
10179
|
(s) => (item == null ? void 0 : item.type) ? s.config.components[item.type] : null
|
|
9954
10180
|
);
|
|
9955
|
-
const editorProps = (0,
|
|
10181
|
+
const editorProps = (0, import_react69.useMemo)(
|
|
9956
10182
|
() => ({
|
|
9957
10183
|
renderDropZone: DropZoneEditPure,
|
|
9958
10184
|
isEditing: true,
|
|
@@ -9975,7 +10201,7 @@ var DropZoneChild = ({
|
|
|
9975
10201
|
}
|
|
9976
10202
|
);
|
|
9977
10203
|
let label = (_b = (_a = componentConfig == null ? void 0 : componentConfig.label) != null ? _a : item == null ? void 0 : item.type.toString()) != null ? _b : "Component";
|
|
9978
|
-
const defaultsProps = (0,
|
|
10204
|
+
const defaultsProps = (0, import_react69.useMemo)(
|
|
9979
10205
|
() => __spreadProps(__spreadValues(__spreadValues({}, componentConfig == null ? void 0 : componentConfig.defaultProps), item == null ? void 0 : item.props), {
|
|
9980
10206
|
editor: editorProps,
|
|
9981
10207
|
editMode: true
|
|
@@ -9983,7 +10209,7 @@ var DropZoneChild = ({
|
|
|
9983
10209
|
}),
|
|
9984
10210
|
[componentConfig == null ? void 0 : componentConfig.defaultProps, item == null ? void 0 : item.props, editorProps]
|
|
9985
10211
|
);
|
|
9986
|
-
const defaultedNode = (0,
|
|
10212
|
+
const defaultedNode = (0, import_react69.useMemo)(
|
|
9987
10213
|
() => {
|
|
9988
10214
|
var _a2;
|
|
9989
10215
|
return { type: (_a2 = item == null ? void 0 : item.type) != null ? _a2 : nodeType, props: defaultsProps };
|
|
@@ -9993,8 +10219,8 @@ var DropZoneChild = ({
|
|
|
9993
10219
|
const config = useAppStore((s) => s.config);
|
|
9994
10220
|
const plugins = useAppStore((s) => s.plugins);
|
|
9995
10221
|
const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
|
|
9996
|
-
const combinedFieldTransforms = (0,
|
|
9997
|
-
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ (0,
|
|
10222
|
+
const combinedFieldTransforms = (0, import_react69.useMemo)(
|
|
10223
|
+
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), getRichTextTransform()), plugins.reduce(
|
|
9998
10224
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
9999
10225
|
{}
|
|
10000
10226
|
)), userFieldTransforms),
|
|
@@ -10008,13 +10234,13 @@ var DropZoneChild = ({
|
|
|
10008
10234
|
isLoading
|
|
10009
10235
|
);
|
|
10010
10236
|
if (!item) return;
|
|
10011
|
-
const Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0,
|
|
10237
|
+
const Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
|
10012
10238
|
"No configuration for ",
|
|
10013
10239
|
item.type
|
|
10014
10240
|
] });
|
|
10015
10241
|
let componentType = item.type;
|
|
10016
10242
|
const isInserting = "previewType" in item ? item.previewType === "insert" : false;
|
|
10017
|
-
return /* @__PURE__ */ (0,
|
|
10243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10018
10244
|
DraggableComponent,
|
|
10019
10245
|
{
|
|
10020
10246
|
id: componentId,
|
|
@@ -10032,7 +10258,7 @@ var DropZoneChild = ({
|
|
|
10032
10258
|
children: (dragRef) => {
|
|
10033
10259
|
var _a2;
|
|
10034
10260
|
if ((componentConfig == null ? void 0 : componentConfig.inline) && !isInserting) {
|
|
10035
|
-
return /* @__PURE__ */ (0,
|
|
10261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10036
10262
|
MemoizeComponent,
|
|
10037
10263
|
{
|
|
10038
10264
|
Component: Render2,
|
|
@@ -10042,14 +10268,14 @@ var DropZoneChild = ({
|
|
|
10042
10268
|
}
|
|
10043
10269
|
);
|
|
10044
10270
|
}
|
|
10045
|
-
return /* @__PURE__ */ (0,
|
|
10271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { ref: dragRef, children: isInserting ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10046
10272
|
InsertPreview,
|
|
10047
10273
|
{
|
|
10048
10274
|
label,
|
|
10049
10275
|
override: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem,
|
|
10050
10276
|
element: "element" in item && item.element ? item.element : void 0
|
|
10051
10277
|
}
|
|
10052
|
-
) : /* @__PURE__ */ (0,
|
|
10278
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10053
10279
|
MemoizeComponent,
|
|
10054
10280
|
{
|
|
10055
10281
|
Component: Render2,
|
|
@@ -10060,8 +10286,8 @@ var DropZoneChild = ({
|
|
|
10060
10286
|
}
|
|
10061
10287
|
);
|
|
10062
10288
|
};
|
|
10063
|
-
var DropZoneChildMemo = (0,
|
|
10064
|
-
var DropZoneEdit = (0,
|
|
10289
|
+
var DropZoneChildMemo = (0, import_react69.memo)(DropZoneChild);
|
|
10290
|
+
var DropZoneEdit = (0, import_react69.forwardRef)(
|
|
10065
10291
|
function DropZoneEditInternal({
|
|
10066
10292
|
zone,
|
|
10067
10293
|
allow,
|
|
@@ -10072,7 +10298,7 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10072
10298
|
collisionAxis,
|
|
10073
10299
|
as
|
|
10074
10300
|
}, userRef) {
|
|
10075
|
-
const ctx = (0,
|
|
10301
|
+
const ctx = (0, import_react69.useContext)(dropZoneContext);
|
|
10076
10302
|
const appStoreApi = useAppStoreApi();
|
|
10077
10303
|
const {
|
|
10078
10304
|
// These all need setting via context
|
|
@@ -10082,7 +10308,7 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10082
10308
|
unregisterLocalZone
|
|
10083
10309
|
} = ctx != null ? ctx : {};
|
|
10084
10310
|
const path = useAppStore(
|
|
10085
|
-
(0,
|
|
10311
|
+
(0, import_shallow7.useShallow)((s) => {
|
|
10086
10312
|
var _a;
|
|
10087
10313
|
return areaId ? (_a = s.state.indexes.nodes[areaId]) == null ? void 0 : _a.path : null;
|
|
10088
10314
|
})
|
|
@@ -10099,38 +10325,29 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10099
10325
|
(s) => s.nextAreaDepthIndex[areaId || ""]
|
|
10100
10326
|
);
|
|
10101
10327
|
const zoneContentIds = useAppStore(
|
|
10102
|
-
(0,
|
|
10328
|
+
(0, import_shallow7.useShallow)((s) => {
|
|
10103
10329
|
var _a;
|
|
10104
10330
|
return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.contentIds;
|
|
10105
10331
|
})
|
|
10106
10332
|
);
|
|
10107
10333
|
const zoneType = useAppStore(
|
|
10108
|
-
(0,
|
|
10334
|
+
(0, import_shallow7.useShallow)((s) => {
|
|
10109
10335
|
var _a;
|
|
10110
10336
|
return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.type;
|
|
10111
10337
|
})
|
|
10112
10338
|
);
|
|
10113
|
-
(0,
|
|
10339
|
+
(0, import_react69.useEffect)(() => {
|
|
10114
10340
|
if (!zoneType || zoneType === "dropzone") {
|
|
10115
10341
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
10116
10342
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
10117
10343
|
}
|
|
10118
10344
|
}
|
|
10119
10345
|
}, [zoneType, appStoreApi]);
|
|
10120
|
-
(0,
|
|
10121
|
-
if (zoneType === "dropzone") {
|
|
10122
|
-
if (zoneCompound !== rootDroppableId) {
|
|
10123
|
-
console.warn(
|
|
10124
|
-
"DropZones have been deprecated in favor of slot fields and will be removed in a future version of Editor. Please see the migration guide: https://www.frontend.co/docs/guides/migrations/dropzones-to-slots"
|
|
10125
|
-
);
|
|
10126
|
-
}
|
|
10127
|
-
}
|
|
10128
|
-
}, [zoneType]);
|
|
10129
|
-
const contentIds = (0, import_react68.useMemo)(() => {
|
|
10346
|
+
const contentIds = (0, import_react69.useMemo)(() => {
|
|
10130
10347
|
return zoneContentIds || [];
|
|
10131
10348
|
}, [zoneContentIds]);
|
|
10132
|
-
const ref = (0,
|
|
10133
|
-
const acceptsTarget = (0,
|
|
10349
|
+
const ref = (0, import_react69.useRef)(null);
|
|
10350
|
+
const acceptsTarget = (0, import_react69.useCallback)(
|
|
10134
10351
|
(componentType) => {
|
|
10135
10352
|
if (!componentType) {
|
|
10136
10353
|
return true;
|
|
@@ -10168,7 +10385,7 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10168
10385
|
}
|
|
10169
10386
|
return _isEnabled;
|
|
10170
10387
|
});
|
|
10171
|
-
(0,
|
|
10388
|
+
(0, import_react69.useEffect)(() => {
|
|
10172
10389
|
if (registerLocalZone) {
|
|
10173
10390
|
registerLocalZone(zoneCompound, targetAccepted || isEnabled);
|
|
10174
10391
|
}
|
|
@@ -10183,8 +10400,8 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10183
10400
|
zoneCompound
|
|
10184
10401
|
);
|
|
10185
10402
|
const isDropEnabled = isEnabled && (preview ? contentIdsWithPreview.length === 1 : contentIdsWithPreview.length === 0);
|
|
10186
|
-
const zoneStore = (0,
|
|
10187
|
-
(0,
|
|
10403
|
+
const zoneStore = (0, import_react69.useContext)(ZoneStoreContext);
|
|
10404
|
+
(0, import_react69.useEffect)(() => {
|
|
10188
10405
|
const { enabledIndex } = zoneStore.getState();
|
|
10189
10406
|
zoneStore.setState({
|
|
10190
10407
|
enabledIndex: __spreadProps(__spreadValues({}, enabledIndex), { [zoneCompound]: isEnabled })
|
|
@@ -10203,7 +10420,7 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10203
10420
|
path: path || []
|
|
10204
10421
|
}
|
|
10205
10422
|
};
|
|
10206
|
-
const { ref: dropRef } = (0,
|
|
10423
|
+
const { ref: dropRef } = (0, import_react70.useDroppable)(droppableConfig);
|
|
10207
10424
|
const isAreaSelected = useAppStore(
|
|
10208
10425
|
(s) => (s == null ? void 0 : s.selectedItem) && areaId === (s == null ? void 0 : s.selectedItem.props.id)
|
|
10209
10426
|
);
|
|
@@ -10213,7 +10430,7 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10213
10430
|
userMinEmptyHeight,
|
|
10214
10431
|
ref
|
|
10215
10432
|
});
|
|
10216
|
-
const setRefs = (0,
|
|
10433
|
+
const setRefs = (0, import_react69.useCallback)(
|
|
10217
10434
|
(node) => {
|
|
10218
10435
|
assignRefs([ref, dropRef, userRef], node);
|
|
10219
10436
|
},
|
|
@@ -10225,10 +10442,10 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10225
10442
|
const El = as != null ? as : "div";
|
|
10226
10443
|
const isRootAreaZone = (areaId != null ? areaId : rootAreaId) === rootAreaId && depth === 0;
|
|
10227
10444
|
const shouldVirtualizeItems = _experimentalVirtualization && isRootAreaZone;
|
|
10228
|
-
return /* @__PURE__ */ (0,
|
|
10445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10229
10446
|
El,
|
|
10230
10447
|
{
|
|
10231
|
-
className: `${
|
|
10448
|
+
className: `${getClassName27({
|
|
10232
10449
|
isRootZone,
|
|
10233
10450
|
hoveringOverArea,
|
|
10234
10451
|
isEnabled,
|
|
@@ -10243,12 +10460,12 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10243
10460
|
"--min-empty-height": minEmptyHeight,
|
|
10244
10461
|
backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
|
|
10245
10462
|
}),
|
|
10246
|
-
children: shouldVirtualizeItems ? /* @__PURE__ */ (0,
|
|
10463
|
+
children: shouldVirtualizeItems ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10247
10464
|
VirtualizedDropZone,
|
|
10248
10465
|
{
|
|
10249
10466
|
contentIds: contentIdsWithPreview,
|
|
10250
10467
|
zoneCompound,
|
|
10251
|
-
renderItem: (props) => /* @__PURE__ */ (0,
|
|
10468
|
+
renderItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10252
10469
|
DropZoneChildMemo,
|
|
10253
10470
|
{
|
|
10254
10471
|
zoneCompound,
|
|
@@ -10262,7 +10479,7 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10262
10479
|
props.componentId
|
|
10263
10480
|
)
|
|
10264
10481
|
}
|
|
10265
|
-
) : contentIdsWithPreview.map((componentId, i) => /* @__PURE__ */ (0,
|
|
10482
|
+
) : contentIdsWithPreview.map((componentId, i) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10266
10483
|
DropZoneChildMemo,
|
|
10267
10484
|
{
|
|
10268
10485
|
zoneCompound,
|
|
@@ -10284,8 +10501,8 @@ var DropZoneRenderItem = ({
|
|
|
10284
10501
|
metadata
|
|
10285
10502
|
}) => {
|
|
10286
10503
|
const Component2 = config.components[item.type];
|
|
10287
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0,
|
|
10288
|
-
const nextContextValue = (0,
|
|
10504
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
10505
|
+
const nextContextValue = (0, import_react69.useMemo)(
|
|
10289
10506
|
() => ({
|
|
10290
10507
|
areaId: props.id,
|
|
10291
10508
|
depth: 1
|
|
@@ -10293,7 +10510,7 @@ var DropZoneRenderItem = ({
|
|
|
10293
10510
|
[props]
|
|
10294
10511
|
);
|
|
10295
10512
|
const richtextProps = useRichtextProps(Component2.fields, props);
|
|
10296
|
-
return /* @__PURE__ */ (0,
|
|
10513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10297
10514
|
Component2.render,
|
|
10298
10515
|
__spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
|
|
10299
10516
|
editor: __spreadProps(__spreadValues({}, props.editor), {
|
|
@@ -10303,15 +10520,15 @@ var DropZoneRenderItem = ({
|
|
|
10303
10520
|
})
|
|
10304
10521
|
) }, props.id);
|
|
10305
10522
|
};
|
|
10306
|
-
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0,
|
|
10307
|
-
var DropZoneRender = (0,
|
|
10523
|
+
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DropZoneRender, __spreadValues({}, props));
|
|
10524
|
+
var DropZoneRender = (0, import_react69.forwardRef)(
|
|
10308
10525
|
function DropZoneRenderInternal({ className, style, zone, as }, ref) {
|
|
10309
|
-
const ctx = (0,
|
|
10526
|
+
const ctx = (0, import_react69.useContext)(dropZoneContext);
|
|
10310
10527
|
const { areaId = "root" } = ctx || {};
|
|
10311
|
-
const { config, data, metadata } = (0,
|
|
10528
|
+
const { config, data, metadata } = (0, import_react69.useContext)(renderContext);
|
|
10312
10529
|
let zoneCompound = `${areaId}:${zone}`;
|
|
10313
10530
|
let content = (data == null ? void 0 : data.content) || [];
|
|
10314
|
-
(0,
|
|
10531
|
+
(0, import_react69.useEffect)(() => {
|
|
10315
10532
|
if (!content) {
|
|
10316
10533
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
10317
10534
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
@@ -10325,10 +10542,10 @@ var DropZoneRender = (0, import_react68.forwardRef)(
|
|
|
10325
10542
|
if (zoneCompound !== rootDroppableId) {
|
|
10326
10543
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
10327
10544
|
}
|
|
10328
|
-
return /* @__PURE__ */ (0,
|
|
10545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(El, { className, style, ref, children: content.map((item) => {
|
|
10329
10546
|
const Component2 = config.components[item.type];
|
|
10330
10547
|
if (Component2) {
|
|
10331
|
-
return /* @__PURE__ */ (0,
|
|
10548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10332
10549
|
DropZoneRenderItem,
|
|
10333
10550
|
{
|
|
10334
10551
|
config,
|
|
@@ -10342,14 +10559,14 @@ var DropZoneRender = (0, import_react68.forwardRef)(
|
|
|
10342
10559
|
}) });
|
|
10343
10560
|
}
|
|
10344
10561
|
);
|
|
10345
|
-
var DropZonePure = (props) => /* @__PURE__ */ (0,
|
|
10346
|
-
var DropZone = (0,
|
|
10562
|
+
var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DropZone, __spreadValues({}, props));
|
|
10563
|
+
var DropZone = (0, import_react69.forwardRef)(
|
|
10347
10564
|
function DropZone2(props, ref) {
|
|
10348
|
-
const ctx = (0,
|
|
10565
|
+
const ctx = (0, import_react69.useContext)(dropZoneContext);
|
|
10349
10566
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
|
10350
|
-
return /* @__PURE__ */ (0,
|
|
10567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_jsx_runtime71.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
10351
10568
|
}
|
|
10352
|
-
return /* @__PURE__ */ (0,
|
|
10569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_jsx_runtime71.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
10353
10570
|
}
|
|
10354
10571
|
);
|
|
10355
10572
|
|
|
@@ -10736,14 +10953,14 @@ function getDeepDir(el) {
|
|
|
10736
10953
|
|
|
10737
10954
|
// components/DragDropContext/index.tsx
|
|
10738
10955
|
var import_state = require("@dnd-kit/state");
|
|
10739
|
-
var
|
|
10956
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
10740
10957
|
var DEBUG3 = false;
|
|
10741
|
-
var dragListenerContext = (0,
|
|
10958
|
+
var dragListenerContext = (0, import_react72.createContext)({
|
|
10742
10959
|
dragListeners: {}
|
|
10743
10960
|
});
|
|
10744
10961
|
function useDragListener(type, fn, deps = []) {
|
|
10745
|
-
const { setDragListeners } = (0,
|
|
10746
|
-
(0,
|
|
10962
|
+
const { setDragListeners } = (0, import_react72.useContext)(dragListenerContext);
|
|
10963
|
+
(0, import_react72.useEffect)(() => {
|
|
10747
10964
|
if (setDragListeners) {
|
|
10748
10965
|
setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
|
|
10749
10966
|
[type]: [...old[type] || [], fn]
|
|
@@ -10753,8 +10970,8 @@ function useDragListener(type, fn, deps = []) {
|
|
|
10753
10970
|
}
|
|
10754
10971
|
var AREA_CHANGE_DEBOUNCE_MS = 100;
|
|
10755
10972
|
var useTempDisableFallback = (timeout3) => {
|
|
10756
|
-
const lastFallbackDisable = (0,
|
|
10757
|
-
return (0,
|
|
10973
|
+
const lastFallbackDisable = (0, import_react72.useRef)(null);
|
|
10974
|
+
return (0, import_react72.useCallback)((manager) => {
|
|
10758
10975
|
collisionStore.setState({ fallbackEnabled: false });
|
|
10759
10976
|
const fallbackId = generateId();
|
|
10760
10977
|
lastFallbackDisable.current = fallbackId;
|
|
@@ -10773,9 +10990,9 @@ var DragDropContextClient = ({
|
|
|
10773
10990
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
10774
10991
|
const instanceId = useAppStore((s) => s.instanceId);
|
|
10775
10992
|
const appStore = useAppStoreApi();
|
|
10776
|
-
const debouncedParamsRef = (0,
|
|
10993
|
+
const debouncedParamsRef = (0, import_react72.useRef)(null);
|
|
10777
10994
|
const tempDisableFallback = useTempDisableFallback(100);
|
|
10778
|
-
const [zoneStore] = (0,
|
|
10995
|
+
const [zoneStore] = (0, import_react72.useState)(() => {
|
|
10779
10996
|
const rootVirtualizers = /* @__PURE__ */ new Map();
|
|
10780
10997
|
return (0, import_zustand6.createStore)(() => ({
|
|
10781
10998
|
zoneDepthIndex: {},
|
|
@@ -10816,7 +11033,7 @@ var DragDropContextClient = ({
|
|
|
10816
11033
|
}
|
|
10817
11034
|
}));
|
|
10818
11035
|
});
|
|
10819
|
-
(0,
|
|
11036
|
+
(0, import_react72.useEffect)(() => {
|
|
10820
11037
|
appStore.setState({
|
|
10821
11038
|
scrollToComponent: (id) => zoneStore.getState().scrollToComponent(id)
|
|
10822
11039
|
});
|
|
@@ -10825,7 +11042,7 @@ var DragDropContextClient = ({
|
|
|
10825
11042
|
} });
|
|
10826
11043
|
};
|
|
10827
11044
|
}, [appStore, zoneStore]);
|
|
10828
|
-
const getChanged2 = (0,
|
|
11045
|
+
const getChanged2 = (0, import_react72.useCallback)(
|
|
10829
11046
|
(params) => {
|
|
10830
11047
|
const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
|
|
10831
11048
|
const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
|
|
@@ -10846,7 +11063,7 @@ var DragDropContextClient = ({
|
|
|
10846
11063
|
},
|
|
10847
11064
|
[zoneStore]
|
|
10848
11065
|
);
|
|
10849
|
-
const setDeepestAndCollide = (0,
|
|
11066
|
+
const setDeepestAndCollide = (0, import_react72.useCallback)(
|
|
10850
11067
|
(params, manager) => {
|
|
10851
11068
|
const { zoneChanged, areaChanged } = getChanged2(params);
|
|
10852
11069
|
if (!zoneChanged && !areaChanged) return;
|
|
@@ -10870,7 +11087,7 @@ var DragDropContextClient = ({
|
|
|
10870
11087
|
setDeepestDb.cancel();
|
|
10871
11088
|
debouncedParamsRef.current = null;
|
|
10872
11089
|
};
|
|
10873
|
-
(0,
|
|
11090
|
+
(0, import_react72.useEffect)(() => {
|
|
10874
11091
|
if (DEBUG3) {
|
|
10875
11092
|
zoneStore.subscribe(
|
|
10876
11093
|
(s) => {
|
|
@@ -10884,7 +11101,7 @@ var DragDropContextClient = ({
|
|
|
10884
11101
|
);
|
|
10885
11102
|
}
|
|
10886
11103
|
}, []);
|
|
10887
|
-
const [plugins] = (0,
|
|
11104
|
+
const [plugins] = (0, import_react72.useState)(() => [
|
|
10888
11105
|
import_dom4.ScrollListener,
|
|
10889
11106
|
import_dom4.Scroller,
|
|
10890
11107
|
...disableAutoScroll ? import_dom4.defaultPreset.plugins.filter((plugin) => plugin !== import_dom4.AutoScroller) : import_dom4.defaultPreset.plugins,
|
|
@@ -10934,10 +11151,10 @@ var DragDropContextClient = ({
|
|
|
10934
11151
|
)
|
|
10935
11152
|
]);
|
|
10936
11153
|
const sensors = useSensors();
|
|
10937
|
-
const [dragListeners, setDragListeners] = (0,
|
|
10938
|
-
const dragMode = (0,
|
|
10939
|
-
const initialSelector = (0,
|
|
10940
|
-
const nextContextValue = (0,
|
|
11154
|
+
const [dragListeners, setDragListeners] = (0, import_react72.useState)({});
|
|
11155
|
+
const dragMode = (0, import_react72.useRef)(null);
|
|
11156
|
+
const initialSelector = (0, import_react72.useRef)(void 0);
|
|
11157
|
+
const nextContextValue = (0, import_react72.useMemo)(
|
|
10941
11158
|
() => ({
|
|
10942
11159
|
mode: "edit",
|
|
10943
11160
|
areaId: "root",
|
|
@@ -10945,15 +11162,15 @@ var DragDropContextClient = ({
|
|
|
10945
11162
|
}),
|
|
10946
11163
|
[]
|
|
10947
11164
|
);
|
|
10948
|
-
return /* @__PURE__ */ (0,
|
|
11165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
10949
11166
|
dragListenerContext.Provider,
|
|
10950
11167
|
{
|
|
10951
11168
|
value: {
|
|
10952
11169
|
dragListeners,
|
|
10953
11170
|
setDragListeners
|
|
10954
11171
|
},
|
|
10955
|
-
children: /* @__PURE__ */ (0,
|
|
10956
|
-
|
|
11172
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
11173
|
+
import_react71.DragDropProvider,
|
|
10957
11174
|
{
|
|
10958
11175
|
plugins,
|
|
10959
11176
|
sensors,
|
|
@@ -11168,7 +11385,7 @@ var DragDropContextClient = ({
|
|
|
11168
11385
|
const entryEl = (_d = getFrame()) == null ? void 0 : _d.querySelector("[data-editor-entry]");
|
|
11169
11386
|
entryEl == null ? void 0 : entryEl.setAttribute("data-editor-dragging", "true");
|
|
11170
11387
|
},
|
|
11171
|
-
children: /* @__PURE__ */ (0,
|
|
11388
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(DropZoneProvider, { value: nextContextValue, children }) })
|
|
11172
11389
|
}
|
|
11173
11390
|
)
|
|
11174
11391
|
}
|
|
@@ -11182,14 +11399,14 @@ var DragDropContext = ({
|
|
|
11182
11399
|
if (status === "LOADING") {
|
|
11183
11400
|
return children;
|
|
11184
11401
|
}
|
|
11185
|
-
return /* @__PURE__ */ (0,
|
|
11402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(DragDropContextClient, { disableAutoScroll, children });
|
|
11186
11403
|
};
|
|
11187
11404
|
|
|
11188
11405
|
// components/Drawer/index.tsx
|
|
11189
|
-
var
|
|
11190
|
-
var
|
|
11191
|
-
var
|
|
11192
|
-
var getClassNameItem2 = get_class_name_factory_default("DrawerItem",
|
|
11406
|
+
var import_react74 = require("@dnd-kit/react");
|
|
11407
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
11408
|
+
var getClassName28 = get_class_name_factory_default("Drawer", styles_module_default18);
|
|
11409
|
+
var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default18);
|
|
11193
11410
|
var DrawerItemInner = ({
|
|
11194
11411
|
children,
|
|
11195
11412
|
name,
|
|
@@ -11198,11 +11415,11 @@ var DrawerItemInner = ({
|
|
|
11198
11415
|
dragRef,
|
|
11199
11416
|
isDragDisabled
|
|
11200
11417
|
}) => {
|
|
11201
|
-
const CustomInner = (0,
|
|
11202
|
-
() => children || (({ children: children2 }) => /* @__PURE__ */ (0,
|
|
11418
|
+
const CustomInner = (0, import_react73.useMemo)(
|
|
11419
|
+
() => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
|
|
11203
11420
|
[children]
|
|
11204
11421
|
);
|
|
11205
|
-
return /* @__PURE__ */ (0,
|
|
11422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11206
11423
|
"div",
|
|
11207
11424
|
{
|
|
11208
11425
|
className: getClassNameItem2({ disabled: isDragDisabled }),
|
|
@@ -11210,9 +11427,9 @@ var DrawerItemInner = ({
|
|
|
11210
11427
|
onMouseDown: (e) => e.preventDefault(),
|
|
11211
11428
|
"data-testid": dragRef ? `drawer-item:${name}` : "",
|
|
11212
11429
|
"data-editor-drawer-item": true,
|
|
11213
|
-
children: /* @__PURE__ */ (0,
|
|
11214
|
-
icon && /* @__PURE__ */ (0,
|
|
11215
|
-
/* @__PURE__ */ (0,
|
|
11430
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
|
|
11431
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassNameItem2("icon"), children: icon }),
|
|
11432
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name })
|
|
11216
11433
|
] }) }) })
|
|
11217
11434
|
}
|
|
11218
11435
|
);
|
|
@@ -11225,15 +11442,15 @@ var DrawerItemDraggable = ({
|
|
|
11225
11442
|
id,
|
|
11226
11443
|
isDragDisabled
|
|
11227
11444
|
}) => {
|
|
11228
|
-
const { ref } = (0,
|
|
11445
|
+
const { ref } = (0, import_react74.useDraggable)({
|
|
11229
11446
|
id,
|
|
11230
11447
|
data: { componentType: name },
|
|
11231
11448
|
disabled: isDragDisabled,
|
|
11232
11449
|
type: "drawer"
|
|
11233
11450
|
});
|
|
11234
|
-
return /* @__PURE__ */ (0,
|
|
11235
|
-
/* @__PURE__ */ (0,
|
|
11236
|
-
/* @__PURE__ */ (0,
|
|
11451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: getClassName28("draggable"), children: [
|
|
11452
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassName28("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DrawerItemInner, { name, label, icon, children }) }),
|
|
11453
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassName28("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11237
11454
|
DrawerItemInner,
|
|
11238
11455
|
{
|
|
11239
11456
|
name,
|
|
@@ -11256,7 +11473,7 @@ var DrawerItem = ({
|
|
|
11256
11473
|
isDragDisabled
|
|
11257
11474
|
}) => {
|
|
11258
11475
|
const resolvedId = id || name;
|
|
11259
|
-
const [dynamicId, setDynamicId] = (0,
|
|
11476
|
+
const [dynamicId, setDynamicId] = (0, import_react73.useState)(generateId(resolvedId));
|
|
11260
11477
|
if (typeof index !== "undefined") {
|
|
11261
11478
|
console.error(
|
|
11262
11479
|
"Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
|
|
@@ -11269,337 +11486,126 @@ var DrawerItem = ({
|
|
|
11269
11486
|
},
|
|
11270
11487
|
[resolvedId]
|
|
11271
11488
|
);
|
|
11272
|
-
return /* @__PURE__ */ (0,
|
|
11489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11273
11490
|
DrawerItemDraggable,
|
|
11274
11491
|
{
|
|
11275
11492
|
name,
|
|
11276
11493
|
label,
|
|
11277
11494
|
icon,
|
|
11278
|
-
id: dynamicId,
|
|
11279
|
-
isDragDisabled,
|
|
11280
|
-
children
|
|
11281
|
-
}
|
|
11282
|
-
) }, dynamicId);
|
|
11283
|
-
};
|
|
11284
|
-
var Drawer = ({
|
|
11285
|
-
children,
|
|
11286
|
-
droppableId,
|
|
11287
|
-
direction,
|
|
11288
|
-
variant = "list"
|
|
11289
|
-
}) => {
|
|
11290
|
-
if (droppableId) {
|
|
11291
|
-
console.error(
|
|
11292
|
-
"Warning: The `droppableId` prop on Drawer is deprecated and no longer required."
|
|
11293
|
-
);
|
|
11294
|
-
}
|
|
11295
|
-
if (direction) {
|
|
11296
|
-
console.error(
|
|
11297
|
-
"Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
|
|
11298
|
-
);
|
|
11299
|
-
}
|
|
11300
|
-
const id = useSafeId();
|
|
11301
|
-
const { ref } = (0, import_react73.useDroppable)({
|
|
11302
|
-
id,
|
|
11303
|
-
type: "void",
|
|
11304
|
-
collisionPriority: 0
|
|
11305
|
-
// Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
|
|
11306
|
-
});
|
|
11307
|
-
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
11308
|
-
"div",
|
|
11309
|
-
{
|
|
11310
|
-
className: getClassName27({ [variant]: variant }),
|
|
11311
|
-
ref,
|
|
11312
|
-
"data-editor-dnd": id,
|
|
11313
|
-
"data-editor-drawer": true,
|
|
11314
|
-
"data-editor-dnd-void": true,
|
|
11315
|
-
children
|
|
11316
|
-
}
|
|
11317
|
-
);
|
|
11318
|
-
};
|
|
11319
|
-
Drawer.Item = DrawerItem;
|
|
11320
|
-
|
|
11321
|
-
// components/ComponentList/index.tsx
|
|
11322
|
-
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
11323
|
-
var getClassName28 = get_class_name_factory_default("ComponentList", styles_module_default16);
|
|
11324
|
-
var ComponentListItem = ({
|
|
11325
|
-
name,
|
|
11326
|
-
label,
|
|
11327
|
-
icon
|
|
11328
|
-
}) => {
|
|
11329
|
-
var _a;
|
|
11330
|
-
const overrides = useAppStore((s) => s.overrides);
|
|
11331
|
-
const canInsert = useAppStore(
|
|
11332
|
-
(s) => s.permissions.getPermissions({
|
|
11333
|
-
type: name
|
|
11334
|
-
}).insert
|
|
11335
|
-
);
|
|
11336
|
-
(0, import_react74.useEffect)(() => {
|
|
11337
|
-
if (overrides.componentItem) {
|
|
11338
|
-
console.warn(
|
|
11339
|
-
"The `componentItem` override has been deprecated and renamed to `drawerItem`"
|
|
11340
|
-
);
|
|
11341
|
-
}
|
|
11342
|
-
}, [overrides]);
|
|
11343
|
-
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Drawer.Item, { label, name, icon, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
|
|
11344
|
-
};
|
|
11345
|
-
var ComponentList = ({
|
|
11346
|
-
children,
|
|
11347
|
-
title,
|
|
11348
|
-
id
|
|
11349
|
-
}) => {
|
|
11350
|
-
const config = useAppStore((s) => s.config);
|
|
11351
|
-
const setUi = useAppStore((s) => s.setUi);
|
|
11352
|
-
const componentList = useAppStore((s) => s.state.ui.componentList);
|
|
11353
|
-
const { expanded = true } = componentList[id] || {};
|
|
11354
|
-
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: getClassName28({ isExpanded: expanded }), children: [
|
|
11355
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
11356
|
-
"button",
|
|
11357
|
-
{
|
|
11358
|
-
type: "button",
|
|
11359
|
-
className: getClassName28("title"),
|
|
11360
|
-
onClick: () => setUi({
|
|
11361
|
-
componentList: __spreadProps(__spreadValues({}, componentList), {
|
|
11362
|
-
[id]: __spreadProps(__spreadValues({}, componentList[id]), {
|
|
11363
|
-
expanded: !expanded
|
|
11364
|
-
})
|
|
11365
|
-
})
|
|
11366
|
-
}),
|
|
11367
|
-
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
|
11368
|
-
children: [
|
|
11369
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassName28("titleIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ChevronRight, { size: 12 }) }),
|
|
11370
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { children: title })
|
|
11371
|
-
]
|
|
11372
|
-
}
|
|
11373
|
-
),
|
|
11374
|
-
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassName28("content"), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Drawer, { variant: "tile", children: children || Object.keys(config.components).map((componentKey) => {
|
|
11375
|
-
var _a;
|
|
11376
|
-
const componentConf = config.components[componentKey] || {};
|
|
11377
|
-
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11378
|
-
ComponentListItem,
|
|
11379
|
-
{
|
|
11380
|
-
label: (_a = componentConf["label"]) != null ? _a : componentKey,
|
|
11381
|
-
icon: componentConf["icon"],
|
|
11382
|
-
name: componentKey
|
|
11383
|
-
},
|
|
11384
|
-
componentKey
|
|
11385
|
-
);
|
|
11386
|
-
}) }) })
|
|
11387
|
-
] });
|
|
11388
|
-
};
|
|
11389
|
-
ComponentList.Item = ComponentListItem;
|
|
11390
|
-
|
|
11391
|
-
// bundle/core.ts
|
|
11392
|
-
init_IconButton2();
|
|
11393
|
-
|
|
11394
|
-
// components/Editor/index.tsx
|
|
11395
|
-
init_react_import();
|
|
11396
|
-
var import_react95 = require("react");
|
|
11397
|
-
init_store();
|
|
11398
|
-
|
|
11399
|
-
// components/Editor/components/Fields/index.tsx
|
|
11400
|
-
init_react_import();
|
|
11401
|
-
init_Loader();
|
|
11402
|
-
init_root_droppable_id();
|
|
11403
|
-
init_store();
|
|
11404
|
-
|
|
11405
|
-
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Fields/styles.module.css#css-module
|
|
11406
|
-
init_react_import();
|
|
11407
|
-
var styles_module_default21 = { "EditorFields": "_EditorFields_3dnua_1", "EditorFields--isLoading": "_EditorFields--isLoading_3dnua_6", "EditorFields-loadingOverlay": "_EditorFields-loadingOverlay_3dnua_10", "EditorFields-loadingOverlayInner": "_EditorFields-loadingOverlayInner_3dnua_25", "EditorFields-field": "_EditorFields-field_3dnua_32", "EditorFields--wrapFields": "_EditorFields--wrapFields_3dnua_36", "EditorFields-syncButton": "_EditorFields-syncButton_3dnua_46", "EditorFields-syncButton--unlinked": "_EditorFields-syncButton--unlinked_3dnua_78" };
|
|
11408
|
-
|
|
11409
|
-
// components/Editor/components/Fields/index.tsx
|
|
11410
|
-
init_lib();
|
|
11411
|
-
var import_react75 = require("react");
|
|
11412
|
-
init_fields();
|
|
11413
|
-
var import_shallow7 = require("zustand/react/shallow");
|
|
11414
|
-
init_lucide_react();
|
|
11415
|
-
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
11416
|
-
var getClassName29 = get_class_name_factory_default("EditorFields", styles_module_default21);
|
|
11417
|
-
var DefaultFields = ({
|
|
11418
|
-
children
|
|
11419
|
-
}) => {
|
|
11420
|
-
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_jsx_runtime74.Fragment, { children });
|
|
11421
|
-
};
|
|
11422
|
-
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
|
|
11423
|
-
const { dispatch, state, selectedItem, resolveComponentData: resolveComponentData2 } = appStore.getState();
|
|
11424
|
-
const { data, ui } = state;
|
|
11425
|
-
const { itemSelector } = ui;
|
|
11426
|
-
const rootProps = data.root.props || data.root;
|
|
11427
|
-
const currentProps = selectedItem ? selectedItem.props : rootProps;
|
|
11428
|
-
const newProps = __spreadProps(__spreadValues({}, currentProps), { [fieldName]: value });
|
|
11429
|
-
if (selectedItem && itemSelector) {
|
|
11430
|
-
const resolved = yield resolveComponentData2(
|
|
11431
|
-
__spreadProps(__spreadValues({}, selectedItem), { props: newProps }),
|
|
11432
|
-
"replace"
|
|
11433
|
-
);
|
|
11434
|
-
const latestSelector = getSelectorForId(
|
|
11435
|
-
appStore.getState().state,
|
|
11436
|
-
selectedItem.props.id
|
|
11437
|
-
);
|
|
11438
|
-
if (!latestSelector) return;
|
|
11439
|
-
dispatch({
|
|
11440
|
-
type: "replace",
|
|
11441
|
-
destinationIndex: latestSelector.index,
|
|
11442
|
-
destinationZone: latestSelector.zone || rootDroppableId,
|
|
11443
|
-
data: resolved.node,
|
|
11444
|
-
ui: updatedUi
|
|
11445
|
-
});
|
|
11446
|
-
return;
|
|
11447
|
-
}
|
|
11448
|
-
if (data.root.props) {
|
|
11449
|
-
dispatch({
|
|
11450
|
-
type: "replaceRoot",
|
|
11451
|
-
root: (yield resolveComponentData2(
|
|
11452
|
-
__spreadProps(__spreadValues({}, data.root), { props: newProps }),
|
|
11453
|
-
"replace"
|
|
11454
|
-
)).node,
|
|
11455
|
-
ui: __spreadValues(__spreadValues({}, ui), updatedUi),
|
|
11456
|
-
recordHistory: true
|
|
11457
|
-
});
|
|
11458
|
-
return;
|
|
11459
|
-
}
|
|
11460
|
-
dispatch({
|
|
11461
|
-
type: "setData",
|
|
11462
|
-
data: { root: newProps }
|
|
11463
|
-
});
|
|
11464
|
-
});
|
|
11465
|
-
var FieldsChildInner = ({ fieldName }) => {
|
|
11466
|
-
const field = useAppStore((s) => s.fields.fields[fieldName]);
|
|
11467
|
-
const isReadOnly = useAppStore(
|
|
11468
|
-
(s) => ((s.selectedItem ? s.selectedItem.readOnly : s.state.data.root.readOnly) || {})[fieldName]
|
|
11469
|
-
);
|
|
11470
|
-
const id = useAppStore((s) => {
|
|
11471
|
-
if (!field) return null;
|
|
11472
|
-
return s.selectedItem ? `${s.selectedItem.props.id}_${field.type}_${fieldName}` : `root_${field.type}_${fieldName}`;
|
|
11473
|
-
});
|
|
11474
|
-
const permissions = useAppStore(
|
|
11475
|
-
(0, import_shallow7.useShallow)((s) => {
|
|
11476
|
-
const { selectedItem, permissions: permissions2 } = s;
|
|
11477
|
-
return selectedItem ? permissions2.getPermissions({ item: selectedItem }) : permissions2.getPermissions({ root: true });
|
|
11478
|
-
})
|
|
11479
|
-
);
|
|
11480
|
-
const appStore = useAppStoreApi();
|
|
11481
|
-
const onChange = (0, import_react75.useCallback)(createOnChange(fieldName, appStore), [
|
|
11482
|
-
fieldName
|
|
11483
|
-
]);
|
|
11484
|
-
const { visible = true } = field != null ? field : {};
|
|
11485
|
-
const fieldStore = (0, import_react75.useContext)(fieldContextStore.ctx);
|
|
11486
|
-
(0, import_react75.useEffect)(() => {
|
|
11487
|
-
return appStore.subscribe(
|
|
11488
|
-
(s) => {
|
|
11489
|
-
var _a;
|
|
11490
|
-
const data = s.getCurrentData();
|
|
11491
|
-
return (_a = data.props) == null ? void 0 : _a[fieldName];
|
|
11492
|
-
},
|
|
11493
|
-
(value) => {
|
|
11494
|
-
fieldStore.setState({ [fieldName]: value });
|
|
11495
|
-
}
|
|
11496
|
-
);
|
|
11497
|
-
}, [appStore, fieldStore]);
|
|
11498
|
-
if (!field || !id || !visible) return null;
|
|
11499
|
-
if (field.type === "slot") return null;
|
|
11500
|
-
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: getClassName29("field"), children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
11501
|
-
AutoFieldPrivate,
|
|
11502
|
-
{
|
|
11503
|
-
field,
|
|
11504
|
-
name: fieldName,
|
|
11505
|
-
id,
|
|
11506
|
-
readOnly: !permissions.edit || isReadOnly,
|
|
11507
|
-
onChange
|
|
11508
|
-
}
|
|
11509
|
-
) }, id);
|
|
11510
|
-
};
|
|
11511
|
-
var FieldsChild = ({ fieldName }) => {
|
|
11512
|
-
const appStore = useAppStoreApi();
|
|
11513
|
-
const initialValue = (0, import_react75.useMemo)(() => {
|
|
11514
|
-
var _a;
|
|
11515
|
-
const value = (_a = appStore.getState().getCurrentData().props) == null ? void 0 : _a[fieldName];
|
|
11516
|
-
return { [fieldName]: value };
|
|
11517
|
-
}, []);
|
|
11518
|
-
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(fieldContextStore.Provider, { value: initialValue, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(FieldsChildInner, { fieldName }) });
|
|
11519
|
-
};
|
|
11520
|
-
var FieldsChildMemo = (0, import_react75.memo)(FieldsChild);
|
|
11521
|
-
var GlobalSyncButton = () => {
|
|
11522
|
-
const appStore = useAppStoreApi();
|
|
11523
|
-
const selectedItem = useAppStore((s) => s.selectedItem);
|
|
11524
|
-
const isGlobalType = useAppStore(
|
|
11525
|
-
(s) => {
|
|
11526
|
-
var _a;
|
|
11527
|
-
return selectedItem ? ((_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.global) === true : false;
|
|
11528
|
-
}
|
|
11529
|
-
);
|
|
11530
|
-
if (!selectedItem || !isGlobalType) return null;
|
|
11531
|
-
const isUnlinked = selectedItem.synced === false;
|
|
11532
|
-
const onClick = () => __async(null, null, function* () {
|
|
11533
|
-
const { dispatch, state, resolveComponentData: resolveComponentData2 } = appStore.getState();
|
|
11534
|
-
const latestSelector = getSelectorForId(state, selectedItem.props.id);
|
|
11535
|
-
if (!latestSelector) return;
|
|
11536
|
-
const resolved = yield resolveComponentData2(
|
|
11537
|
-
__spreadProps(__spreadValues({}, selectedItem), { synced: isUnlinked ? true : false }),
|
|
11538
|
-
"replace"
|
|
11495
|
+
id: dynamicId,
|
|
11496
|
+
isDragDisabled,
|
|
11497
|
+
children
|
|
11498
|
+
}
|
|
11499
|
+
) }, dynamicId);
|
|
11500
|
+
};
|
|
11501
|
+
var Drawer = ({
|
|
11502
|
+
children,
|
|
11503
|
+
droppableId,
|
|
11504
|
+
direction,
|
|
11505
|
+
variant = "list"
|
|
11506
|
+
}) => {
|
|
11507
|
+
if (droppableId) {
|
|
11508
|
+
console.error(
|
|
11509
|
+
"Warning: The `droppableId` prop on Drawer is deprecated and no longer required."
|
|
11539
11510
|
);
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11511
|
+
}
|
|
11512
|
+
if (direction) {
|
|
11513
|
+
console.error(
|
|
11514
|
+
"Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
|
|
11515
|
+
);
|
|
11516
|
+
}
|
|
11517
|
+
const id = useSafeId();
|
|
11518
|
+
const { ref } = (0, import_react74.useDroppable)({
|
|
11519
|
+
id,
|
|
11520
|
+
type: "void",
|
|
11521
|
+
collisionPriority: 0
|
|
11522
|
+
// Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
|
|
11546
11523
|
});
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
|
|
11553
|
-
|
|
11554
|
-
|
|
11524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11525
|
+
"div",
|
|
11526
|
+
{
|
|
11527
|
+
className: getClassName28({ [variant]: variant }),
|
|
11528
|
+
ref,
|
|
11529
|
+
"data-editor-dnd": id,
|
|
11530
|
+
"data-editor-drawer": true,
|
|
11531
|
+
"data-editor-dnd-void": true,
|
|
11532
|
+
children
|
|
11533
|
+
}
|
|
11534
|
+
);
|
|
11555
11535
|
};
|
|
11556
|
-
|
|
11536
|
+
Drawer.Item = DrawerItem;
|
|
11537
|
+
|
|
11538
|
+
// components/ComponentList/index.tsx
|
|
11539
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
11540
|
+
var getClassName29 = get_class_name_factory_default("ComponentList", styles_module_default17);
|
|
11541
|
+
var ComponentListItem = ({
|
|
11542
|
+
name,
|
|
11543
|
+
label,
|
|
11544
|
+
icon
|
|
11545
|
+
}) => {
|
|
11546
|
+
var _a;
|
|
11557
11547
|
const overrides = useAppStore((s) => s.overrides);
|
|
11558
|
-
const
|
|
11559
|
-
|
|
11560
|
-
|
|
11561
|
-
|
|
11562
|
-
});
|
|
11563
|
-
const itemSelector = useAppStore((0, import_shallow7.useShallow)((s) => s.state.ui.itemSelector));
|
|
11564
|
-
const id = useAppStore((s) => {
|
|
11565
|
-
var _a;
|
|
11566
|
-
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
|
11567
|
-
});
|
|
11568
|
-
const appStore = useAppStoreApi();
|
|
11569
|
-
useRegisterFieldsSlice(appStore, id);
|
|
11570
|
-
const fieldsLoading = useAppStore((s) => s.fields.loading);
|
|
11571
|
-
const fieldNames = useAppStore(
|
|
11572
|
-
(0, import_shallow7.useShallow)((s) => {
|
|
11573
|
-
if (s.fields.id === id) {
|
|
11574
|
-
return Object.keys(s.fields.fields);
|
|
11575
|
-
}
|
|
11576
|
-
return [];
|
|
11577
|
-
})
|
|
11548
|
+
const canInsert = useAppStore(
|
|
11549
|
+
(s) => s.permissions.getPermissions({
|
|
11550
|
+
type: name
|
|
11551
|
+
}).insert
|
|
11578
11552
|
);
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
className: getClassName29({ wrapFields }),
|
|
11585
|
-
onSubmit: (e) => {
|
|
11586
|
-
e.preventDefault();
|
|
11587
|
-
},
|
|
11588
|
-
children: [
|
|
11589
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(Wrapper, { isLoading, itemSelector, children: [
|
|
11590
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(GlobalSyncButton, {}),
|
|
11591
|
-
fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(FieldsChildMemo, { fieldName }, fieldName))
|
|
11592
|
-
] }),
|
|
11593
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: getClassName29("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: getClassName29("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Loader, { size: 16 }) }) })
|
|
11594
|
-
]
|
|
11553
|
+
(0, import_react75.useEffect)(() => {
|
|
11554
|
+
if (overrides.componentItem) {
|
|
11555
|
+
console.warn(
|
|
11556
|
+
"The `componentItem` override has been deprecated and renamed to `drawerItem`"
|
|
11557
|
+
);
|
|
11595
11558
|
}
|
|
11596
|
-
);
|
|
11559
|
+
}, [overrides]);
|
|
11560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Drawer.Item, { label, name, icon, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
|
|
11561
|
+
};
|
|
11562
|
+
var ComponentList = ({
|
|
11563
|
+
children,
|
|
11564
|
+
title,
|
|
11565
|
+
id
|
|
11566
|
+
}) => {
|
|
11567
|
+
const config = useAppStore((s) => s.config);
|
|
11568
|
+
const setUi = useAppStore((s) => s.setUi);
|
|
11569
|
+
const componentList = useAppStore((s) => s.state.ui.componentList);
|
|
11570
|
+
const { expanded = true } = componentList[id] || {};
|
|
11571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: getClassName29({ isExpanded: expanded }), children: [
|
|
11572
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
11573
|
+
"button",
|
|
11574
|
+
{
|
|
11575
|
+
type: "button",
|
|
11576
|
+
className: getClassName29("title"),
|
|
11577
|
+
onClick: () => setUi({
|
|
11578
|
+
componentList: __spreadProps(__spreadValues({}, componentList), {
|
|
11579
|
+
[id]: __spreadProps(__spreadValues({}, componentList[id]), {
|
|
11580
|
+
expanded: !expanded
|
|
11581
|
+
})
|
|
11582
|
+
})
|
|
11583
|
+
}),
|
|
11584
|
+
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
|
11585
|
+
children: [
|
|
11586
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: getClassName29("titleIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ChevronRight, { size: 12 }) }),
|
|
11587
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { children: title })
|
|
11588
|
+
]
|
|
11589
|
+
}
|
|
11590
|
+
),
|
|
11591
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: getClassName29("content"), children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Drawer, { variant: "tile", children: children || Object.keys(config.components).map((componentKey) => {
|
|
11592
|
+
var _a;
|
|
11593
|
+
const componentConf = config.components[componentKey] || {};
|
|
11594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
11595
|
+
ComponentListItem,
|
|
11596
|
+
{
|
|
11597
|
+
label: (_a = componentConf["label"]) != null ? _a : componentKey,
|
|
11598
|
+
icon: componentConf["icon"],
|
|
11599
|
+
name: componentKey
|
|
11600
|
+
},
|
|
11601
|
+
componentKey
|
|
11602
|
+
);
|
|
11603
|
+
}) }) })
|
|
11604
|
+
] });
|
|
11597
11605
|
};
|
|
11598
|
-
|
|
11606
|
+
ComponentList.Item = ComponentListItem;
|
|
11599
11607
|
|
|
11600
11608
|
// components/Editor/components/Components/index.tsx
|
|
11601
|
-
init_react_import();
|
|
11602
|
-
init_store();
|
|
11603
11609
|
var import_react76 = require("react");
|
|
11604
11610
|
init_lucide_react();
|
|
11605
11611
|
|
|
@@ -13297,7 +13303,7 @@ var DEVICE_VIEWPORTS = {
|
|
|
13297
13303
|
var BrowserBar = ({
|
|
13298
13304
|
onViewportChange
|
|
13299
13305
|
}) => {
|
|
13300
|
-
const { routes,
|
|
13306
|
+
const { routes, currentRoute, onRouteChange } = usePropsContext();
|
|
13301
13307
|
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
13302
13308
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
13303
13309
|
const leftSideBarVisible = useAppStore((s) => s.state.ui.leftSideBarVisible);
|
|
@@ -13323,24 +13329,24 @@ var BrowserBar = ({
|
|
|
13323
13329
|
const setDevice = (device) => {
|
|
13324
13330
|
onViewportChange == null ? void 0 : onViewportChange(DEVICE_VIEWPORTS[device]);
|
|
13325
13331
|
};
|
|
13326
|
-
const showRoutePicker = !!routes &&
|
|
13327
|
-
const [inputValue, setInputValue] = (0, import_react87.useState)(
|
|
13328
|
-
const lastSyncedPath = (0, import_react87.useRef)(
|
|
13329
|
-
if (lastSyncedPath.current !==
|
|
13330
|
-
lastSyncedPath.current =
|
|
13331
|
-
setInputValue(
|
|
13332
|
+
const showRoutePicker = !!routes && currentRoute !== void 0 && !!onRouteChange;
|
|
13333
|
+
const [inputValue, setInputValue] = (0, import_react87.useState)(currentRoute != null ? currentRoute : "");
|
|
13334
|
+
const lastSyncedPath = (0, import_react87.useRef)(currentRoute);
|
|
13335
|
+
if (lastSyncedPath.current !== currentRoute) {
|
|
13336
|
+
lastSyncedPath.current = currentRoute;
|
|
13337
|
+
setInputValue(currentRoute != null ? currentRoute : "");
|
|
13332
13338
|
}
|
|
13333
13339
|
const submit = (raw) => {
|
|
13334
13340
|
const next = normalizeRoute(raw);
|
|
13335
|
-
if (!next || next ===
|
|
13341
|
+
if (!next || next === currentRoute) return;
|
|
13336
13342
|
void (onRouteChange == null ? void 0 : onRouteChange(next));
|
|
13337
13343
|
};
|
|
13338
13344
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: getClassName36(), children: [
|
|
13339
13345
|
showRoutePicker ? /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
13340
13346
|
Combobox,
|
|
13341
13347
|
{
|
|
13342
|
-
items: routes
|
|
13343
|
-
value:
|
|
13348
|
+
items: routes,
|
|
13349
|
+
value: currentRoute,
|
|
13344
13350
|
onValueChange: (next) => {
|
|
13345
13351
|
if (typeof next === "string") submit(next);
|
|
13346
13352
|
},
|
|
@@ -13373,13 +13379,7 @@ var BrowserBar = ({
|
|
|
13373
13379
|
),
|
|
13374
13380
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(ComboboxContent, { children: [
|
|
13375
13381
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ComboboxEmpty, { children: "Press Enter to go to this path" }),
|
|
13376
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ComboboxList, { children: (path) => {
|
|
13377
|
-
const route = routes.find((r) => r.path === path);
|
|
13378
|
-
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(ComboboxItem, { value: path, children: [
|
|
13379
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: getClassName36("itemPath"), children: path }),
|
|
13380
|
-
(route == null ? void 0 : route.title) ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: getClassName36("itemTitle"), children: route.title }) : null
|
|
13381
|
-
] }, path);
|
|
13382
|
-
} })
|
|
13382
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ComboboxList, { children: (path) => /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ComboboxItem, { value: path, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: getClassName36("itemPath"), children: path }) }, path) })
|
|
13383
13383
|
] })
|
|
13384
13384
|
]
|
|
13385
13385
|
}
|
|
@@ -14116,25 +14116,6 @@ var blocksPlugin = () => ({
|
|
|
14116
14116
|
icon: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Plus, {})
|
|
14117
14117
|
});
|
|
14118
14118
|
|
|
14119
|
-
// plugins/outline/index.tsx
|
|
14120
|
-
init_react_import();
|
|
14121
|
-
init_lucide_react();
|
|
14122
|
-
|
|
14123
|
-
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/outline/styles.module.css#css-module
|
|
14124
|
-
init_react_import();
|
|
14125
|
-
var styles_module_default35 = { "OutlinePlugin": "_OutlinePlugin_q92j6_1" };
|
|
14126
|
-
|
|
14127
|
-
// plugins/outline/index.tsx
|
|
14128
|
-
init_lib();
|
|
14129
|
-
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
14130
|
-
var getClassName42 = get_class_name_factory_default("OutlinePlugin", styles_module_default35);
|
|
14131
|
-
var outlinePlugin = () => ({
|
|
14132
|
-
name: "outline",
|
|
14133
|
-
label: "Outline",
|
|
14134
|
-
render: () => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: getClassName42(), children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Outline, {}) }),
|
|
14135
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Layers, {})
|
|
14136
|
-
});
|
|
14137
|
-
|
|
14138
14119
|
// plugins/fields/index.tsx
|
|
14139
14120
|
init_react_import();
|
|
14140
14121
|
init_lucide_react();
|
|
@@ -14142,12 +14123,12 @@ init_store();
|
|
|
14142
14123
|
|
|
14143
14124
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css#css-module
|
|
14144
14125
|
init_react_import();
|
|
14145
|
-
var
|
|
14126
|
+
var styles_module_default35 = { "FieldsPlugin": "_FieldsPlugin_262zt_1", "FieldsPlugin-header": "_FieldsPlugin-header_262zt_7" };
|
|
14146
14127
|
|
|
14147
14128
|
// plugins/fields/index.tsx
|
|
14148
14129
|
init_lib();
|
|
14149
|
-
var
|
|
14150
|
-
var
|
|
14130
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
14131
|
+
var getClassName42 = get_class_name_factory_default("FieldsPlugin", styles_module_default35);
|
|
14151
14132
|
var CurrentTitle = () => {
|
|
14152
14133
|
const label = useAppStore((s) => {
|
|
14153
14134
|
var _a, _b;
|
|
@@ -14159,22 +14140,22 @@ var CurrentTitle = () => {
|
|
|
14159
14140
|
var fieldsPlugin = ({ desktopSideBar = "right" } = {}) => ({
|
|
14160
14141
|
name: "fields",
|
|
14161
14142
|
label: "Fields",
|
|
14162
|
-
render: () => /* @__PURE__ */ (0,
|
|
14163
|
-
/* @__PURE__ */ (0,
|
|
14164
|
-
/* @__PURE__ */ (0,
|
|
14143
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: getClassName42(), children: [
|
|
14144
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: getClassName42("header"), children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Breadcrumbs, { numParents: 2, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(CurrentTitle, {}) }) }),
|
|
14145
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Fields, {})
|
|
14165
14146
|
] }),
|
|
14166
|
-
icon: /* @__PURE__ */ (0,
|
|
14147
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(RectangleEllipsis, {}),
|
|
14167
14148
|
mobileOnly: desktopSideBar === "right"
|
|
14168
14149
|
});
|
|
14169
14150
|
|
|
14170
14151
|
// components/Editor/components/Layout/index.tsx
|
|
14171
|
-
var
|
|
14172
|
-
var
|
|
14152
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
14153
|
+
var getClassName43 = get_class_name_factory_default("Editor", styles_module_default25);
|
|
14173
14154
|
var getLayoutClassName = get_class_name_factory_default("EditorLayout", styles_module_default25);
|
|
14174
14155
|
var getPluginTabClassName = get_class_name_factory_default("EditorPluginTab", styles_module_default25);
|
|
14175
14156
|
var FieldSideBarToolbar = () => {
|
|
14176
14157
|
const appStore = useAppStoreApi();
|
|
14177
|
-
const { onPublish } = usePropsContext();
|
|
14158
|
+
const { onPublish, currentRoute } = usePropsContext();
|
|
14178
14159
|
const back = useAppStore((s) => s.history.back);
|
|
14179
14160
|
const forward = useAppStore((s) => s.history.forward);
|
|
14180
14161
|
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
|
@@ -14182,35 +14163,35 @@ var FieldSideBarToolbar = () => {
|
|
|
14182
14163
|
const CustomHeaderActions = useAppStore(
|
|
14183
14164
|
(s) => s.overrides.headerActions || DefaultOverride
|
|
14184
14165
|
);
|
|
14185
|
-
return /* @__PURE__ */ (0,
|
|
14186
|
-
/* @__PURE__ */ (0,
|
|
14187
|
-
/* @__PURE__ */ (0,
|
|
14166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: getClassName43("fieldSideBarToolbar"), children: [
|
|
14167
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: getClassName43("fieldSideBarHistory"), children: [
|
|
14168
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14188
14169
|
IconButton,
|
|
14189
14170
|
{
|
|
14190
14171
|
type: "button",
|
|
14191
14172
|
title: "undo",
|
|
14192
14173
|
disabled: !hasPast,
|
|
14193
14174
|
onClick: back,
|
|
14194
|
-
children: /* @__PURE__ */ (0,
|
|
14175
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Undo2, { size: 18 })
|
|
14195
14176
|
}
|
|
14196
14177
|
),
|
|
14197
|
-
/* @__PURE__ */ (0,
|
|
14178
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14198
14179
|
IconButton,
|
|
14199
14180
|
{
|
|
14200
14181
|
type: "button",
|
|
14201
14182
|
title: "redo",
|
|
14202
14183
|
disabled: !hasFuture,
|
|
14203
14184
|
onClick: forward,
|
|
14204
|
-
children: /* @__PURE__ */ (0,
|
|
14185
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Redo2, { size: 18 })
|
|
14205
14186
|
}
|
|
14206
14187
|
)
|
|
14207
14188
|
] }),
|
|
14208
|
-
/* @__PURE__ */ (0,
|
|
14189
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getClassName43("fieldSideBarActions"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14209
14190
|
Button,
|
|
14210
14191
|
{
|
|
14211
14192
|
onClick: () => {
|
|
14212
14193
|
const data = appStore.getState().state.data;
|
|
14213
|
-
onPublish && onPublish(data);
|
|
14194
|
+
onPublish && onPublish(data, currentRoute);
|
|
14214
14195
|
},
|
|
14215
14196
|
children: "Publish"
|
|
14216
14197
|
}
|
|
@@ -14224,9 +14205,9 @@ var FieldSideBar = () => {
|
|
|
14224
14205
|
return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : ((_c = s.config.root) == null ? void 0 : _c.label) || "Page";
|
|
14225
14206
|
}
|
|
14226
14207
|
);
|
|
14227
|
-
return /* @__PURE__ */ (0,
|
|
14228
|
-
/* @__PURE__ */ (0,
|
|
14229
|
-
/* @__PURE__ */ (0,
|
|
14208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
14209
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(FieldSideBarToolbar, {}),
|
|
14210
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Fields, {}) })
|
|
14230
14211
|
] });
|
|
14231
14212
|
};
|
|
14232
14213
|
var PluginTab = ({
|
|
@@ -14234,7 +14215,7 @@ var PluginTab = ({
|
|
|
14234
14215
|
visible,
|
|
14235
14216
|
mobileOnly
|
|
14236
14217
|
}) => {
|
|
14237
|
-
return /* @__PURE__ */ (0,
|
|
14218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getPluginTabClassName({ visible, mobileOnly }), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getPluginTabClassName("body"), children }) });
|
|
14238
14219
|
};
|
|
14239
14220
|
var Layout = ({ children }) => {
|
|
14240
14221
|
const {
|
|
@@ -14257,6 +14238,7 @@ var Layout = ({ children }) => {
|
|
|
14257
14238
|
const rightSideBarVisible = useAppStore(
|
|
14258
14239
|
(s) => s.state.ui.rightSideBarVisible
|
|
14259
14240
|
);
|
|
14241
|
+
const navBarVisible = useAppStore((s) => s.state.ui.navBarVisible);
|
|
14260
14242
|
const instanceId = useAppStore((s) => s.instanceId);
|
|
14261
14243
|
const {
|
|
14262
14244
|
width: leftWidth,
|
|
@@ -14401,7 +14383,7 @@ var Layout = ({ children }) => {
|
|
|
14401
14383
|
const toggleTheme = () => {
|
|
14402
14384
|
setTheme((t) => t === "dark" ? "light" : "dark");
|
|
14403
14385
|
};
|
|
14404
|
-
const themeIcon = theme === "dark" ? /* @__PURE__ */ (0,
|
|
14386
|
+
const themeIcon = theme === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Sun, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Moon, { size: 18 });
|
|
14405
14387
|
const themeLabel = theme === "dark" ? "Switch to light mode" : "Switch to dark mode";
|
|
14406
14388
|
const hasLegacySideBarPlugin = (0, import_react94.useMemo)(
|
|
14407
14389
|
() => !!(plugins == null ? void 0 : plugins.find((p) => p.name === "legacy-side-bar")),
|
|
@@ -14409,7 +14391,7 @@ var Layout = ({ children }) => {
|
|
|
14409
14391
|
);
|
|
14410
14392
|
const pluginItems = (0, import_react94.useMemo)(() => {
|
|
14411
14393
|
const details = {};
|
|
14412
|
-
const defaultPlugins = [blocksPlugin()
|
|
14394
|
+
const defaultPlugins = [blocksPlugin()];
|
|
14413
14395
|
const isLegacy = (plugin) => plugin.name === "legacy-side-bar" ? -1 : 0;
|
|
14414
14396
|
const combinedPlugins = [
|
|
14415
14397
|
...defaultPlugins,
|
|
@@ -14426,7 +14408,7 @@ var Layout = ({ children }) => {
|
|
|
14426
14408
|
}
|
|
14427
14409
|
details[plugin.name] = {
|
|
14428
14410
|
label: (_a = plugin.label) != null ? _a : plugin.name,
|
|
14429
|
-
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ (0,
|
|
14411
|
+
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToyBrick, {}),
|
|
14430
14412
|
onClick: () => {
|
|
14431
14413
|
var _a2;
|
|
14432
14414
|
setMobilePanelHeightMode((_a2 = plugin.mobilePanelHeight) != null ? _a2 : "toggle");
|
|
@@ -14465,17 +14447,17 @@ var Layout = ({ children }) => {
|
|
|
14465
14447
|
if (mobilePanelHeight && leftSideBarVisible) {
|
|
14466
14448
|
mobilePanelStyle["--editor-mobile-panel-height"] = `${mobilePanelHeight}px`;
|
|
14467
14449
|
}
|
|
14468
|
-
return /* @__PURE__ */ (0,
|
|
14450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
14469
14451
|
"div",
|
|
14470
14452
|
{
|
|
14471
|
-
className: `Editor ${
|
|
14453
|
+
className: `Editor ${getClassName43({
|
|
14472
14454
|
hidePlugins: hasLegacySideBarPlugin
|
|
14473
14455
|
})}`,
|
|
14474
14456
|
id: instanceId,
|
|
14475
14457
|
"data-theme": theme,
|
|
14476
14458
|
style: { height },
|
|
14477
14459
|
children: [
|
|
14478
|
-
/* @__PURE__ */ (0,
|
|
14460
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(CustomEditor, { children: children || /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(FrameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14479
14461
|
"div",
|
|
14480
14462
|
{
|
|
14481
14463
|
className: getLayoutClassName({
|
|
@@ -14487,17 +14469,17 @@ var Layout = ({ children }) => {
|
|
|
14487
14469
|
mobilePanelCustomHeight: mobilePanelHeight !== null && leftSideBarVisible
|
|
14488
14470
|
}),
|
|
14489
14471
|
style: { height },
|
|
14490
|
-
children: /* @__PURE__ */ (0,
|
|
14472
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
14491
14473
|
"div",
|
|
14492
14474
|
{
|
|
14493
14475
|
className: getLayoutClassName("inner"),
|
|
14494
14476
|
style: __spreadValues(__spreadValues({}, layoutOptions), mobilePanelStyle),
|
|
14495
14477
|
children: [
|
|
14496
|
-
/* @__PURE__ */ (0,
|
|
14478
|
+
navBarVisible && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getLayoutClassName("nav"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14497
14479
|
Nav,
|
|
14498
14480
|
{
|
|
14499
14481
|
items: pluginItems,
|
|
14500
|
-
footer: /* @__PURE__ */ (0,
|
|
14482
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14501
14483
|
IconButton,
|
|
14502
14484
|
{
|
|
14503
14485
|
type: "button",
|
|
@@ -14508,19 +14490,19 @@ var Layout = ({ children }) => {
|
|
|
14508
14490
|
)
|
|
14509
14491
|
}
|
|
14510
14492
|
) }),
|
|
14511
|
-
/* @__PURE__ */ (0,
|
|
14493
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
14512
14494
|
"div",
|
|
14513
14495
|
{
|
|
14514
14496
|
ref: mobilePanelRef,
|
|
14515
14497
|
className: getLayoutClassName("mobilePanel"),
|
|
14516
14498
|
children: [
|
|
14517
|
-
/* @__PURE__ */ (0,
|
|
14499
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14518
14500
|
"div",
|
|
14519
14501
|
{
|
|
14520
14502
|
className: getLayoutClassName("mobileDragHandle"),
|
|
14521
14503
|
onTouchStart: (e) => handleMobileDragStart(e.touches[0].clientY),
|
|
14522
14504
|
onMouseDown: (e) => handleMobileDragStart(e.clientY),
|
|
14523
|
-
children: /* @__PURE__ */ (0,
|
|
14505
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14524
14506
|
"div",
|
|
14525
14507
|
{
|
|
14526
14508
|
className: getLayoutClassName("mobileDragHandlePill")
|
|
@@ -14528,17 +14510,17 @@ var Layout = ({ children }) => {
|
|
|
14528
14510
|
)
|
|
14529
14511
|
}
|
|
14530
14512
|
),
|
|
14531
|
-
/* @__PURE__ */ (0,
|
|
14513
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14532
14514
|
"div",
|
|
14533
14515
|
{
|
|
14534
14516
|
className: getLayoutClassName("mobilePanelContent"),
|
|
14535
14517
|
children: Object.entries(pluginItems).map(
|
|
14536
|
-
([id, { mobileOnly, render: Render2 }]) => /* @__PURE__ */ (0,
|
|
14518
|
+
([id, { mobileOnly, render: Render2 }]) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14537
14519
|
PluginTab,
|
|
14538
14520
|
{
|
|
14539
14521
|
visible: currentPlugin === id,
|
|
14540
14522
|
mobileOnly,
|
|
14541
|
-
children: /* @__PURE__ */ (0,
|
|
14523
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Render2, {})
|
|
14542
14524
|
},
|
|
14543
14525
|
id
|
|
14544
14526
|
)
|
|
@@ -14548,7 +14530,7 @@ var Layout = ({ children }) => {
|
|
|
14548
14530
|
]
|
|
14549
14531
|
}
|
|
14550
14532
|
),
|
|
14551
|
-
/* @__PURE__ */ (0,
|
|
14533
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14552
14534
|
Sidebar,
|
|
14553
14535
|
{
|
|
14554
14536
|
position: "left",
|
|
@@ -14557,20 +14539,20 @@ var Layout = ({ children }) => {
|
|
|
14557
14539
|
onResize: setLeftWidth,
|
|
14558
14540
|
onResizeEnd: handleLeftSidebarResizeEnd,
|
|
14559
14541
|
children: Object.entries(pluginItems).map(
|
|
14560
|
-
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */ (0,
|
|
14542
|
+
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14561
14543
|
PluginTab,
|
|
14562
14544
|
{
|
|
14563
14545
|
visible: currentPlugin === id,
|
|
14564
14546
|
mobileOnly,
|
|
14565
|
-
children: /* @__PURE__ */ (0,
|
|
14547
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Render2, {})
|
|
14566
14548
|
},
|
|
14567
14549
|
id
|
|
14568
14550
|
)
|
|
14569
14551
|
)
|
|
14570
14552
|
}
|
|
14571
14553
|
),
|
|
14572
|
-
/* @__PURE__ */ (0,
|
|
14573
|
-
!hasDesktopFieldsPlugin && /* @__PURE__ */ (0,
|
|
14554
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Canvas, {}),
|
|
14555
|
+
!hasDesktopFieldsPlugin && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14574
14556
|
Sidebar,
|
|
14575
14557
|
{
|
|
14576
14558
|
position: "right",
|
|
@@ -14578,7 +14560,7 @@ var Layout = ({ children }) => {
|
|
|
14578
14560
|
isVisible: rightSideBarVisible,
|
|
14579
14561
|
onResize: setRightWidth,
|
|
14580
14562
|
onResizeEnd: handleRightSidebarResizeEnd,
|
|
14581
|
-
children: /* @__PURE__ */ (0,
|
|
14563
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(FieldSideBar, {})
|
|
14582
14564
|
}
|
|
14583
14565
|
)
|
|
14584
14566
|
]
|
|
@@ -14586,17 +14568,17 @@ var Layout = ({ children }) => {
|
|
|
14586
14568
|
)
|
|
14587
14569
|
}
|
|
14588
14570
|
) }) }) }),
|
|
14589
|
-
/* @__PURE__ */ (0,
|
|
14571
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { id: "editor-portal-root", className: getClassName43("portal") })
|
|
14590
14572
|
]
|
|
14591
14573
|
}
|
|
14592
14574
|
);
|
|
14593
14575
|
};
|
|
14594
14576
|
|
|
14595
14577
|
// components/Editor/index.tsx
|
|
14596
|
-
var
|
|
14578
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
14597
14579
|
var propsContext = (0, import_react95.createContext)({});
|
|
14598
14580
|
function PropsProvider(props) {
|
|
14599
|
-
return /* @__PURE__ */ (0,
|
|
14581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(propsContext.Provider, { value: props, children: props.children });
|
|
14600
14582
|
}
|
|
14601
14583
|
var usePropsContext = () => (0, import_react95.useContext)(propsContext);
|
|
14602
14584
|
function EditorProvider({ children }) {
|
|
@@ -14780,10 +14762,10 @@ function EditorProvider({ children }) {
|
|
|
14780
14762
|
resolveAndCommitData();
|
|
14781
14763
|
}, 0);
|
|
14782
14764
|
}, []);
|
|
14783
|
-
return /* @__PURE__ */ (0,
|
|
14765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(UseEditorStoreContext.Provider, { value: uEditorStore, children }) });
|
|
14784
14766
|
}
|
|
14785
14767
|
function Editor4(props) {
|
|
14786
|
-
return /* @__PURE__ */ (0,
|
|
14768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(EditorProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Layout, { children: props.children }) })) }));
|
|
14787
14769
|
}
|
|
14788
14770
|
Editor4.Components = Components;
|
|
14789
14771
|
Editor4.Fields = Fields;
|
|
@@ -14791,9 +14773,349 @@ Editor4.Layout = Layout;
|
|
|
14791
14773
|
Editor4.Outline = Outline;
|
|
14792
14774
|
Editor4.Preview = Preview2;
|
|
14793
14775
|
|
|
14776
|
+
// components/App/AppProvider.tsx
|
|
14777
|
+
init_react_import();
|
|
14778
|
+
var import_react98 = require("react");
|
|
14779
|
+
var import_react_router2 = require("react-router");
|
|
14780
|
+
|
|
14781
|
+
// lib/use-stable-value.ts
|
|
14782
|
+
init_react_import();
|
|
14783
|
+
var import_react96 = require("react");
|
|
14784
|
+
var import_fast_equals5 = require("fast-equals");
|
|
14785
|
+
var useStableValue = (value) => {
|
|
14786
|
+
const ref = (0, import_react96.useRef)(value);
|
|
14787
|
+
if (!(0, import_fast_equals5.deepEqual)(ref.current, value)) {
|
|
14788
|
+
ref.current = value;
|
|
14789
|
+
}
|
|
14790
|
+
return ref.current;
|
|
14791
|
+
};
|
|
14792
|
+
|
|
14793
|
+
// components/App/context.ts
|
|
14794
|
+
init_react_import();
|
|
14795
|
+
var import_react97 = require("react");
|
|
14796
|
+
var import_react_router = require("react-router");
|
|
14797
|
+
var appConfigContext = (0, import_react97.createContext)(null);
|
|
14798
|
+
var useAppConfigContext = () => {
|
|
14799
|
+
const ctx = (0, import_react97.useContext)(appConfigContext);
|
|
14800
|
+
if (!ctx) {
|
|
14801
|
+
throw new Error("useApp must be called inside an <AppProvider> or <App>");
|
|
14802
|
+
}
|
|
14803
|
+
return ctx;
|
|
14804
|
+
};
|
|
14805
|
+
var stripPrefix = (path, prefix2) => {
|
|
14806
|
+
if (path === prefix2) return "/";
|
|
14807
|
+
if (!path.startsWith(`${prefix2}/`)) return path;
|
|
14808
|
+
const rest = path.slice(prefix2.length);
|
|
14809
|
+
return rest.startsWith("/") ? rest : `/${rest}`;
|
|
14810
|
+
};
|
|
14811
|
+
var useApp = () => {
|
|
14812
|
+
const cfg = useAppConfigContext();
|
|
14813
|
+
const location = (0, import_react_router.useLocation)();
|
|
14814
|
+
const rrNavigate = (0, import_react_router.useNavigate)();
|
|
14815
|
+
const currentPath = location.pathname || "/";
|
|
14816
|
+
const isEditing = cfg.editorPath !== null && (currentPath === cfg.editorPath || currentPath.startsWith(`${cfg.editorPath}/`));
|
|
14817
|
+
const matchRoute = isEditing ? stripPrefix(currentPath, cfg.editorPath) : currentPath;
|
|
14818
|
+
const matched = (0, import_react97.useMemo)(() => {
|
|
14819
|
+
const routeKeys = Object.keys(cfg.pages);
|
|
14820
|
+
if (routeKeys.length === 0) return null;
|
|
14821
|
+
const matches = (0, import_react_router.matchRoutes)(
|
|
14822
|
+
routeKeys.map((path) => ({ path })),
|
|
14823
|
+
matchRoute
|
|
14824
|
+
);
|
|
14825
|
+
if (!matches || matches.length === 0) return null;
|
|
14826
|
+
const last = matches[matches.length - 1];
|
|
14827
|
+
const key = last.route.path;
|
|
14828
|
+
return {
|
|
14829
|
+
route: key,
|
|
14830
|
+
params: last.params,
|
|
14831
|
+
data: cfg.pages[key]
|
|
14832
|
+
};
|
|
14833
|
+
}, [cfg.pages, matchRoute]);
|
|
14834
|
+
const routes = (0, import_react97.useMemo)(() => Object.keys(cfg.pages), [cfg.pages]);
|
|
14835
|
+
const navigate = (route) => {
|
|
14836
|
+
const target = isEditing && cfg.editorPath ? `${cfg.editorPath}${route === "/" ? "" : route}` || "/" : route;
|
|
14837
|
+
rrNavigate(target || "/");
|
|
14838
|
+
};
|
|
14839
|
+
return __spreadProps(__spreadValues({}, cfg), {
|
|
14840
|
+
routes,
|
|
14841
|
+
currentPath,
|
|
14842
|
+
isEditing,
|
|
14843
|
+
matchRoute,
|
|
14844
|
+
matched,
|
|
14845
|
+
navigate
|
|
14846
|
+
});
|
|
14847
|
+
};
|
|
14848
|
+
|
|
14849
|
+
// components/App/AppProvider.tsx
|
|
14850
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
14851
|
+
var EDITOR_PATH = "/editor";
|
|
14852
|
+
var isServer = typeof window === "undefined";
|
|
14853
|
+
function AppProvider({
|
|
14854
|
+
config,
|
|
14855
|
+
pages,
|
|
14856
|
+
editorPath = EDITOR_PATH,
|
|
14857
|
+
router = "browser",
|
|
14858
|
+
currentPath,
|
|
14859
|
+
children
|
|
14860
|
+
}) {
|
|
14861
|
+
const stablePages = useStableValue(pages);
|
|
14862
|
+
const resolvedEditorPath = editorPath === null ? null : editorPath || EDITOR_PATH;
|
|
14863
|
+
const ctxValue = (0, import_react98.useMemo)(
|
|
14864
|
+
() => ({
|
|
14865
|
+
config,
|
|
14866
|
+
pages: stablePages,
|
|
14867
|
+
editorPath: resolvedEditorPath
|
|
14868
|
+
}),
|
|
14869
|
+
[config, stablePages, resolvedEditorPath]
|
|
14870
|
+
);
|
|
14871
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(appConfigContext.Provider, { value: ctxValue, children });
|
|
14872
|
+
if (isServer) {
|
|
14873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_router2.StaticRouter, { location: currentPath != null ? currentPath : "/", children: inner });
|
|
14874
|
+
}
|
|
14875
|
+
if (router === "hash") {
|
|
14876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_router2.HashRouter, { children: inner });
|
|
14877
|
+
}
|
|
14878
|
+
if (router === "memory") {
|
|
14879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_router2.MemoryRouter, { initialEntries: [currentPath != null ? currentPath : "/"], children: inner });
|
|
14880
|
+
}
|
|
14881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_router2.BrowserRouter, { children: inner });
|
|
14882
|
+
}
|
|
14883
|
+
|
|
14884
|
+
// components/App/App.tsx
|
|
14885
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
14886
|
+
var joinEditorPath = (editorPath, route) => {
|
|
14887
|
+
if (route === "/") return editorPath;
|
|
14888
|
+
return `${editorPath}${route}`;
|
|
14889
|
+
};
|
|
14890
|
+
var DefaultNotFound = () => /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
14891
|
+
"div",
|
|
14892
|
+
{
|
|
14893
|
+
style: {
|
|
14894
|
+
display: "flex",
|
|
14895
|
+
height: "100vh",
|
|
14896
|
+
textAlign: "center",
|
|
14897
|
+
justifyContent: "center",
|
|
14898
|
+
alignItems: "center"
|
|
14899
|
+
},
|
|
14900
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { children: [
|
|
14901
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("h1", { children: "404" }),
|
|
14902
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)("p", { children: "No page matches this route." })
|
|
14903
|
+
] })
|
|
14904
|
+
}
|
|
14905
|
+
);
|
|
14906
|
+
function RenderForKey({
|
|
14907
|
+
routeKey,
|
|
14908
|
+
metadata
|
|
14909
|
+
}) {
|
|
14910
|
+
const { config, pages } = useApp();
|
|
14911
|
+
const data = pages[routeKey];
|
|
14912
|
+
if (!data) return null;
|
|
14913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
14914
|
+
Render,
|
|
14915
|
+
{
|
|
14916
|
+
config,
|
|
14917
|
+
data,
|
|
14918
|
+
metadata
|
|
14919
|
+
},
|
|
14920
|
+
routeKey
|
|
14921
|
+
);
|
|
14922
|
+
}
|
|
14923
|
+
function EditorForKey({
|
|
14924
|
+
routeKey,
|
|
14925
|
+
editorProps,
|
|
14926
|
+
children
|
|
14927
|
+
}) {
|
|
14928
|
+
const { config, pages, routes, navigate } = useApp();
|
|
14929
|
+
const data = pages[routeKey];
|
|
14930
|
+
if (!data) return null;
|
|
14931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
14932
|
+
Editor4,
|
|
14933
|
+
{
|
|
14934
|
+
config,
|
|
14935
|
+
data,
|
|
14936
|
+
ui: editorProps.ui,
|
|
14937
|
+
plugins: editorProps.plugins,
|
|
14938
|
+
overrides: editorProps.overrides,
|
|
14939
|
+
fieldTransforms: editorProps.fieldTransforms,
|
|
14940
|
+
metadata: editorProps.metadata,
|
|
14941
|
+
iframe: editorProps.iframe,
|
|
14942
|
+
viewports: editorProps.viewports,
|
|
14943
|
+
permissions: editorProps.permissions,
|
|
14944
|
+
onChange: editorProps.onChange,
|
|
14945
|
+
onPublish: editorProps.onPublish,
|
|
14946
|
+
onAction: editorProps.onAction,
|
|
14947
|
+
renderHeader: editorProps.renderHeader,
|
|
14948
|
+
renderHeaderActions: editorProps.renderHeaderActions,
|
|
14949
|
+
title: editorProps.title,
|
|
14950
|
+
dnd: editorProps.dnd,
|
|
14951
|
+
initialHistory: editorProps.initialHistory,
|
|
14952
|
+
height: editorProps.height,
|
|
14953
|
+
fullScreenCanvas: editorProps.fullScreenCanvas,
|
|
14954
|
+
disableZoomControls: editorProps.disableZoomControls,
|
|
14955
|
+
_experimentalVirtualization: editorProps._experimentalVirtualization,
|
|
14956
|
+
routes,
|
|
14957
|
+
currentRoute: routeKey,
|
|
14958
|
+
onRouteChange: (next) => navigate(next),
|
|
14959
|
+
children
|
|
14960
|
+
},
|
|
14961
|
+
routeKey
|
|
14962
|
+
);
|
|
14963
|
+
}
|
|
14964
|
+
function AppRender({ metadata, renderNotFound }) {
|
|
14965
|
+
const { pages, isEditing } = useApp();
|
|
14966
|
+
if (isEditing) return null;
|
|
14967
|
+
const routeKeys = Object.keys(pages);
|
|
14968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_react_router3.Routes, { children: [
|
|
14969
|
+
routeKeys.map((routeKey) => /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
14970
|
+
import_react_router3.Route,
|
|
14971
|
+
{
|
|
14972
|
+
path: routeKey,
|
|
14973
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
14974
|
+
RenderForKey,
|
|
14975
|
+
{
|
|
14976
|
+
routeKey,
|
|
14977
|
+
metadata
|
|
14978
|
+
}
|
|
14979
|
+
)
|
|
14980
|
+
},
|
|
14981
|
+
`render:${routeKey}`
|
|
14982
|
+
)),
|
|
14983
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
14984
|
+
import_react_router3.Route,
|
|
14985
|
+
{
|
|
14986
|
+
path: "*",
|
|
14987
|
+
element: renderNotFound ? /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_jsx_runtime95.Fragment, { children: renderNotFound() }) : /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(DefaultNotFound, {})
|
|
14988
|
+
}
|
|
14989
|
+
)
|
|
14990
|
+
] });
|
|
14991
|
+
}
|
|
14992
|
+
function AppEditor(props) {
|
|
14993
|
+
const _a = props, { children, renderNotFound } = _a, editorProps = __objRest(_a, ["children", "renderNotFound"]);
|
|
14994
|
+
const { pages, isEditing, editorPath } = useApp();
|
|
14995
|
+
if (!isEditing || editorPath === null) return null;
|
|
14996
|
+
const routeKeys = Object.keys(pages);
|
|
14997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_react_router3.Routes, { children: [
|
|
14998
|
+
routeKeys.map((routeKey) => /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
14999
|
+
import_react_router3.Route,
|
|
15000
|
+
{
|
|
15001
|
+
path: joinEditorPath(editorPath, routeKey),
|
|
15002
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
15003
|
+
EditorForKey,
|
|
15004
|
+
{
|
|
15005
|
+
routeKey,
|
|
15006
|
+
editorProps,
|
|
15007
|
+
children
|
|
15008
|
+
}
|
|
15009
|
+
)
|
|
15010
|
+
},
|
|
15011
|
+
`edit:${routeKey}`
|
|
15012
|
+
)),
|
|
15013
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
15014
|
+
import_react_router3.Route,
|
|
15015
|
+
{
|
|
15016
|
+
path: "*",
|
|
15017
|
+
element: renderNotFound ? /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_jsx_runtime95.Fragment, { children: renderNotFound() }) : /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(DefaultNotFound, {})
|
|
15018
|
+
}
|
|
15019
|
+
)
|
|
15020
|
+
] });
|
|
15021
|
+
}
|
|
15022
|
+
function DefaultAppLayout(props) {
|
|
15023
|
+
const _a = props, { renderNotFound } = _a, editorProps = __objRest(_a, ["renderNotFound"]);
|
|
15024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_jsx_runtime95.Fragment, { children: [
|
|
15025
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
15026
|
+
AppRender,
|
|
15027
|
+
{
|
|
15028
|
+
metadata: editorProps.metadata,
|
|
15029
|
+
renderNotFound
|
|
15030
|
+
}
|
|
15031
|
+
),
|
|
15032
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(AppEditor, __spreadProps(__spreadValues({}, editorProps), { renderNotFound }))
|
|
15033
|
+
] });
|
|
15034
|
+
}
|
|
15035
|
+
function App(props) {
|
|
15036
|
+
const _a = props, {
|
|
15037
|
+
config,
|
|
15038
|
+
pages,
|
|
15039
|
+
currentPath,
|
|
15040
|
+
editorPath,
|
|
15041
|
+
router,
|
|
15042
|
+
children
|
|
15043
|
+
} = _a, layoutProps = __objRest(_a, [
|
|
15044
|
+
"config",
|
|
15045
|
+
"pages",
|
|
15046
|
+
"currentPath",
|
|
15047
|
+
"editorPath",
|
|
15048
|
+
"router",
|
|
15049
|
+
"children"
|
|
15050
|
+
]);
|
|
15051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
15052
|
+
AppProvider,
|
|
15053
|
+
{
|
|
15054
|
+
config,
|
|
15055
|
+
pages,
|
|
15056
|
+
currentPath,
|
|
15057
|
+
editorPath,
|
|
15058
|
+
router,
|
|
15059
|
+
children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(DefaultAppLayout, __spreadValues({}, layoutProps))
|
|
15060
|
+
}
|
|
15061
|
+
);
|
|
15062
|
+
}
|
|
15063
|
+
App.Render = AppRender;
|
|
15064
|
+
App.Editor = AppEditor;
|
|
15065
|
+
|
|
15066
|
+
// components/App/use-route-params.ts
|
|
15067
|
+
init_react_import();
|
|
15068
|
+
var import_react_router4 = require("react-router");
|
|
15069
|
+
var useRouteParams = import_react_router4.useParams;
|
|
15070
|
+
|
|
14794
15071
|
// bundle/core.ts
|
|
15072
|
+
init_IconButton2();
|
|
14795
15073
|
init_inner();
|
|
14796
15074
|
|
|
15075
|
+
// lib/get-route-props.ts
|
|
15076
|
+
init_react_import();
|
|
15077
|
+
var import_react_router5 = require("react-router");
|
|
15078
|
+
var DEFAULT_EDITOR_PATH = "/editor";
|
|
15079
|
+
var stripEditorPrefix = (currentRoute, editorPath) => {
|
|
15080
|
+
if (!editorPath) return currentRoute;
|
|
15081
|
+
if (currentRoute === editorPath) return "/";
|
|
15082
|
+
if (!currentRoute.startsWith(`${editorPath}/`)) return currentRoute;
|
|
15083
|
+
const rest = currentRoute.slice(editorPath.length);
|
|
15084
|
+
return rest.startsWith("/") ? rest : `/${rest}`;
|
|
15085
|
+
};
|
|
15086
|
+
var findMatch = (pages, pathname) => {
|
|
15087
|
+
const keys = Object.keys(pages);
|
|
15088
|
+
if (keys.length === 0) return null;
|
|
15089
|
+
const matches = (0, import_react_router5.matchRoutes)(
|
|
15090
|
+
keys.map((path) => ({ path })),
|
|
15091
|
+
pathname
|
|
15092
|
+
);
|
|
15093
|
+
if (!matches || matches.length === 0) return null;
|
|
15094
|
+
const last = matches[matches.length - 1];
|
|
15095
|
+
const key = last.route.path;
|
|
15096
|
+
return { route: key, params: last.params, data: pages[key] };
|
|
15097
|
+
};
|
|
15098
|
+
var getRouteProps = (pages, currentRoute, options = {}) => {
|
|
15099
|
+
var _a, _b;
|
|
15100
|
+
const editorPath = options.editorPath === void 0 ? DEFAULT_EDITOR_PATH : options.editorPath;
|
|
15101
|
+
const matchRoute = stripEditorPrefix(currentRoute || "/", editorPath);
|
|
15102
|
+
const match = findMatch(pages, matchRoute);
|
|
15103
|
+
if (!match) return null;
|
|
15104
|
+
const props = (_b = (_a = match.data) == null ? void 0 : _a.root) == null ? void 0 : _b.props;
|
|
15105
|
+
return props != null ? props : null;
|
|
15106
|
+
};
|
|
15107
|
+
var resolveRouteFromString = (pages, currentRoute, options = {}) => {
|
|
15108
|
+
const editorPath = options.editorPath === void 0 ? DEFAULT_EDITOR_PATH : options.editorPath;
|
|
15109
|
+
const matchRoute = stripEditorPrefix(currentRoute || "/", editorPath);
|
|
15110
|
+
const match = findMatch(pages, matchRoute);
|
|
15111
|
+
if (!match) return null;
|
|
15112
|
+
return {
|
|
15113
|
+
route: match.route,
|
|
15114
|
+
data: match.data,
|
|
15115
|
+
params: match.params
|
|
15116
|
+
};
|
|
15117
|
+
};
|
|
15118
|
+
|
|
14797
15119
|
// lib/migrate.ts
|
|
14798
15120
|
init_react_import();
|
|
14799
15121
|
init_default_app_state();
|
|
@@ -15067,20 +15389,41 @@ function resolveAllData(_0, _1) {
|
|
|
15067
15389
|
// bundle/core.ts
|
|
15068
15390
|
init_walk_tree();
|
|
15069
15391
|
|
|
15392
|
+
// plugins/outline/index.tsx
|
|
15393
|
+
init_react_import();
|
|
15394
|
+
init_lucide_react();
|
|
15395
|
+
|
|
15396
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/outline/styles.module.css#css-module
|
|
15397
|
+
init_react_import();
|
|
15398
|
+
var styles_module_default36 = { "OutlinePlugin": "_OutlinePlugin_q92j6_1" };
|
|
15399
|
+
|
|
15400
|
+
// plugins/outline/index.tsx
|
|
15401
|
+
init_lib();
|
|
15402
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
15403
|
+
var getClassName44 = get_class_name_factory_default("OutlinePlugin", styles_module_default36);
|
|
15404
|
+
var outlinePlugin = () => ({
|
|
15405
|
+
name: "outline",
|
|
15406
|
+
label: "Outline",
|
|
15407
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: getClassName44(), children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(Outline, {}) }),
|
|
15408
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(Layers, {})
|
|
15409
|
+
});
|
|
15410
|
+
|
|
15070
15411
|
// plugins/legacy-side-bar/index.tsx
|
|
15071
15412
|
init_react_import();
|
|
15072
|
-
var
|
|
15413
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
15073
15414
|
var legacySideBarPlugin = () => ({
|
|
15074
15415
|
name: "legacy-side-bar",
|
|
15075
|
-
render: () => /* @__PURE__ */ (0,
|
|
15076
|
-
/* @__PURE__ */ (0,
|
|
15077
|
-
/* @__PURE__ */ (0,
|
|
15416
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { style: { overflowY: "auto" }, children: [
|
|
15417
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Components, {}) }),
|
|
15418
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Outline, {}) })
|
|
15078
15419
|
] })
|
|
15079
15420
|
});
|
|
15080
15421
|
// Annotate the CommonJS export names for ESM import in node:
|
|
15081
15422
|
0 && (module.exports = {
|
|
15082
15423
|
Action,
|
|
15083
15424
|
ActionBar,
|
|
15425
|
+
App,
|
|
15426
|
+
AppProvider,
|
|
15084
15427
|
AutoField,
|
|
15085
15428
|
Button,
|
|
15086
15429
|
ComponentList,
|
|
@@ -15093,9 +15436,11 @@ var legacySideBarPlugin = () => ({
|
|
|
15093
15436
|
Render,
|
|
15094
15437
|
RichTextMenu,
|
|
15095
15438
|
Separator,
|
|
15439
|
+
appConfigContext,
|
|
15096
15440
|
blocksPlugin,
|
|
15097
15441
|
createUseEditor,
|
|
15098
15442
|
fieldsPlugin,
|
|
15443
|
+
getRouteProps,
|
|
15099
15444
|
legacySideBarPlugin,
|
|
15100
15445
|
migrate,
|
|
15101
15446
|
outlinePlugin,
|
|
@@ -15104,11 +15449,15 @@ var legacySideBarPlugin = () => ({
|
|
|
15104
15449
|
registerOverlayPortal,
|
|
15105
15450
|
renderContext,
|
|
15106
15451
|
resolveAllData,
|
|
15452
|
+
resolveRouteFromString,
|
|
15107
15453
|
setDeep,
|
|
15108
15454
|
transformProps,
|
|
15455
|
+
useApp,
|
|
15109
15456
|
useEditor,
|
|
15110
15457
|
useGetEditor,
|
|
15111
15458
|
usePropsContext,
|
|
15459
|
+
useRouteParams,
|
|
15460
|
+
useStableValue,
|
|
15112
15461
|
walkTree
|
|
15113
15462
|
});
|
|
15114
15463
|
/*! Bundled license information:
|