@reacteditor/core 0.0.9 → 0.0.10
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/dist/{Editor-KXEVJBNG.mjs → Editor-3COFH5WN.mjs} +3 -3
- package/dist/{actions-2L-1hQ7r.d.mts → actions-B8_EA7vy.d.mts} +1 -1
- package/dist/{actions-2L-1hQ7r.d.ts → actions-B8_EA7vy.d.ts} +1 -1
- package/dist/{chunk-DU757QEH.mjs → chunk-3IP22OOD.mjs} +307 -33
- package/dist/{chunk-AJWRDM22.mjs → chunk-BZ4BQZJR.mjs} +4 -4
- package/dist/{chunk-TI3KC54Y.mjs → chunk-PUDWMFBH.mjs} +46 -0
- package/dist/{full-ZFZZ626B.mjs → full-QT5KXRDP.mjs} +2 -2
- package/dist/{index-BNsSzMCj.d.ts → index-BrHy0cc_.d.ts} +1 -1
- package/dist/{index-BXuSeNez.d.mts → index-JoD48fK_.d.mts} +1 -1
- package/dist/index.css +84 -84
- package/dist/index.d.mts +110 -17
- package/dist/index.d.ts +110 -17
- package/dist/index.js +990 -663
- package/dist/index.mjs +27 -11
- package/dist/internal.d.mts +2 -2
- package/dist/internal.d.ts +2 -2
- 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 +84 -84
- package/dist/no-external.d.mts +4 -4
- package/dist/no-external.d.ts +4 -4
- package/dist/no-external.js +990 -663
- package/dist/no-external.mjs +27 -11
- 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 +48 -0
- package/dist/rsc.mjs +5 -1
- package/dist/{walk-tree-4C3ODO3X.d.mts → walk-tree-BR2XIZ0W.d.mts} +33 -2
- package/dist/{walk-tree-C9GrSWsR.d.ts → walk-tree-DpUJ9kDx.d.ts} +33 -2
- package/package.json +14 -3
- package/dist/{chunk-U7VW3V3W.mjs → chunk-BUR5T7IX.mjs} +3 -3
package/dist/index.js
CHANGED
|
@@ -5402,11 +5402,11 @@ function RichTextRender({
|
|
|
5402
5402
|
}) {
|
|
5403
5403
|
const { tiptap = {}, options } = field;
|
|
5404
5404
|
const { extensions = [] } = tiptap;
|
|
5405
|
-
const loadedExtensions = (0,
|
|
5405
|
+
const loadedExtensions = (0, import_react60.useMemo)(
|
|
5406
5406
|
() => [EditorRichText.configure(options), ...extensions],
|
|
5407
5407
|
[field, extensions]
|
|
5408
5408
|
);
|
|
5409
|
-
const normalized = (0,
|
|
5409
|
+
const normalized = (0, import_react60.useMemo)(() => {
|
|
5410
5410
|
if (typeof content === "object" && (content == null ? void 0 : content.type) === "doc") {
|
|
5411
5411
|
return content;
|
|
5412
5412
|
}
|
|
@@ -5424,23 +5424,23 @@ function RichTextRender({
|
|
|
5424
5424
|
}
|
|
5425
5425
|
return { type: "doc", content: [] };
|
|
5426
5426
|
}, [content, loadedExtensions]);
|
|
5427
|
-
const html = (0,
|
|
5427
|
+
const html = (0, import_react60.useMemo)(() => {
|
|
5428
5428
|
return (0, import_html.generateHTML)(normalized, loadedExtensions);
|
|
5429
5429
|
}, [normalized, loadedExtensions]);
|
|
5430
|
-
return /* @__PURE__ */ (0,
|
|
5430
|
+
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
5431
|
}
|
|
5432
|
-
var import_html,
|
|
5432
|
+
var import_html, import_react60, import_jsx_runtime61, getClassName25;
|
|
5433
5433
|
var init_Render = __esm({
|
|
5434
5434
|
"components/RichTextEditor/components/Render.tsx"() {
|
|
5435
5435
|
"use strict";
|
|
5436
5436
|
init_react_import();
|
|
5437
5437
|
import_html = require("@tiptap/html");
|
|
5438
|
-
|
|
5438
|
+
import_react60 = require("react");
|
|
5439
5439
|
init_get_class_name_factory();
|
|
5440
5440
|
init_styles_module6();
|
|
5441
5441
|
init_extension();
|
|
5442
|
-
|
|
5443
|
-
|
|
5442
|
+
import_jsx_runtime61 = require("react/jsx-runtime");
|
|
5443
|
+
getClassName25 = get_class_name_factory_default("RichTextEditor", styles_module_default14);
|
|
5444
5444
|
}
|
|
5445
5445
|
});
|
|
5446
5446
|
|
|
@@ -5449,6 +5449,8 @@ var index_exports = {};
|
|
|
5449
5449
|
__export(index_exports, {
|
|
5450
5450
|
Action: () => Action,
|
|
5451
5451
|
ActionBar: () => ActionBar,
|
|
5452
|
+
App: () => App,
|
|
5453
|
+
AppProvider: () => AppProvider,
|
|
5452
5454
|
AutoField: () => AutoField,
|
|
5453
5455
|
Button: () => Button,
|
|
5454
5456
|
ComponentList: () => ComponentList,
|
|
@@ -5461,9 +5463,11 @@ __export(index_exports, {
|
|
|
5461
5463
|
Render: () => Render,
|
|
5462
5464
|
RichTextMenu: () => RichTextMenu,
|
|
5463
5465
|
Separator: () => Separator,
|
|
5466
|
+
appConfigContext: () => appConfigContext,
|
|
5464
5467
|
blocksPlugin: () => blocksPlugin,
|
|
5465
5468
|
createUseEditor: () => createUseEditor,
|
|
5466
5469
|
fieldsPlugin: () => fieldsPlugin,
|
|
5470
|
+
getRouteProps: () => getRouteProps,
|
|
5467
5471
|
legacySideBarPlugin: () => legacySideBarPlugin,
|
|
5468
5472
|
migrate: () => migrate,
|
|
5469
5473
|
outlinePlugin: () => outlinePlugin,
|
|
@@ -5472,11 +5476,15 @@ __export(index_exports, {
|
|
|
5472
5476
|
registerOverlayPortal: () => registerOverlayPortal,
|
|
5473
5477
|
renderContext: () => renderContext,
|
|
5474
5478
|
resolveAllData: () => resolveAllData,
|
|
5479
|
+
resolveRouteFromString: () => resolveRouteFromString,
|
|
5475
5480
|
setDeep: () => setDeep,
|
|
5476
5481
|
transformProps: () => transformProps,
|
|
5482
|
+
useApp: () => useApp,
|
|
5477
5483
|
useEditor: () => useEditor2,
|
|
5478
5484
|
useGetEditor: () => useGetEditor,
|
|
5479
5485
|
usePropsContext: () => usePropsContext,
|
|
5486
|
+
useRouteParams: () => useRouteParams,
|
|
5487
|
+
useStableValue: () => useStableValue,
|
|
5480
5488
|
walkTree: () => walkTree
|
|
5481
5489
|
});
|
|
5482
5490
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -7904,16 +7912,245 @@ function AutoField(props) {
|
|
|
7904
7912
|
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
7913
|
}
|
|
7906
7914
|
|
|
7915
|
+
// components/App/index.ts
|
|
7916
|
+
init_react_import();
|
|
7917
|
+
|
|
7918
|
+
// components/App/App.tsx
|
|
7919
|
+
init_react_import();
|
|
7920
|
+
var import_react_router3 = require("react-router");
|
|
7921
|
+
|
|
7922
|
+
// components/Editor/index.tsx
|
|
7923
|
+
init_react_import();
|
|
7924
|
+
var import_react95 = require("react");
|
|
7925
|
+
init_store();
|
|
7926
|
+
|
|
7927
|
+
// components/Editor/components/Fields/index.tsx
|
|
7928
|
+
init_react_import();
|
|
7929
|
+
init_Loader();
|
|
7930
|
+
init_root_droppable_id();
|
|
7931
|
+
|
|
7932
|
+
// lib/get-selector-for-id.ts
|
|
7933
|
+
init_react_import();
|
|
7934
|
+
var getSelectorForId = (state, id) => {
|
|
7935
|
+
const node = state.indexes.nodes[id];
|
|
7936
|
+
if (!node) return;
|
|
7937
|
+
const zoneCompound = `${node.parentId}:${node.zone}`;
|
|
7938
|
+
const index = state.indexes.zones[zoneCompound].contentIds.indexOf(id);
|
|
7939
|
+
return { zone: zoneCompound, index };
|
|
7940
|
+
};
|
|
7941
|
+
|
|
7942
|
+
// components/Editor/components/Fields/index.tsx
|
|
7943
|
+
init_store();
|
|
7944
|
+
|
|
7945
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Fields/styles.module.css#css-module
|
|
7946
|
+
init_react_import();
|
|
7947
|
+
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" };
|
|
7948
|
+
|
|
7949
|
+
// components/Editor/components/Fields/index.tsx
|
|
7950
|
+
init_lib();
|
|
7951
|
+
var import_react50 = require("react");
|
|
7952
|
+
init_fields();
|
|
7953
|
+
var import_shallow4 = require("zustand/react/shallow");
|
|
7954
|
+
init_lucide_react();
|
|
7955
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
7956
|
+
var getClassName22 = get_class_name_factory_default("EditorFields", styles_module_default16);
|
|
7957
|
+
var DefaultFields = ({
|
|
7958
|
+
children
|
|
7959
|
+
}) => {
|
|
7960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children });
|
|
7961
|
+
};
|
|
7962
|
+
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
|
|
7963
|
+
const { dispatch, state, selectedItem, resolveComponentData: resolveComponentData2 } = appStore.getState();
|
|
7964
|
+
const { data, ui } = state;
|
|
7965
|
+
const { itemSelector } = ui;
|
|
7966
|
+
const rootProps = data.root.props || data.root;
|
|
7967
|
+
const currentProps = selectedItem ? selectedItem.props : rootProps;
|
|
7968
|
+
const newProps = __spreadProps(__spreadValues({}, currentProps), { [fieldName]: value });
|
|
7969
|
+
if (selectedItem && itemSelector) {
|
|
7970
|
+
const resolved = yield resolveComponentData2(
|
|
7971
|
+
__spreadProps(__spreadValues({}, selectedItem), { props: newProps }),
|
|
7972
|
+
"replace"
|
|
7973
|
+
);
|
|
7974
|
+
const latestSelector = getSelectorForId(
|
|
7975
|
+
appStore.getState().state,
|
|
7976
|
+
selectedItem.props.id
|
|
7977
|
+
);
|
|
7978
|
+
if (!latestSelector) return;
|
|
7979
|
+
dispatch({
|
|
7980
|
+
type: "replace",
|
|
7981
|
+
destinationIndex: latestSelector.index,
|
|
7982
|
+
destinationZone: latestSelector.zone || rootDroppableId,
|
|
7983
|
+
data: resolved.node,
|
|
7984
|
+
ui: updatedUi
|
|
7985
|
+
});
|
|
7986
|
+
return;
|
|
7987
|
+
}
|
|
7988
|
+
if (data.root.props) {
|
|
7989
|
+
dispatch({
|
|
7990
|
+
type: "replaceRoot",
|
|
7991
|
+
root: (yield resolveComponentData2(
|
|
7992
|
+
__spreadProps(__spreadValues({}, data.root), { props: newProps }),
|
|
7993
|
+
"replace"
|
|
7994
|
+
)).node,
|
|
7995
|
+
ui: __spreadValues(__spreadValues({}, ui), updatedUi),
|
|
7996
|
+
recordHistory: true
|
|
7997
|
+
});
|
|
7998
|
+
return;
|
|
7999
|
+
}
|
|
8000
|
+
dispatch({
|
|
8001
|
+
type: "setData",
|
|
8002
|
+
data: { root: newProps }
|
|
8003
|
+
});
|
|
8004
|
+
});
|
|
8005
|
+
var FieldsChildInner = ({ fieldName }) => {
|
|
8006
|
+
const field = useAppStore((s) => s.fields.fields[fieldName]);
|
|
8007
|
+
const isReadOnly = useAppStore(
|
|
8008
|
+
(s) => ((s.selectedItem ? s.selectedItem.readOnly : s.state.data.root.readOnly) || {})[fieldName]
|
|
8009
|
+
);
|
|
8010
|
+
const id = useAppStore((s) => {
|
|
8011
|
+
if (!field) return null;
|
|
8012
|
+
return s.selectedItem ? `${s.selectedItem.props.id}_${field.type}_${fieldName}` : `root_${field.type}_${fieldName}`;
|
|
8013
|
+
});
|
|
8014
|
+
const permissions = useAppStore(
|
|
8015
|
+
(0, import_shallow4.useShallow)((s) => {
|
|
8016
|
+
const { selectedItem, permissions: permissions2 } = s;
|
|
8017
|
+
return selectedItem ? permissions2.getPermissions({ item: selectedItem }) : permissions2.getPermissions({ root: true });
|
|
8018
|
+
})
|
|
8019
|
+
);
|
|
8020
|
+
const appStore = useAppStoreApi();
|
|
8021
|
+
const onChange = (0, import_react50.useCallback)(createOnChange(fieldName, appStore), [
|
|
8022
|
+
fieldName
|
|
8023
|
+
]);
|
|
8024
|
+
const { visible = true } = field != null ? field : {};
|
|
8025
|
+
const fieldStore = (0, import_react50.useContext)(fieldContextStore.ctx);
|
|
8026
|
+
(0, import_react50.useEffect)(() => {
|
|
8027
|
+
return appStore.subscribe(
|
|
8028
|
+
(s) => {
|
|
8029
|
+
var _a;
|
|
8030
|
+
const data = s.getCurrentData();
|
|
8031
|
+
return (_a = data.props) == null ? void 0 : _a[fieldName];
|
|
8032
|
+
},
|
|
8033
|
+
(value) => {
|
|
8034
|
+
fieldStore.setState({ [fieldName]: value });
|
|
8035
|
+
}
|
|
8036
|
+
);
|
|
8037
|
+
}, [appStore, fieldStore]);
|
|
8038
|
+
if (!field || !id || !visible) return null;
|
|
8039
|
+
if (field.type === "slot") return null;
|
|
8040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: getClassName22("field"), children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
8041
|
+
AutoFieldPrivate,
|
|
8042
|
+
{
|
|
8043
|
+
field,
|
|
8044
|
+
name: fieldName,
|
|
8045
|
+
id,
|
|
8046
|
+
readOnly: !permissions.edit || isReadOnly,
|
|
8047
|
+
onChange
|
|
8048
|
+
}
|
|
8049
|
+
) }, id);
|
|
8050
|
+
};
|
|
8051
|
+
var FieldsChild = ({ fieldName }) => {
|
|
8052
|
+
const appStore = useAppStoreApi();
|
|
8053
|
+
const initialValue = (0, import_react50.useMemo)(() => {
|
|
8054
|
+
var _a;
|
|
8055
|
+
const value = (_a = appStore.getState().getCurrentData().props) == null ? void 0 : _a[fieldName];
|
|
8056
|
+
return { [fieldName]: value };
|
|
8057
|
+
}, []);
|
|
8058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(fieldContextStore.Provider, { value: initialValue, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(FieldsChildInner, { fieldName }) });
|
|
8059
|
+
};
|
|
8060
|
+
var FieldsChildMemo = (0, import_react50.memo)(FieldsChild);
|
|
8061
|
+
var GlobalSyncButton = () => {
|
|
8062
|
+
const appStore = useAppStoreApi();
|
|
8063
|
+
const selectedItem = useAppStore((s) => s.selectedItem);
|
|
8064
|
+
const isGlobalType = useAppStore(
|
|
8065
|
+
(s) => {
|
|
8066
|
+
var _a;
|
|
8067
|
+
return selectedItem ? ((_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.global) === true : false;
|
|
8068
|
+
}
|
|
8069
|
+
);
|
|
8070
|
+
if (!selectedItem || !isGlobalType) return null;
|
|
8071
|
+
const isUnlinked = selectedItem.synced === false;
|
|
8072
|
+
const onClick = () => __async(null, null, function* () {
|
|
8073
|
+
const { dispatch, state, resolveComponentData: resolveComponentData2 } = appStore.getState();
|
|
8074
|
+
const latestSelector = getSelectorForId(state, selectedItem.props.id);
|
|
8075
|
+
if (!latestSelector) return;
|
|
8076
|
+
const resolved = yield resolveComponentData2(
|
|
8077
|
+
__spreadProps(__spreadValues({}, selectedItem), { synced: isUnlinked ? true : false }),
|
|
8078
|
+
"replace"
|
|
8079
|
+
);
|
|
8080
|
+
dispatch({
|
|
8081
|
+
type: "replace",
|
|
8082
|
+
destinationIndex: latestSelector.index,
|
|
8083
|
+
destinationZone: latestSelector.zone || rootDroppableId,
|
|
8084
|
+
data: resolved.node
|
|
8085
|
+
});
|
|
8086
|
+
});
|
|
8087
|
+
const syncButtonClass = [
|
|
8088
|
+
getClassName22("syncButton"),
|
|
8089
|
+
isUnlinked ? styles_module_default16["EditorFields-syncButton--unlinked"] : null
|
|
8090
|
+
].filter(Boolean).join(" ");
|
|
8091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("button", { type: "button", className: syncButtonClass, onClick, children: [
|
|
8092
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Link, { size: 14 }),
|
|
8093
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { children: isUnlinked ? "Link to shared" : "Linked to shared" })
|
|
8094
|
+
] });
|
|
8095
|
+
};
|
|
8096
|
+
var FieldsInternal = ({ wrapFields = true }) => {
|
|
8097
|
+
const overrides = useAppStore((s) => s.overrides);
|
|
8098
|
+
const componentResolving = useAppStore((s) => {
|
|
8099
|
+
var _a, _b;
|
|
8100
|
+
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;
|
|
8101
|
+
return (loadingCount != null ? loadingCount : 0) > 0;
|
|
8102
|
+
});
|
|
8103
|
+
const itemSelector = useAppStore((0, import_shallow4.useShallow)((s) => s.state.ui.itemSelector));
|
|
8104
|
+
const id = useAppStore((s) => {
|
|
8105
|
+
var _a;
|
|
8106
|
+
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
|
8107
|
+
});
|
|
8108
|
+
const appStore = useAppStoreApi();
|
|
8109
|
+
useRegisterFieldsSlice(appStore, id);
|
|
8110
|
+
const fieldsLoading = useAppStore((s) => s.fields.loading);
|
|
8111
|
+
const fieldNames = useAppStore(
|
|
8112
|
+
(0, import_shallow4.useShallow)((s) => {
|
|
8113
|
+
if (s.fields.id === id) {
|
|
8114
|
+
return Object.keys(s.fields.fields);
|
|
8115
|
+
}
|
|
8116
|
+
return [];
|
|
8117
|
+
})
|
|
8118
|
+
);
|
|
8119
|
+
const isLoading = fieldsLoading || componentResolving;
|
|
8120
|
+
const Wrapper = (0, import_react50.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
|
8121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
8122
|
+
"form",
|
|
8123
|
+
{
|
|
8124
|
+
className: getClassName22({ wrapFields }),
|
|
8125
|
+
onSubmit: (e) => {
|
|
8126
|
+
e.preventDefault();
|
|
8127
|
+
},
|
|
8128
|
+
children: [
|
|
8129
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Wrapper, { isLoading, itemSelector, children: [
|
|
8130
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(GlobalSyncButton, {}),
|
|
8131
|
+
fieldNames.map((fieldName) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(FieldsChildMemo, { fieldName }, fieldName))
|
|
8132
|
+
] }),
|
|
8133
|
+
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 }) }) })
|
|
8134
|
+
]
|
|
8135
|
+
}
|
|
8136
|
+
);
|
|
8137
|
+
};
|
|
8138
|
+
var Fields = (0, import_react50.memo)(FieldsInternal);
|
|
8139
|
+
|
|
8140
|
+
// components/Editor/components/Components/index.tsx
|
|
8141
|
+
init_react_import();
|
|
8142
|
+
init_store();
|
|
8143
|
+
|
|
7907
8144
|
// components/ComponentList/index.tsx
|
|
7908
8145
|
init_react_import();
|
|
7909
8146
|
|
|
7910
8147
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ComponentList/styles.module.css#css-module
|
|
7911
8148
|
init_react_import();
|
|
7912
|
-
var
|
|
8149
|
+
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
8150
|
|
|
7914
8151
|
// components/ComponentList/index.tsx
|
|
7915
8152
|
init_get_class_name_factory();
|
|
7916
|
-
var
|
|
8153
|
+
var import_react75 = require("react");
|
|
7917
8154
|
init_lucide_react();
|
|
7918
8155
|
init_store();
|
|
7919
8156
|
|
|
@@ -7922,31 +8159,31 @@ init_react_import();
|
|
|
7922
8159
|
|
|
7923
8160
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Drawer/styles.module.css#css-module
|
|
7924
8161
|
init_react_import();
|
|
7925
|
-
var
|
|
8162
|
+
var styles_module_default18 = { "Drawer": "_Drawer_146py_1", "Drawer--tile": "_Drawer--tile_146py_8", "Drawer-draggable": "_Drawer-draggable_146py_19", "Drawer-draggableBg": "_Drawer-draggableBg_146py_23", "DrawerItem-draggable": "_DrawerItem-draggable_146py_33", "DrawerItem-icon": "_DrawerItem-icon_146py_50", "DrawerItem--disabled": "_DrawerItem--disabled_146py_56", "DrawerItem": "_DrawerItem_146py_33", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_146py_66", "DrawerItem-name": "_DrawerItem-name_146py_91" };
|
|
7926
8163
|
|
|
7927
8164
|
// components/Drawer/index.tsx
|
|
7928
8165
|
init_get_class_name_factory();
|
|
7929
|
-
var
|
|
8166
|
+
var import_react73 = require("react");
|
|
7930
8167
|
init_generate_id();
|
|
7931
8168
|
|
|
7932
8169
|
// components/DragDropContext/index.tsx
|
|
7933
8170
|
init_react_import();
|
|
7934
|
-
var
|
|
8171
|
+
var import_react71 = require("@dnd-kit/react");
|
|
7935
8172
|
init_store();
|
|
7936
|
-
var
|
|
8173
|
+
var import_react72 = require("react");
|
|
7937
8174
|
var import_dom4 = require("@dnd-kit/dom");
|
|
7938
8175
|
|
|
7939
8176
|
// components/DropZone/index.tsx
|
|
7940
8177
|
init_react_import();
|
|
7941
|
-
var
|
|
8178
|
+
var import_react69 = require("react");
|
|
7942
8179
|
|
|
7943
8180
|
// components/DraggableComponent/index.tsx
|
|
7944
8181
|
init_react_import();
|
|
7945
|
-
var
|
|
8182
|
+
var import_react53 = require("react");
|
|
7946
8183
|
|
|
7947
8184
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/DraggableComponent/styles.module.css#css-module
|
|
7948
8185
|
init_react_import();
|
|
7949
|
-
var
|
|
8186
|
+
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
8187
|
|
|
7951
8188
|
// components/DraggableComponent/index.tsx
|
|
7952
8189
|
init_get_class_name_factory();
|
|
@@ -7977,12 +8214,12 @@ function getDeepScrollPosition(element) {
|
|
|
7977
8214
|
|
|
7978
8215
|
// components/DropZone/context.tsx
|
|
7979
8216
|
init_react_import();
|
|
7980
|
-
var
|
|
8217
|
+
var import_react51 = require("react");
|
|
7981
8218
|
init_store();
|
|
7982
8219
|
var import_zustand5 = require("zustand");
|
|
7983
|
-
var
|
|
7984
|
-
var dropZoneContext = (0,
|
|
7985
|
-
var ZoneStoreContext = (0,
|
|
8220
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
8221
|
+
var dropZoneContext = (0, import_react51.createContext)(null);
|
|
8222
|
+
var ZoneStoreContext = (0, import_react51.createContext)(
|
|
7986
8223
|
(0, import_zustand5.createStore)(() => ({
|
|
7987
8224
|
zoneDepthIndex: {},
|
|
7988
8225
|
nextZoneDepthIndex: {},
|
|
@@ -8003,14 +8240,14 @@ var ZoneStoreProvider = ({
|
|
|
8003
8240
|
children,
|
|
8004
8241
|
store
|
|
8005
8242
|
}) => {
|
|
8006
|
-
return /* @__PURE__ */ (0,
|
|
8243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ZoneStoreContext.Provider, { value: store, children });
|
|
8007
8244
|
};
|
|
8008
8245
|
var DropZoneProvider = ({
|
|
8009
8246
|
children,
|
|
8010
8247
|
value
|
|
8011
8248
|
}) => {
|
|
8012
8249
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
8013
|
-
const registerZone = (0,
|
|
8250
|
+
const registerZone = (0, import_react51.useCallback)(
|
|
8014
8251
|
(zoneCompound) => {
|
|
8015
8252
|
dispatch({
|
|
8016
8253
|
type: "registerZone",
|
|
@@ -8019,28 +8256,28 @@ var DropZoneProvider = ({
|
|
|
8019
8256
|
},
|
|
8020
8257
|
[dispatch]
|
|
8021
8258
|
);
|
|
8022
|
-
const memoValue = (0,
|
|
8259
|
+
const memoValue = (0, import_react51.useMemo)(
|
|
8023
8260
|
() => __spreadValues({
|
|
8024
8261
|
registerZone
|
|
8025
8262
|
}, value),
|
|
8026
8263
|
[value]
|
|
8027
8264
|
);
|
|
8028
|
-
return /* @__PURE__ */ (0,
|
|
8265
|
+
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
8266
|
};
|
|
8030
8267
|
|
|
8031
8268
|
// components/DraggableComponent/index.tsx
|
|
8032
|
-
var
|
|
8269
|
+
var import_shallow5 = require("zustand/react/shallow");
|
|
8033
8270
|
init_get_item();
|
|
8034
8271
|
var import_sortable2 = require("@dnd-kit/react/sortable");
|
|
8035
8272
|
var import_dom3 = require("@dnd-kit/dom");
|
|
8036
8273
|
|
|
8037
8274
|
// lib/dnd/use-on-drag-finished.ts
|
|
8038
8275
|
init_react_import();
|
|
8039
|
-
var
|
|
8276
|
+
var import_react52 = require("react");
|
|
8040
8277
|
init_store();
|
|
8041
8278
|
var useOnDragFinished = (cb, deps = []) => {
|
|
8042
8279
|
const appStore = useAppStoreApi();
|
|
8043
|
-
return (0,
|
|
8280
|
+
return (0, import_react52.useCallback)(() => {
|
|
8044
8281
|
let dispose = () => {
|
|
8045
8282
|
};
|
|
8046
8283
|
const processDragging = (isDragging2) => {
|
|
@@ -8086,8 +8323,8 @@ function assignRefs(refs, node) {
|
|
|
8086
8323
|
}
|
|
8087
8324
|
|
|
8088
8325
|
// components/DraggableComponent/index.tsx
|
|
8089
|
-
var
|
|
8090
|
-
var
|
|
8326
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
8327
|
+
var getClassName23 = get_class_name_factory_default("DraggableComponent", styles_module_default19);
|
|
8091
8328
|
var DEBUG2 = false;
|
|
8092
8329
|
var MEASURE_EVERY_MS = 100;
|
|
8093
8330
|
var space = 8;
|
|
@@ -8098,16 +8335,16 @@ var DefaultActionBar = ({
|
|
|
8098
8335
|
label,
|
|
8099
8336
|
children,
|
|
8100
8337
|
parentAction
|
|
8101
|
-
}) => /* @__PURE__ */ (0,
|
|
8102
|
-
/* @__PURE__ */ (0,
|
|
8338
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(ActionBar, { children: [
|
|
8339
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(ActionBar.Group, { children: [
|
|
8103
8340
|
parentAction,
|
|
8104
|
-
label && /* @__PURE__ */ (0,
|
|
8341
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ActionBar.Label, { label })
|
|
8105
8342
|
] }),
|
|
8106
|
-
/* @__PURE__ */ (0,
|
|
8343
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ActionBar.Group, { children })
|
|
8107
8344
|
] });
|
|
8108
8345
|
var DefaultOverlay = ({
|
|
8109
8346
|
children
|
|
8110
|
-
}) => /* @__PURE__ */ (0,
|
|
8347
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_jsx_runtime59.Fragment, { children });
|
|
8111
8348
|
var DraggableComponent = ({
|
|
8112
8349
|
children,
|
|
8113
8350
|
depth,
|
|
@@ -8140,10 +8377,10 @@ var DraggableComponent = ({
|
|
|
8140
8377
|
return ((_a = s.config.components[componentType]) == null ? void 0 : _a.global) === true;
|
|
8141
8378
|
}
|
|
8142
8379
|
);
|
|
8143
|
-
const lastMeasureRef = (0,
|
|
8144
|
-
const ctx = (0,
|
|
8145
|
-
const [localZones, setLocalZones] = (0,
|
|
8146
|
-
const registerLocalZone = (0,
|
|
8380
|
+
const lastMeasureRef = (0, import_react53.useRef)(0);
|
|
8381
|
+
const ctx = (0, import_react53.useContext)(dropZoneContext);
|
|
8382
|
+
const [localZones, setLocalZones] = (0, import_react53.useState)({});
|
|
8383
|
+
const registerLocalZone = (0, import_react53.useCallback)(
|
|
8147
8384
|
(zoneCompound2, active) => {
|
|
8148
8385
|
var _a;
|
|
8149
8386
|
(_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
|
|
@@ -8153,7 +8390,7 @@ var DraggableComponent = ({
|
|
|
8153
8390
|
},
|
|
8154
8391
|
[setLocalZones]
|
|
8155
8392
|
);
|
|
8156
|
-
const unregisterLocalZone = (0,
|
|
8393
|
+
const unregisterLocalZone = (0, import_react53.useCallback)(
|
|
8157
8394
|
(zoneCompound2) => {
|
|
8158
8395
|
var _a;
|
|
8159
8396
|
(_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
|
|
@@ -8166,23 +8403,23 @@ var DraggableComponent = ({
|
|
|
8166
8403
|
[setLocalZones]
|
|
8167
8404
|
);
|
|
8168
8405
|
const containsActiveZone = Object.values(localZones).filter(Boolean).length > 0;
|
|
8169
|
-
const path = useAppStore((0,
|
|
8406
|
+
const path = useAppStore((0, import_shallow5.useShallow)((s) => {
|
|
8170
8407
|
var _a;
|
|
8171
8408
|
return (_a = s.state.indexes.nodes[id]) == null ? void 0 : _a.path;
|
|
8172
8409
|
}));
|
|
8173
8410
|
const permissions = useAppStore(
|
|
8174
|
-
(0,
|
|
8411
|
+
(0, import_shallow5.useShallow)((s) => {
|
|
8175
8412
|
const item = getItem({ index, zone: zoneCompound }, s.state);
|
|
8176
8413
|
return s.permissions.getPermissions({ item });
|
|
8177
8414
|
})
|
|
8178
8415
|
);
|
|
8179
|
-
const zoneStore = (0,
|
|
8180
|
-
const [dragAxis, setDragAxis] = (0,
|
|
8181
|
-
const dynamicCollisionDetector = (0,
|
|
8416
|
+
const zoneStore = (0, import_react53.useContext)(ZoneStoreContext);
|
|
8417
|
+
const [dragAxis, setDragAxis] = (0, import_react53.useState)(userDragAxis || autoDragAxis);
|
|
8418
|
+
const dynamicCollisionDetector = (0, import_react53.useMemo)(
|
|
8182
8419
|
() => createDynamicCollisionDetector(dragAxis),
|
|
8183
8420
|
[dragAxis]
|
|
8184
8421
|
);
|
|
8185
|
-
const sortablePlugins = (0,
|
|
8422
|
+
const sortablePlugins = (0, import_react53.useMemo)(
|
|
8186
8423
|
() => (defaults) => [
|
|
8187
8424
|
...defaults,
|
|
8188
8425
|
import_dom3.Feedback.configure({ feedback: "clone" })
|
|
@@ -8216,7 +8453,7 @@ var DraggableComponent = ({
|
|
|
8216
8453
|
easing: "cubic-bezier(0.2, 0, 0, 1)"
|
|
8217
8454
|
}
|
|
8218
8455
|
});
|
|
8219
|
-
(0,
|
|
8456
|
+
(0, import_react53.useEffect)(() => {
|
|
8220
8457
|
const isEnabled = zoneStore.getState().enabledIndex[zoneCompound];
|
|
8221
8458
|
sortable.droppable.disabled = !isEnabled;
|
|
8222
8459
|
sortable.draggable.disabled = !permissions.drag;
|
|
@@ -8233,9 +8470,9 @@ var DraggableComponent = ({
|
|
|
8233
8470
|
}
|
|
8234
8471
|
return cleanup;
|
|
8235
8472
|
}, [permissions.drag, zoneCompound]);
|
|
8236
|
-
const [, setRerender] = (0,
|
|
8237
|
-
const ref = (0,
|
|
8238
|
-
const refSetter = (0,
|
|
8473
|
+
const [, setRerender] = (0, import_react53.useState)(0);
|
|
8474
|
+
const ref = (0, import_react53.useRef)(null);
|
|
8475
|
+
const refSetter = (0, import_react53.useCallback)(
|
|
8239
8476
|
(el) => {
|
|
8240
8477
|
sortableRef(el);
|
|
8241
8478
|
if (ref.current !== el) {
|
|
@@ -8248,14 +8485,14 @@ var DraggableComponent = ({
|
|
|
8248
8485
|
},
|
|
8249
8486
|
[itemRef, sortableRef]
|
|
8250
8487
|
);
|
|
8251
|
-
const [portalEl, setPortalEl] = (0,
|
|
8252
|
-
(0,
|
|
8488
|
+
const [portalEl, setPortalEl] = (0, import_react53.useState)();
|
|
8489
|
+
(0, import_react53.useEffect)(() => {
|
|
8253
8490
|
var _a, _b, _c;
|
|
8254
8491
|
setPortalEl(
|
|
8255
8492
|
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
8493
|
);
|
|
8257
8494
|
}, [iframe.enabled]);
|
|
8258
|
-
const getStyle = (0,
|
|
8495
|
+
const getStyle = (0, import_react53.useCallback)(() => {
|
|
8259
8496
|
var _a, _b;
|
|
8260
8497
|
if (!ref.current) return;
|
|
8261
8498
|
const el = ref.current;
|
|
@@ -8287,23 +8524,23 @@ var DraggableComponent = ({
|
|
|
8287
8524
|
};
|
|
8288
8525
|
return style2;
|
|
8289
8526
|
}, [iframe.enabled]);
|
|
8290
|
-
const [style, setStyle] = (0,
|
|
8291
|
-
const lastRectRef = (0,
|
|
8292
|
-
const syncRafRef = (0,
|
|
8293
|
-
const sync = (0,
|
|
8527
|
+
const [style, setStyle] = (0, import_react53.useState)();
|
|
8528
|
+
const lastRectRef = (0, import_react53.useRef)(null);
|
|
8529
|
+
const syncRafRef = (0, import_react53.useRef)(null);
|
|
8530
|
+
const sync = (0, import_react53.useCallback)(() => {
|
|
8294
8531
|
setStyle(getStyle());
|
|
8295
8532
|
if (itemRef) {
|
|
8296
8533
|
assignRefs([itemRef], ref.current);
|
|
8297
8534
|
}
|
|
8298
8535
|
}, [getStyle, itemRef]);
|
|
8299
|
-
const scheduleSync = (0,
|
|
8536
|
+
const scheduleSync = (0, import_react53.useCallback)(() => {
|
|
8300
8537
|
if (syncRafRef.current != null) return;
|
|
8301
8538
|
syncRafRef.current = requestAnimationFrame(() => {
|
|
8302
8539
|
syncRafRef.current = null;
|
|
8303
8540
|
sync();
|
|
8304
8541
|
});
|
|
8305
8542
|
}, [sync]);
|
|
8306
|
-
(0,
|
|
8543
|
+
(0, import_react53.useEffect)(() => {
|
|
8307
8544
|
return () => {
|
|
8308
8545
|
if (syncRafRef.current != null) {
|
|
8309
8546
|
cancelAnimationFrame(syncRafRef.current);
|
|
@@ -8311,7 +8548,7 @@ var DraggableComponent = ({
|
|
|
8311
8548
|
}
|
|
8312
8549
|
};
|
|
8313
8550
|
}, []);
|
|
8314
|
-
(0,
|
|
8551
|
+
(0, import_react53.useEffect)(() => {
|
|
8315
8552
|
if (ref.current) {
|
|
8316
8553
|
const observer = new ResizeObserver(() => {
|
|
8317
8554
|
scheduleSync();
|
|
@@ -8324,37 +8561,37 @@ var DraggableComponent = ({
|
|
|
8324
8561
|
}, [scheduleSync, itemRef]);
|
|
8325
8562
|
const registerNode = useAppStore((s) => s.nodes.registerNode);
|
|
8326
8563
|
const unregisterNode = useAppStore((s) => s.nodes.unregisterNode);
|
|
8327
|
-
const hideOverlay = (0,
|
|
8564
|
+
const hideOverlay = (0, import_react53.useCallback)(() => {
|
|
8328
8565
|
setIsVisible(false);
|
|
8329
8566
|
}, []);
|
|
8330
|
-
const showOverlay = (0,
|
|
8567
|
+
const showOverlay = (0, import_react53.useCallback)(() => {
|
|
8331
8568
|
setIsVisible(true);
|
|
8332
8569
|
}, []);
|
|
8333
|
-
const nodeHandleRef = (0,
|
|
8570
|
+
const nodeHandleRef = (0, import_react53.useRef)({
|
|
8334
8571
|
sync: () => null,
|
|
8335
8572
|
hideOverlay: () => null,
|
|
8336
8573
|
showOverlay: () => null
|
|
8337
8574
|
});
|
|
8338
|
-
(0,
|
|
8575
|
+
(0, import_react53.useLayoutEffect)(() => {
|
|
8339
8576
|
nodeHandleRef.current.sync = sync;
|
|
8340
8577
|
nodeHandleRef.current.hideOverlay = hideOverlay;
|
|
8341
8578
|
nodeHandleRef.current.showOverlay = showOverlay;
|
|
8342
8579
|
}, [hideOverlay, showOverlay, sync]);
|
|
8343
|
-
(0,
|
|
8580
|
+
(0, import_react53.useEffect)(() => {
|
|
8344
8581
|
registerNode(id, nodeHandleRef.current);
|
|
8345
8582
|
return () => {
|
|
8346
8583
|
unregisterNode(id);
|
|
8347
8584
|
};
|
|
8348
8585
|
}, [id, registerNode, unregisterNode]);
|
|
8349
|
-
const CustomActionBar = (0,
|
|
8586
|
+
const CustomActionBar = (0, import_react53.useMemo)(
|
|
8350
8587
|
() => overrides.actionBar || DefaultActionBar,
|
|
8351
8588
|
[overrides.actionBar]
|
|
8352
8589
|
);
|
|
8353
|
-
const CustomOverlay = (0,
|
|
8590
|
+
const CustomOverlay = (0, import_react53.useMemo)(
|
|
8354
8591
|
() => overrides.componentOverlay || DefaultOverlay,
|
|
8355
8592
|
[overrides.componentOverlay]
|
|
8356
8593
|
);
|
|
8357
|
-
const onClick = (0,
|
|
8594
|
+
const onClick = (0, import_react53.useCallback)(
|
|
8358
8595
|
(e) => {
|
|
8359
8596
|
const userIsDragging = !!zoneStore.getState().draggedItem;
|
|
8360
8597
|
if (userIsDragging) {
|
|
@@ -8383,7 +8620,7 @@ var DraggableComponent = ({
|
|
|
8383
8620
|
[index, zoneCompound, id, isSelected, fullScreenCanvas]
|
|
8384
8621
|
);
|
|
8385
8622
|
const appStore = useAppStoreApi();
|
|
8386
|
-
const onSelectParent = (0,
|
|
8623
|
+
const onSelectParent = (0, import_react53.useCallback)(() => {
|
|
8387
8624
|
const { nodes, zones } = appStore.getState().state.indexes;
|
|
8388
8625
|
const node = nodes[id];
|
|
8389
8626
|
const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node == null ? void 0 : node.parentId] : null;
|
|
@@ -8404,26 +8641,26 @@ var DraggableComponent = ({
|
|
|
8404
8641
|
}
|
|
8405
8642
|
});
|
|
8406
8643
|
}, [ctx, path]);
|
|
8407
|
-
const onDuplicate = (0,
|
|
8644
|
+
const onDuplicate = (0, import_react53.useCallback)(() => {
|
|
8408
8645
|
dispatch({
|
|
8409
8646
|
type: "duplicate",
|
|
8410
8647
|
sourceIndex: index,
|
|
8411
8648
|
sourceZone: zoneCompound
|
|
8412
8649
|
});
|
|
8413
8650
|
}, [index, zoneCompound]);
|
|
8414
|
-
const onDelete = (0,
|
|
8651
|
+
const onDelete = (0, import_react53.useCallback)(() => {
|
|
8415
8652
|
dispatch({
|
|
8416
8653
|
type: "remove",
|
|
8417
8654
|
index,
|
|
8418
8655
|
zone: zoneCompound
|
|
8419
8656
|
});
|
|
8420
8657
|
}, [index, zoneCompound]);
|
|
8421
|
-
const [hover, setHover] = (0,
|
|
8658
|
+
const [hover, setHover] = (0, import_react53.useState)(false);
|
|
8422
8659
|
const indicativeHover = useContextStore(
|
|
8423
8660
|
ZoneStoreContext,
|
|
8424
8661
|
(s) => s.hoveringComponent === id
|
|
8425
8662
|
);
|
|
8426
|
-
(0,
|
|
8663
|
+
(0, import_react53.useEffect)(() => {
|
|
8427
8664
|
if (!ref.current) {
|
|
8428
8665
|
return;
|
|
8429
8666
|
}
|
|
@@ -8468,10 +8705,10 @@ var DraggableComponent = ({
|
|
|
8468
8705
|
thisIsDragging,
|
|
8469
8706
|
inDroppableZone
|
|
8470
8707
|
]);
|
|
8471
|
-
const [isVisible, setIsVisible] = (0,
|
|
8472
|
-
const [dragFinished, setDragFinished] = (0,
|
|
8473
|
-
const [_, startTransition] = (0,
|
|
8474
|
-
(0,
|
|
8708
|
+
const [isVisible, setIsVisible] = (0, import_react53.useState)(false);
|
|
8709
|
+
const [dragFinished, setDragFinished] = (0, import_react53.useState)(true);
|
|
8710
|
+
const [_, startTransition] = (0, import_react53.useTransition)();
|
|
8711
|
+
(0, import_react53.useEffect)(() => {
|
|
8475
8712
|
startTransition(() => {
|
|
8476
8713
|
if (hover || indicativeHover || isSelected) {
|
|
8477
8714
|
scheduleSync();
|
|
@@ -8482,7 +8719,7 @@ var DraggableComponent = ({
|
|
|
8482
8719
|
}
|
|
8483
8720
|
});
|
|
8484
8721
|
}, [hover, indicativeHover, isSelected, iframe]);
|
|
8485
|
-
const [thisWasDragging, setThisWasDragging] = (0,
|
|
8722
|
+
const [thisWasDragging, setThisWasDragging] = (0, import_react53.useState)(false);
|
|
8486
8723
|
const onDragFinished = useOnDragFinished((finished) => {
|
|
8487
8724
|
if (finished) {
|
|
8488
8725
|
startTransition(() => {
|
|
@@ -8493,15 +8730,15 @@ var DraggableComponent = ({
|
|
|
8493
8730
|
setDragFinished(false);
|
|
8494
8731
|
}
|
|
8495
8732
|
});
|
|
8496
|
-
(0,
|
|
8733
|
+
(0, import_react53.useEffect)(() => {
|
|
8497
8734
|
if (thisIsDragging) {
|
|
8498
8735
|
setThisWasDragging(true);
|
|
8499
8736
|
}
|
|
8500
8737
|
}, [thisIsDragging]);
|
|
8501
|
-
(0,
|
|
8738
|
+
(0, import_react53.useEffect)(() => {
|
|
8502
8739
|
if (thisWasDragging) return onDragFinished();
|
|
8503
8740
|
}, [thisWasDragging, onDragFinished]);
|
|
8504
|
-
(0,
|
|
8741
|
+
(0, import_react53.useEffect)(() => {
|
|
8505
8742
|
if (!dragFinished || !(isSelected || thisIsDragging)) return;
|
|
8506
8743
|
const el = ref.current;
|
|
8507
8744
|
if (!el) return;
|
|
@@ -8538,7 +8775,7 @@ var DraggableComponent = ({
|
|
|
8538
8775
|
cancelAnimationFrame(frame);
|
|
8539
8776
|
};
|
|
8540
8777
|
}, [dragFinished, isSelected, thisIsDragging, scheduleSync]);
|
|
8541
|
-
const syncActionsPosition = (0,
|
|
8778
|
+
const syncActionsPosition = (0, import_react53.useCallback)(
|
|
8542
8779
|
(el) => {
|
|
8543
8780
|
if (el) {
|
|
8544
8781
|
const view = el.ownerDocument.defaultView;
|
|
@@ -8563,7 +8800,7 @@ var DraggableComponent = ({
|
|
|
8563
8800
|
},
|
|
8564
8801
|
[zoom]
|
|
8565
8802
|
);
|
|
8566
|
-
(0,
|
|
8803
|
+
(0, import_react53.useEffect)(() => {
|
|
8567
8804
|
if (userDragAxis) {
|
|
8568
8805
|
setDragAxis(userDragAxis);
|
|
8569
8806
|
return;
|
|
@@ -8577,11 +8814,11 @@ var DraggableComponent = ({
|
|
|
8577
8814
|
}
|
|
8578
8815
|
setDragAxis(autoDragAxis);
|
|
8579
8816
|
}, [ref, userDragAxis, autoDragAxis]);
|
|
8580
|
-
const parentAction = (0,
|
|
8581
|
-
() => (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ (0,
|
|
8817
|
+
const parentAction = (0, import_react53.useMemo)(
|
|
8818
|
+
() => (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
8819
|
[ctx == null ? void 0 : ctx.areaId]
|
|
8583
8820
|
);
|
|
8584
|
-
const nextContextValue = (0,
|
|
8821
|
+
const nextContextValue = (0, import_react53.useMemo)(
|
|
8585
8822
|
() => __spreadProps(__spreadValues({}, ctx), {
|
|
8586
8823
|
areaId: id,
|
|
8587
8824
|
zoneCompound,
|
|
@@ -8607,12 +8844,12 @@ var DraggableComponent = ({
|
|
|
8607
8844
|
}
|
|
8608
8845
|
);
|
|
8609
8846
|
const hasNormalActions = permissions.duplicate || permissions.delete;
|
|
8610
|
-
return /* @__PURE__ */ (0,
|
|
8847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(DropZoneProvider, { value: nextContextValue, children: [
|
|
8611
8848
|
dragFinished && isVisible && (0, import_react_dom2.createPortal)(
|
|
8612
|
-
/* @__PURE__ */ (0,
|
|
8849
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
8613
8850
|
"div",
|
|
8614
8851
|
{
|
|
8615
|
-
className:
|
|
8852
|
+
className: getClassName23({
|
|
8616
8853
|
isSelected,
|
|
8617
8854
|
isDragging: thisIsDragging,
|
|
8618
8855
|
hover: hover || indicativeHover,
|
|
@@ -8622,18 +8859,18 @@ var DraggableComponent = ({
|
|
|
8622
8859
|
"data-editor-overlay": true,
|
|
8623
8860
|
children: [
|
|
8624
8861
|
debug,
|
|
8625
|
-
isLoading && /* @__PURE__ */ (0,
|
|
8626
|
-
/* @__PURE__ */ (0,
|
|
8862
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: getClassName23("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Loader, {}) }),
|
|
8863
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8627
8864
|
"div",
|
|
8628
8865
|
{
|
|
8629
|
-
className:
|
|
8866
|
+
className: getClassName23("actionsOverlay"),
|
|
8630
8867
|
style: {
|
|
8631
8868
|
top: actionsOverlayTop / zoom
|
|
8632
8869
|
},
|
|
8633
|
-
children: /* @__PURE__ */ (0,
|
|
8870
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8634
8871
|
"div",
|
|
8635
8872
|
{
|
|
8636
|
-
className:
|
|
8873
|
+
className: getClassName23("actions"),
|
|
8637
8874
|
style: {
|
|
8638
8875
|
transform: `scale(${1 / zoom}`,
|
|
8639
8876
|
top: actionsTop / zoom,
|
|
@@ -8642,14 +8879,14 @@ var DraggableComponent = ({
|
|
|
8642
8879
|
paddingRight: actionsSide
|
|
8643
8880
|
},
|
|
8644
8881
|
ref: syncActionsPosition,
|
|
8645
|
-
children: /* @__PURE__ */ (0,
|
|
8882
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
8646
8883
|
CustomActionBar,
|
|
8647
8884
|
{
|
|
8648
8885
|
parentAction,
|
|
8649
8886
|
label: DEBUG2 ? id : label,
|
|
8650
8887
|
children: [
|
|
8651
|
-
richText && /* @__PURE__ */ (0,
|
|
8652
|
-
/* @__PURE__ */ (0,
|
|
8888
|
+
richText && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
8889
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8653
8890
|
LoadedRichTextMenu,
|
|
8654
8891
|
{
|
|
8655
8892
|
editor: richText.editor,
|
|
@@ -8658,10 +8895,10 @@ var DraggableComponent = ({
|
|
|
8658
8895
|
readOnly: false
|
|
8659
8896
|
}
|
|
8660
8897
|
),
|
|
8661
|
-
hasNormalActions && /* @__PURE__ */ (0,
|
|
8898
|
+
hasNormalActions && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ActionBar.Separator, {})
|
|
8662
8899
|
] }),
|
|
8663
|
-
permissions.duplicate && /* @__PURE__ */ (0,
|
|
8664
|
-
permissions.delete && /* @__PURE__ */ (0,
|
|
8900
|
+
permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Copy, { size: 16 }) }),
|
|
8901
|
+
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
8902
|
]
|
|
8666
8903
|
}
|
|
8667
8904
|
)
|
|
@@ -8669,14 +8906,14 @@ var DraggableComponent = ({
|
|
|
8669
8906
|
)
|
|
8670
8907
|
}
|
|
8671
8908
|
),
|
|
8672
|
-
/* @__PURE__ */ (0,
|
|
8909
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: getClassName23("overlayWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
8673
8910
|
CustomOverlay,
|
|
8674
8911
|
{
|
|
8675
8912
|
componentId: id,
|
|
8676
8913
|
componentType,
|
|
8677
8914
|
hover,
|
|
8678
8915
|
isSelected,
|
|
8679
|
-
children: /* @__PURE__ */ (0,
|
|
8916
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: getClassName23("overlay") })
|
|
8680
8917
|
}
|
|
8681
8918
|
) })
|
|
8682
8919
|
]
|
|
@@ -8695,16 +8932,16 @@ init_lib();
|
|
|
8695
8932
|
|
|
8696
8933
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/DropZone/styles.module.css#css-module
|
|
8697
8934
|
init_react_import();
|
|
8698
|
-
var
|
|
8935
|
+
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
8936
|
|
|
8700
8937
|
// components/DropZone/index.tsx
|
|
8701
8938
|
init_store();
|
|
8702
|
-
var
|
|
8939
|
+
var import_react70 = require("@dnd-kit/react");
|
|
8703
8940
|
var import_collision2 = require("@dnd-kit/collision");
|
|
8704
8941
|
|
|
8705
8942
|
// components/DropZone/lib/use-min-empty-height.ts
|
|
8706
8943
|
init_react_import();
|
|
8707
|
-
var
|
|
8944
|
+
var import_react54 = require("react");
|
|
8708
8945
|
init_store();
|
|
8709
8946
|
var getNumItems = (appStore, zoneCompound) => appStore.getState().state.indexes.zones[zoneCompound].contentIds.length;
|
|
8710
8947
|
var useMinEmptyHeight = ({
|
|
@@ -8713,8 +8950,8 @@ var useMinEmptyHeight = ({
|
|
|
8713
8950
|
ref
|
|
8714
8951
|
}) => {
|
|
8715
8952
|
const appStore = useAppStoreApi();
|
|
8716
|
-
const [prevHeight, setPrevHeight] = (0,
|
|
8717
|
-
const [isAnimating, setIsAnimating] = (0,
|
|
8953
|
+
const [prevHeight, setPrevHeight] = (0, import_react54.useState)(0);
|
|
8954
|
+
const [isAnimating, setIsAnimating] = (0, import_react54.useState)(false);
|
|
8718
8955
|
const { draggedItem, isZone } = useContextStore(ZoneStoreContext, (s) => {
|
|
8719
8956
|
var _a, _b;
|
|
8720
8957
|
return {
|
|
@@ -8722,7 +8959,7 @@ var useMinEmptyHeight = ({
|
|
|
8722
8959
|
isZone: ((_b = s.draggedItem) == null ? void 0 : _b.data.zone) === zoneCompound
|
|
8723
8960
|
};
|
|
8724
8961
|
});
|
|
8725
|
-
const numItems = (0,
|
|
8962
|
+
const numItems = (0, import_react54.useRef)(0);
|
|
8726
8963
|
const onDragFinished = useOnDragFinished(
|
|
8727
8964
|
(finished) => {
|
|
8728
8965
|
if (finished) {
|
|
@@ -8752,7 +8989,7 @@ var useMinEmptyHeight = ({
|
|
|
8752
8989
|
},
|
|
8753
8990
|
[appStore, prevHeight, zoneCompound]
|
|
8754
8991
|
);
|
|
8755
|
-
(0,
|
|
8992
|
+
(0, import_react54.useEffect)(() => {
|
|
8756
8993
|
if (draggedItem && ref.current) {
|
|
8757
8994
|
if (isZone) {
|
|
8758
8995
|
const rect = ref.current.getBoundingClientRect();
|
|
@@ -8769,15 +9006,15 @@ var useMinEmptyHeight = ({
|
|
|
8769
9006
|
|
|
8770
9007
|
// components/DropZone/lib/use-content-with-preview.ts
|
|
8771
9008
|
init_react_import();
|
|
8772
|
-
var
|
|
9009
|
+
var import_react57 = require("react");
|
|
8773
9010
|
|
|
8774
9011
|
// lib/dnd/use-rendered-callback.ts
|
|
8775
9012
|
init_react_import();
|
|
8776
|
-
var
|
|
8777
|
-
var
|
|
9013
|
+
var import_react55 = require("@dnd-kit/react");
|
|
9014
|
+
var import_react56 = require("react");
|
|
8778
9015
|
function useRenderedCallback(callback, deps) {
|
|
8779
|
-
const manager = (0,
|
|
8780
|
-
return (0,
|
|
9016
|
+
const manager = (0, import_react55.useDragDropManager)();
|
|
9017
|
+
return (0, import_react56.useCallback)(
|
|
8781
9018
|
(...args) => __async(null, null, function* () {
|
|
8782
9019
|
yield manager == null ? void 0 : manager.renderer.rendering;
|
|
8783
9020
|
return callback(...args);
|
|
@@ -8790,14 +9027,14 @@ function useRenderedCallback(callback, deps) {
|
|
|
8790
9027
|
init_insert();
|
|
8791
9028
|
init_store();
|
|
8792
9029
|
var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
8793
|
-
const zoneStore = (0,
|
|
9030
|
+
const zoneStore = (0, import_react57.useContext)(ZoneStoreContext);
|
|
8794
9031
|
const preview = useContextStore(
|
|
8795
9032
|
ZoneStoreContext,
|
|
8796
9033
|
(s) => s.previewIndex[zoneCompound]
|
|
8797
9034
|
);
|
|
8798
9035
|
const isDragging = useAppStore((s) => s.state.ui.isDragging);
|
|
8799
|
-
const [contentIdsWithPreview, setContentIdsWithPreview] = (0,
|
|
8800
|
-
const [localPreview, setLocalPreview] = (0,
|
|
9036
|
+
const [contentIdsWithPreview, setContentIdsWithPreview] = (0, import_react57.useState)(contentIds);
|
|
9037
|
+
const [localPreview, setLocalPreview] = (0, import_react57.useState)(
|
|
8801
9038
|
preview
|
|
8802
9039
|
);
|
|
8803
9040
|
const updateContent = useRenderedCallback(
|
|
@@ -8832,7 +9069,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
|
8832
9069
|
},
|
|
8833
9070
|
[]
|
|
8834
9071
|
);
|
|
8835
|
-
(0,
|
|
9072
|
+
(0, import_react57.useEffect)(() => {
|
|
8836
9073
|
var _a;
|
|
8837
9074
|
const s = zoneStore.getState();
|
|
8838
9075
|
const draggedItemId = (_a = s.draggedItem) == null ? void 0 : _a.id;
|
|
@@ -8850,17 +9087,17 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
|
8850
9087
|
|
|
8851
9088
|
// components/DropZone/lib/use-drag-axis.ts
|
|
8852
9089
|
init_react_import();
|
|
8853
|
-
var
|
|
9090
|
+
var import_react58 = require("react");
|
|
8854
9091
|
init_store();
|
|
8855
9092
|
var GRID_DRAG_AXIS = "dynamic";
|
|
8856
9093
|
var FLEX_ROW_DRAG_AXIS = "x";
|
|
8857
9094
|
var DEFAULT_DRAG_AXIS = "y";
|
|
8858
9095
|
var useDragAxis = (ref, collisionAxis) => {
|
|
8859
9096
|
const status = useAppStore((s) => s.status);
|
|
8860
|
-
const [dragAxis, setDragAxis] = (0,
|
|
9097
|
+
const [dragAxis, setDragAxis] = (0, import_react58.useState)(
|
|
8861
9098
|
collisionAxis || DEFAULT_DRAG_AXIS
|
|
8862
9099
|
);
|
|
8863
|
-
const calculateDragAxis = (0,
|
|
9100
|
+
const calculateDragAxis = (0, import_react58.useCallback)(() => {
|
|
8864
9101
|
if (ref.current) {
|
|
8865
9102
|
const computedStyle = window.getComputedStyle(ref.current);
|
|
8866
9103
|
if (computedStyle.display === "grid") {
|
|
@@ -8872,7 +9109,7 @@ var useDragAxis = (ref, collisionAxis) => {
|
|
|
8872
9109
|
}
|
|
8873
9110
|
}
|
|
8874
9111
|
}, [ref.current]);
|
|
8875
|
-
(0,
|
|
9112
|
+
(0, import_react58.useEffect)(() => {
|
|
8876
9113
|
const onViewportChange = () => {
|
|
8877
9114
|
calculateDragAxis();
|
|
8878
9115
|
};
|
|
@@ -8881,12 +9118,12 @@ var useDragAxis = (ref, collisionAxis) => {
|
|
|
8881
9118
|
window.removeEventListener("viewportchange", onViewportChange);
|
|
8882
9119
|
};
|
|
8883
9120
|
}, []);
|
|
8884
|
-
(0,
|
|
9121
|
+
(0, import_react58.useEffect)(calculateDragAxis, [status, collisionAxis]);
|
|
8885
9122
|
return [dragAxis, calculateDragAxis];
|
|
8886
9123
|
};
|
|
8887
9124
|
|
|
8888
9125
|
// components/DropZone/index.tsx
|
|
8889
|
-
var
|
|
9126
|
+
var import_shallow7 = require("zustand/react/shallow");
|
|
8890
9127
|
|
|
8891
9128
|
// components/Render/index.tsx
|
|
8892
9129
|
init_react_import();
|
|
@@ -8897,7 +9134,7 @@ init_react_import();
|
|
|
8897
9134
|
|
|
8898
9135
|
// lib/field-transforms/use-field-transforms.tsx
|
|
8899
9136
|
init_react_import();
|
|
8900
|
-
var
|
|
9137
|
+
var import_react59 = require("react");
|
|
8901
9138
|
init_map_fields();
|
|
8902
9139
|
|
|
8903
9140
|
// lib/field-transforms/build-mappers.ts
|
|
@@ -8926,14 +9163,14 @@ function buildMappers(transforms, readOnly, forceReadOnly) {
|
|
|
8926
9163
|
|
|
8927
9164
|
// lib/field-transforms/use-field-transforms.tsx
|
|
8928
9165
|
function useFieldTransforms(config, item, transforms, readOnly, forceReadOnly) {
|
|
8929
|
-
const mappers = (0,
|
|
9166
|
+
const mappers = (0, import_react59.useMemo)(
|
|
8930
9167
|
() => buildMappers(transforms, readOnly, forceReadOnly),
|
|
8931
9168
|
[transforms, readOnly, forceReadOnly]
|
|
8932
9169
|
);
|
|
8933
|
-
const transformedProps = (0,
|
|
9170
|
+
const transformedProps = (0, import_react59.useMemo)(() => {
|
|
8934
9171
|
return mapFields(item, mappers, config).props;
|
|
8935
9172
|
}, [config, item, mappers]);
|
|
8936
|
-
const mergedProps = (0,
|
|
9173
|
+
const mergedProps = (0, import_react59.useMemo)(
|
|
8937
9174
|
() => __spreadValues(__spreadValues({}, item.props), transformedProps),
|
|
8938
9175
|
[item.props, transformedProps]
|
|
8939
9176
|
);
|
|
@@ -8968,29 +9205,29 @@ function useSlots(config, item, renderSlotEdit, renderSlotRender = renderSlotEdi
|
|
|
8968
9205
|
}
|
|
8969
9206
|
|
|
8970
9207
|
// components/Render/index.tsx
|
|
8971
|
-
var
|
|
9208
|
+
var import_react63 = __toESM(require("react"));
|
|
8972
9209
|
|
|
8973
9210
|
// components/SlotRender/index.tsx
|
|
8974
9211
|
init_react_import();
|
|
8975
|
-
var
|
|
9212
|
+
var import_shallow6 = require("zustand/react/shallow");
|
|
8976
9213
|
init_store();
|
|
8977
9214
|
|
|
8978
9215
|
// components/SlotRender/server.tsx
|
|
8979
9216
|
init_react_import();
|
|
8980
|
-
var
|
|
9217
|
+
var import_react62 = require("react");
|
|
8981
9218
|
|
|
8982
9219
|
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
8983
9220
|
init_react_import();
|
|
8984
|
-
var
|
|
9221
|
+
var import_react61 = require("react");
|
|
8985
9222
|
|
|
8986
9223
|
// components/RichTextEditor/components/RenderFallback.tsx
|
|
8987
9224
|
init_react_import();
|
|
8988
9225
|
init_get_class_name_factory();
|
|
8989
9226
|
init_styles_module6();
|
|
8990
|
-
var
|
|
8991
|
-
var
|
|
9227
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
9228
|
+
var getClassName24 = get_class_name_factory_default("RichTextEditor", styles_module_default14);
|
|
8992
9229
|
function RichTextRenderFallback({ content }) {
|
|
8993
|
-
return /* @__PURE__ */ (0,
|
|
9230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: getClassName24(), children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
8994
9231
|
"div",
|
|
8995
9232
|
{
|
|
8996
9233
|
className: "rich-text",
|
|
@@ -9021,7 +9258,7 @@ var mapDeep = (source, path, render) => {
|
|
|
9021
9258
|
};
|
|
9022
9259
|
|
|
9023
9260
|
// components/RichTextEditor/lib/use-richtext-props.tsx
|
|
9024
|
-
var
|
|
9261
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
9025
9262
|
function useRichtextProps(fields, props) {
|
|
9026
9263
|
const findAllRichtextKeys = (fields2, path = []) => {
|
|
9027
9264
|
if (!fields2) return [];
|
|
@@ -9043,21 +9280,21 @@ function useRichtextProps(fields, props) {
|
|
|
9043
9280
|
}
|
|
9044
9281
|
return result;
|
|
9045
9282
|
};
|
|
9046
|
-
const richtextKeys = (0,
|
|
9047
|
-
const richtextProps = (0,
|
|
9283
|
+
const richtextKeys = (0, import_react61.useMemo)(() => findAllRichtextKeys(fields), [fields]);
|
|
9284
|
+
const richtextProps = (0, import_react61.useMemo)(() => {
|
|
9048
9285
|
if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
|
|
9049
|
-
const RichTextRender3 = (0,
|
|
9286
|
+
const RichTextRender3 = (0, import_react61.lazy)(
|
|
9050
9287
|
() => Promise.resolve().then(() => (init_Render(), Render_exports)).then((m) => ({
|
|
9051
9288
|
default: m.RichTextRender
|
|
9052
9289
|
}))
|
|
9053
9290
|
);
|
|
9054
9291
|
let result = __spreadValues({}, props);
|
|
9055
9292
|
for (const { path, field } of richtextKeys) {
|
|
9056
|
-
result = mapDeep(result, path, (content) => /* @__PURE__ */ (0,
|
|
9057
|
-
|
|
9293
|
+
result = mapDeep(result, path, (content) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
9294
|
+
import_react61.Suspense,
|
|
9058
9295
|
{
|
|
9059
|
-
fallback: /* @__PURE__ */ (0,
|
|
9060
|
-
children: /* @__PURE__ */ (0,
|
|
9296
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(RichTextRenderFallback, { content }),
|
|
9297
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(RichTextRender3, { content, field })
|
|
9061
9298
|
},
|
|
9062
9299
|
generateId()
|
|
9063
9300
|
));
|
|
@@ -9068,17 +9305,17 @@ function useRichtextProps(fields, props) {
|
|
|
9068
9305
|
}
|
|
9069
9306
|
|
|
9070
9307
|
// components/SlotRender/server.tsx
|
|
9071
|
-
var
|
|
9072
|
-
var SlotRenderPure = (props) => /* @__PURE__ */ (0,
|
|
9308
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
9309
|
+
var SlotRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(SlotRender, __spreadValues({}, props));
|
|
9073
9310
|
var Item3 = ({
|
|
9074
9311
|
config,
|
|
9075
9312
|
item,
|
|
9076
9313
|
metadata
|
|
9077
9314
|
}) => {
|
|
9078
9315
|
const Component2 = config.components[item.type];
|
|
9079
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0,
|
|
9316
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
9080
9317
|
const richtextProps = useRichtextProps(Component2.fields, props);
|
|
9081
|
-
return /* @__PURE__ */ (0,
|
|
9318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
9082
9319
|
Component2.render,
|
|
9083
9320
|
__spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
|
|
9084
9321
|
editor: __spreadProps(__spreadValues({}, props.editor), {
|
|
@@ -9087,14 +9324,14 @@ var Item3 = ({
|
|
|
9087
9324
|
})
|
|
9088
9325
|
);
|
|
9089
9326
|
};
|
|
9090
|
-
var SlotRender = (0,
|
|
9327
|
+
var SlotRender = (0, import_react62.forwardRef)(
|
|
9091
9328
|
function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
|
|
9092
9329
|
const El = as != null ? as : "div";
|
|
9093
|
-
return /* @__PURE__ */ (0,
|
|
9330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(El, { className, style, ref, children: content.map((item) => {
|
|
9094
9331
|
if (!config.components[item.type]) {
|
|
9095
9332
|
return null;
|
|
9096
9333
|
}
|
|
9097
|
-
return /* @__PURE__ */ (0,
|
|
9334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
9098
9335
|
Item3,
|
|
9099
9336
|
{
|
|
9100
9337
|
config,
|
|
@@ -9108,7 +9345,7 @@ var SlotRender = (0, import_react61.forwardRef)(
|
|
|
9108
9345
|
);
|
|
9109
9346
|
|
|
9110
9347
|
// components/SlotRender/index.tsx
|
|
9111
|
-
var
|
|
9348
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
9112
9349
|
var ContextSlotRender = ({
|
|
9113
9350
|
componentId,
|
|
9114
9351
|
zone
|
|
@@ -9116,14 +9353,14 @@ var ContextSlotRender = ({
|
|
|
9116
9353
|
const config = useAppStore((s) => s.config);
|
|
9117
9354
|
const metadata = useAppStore((s) => s.metadata);
|
|
9118
9355
|
const slotContent = useAppStore(
|
|
9119
|
-
(0,
|
|
9356
|
+
(0, import_shallow6.useShallow)((s) => {
|
|
9120
9357
|
var _a, _b;
|
|
9121
9358
|
const indexes = s.state.indexes;
|
|
9122
9359
|
const contentIds = (_b = (_a = indexes.zones[`${componentId}:${zone}`]) == null ? void 0 : _a.contentIds) != null ? _b : [];
|
|
9123
9360
|
return contentIds.map((contentId) => indexes.nodes[contentId].flatData);
|
|
9124
9361
|
})
|
|
9125
9362
|
);
|
|
9126
|
-
return /* @__PURE__ */ (0,
|
|
9363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
9127
9364
|
SlotRenderPure,
|
|
9128
9365
|
{
|
|
9129
9366
|
content: slotContent,
|
|
@@ -9184,8 +9421,8 @@ function resolveGlobals(data, config) {
|
|
|
9184
9421
|
}
|
|
9185
9422
|
|
|
9186
9423
|
// components/Render/index.tsx
|
|
9187
|
-
var
|
|
9188
|
-
var renderContext =
|
|
9424
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
9425
|
+
var renderContext = import_react63.default.createContext({
|
|
9189
9426
|
config: { components: {} },
|
|
9190
9427
|
data: { root: {}, content: [] },
|
|
9191
9428
|
metadata: {}
|
|
@@ -9196,7 +9433,7 @@ function Render({
|
|
|
9196
9433
|
metadata = {}
|
|
9197
9434
|
}) {
|
|
9198
9435
|
var _a, _b;
|
|
9199
|
-
const defaultedData = (0,
|
|
9436
|
+
const defaultedData = (0, import_react63.useMemo)(() => {
|
|
9200
9437
|
const base = __spreadProps(__spreadValues({}, data), {
|
|
9201
9438
|
root: data.root || {},
|
|
9202
9439
|
content: data.content || []
|
|
@@ -9219,10 +9456,10 @@ function Render({
|
|
|
9219
9456
|
const propsWithSlots = useSlots(
|
|
9220
9457
|
config,
|
|
9221
9458
|
{ type: "root", props: pageProps },
|
|
9222
|
-
(props) => /* @__PURE__ */ (0,
|
|
9459
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
|
|
9223
9460
|
);
|
|
9224
9461
|
const richtextProps = useRichtextProps((_a = config.root) == null ? void 0 : _a.fields, pageProps);
|
|
9225
|
-
const nextContextValue = (0,
|
|
9462
|
+
const nextContextValue = (0, import_react63.useMemo)(
|
|
9226
9463
|
() => ({
|
|
9227
9464
|
mode: "render",
|
|
9228
9465
|
depth: 0
|
|
@@ -9230,9 +9467,9 @@ function Render({
|
|
|
9230
9467
|
[]
|
|
9231
9468
|
);
|
|
9232
9469
|
if ((_b = config.root) == null ? void 0 : _b.render) {
|
|
9233
|
-
return /* @__PURE__ */ (0,
|
|
9470
|
+
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
9471
|
}
|
|
9235
|
-
return /* @__PURE__ */ (0,
|
|
9472
|
+
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
9473
|
}
|
|
9237
9474
|
|
|
9238
9475
|
// components/DropZone/index.tsx
|
|
@@ -9240,16 +9477,16 @@ init_flatten_node();
|
|
|
9240
9477
|
|
|
9241
9478
|
// lib/field-transforms/use-field-transforms-tracked.tsx
|
|
9242
9479
|
init_react_import();
|
|
9243
|
-
var
|
|
9480
|
+
var import_react64 = require("react");
|
|
9244
9481
|
init_map_fields();
|
|
9245
9482
|
function useFieldTransformsTracked(config, item, transforms, readOnly, forceReadOnly) {
|
|
9246
|
-
const prevProps = (0,
|
|
9247
|
-
const prevResult = (0,
|
|
9248
|
-
const mappers = (0,
|
|
9483
|
+
const prevProps = (0, import_react64.useRef)(null);
|
|
9484
|
+
const prevResult = (0, import_react64.useRef)(item.props);
|
|
9485
|
+
const mappers = (0, import_react64.useMemo)(
|
|
9249
9486
|
() => buildMappers(transforms, readOnly, forceReadOnly),
|
|
9250
9487
|
[transforms, readOnly, forceReadOnly]
|
|
9251
9488
|
);
|
|
9252
|
-
const transformedProps = (0,
|
|
9489
|
+
const transformedProps = (0, import_react64.useMemo)(() => {
|
|
9253
9490
|
var _a, _b, _c;
|
|
9254
9491
|
const changedProps = {};
|
|
9255
9492
|
const componentConfig = item.type === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[item.type];
|
|
@@ -9275,7 +9512,7 @@ function useFieldTransformsTracked(config, item, transforms, readOnly, forceRead
|
|
|
9275
9512
|
prevResult.current = __spreadValues(__spreadValues({}, prevResult.current), mapped);
|
|
9276
9513
|
return prevResult.current;
|
|
9277
9514
|
}, [config, item, mappers]);
|
|
9278
|
-
const mergedProps = (0,
|
|
9515
|
+
const mergedProps = (0, import_react64.useMemo)(
|
|
9279
9516
|
() => __spreadValues(__spreadValues({}, item.props), transformedProps),
|
|
9280
9517
|
[item.props, transformedProps]
|
|
9281
9518
|
);
|
|
@@ -9287,7 +9524,7 @@ init_react_import();
|
|
|
9287
9524
|
|
|
9288
9525
|
// components/InlineTextField/index.tsx
|
|
9289
9526
|
init_react_import();
|
|
9290
|
-
var
|
|
9527
|
+
var import_react65 = require("react");
|
|
9291
9528
|
|
|
9292
9529
|
// lib/overlay-portal/index.tsx
|
|
9293
9530
|
init_react_import();
|
|
@@ -9342,24 +9579,12 @@ init_store();
|
|
|
9342
9579
|
|
|
9343
9580
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/InlineTextField/styles.module.css#css-module
|
|
9344
9581
|
init_react_import();
|
|
9345
|
-
var
|
|
9582
|
+
var styles_module_default21 = { "InlineTextField": "_InlineTextField_104qp_1" };
|
|
9346
9583
|
|
|
9347
9584
|
// components/InlineTextField/index.tsx
|
|
9348
9585
|
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);
|
|
9586
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
9587
|
+
var getClassName26 = get_class_name_factory_default("InlineTextField", styles_module_default21);
|
|
9363
9588
|
var InlineTextFieldInternal = ({
|
|
9364
9589
|
propPath,
|
|
9365
9590
|
componentId,
|
|
@@ -9368,10 +9593,10 @@ var InlineTextFieldInternal = ({
|
|
|
9368
9593
|
opts = {}
|
|
9369
9594
|
}) => {
|
|
9370
9595
|
var _a;
|
|
9371
|
-
const ref = (0,
|
|
9596
|
+
const ref = (0, import_react65.useRef)(null);
|
|
9372
9597
|
const appStoreApi = useAppStoreApi();
|
|
9373
9598
|
const disableLineBreaks = (_a = opts.disableLineBreaks) != null ? _a : false;
|
|
9374
|
-
(0,
|
|
9599
|
+
(0, import_react65.useEffect)(() => {
|
|
9375
9600
|
const appStore = appStoreApi.getState();
|
|
9376
9601
|
const data = appStore.state.indexes.nodes[componentId].data;
|
|
9377
9602
|
const componentConfig = appStore.getComponentConfig(data.type);
|
|
@@ -9417,12 +9642,12 @@ var InlineTextFieldInternal = ({
|
|
|
9417
9642
|
};
|
|
9418
9643
|
}
|
|
9419
9644
|
}, [appStoreApi, ref.current, value, disableLineBreaks]);
|
|
9420
|
-
const [isHovering, setIsHovering] = (0,
|
|
9421
|
-
const [isFocused, setIsFocused] = (0,
|
|
9422
|
-
return /* @__PURE__ */ (0,
|
|
9645
|
+
const [isHovering, setIsHovering] = (0, import_react65.useState)(false);
|
|
9646
|
+
const [isFocused, setIsFocused] = (0, import_react65.useState)(false);
|
|
9647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
9423
9648
|
"span",
|
|
9424
9649
|
{
|
|
9425
|
-
className:
|
|
9650
|
+
className: getClassName26(),
|
|
9426
9651
|
ref,
|
|
9427
9652
|
contentEditable: isHovering || isFocused ? "plaintext-only" : "false",
|
|
9428
9653
|
onClick: (e) => {
|
|
@@ -9455,14 +9680,14 @@ var InlineTextFieldInternal = ({
|
|
|
9455
9680
|
}
|
|
9456
9681
|
);
|
|
9457
9682
|
};
|
|
9458
|
-
var InlineTextField = (0,
|
|
9683
|
+
var InlineTextField = (0, import_react65.memo)(InlineTextFieldInternal);
|
|
9459
9684
|
|
|
9460
9685
|
// lib/field-transforms/default-transforms/inline-text-transform.tsx
|
|
9461
|
-
var
|
|
9686
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
9462
9687
|
var getInlineTextTransform = () => ({
|
|
9463
9688
|
text: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
9464
9689
|
if (field.contentEditable) {
|
|
9465
|
-
return /* @__PURE__ */ (0,
|
|
9690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9466
9691
|
InlineTextField,
|
|
9467
9692
|
{
|
|
9468
9693
|
propPath,
|
|
@@ -9477,7 +9702,7 @@ var getInlineTextTransform = () => ({
|
|
|
9477
9702
|
},
|
|
9478
9703
|
textarea: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
9479
9704
|
if (field.contentEditable) {
|
|
9480
|
-
return /* @__PURE__ */ (0,
|
|
9705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9481
9706
|
InlineTextField,
|
|
9482
9707
|
{
|
|
9483
9708
|
propPath,
|
|
@@ -9491,7 +9716,7 @@ var getInlineTextTransform = () => ({
|
|
|
9491
9716
|
},
|
|
9492
9717
|
custom: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
9493
9718
|
if (field.contentEditable && typeof value === "string") {
|
|
9494
|
-
return /* @__PURE__ */ (0,
|
|
9719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
9495
9720
|
InlineTextField,
|
|
9496
9721
|
{
|
|
9497
9722
|
propPath,
|
|
@@ -9508,19 +9733,19 @@ var getInlineTextTransform = () => ({
|
|
|
9508
9733
|
// lib/field-transforms/default-transforms/rich-text-transform.tsx
|
|
9509
9734
|
init_react_import();
|
|
9510
9735
|
init_store();
|
|
9511
|
-
var
|
|
9512
|
-
var
|
|
9513
|
-
var Editor3 = (0,
|
|
9736
|
+
var import_react66 = require("react");
|
|
9737
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
9738
|
+
var Editor3 = (0, import_react66.lazy)(
|
|
9514
9739
|
() => Promise.resolve().then(() => (init_Editor(), Editor_exports)).then((m) => ({
|
|
9515
9740
|
default: m.Editor
|
|
9516
9741
|
}))
|
|
9517
9742
|
);
|
|
9518
|
-
var RichTextRender2 = (0,
|
|
9743
|
+
var RichTextRender2 = (0, import_react66.lazy)(
|
|
9519
9744
|
() => Promise.resolve().then(() => (init_Render(), Render_exports)).then((m) => ({
|
|
9520
9745
|
default: m.RichTextRender
|
|
9521
9746
|
}))
|
|
9522
9747
|
);
|
|
9523
|
-
var InlineEditorWrapper = (0,
|
|
9748
|
+
var InlineEditorWrapper = (0, import_react66.memo)(
|
|
9524
9749
|
({
|
|
9525
9750
|
value,
|
|
9526
9751
|
componentId,
|
|
@@ -9528,7 +9753,7 @@ var InlineEditorWrapper = (0, import_react65.memo)(
|
|
|
9528
9753
|
field,
|
|
9529
9754
|
id
|
|
9530
9755
|
}) => {
|
|
9531
|
-
const portalRef = (0,
|
|
9756
|
+
const portalRef = (0, import_react66.useRef)(null);
|
|
9532
9757
|
const appStoreApi = useAppStoreApi();
|
|
9533
9758
|
const onClickHandler = (e) => {
|
|
9534
9759
|
e.preventDefault();
|
|
@@ -9543,14 +9768,14 @@ var InlineEditorWrapper = (0, import_react65.memo)(
|
|
|
9543
9768
|
);
|
|
9544
9769
|
appStoreApi.getState().setUi({ itemSelector });
|
|
9545
9770
|
};
|
|
9546
|
-
(0,
|
|
9771
|
+
(0, import_react66.useEffect)(() => {
|
|
9547
9772
|
if (!portalRef.current) return;
|
|
9548
9773
|
const cleanup = registerOverlayPortal(portalRef.current, {
|
|
9549
9774
|
disableDragOnFocus: true
|
|
9550
9775
|
});
|
|
9551
9776
|
return () => cleanup == null ? void 0 : cleanup();
|
|
9552
9777
|
}, [portalRef.current]);
|
|
9553
|
-
const handleChange = (0,
|
|
9778
|
+
const handleChange = (0, import_react66.useCallback)(
|
|
9554
9779
|
(content, ui) => __async(null, null, function* () {
|
|
9555
9780
|
var _a;
|
|
9556
9781
|
const appStore = appStoreApi.getState();
|
|
@@ -9574,7 +9799,7 @@ var InlineEditorWrapper = (0, import_react65.memo)(
|
|
|
9574
9799
|
}),
|
|
9575
9800
|
[appStoreApi, componentId, propPath]
|
|
9576
9801
|
);
|
|
9577
|
-
const handleFocus = (0,
|
|
9802
|
+
const handleFocus = (0, import_react66.useCallback)(
|
|
9578
9803
|
(editor) => {
|
|
9579
9804
|
appStoreApi.setState({
|
|
9580
9805
|
currentRichText: {
|
|
@@ -9589,7 +9814,7 @@ var InlineEditorWrapper = (0, import_react65.memo)(
|
|
|
9589
9814
|
[field, componentId]
|
|
9590
9815
|
);
|
|
9591
9816
|
if (!field.contentEditable)
|
|
9592
|
-
return /* @__PURE__ */ (0,
|
|
9817
|
+
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
9818
|
const editorProps = {
|
|
9594
9819
|
content: value,
|
|
9595
9820
|
onChange: handleChange,
|
|
@@ -9599,13 +9824,13 @@ var InlineEditorWrapper = (0, import_react65.memo)(
|
|
|
9599
9824
|
id,
|
|
9600
9825
|
name: propPath
|
|
9601
9826
|
};
|
|
9602
|
-
return /* @__PURE__ */ (0,
|
|
9827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
9603
9828
|
"div",
|
|
9604
9829
|
{
|
|
9605
9830
|
ref: portalRef,
|
|
9606
9831
|
onClick: onClickHandler,
|
|
9607
9832
|
onClickCapture: onClickCaptureHandler,
|
|
9608
|
-
children: /* @__PURE__ */ (0,
|
|
9833
|
+
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
9834
|
}
|
|
9610
9835
|
);
|
|
9611
9836
|
}
|
|
@@ -9615,10 +9840,10 @@ var getRichTextTransform = () => ({
|
|
|
9615
9840
|
richtext: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
9616
9841
|
const { contentEditable = true, tiptap } = field;
|
|
9617
9842
|
if (contentEditable === false || isReadOnly) {
|
|
9618
|
-
return /* @__PURE__ */ (0,
|
|
9843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(RichTextRender2, { content: value, field });
|
|
9619
9844
|
}
|
|
9620
9845
|
const id = `${componentId}_${field.type}_${propPath}`;
|
|
9621
|
-
return /* @__PURE__ */ (0,
|
|
9846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
9622
9847
|
InlineEditorWrapper,
|
|
9623
9848
|
{
|
|
9624
9849
|
value,
|
|
@@ -9635,7 +9860,7 @@ var getRichTextTransform = () => ({
|
|
|
9635
9860
|
// components/MemoizeComponent/index.tsx
|
|
9636
9861
|
init_react_import();
|
|
9637
9862
|
var import_fast_equals3 = require("fast-equals");
|
|
9638
|
-
var
|
|
9863
|
+
var import_react67 = require("react");
|
|
9639
9864
|
|
|
9640
9865
|
// lib/shallow-equal.ts
|
|
9641
9866
|
init_react_import();
|
|
@@ -9662,14 +9887,14 @@ function shallowEqual(obj1, obj2, keysToIgnore = []) {
|
|
|
9662
9887
|
}
|
|
9663
9888
|
|
|
9664
9889
|
// components/MemoizeComponent/index.tsx
|
|
9665
|
-
var
|
|
9890
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
9666
9891
|
var RenderComponent = ({
|
|
9667
9892
|
Component: Component2,
|
|
9668
9893
|
componentProps: renderProps
|
|
9669
9894
|
}) => {
|
|
9670
|
-
return /* @__PURE__ */ (0,
|
|
9895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Component2, __spreadValues({}, renderProps));
|
|
9671
9896
|
};
|
|
9672
|
-
var MemoizeComponent = (0,
|
|
9897
|
+
var MemoizeComponent = (0, import_react67.memo)(RenderComponent, (prev, next) => {
|
|
9673
9898
|
let editorEquals = true;
|
|
9674
9899
|
if ("editor" in prev.componentProps && "editor" in next.componentProps) {
|
|
9675
9900
|
editorEquals = (0, import_fast_equals3.deepEqual)(prev.componentProps.editor, next.componentProps.editor);
|
|
@@ -9679,7 +9904,7 @@ var MemoizeComponent = (0, import_react66.memo)(RenderComponent, (prev, next) =>
|
|
|
9679
9904
|
|
|
9680
9905
|
// components/DropZone/VirtualizedDropZone.tsx
|
|
9681
9906
|
init_react_import();
|
|
9682
|
-
var
|
|
9907
|
+
var import_react68 = require("react");
|
|
9683
9908
|
init_store();
|
|
9684
9909
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
9685
9910
|
|
|
@@ -9695,7 +9920,7 @@ var getFrame = () => {
|
|
|
9695
9920
|
};
|
|
9696
9921
|
|
|
9697
9922
|
// components/DropZone/VirtualizedDropZone.tsx
|
|
9698
|
-
var
|
|
9923
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
9699
9924
|
var ROOT_ZONE_VIRTUALIZATION_OVERSCAN = 5;
|
|
9700
9925
|
var DEFAULT_VIRTUALIZED_ITEM_HEIGHT = 320;
|
|
9701
9926
|
var measuredItemHeights = /* @__PURE__ */ new Map();
|
|
@@ -9719,7 +9944,7 @@ var VirtualizedDropZone = ({
|
|
|
9719
9944
|
return (_b = (_a = s.selectedItem) == null ? void 0 : _a.props.id) != null ? _b : null;
|
|
9720
9945
|
});
|
|
9721
9946
|
const frame = getFrame();
|
|
9722
|
-
const zoneStore = (0,
|
|
9947
|
+
const zoneStore = (0, import_react68.useContext)(ZoneStoreContext);
|
|
9723
9948
|
const draggedItemId = useContextStore(ZoneStoreContext, (s) => {
|
|
9724
9949
|
var _a;
|
|
9725
9950
|
const draggedId = (_a = s.draggedItem) == null ? void 0 : _a.id;
|
|
@@ -9734,9 +9959,9 @@ var VirtualizedDropZone = ({
|
|
|
9734
9959
|
return null;
|
|
9735
9960
|
});
|
|
9736
9961
|
const iframeWindow = frame == null ? void 0 : frame.defaultView;
|
|
9737
|
-
const measureRefsRef = (0,
|
|
9962
|
+
const measureRefsRef = (0, import_react68.useRef)(/* @__PURE__ */ new Map());
|
|
9738
9963
|
const appStoreApi = useAppStoreApi();
|
|
9739
|
-
const resolveIndex = (0,
|
|
9964
|
+
const resolveIndex = (0, import_react68.useCallback)(
|
|
9740
9965
|
(targetId) => {
|
|
9741
9966
|
var _a, _b, _c, _d;
|
|
9742
9967
|
if (!targetId || targetId === "root") {
|
|
@@ -9761,7 +9986,7 @@ var VirtualizedDropZone = ({
|
|
|
9761
9986
|
},
|
|
9762
9987
|
[appStoreApi, contentIds]
|
|
9763
9988
|
);
|
|
9764
|
-
const pinnedIndexes = (0,
|
|
9989
|
+
const pinnedIndexes = (0, import_react68.useMemo)(() => {
|
|
9765
9990
|
const nextPinnedIndexes = /* @__PURE__ */ new Set();
|
|
9766
9991
|
[selectedId, draggedItemId, dragTargetParentId].forEach((targetId) => {
|
|
9767
9992
|
const currentIndex = resolveIndex(targetId);
|
|
@@ -9771,7 +9996,7 @@ var VirtualizedDropZone = ({
|
|
|
9771
9996
|
});
|
|
9772
9997
|
return Array.from(nextPinnedIndexes).sort((a, b) => a - b);
|
|
9773
9998
|
}, [dragTargetParentId, draggedItemId, resolveIndex, selectedId]);
|
|
9774
|
-
const rangeExtractor = (0,
|
|
9999
|
+
const rangeExtractor = (0, import_react68.useCallback)(
|
|
9775
10000
|
(range) => {
|
|
9776
10001
|
const indexes = (0, import_react_virtual.defaultRangeExtractor)(range);
|
|
9777
10002
|
pinnedIndexes.forEach((index) => {
|
|
@@ -9796,7 +10021,7 @@ var VirtualizedDropZone = ({
|
|
|
9796
10021
|
rangeExtractor,
|
|
9797
10022
|
initialOffset: () => iframeWindow ? iframeWindow.scrollY : 0
|
|
9798
10023
|
});
|
|
9799
|
-
(0,
|
|
10024
|
+
(0, import_react68.useEffect)(() => {
|
|
9800
10025
|
zoneStore.getState().registerRootVirtualizer(zoneCompound, {
|
|
9801
10026
|
resolveIndex: (targetId) => resolveIndex(targetId),
|
|
9802
10027
|
virtualizer
|
|
@@ -9805,7 +10030,7 @@ var VirtualizedDropZone = ({
|
|
|
9805
10030
|
zoneStore.getState().unregisterRootVirtualizer(zoneCompound);
|
|
9806
10031
|
};
|
|
9807
10032
|
}, [resolveIndex, virtualizer, zoneCompound, zoneStore]);
|
|
9808
|
-
const getMeasureRef = (0,
|
|
10033
|
+
const getMeasureRef = (0, import_react68.useCallback)((componentId) => {
|
|
9809
10034
|
const cachedRef = measureRefsRef.current.get(componentId);
|
|
9810
10035
|
if (cachedRef) {
|
|
9811
10036
|
return cachedRef;
|
|
@@ -9822,7 +10047,7 @@ var VirtualizedDropZone = ({
|
|
|
9822
10047
|
measureRefsRef.current.set(componentId, measureRef);
|
|
9823
10048
|
return measureRef;
|
|
9824
10049
|
}, []);
|
|
9825
|
-
(0,
|
|
10050
|
+
(0, import_react68.useEffect)(() => {
|
|
9826
10051
|
const validIds = new Set(contentIds);
|
|
9827
10052
|
Array.from(measureRefsRef.current.keys()).forEach((componentId) => {
|
|
9828
10053
|
if (!validIds.has(componentId)) {
|
|
@@ -9832,7 +10057,7 @@ var VirtualizedDropZone = ({
|
|
|
9832
10057
|
}, [contentIds]);
|
|
9833
10058
|
const virtualItems = virtualizer.getVirtualItems();
|
|
9834
10059
|
const totalSize = virtualizer.getTotalSize();
|
|
9835
|
-
const renderedItems = (0,
|
|
10060
|
+
const renderedItems = (0, import_react68.useMemo)(() => {
|
|
9836
10061
|
const items = [];
|
|
9837
10062
|
let previousEnd = 0;
|
|
9838
10063
|
let previousIndex = -1;
|
|
@@ -9842,7 +10067,7 @@ var VirtualizedDropZone = ({
|
|
|
9842
10067
|
const gapSize = Math.max(virtualItem.start - previousEnd, 0);
|
|
9843
10068
|
if (gapSize > 0) {
|
|
9844
10069
|
items.push(
|
|
9845
|
-
/* @__PURE__ */ (0,
|
|
10070
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
9846
10071
|
"div",
|
|
9847
10072
|
{
|
|
9848
10073
|
style: { height: `${gapSize}px` }
|
|
@@ -9864,7 +10089,7 @@ var VirtualizedDropZone = ({
|
|
|
9864
10089
|
const trailingGap = Math.max(totalSize - previousEnd, 0);
|
|
9865
10090
|
if (trailingGap > 0) {
|
|
9866
10091
|
items.push(
|
|
9867
|
-
/* @__PURE__ */ (0,
|
|
10092
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
9868
10093
|
"div",
|
|
9869
10094
|
{
|
|
9870
10095
|
style: { height: `${trailingGap}px` }
|
|
@@ -9875,15 +10100,15 @@ var VirtualizedDropZone = ({
|
|
|
9875
10100
|
}
|
|
9876
10101
|
return items;
|
|
9877
10102
|
}, [totalSize, virtualItems, getMeasureRef]);
|
|
9878
|
-
return /* @__PURE__ */ (0,
|
|
10103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_jsx_runtime70.Fragment, { children: renderedItems });
|
|
9879
10104
|
};
|
|
9880
10105
|
|
|
9881
10106
|
// components/DropZone/index.tsx
|
|
9882
|
-
var
|
|
10107
|
+
var import_jsx_runtime71 = (
|
|
9883
10108
|
// Safe to use this since the HTML is set by the user
|
|
9884
10109
|
require("react/jsx-runtime")
|
|
9885
10110
|
);
|
|
9886
|
-
var
|
|
10111
|
+
var getClassName27 = get_class_name_factory_default("DropZone", styles_module_default20);
|
|
9887
10112
|
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
|
9888
10113
|
var RENDER_DEBUG = false;
|
|
9889
10114
|
var InsertPreview = ({
|
|
@@ -9892,11 +10117,11 @@ var InsertPreview = ({
|
|
|
9892
10117
|
override
|
|
9893
10118
|
}) => {
|
|
9894
10119
|
if (element) {
|
|
9895
|
-
return /* @__PURE__ */ (0,
|
|
10120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { dangerouslySetInnerHTML: { __html: element.outerHTML } });
|
|
9896
10121
|
}
|
|
9897
|
-
return /* @__PURE__ */ (0,
|
|
10122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DrawerItemInner, { name: label, children: override });
|
|
9898
10123
|
};
|
|
9899
|
-
var DropZoneEditPure = (props) => /* @__PURE__ */ (0,
|
|
10124
|
+
var DropZoneEditPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DropZoneEdit, __spreadValues({}, props));
|
|
9900
10125
|
var DropZoneChild = ({
|
|
9901
10126
|
zoneCompound,
|
|
9902
10127
|
componentId,
|
|
@@ -9908,11 +10133,11 @@ var DropZoneChild = ({
|
|
|
9908
10133
|
}) => {
|
|
9909
10134
|
var _a, _b;
|
|
9910
10135
|
const metadata = useAppStore((s) => s.metadata);
|
|
9911
|
-
const ctx = (0,
|
|
10136
|
+
const ctx = (0, import_react69.useContext)(dropZoneContext);
|
|
9912
10137
|
const { depth = 1 } = ctx != null ? ctx : {};
|
|
9913
|
-
const zoneStore = (0,
|
|
10138
|
+
const zoneStore = (0, import_react69.useContext)(ZoneStoreContext);
|
|
9914
10139
|
const nodeProps = useAppStore(
|
|
9915
|
-
(0,
|
|
10140
|
+
(0, import_shallow7.useShallow)((s) => {
|
|
9916
10141
|
var _a2;
|
|
9917
10142
|
return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.flatData.props;
|
|
9918
10143
|
})
|
|
@@ -9924,13 +10149,13 @@ var DropZoneChild = ({
|
|
|
9924
10149
|
}
|
|
9925
10150
|
);
|
|
9926
10151
|
const nodeReadOnly = useAppStore(
|
|
9927
|
-
(0,
|
|
10152
|
+
(0, import_shallow7.useShallow)((s) => {
|
|
9928
10153
|
var _a2;
|
|
9929
10154
|
return (_a2 = s.state.indexes.nodes[componentId]) == null ? void 0 : _a2.data.readOnly;
|
|
9930
10155
|
})
|
|
9931
10156
|
);
|
|
9932
10157
|
const appStore = useAppStoreApi();
|
|
9933
|
-
const item = (0,
|
|
10158
|
+
const item = (0, import_react69.useMemo)(() => {
|
|
9934
10159
|
if (nodeProps) {
|
|
9935
10160
|
const expanded = expandNode({
|
|
9936
10161
|
type: nodeType,
|
|
@@ -9952,7 +10177,7 @@ var DropZoneChild = ({
|
|
|
9952
10177
|
const componentConfig = useAppStore(
|
|
9953
10178
|
(s) => (item == null ? void 0 : item.type) ? s.config.components[item.type] : null
|
|
9954
10179
|
);
|
|
9955
|
-
const editorProps = (0,
|
|
10180
|
+
const editorProps = (0, import_react69.useMemo)(
|
|
9956
10181
|
() => ({
|
|
9957
10182
|
renderDropZone: DropZoneEditPure,
|
|
9958
10183
|
isEditing: true,
|
|
@@ -9975,7 +10200,7 @@ var DropZoneChild = ({
|
|
|
9975
10200
|
}
|
|
9976
10201
|
);
|
|
9977
10202
|
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,
|
|
10203
|
+
const defaultsProps = (0, import_react69.useMemo)(
|
|
9979
10204
|
() => __spreadProps(__spreadValues(__spreadValues({}, componentConfig == null ? void 0 : componentConfig.defaultProps), item == null ? void 0 : item.props), {
|
|
9980
10205
|
editor: editorProps,
|
|
9981
10206
|
editMode: true
|
|
@@ -9983,7 +10208,7 @@ var DropZoneChild = ({
|
|
|
9983
10208
|
}),
|
|
9984
10209
|
[componentConfig == null ? void 0 : componentConfig.defaultProps, item == null ? void 0 : item.props, editorProps]
|
|
9985
10210
|
);
|
|
9986
|
-
const defaultedNode = (0,
|
|
10211
|
+
const defaultedNode = (0, import_react69.useMemo)(
|
|
9987
10212
|
() => {
|
|
9988
10213
|
var _a2;
|
|
9989
10214
|
return { type: (_a2 = item == null ? void 0 : item.type) != null ? _a2 : nodeType, props: defaultsProps };
|
|
@@ -9993,8 +10218,8 @@ var DropZoneChild = ({
|
|
|
9993
10218
|
const config = useAppStore((s) => s.config);
|
|
9994
10219
|
const plugins = useAppStore((s) => s.plugins);
|
|
9995
10220
|
const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
|
|
9996
|
-
const combinedFieldTransforms = (0,
|
|
9997
|
-
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ (0,
|
|
10221
|
+
const combinedFieldTransforms = (0, import_react69.useMemo)(
|
|
10222
|
+
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), getRichTextTransform()), plugins.reduce(
|
|
9998
10223
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
9999
10224
|
{}
|
|
10000
10225
|
)), userFieldTransforms),
|
|
@@ -10008,13 +10233,13 @@ var DropZoneChild = ({
|
|
|
10008
10233
|
isLoading
|
|
10009
10234
|
);
|
|
10010
10235
|
if (!item) return;
|
|
10011
|
-
const Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0,
|
|
10236
|
+
const Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
|
10012
10237
|
"No configuration for ",
|
|
10013
10238
|
item.type
|
|
10014
10239
|
] });
|
|
10015
10240
|
let componentType = item.type;
|
|
10016
10241
|
const isInserting = "previewType" in item ? item.previewType === "insert" : false;
|
|
10017
|
-
return /* @__PURE__ */ (0,
|
|
10242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10018
10243
|
DraggableComponent,
|
|
10019
10244
|
{
|
|
10020
10245
|
id: componentId,
|
|
@@ -10032,7 +10257,7 @@ var DropZoneChild = ({
|
|
|
10032
10257
|
children: (dragRef) => {
|
|
10033
10258
|
var _a2;
|
|
10034
10259
|
if ((componentConfig == null ? void 0 : componentConfig.inline) && !isInserting) {
|
|
10035
|
-
return /* @__PURE__ */ (0,
|
|
10260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10036
10261
|
MemoizeComponent,
|
|
10037
10262
|
{
|
|
10038
10263
|
Component: Render2,
|
|
@@ -10042,14 +10267,14 @@ var DropZoneChild = ({
|
|
|
10042
10267
|
}
|
|
10043
10268
|
);
|
|
10044
10269
|
}
|
|
10045
|
-
return /* @__PURE__ */ (0,
|
|
10270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { ref: dragRef, children: isInserting ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10046
10271
|
InsertPreview,
|
|
10047
10272
|
{
|
|
10048
10273
|
label,
|
|
10049
10274
|
override: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem,
|
|
10050
10275
|
element: "element" in item && item.element ? item.element : void 0
|
|
10051
10276
|
}
|
|
10052
|
-
) : /* @__PURE__ */ (0,
|
|
10277
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10053
10278
|
MemoizeComponent,
|
|
10054
10279
|
{
|
|
10055
10280
|
Component: Render2,
|
|
@@ -10060,8 +10285,8 @@ var DropZoneChild = ({
|
|
|
10060
10285
|
}
|
|
10061
10286
|
);
|
|
10062
10287
|
};
|
|
10063
|
-
var DropZoneChildMemo = (0,
|
|
10064
|
-
var DropZoneEdit = (0,
|
|
10288
|
+
var DropZoneChildMemo = (0, import_react69.memo)(DropZoneChild);
|
|
10289
|
+
var DropZoneEdit = (0, import_react69.forwardRef)(
|
|
10065
10290
|
function DropZoneEditInternal({
|
|
10066
10291
|
zone,
|
|
10067
10292
|
allow,
|
|
@@ -10072,7 +10297,7 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10072
10297
|
collisionAxis,
|
|
10073
10298
|
as
|
|
10074
10299
|
}, userRef) {
|
|
10075
|
-
const ctx = (0,
|
|
10300
|
+
const ctx = (0, import_react69.useContext)(dropZoneContext);
|
|
10076
10301
|
const appStoreApi = useAppStoreApi();
|
|
10077
10302
|
const {
|
|
10078
10303
|
// These all need setting via context
|
|
@@ -10082,7 +10307,7 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10082
10307
|
unregisterLocalZone
|
|
10083
10308
|
} = ctx != null ? ctx : {};
|
|
10084
10309
|
const path = useAppStore(
|
|
10085
|
-
(0,
|
|
10310
|
+
(0, import_shallow7.useShallow)((s) => {
|
|
10086
10311
|
var _a;
|
|
10087
10312
|
return areaId ? (_a = s.state.indexes.nodes[areaId]) == null ? void 0 : _a.path : null;
|
|
10088
10313
|
})
|
|
@@ -10099,25 +10324,25 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10099
10324
|
(s) => s.nextAreaDepthIndex[areaId || ""]
|
|
10100
10325
|
);
|
|
10101
10326
|
const zoneContentIds = useAppStore(
|
|
10102
|
-
(0,
|
|
10327
|
+
(0, import_shallow7.useShallow)((s) => {
|
|
10103
10328
|
var _a;
|
|
10104
10329
|
return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.contentIds;
|
|
10105
10330
|
})
|
|
10106
10331
|
);
|
|
10107
10332
|
const zoneType = useAppStore(
|
|
10108
|
-
(0,
|
|
10333
|
+
(0, import_shallow7.useShallow)((s) => {
|
|
10109
10334
|
var _a;
|
|
10110
10335
|
return (_a = s.state.indexes.zones[zoneCompound]) == null ? void 0 : _a.type;
|
|
10111
10336
|
})
|
|
10112
10337
|
);
|
|
10113
|
-
(0,
|
|
10338
|
+
(0, import_react69.useEffect)(() => {
|
|
10114
10339
|
if (!zoneType || zoneType === "dropzone") {
|
|
10115
10340
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
10116
10341
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
10117
10342
|
}
|
|
10118
10343
|
}
|
|
10119
10344
|
}, [zoneType, appStoreApi]);
|
|
10120
|
-
(0,
|
|
10345
|
+
(0, import_react69.useEffect)(() => {
|
|
10121
10346
|
if (zoneType === "dropzone") {
|
|
10122
10347
|
if (zoneCompound !== rootDroppableId) {
|
|
10123
10348
|
console.warn(
|
|
@@ -10126,11 +10351,11 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10126
10351
|
}
|
|
10127
10352
|
}
|
|
10128
10353
|
}, [zoneType]);
|
|
10129
|
-
const contentIds = (0,
|
|
10354
|
+
const contentIds = (0, import_react69.useMemo)(() => {
|
|
10130
10355
|
return zoneContentIds || [];
|
|
10131
10356
|
}, [zoneContentIds]);
|
|
10132
|
-
const ref = (0,
|
|
10133
|
-
const acceptsTarget = (0,
|
|
10357
|
+
const ref = (0, import_react69.useRef)(null);
|
|
10358
|
+
const acceptsTarget = (0, import_react69.useCallback)(
|
|
10134
10359
|
(componentType) => {
|
|
10135
10360
|
if (!componentType) {
|
|
10136
10361
|
return true;
|
|
@@ -10168,7 +10393,7 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10168
10393
|
}
|
|
10169
10394
|
return _isEnabled;
|
|
10170
10395
|
});
|
|
10171
|
-
(0,
|
|
10396
|
+
(0, import_react69.useEffect)(() => {
|
|
10172
10397
|
if (registerLocalZone) {
|
|
10173
10398
|
registerLocalZone(zoneCompound, targetAccepted || isEnabled);
|
|
10174
10399
|
}
|
|
@@ -10183,8 +10408,8 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10183
10408
|
zoneCompound
|
|
10184
10409
|
);
|
|
10185
10410
|
const isDropEnabled = isEnabled && (preview ? contentIdsWithPreview.length === 1 : contentIdsWithPreview.length === 0);
|
|
10186
|
-
const zoneStore = (0,
|
|
10187
|
-
(0,
|
|
10411
|
+
const zoneStore = (0, import_react69.useContext)(ZoneStoreContext);
|
|
10412
|
+
(0, import_react69.useEffect)(() => {
|
|
10188
10413
|
const { enabledIndex } = zoneStore.getState();
|
|
10189
10414
|
zoneStore.setState({
|
|
10190
10415
|
enabledIndex: __spreadProps(__spreadValues({}, enabledIndex), { [zoneCompound]: isEnabled })
|
|
@@ -10203,7 +10428,7 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10203
10428
|
path: path || []
|
|
10204
10429
|
}
|
|
10205
10430
|
};
|
|
10206
|
-
const { ref: dropRef } = (0,
|
|
10431
|
+
const { ref: dropRef } = (0, import_react70.useDroppable)(droppableConfig);
|
|
10207
10432
|
const isAreaSelected = useAppStore(
|
|
10208
10433
|
(s) => (s == null ? void 0 : s.selectedItem) && areaId === (s == null ? void 0 : s.selectedItem.props.id)
|
|
10209
10434
|
);
|
|
@@ -10213,7 +10438,7 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10213
10438
|
userMinEmptyHeight,
|
|
10214
10439
|
ref
|
|
10215
10440
|
});
|
|
10216
|
-
const setRefs = (0,
|
|
10441
|
+
const setRefs = (0, import_react69.useCallback)(
|
|
10217
10442
|
(node) => {
|
|
10218
10443
|
assignRefs([ref, dropRef, userRef], node);
|
|
10219
10444
|
},
|
|
@@ -10225,10 +10450,10 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10225
10450
|
const El = as != null ? as : "div";
|
|
10226
10451
|
const isRootAreaZone = (areaId != null ? areaId : rootAreaId) === rootAreaId && depth === 0;
|
|
10227
10452
|
const shouldVirtualizeItems = _experimentalVirtualization && isRootAreaZone;
|
|
10228
|
-
return /* @__PURE__ */ (0,
|
|
10453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10229
10454
|
El,
|
|
10230
10455
|
{
|
|
10231
|
-
className: `${
|
|
10456
|
+
className: `${getClassName27({
|
|
10232
10457
|
isRootZone,
|
|
10233
10458
|
hoveringOverArea,
|
|
10234
10459
|
isEnabled,
|
|
@@ -10243,12 +10468,12 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10243
10468
|
"--min-empty-height": minEmptyHeight,
|
|
10244
10469
|
backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
|
|
10245
10470
|
}),
|
|
10246
|
-
children: shouldVirtualizeItems ? /* @__PURE__ */ (0,
|
|
10471
|
+
children: shouldVirtualizeItems ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10247
10472
|
VirtualizedDropZone,
|
|
10248
10473
|
{
|
|
10249
10474
|
contentIds: contentIdsWithPreview,
|
|
10250
10475
|
zoneCompound,
|
|
10251
|
-
renderItem: (props) => /* @__PURE__ */ (0,
|
|
10476
|
+
renderItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10252
10477
|
DropZoneChildMemo,
|
|
10253
10478
|
{
|
|
10254
10479
|
zoneCompound,
|
|
@@ -10262,7 +10487,7 @@ var DropZoneEdit = (0, import_react68.forwardRef)(
|
|
|
10262
10487
|
props.componentId
|
|
10263
10488
|
)
|
|
10264
10489
|
}
|
|
10265
|
-
) : contentIdsWithPreview.map((componentId, i) => /* @__PURE__ */ (0,
|
|
10490
|
+
) : contentIdsWithPreview.map((componentId, i) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10266
10491
|
DropZoneChildMemo,
|
|
10267
10492
|
{
|
|
10268
10493
|
zoneCompound,
|
|
@@ -10284,8 +10509,8 @@ var DropZoneRenderItem = ({
|
|
|
10284
10509
|
metadata
|
|
10285
10510
|
}) => {
|
|
10286
10511
|
const Component2 = config.components[item.type];
|
|
10287
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0,
|
|
10288
|
-
const nextContextValue = (0,
|
|
10512
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
10513
|
+
const nextContextValue = (0, import_react69.useMemo)(
|
|
10289
10514
|
() => ({
|
|
10290
10515
|
areaId: props.id,
|
|
10291
10516
|
depth: 1
|
|
@@ -10293,7 +10518,7 @@ var DropZoneRenderItem = ({
|
|
|
10293
10518
|
[props]
|
|
10294
10519
|
);
|
|
10295
10520
|
const richtextProps = useRichtextProps(Component2.fields, props);
|
|
10296
|
-
return /* @__PURE__ */ (0,
|
|
10521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10297
10522
|
Component2.render,
|
|
10298
10523
|
__spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
|
|
10299
10524
|
editor: __spreadProps(__spreadValues({}, props.editor), {
|
|
@@ -10303,15 +10528,15 @@ var DropZoneRenderItem = ({
|
|
|
10303
10528
|
})
|
|
10304
10529
|
) }, props.id);
|
|
10305
10530
|
};
|
|
10306
|
-
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0,
|
|
10307
|
-
var DropZoneRender = (0,
|
|
10531
|
+
var DropZoneRenderPure = (props) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DropZoneRender, __spreadValues({}, props));
|
|
10532
|
+
var DropZoneRender = (0, import_react69.forwardRef)(
|
|
10308
10533
|
function DropZoneRenderInternal({ className, style, zone, as }, ref) {
|
|
10309
|
-
const ctx = (0,
|
|
10534
|
+
const ctx = (0, import_react69.useContext)(dropZoneContext);
|
|
10310
10535
|
const { areaId = "root" } = ctx || {};
|
|
10311
|
-
const { config, data, metadata } = (0,
|
|
10536
|
+
const { config, data, metadata } = (0, import_react69.useContext)(renderContext);
|
|
10312
10537
|
let zoneCompound = `${areaId}:${zone}`;
|
|
10313
10538
|
let content = (data == null ? void 0 : data.content) || [];
|
|
10314
|
-
(0,
|
|
10539
|
+
(0, import_react69.useEffect)(() => {
|
|
10315
10540
|
if (!content) {
|
|
10316
10541
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
|
10317
10542
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
|
@@ -10325,10 +10550,10 @@ var DropZoneRender = (0, import_react68.forwardRef)(
|
|
|
10325
10550
|
if (zoneCompound !== rootDroppableId) {
|
|
10326
10551
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
10327
10552
|
}
|
|
10328
|
-
return /* @__PURE__ */ (0,
|
|
10553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(El, { className, style, ref, children: content.map((item) => {
|
|
10329
10554
|
const Component2 = config.components[item.type];
|
|
10330
10555
|
if (Component2) {
|
|
10331
|
-
return /* @__PURE__ */ (0,
|
|
10556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
10332
10557
|
DropZoneRenderItem,
|
|
10333
10558
|
{
|
|
10334
10559
|
config,
|
|
@@ -10342,14 +10567,14 @@ var DropZoneRender = (0, import_react68.forwardRef)(
|
|
|
10342
10567
|
}) });
|
|
10343
10568
|
}
|
|
10344
10569
|
);
|
|
10345
|
-
var DropZonePure = (props) => /* @__PURE__ */ (0,
|
|
10346
|
-
var DropZone = (0,
|
|
10570
|
+
var DropZonePure = (props) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DropZone, __spreadValues({}, props));
|
|
10571
|
+
var DropZone = (0, import_react69.forwardRef)(
|
|
10347
10572
|
function DropZone2(props, ref) {
|
|
10348
|
-
const ctx = (0,
|
|
10573
|
+
const ctx = (0, import_react69.useContext)(dropZoneContext);
|
|
10349
10574
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
|
10350
|
-
return /* @__PURE__ */ (0,
|
|
10575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_jsx_runtime71.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
10351
10576
|
}
|
|
10352
|
-
return /* @__PURE__ */ (0,
|
|
10577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_jsx_runtime71.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
10353
10578
|
}
|
|
10354
10579
|
);
|
|
10355
10580
|
|
|
@@ -10736,14 +10961,14 @@ function getDeepDir(el) {
|
|
|
10736
10961
|
|
|
10737
10962
|
// components/DragDropContext/index.tsx
|
|
10738
10963
|
var import_state = require("@dnd-kit/state");
|
|
10739
|
-
var
|
|
10964
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
10740
10965
|
var DEBUG3 = false;
|
|
10741
|
-
var dragListenerContext = (0,
|
|
10966
|
+
var dragListenerContext = (0, import_react72.createContext)({
|
|
10742
10967
|
dragListeners: {}
|
|
10743
10968
|
});
|
|
10744
10969
|
function useDragListener(type, fn, deps = []) {
|
|
10745
|
-
const { setDragListeners } = (0,
|
|
10746
|
-
(0,
|
|
10970
|
+
const { setDragListeners } = (0, import_react72.useContext)(dragListenerContext);
|
|
10971
|
+
(0, import_react72.useEffect)(() => {
|
|
10747
10972
|
if (setDragListeners) {
|
|
10748
10973
|
setDragListeners((old) => __spreadProps(__spreadValues({}, old), {
|
|
10749
10974
|
[type]: [...old[type] || [], fn]
|
|
@@ -10753,8 +10978,8 @@ function useDragListener(type, fn, deps = []) {
|
|
|
10753
10978
|
}
|
|
10754
10979
|
var AREA_CHANGE_DEBOUNCE_MS = 100;
|
|
10755
10980
|
var useTempDisableFallback = (timeout3) => {
|
|
10756
|
-
const lastFallbackDisable = (0,
|
|
10757
|
-
return (0,
|
|
10981
|
+
const lastFallbackDisable = (0, import_react72.useRef)(null);
|
|
10982
|
+
return (0, import_react72.useCallback)((manager) => {
|
|
10758
10983
|
collisionStore.setState({ fallbackEnabled: false });
|
|
10759
10984
|
const fallbackId = generateId();
|
|
10760
10985
|
lastFallbackDisable.current = fallbackId;
|
|
@@ -10773,9 +10998,9 @@ var DragDropContextClient = ({
|
|
|
10773
10998
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
10774
10999
|
const instanceId = useAppStore((s) => s.instanceId);
|
|
10775
11000
|
const appStore = useAppStoreApi();
|
|
10776
|
-
const debouncedParamsRef = (0,
|
|
11001
|
+
const debouncedParamsRef = (0, import_react72.useRef)(null);
|
|
10777
11002
|
const tempDisableFallback = useTempDisableFallback(100);
|
|
10778
|
-
const [zoneStore] = (0,
|
|
11003
|
+
const [zoneStore] = (0, import_react72.useState)(() => {
|
|
10779
11004
|
const rootVirtualizers = /* @__PURE__ */ new Map();
|
|
10780
11005
|
return (0, import_zustand6.createStore)(() => ({
|
|
10781
11006
|
zoneDepthIndex: {},
|
|
@@ -10816,7 +11041,7 @@ var DragDropContextClient = ({
|
|
|
10816
11041
|
}
|
|
10817
11042
|
}));
|
|
10818
11043
|
});
|
|
10819
|
-
(0,
|
|
11044
|
+
(0, import_react72.useEffect)(() => {
|
|
10820
11045
|
appStore.setState({
|
|
10821
11046
|
scrollToComponent: (id) => zoneStore.getState().scrollToComponent(id)
|
|
10822
11047
|
});
|
|
@@ -10825,7 +11050,7 @@ var DragDropContextClient = ({
|
|
|
10825
11050
|
} });
|
|
10826
11051
|
};
|
|
10827
11052
|
}, [appStore, zoneStore]);
|
|
10828
|
-
const getChanged2 = (0,
|
|
11053
|
+
const getChanged2 = (0, import_react72.useCallback)(
|
|
10829
11054
|
(params) => {
|
|
10830
11055
|
const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
|
|
10831
11056
|
const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
|
|
@@ -10846,7 +11071,7 @@ var DragDropContextClient = ({
|
|
|
10846
11071
|
},
|
|
10847
11072
|
[zoneStore]
|
|
10848
11073
|
);
|
|
10849
|
-
const setDeepestAndCollide = (0,
|
|
11074
|
+
const setDeepestAndCollide = (0, import_react72.useCallback)(
|
|
10850
11075
|
(params, manager) => {
|
|
10851
11076
|
const { zoneChanged, areaChanged } = getChanged2(params);
|
|
10852
11077
|
if (!zoneChanged && !areaChanged) return;
|
|
@@ -10870,7 +11095,7 @@ var DragDropContextClient = ({
|
|
|
10870
11095
|
setDeepestDb.cancel();
|
|
10871
11096
|
debouncedParamsRef.current = null;
|
|
10872
11097
|
};
|
|
10873
|
-
(0,
|
|
11098
|
+
(0, import_react72.useEffect)(() => {
|
|
10874
11099
|
if (DEBUG3) {
|
|
10875
11100
|
zoneStore.subscribe(
|
|
10876
11101
|
(s) => {
|
|
@@ -10884,7 +11109,7 @@ var DragDropContextClient = ({
|
|
|
10884
11109
|
);
|
|
10885
11110
|
}
|
|
10886
11111
|
}, []);
|
|
10887
|
-
const [plugins] = (0,
|
|
11112
|
+
const [plugins] = (0, import_react72.useState)(() => [
|
|
10888
11113
|
import_dom4.ScrollListener,
|
|
10889
11114
|
import_dom4.Scroller,
|
|
10890
11115
|
...disableAutoScroll ? import_dom4.defaultPreset.plugins.filter((plugin) => plugin !== import_dom4.AutoScroller) : import_dom4.defaultPreset.plugins,
|
|
@@ -10934,10 +11159,10 @@ var DragDropContextClient = ({
|
|
|
10934
11159
|
)
|
|
10935
11160
|
]);
|
|
10936
11161
|
const sensors = useSensors();
|
|
10937
|
-
const [dragListeners, setDragListeners] = (0,
|
|
10938
|
-
const dragMode = (0,
|
|
10939
|
-
const initialSelector = (0,
|
|
10940
|
-
const nextContextValue = (0,
|
|
11162
|
+
const [dragListeners, setDragListeners] = (0, import_react72.useState)({});
|
|
11163
|
+
const dragMode = (0, import_react72.useRef)(null);
|
|
11164
|
+
const initialSelector = (0, import_react72.useRef)(void 0);
|
|
11165
|
+
const nextContextValue = (0, import_react72.useMemo)(
|
|
10941
11166
|
() => ({
|
|
10942
11167
|
mode: "edit",
|
|
10943
11168
|
areaId: "root",
|
|
@@ -10945,15 +11170,15 @@ var DragDropContextClient = ({
|
|
|
10945
11170
|
}),
|
|
10946
11171
|
[]
|
|
10947
11172
|
);
|
|
10948
|
-
return /* @__PURE__ */ (0,
|
|
11173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
10949
11174
|
dragListenerContext.Provider,
|
|
10950
11175
|
{
|
|
10951
11176
|
value: {
|
|
10952
11177
|
dragListeners,
|
|
10953
11178
|
setDragListeners
|
|
10954
11179
|
},
|
|
10955
|
-
children: /* @__PURE__ */ (0,
|
|
10956
|
-
|
|
11180
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
11181
|
+
import_react71.DragDropProvider,
|
|
10957
11182
|
{
|
|
10958
11183
|
plugins,
|
|
10959
11184
|
sensors,
|
|
@@ -11168,7 +11393,7 @@ var DragDropContextClient = ({
|
|
|
11168
11393
|
const entryEl = (_d = getFrame()) == null ? void 0 : _d.querySelector("[data-editor-entry]");
|
|
11169
11394
|
entryEl == null ? void 0 : entryEl.setAttribute("data-editor-dragging", "true");
|
|
11170
11395
|
},
|
|
11171
|
-
children: /* @__PURE__ */ (0,
|
|
11396
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(DropZoneProvider, { value: nextContextValue, children }) })
|
|
11172
11397
|
}
|
|
11173
11398
|
)
|
|
11174
11399
|
}
|
|
@@ -11182,14 +11407,14 @@ var DragDropContext = ({
|
|
|
11182
11407
|
if (status === "LOADING") {
|
|
11183
11408
|
return children;
|
|
11184
11409
|
}
|
|
11185
|
-
return /* @__PURE__ */ (0,
|
|
11410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(DragDropContextClient, { disableAutoScroll, children });
|
|
11186
11411
|
};
|
|
11187
11412
|
|
|
11188
11413
|
// components/Drawer/index.tsx
|
|
11189
|
-
var
|
|
11190
|
-
var
|
|
11191
|
-
var
|
|
11192
|
-
var getClassNameItem2 = get_class_name_factory_default("DrawerItem",
|
|
11414
|
+
var import_react74 = require("@dnd-kit/react");
|
|
11415
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
11416
|
+
var getClassName28 = get_class_name_factory_default("Drawer", styles_module_default18);
|
|
11417
|
+
var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default18);
|
|
11193
11418
|
var DrawerItemInner = ({
|
|
11194
11419
|
children,
|
|
11195
11420
|
name,
|
|
@@ -11198,11 +11423,11 @@ var DrawerItemInner = ({
|
|
|
11198
11423
|
dragRef,
|
|
11199
11424
|
isDragDisabled
|
|
11200
11425
|
}) => {
|
|
11201
|
-
const CustomInner = (0,
|
|
11202
|
-
() => children || (({ children: children2 }) => /* @__PURE__ */ (0,
|
|
11426
|
+
const CustomInner = (0, import_react73.useMemo)(
|
|
11427
|
+
() => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
|
|
11203
11428
|
[children]
|
|
11204
11429
|
);
|
|
11205
|
-
return /* @__PURE__ */ (0,
|
|
11430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11206
11431
|
"div",
|
|
11207
11432
|
{
|
|
11208
11433
|
className: getClassNameItem2({ disabled: isDragDisabled }),
|
|
@@ -11210,9 +11435,9 @@ var DrawerItemInner = ({
|
|
|
11210
11435
|
onMouseDown: (e) => e.preventDefault(),
|
|
11211
11436
|
"data-testid": dragRef ? `drawer-item:${name}` : "",
|
|
11212
11437
|
"data-editor-drawer-item": true,
|
|
11213
|
-
children: /* @__PURE__ */ (0,
|
|
11214
|
-
icon && /* @__PURE__ */ (0,
|
|
11215
|
-
/* @__PURE__ */ (0,
|
|
11438
|
+
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: [
|
|
11439
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassNameItem2("icon"), children: icon }),
|
|
11440
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name })
|
|
11216
11441
|
] }) }) })
|
|
11217
11442
|
}
|
|
11218
11443
|
);
|
|
@@ -11225,15 +11450,15 @@ var DrawerItemDraggable = ({
|
|
|
11225
11450
|
id,
|
|
11226
11451
|
isDragDisabled
|
|
11227
11452
|
}) => {
|
|
11228
|
-
const { ref } = (0,
|
|
11453
|
+
const { ref } = (0, import_react74.useDraggable)({
|
|
11229
11454
|
id,
|
|
11230
11455
|
data: { componentType: name },
|
|
11231
11456
|
disabled: isDragDisabled,
|
|
11232
11457
|
type: "drawer"
|
|
11233
11458
|
});
|
|
11234
|
-
return /* @__PURE__ */ (0,
|
|
11235
|
-
/* @__PURE__ */ (0,
|
|
11236
|
-
/* @__PURE__ */ (0,
|
|
11459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: getClassName28("draggable"), children: [
|
|
11460
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassName28("draggableBg"), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DrawerItemInner, { name, label, icon, children }) }),
|
|
11461
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: getClassName28("draggableFg"), children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11237
11462
|
DrawerItemInner,
|
|
11238
11463
|
{
|
|
11239
11464
|
name,
|
|
@@ -11256,7 +11481,7 @@ var DrawerItem = ({
|
|
|
11256
11481
|
isDragDisabled
|
|
11257
11482
|
}) => {
|
|
11258
11483
|
const resolvedId = id || name;
|
|
11259
|
-
const [dynamicId, setDynamicId] = (0,
|
|
11484
|
+
const [dynamicId, setDynamicId] = (0, import_react73.useState)(generateId(resolvedId));
|
|
11260
11485
|
if (typeof index !== "undefined") {
|
|
11261
11486
|
console.error(
|
|
11262
11487
|
"Warning: The `index` prop on Drawer.Item is deprecated and no longer required."
|
|
@@ -11266,340 +11491,129 @@ var DrawerItem = ({
|
|
|
11266
11491
|
"dragend",
|
|
11267
11492
|
() => {
|
|
11268
11493
|
setDynamicId(generateId(resolvedId));
|
|
11269
|
-
},
|
|
11270
|
-
[resolvedId]
|
|
11271
|
-
);
|
|
11272
|
-
return /* @__PURE__ */ (0,
|
|
11273
|
-
DrawerItemDraggable,
|
|
11274
|
-
{
|
|
11275
|
-
name,
|
|
11276
|
-
label,
|
|
11277
|
-
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,
|
|
11494
|
+
},
|
|
11495
|
+
[resolvedId]
|
|
11496
|
+
);
|
|
11497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11498
|
+
DrawerItemDraggable,
|
|
11502
11499
|
{
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
|
|
11500
|
+
name,
|
|
11501
|
+
label,
|
|
11502
|
+
icon,
|
|
11503
|
+
id: dynamicId,
|
|
11504
|
+
isDragDisabled,
|
|
11505
|
+
children
|
|
11508
11506
|
}
|
|
11509
|
-
) },
|
|
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 }) });
|
|
11507
|
+
) }, dynamicId);
|
|
11519
11508
|
};
|
|
11520
|
-
var
|
|
11521
|
-
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
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"
|
|
11509
|
+
var Drawer = ({
|
|
11510
|
+
children,
|
|
11511
|
+
droppableId,
|
|
11512
|
+
direction,
|
|
11513
|
+
variant = "list"
|
|
11514
|
+
}) => {
|
|
11515
|
+
if (droppableId) {
|
|
11516
|
+
console.error(
|
|
11517
|
+
"Warning: The `droppableId` prop on Drawer is deprecated and no longer required."
|
|
11539
11518
|
);
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11519
|
+
}
|
|
11520
|
+
if (direction) {
|
|
11521
|
+
console.error(
|
|
11522
|
+
"Warning: The `direction` prop on Drawer is deprecated and no longer required to achieve multi-directional dragging."
|
|
11523
|
+
);
|
|
11524
|
+
}
|
|
11525
|
+
const id = useSafeId();
|
|
11526
|
+
const { ref } = (0, import_react74.useDroppable)({
|
|
11527
|
+
id,
|
|
11528
|
+
type: "void",
|
|
11529
|
+
collisionPriority: 0
|
|
11530
|
+
// Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
|
|
11546
11531
|
});
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
|
|
11553
|
-
|
|
11554
|
-
|
|
11532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
11533
|
+
"div",
|
|
11534
|
+
{
|
|
11535
|
+
className: getClassName28({ [variant]: variant }),
|
|
11536
|
+
ref,
|
|
11537
|
+
"data-editor-dnd": id,
|
|
11538
|
+
"data-editor-drawer": true,
|
|
11539
|
+
"data-editor-dnd-void": true,
|
|
11540
|
+
children
|
|
11541
|
+
}
|
|
11542
|
+
);
|
|
11555
11543
|
};
|
|
11556
|
-
|
|
11544
|
+
Drawer.Item = DrawerItem;
|
|
11545
|
+
|
|
11546
|
+
// components/ComponentList/index.tsx
|
|
11547
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
11548
|
+
var getClassName29 = get_class_name_factory_default("ComponentList", styles_module_default17);
|
|
11549
|
+
var ComponentListItem = ({
|
|
11550
|
+
name,
|
|
11551
|
+
label,
|
|
11552
|
+
icon
|
|
11553
|
+
}) => {
|
|
11554
|
+
var _a;
|
|
11557
11555
|
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
|
-
})
|
|
11556
|
+
const canInsert = useAppStore(
|
|
11557
|
+
(s) => s.permissions.getPermissions({
|
|
11558
|
+
type: name
|
|
11559
|
+
}).insert
|
|
11578
11560
|
);
|
|
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
|
-
]
|
|
11561
|
+
(0, import_react75.useEffect)(() => {
|
|
11562
|
+
if (overrides.componentItem) {
|
|
11563
|
+
console.warn(
|
|
11564
|
+
"The `componentItem` override has been deprecated and renamed to `drawerItem`"
|
|
11565
|
+
);
|
|
11595
11566
|
}
|
|
11596
|
-
);
|
|
11567
|
+
}, [overrides]);
|
|
11568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Drawer.Item, { label, name, icon, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
|
|
11569
|
+
};
|
|
11570
|
+
var ComponentList = ({
|
|
11571
|
+
children,
|
|
11572
|
+
title,
|
|
11573
|
+
id
|
|
11574
|
+
}) => {
|
|
11575
|
+
const config = useAppStore((s) => s.config);
|
|
11576
|
+
const setUi = useAppStore((s) => s.setUi);
|
|
11577
|
+
const componentList = useAppStore((s) => s.state.ui.componentList);
|
|
11578
|
+
const { expanded = true } = componentList[id] || {};
|
|
11579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: getClassName29({ isExpanded: expanded }), children: [
|
|
11580
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
11581
|
+
"button",
|
|
11582
|
+
{
|
|
11583
|
+
type: "button",
|
|
11584
|
+
className: getClassName29("title"),
|
|
11585
|
+
onClick: () => setUi({
|
|
11586
|
+
componentList: __spreadProps(__spreadValues({}, componentList), {
|
|
11587
|
+
[id]: __spreadProps(__spreadValues({}, componentList[id]), {
|
|
11588
|
+
expanded: !expanded
|
|
11589
|
+
})
|
|
11590
|
+
})
|
|
11591
|
+
}),
|
|
11592
|
+
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
|
11593
|
+
children: [
|
|
11594
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: getClassName29("titleIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ChevronRight, { size: 12 }) }),
|
|
11595
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { children: title })
|
|
11596
|
+
]
|
|
11597
|
+
}
|
|
11598
|
+
),
|
|
11599
|
+
/* @__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) => {
|
|
11600
|
+
var _a;
|
|
11601
|
+
const componentConf = config.components[componentKey] || {};
|
|
11602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
11603
|
+
ComponentListItem,
|
|
11604
|
+
{
|
|
11605
|
+
label: (_a = componentConf["label"]) != null ? _a : componentKey,
|
|
11606
|
+
icon: componentConf["icon"],
|
|
11607
|
+
name: componentKey
|
|
11608
|
+
},
|
|
11609
|
+
componentKey
|
|
11610
|
+
);
|
|
11611
|
+
}) }) })
|
|
11612
|
+
] });
|
|
11597
11613
|
};
|
|
11598
|
-
|
|
11614
|
+
ComponentList.Item = ComponentListItem;
|
|
11599
11615
|
|
|
11600
11616
|
// components/Editor/components/Components/index.tsx
|
|
11601
|
-
init_react_import();
|
|
11602
|
-
init_store();
|
|
11603
11617
|
var import_react76 = require("react");
|
|
11604
11618
|
init_lucide_react();
|
|
11605
11619
|
|
|
@@ -13297,7 +13311,7 @@ var DEVICE_VIEWPORTS = {
|
|
|
13297
13311
|
var BrowserBar = ({
|
|
13298
13312
|
onViewportChange
|
|
13299
13313
|
}) => {
|
|
13300
|
-
const { routes,
|
|
13314
|
+
const { routes, currentRoute, onRouteChange } = usePropsContext();
|
|
13301
13315
|
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
13302
13316
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
13303
13317
|
const leftSideBarVisible = useAppStore((s) => s.state.ui.leftSideBarVisible);
|
|
@@ -13323,24 +13337,24 @@ var BrowserBar = ({
|
|
|
13323
13337
|
const setDevice = (device) => {
|
|
13324
13338
|
onViewportChange == null ? void 0 : onViewportChange(DEVICE_VIEWPORTS[device]);
|
|
13325
13339
|
};
|
|
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(
|
|
13340
|
+
const showRoutePicker = !!routes && currentRoute !== void 0 && !!onRouteChange;
|
|
13341
|
+
const [inputValue, setInputValue] = (0, import_react87.useState)(currentRoute != null ? currentRoute : "");
|
|
13342
|
+
const lastSyncedPath = (0, import_react87.useRef)(currentRoute);
|
|
13343
|
+
if (lastSyncedPath.current !== currentRoute) {
|
|
13344
|
+
lastSyncedPath.current = currentRoute;
|
|
13345
|
+
setInputValue(currentRoute != null ? currentRoute : "");
|
|
13332
13346
|
}
|
|
13333
13347
|
const submit = (raw) => {
|
|
13334
13348
|
const next = normalizeRoute(raw);
|
|
13335
|
-
if (!next || next ===
|
|
13349
|
+
if (!next || next === currentRoute) return;
|
|
13336
13350
|
void (onRouteChange == null ? void 0 : onRouteChange(next));
|
|
13337
13351
|
};
|
|
13338
13352
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: getClassName36(), children: [
|
|
13339
13353
|
showRoutePicker ? /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
13340
13354
|
Combobox,
|
|
13341
13355
|
{
|
|
13342
|
-
items: routes
|
|
13343
|
-
value:
|
|
13356
|
+
items: routes,
|
|
13357
|
+
value: currentRoute,
|
|
13344
13358
|
onValueChange: (next) => {
|
|
13345
13359
|
if (typeof next === "string") submit(next);
|
|
13346
13360
|
},
|
|
@@ -13373,13 +13387,7 @@ var BrowserBar = ({
|
|
|
13373
13387
|
),
|
|
13374
13388
|
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(ComboboxContent, { children: [
|
|
13375
13389
|
/* @__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
|
-
} })
|
|
13390
|
+
/* @__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
13391
|
] })
|
|
13384
13392
|
]
|
|
13385
13393
|
}
|
|
@@ -14174,7 +14182,7 @@ var getLayoutClassName = get_class_name_factory_default("EditorLayout", styles_m
|
|
|
14174
14182
|
var getPluginTabClassName = get_class_name_factory_default("EditorPluginTab", styles_module_default25);
|
|
14175
14183
|
var FieldSideBarToolbar = () => {
|
|
14176
14184
|
const appStore = useAppStoreApi();
|
|
14177
|
-
const { onPublish } = usePropsContext();
|
|
14185
|
+
const { onPublish, currentRoute } = usePropsContext();
|
|
14178
14186
|
const back = useAppStore((s) => s.history.back);
|
|
14179
14187
|
const forward = useAppStore((s) => s.history.forward);
|
|
14180
14188
|
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
|
@@ -14210,7 +14218,7 @@ var FieldSideBarToolbar = () => {
|
|
|
14210
14218
|
{
|
|
14211
14219
|
onClick: () => {
|
|
14212
14220
|
const data = appStore.getState().state.data;
|
|
14213
|
-
onPublish && onPublish(data);
|
|
14221
|
+
onPublish && onPublish(data, currentRoute);
|
|
14214
14222
|
},
|
|
14215
14223
|
children: "Publish"
|
|
14216
14224
|
}
|
|
@@ -14791,9 +14799,320 @@ Editor4.Layout = Layout;
|
|
|
14791
14799
|
Editor4.Outline = Outline;
|
|
14792
14800
|
Editor4.Preview = Preview2;
|
|
14793
14801
|
|
|
14802
|
+
// components/App/AppProvider.tsx
|
|
14803
|
+
init_react_import();
|
|
14804
|
+
var import_react98 = require("react");
|
|
14805
|
+
var import_react_router2 = require("react-router");
|
|
14806
|
+
|
|
14807
|
+
// lib/use-stable-value.ts
|
|
14808
|
+
init_react_import();
|
|
14809
|
+
var import_react96 = require("react");
|
|
14810
|
+
var import_fast_equals5 = require("fast-equals");
|
|
14811
|
+
var useStableValue = (value) => {
|
|
14812
|
+
const ref = (0, import_react96.useRef)(value);
|
|
14813
|
+
if (!(0, import_fast_equals5.deepEqual)(ref.current, value)) {
|
|
14814
|
+
ref.current = value;
|
|
14815
|
+
}
|
|
14816
|
+
return ref.current;
|
|
14817
|
+
};
|
|
14818
|
+
|
|
14819
|
+
// components/App/context.ts
|
|
14820
|
+
init_react_import();
|
|
14821
|
+
var import_react97 = require("react");
|
|
14822
|
+
var import_react_router = require("react-router");
|
|
14823
|
+
var appConfigContext = (0, import_react97.createContext)(null);
|
|
14824
|
+
var useAppConfigContext = () => {
|
|
14825
|
+
const ctx = (0, import_react97.useContext)(appConfigContext);
|
|
14826
|
+
if (!ctx) {
|
|
14827
|
+
throw new Error("useApp must be called inside an <AppProvider> or <App>");
|
|
14828
|
+
}
|
|
14829
|
+
return ctx;
|
|
14830
|
+
};
|
|
14831
|
+
var stripPrefix = (path, prefix2) => {
|
|
14832
|
+
if (path === prefix2) return "/";
|
|
14833
|
+
if (!path.startsWith(`${prefix2}/`)) return path;
|
|
14834
|
+
const rest = path.slice(prefix2.length);
|
|
14835
|
+
return rest.startsWith("/") ? rest : `/${rest}`;
|
|
14836
|
+
};
|
|
14837
|
+
var useApp = () => {
|
|
14838
|
+
const cfg = useAppConfigContext();
|
|
14839
|
+
const location = (0, import_react_router.useLocation)();
|
|
14840
|
+
const rrNavigate = (0, import_react_router.useNavigate)();
|
|
14841
|
+
const currentPath = location.pathname || "/";
|
|
14842
|
+
const isEditing = cfg.editorPath !== null && (currentPath === cfg.editorPath || currentPath.startsWith(`${cfg.editorPath}/`));
|
|
14843
|
+
const matchRoute = isEditing ? stripPrefix(currentPath, cfg.editorPath) : currentPath;
|
|
14844
|
+
const matched = (0, import_react97.useMemo)(() => {
|
|
14845
|
+
const routeKeys = Object.keys(cfg.pages);
|
|
14846
|
+
if (routeKeys.length === 0) return null;
|
|
14847
|
+
const matches = (0, import_react_router.matchRoutes)(
|
|
14848
|
+
routeKeys.map((path) => ({ path })),
|
|
14849
|
+
matchRoute
|
|
14850
|
+
);
|
|
14851
|
+
if (!matches || matches.length === 0) return null;
|
|
14852
|
+
const last = matches[matches.length - 1];
|
|
14853
|
+
const key = last.route.path;
|
|
14854
|
+
return {
|
|
14855
|
+
route: key,
|
|
14856
|
+
params: last.params,
|
|
14857
|
+
data: cfg.pages[key]
|
|
14858
|
+
};
|
|
14859
|
+
}, [cfg.pages, matchRoute]);
|
|
14860
|
+
const routes = (0, import_react97.useMemo)(() => Object.keys(cfg.pages), [cfg.pages]);
|
|
14861
|
+
const navigate = (route) => {
|
|
14862
|
+
const target = isEditing && cfg.editorPath ? `${cfg.editorPath}${route === "/" ? "" : route}` || "/" : route;
|
|
14863
|
+
rrNavigate(target || "/");
|
|
14864
|
+
};
|
|
14865
|
+
return __spreadProps(__spreadValues({}, cfg), {
|
|
14866
|
+
routes,
|
|
14867
|
+
currentPath,
|
|
14868
|
+
isEditing,
|
|
14869
|
+
matchRoute,
|
|
14870
|
+
matched,
|
|
14871
|
+
navigate
|
|
14872
|
+
});
|
|
14873
|
+
};
|
|
14874
|
+
|
|
14875
|
+
// components/App/AppProvider.tsx
|
|
14876
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
14877
|
+
var EDITOR_PATH = "/editor";
|
|
14878
|
+
var isServer = typeof window === "undefined";
|
|
14879
|
+
function AppProvider({
|
|
14880
|
+
config,
|
|
14881
|
+
pages,
|
|
14882
|
+
editorPath = EDITOR_PATH,
|
|
14883
|
+
router = "browser",
|
|
14884
|
+
currentPath,
|
|
14885
|
+
children
|
|
14886
|
+
}) {
|
|
14887
|
+
const stablePages = useStableValue(pages);
|
|
14888
|
+
const resolvedEditorPath = editorPath === null ? null : editorPath || EDITOR_PATH;
|
|
14889
|
+
const ctxValue = (0, import_react98.useMemo)(
|
|
14890
|
+
() => ({
|
|
14891
|
+
config,
|
|
14892
|
+
pages: stablePages,
|
|
14893
|
+
editorPath: resolvedEditorPath
|
|
14894
|
+
}),
|
|
14895
|
+
[config, stablePages, resolvedEditorPath]
|
|
14896
|
+
);
|
|
14897
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(appConfigContext.Provider, { value: ctxValue, children });
|
|
14898
|
+
if (isServer) {
|
|
14899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react_router2.StaticRouter, { location: currentPath != null ? currentPath : "/", children: inner });
|
|
14900
|
+
}
|
|
14901
|
+
if (router === "hash") {
|
|
14902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react_router2.HashRouter, { children: inner });
|
|
14903
|
+
}
|
|
14904
|
+
if (router === "memory") {
|
|
14905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react_router2.MemoryRouter, { initialEntries: [currentPath != null ? currentPath : "/"], children: inner });
|
|
14906
|
+
}
|
|
14907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react_router2.BrowserRouter, { children: inner });
|
|
14908
|
+
}
|
|
14909
|
+
|
|
14910
|
+
// components/App/App.tsx
|
|
14911
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
14912
|
+
var joinEditorPath = (editorPath, route) => {
|
|
14913
|
+
if (route === "/") return editorPath;
|
|
14914
|
+
return `${editorPath}${route}`;
|
|
14915
|
+
};
|
|
14916
|
+
var DefaultNotFound = () => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
14917
|
+
"div",
|
|
14918
|
+
{
|
|
14919
|
+
style: {
|
|
14920
|
+
display: "flex",
|
|
14921
|
+
height: "100vh",
|
|
14922
|
+
textAlign: "center",
|
|
14923
|
+
justifyContent: "center",
|
|
14924
|
+
alignItems: "center"
|
|
14925
|
+
},
|
|
14926
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)("div", { children: [
|
|
14927
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("h1", { children: "404" }),
|
|
14928
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)("p", { children: "No page matches this route." })
|
|
14929
|
+
] })
|
|
14930
|
+
}
|
|
14931
|
+
);
|
|
14932
|
+
function RenderRoute({
|
|
14933
|
+
routeKey,
|
|
14934
|
+
metadata
|
|
14935
|
+
}) {
|
|
14936
|
+
const { config, pages } = useApp();
|
|
14937
|
+
const data = pages[routeKey];
|
|
14938
|
+
if (!data) return null;
|
|
14939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
14940
|
+
Render,
|
|
14941
|
+
{
|
|
14942
|
+
config,
|
|
14943
|
+
data,
|
|
14944
|
+
metadata
|
|
14945
|
+
},
|
|
14946
|
+
routeKey
|
|
14947
|
+
);
|
|
14948
|
+
}
|
|
14949
|
+
function EditorRouteRender({
|
|
14950
|
+
routeKey,
|
|
14951
|
+
layoutProps
|
|
14952
|
+
}) {
|
|
14953
|
+
const {
|
|
14954
|
+
onPublish,
|
|
14955
|
+
onChange,
|
|
14956
|
+
plugins,
|
|
14957
|
+
overrides,
|
|
14958
|
+
fieldTransforms,
|
|
14959
|
+
metadata,
|
|
14960
|
+
iframe,
|
|
14961
|
+
viewports,
|
|
14962
|
+
permissions
|
|
14963
|
+
} = layoutProps;
|
|
14964
|
+
const { config, pages, routes, navigate } = useApp();
|
|
14965
|
+
const data = pages[routeKey];
|
|
14966
|
+
if (!data) return null;
|
|
14967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
14968
|
+
Editor4,
|
|
14969
|
+
{
|
|
14970
|
+
config,
|
|
14971
|
+
data,
|
|
14972
|
+
plugins,
|
|
14973
|
+
overrides,
|
|
14974
|
+
fieldTransforms,
|
|
14975
|
+
metadata,
|
|
14976
|
+
iframe,
|
|
14977
|
+
viewports,
|
|
14978
|
+
permissions,
|
|
14979
|
+
onChange,
|
|
14980
|
+
onPublish,
|
|
14981
|
+
routes,
|
|
14982
|
+
currentRoute: routeKey,
|
|
14983
|
+
onRouteChange: (next) => navigate(next)
|
|
14984
|
+
},
|
|
14985
|
+
routeKey
|
|
14986
|
+
);
|
|
14987
|
+
}
|
|
14988
|
+
function NotFoundRoute({
|
|
14989
|
+
renderNotFound
|
|
14990
|
+
}) {
|
|
14991
|
+
return renderNotFound ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_jsx_runtime96.Fragment, { children: renderNotFound() }) : /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(DefaultNotFound, {});
|
|
14992
|
+
}
|
|
14993
|
+
function AppLayout(layoutProps) {
|
|
14994
|
+
const { pages, editorPath } = useApp();
|
|
14995
|
+
const renderRoutes = Object.keys(pages);
|
|
14996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_react_router3.Routes, { children: [
|
|
14997
|
+
renderRoutes.map((routeKey) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
14998
|
+
import_react_router3.Route,
|
|
14999
|
+
{
|
|
15000
|
+
path: routeKey,
|
|
15001
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
15002
|
+
RenderRoute,
|
|
15003
|
+
{
|
|
15004
|
+
routeKey,
|
|
15005
|
+
metadata: layoutProps.metadata
|
|
15006
|
+
}
|
|
15007
|
+
)
|
|
15008
|
+
},
|
|
15009
|
+
`render:${routeKey}`
|
|
15010
|
+
)),
|
|
15011
|
+
editorPath !== null && renderRoutes.map((routeKey) => /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
15012
|
+
import_react_router3.Route,
|
|
15013
|
+
{
|
|
15014
|
+
path: joinEditorPath(editorPath, routeKey),
|
|
15015
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
15016
|
+
EditorRouteRender,
|
|
15017
|
+
{
|
|
15018
|
+
routeKey,
|
|
15019
|
+
layoutProps
|
|
15020
|
+
}
|
|
15021
|
+
)
|
|
15022
|
+
},
|
|
15023
|
+
`edit:${routeKey}`
|
|
15024
|
+
)),
|
|
15025
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
15026
|
+
import_react_router3.Route,
|
|
15027
|
+
{
|
|
15028
|
+
path: "*",
|
|
15029
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(NotFoundRoute, { renderNotFound: layoutProps.renderNotFound })
|
|
15030
|
+
}
|
|
15031
|
+
)
|
|
15032
|
+
] });
|
|
15033
|
+
}
|
|
15034
|
+
function App(props) {
|
|
15035
|
+
const _a = props, {
|
|
15036
|
+
config,
|
|
15037
|
+
pages,
|
|
15038
|
+
currentPath,
|
|
15039
|
+
editorPath,
|
|
15040
|
+
router,
|
|
15041
|
+
children
|
|
15042
|
+
} = _a, layoutProps = __objRest(_a, [
|
|
15043
|
+
"config",
|
|
15044
|
+
"pages",
|
|
15045
|
+
"currentPath",
|
|
15046
|
+
"editorPath",
|
|
15047
|
+
"router",
|
|
15048
|
+
"children"
|
|
15049
|
+
]);
|
|
15050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
15051
|
+
AppProvider,
|
|
15052
|
+
{
|
|
15053
|
+
config,
|
|
15054
|
+
pages,
|
|
15055
|
+
currentPath,
|
|
15056
|
+
editorPath,
|
|
15057
|
+
router,
|
|
15058
|
+
children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(AppLayout, __spreadValues({}, layoutProps))
|
|
15059
|
+
}
|
|
15060
|
+
);
|
|
15061
|
+
}
|
|
15062
|
+
|
|
15063
|
+
// components/App/use-route-params.ts
|
|
15064
|
+
init_react_import();
|
|
15065
|
+
var import_react_router4 = require("react-router");
|
|
15066
|
+
var useRouteParams = import_react_router4.useParams;
|
|
15067
|
+
|
|
14794
15068
|
// bundle/core.ts
|
|
15069
|
+
init_IconButton2();
|
|
14795
15070
|
init_inner();
|
|
14796
15071
|
|
|
15072
|
+
// lib/get-route-props.ts
|
|
15073
|
+
init_react_import();
|
|
15074
|
+
var import_react_router5 = require("react-router");
|
|
15075
|
+
var DEFAULT_EDITOR_PATH = "/editor";
|
|
15076
|
+
var stripEditorPrefix = (currentRoute, editorPath) => {
|
|
15077
|
+
if (!editorPath) return currentRoute;
|
|
15078
|
+
if (currentRoute === editorPath) return "/";
|
|
15079
|
+
if (!currentRoute.startsWith(`${editorPath}/`)) return currentRoute;
|
|
15080
|
+
const rest = currentRoute.slice(editorPath.length);
|
|
15081
|
+
return rest.startsWith("/") ? rest : `/${rest}`;
|
|
15082
|
+
};
|
|
15083
|
+
var findMatch = (pages, pathname) => {
|
|
15084
|
+
const keys = Object.keys(pages);
|
|
15085
|
+
if (keys.length === 0) return null;
|
|
15086
|
+
const matches = (0, import_react_router5.matchRoutes)(
|
|
15087
|
+
keys.map((path) => ({ path })),
|
|
15088
|
+
pathname
|
|
15089
|
+
);
|
|
15090
|
+
if (!matches || matches.length === 0) return null;
|
|
15091
|
+
const last = matches[matches.length - 1];
|
|
15092
|
+
const key = last.route.path;
|
|
15093
|
+
return { route: key, params: last.params, data: pages[key] };
|
|
15094
|
+
};
|
|
15095
|
+
var getRouteProps = (pages, currentRoute, options = {}) => {
|
|
15096
|
+
var _a, _b;
|
|
15097
|
+
const editorPath = options.editorPath === void 0 ? DEFAULT_EDITOR_PATH : options.editorPath;
|
|
15098
|
+
const matchRoute = stripEditorPrefix(currentRoute || "/", editorPath);
|
|
15099
|
+
const match = findMatch(pages, matchRoute);
|
|
15100
|
+
if (!match) return null;
|
|
15101
|
+
const props = (_b = (_a = match.data) == null ? void 0 : _a.root) == null ? void 0 : _b.props;
|
|
15102
|
+
return props != null ? props : null;
|
|
15103
|
+
};
|
|
15104
|
+
var resolveRouteFromString = (pages, currentRoute, options = {}) => {
|
|
15105
|
+
const editorPath = options.editorPath === void 0 ? DEFAULT_EDITOR_PATH : options.editorPath;
|
|
15106
|
+
const matchRoute = stripEditorPrefix(currentRoute || "/", editorPath);
|
|
15107
|
+
const match = findMatch(pages, matchRoute);
|
|
15108
|
+
if (!match) return null;
|
|
15109
|
+
return {
|
|
15110
|
+
route: match.route,
|
|
15111
|
+
data: match.data,
|
|
15112
|
+
params: match.params
|
|
15113
|
+
};
|
|
15114
|
+
};
|
|
15115
|
+
|
|
14797
15116
|
// lib/migrate.ts
|
|
14798
15117
|
init_react_import();
|
|
14799
15118
|
init_default_app_state();
|
|
@@ -15069,18 +15388,20 @@ init_walk_tree();
|
|
|
15069
15388
|
|
|
15070
15389
|
// plugins/legacy-side-bar/index.tsx
|
|
15071
15390
|
init_react_import();
|
|
15072
|
-
var
|
|
15391
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
15073
15392
|
var legacySideBarPlugin = () => ({
|
|
15074
15393
|
name: "legacy-side-bar",
|
|
15075
|
-
render: () => /* @__PURE__ */ (0,
|
|
15076
|
-
/* @__PURE__ */ (0,
|
|
15077
|
-
/* @__PURE__ */ (0,
|
|
15394
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { style: { overflowY: "auto" }, children: [
|
|
15395
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Components, {}) }),
|
|
15396
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Outline, {}) })
|
|
15078
15397
|
] })
|
|
15079
15398
|
});
|
|
15080
15399
|
// Annotate the CommonJS export names for ESM import in node:
|
|
15081
15400
|
0 && (module.exports = {
|
|
15082
15401
|
Action,
|
|
15083
15402
|
ActionBar,
|
|
15403
|
+
App,
|
|
15404
|
+
AppProvider,
|
|
15084
15405
|
AutoField,
|
|
15085
15406
|
Button,
|
|
15086
15407
|
ComponentList,
|
|
@@ -15093,9 +15414,11 @@ var legacySideBarPlugin = () => ({
|
|
|
15093
15414
|
Render,
|
|
15094
15415
|
RichTextMenu,
|
|
15095
15416
|
Separator,
|
|
15417
|
+
appConfigContext,
|
|
15096
15418
|
blocksPlugin,
|
|
15097
15419
|
createUseEditor,
|
|
15098
15420
|
fieldsPlugin,
|
|
15421
|
+
getRouteProps,
|
|
15099
15422
|
legacySideBarPlugin,
|
|
15100
15423
|
migrate,
|
|
15101
15424
|
outlinePlugin,
|
|
@@ -15104,11 +15427,15 @@ var legacySideBarPlugin = () => ({
|
|
|
15104
15427
|
registerOverlayPortal,
|
|
15105
15428
|
renderContext,
|
|
15106
15429
|
resolveAllData,
|
|
15430
|
+
resolveRouteFromString,
|
|
15107
15431
|
setDeep,
|
|
15108
15432
|
transformProps,
|
|
15433
|
+
useApp,
|
|
15109
15434
|
useEditor,
|
|
15110
15435
|
useGetEditor,
|
|
15111
15436
|
usePropsContext,
|
|
15437
|
+
useRouteParams,
|
|
15438
|
+
useStableValue,
|
|
15112
15439
|
walkTree
|
|
15113
15440
|
});
|
|
15114
15441
|
/*! Bundled license information:
|