@reacteditor/core 0.0.14 → 0.0.15
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-J7XDD77B.mjs → Editor-7UIJWCPN.mjs} +7 -7
- package/dist/{chunk-4L7H4JV4.mjs → chunk-3CGBQNX4.mjs} +1 -1
- package/dist/{chunk-5QKQ3LQJ.mjs → chunk-647NZJYM.mjs} +3 -3
- package/dist/{chunk-RQZQMS6E.mjs → chunk-C2KWANIN.mjs} +1 -1
- package/dist/{chunk-TG2KTWSB.mjs → chunk-GIGXMGTZ.mjs} +1 -1
- package/dist/{chunk-RGC274VM.mjs → chunk-NKHR722W.mjs} +1 -1
- package/dist/{chunk-FTVOCMGV.mjs → chunk-NPC7A3V3.mjs} +3 -13
- package/dist/{chunk-IFFNAAXW.mjs → chunk-RAMNEU3M.mjs} +1037 -1320
- package/dist/{chunk-JHURG5NN.mjs → chunk-T43H325W.mjs} +21 -122
- package/dist/{chunk-Q667J2EG.mjs → chunk-TFAZFGYZ.mjs} +7 -7
- package/dist/{full-T5SGODJ2.mjs → full-PM3VSLYA.mjs} +6 -6
- package/dist/index.css +411 -524
- package/dist/index.js +834 -1240
- package/dist/index.mjs +9 -9
- package/dist/{loaded-DUBT6SP5.mjs → loaded-5MUU76TF.mjs} +3 -3
- package/dist/{loaded-6YKSFCCD.mjs → loaded-IIHO4UZS.mjs} +3 -3
- package/dist/{loaded-ZQCRSG65.mjs → loaded-ULJY3YN5.mjs} +3 -3
- package/dist/no-external.css +411 -524
- package/dist/no-external.js +834 -1240
- package/dist/no-external.mjs +9 -9
- package/dist/rsc.js +3 -14
- package/dist/rsc.mjs +2 -2
- package/package.json +2 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EditorInner,
|
|
3
3
|
LoadedRichTextMenu
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-647NZJYM.mjs";
|
|
5
5
|
import {
|
|
6
6
|
ActionBar,
|
|
7
7
|
IconButton,
|
|
8
8
|
LoadedRichTextMenuInner,
|
|
9
9
|
Loader
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TFAZFGYZ.mjs";
|
|
11
11
|
import {
|
|
12
12
|
RichTextRenderFallback,
|
|
13
13
|
SlotRender,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
getSlotTransform,
|
|
17
17
|
useRichtextProps,
|
|
18
18
|
useSlots
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-3CGBQNX4.mjs";
|
|
20
20
|
import {
|
|
21
21
|
Check,
|
|
22
22
|
ChevronDown,
|
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
SlidersHorizontal,
|
|
43
43
|
Smartphone,
|
|
44
44
|
Sun,
|
|
45
|
+
Tablet,
|
|
45
46
|
ToyBrick,
|
|
46
47
|
Trash,
|
|
47
48
|
Undo2,
|
|
@@ -49,7 +50,7 @@ import {
|
|
|
49
50
|
X,
|
|
50
51
|
appStoreContext,
|
|
51
52
|
createAppStore,
|
|
52
|
-
|
|
53
|
+
defaultViewports,
|
|
53
54
|
monitorHotkeys,
|
|
54
55
|
reorder,
|
|
55
56
|
replace,
|
|
@@ -60,7 +61,7 @@ import {
|
|
|
60
61
|
useRegisterFieldsSlice,
|
|
61
62
|
useRegisterHistorySlice,
|
|
62
63
|
useRegisterPermissionsSlice
|
|
63
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-T43H325W.mjs";
|
|
64
65
|
import {
|
|
65
66
|
getItem,
|
|
66
67
|
insert,
|
|
@@ -69,9 +70,8 @@ import {
|
|
|
69
70
|
populateIds
|
|
70
71
|
} from "./chunk-M4JDRFYB.mjs";
|
|
71
72
|
import {
|
|
72
|
-
defaultAppState
|
|
73
|
-
|
|
74
|
-
} from "./chunk-FTVOCMGV.mjs";
|
|
73
|
+
defaultAppState
|
|
74
|
+
} from "./chunk-NPC7A3V3.mjs";
|
|
75
75
|
import {
|
|
76
76
|
get_class_name_factory_default
|
|
77
77
|
} from "./chunk-Y2EFNT5P.mjs";
|
|
@@ -2146,7 +2146,7 @@ EditorFallback.displayName = "EditorFallback";
|
|
|
2146
2146
|
// components/AutoField/fields/RichtextField/index.tsx
|
|
2147
2147
|
import { Fragment as Fragment3, jsx as jsx20 } from "react/jsx-runtime";
|
|
2148
2148
|
var Editor = lazy(
|
|
2149
|
-
() => import("./Editor-
|
|
2149
|
+
() => import("./Editor-7UIJWCPN.mjs").then((m) => ({
|
|
2150
2150
|
default: m.Editor
|
|
2151
2151
|
}))
|
|
2152
2152
|
);
|
|
@@ -4698,7 +4698,7 @@ import {
|
|
|
4698
4698
|
} from "react";
|
|
4699
4699
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
4700
4700
|
var Editor2 = lazy2(
|
|
4701
|
-
() => import("./Editor-
|
|
4701
|
+
() => import("./Editor-7UIJWCPN.mjs").then((m) => ({
|
|
4702
4702
|
default: m.Editor
|
|
4703
4703
|
}))
|
|
4704
4704
|
);
|
|
@@ -6013,121 +6013,6 @@ function useGetEditor() {
|
|
|
6013
6013
|
return useEditorApi.getState;
|
|
6014
6014
|
}
|
|
6015
6015
|
|
|
6016
|
-
// plugins/blocks/index.tsx
|
|
6017
|
-
init_react_import();
|
|
6018
|
-
|
|
6019
|
-
// components/Editor/components/Components/index.tsx
|
|
6020
|
-
init_react_import();
|
|
6021
|
-
import { useMemo as useMemo14, useState as useState17 } from "react";
|
|
6022
|
-
|
|
6023
|
-
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Components/styles.module.css#css-module
|
|
6024
|
-
init_react_import();
|
|
6025
|
-
var styles_module_default15 = { "Components-search": "_Components-search_recer_1", "Components-searchIcon": "_Components-searchIcon_recer_8", "Components-searchInput": "_Components-searchInput_recer_16", "Components-empty": "_Components-empty_recer_39" };
|
|
6026
|
-
|
|
6027
|
-
// components/Editor/components/Components/index.tsx
|
|
6028
|
-
import { jsx as jsx36, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6029
|
-
var getClassName20 = get_class_name_factory_default("Components", styles_module_default15);
|
|
6030
|
-
var Components = () => {
|
|
6031
|
-
var _a;
|
|
6032
|
-
const overrides = useAppStore((s) => s.overrides);
|
|
6033
|
-
const components = useAppStore((s) => s.config.components);
|
|
6034
|
-
const categoriesConfig = useAppStore((s) => s.config.categories);
|
|
6035
|
-
const [search, setSearch] = useState17("");
|
|
6036
|
-
const Wrapper = useMemo14(() => {
|
|
6037
|
-
if (overrides.components) {
|
|
6038
|
-
console.warn(
|
|
6039
|
-
"The `components` override has been deprecated and renamed to `drawer`"
|
|
6040
|
-
);
|
|
6041
|
-
}
|
|
6042
|
-
return overrides.components || overrides.drawer || "div";
|
|
6043
|
-
}, [overrides]);
|
|
6044
|
-
const groups = useMemo14(() => {
|
|
6045
|
-
var _a2;
|
|
6046
|
-
const query = search.trim().toLowerCase();
|
|
6047
|
-
const entries = Object.entries(components != null ? components : {}).filter(([name, conf]) => {
|
|
6048
|
-
var _a3;
|
|
6049
|
-
if (!query) return true;
|
|
6050
|
-
const label = ((_a3 = conf.label) != null ? _a3 : name).toLowerCase();
|
|
6051
|
-
return label.includes(query);
|
|
6052
|
-
});
|
|
6053
|
-
if (!entries.length) return [];
|
|
6054
|
-
const buckets = /* @__PURE__ */ new Map();
|
|
6055
|
-
for (const entry of entries) {
|
|
6056
|
-
const [, conf] = entry;
|
|
6057
|
-
const key = conf.category;
|
|
6058
|
-
const bucket = (_a2 = buckets.get(key)) != null ? _a2 : [];
|
|
6059
|
-
bucket.push(entry);
|
|
6060
|
-
buckets.set(key, bucket);
|
|
6061
|
-
}
|
|
6062
|
-
return Array.from(buckets.entries());
|
|
6063
|
-
}, [components, search]);
|
|
6064
|
-
return /* @__PURE__ */ jsxs13(Wrapper, { children: [
|
|
6065
|
-
/* @__PURE__ */ jsxs13("div", { className: getClassName20("search"), children: [
|
|
6066
|
-
/* @__PURE__ */ jsx36("div", { className: getClassName20("searchIcon"), children: /* @__PURE__ */ jsx36(Search, { size: 14 }) }),
|
|
6067
|
-
/* @__PURE__ */ jsx36(
|
|
6068
|
-
"input",
|
|
6069
|
-
{
|
|
6070
|
-
type: "search",
|
|
6071
|
-
className: getClassName20("searchInput"),
|
|
6072
|
-
placeholder: "search",
|
|
6073
|
-
value: search,
|
|
6074
|
-
onChange: (e) => setSearch(e.target.value)
|
|
6075
|
-
}
|
|
6076
|
-
)
|
|
6077
|
-
] }),
|
|
6078
|
-
groups.length === 0 ? /* @__PURE__ */ jsx36("div", { className: getClassName20("empty"), children: "No results match your search" }) : groups.length <= 1 && !((_a = groups[0]) == null ? void 0 : _a[0]) ? /* @__PURE__ */ jsx36(ComponentList, { id: "all", children: groups[0][1].map(([name, conf]) => {
|
|
6079
|
-
var _a2;
|
|
6080
|
-
return /* @__PURE__ */ jsx36(
|
|
6081
|
-
ComponentList.Item,
|
|
6082
|
-
{
|
|
6083
|
-
name,
|
|
6084
|
-
label: (_a2 = conf.label) != null ? _a2 : name,
|
|
6085
|
-
icon: conf.icon
|
|
6086
|
-
},
|
|
6087
|
-
name
|
|
6088
|
-
);
|
|
6089
|
-
}) }) : groups.map(([category, entries]) => {
|
|
6090
|
-
var _a2, _b;
|
|
6091
|
-
const categoryKey = category != null ? category : "other";
|
|
6092
|
-
const title = (_b = (_a2 = categoriesConfig == null ? void 0 : categoriesConfig[categoryKey]) == null ? void 0 : _a2.title) != null ? _b : category != null ? category : "Other";
|
|
6093
|
-
return /* @__PURE__ */ jsx36(
|
|
6094
|
-
ComponentList,
|
|
6095
|
-
{
|
|
6096
|
-
id: categoryKey,
|
|
6097
|
-
title,
|
|
6098
|
-
children: entries.map(([name, conf]) => {
|
|
6099
|
-
var _a3;
|
|
6100
|
-
return /* @__PURE__ */ jsx36(
|
|
6101
|
-
ComponentList.Item,
|
|
6102
|
-
{
|
|
6103
|
-
name,
|
|
6104
|
-
label: (_a3 = conf.label) != null ? _a3 : name,
|
|
6105
|
-
icon: conf.icon
|
|
6106
|
-
},
|
|
6107
|
-
name
|
|
6108
|
-
);
|
|
6109
|
-
})
|
|
6110
|
-
},
|
|
6111
|
-
categoryKey
|
|
6112
|
-
);
|
|
6113
|
-
})
|
|
6114
|
-
] });
|
|
6115
|
-
};
|
|
6116
|
-
|
|
6117
|
-
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/blocks/styles.module.css#css-module
|
|
6118
|
-
init_react_import();
|
|
6119
|
-
var styles_module_default16 = { "BlocksPlugin": "_BlocksPlugin_15ud0_1" };
|
|
6120
|
-
|
|
6121
|
-
// plugins/blocks/index.tsx
|
|
6122
|
-
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
6123
|
-
var getClassName21 = get_class_name_factory_default("BlocksPlugin", styles_module_default16);
|
|
6124
|
-
var blocksPlugin = () => ({
|
|
6125
|
-
name: "blocks",
|
|
6126
|
-
label: "Blocks",
|
|
6127
|
-
render: () => /* @__PURE__ */ jsx37("div", { className: getClassName21(), children: /* @__PURE__ */ jsx37(Components, {}) }),
|
|
6128
|
-
icon: /* @__PURE__ */ jsx37(Plus, {})
|
|
6129
|
-
});
|
|
6130
|
-
|
|
6131
6016
|
// plugins/fields/index.tsx
|
|
6132
6017
|
init_react_import();
|
|
6133
6018
|
|
|
@@ -6136,11 +6021,11 @@ init_react_import();
|
|
|
6136
6021
|
|
|
6137
6022
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Breadcrumbs/styles.module.css#css-module
|
|
6138
6023
|
init_react_import();
|
|
6139
|
-
var
|
|
6024
|
+
var styles_module_default15 = { "Breadcrumbs": "_Breadcrumbs_1cjxk_1", "Breadcrumbs-breadcrumb": "_Breadcrumbs-breadcrumb_1cjxk_10", "Breadcrumbs-breadcrumbLabel": "_Breadcrumbs-breadcrumbLabel_1cjxk_17" };
|
|
6140
6025
|
|
|
6141
6026
|
// lib/use-breadcrumbs.ts
|
|
6142
6027
|
init_react_import();
|
|
6143
|
-
import { useMemo as
|
|
6028
|
+
import { useMemo as useMemo14 } from "react";
|
|
6144
6029
|
var useBreadcrumbs = (renderCount) => {
|
|
6145
6030
|
const selectedId = useAppStore((s) => {
|
|
6146
6031
|
var _a;
|
|
@@ -6152,7 +6037,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
6152
6037
|
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
|
6153
6038
|
});
|
|
6154
6039
|
const appStore = useAppStoreApi();
|
|
6155
|
-
return
|
|
6040
|
+
return useMemo14(() => {
|
|
6156
6041
|
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
|
6157
6042
|
var _a, _b, _c, _d;
|
|
6158
6043
|
const [componentId] = zoneCompound.split(":");
|
|
@@ -6183,26 +6068,26 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
6183
6068
|
};
|
|
6184
6069
|
|
|
6185
6070
|
// components/Breadcrumbs/index.tsx
|
|
6186
|
-
import { jsx as
|
|
6187
|
-
var
|
|
6071
|
+
import { jsx as jsx36, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6072
|
+
var getClassName20 = get_class_name_factory_default("Breadcrumbs", styles_module_default15);
|
|
6188
6073
|
var Breadcrumbs = ({
|
|
6189
6074
|
children,
|
|
6190
6075
|
numParents = 1
|
|
6191
6076
|
}) => {
|
|
6192
6077
|
const setUi = useAppStore((s) => s.setUi);
|
|
6193
6078
|
const breadcrumbs = useBreadcrumbs(numParents);
|
|
6194
|
-
return /* @__PURE__ */
|
|
6195
|
-
breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */
|
|
6196
|
-
/* @__PURE__ */
|
|
6079
|
+
return /* @__PURE__ */ jsxs13("div", { className: getClassName20(), children: [
|
|
6080
|
+
breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs13("div", { className: getClassName20("breadcrumb"), children: [
|
|
6081
|
+
/* @__PURE__ */ jsx36(
|
|
6197
6082
|
"button",
|
|
6198
6083
|
{
|
|
6199
6084
|
type: "button",
|
|
6200
|
-
className:
|
|
6085
|
+
className: getClassName20("breadcrumbLabel"),
|
|
6201
6086
|
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
|
6202
6087
|
children: breadcrumb.label
|
|
6203
6088
|
}
|
|
6204
6089
|
),
|
|
6205
|
-
/* @__PURE__ */
|
|
6090
|
+
/* @__PURE__ */ jsx36(ChevronRight, { size: 14 })
|
|
6206
6091
|
] }, i)),
|
|
6207
6092
|
children
|
|
6208
6093
|
] });
|
|
@@ -6213,7 +6098,7 @@ init_react_import();
|
|
|
6213
6098
|
|
|
6214
6099
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Fields/styles.module.css#css-module
|
|
6215
6100
|
init_react_import();
|
|
6216
|
-
var
|
|
6101
|
+
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" };
|
|
6217
6102
|
|
|
6218
6103
|
// components/Editor/components/Fields/index.tsx
|
|
6219
6104
|
import {
|
|
@@ -6221,15 +6106,15 @@ import {
|
|
|
6221
6106
|
useCallback as useCallback15,
|
|
6222
6107
|
useContext as useContext11,
|
|
6223
6108
|
useEffect as useEffect19,
|
|
6224
|
-
useMemo as
|
|
6109
|
+
useMemo as useMemo15
|
|
6225
6110
|
} from "react";
|
|
6226
6111
|
import { useShallow as useShallow7 } from "zustand/react/shallow";
|
|
6227
|
-
import { Fragment as Fragment8, jsx as
|
|
6228
|
-
var
|
|
6112
|
+
import { Fragment as Fragment8, jsx as jsx37, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
6113
|
+
var getClassName21 = get_class_name_factory_default("EditorFields", styles_module_default16);
|
|
6229
6114
|
var DefaultFields = ({
|
|
6230
6115
|
children
|
|
6231
6116
|
}) => {
|
|
6232
|
-
return /* @__PURE__ */
|
|
6117
|
+
return /* @__PURE__ */ jsx37(Fragment8, { children });
|
|
6233
6118
|
};
|
|
6234
6119
|
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
|
|
6235
6120
|
const { dispatch, state, selectedItem, resolveComponentData } = appStore.getState();
|
|
@@ -6309,7 +6194,7 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
6309
6194
|
}, [appStore, fieldStore]);
|
|
6310
6195
|
if (!field || !id || !visible) return null;
|
|
6311
6196
|
if (field.type === "slot") return null;
|
|
6312
|
-
return /* @__PURE__ */
|
|
6197
|
+
return /* @__PURE__ */ jsx37("div", { className: getClassName21("field"), children: /* @__PURE__ */ jsx37(
|
|
6313
6198
|
AutoFieldPrivate,
|
|
6314
6199
|
{
|
|
6315
6200
|
field,
|
|
@@ -6322,12 +6207,12 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
6322
6207
|
};
|
|
6323
6208
|
var FieldsChild = ({ fieldName }) => {
|
|
6324
6209
|
const appStore = useAppStoreApi();
|
|
6325
|
-
const initialValue =
|
|
6210
|
+
const initialValue = useMemo15(() => {
|
|
6326
6211
|
var _a;
|
|
6327
6212
|
const value = (_a = appStore.getState().getCurrentData().props) == null ? void 0 : _a[fieldName];
|
|
6328
6213
|
return { [fieldName]: value };
|
|
6329
6214
|
}, []);
|
|
6330
|
-
return /* @__PURE__ */
|
|
6215
|
+
return /* @__PURE__ */ jsx37(fieldContextStore.Provider, { value: initialValue, children: /* @__PURE__ */ jsx37(FieldsChildInner, { fieldName }) });
|
|
6331
6216
|
};
|
|
6332
6217
|
var FieldsChildMemo = memo8(FieldsChild);
|
|
6333
6218
|
var GlobalSyncButton = () => {
|
|
@@ -6357,12 +6242,12 @@ var GlobalSyncButton = () => {
|
|
|
6357
6242
|
});
|
|
6358
6243
|
});
|
|
6359
6244
|
const syncButtonClass = [
|
|
6360
|
-
|
|
6361
|
-
isUnlinked ?
|
|
6245
|
+
getClassName21("syncButton"),
|
|
6246
|
+
isUnlinked ? styles_module_default16["EditorFields-syncButton--unlinked"] : null
|
|
6362
6247
|
].filter(Boolean).join(" ");
|
|
6363
|
-
return /* @__PURE__ */
|
|
6364
|
-
/* @__PURE__ */
|
|
6365
|
-
/* @__PURE__ */
|
|
6248
|
+
return /* @__PURE__ */ jsxs14("button", { type: "button", className: syncButtonClass, onClick, children: [
|
|
6249
|
+
/* @__PURE__ */ jsx37(Link, { size: 14 }),
|
|
6250
|
+
/* @__PURE__ */ jsx37("span", { children: isUnlinked ? "Link to shared" : "Linked to shared" })
|
|
6366
6251
|
] });
|
|
6367
6252
|
};
|
|
6368
6253
|
var FieldsInternal = ({ wrapFields = true }) => {
|
|
@@ -6389,20 +6274,20 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
6389
6274
|
})
|
|
6390
6275
|
);
|
|
6391
6276
|
const isLoading = fieldsLoading || componentResolving;
|
|
6392
|
-
const Wrapper =
|
|
6393
|
-
return /* @__PURE__ */
|
|
6277
|
+
const Wrapper = useMemo15(() => overrides.fields || DefaultFields, [overrides]);
|
|
6278
|
+
return /* @__PURE__ */ jsxs14(
|
|
6394
6279
|
"form",
|
|
6395
6280
|
{
|
|
6396
|
-
className:
|
|
6281
|
+
className: getClassName21({ wrapFields }),
|
|
6397
6282
|
onSubmit: (e) => {
|
|
6398
6283
|
e.preventDefault();
|
|
6399
6284
|
},
|
|
6400
6285
|
children: [
|
|
6401
|
-
/* @__PURE__ */
|
|
6402
|
-
/* @__PURE__ */
|
|
6403
|
-
fieldNames.map((fieldName) => /* @__PURE__ */
|
|
6286
|
+
/* @__PURE__ */ jsxs14(Wrapper, { isLoading, itemSelector, children: [
|
|
6287
|
+
/* @__PURE__ */ jsx37(GlobalSyncButton, {}),
|
|
6288
|
+
fieldNames.map((fieldName) => /* @__PURE__ */ jsx37(FieldsChildMemo, { fieldName }, fieldName))
|
|
6404
6289
|
] }),
|
|
6405
|
-
isLoading && /* @__PURE__ */
|
|
6290
|
+
isLoading && /* @__PURE__ */ jsx37("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ jsx37("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ jsx37(Loader, { size: 16 }) }) })
|
|
6406
6291
|
]
|
|
6407
6292
|
}
|
|
6408
6293
|
);
|
|
@@ -6411,11 +6296,11 @@ var Fields = memo8(FieldsInternal);
|
|
|
6411
6296
|
|
|
6412
6297
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css#css-module
|
|
6413
6298
|
init_react_import();
|
|
6414
|
-
var
|
|
6299
|
+
var styles_module_default17 = { "FieldsPlugin": "_FieldsPlugin_262zt_1", "FieldsPlugin-header": "_FieldsPlugin-header_262zt_7" };
|
|
6415
6300
|
|
|
6416
6301
|
// plugins/fields/index.tsx
|
|
6417
|
-
import { jsx as
|
|
6418
|
-
var
|
|
6302
|
+
import { jsx as jsx38, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
6303
|
+
var getClassName22 = get_class_name_factory_default("FieldsPlugin", styles_module_default17);
|
|
6419
6304
|
var CurrentTitle = () => {
|
|
6420
6305
|
const label = useAppStore((s) => {
|
|
6421
6306
|
var _a, _b;
|
|
@@ -6427,26 +6312,124 @@ var CurrentTitle = () => {
|
|
|
6427
6312
|
var fieldsPlugin = ({ desktopSideBar = "right" } = {}) => ({
|
|
6428
6313
|
name: "fields",
|
|
6429
6314
|
label: "Fields",
|
|
6430
|
-
render: () => /* @__PURE__ */
|
|
6431
|
-
/* @__PURE__ */
|
|
6432
|
-
/* @__PURE__ */
|
|
6315
|
+
render: () => /* @__PURE__ */ jsxs15("div", { className: getClassName22(), children: [
|
|
6316
|
+
/* @__PURE__ */ jsx38("div", { className: getClassName22("header"), children: /* @__PURE__ */ jsx38(Breadcrumbs, { numParents: 2, children: /* @__PURE__ */ jsx38(CurrentTitle, {}) }) }),
|
|
6317
|
+
/* @__PURE__ */ jsx38(Fields, {})
|
|
6433
6318
|
] }),
|
|
6434
|
-
icon: /* @__PURE__ */
|
|
6319
|
+
icon: /* @__PURE__ */ jsx38(RectangleEllipsis, {}),
|
|
6435
6320
|
mobileOnly: desktopSideBar === "right"
|
|
6436
6321
|
});
|
|
6437
6322
|
|
|
6438
6323
|
// components/Editor/index.tsx
|
|
6439
6324
|
init_react_import();
|
|
6440
6325
|
import {
|
|
6441
|
-
createContext as
|
|
6442
|
-
useCallback as
|
|
6443
|
-
useContext as
|
|
6444
|
-
useEffect as
|
|
6445
|
-
useMemo as
|
|
6446
|
-
useRef as
|
|
6447
|
-
useState as
|
|
6326
|
+
createContext as createContext9,
|
|
6327
|
+
useCallback as useCallback22,
|
|
6328
|
+
useContext as useContext16,
|
|
6329
|
+
useEffect as useEffect25,
|
|
6330
|
+
useMemo as useMemo23,
|
|
6331
|
+
useRef as useRef16,
|
|
6332
|
+
useState as useState23
|
|
6448
6333
|
} from "react";
|
|
6449
6334
|
|
|
6335
|
+
// components/Editor/components/Components/index.tsx
|
|
6336
|
+
init_react_import();
|
|
6337
|
+
import { useMemo as useMemo16, useState as useState17 } from "react";
|
|
6338
|
+
|
|
6339
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Components/styles.module.css#css-module
|
|
6340
|
+
init_react_import();
|
|
6341
|
+
var styles_module_default18 = { "Components-search": "_Components-search_recer_1", "Components-searchIcon": "_Components-searchIcon_recer_8", "Components-searchInput": "_Components-searchInput_recer_16", "Components-empty": "_Components-empty_recer_39" };
|
|
6342
|
+
|
|
6343
|
+
// components/Editor/components/Components/index.tsx
|
|
6344
|
+
import { jsx as jsx39, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6345
|
+
var getClassName23 = get_class_name_factory_default("Components", styles_module_default18);
|
|
6346
|
+
var Components = () => {
|
|
6347
|
+
var _a;
|
|
6348
|
+
const overrides = useAppStore((s) => s.overrides);
|
|
6349
|
+
const components = useAppStore((s) => s.config.components);
|
|
6350
|
+
const categoriesConfig = useAppStore((s) => s.config.categories);
|
|
6351
|
+
const [search, setSearch] = useState17("");
|
|
6352
|
+
const Wrapper = useMemo16(() => {
|
|
6353
|
+
if (overrides.components) {
|
|
6354
|
+
console.warn(
|
|
6355
|
+
"The `components` override has been deprecated and renamed to `drawer`"
|
|
6356
|
+
);
|
|
6357
|
+
}
|
|
6358
|
+
return overrides.components || overrides.drawer || "div";
|
|
6359
|
+
}, [overrides]);
|
|
6360
|
+
const groups = useMemo16(() => {
|
|
6361
|
+
var _a2;
|
|
6362
|
+
const query = search.trim().toLowerCase();
|
|
6363
|
+
const entries = Object.entries(components != null ? components : {}).filter(([name, conf]) => {
|
|
6364
|
+
var _a3;
|
|
6365
|
+
if (!query) return true;
|
|
6366
|
+
const label = ((_a3 = conf.label) != null ? _a3 : name).toLowerCase();
|
|
6367
|
+
return label.includes(query);
|
|
6368
|
+
});
|
|
6369
|
+
if (!entries.length) return [];
|
|
6370
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
6371
|
+
for (const entry of entries) {
|
|
6372
|
+
const [, conf] = entry;
|
|
6373
|
+
const key = conf.category;
|
|
6374
|
+
const bucket = (_a2 = buckets.get(key)) != null ? _a2 : [];
|
|
6375
|
+
bucket.push(entry);
|
|
6376
|
+
buckets.set(key, bucket);
|
|
6377
|
+
}
|
|
6378
|
+
return Array.from(buckets.entries());
|
|
6379
|
+
}, [components, search]);
|
|
6380
|
+
return /* @__PURE__ */ jsxs16(Wrapper, { children: [
|
|
6381
|
+
/* @__PURE__ */ jsxs16("div", { className: getClassName23("search"), children: [
|
|
6382
|
+
/* @__PURE__ */ jsx39("div", { className: getClassName23("searchIcon"), children: /* @__PURE__ */ jsx39(Search, { size: 14 }) }),
|
|
6383
|
+
/* @__PURE__ */ jsx39(
|
|
6384
|
+
"input",
|
|
6385
|
+
{
|
|
6386
|
+
type: "search",
|
|
6387
|
+
className: getClassName23("searchInput"),
|
|
6388
|
+
placeholder: "search",
|
|
6389
|
+
value: search,
|
|
6390
|
+
onChange: (e) => setSearch(e.target.value)
|
|
6391
|
+
}
|
|
6392
|
+
)
|
|
6393
|
+
] }),
|
|
6394
|
+
groups.length === 0 ? /* @__PURE__ */ jsx39("div", { className: getClassName23("empty"), children: "No results match your search" }) : groups.length <= 1 && !((_a = groups[0]) == null ? void 0 : _a[0]) ? /* @__PURE__ */ jsx39(ComponentList, { id: "all", children: groups[0][1].map(([name, conf]) => {
|
|
6395
|
+
var _a2;
|
|
6396
|
+
return /* @__PURE__ */ jsx39(
|
|
6397
|
+
ComponentList.Item,
|
|
6398
|
+
{
|
|
6399
|
+
name,
|
|
6400
|
+
label: (_a2 = conf.label) != null ? _a2 : name,
|
|
6401
|
+
icon: conf.icon
|
|
6402
|
+
},
|
|
6403
|
+
name
|
|
6404
|
+
);
|
|
6405
|
+
}) }) : groups.map(([category, entries]) => {
|
|
6406
|
+
var _a2, _b;
|
|
6407
|
+
const categoryKey = category != null ? category : "other";
|
|
6408
|
+
const title = (_b = (_a2 = categoriesConfig == null ? void 0 : categoriesConfig[categoryKey]) == null ? void 0 : _a2.title) != null ? _b : category != null ? category : "Other";
|
|
6409
|
+
return /* @__PURE__ */ jsx39(
|
|
6410
|
+
ComponentList,
|
|
6411
|
+
{
|
|
6412
|
+
id: categoryKey,
|
|
6413
|
+
title,
|
|
6414
|
+
children: entries.map(([name, conf]) => {
|
|
6415
|
+
var _a3;
|
|
6416
|
+
return /* @__PURE__ */ jsx39(
|
|
6417
|
+
ComponentList.Item,
|
|
6418
|
+
{
|
|
6419
|
+
name,
|
|
6420
|
+
label: (_a3 = conf.label) != null ? _a3 : name,
|
|
6421
|
+
icon: conf.icon
|
|
6422
|
+
},
|
|
6423
|
+
name
|
|
6424
|
+
);
|
|
6425
|
+
})
|
|
6426
|
+
},
|
|
6427
|
+
categoryKey
|
|
6428
|
+
);
|
|
6429
|
+
})
|
|
6430
|
+
] });
|
|
6431
|
+
};
|
|
6432
|
+
|
|
6450
6433
|
// components/Editor/components/Preview/index.tsx
|
|
6451
6434
|
init_react_import();
|
|
6452
6435
|
import { useCallback as useCallback16, useEffect as useEffect21, useRef as useRef11, useMemo as useMemo17 } from "react";
|
|
@@ -6461,7 +6444,7 @@ import {
|
|
|
6461
6444
|
} from "react";
|
|
6462
6445
|
import hash from "object-hash";
|
|
6463
6446
|
import { createPortal as createPortal3 } from "react-dom";
|
|
6464
|
-
import { Fragment as Fragment9, jsx as
|
|
6447
|
+
import { Fragment as Fragment9, jsx as jsx40 } from "react/jsx-runtime";
|
|
6465
6448
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
|
6466
6449
|
var collectStyles = (doc) => {
|
|
6467
6450
|
const collected = [];
|
|
@@ -6678,7 +6661,7 @@ var CopyHostStyles = ({
|
|
|
6678
6661
|
observer.disconnect();
|
|
6679
6662
|
};
|
|
6680
6663
|
}, []);
|
|
6681
|
-
return /* @__PURE__ */
|
|
6664
|
+
return /* @__PURE__ */ jsx40(Fragment9, { children });
|
|
6682
6665
|
};
|
|
6683
6666
|
var autoFrameContext = createContext6({});
|
|
6684
6667
|
var useFrame = () => useContext12(autoFrameContext);
|
|
@@ -6725,17 +6708,60 @@ function AutoFrame(_a) {
|
|
|
6725
6708
|
}
|
|
6726
6709
|
}
|
|
6727
6710
|
}, [frameRef, loaded, stylesLoaded]);
|
|
6728
|
-
|
|
6711
|
+
useEffect20(() => {
|
|
6712
|
+
const doc = ctx.document;
|
|
6713
|
+
const iframeEl = frameRef.current;
|
|
6714
|
+
if (!doc || !iframeEl || !stylesLoaded) return;
|
|
6715
|
+
let scheduled = false;
|
|
6716
|
+
const update = () => {
|
|
6717
|
+
if (scheduled) return;
|
|
6718
|
+
scheduled = true;
|
|
6719
|
+
requestAnimationFrame(() => {
|
|
6720
|
+
scheduled = false;
|
|
6721
|
+
const html = doc.documentElement;
|
|
6722
|
+
const body = doc.body;
|
|
6723
|
+
if (!html || !body) return;
|
|
6724
|
+
iframeEl.style.height = "0px";
|
|
6725
|
+
const height = Math.max(
|
|
6726
|
+
body.scrollHeight,
|
|
6727
|
+
body.offsetHeight,
|
|
6728
|
+
html.scrollHeight,
|
|
6729
|
+
html.offsetHeight
|
|
6730
|
+
);
|
|
6731
|
+
if (height > 0) {
|
|
6732
|
+
iframeEl.style.height = `${height}px`;
|
|
6733
|
+
}
|
|
6734
|
+
});
|
|
6735
|
+
};
|
|
6736
|
+
update();
|
|
6737
|
+
const observer = new ResizeObserver(update);
|
|
6738
|
+
observer.observe(doc.body);
|
|
6739
|
+
observer.observe(doc.documentElement);
|
|
6740
|
+
const iframeObserver = new ResizeObserver(update);
|
|
6741
|
+
iframeObserver.observe(iframeEl);
|
|
6742
|
+
const mutationObserver = new MutationObserver(update);
|
|
6743
|
+
mutationObserver.observe(doc.body, {
|
|
6744
|
+
attributes: true,
|
|
6745
|
+
childList: true,
|
|
6746
|
+
subtree: true
|
|
6747
|
+
});
|
|
6748
|
+
return () => {
|
|
6749
|
+
observer.disconnect();
|
|
6750
|
+
iframeObserver.disconnect();
|
|
6751
|
+
mutationObserver.disconnect();
|
|
6752
|
+
};
|
|
6753
|
+
}, [ctx.document, frameRef, stylesLoaded]);
|
|
6754
|
+
return /* @__PURE__ */ jsx40(
|
|
6729
6755
|
"iframe",
|
|
6730
6756
|
__spreadProps(__spreadValues({}, props), {
|
|
6731
6757
|
className,
|
|
6732
6758
|
id,
|
|
6733
|
-
srcDoc: '<!DOCTYPE html><html><head
|
|
6759
|
+
srcDoc: '<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" /></head><body style="touch-action:none"><div id="frame-root" data-editor-entry></div></body></html>',
|
|
6734
6760
|
ref: frameRef,
|
|
6735
6761
|
onLoad: () => {
|
|
6736
6762
|
setLoaded(true);
|
|
6737
6763
|
},
|
|
6738
|
-
children: /* @__PURE__ */
|
|
6764
|
+
children: /* @__PURE__ */ jsx40(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx40(
|
|
6739
6765
|
CopyHostStyles,
|
|
6740
6766
|
{
|
|
6741
6767
|
debug,
|
|
@@ -6751,11 +6777,11 @@ var AutoFrame_default = AutoFrame;
|
|
|
6751
6777
|
|
|
6752
6778
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Preview/styles.module.css#css-module
|
|
6753
6779
|
init_react_import();
|
|
6754
|
-
var
|
|
6780
|
+
var styles_module_default19 = { "EditorPreview": "_EditorPreview_xou64_1", "EditorPreview-frame": "_EditorPreview-frame_xou64_6" };
|
|
6755
6781
|
|
|
6756
6782
|
// components/Editor/components/Preview/index.tsx
|
|
6757
|
-
import { Fragment as Fragment10, jsx as
|
|
6758
|
-
var
|
|
6783
|
+
import { Fragment as Fragment10, jsx as jsx41 } from "react/jsx-runtime";
|
|
6784
|
+
var getClassName24 = get_class_name_factory_default("EditorPreview", styles_module_default19);
|
|
6759
6785
|
var Preview2 = ({ id = "editor-preview" }) => {
|
|
6760
6786
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
6761
6787
|
const root = useAppStore((s) => s.state.data.root);
|
|
@@ -6781,14 +6807,14 @@ var Preview2 = ({ id = "editor-preview" }) => {
|
|
|
6781
6807
|
);
|
|
6782
6808
|
return ((_c = config.root) == null ? void 0 : _c.render) ? (_d = config.root) == null ? void 0 : _d.render(__spreadValues(__spreadValues({
|
|
6783
6809
|
id: "editor-root"
|
|
6784
|
-
}, propsWithSlots), richtextProps)) : /* @__PURE__ */
|
|
6810
|
+
}, propsWithSlots), richtextProps)) : /* @__PURE__ */ jsx41(Fragment10, { children: propsWithSlots.children });
|
|
6785
6811
|
},
|
|
6786
6812
|
[config]
|
|
6787
6813
|
);
|
|
6788
6814
|
const Frame = useMemo17(() => overrides.iframe, [overrides]);
|
|
6789
6815
|
const rootProps = root.props || root;
|
|
6790
6816
|
const ref = useRef11(null);
|
|
6791
|
-
const inner = !renderData ? /* @__PURE__ */
|
|
6817
|
+
const inner = !renderData ? /* @__PURE__ */ jsx41(
|
|
6792
6818
|
Page,
|
|
6793
6819
|
__spreadProps(__spreadValues({}, rootProps), {
|
|
6794
6820
|
editor: {
|
|
@@ -6798,18 +6824,18 @@ var Preview2 = ({ id = "editor-preview" }) => {
|
|
|
6798
6824
|
metadata
|
|
6799
6825
|
},
|
|
6800
6826
|
editMode: true,
|
|
6801
|
-
children: /* @__PURE__ */
|
|
6827
|
+
children: /* @__PURE__ */ jsx41(DropZonePure, { zone: rootDroppableId })
|
|
6802
6828
|
})
|
|
6803
|
-
) : /* @__PURE__ */
|
|
6829
|
+
) : /* @__PURE__ */ jsx41(Render, { data: renderData, config, metadata });
|
|
6804
6830
|
useEffect21(() => {
|
|
6805
6831
|
if (!iframe.enabled) {
|
|
6806
6832
|
setStatus("READY");
|
|
6807
6833
|
}
|
|
6808
6834
|
}, [iframe.enabled]);
|
|
6809
|
-
return /* @__PURE__ */
|
|
6835
|
+
return /* @__PURE__ */ jsx41(
|
|
6810
6836
|
"div",
|
|
6811
6837
|
{
|
|
6812
|
-
className:
|
|
6838
|
+
className: getClassName24(),
|
|
6813
6839
|
id,
|
|
6814
6840
|
"data-editor-preview": true,
|
|
6815
6841
|
onClick: (e) => {
|
|
@@ -6818,11 +6844,11 @@ var Preview2 = ({ id = "editor-preview" }) => {
|
|
|
6818
6844
|
dispatch({ type: "setUi", ui: { itemSelector: null } });
|
|
6819
6845
|
}
|
|
6820
6846
|
},
|
|
6821
|
-
children: iframe.enabled ? /* @__PURE__ */
|
|
6847
|
+
children: iframe.enabled ? /* @__PURE__ */ jsx41(
|
|
6822
6848
|
AutoFrame_default,
|
|
6823
6849
|
{
|
|
6824
6850
|
id: "preview-frame",
|
|
6825
|
-
className:
|
|
6851
|
+
className: getClassName24("frame"),
|
|
6826
6852
|
"data-rfd-iframe": true,
|
|
6827
6853
|
onReady: () => {
|
|
6828
6854
|
setStatus("READY");
|
|
@@ -6831,18 +6857,18 @@ var Preview2 = ({ id = "editor-preview" }) => {
|
|
|
6831
6857
|
setStatus("MOUNTED");
|
|
6832
6858
|
},
|
|
6833
6859
|
frameRef: ref,
|
|
6834
|
-
children: /* @__PURE__ */
|
|
6860
|
+
children: /* @__PURE__ */ jsx41(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
|
6835
6861
|
if (Frame) {
|
|
6836
|
-
return /* @__PURE__ */
|
|
6862
|
+
return /* @__PURE__ */ jsx41(Frame, { document: document2, children: inner });
|
|
6837
6863
|
}
|
|
6838
6864
|
return inner;
|
|
6839
6865
|
} })
|
|
6840
6866
|
}
|
|
6841
|
-
) : /* @__PURE__ */
|
|
6867
|
+
) : /* @__PURE__ */ jsx41(
|
|
6842
6868
|
"div",
|
|
6843
6869
|
{
|
|
6844
6870
|
id: "preview-frame",
|
|
6845
|
-
className:
|
|
6871
|
+
className: getClassName24("frame"),
|
|
6846
6872
|
ref,
|
|
6847
6873
|
"data-editor-entry": true,
|
|
6848
6874
|
children: inner
|
|
@@ -6860,7 +6886,7 @@ init_react_import();
|
|
|
6860
6886
|
|
|
6861
6887
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/LayerTree/styles.module.css#css-module
|
|
6862
6888
|
init_react_import();
|
|
6863
|
-
var
|
|
6889
|
+
var styles_module_default20 = { "LayerTree": "_LayerTree_3eixb_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_3eixb_11", "LayerTree-helper": "_LayerTree-helper_3eixb_17", "Layer": "_Layer_3eixb_1", "Layer-inner": "_Layer-inner_3eixb_34", "Layer--containsZone": "_Layer--containsZone_3eixb_42", "Layer-clickable": "_Layer-clickable_3eixb_46", "Layer--isSelected": "_Layer--isSelected_3eixb_68", "Layer-icon": "_Layer-icon_3eixb_80", "Layer-zoneIcon": "_Layer-zoneIcon_3eixb_81", "Layer-chevron": "_Layer-chevron_3eixb_85", "Layer--childIsSelected": "_Layer--childIsSelected_3eixb_97", "Layer-zones": "_Layer-zones_3eixb_101", "Layer-title": "_Layer-title_3eixb_117", "Layer-name": "_Layer-name_3eixb_130", "Layer--isGlobal": "_Layer--isGlobal_3eixb_150", "Layer--isUnlinked": "_Layer--isUnlinked_3eixb_171", "Layer-unlinkedGlyph": "_Layer-unlinkedGlyph_3eixb_175" };
|
|
6864
6890
|
|
|
6865
6891
|
// components/LayerTree/index.tsx
|
|
6866
6892
|
import {
|
|
@@ -6870,9 +6896,9 @@ import {
|
|
|
6870
6896
|
useRef as useRef12
|
|
6871
6897
|
} from "react";
|
|
6872
6898
|
import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
|
|
6873
|
-
import { Fragment as Fragment11, jsx as
|
|
6874
|
-
var
|
|
6875
|
-
var getClassNameLayer = get_class_name_factory_default("Layer",
|
|
6899
|
+
import { Fragment as Fragment11, jsx as jsx42, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6900
|
+
var getClassName25 = get_class_name_factory_default("LayerTree", styles_module_default20);
|
|
6901
|
+
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default20);
|
|
6876
6902
|
var DEFAULT_LAYER_ROW_HEIGHT = 32;
|
|
6877
6903
|
var LAYER_TREE_VIRTUALIZATION_OVERSCAN = 8;
|
|
6878
6904
|
var MIN_VIRTUALIZED_LAYER_COUNT = 25;
|
|
@@ -7026,7 +7052,7 @@ var Layer = forwardRef2(function Layer2({
|
|
|
7026
7052
|
"data-index": dataIndex,
|
|
7027
7053
|
"data-editor-layer-tree-id": node.itemId,
|
|
7028
7054
|
children: [
|
|
7029
|
-
/* @__PURE__ */
|
|
7055
|
+
/* @__PURE__ */ jsx42("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs17(
|
|
7030
7056
|
"button",
|
|
7031
7057
|
{
|
|
7032
7058
|
type: "button",
|
|
@@ -7051,34 +7077,34 @@ var Layer = forwardRef2(function Layer2({
|
|
|
7051
7077
|
zoneStore.setState({ hoveringComponent: null });
|
|
7052
7078
|
},
|
|
7053
7079
|
children: [
|
|
7054
|
-
/* @__PURE__ */
|
|
7080
|
+
/* @__PURE__ */ jsx42(
|
|
7055
7081
|
"div",
|
|
7056
7082
|
{
|
|
7057
7083
|
className: getClassNameLayer("chevron"),
|
|
7058
7084
|
title: containsZone ? isSelected ? "Collapse" : "Expand" : void 0,
|
|
7059
|
-
children: containsZone && /* @__PURE__ */
|
|
7085
|
+
children: containsZone && /* @__PURE__ */ jsx42(ChevronRight, { size: "12" })
|
|
7060
7086
|
}
|
|
7061
7087
|
),
|
|
7062
7088
|
/* @__PURE__ */ jsxs17("div", { className: getClassNameLayer("title"), children: [
|
|
7063
|
-
/* @__PURE__ */
|
|
7064
|
-
/* @__PURE__ */
|
|
7065
|
-
isGlobal && isUnlinked && /* @__PURE__ */
|
|
7089
|
+
/* @__PURE__ */ jsx42("div", { className: getClassNameLayer("icon"), children: /* @__PURE__ */ jsx42(Component, { size: "16" }) }),
|
|
7090
|
+
/* @__PURE__ */ jsx42("div", { className: getClassNameLayer("name"), children: node.label }),
|
|
7091
|
+
isGlobal && isUnlinked && /* @__PURE__ */ jsx42(
|
|
7066
7092
|
"div",
|
|
7067
7093
|
{
|
|
7068
7094
|
className: getClassNameLayer("unlinkedGlyph"),
|
|
7069
7095
|
title: "Unlinked from shared",
|
|
7070
|
-
children: /* @__PURE__ */
|
|
7096
|
+
children: /* @__PURE__ */ jsx42(Unlink2, { size: "12" })
|
|
7071
7097
|
}
|
|
7072
7098
|
)
|
|
7073
7099
|
] })
|
|
7074
7100
|
]
|
|
7075
7101
|
}
|
|
7076
7102
|
) }),
|
|
7077
|
-
containsZone && shouldRenderChildren && node.childZones.map((childZone) => /* @__PURE__ */
|
|
7103
|
+
containsZone && shouldRenderChildren && node.childZones.map((childZone) => /* @__PURE__ */ jsx42(
|
|
7078
7104
|
"div",
|
|
7079
7105
|
{
|
|
7080
7106
|
className: getClassNameLayer("zones"),
|
|
7081
|
-
children: /* @__PURE__ */
|
|
7107
|
+
children: /* @__PURE__ */ jsx42(
|
|
7082
7108
|
LayerTreeZone,
|
|
7083
7109
|
{
|
|
7084
7110
|
depth: depth + 1,
|
|
@@ -7102,8 +7128,8 @@ var LayerTreeZone = ({
|
|
|
7102
7128
|
}) => {
|
|
7103
7129
|
const shouldVirtualize = depth === 0 && tree.items.length >= MIN_VIRTUALIZED_LAYER_COUNT;
|
|
7104
7130
|
return /* @__PURE__ */ jsxs17(Fragment11, { children: [
|
|
7105
|
-
tree.label && /* @__PURE__ */
|
|
7106
|
-
shouldVirtualize ? /* @__PURE__ */
|
|
7131
|
+
tree.label && /* @__PURE__ */ jsx42("div", { className: getClassName25("zoneTitle"), children: tree.label }),
|
|
7132
|
+
shouldVirtualize ? /* @__PURE__ */ jsx42(
|
|
7107
7133
|
VirtualizedLayerTreeItems,
|
|
7108
7134
|
{
|
|
7109
7135
|
depth,
|
|
@@ -7111,7 +7137,7 @@ var LayerTreeZone = ({
|
|
|
7111
7137
|
selectedPathIds,
|
|
7112
7138
|
tree
|
|
7113
7139
|
}
|
|
7114
|
-
) : /* @__PURE__ */
|
|
7140
|
+
) : /* @__PURE__ */ jsx42(
|
|
7115
7141
|
StaticLayerTreeItems,
|
|
7116
7142
|
{
|
|
7117
7143
|
depth,
|
|
@@ -7128,9 +7154,9 @@ var StaticLayerTreeItems = ({
|
|
|
7128
7154
|
selectedPathIds,
|
|
7129
7155
|
tree
|
|
7130
7156
|
}) => {
|
|
7131
|
-
return /* @__PURE__ */ jsxs17("ul", { className:
|
|
7132
|
-
tree.items.length === 0 && /* @__PURE__ */
|
|
7133
|
-
tree.items.map((node) => /* @__PURE__ */
|
|
7157
|
+
return /* @__PURE__ */ jsxs17("ul", { className: getClassName25(), children: [
|
|
7158
|
+
tree.items.length === 0 && /* @__PURE__ */ jsx42("div", { className: getClassName25("helper"), children: "empty" }),
|
|
7159
|
+
tree.items.map((node) => /* @__PURE__ */ jsx42(
|
|
7134
7160
|
Layer,
|
|
7135
7161
|
{
|
|
7136
7162
|
childIsSelected: selectedPathIds.has(node.itemId),
|
|
@@ -7176,7 +7202,7 @@ var VirtualizedLayerTreeItems = ({
|
|
|
7176
7202
|
const gapSize = Math.max(virtualItem.start - previousEnd, 0);
|
|
7177
7203
|
if (gapSize > 0) {
|
|
7178
7204
|
renderedItems.push(
|
|
7179
|
-
/* @__PURE__ */
|
|
7205
|
+
/* @__PURE__ */ jsx42(
|
|
7180
7206
|
"li",
|
|
7181
7207
|
{
|
|
7182
7208
|
"aria-hidden": "true",
|
|
@@ -7187,7 +7213,7 @@ var VirtualizedLayerTreeItems = ({
|
|
|
7187
7213
|
);
|
|
7188
7214
|
}
|
|
7189
7215
|
renderedItems.push(
|
|
7190
|
-
/* @__PURE__ */
|
|
7216
|
+
/* @__PURE__ */ jsx42(
|
|
7191
7217
|
Layer,
|
|
7192
7218
|
{
|
|
7193
7219
|
childIsSelected: selectedPathIds.has(node.itemId),
|
|
@@ -7208,7 +7234,7 @@ var VirtualizedLayerTreeItems = ({
|
|
|
7208
7234
|
const trailingGap = Math.max(totalSize - previousEnd, 0);
|
|
7209
7235
|
if (trailingGap > 0) {
|
|
7210
7236
|
renderedItems.push(
|
|
7211
|
-
/* @__PURE__ */
|
|
7237
|
+
/* @__PURE__ */ jsx42(
|
|
7212
7238
|
"li",
|
|
7213
7239
|
{
|
|
7214
7240
|
"aria-hidden": "true",
|
|
@@ -7218,8 +7244,8 @@ var VirtualizedLayerTreeItems = ({
|
|
|
7218
7244
|
)
|
|
7219
7245
|
);
|
|
7220
7246
|
}
|
|
7221
|
-
return /* @__PURE__ */ jsxs17("ul", { className:
|
|
7222
|
-
tree.items.length === 0 && /* @__PURE__ */
|
|
7247
|
+
return /* @__PURE__ */ jsxs17("ul", { className: getClassName25(), ref: listRef, children: [
|
|
7248
|
+
tree.items.length === 0 && /* @__PURE__ */ jsx42("div", { className: getClassName25("helper"), children: "empty" }),
|
|
7223
7249
|
renderedItems
|
|
7224
7250
|
] });
|
|
7225
7251
|
};
|
|
@@ -7228,7 +7254,7 @@ var LayerTree = ({
|
|
|
7228
7254
|
selectedPathIds,
|
|
7229
7255
|
trees
|
|
7230
7256
|
}) => {
|
|
7231
|
-
return /* @__PURE__ */
|
|
7257
|
+
return /* @__PURE__ */ jsx42(Fragment11, { children: trees.map((tree) => /* @__PURE__ */ jsx42(
|
|
7232
7258
|
LayerTreeZone,
|
|
7233
7259
|
{
|
|
7234
7260
|
depth: 0,
|
|
@@ -7253,7 +7279,7 @@ var findZonesForArea = (state, area) => {
|
|
|
7253
7279
|
|
|
7254
7280
|
// components/Editor/components/Outline/index.tsx
|
|
7255
7281
|
import { useShallow as useShallow8 } from "zustand/react/shallow";
|
|
7256
|
-
import { jsx as
|
|
7282
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
7257
7283
|
var Outline = () => {
|
|
7258
7284
|
const outlineOverride = useAppStore((s) => s.overrides.outline);
|
|
7259
7285
|
const config = useAppStore((s) => s.config);
|
|
@@ -7286,7 +7312,7 @@ var Outline = () => {
|
|
|
7286
7312
|
[config, nodes, rootZones, zones]
|
|
7287
7313
|
);
|
|
7288
7314
|
const Wrapper = useMemo18(() => outlineOverride || "div", [outlineOverride]);
|
|
7289
|
-
return /* @__PURE__ */
|
|
7315
|
+
return /* @__PURE__ */ jsx43(Wrapper, { children: /* @__PURE__ */ jsx43(
|
|
7290
7316
|
LayerTree,
|
|
7291
7317
|
{
|
|
7292
7318
|
selectedId,
|
|
@@ -7393,17 +7419,11 @@ function splitGlobals(data, config) {
|
|
|
7393
7419
|
|
|
7394
7420
|
// components/Editor/components/Layout/index.tsx
|
|
7395
7421
|
init_react_import();
|
|
7396
|
-
import {
|
|
7397
|
-
useCallback as useCallback24,
|
|
7398
|
-
useEffect as useEffect25,
|
|
7399
|
-
useMemo as useMemo23,
|
|
7400
|
-
useRef as useRef18,
|
|
7401
|
-
useState as useState23
|
|
7402
|
-
} from "react";
|
|
7422
|
+
import { useEffect as useEffect24, useMemo as useMemo22, useState as useState22 } from "react";
|
|
7403
7423
|
|
|
7404
7424
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Layout/styles.module.css#css-module
|
|
7405
7425
|
init_react_import();
|
|
7406
|
-
var
|
|
7426
|
+
var styles_module_default21 = { "Editor": "_Editor_1d9v5_8", "Editor-portal": "_Editor-portal_1d9v5_21", "EditorLayout": "_EditorLayout_1d9v5_26", "EditorLayout-inner": "_EditorLayout-inner_1d9v5_30", "EditorLayout--navBarVisible": "_EditorLayout--navBarVisible_1d9v5_44", "EditorLayout-header": "_EditorLayout-header_1d9v5_49", "EditorLayout-headerStart": "_EditorLayout-headerStart_1d9v5_62", "EditorLayout-headerCenter": "_EditorLayout-headerCenter_1d9v5_70", "EditorLayout-headerEnd": "_EditorLayout-headerEnd_1d9v5_81", "EditorLayout-headerHistory": "_EditorLayout-headerHistory_1d9v5_91", "EditorPluginTab": "_EditorPluginTab_1d9v5_110", "EditorPluginTab--visible": "_EditorPluginTab--visible_1d9v5_116", "EditorPluginTab-body": "_EditorPluginTab-body_1d9v5_121" };
|
|
7407
7427
|
|
|
7408
7428
|
// lib/use-inject-css.ts
|
|
7409
7429
|
init_react_import();
|
|
@@ -7434,8 +7454,8 @@ var useInjectGlobalCss = (iframeEnabled) => {
|
|
|
7434
7454
|
|
|
7435
7455
|
// components/DefaultOverride/index.tsx
|
|
7436
7456
|
init_react_import();
|
|
7437
|
-
import { Fragment as Fragment12, jsx as
|
|
7438
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */
|
|
7457
|
+
import { Fragment as Fragment12, jsx as jsx44 } from "react/jsx-runtime";
|
|
7458
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx44(Fragment12, { children });
|
|
7439
7459
|
|
|
7440
7460
|
// lib/use-preview-mode-hotkeys.ts
|
|
7441
7461
|
init_react_import();
|
|
@@ -7460,11 +7480,11 @@ init_react_import();
|
|
|
7460
7480
|
|
|
7461
7481
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/SidebarSection/styles.module.css#css-module
|
|
7462
7482
|
init_react_import();
|
|
7463
|
-
var
|
|
7483
|
+
var styles_module_default22 = { "SidebarSection": "_SidebarSection_tt2oy_1", "SidebarSection-title": "_SidebarSection-title_tt2oy_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_tt2oy_20", "SidebarSection-content": "_SidebarSection-content_tt2oy_24", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_tt2oy_33", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_tt2oy_62", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_tt2oy_33", "SidebarSection-heading": "_SidebarSection-heading_tt2oy_74", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_tt2oy_88" };
|
|
7464
7484
|
|
|
7465
7485
|
// components/SidebarSection/index.tsx
|
|
7466
|
-
import { jsx as
|
|
7467
|
-
var
|
|
7486
|
+
import { jsx as jsx45, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7487
|
+
var getClassName26 = get_class_name_factory_default("SidebarSection", styles_module_default22);
|
|
7468
7488
|
var SidebarSection = ({
|
|
7469
7489
|
children,
|
|
7470
7490
|
title,
|
|
@@ -7473,13 +7493,15 @@ var SidebarSection = ({
|
|
|
7473
7493
|
noBorderTop,
|
|
7474
7494
|
isLoading
|
|
7475
7495
|
}) => {
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7496
|
+
const showTitleBar = title !== null && title !== void 0;
|
|
7497
|
+
const showBreadcrumbsRow = !!showBreadcrumbs;
|
|
7498
|
+
return /* @__PURE__ */ jsxs18("div", { className: getClassName26({ noBorderTop }), style: { background }, children: [
|
|
7499
|
+
(showTitleBar || showBreadcrumbsRow) && /* @__PURE__ */ jsx45("div", { className: getClassName26("title"), children: /* @__PURE__ */ jsxs18("div", { className: getClassName26("breadcrumbs"), children: [
|
|
7500
|
+
showBreadcrumbsRow && /* @__PURE__ */ jsx45(Breadcrumbs, {}),
|
|
7501
|
+
showTitleBar && /* @__PURE__ */ jsx45("div", { className: getClassName26("heading"), children: /* @__PURE__ */ jsx45(Heading, { rank: "2", size: "xs", children: title }) })
|
|
7480
7502
|
] }) }),
|
|
7481
|
-
/* @__PURE__ */
|
|
7482
|
-
isLoading && /* @__PURE__ */
|
|
7503
|
+
/* @__PURE__ */ jsx45("div", { className: getClassName26("content"), children }),
|
|
7504
|
+
isLoading && /* @__PURE__ */ jsx45("div", { className: getClassName26("loadingOverlay"), children: /* @__PURE__ */ jsx45(Loader, { size: 32 }) })
|
|
7483
7505
|
] });
|
|
7484
7506
|
};
|
|
7485
7507
|
|
|
@@ -7488,320 +7510,102 @@ init_react_import();
|
|
|
7488
7510
|
import {
|
|
7489
7511
|
useCallback as useCallback19,
|
|
7490
7512
|
useEffect as useEffect23,
|
|
7491
|
-
useMemo as
|
|
7492
|
-
useRef as
|
|
7493
|
-
useState as
|
|
7513
|
+
useMemo as useMemo21,
|
|
7514
|
+
useRef as useRef14,
|
|
7515
|
+
useState as useState20
|
|
7494
7516
|
} from "react";
|
|
7517
|
+
import {
|
|
7518
|
+
TransformWrapper,
|
|
7519
|
+
TransformComponent,
|
|
7520
|
+
useTransformComponent,
|
|
7521
|
+
useTransformEffect
|
|
7522
|
+
} from "react-zoom-pan-pinch";
|
|
7495
7523
|
|
|
7496
|
-
// components/
|
|
7524
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Canvas/styles.module.css#css-module
|
|
7497
7525
|
init_react_import();
|
|
7498
|
-
|
|
7526
|
+
var styles_module_default23 = { "EditorCanvas": "_EditorCanvas_1h1vv_1", "EditorCanvas--fullScreen": "_EditorCanvas--fullScreen_1h1vv_11", "EditorCanvas--canvasFullScreen": "_EditorCanvas--canvasFullScreen_1h1vv_31", "EditorCanvas-inner": "_EditorCanvas-inner_1h1vv_38", "EditorCanvas-bar": "_EditorCanvas-bar_1h1vv_50", "EditorCanvas-zoomViewport": "_EditorCanvas-zoomViewport_1h1vv_60", "EditorCanvas-rootColumn": "_EditorCanvas-rootColumn_1h1vv_69", "EditorCanvas-frame": "_EditorCanvas-frame_1h1vv_74", "EditorCanvas-root": "_EditorCanvas-root_1h1vv_69", "EditorCanvas--ready": "_EditorCanvas--ready_1h1vv_98", "EditorCanvas-loader": "_EditorCanvas-loader_1h1vv_103", "EditorCanvas--showLoader": "_EditorCanvas--showLoader_1h1vv_115", "EditorCanvas-toolbar": "_EditorCanvas-toolbar_1h1vv_128", "EditorCanvas-toolbarDivider": "_EditorCanvas-toolbarDivider_1h1vv_144", "EditorCanvas-zoomLevel": "_EditorCanvas-zoomLevel_1h1vv_152" };
|
|
7499
7527
|
|
|
7500
|
-
// components/
|
|
7501
|
-
|
|
7502
|
-
import { Combobox as ComboboxPrimitive } from "@base-ui/react";
|
|
7528
|
+
// components/Editor/components/Canvas/index.tsx
|
|
7529
|
+
import { useShallow as useShallow9 } from "zustand/react/shallow";
|
|
7503
7530
|
|
|
7504
|
-
//
|
|
7531
|
+
// lib/frame-context.tsx
|
|
7505
7532
|
init_react_import();
|
|
7506
|
-
|
|
7533
|
+
import {
|
|
7534
|
+
createContext as createContext7,
|
|
7535
|
+
useContext as useContext14,
|
|
7536
|
+
useRef as useRef13,
|
|
7537
|
+
useMemo as useMemo20
|
|
7538
|
+
} from "react";
|
|
7539
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
7540
|
+
var FrameContext = createContext7(null);
|
|
7541
|
+
var FrameProvider = ({
|
|
7542
|
+
children
|
|
7543
|
+
}) => {
|
|
7544
|
+
const frameRef = useRef13(null);
|
|
7545
|
+
const value = useMemo20(
|
|
7546
|
+
() => ({
|
|
7547
|
+
frameRef
|
|
7548
|
+
}),
|
|
7549
|
+
[]
|
|
7550
|
+
);
|
|
7551
|
+
return /* @__PURE__ */ jsx46(FrameContext.Provider, { value, children });
|
|
7552
|
+
};
|
|
7553
|
+
var useCanvasFrame = () => {
|
|
7554
|
+
const context = useContext14(FrameContext);
|
|
7555
|
+
if (context === null) {
|
|
7556
|
+
throw new Error("useCanvasFrame must be used within a FrameProvider");
|
|
7557
|
+
}
|
|
7558
|
+
return context;
|
|
7559
|
+
};
|
|
7507
7560
|
|
|
7508
|
-
//
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
var
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
if (typeof override === "function") {
|
|
7515
|
-
return (state) => join(base, override(state));
|
|
7561
|
+
// lib/theme-context.tsx
|
|
7562
|
+
init_react_import();
|
|
7563
|
+
import { createContext as createContext8, useContext as useContext15 } from "react";
|
|
7564
|
+
var ThemeContext = createContext8({
|
|
7565
|
+
theme: "light",
|
|
7566
|
+
toggleTheme: () => {
|
|
7516
7567
|
}
|
|
7517
|
-
|
|
7568
|
+
});
|
|
7569
|
+
var useEditorTheme = () => useContext15(ThemeContext);
|
|
7570
|
+
|
|
7571
|
+
// components/Editor/components/Canvas/index.tsx
|
|
7572
|
+
import { Fragment as Fragment13, jsx as jsx47, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7573
|
+
var getClassName27 = get_class_name_factory_default("EditorCanvas", styles_module_default23);
|
|
7574
|
+
var MIN_ZOOM = 0.25;
|
|
7575
|
+
var MAX_ZOOM = 3;
|
|
7576
|
+
var PREVIEW_MAX_WIDTH = 1200;
|
|
7577
|
+
var DEVICE_VIEWPORTS = {
|
|
7578
|
+
desktop: { width: "100%", height: "auto", label: "Desktop" },
|
|
7579
|
+
tablet: { width: 768, height: "auto", label: "Tablet" },
|
|
7580
|
+
mobile: { width: 360, height: "auto", label: "Mobile" }
|
|
7518
7581
|
};
|
|
7519
|
-
var
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
"className"
|
|
7525
|
-
]);
|
|
7526
|
-
return /* @__PURE__ */ jsx47(
|
|
7527
|
-
ComboboxPrimitive.Input,
|
|
7528
|
-
__spreadValues({
|
|
7529
|
-
"data-slot": "combobox-input",
|
|
7530
|
-
className: mergeClassName(getClassName28("input"), className)
|
|
7531
|
-
}, props)
|
|
7532
|
-
);
|
|
7533
|
-
}
|
|
7534
|
-
function ComboboxContent(_a) {
|
|
7535
|
-
var _b = _a, {
|
|
7536
|
-
className,
|
|
7537
|
-
side = "bottom",
|
|
7538
|
-
sideOffset = 4,
|
|
7539
|
-
align = "start",
|
|
7540
|
-
alignOffset = 0,
|
|
7541
|
-
children
|
|
7542
|
-
} = _b, props = __objRest(_b, [
|
|
7543
|
-
"className",
|
|
7544
|
-
"side",
|
|
7545
|
-
"sideOffset",
|
|
7546
|
-
"align",
|
|
7547
|
-
"alignOffset",
|
|
7548
|
-
"children"
|
|
7549
|
-
]);
|
|
7550
|
-
return /* @__PURE__ */ jsx47(ComboboxPrimitive.Portal, { children: /* @__PURE__ */ jsx47(
|
|
7551
|
-
ComboboxPrimitive.Positioner,
|
|
7552
|
-
{
|
|
7553
|
-
side,
|
|
7554
|
-
sideOffset,
|
|
7555
|
-
align,
|
|
7556
|
-
alignOffset,
|
|
7557
|
-
className: getClassName28("positioner"),
|
|
7558
|
-
children: /* @__PURE__ */ jsx47(
|
|
7559
|
-
ComboboxPrimitive.Popup,
|
|
7560
|
-
__spreadProps(__spreadValues({
|
|
7561
|
-
"data-slot": "combobox-content",
|
|
7562
|
-
className: mergeClassName(getClassName28("content"), className)
|
|
7563
|
-
}, props), {
|
|
7564
|
-
children
|
|
7565
|
-
})
|
|
7566
|
-
)
|
|
7567
|
-
}
|
|
7568
|
-
) });
|
|
7569
|
-
}
|
|
7570
|
-
function ComboboxList(_a) {
|
|
7571
|
-
var _b = _a, {
|
|
7572
|
-
className
|
|
7573
|
-
} = _b, props = __objRest(_b, [
|
|
7574
|
-
"className"
|
|
7575
|
-
]);
|
|
7576
|
-
return /* @__PURE__ */ jsx47(
|
|
7577
|
-
ComboboxPrimitive.List,
|
|
7578
|
-
__spreadValues({
|
|
7579
|
-
"data-slot": "combobox-list",
|
|
7580
|
-
className: mergeClassName(getClassName28("list"), className)
|
|
7581
|
-
}, props)
|
|
7582
|
-
);
|
|
7583
|
-
}
|
|
7584
|
-
function ComboboxItem(_a) {
|
|
7585
|
-
var _b = _a, {
|
|
7586
|
-
className,
|
|
7587
|
-
children
|
|
7588
|
-
} = _b, props = __objRest(_b, [
|
|
7589
|
-
"className",
|
|
7590
|
-
"children"
|
|
7591
|
-
]);
|
|
7592
|
-
return /* @__PURE__ */ jsxs19(
|
|
7593
|
-
ComboboxPrimitive.Item,
|
|
7594
|
-
__spreadProps(__spreadValues({
|
|
7595
|
-
"data-slot": "combobox-item",
|
|
7596
|
-
className: mergeClassName(getClassName28("item"), className)
|
|
7597
|
-
}, props), {
|
|
7598
|
-
children: [
|
|
7599
|
-
/* @__PURE__ */ jsx47("span", { className: getClassName28("itemIndicator"), children: /* @__PURE__ */ jsx47(ComboboxPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx47(Check, { size: 14 }) }) }),
|
|
7600
|
-
children
|
|
7601
|
-
]
|
|
7602
|
-
})
|
|
7603
|
-
);
|
|
7604
|
-
}
|
|
7605
|
-
function ComboboxEmpty(_a) {
|
|
7606
|
-
var _b = _a, {
|
|
7607
|
-
className
|
|
7608
|
-
} = _b, props = __objRest(_b, [
|
|
7609
|
-
"className"
|
|
7610
|
-
]);
|
|
7611
|
-
return /* @__PURE__ */ jsx47(
|
|
7612
|
-
ComboboxPrimitive.Empty,
|
|
7613
|
-
__spreadValues({
|
|
7614
|
-
"data-slot": "combobox-empty",
|
|
7615
|
-
className: mergeClassName(getClassName28("empty"), className)
|
|
7616
|
-
}, props)
|
|
7617
|
-
);
|
|
7618
|
-
}
|
|
7619
|
-
|
|
7620
|
-
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/BrowserBar/styles.module.css#css-module
|
|
7621
|
-
init_react_import();
|
|
7622
|
-
var styles_module_default25 = { "BrowserBar": "_BrowserBar_coofe_1", "BrowserBar-urlTrigger": "_BrowserBar-urlTrigger_coofe_16", "BrowserBar-urlIcon": "_BrowserBar-urlIcon_coofe_46", "BrowserBar-urlText": "_BrowserBar-urlText_coofe_51", "BrowserBar-urlInput": "_BrowserBar-urlInput_coofe_63", "BrowserBar-itemPath": "_BrowserBar-itemPath_coofe_69", "BrowserBar-itemTitle": "_BrowserBar-itemTitle_coofe_74", "BrowserBar-actions": "_BrowserBar-actions_coofe_82", "BrowserBar-deviceIcon": "_BrowserBar-deviceIcon_coofe_92" };
|
|
7623
|
-
|
|
7624
|
-
// components/BrowserBar/index.tsx
|
|
7625
|
-
import { jsx as jsx48, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7626
|
-
var normalizeRoute = (raw) => {
|
|
7627
|
-
const trimmed = raw.trim();
|
|
7628
|
-
if (!trimmed) return trimmed;
|
|
7629
|
-
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
7630
|
-
};
|
|
7631
|
-
var getClassName29 = get_class_name_factory_default("BrowserBar", styles_module_default25);
|
|
7632
|
-
var DEVICE_VIEWPORTS = {
|
|
7633
|
-
desktop: { width: "100%", height: "auto", icon: "Monitor", label: "Desktop" },
|
|
7634
|
-
mobile: { width: 360, height: "auto", icon: "Smartphone", label: "Mobile" }
|
|
7582
|
+
var DEVICE_ORDER = ["desktop", "tablet", "mobile"];
|
|
7583
|
+
var DEVICE_ICONS = {
|
|
7584
|
+
desktop: /* @__PURE__ */ jsx47(Monitor, { size: 14 }),
|
|
7585
|
+
tablet: /* @__PURE__ */ jsx47(Tablet, { size: 14 }),
|
|
7586
|
+
mobile: /* @__PURE__ */ jsx47(Smartphone, { size: 14 })
|
|
7635
7587
|
};
|
|
7636
|
-
var
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
const dispatch = useAppStore((s) => s.dispatch);
|
|
7643
|
-
const isFullScreen = useAppStore(
|
|
7644
|
-
(s) => {
|
|
7645
|
-
var _a;
|
|
7646
|
-
return (_a = s.state.ui.canvasFullScreen) != null ? _a : false;
|
|
7588
|
+
var ZoomConfigSync = () => {
|
|
7589
|
+
const appStoreApi = useAppStoreApi();
|
|
7590
|
+
useTransformEffect((ref) => {
|
|
7591
|
+
const { zoomConfig, setZoomConfig } = appStoreApi.getState();
|
|
7592
|
+
if (zoomConfig.zoom !== ref.state.scale) {
|
|
7593
|
+
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom: ref.state.scale }));
|
|
7647
7594
|
}
|
|
7648
|
-
);
|
|
7649
|
-
|
|
7650
|
-
dispatch({
|
|
7651
|
-
type: "setUi",
|
|
7652
|
-
ui: { canvasFullScreen: !isFullScreen }
|
|
7653
|
-
});
|
|
7654
|
-
};
|
|
7655
|
-
const activeDevice = useMemo20(() => {
|
|
7656
|
-
const w = viewports.current.width;
|
|
7657
|
-
if (typeof w === "number" && w <= 640) return "mobile";
|
|
7658
|
-
return "desktop";
|
|
7659
|
-
}, [viewports.current.width]);
|
|
7660
|
-
const setDevice = (device) => {
|
|
7661
|
-
onViewportChange == null ? void 0 : onViewportChange(DEVICE_VIEWPORTS[device]);
|
|
7662
|
-
};
|
|
7663
|
-
const showRoutePicker = !!routes && currentRoute !== void 0 && !!onRouteChange;
|
|
7664
|
-
const [inputValue, setInputValue] = useState20(currentRoute != null ? currentRoute : "");
|
|
7665
|
-
const lastSyncedPath = useRef13(currentRoute);
|
|
7666
|
-
if (lastSyncedPath.current !== currentRoute) {
|
|
7667
|
-
lastSyncedPath.current = currentRoute;
|
|
7668
|
-
setInputValue(currentRoute != null ? currentRoute : "");
|
|
7669
|
-
}
|
|
7670
|
-
const submit = (raw) => {
|
|
7671
|
-
const next = normalizeRoute(raw);
|
|
7672
|
-
if (!next || next === currentRoute) return;
|
|
7673
|
-
void (onRouteChange == null ? void 0 : onRouteChange(next));
|
|
7674
|
-
};
|
|
7675
|
-
if (!chrome.showUrlBar && !chrome.showDeviceToggle && !chrome.showFullScreenToggle) {
|
|
7676
|
-
return null;
|
|
7677
|
-
}
|
|
7678
|
-
return /* @__PURE__ */ jsxs20("div", { className: getClassName29(), children: [
|
|
7679
|
-
chrome.showUrlBar && (showRoutePicker ? /* @__PURE__ */ jsxs20(
|
|
7680
|
-
Combobox,
|
|
7681
|
-
{
|
|
7682
|
-
items: routes,
|
|
7683
|
-
value: currentRoute,
|
|
7684
|
-
onValueChange: (next) => {
|
|
7685
|
-
if (typeof next === "string") submit(next);
|
|
7686
|
-
},
|
|
7687
|
-
inputValue,
|
|
7688
|
-
onInputValueChange: (next) => setInputValue(next),
|
|
7689
|
-
autoHighlight: false,
|
|
7690
|
-
children: [
|
|
7691
|
-
/* @__PURE__ */ jsxs20(
|
|
7692
|
-
"form",
|
|
7693
|
-
{
|
|
7694
|
-
className: getClassName29("urlTrigger"),
|
|
7695
|
-
onSubmit: (event) => {
|
|
7696
|
-
event.preventDefault();
|
|
7697
|
-
submit(inputValue);
|
|
7698
|
-
},
|
|
7699
|
-
children: [
|
|
7700
|
-
/* @__PURE__ */ jsx48(Globe, { className: getClassName29("urlIcon"), size: 14 }),
|
|
7701
|
-
/* @__PURE__ */ jsx48(
|
|
7702
|
-
ComboboxInput,
|
|
7703
|
-
{
|
|
7704
|
-
className: getClassName29("urlInput"),
|
|
7705
|
-
placeholder: "/",
|
|
7706
|
-
spellCheck: false,
|
|
7707
|
-
autoCorrect: "off",
|
|
7708
|
-
autoCapitalize: "off"
|
|
7709
|
-
}
|
|
7710
|
-
)
|
|
7711
|
-
]
|
|
7712
|
-
}
|
|
7713
|
-
),
|
|
7714
|
-
/* @__PURE__ */ jsxs20(ComboboxContent, { children: [
|
|
7715
|
-
/* @__PURE__ */ jsx48(ComboboxEmpty, { children: "Press Enter to go to this path" }),
|
|
7716
|
-
/* @__PURE__ */ jsx48(ComboboxList, { children: (path) => /* @__PURE__ */ jsx48(ComboboxItem, { value: path, children: /* @__PURE__ */ jsx48("span", { className: getClassName29("itemPath"), children: path }) }, path) })
|
|
7717
|
-
] })
|
|
7718
|
-
]
|
|
7719
|
-
}
|
|
7720
|
-
) : /* @__PURE__ */ jsxs20("div", { className: getClassName29("urlTrigger"), children: [
|
|
7721
|
-
/* @__PURE__ */ jsx48(Globe, { className: getClassName29("urlIcon"), size: 14 }),
|
|
7722
|
-
/* @__PURE__ */ jsx48("span", { className: getClassName29("urlText"), children: "/" })
|
|
7723
|
-
] })),
|
|
7724
|
-
(chrome.showDeviceToggle || chrome.showFullScreenToggle) && /* @__PURE__ */ jsxs20("div", { className: getClassName29("actions"), children: [
|
|
7725
|
-
chrome.showDeviceToggle && /* @__PURE__ */ jsx48(
|
|
7726
|
-
IconButton,
|
|
7727
|
-
{
|
|
7728
|
-
type: "button",
|
|
7729
|
-
title: activeDevice === "desktop" ? "Switch to mobile viewport" : "Switch to desktop viewport",
|
|
7730
|
-
onClick: () => setDevice(activeDevice === "desktop" ? "mobile" : "desktop"),
|
|
7731
|
-
children: /* @__PURE__ */ jsx48("span", { className: getClassName29("deviceIcon"), children: activeDevice === "desktop" ? /* @__PURE__ */ jsx48(Monitor, { size: 16 }) : /* @__PURE__ */ jsx48(Smartphone, { size: 16 }) })
|
|
7732
|
-
}
|
|
7733
|
-
),
|
|
7734
|
-
chrome.showFullScreenToggle && /* @__PURE__ */ jsx48(
|
|
7735
|
-
IconButton,
|
|
7736
|
-
{
|
|
7737
|
-
type: "button",
|
|
7738
|
-
title: isFullScreen ? "Exit full screen" : "Enter full screen",
|
|
7739
|
-
onClick: toggleFullScreen,
|
|
7740
|
-
children: /* @__PURE__ */ jsx48("span", { className: getClassName29("deviceIcon"), children: isFullScreen ? /* @__PURE__ */ jsx48(Minimize, { size: 16 }) : /* @__PURE__ */ jsx48(Maximize, { size: 16 }) })
|
|
7741
|
-
}
|
|
7742
|
-
)
|
|
7743
|
-
] })
|
|
7744
|
-
] });
|
|
7745
|
-
};
|
|
7746
|
-
|
|
7747
|
-
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Canvas/styles.module.css#css-module
|
|
7748
|
-
init_react_import();
|
|
7749
|
-
var styles_module_default26 = { "EditorCanvas": "_EditorCanvas_1aq14_1", "EditorCanvas-controls": "_EditorCanvas-controls_1aq14_17", "EditorCanvas--fullScreen": "_EditorCanvas--fullScreen_1aq14_22", "EditorCanvas--canvasFullScreen": "_EditorCanvas--canvasFullScreen_1aq14_42", "EditorCanvas-inner": "_EditorCanvas-inner_1aq14_49", "EditorCanvas-rootColumn": "_EditorCanvas-rootColumn_1aq14_62", "EditorCanvas-root": "_EditorCanvas-root_1aq14_62", "EditorCanvas--ready": "_EditorCanvas--ready_1aq14_99", "EditorCanvas-loader": "_EditorCanvas-loader_1aq14_104", "EditorCanvas--showLoader": "_EditorCanvas--showLoader_1aq14_116", "EditorCanvas-browserBar": "_EditorCanvas-browserBar_1aq14_125", "EditorCanvas-zoomControls": "_EditorCanvas-zoomControls_1aq14_130" };
|
|
7750
|
-
|
|
7751
|
-
// components/Editor/components/Canvas/index.tsx
|
|
7752
|
-
import { useShallow as useShallow9 } from "zustand/react/shallow";
|
|
7753
|
-
|
|
7754
|
-
// lib/frame-context.tsx
|
|
7755
|
-
init_react_import();
|
|
7756
|
-
import {
|
|
7757
|
-
createContext as createContext7,
|
|
7758
|
-
useContext as useContext14,
|
|
7759
|
-
useRef as useRef14,
|
|
7760
|
-
useMemo as useMemo21
|
|
7761
|
-
} from "react";
|
|
7762
|
-
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
7763
|
-
var FrameContext = createContext7(null);
|
|
7764
|
-
var FrameProvider = ({
|
|
7765
|
-
children
|
|
7766
|
-
}) => {
|
|
7767
|
-
const frameRef = useRef14(null);
|
|
7768
|
-
const value = useMemo21(
|
|
7769
|
-
() => ({
|
|
7770
|
-
frameRef
|
|
7771
|
-
}),
|
|
7772
|
-
[]
|
|
7773
|
-
);
|
|
7774
|
-
return /* @__PURE__ */ jsx49(FrameContext.Provider, { value, children });
|
|
7595
|
+
});
|
|
7596
|
+
return null;
|
|
7775
7597
|
};
|
|
7776
|
-
var
|
|
7777
|
-
const
|
|
7778
|
-
|
|
7779
|
-
throw new Error("useCanvasFrame must be used within a FrameProvider");
|
|
7780
|
-
}
|
|
7781
|
-
return context;
|
|
7598
|
+
var ZoomLevel = ({ className }) => {
|
|
7599
|
+
const scale = useTransformComponent((ctx) => ctx.state.scale);
|
|
7600
|
+
return /* @__PURE__ */ jsx47("span", { className, children: `${Math.round(scale * 100)}%` });
|
|
7782
7601
|
};
|
|
7783
|
-
|
|
7784
|
-
// components/Editor/components/Canvas/index.tsx
|
|
7785
|
-
import { Fragment as Fragment13, jsx as jsx50, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7786
|
-
var getClassName30 = get_class_name_factory_default("EditorCanvas", styles_module_default26);
|
|
7787
|
-
var ZOOM_STEP = 0.15;
|
|
7788
|
-
var MIN_ZOOM = 0.25;
|
|
7789
|
-
var MAX_ZOOM = 3;
|
|
7790
|
-
var TRANSITION_DURATION = 150;
|
|
7791
7602
|
var Canvas = () => {
|
|
7792
|
-
var _a, _b;
|
|
7793
7603
|
const { frameRef } = useCanvasFrame();
|
|
7794
|
-
const {
|
|
7795
|
-
viewports: viewportOptions = defaultViewports,
|
|
7796
|
-
ui: uiProp,
|
|
7797
|
-
disableZoomControls
|
|
7798
|
-
} = usePropsContext();
|
|
7604
|
+
const { disableZoomControls } = usePropsContext();
|
|
7799
7605
|
const {
|
|
7800
7606
|
dispatch,
|
|
7801
7607
|
overrides,
|
|
7802
7608
|
setUi,
|
|
7803
|
-
zoomConfig,
|
|
7804
|
-
setZoomConfig,
|
|
7805
7609
|
status,
|
|
7806
7610
|
iframe,
|
|
7807
7611
|
fullScreenCanvas
|
|
@@ -7810,8 +7614,6 @@ var Canvas = () => {
|
|
|
7810
7614
|
dispatch: s.dispatch,
|
|
7811
7615
|
overrides: s.overrides,
|
|
7812
7616
|
setUi: s.setUi,
|
|
7813
|
-
zoomConfig: s.zoomConfig,
|
|
7814
|
-
setZoomConfig: s.setZoomConfig,
|
|
7815
7617
|
status: s.status,
|
|
7816
7618
|
iframe: s.iframe,
|
|
7817
7619
|
fullScreenCanvas: s.fullScreenCanvas
|
|
@@ -7820,143 +7622,203 @@ var Canvas = () => {
|
|
|
7820
7622
|
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
7821
7623
|
const canvasFullScreen = useAppStore(
|
|
7822
7624
|
(s) => {
|
|
7823
|
-
var
|
|
7824
|
-
return (
|
|
7625
|
+
var _a;
|
|
7626
|
+
return (_a = s.state.ui.canvasFullScreen) != null ? _a : false;
|
|
7825
7627
|
}
|
|
7826
7628
|
);
|
|
7827
|
-
const
|
|
7828
|
-
const
|
|
7829
|
-
const
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
const
|
|
7834
|
-
const
|
|
7629
|
+
const chrome = useChromeConfig();
|
|
7630
|
+
const { theme, toggleTheme } = useEditorTheme();
|
|
7631
|
+
const toggleFullScreen = useCallback19(
|
|
7632
|
+
() => setUi({ canvasFullScreen: !canvasFullScreen }),
|
|
7633
|
+
[setUi, canvasFullScreen]
|
|
7634
|
+
);
|
|
7635
|
+
const activeDevice = useMemo21(() => {
|
|
7636
|
+
const w = viewports.current.width;
|
|
7637
|
+
if (w === "100%") return "desktop";
|
|
7638
|
+
if (typeof w === "number" && w <= 640) return "mobile";
|
|
7639
|
+
return "tablet";
|
|
7640
|
+
}, [viewports.current.width]);
|
|
7641
|
+
const cycleDevice = useCallback19(() => {
|
|
7642
|
+
const next = DEVICE_ORDER[(DEVICE_ORDER.indexOf(activeDevice) + 1) % DEVICE_ORDER.length];
|
|
7643
|
+
const v = DEVICE_VIEWPORTS[next];
|
|
7644
|
+
setUi({
|
|
7645
|
+
viewports: __spreadProps(__spreadValues({}, viewports), {
|
|
7646
|
+
current: { width: v.width, height: v.height }
|
|
7647
|
+
})
|
|
7648
|
+
});
|
|
7649
|
+
}, [activeDevice, setUi, viewports]);
|
|
7650
|
+
const nextDeviceLabel = DEVICE_VIEWPORTS[DEVICE_ORDER[(DEVICE_ORDER.indexOf(activeDevice) + 1) % DEVICE_ORDER.length]].label;
|
|
7651
|
+
const transformRef = useRef14(null);
|
|
7652
|
+
const defaultRender = useMemo21(() => {
|
|
7653
|
+
const EditorDefault = ({ children }) => /* @__PURE__ */ jsx47(Fragment13, { children });
|
|
7835
7654
|
return EditorDefault;
|
|
7836
7655
|
}, []);
|
|
7837
|
-
const CustomPreview =
|
|
7656
|
+
const CustomPreview = useMemo21(
|
|
7838
7657
|
() => overrides.preview || defaultRender,
|
|
7839
7658
|
[overrides]
|
|
7840
7659
|
);
|
|
7841
|
-
const
|
|
7842
|
-
if (frameRef.current) {
|
|
7843
|
-
const frame = frameRef.current;
|
|
7844
|
-
const box = getBox(frame);
|
|
7845
|
-
return { width: box.contentBox.width, height: box.contentBox.height };
|
|
7846
|
-
}
|
|
7847
|
-
return { width: 0, height: 0 };
|
|
7848
|
-
}, [frameRef]);
|
|
7849
|
-
useEffect23(() => {
|
|
7850
|
-
const { height: frameHeight } = getFrameDimensions();
|
|
7851
|
-
if (viewports.current.height === "auto") {
|
|
7852
|
-
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom: 1, rootHeight: frameHeight }));
|
|
7853
|
-
}
|
|
7854
|
-
}, [getFrameDimensions, setZoomConfig, viewports.current.height]);
|
|
7855
|
-
const [showLoader, setShowLoader] = useState21(false);
|
|
7660
|
+
const [showLoader, setShowLoader] = useState20(false);
|
|
7856
7661
|
useEffect23(() => {
|
|
7857
7662
|
setTimeout(() => {
|
|
7858
7663
|
setShowLoader(true);
|
|
7859
7664
|
}, 500);
|
|
7860
7665
|
}, []);
|
|
7861
|
-
const
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
value
|
|
7880
|
-
})).sort((a, b) => a.diff > b.diff ? 1 : -1);
|
|
7881
|
-
let closestViewport = (_b2 = viewportDifferences[0]) == null ? void 0 : _b2.value;
|
|
7882
|
-
if (!closestViewport) return null;
|
|
7883
|
-
if (closestViewport.width < frameWidth && fullWidthViewport) {
|
|
7884
|
-
closestViewport = fullWidthViewport;
|
|
7885
|
-
}
|
|
7886
|
-
return closestViewport;
|
|
7887
|
-
}, [viewportOptions, frameRef]);
|
|
7666
|
+
const centerFrame = useCallback19(() => {
|
|
7667
|
+
let canceled = false;
|
|
7668
|
+
requestAnimationFrame(() => {
|
|
7669
|
+
if (canceled) return;
|
|
7670
|
+
requestAnimationFrame(() => {
|
|
7671
|
+
if (canceled) return;
|
|
7672
|
+
const ref = transformRef.current;
|
|
7673
|
+
const wrapper = ref == null ? void 0 : ref.instance.wrapperComponent;
|
|
7674
|
+
if (!ref || !wrapper) return;
|
|
7675
|
+
const wrapperW = wrapper.clientWidth;
|
|
7676
|
+
const x = Math.max(0, (wrapperW - PREVIEW_MAX_WIDTH) / 2);
|
|
7677
|
+
ref.setTransform(x, 16, 1, 0);
|
|
7678
|
+
});
|
|
7679
|
+
});
|
|
7680
|
+
return () => {
|
|
7681
|
+
canceled = true;
|
|
7682
|
+
};
|
|
7683
|
+
}, []);
|
|
7888
7684
|
useEffect23(() => {
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7685
|
+
return centerFrame();
|
|
7686
|
+
}, [centerFrame, viewports.current.width]);
|
|
7687
|
+
const handleZoomIn = useCallback19(
|
|
7688
|
+
() => {
|
|
7689
|
+
var _a;
|
|
7690
|
+
return (_a = transformRef.current) == null ? void 0 : _a.zoomIn();
|
|
7691
|
+
},
|
|
7692
|
+
[]
|
|
7693
|
+
);
|
|
7694
|
+
const handleZoomOut = useCallback19(
|
|
7695
|
+
() => {
|
|
7696
|
+
var _a;
|
|
7697
|
+
return (_a = transformRef.current) == null ? void 0 : _a.zoomOut();
|
|
7698
|
+
},
|
|
7699
|
+
[]
|
|
7700
|
+
);
|
|
7701
|
+
const handleResetZoom = useCallback19(() => {
|
|
7702
|
+
centerFrame();
|
|
7703
|
+
}, [centerFrame]);
|
|
7704
|
+
useEffect23(() => {
|
|
7705
|
+
var _a;
|
|
7706
|
+
const handler = (e) => {
|
|
7707
|
+
var _a2;
|
|
7708
|
+
e.preventDefault();
|
|
7709
|
+
const ref = transformRef.current;
|
|
7710
|
+
if (!ref) return;
|
|
7711
|
+
const isPinch = e.ctrlKey || e.metaKey;
|
|
7712
|
+
if (isPinch) {
|
|
7713
|
+
const wrapper = ref.instance.wrapperComponent;
|
|
7714
|
+
if (!wrapper) return;
|
|
7715
|
+
const factor = e.deltaY < 0 ? 1.05 : 1 / 1.05;
|
|
7716
|
+
const currentScale = ref.state.scale;
|
|
7717
|
+
const newScale = Math.max(
|
|
7718
|
+
MIN_ZOOM,
|
|
7719
|
+
Math.min(MAX_ZOOM, currentScale * factor)
|
|
7720
|
+
);
|
|
7721
|
+
if (newScale === currentScale) return;
|
|
7722
|
+
const wrapperRect = wrapper.getBoundingClientRect();
|
|
7723
|
+
const isIframeEvent = ((_a2 = e.target) == null ? void 0 : _a2.ownerDocument) !== document;
|
|
7724
|
+
let cursorX;
|
|
7725
|
+
let cursorY;
|
|
7726
|
+
if (isIframeEvent) {
|
|
7727
|
+
const iframeEl = document.getElementById(
|
|
7728
|
+
"preview-frame"
|
|
7729
|
+
);
|
|
7730
|
+
const iframeRect = iframeEl == null ? void 0 : iframeEl.getBoundingClientRect();
|
|
7731
|
+
if (!iframeRect) return;
|
|
7732
|
+
cursorX = iframeRect.left + e.clientX * currentScale - wrapperRect.left;
|
|
7733
|
+
cursorY = iframeRect.top + e.clientY * currentScale - wrapperRect.top;
|
|
7734
|
+
} else {
|
|
7735
|
+
cursorX = e.clientX - wrapperRect.left;
|
|
7736
|
+
cursorY = e.clientY - wrapperRect.top;
|
|
7737
|
+
}
|
|
7738
|
+
const ratio = newScale / currentScale;
|
|
7739
|
+
const newPositionX = cursorX - (cursorX - ref.state.positionX) * ratio;
|
|
7740
|
+
const newPositionY = cursorY - (cursorY - ref.state.positionY) * ratio;
|
|
7741
|
+
ref.setTransform(newPositionX, newPositionY, newScale, 0);
|
|
7742
|
+
return;
|
|
7743
|
+
}
|
|
7744
|
+
ref.setTransform(
|
|
7745
|
+
ref.state.positionX - e.deltaX,
|
|
7746
|
+
ref.state.positionY - e.deltaY,
|
|
7747
|
+
ref.state.scale,
|
|
7748
|
+
0
|
|
7749
|
+
);
|
|
7750
|
+
};
|
|
7751
|
+
const cleanups = [];
|
|
7752
|
+
const onWindowWheel = (e) => {
|
|
7753
|
+
if (e.ctrlKey || e.metaKey) e.preventDefault();
|
|
7754
|
+
};
|
|
7755
|
+
window.addEventListener("wheel", onWindowWheel, { passive: false });
|
|
7756
|
+
cleanups.push(
|
|
7757
|
+
() => window.removeEventListener("wheel", onWindowWheel)
|
|
7758
|
+
);
|
|
7759
|
+
const viewportEl = (_a = frameRef.current) == null ? void 0 : _a.firstElementChild;
|
|
7760
|
+
if (viewportEl) {
|
|
7761
|
+
viewportEl.addEventListener("wheel", handler, { passive: false });
|
|
7762
|
+
cleanups.push(
|
|
7763
|
+
() => viewportEl.removeEventListener("wheel", handler)
|
|
7764
|
+
);
|
|
7765
|
+
}
|
|
7894
7766
|
if (iframe.enabled) {
|
|
7895
|
-
const
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7767
|
+
const tryAttach = () => {
|
|
7768
|
+
const el = document.getElementById(
|
|
7769
|
+
"preview-frame"
|
|
7770
|
+
);
|
|
7771
|
+
const doc = el == null ? void 0 : el.contentDocument;
|
|
7772
|
+
const win = el == null ? void 0 : el.contentWindow;
|
|
7773
|
+
if (!doc || !win) return false;
|
|
7774
|
+
const opts = { passive: false, capture: true };
|
|
7775
|
+
doc.addEventListener("wheel", handler, opts);
|
|
7776
|
+
win.addEventListener("wheel", handler, opts);
|
|
7777
|
+
cleanups.push(() => {
|
|
7778
|
+
doc.removeEventListener("wheel", handler, opts);
|
|
7779
|
+
win.removeEventListener("wheel", handler, opts);
|
|
7780
|
+
});
|
|
7781
|
+
return true;
|
|
7907
7782
|
};
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7783
|
+
if (!tryAttach()) {
|
|
7784
|
+
const interval = window.setInterval(() => {
|
|
7785
|
+
if (tryAttach()) window.clearInterval(interval);
|
|
7786
|
+
}, 100);
|
|
7787
|
+
cleanups.push(() => window.clearInterval(interval));
|
|
7911
7788
|
}
|
|
7912
|
-
appStoreApi.setState(__spreadProps(__spreadValues({}, appState), { history }));
|
|
7913
7789
|
}
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
})
|
|
7944
|
-
});
|
|
7945
|
-
});
|
|
7946
|
-
observer.observe(target);
|
|
7947
|
-
return () => observer.disconnect();
|
|
7948
|
-
}, [
|
|
7949
|
-
pickClosestViewport,
|
|
7950
|
-
frameRef,
|
|
7951
|
-
iframe.enabled,
|
|
7952
|
-
(_b = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _b.current,
|
|
7953
|
-
appStoreApi,
|
|
7954
|
-
setUi
|
|
7955
|
-
]);
|
|
7956
|
-
return /* @__PURE__ */ jsx50(
|
|
7790
|
+
return () => {
|
|
7791
|
+
cleanups.forEach((fn) => fn());
|
|
7792
|
+
};
|
|
7793
|
+
}, [iframe.enabled, frameRef]);
|
|
7794
|
+
const previewWidth = !iframe.enabled ? "100%" : viewports.current.width === "100%" ? PREVIEW_MAX_WIDTH : viewports.current.width;
|
|
7795
|
+
const frameContents = /* @__PURE__ */ jsx47(
|
|
7796
|
+
"div",
|
|
7797
|
+
{
|
|
7798
|
+
className: getClassName27("rootColumn"),
|
|
7799
|
+
style: { width: PREVIEW_MAX_WIDTH },
|
|
7800
|
+
children: /* @__PURE__ */ jsx47(
|
|
7801
|
+
"div",
|
|
7802
|
+
{
|
|
7803
|
+
className: getClassName27("frame"),
|
|
7804
|
+
style: { width: previewWidth, margin: "0 auto" },
|
|
7805
|
+
children: /* @__PURE__ */ jsx47(
|
|
7806
|
+
"div",
|
|
7807
|
+
{
|
|
7808
|
+
className: getClassName27("root"),
|
|
7809
|
+
suppressHydrationWarning: true,
|
|
7810
|
+
id: "editor-canvas-root",
|
|
7811
|
+
children: /* @__PURE__ */ jsx47(CustomPreview, { children: /* @__PURE__ */ jsx47(Preview2, {}) })
|
|
7812
|
+
}
|
|
7813
|
+
)
|
|
7814
|
+
}
|
|
7815
|
+
)
|
|
7816
|
+
}
|
|
7817
|
+
);
|
|
7818
|
+
return /* @__PURE__ */ jsx47(
|
|
7957
7819
|
"div",
|
|
7958
7820
|
{
|
|
7959
|
-
className:
|
|
7821
|
+
className: getClassName27({
|
|
7960
7822
|
ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
|
|
7961
7823
|
showLoader,
|
|
7962
7824
|
fullScreen: fullScreenCanvas,
|
|
@@ -7972,260 +7834,119 @@ var Canvas = () => {
|
|
|
7972
7834
|
});
|
|
7973
7835
|
}
|
|
7974
7836
|
},
|
|
7975
|
-
children: /* @__PURE__ */
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
/* @__PURE__ */ jsx50(IconButton, { type: "button", title: "Reset zoom", onClick: resetZoom, children: /* @__PURE__ */ jsx50(RotateCcw, { size: 14 }) }),
|
|
7979
|
-
/* @__PURE__ */ jsx50(IconButton, { type: "button", title: "Zoom in", onClick: zoomIn, children: /* @__PURE__ */ jsx50(Plus, { size: 14 }) })
|
|
7980
|
-
] }),
|
|
7981
|
-
/* @__PURE__ */ jsxs21(
|
|
7982
|
-
"div",
|
|
7837
|
+
children: /* @__PURE__ */ jsxs19("div", { className: getClassName27("inner"), ref: frameRef, children: [
|
|
7838
|
+
/* @__PURE__ */ jsx47("div", { className: getClassName27("zoomViewport"), children: disableZoomControls ? frameContents : /* @__PURE__ */ jsxs19(
|
|
7839
|
+
TransformWrapper,
|
|
7983
7840
|
{
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
},
|
|
7841
|
+
ref: transformRef,
|
|
7842
|
+
minScale: MIN_ZOOM,
|
|
7843
|
+
maxScale: MAX_ZOOM,
|
|
7844
|
+
initialScale: 1,
|
|
7845
|
+
doubleClick: { disabled: true },
|
|
7846
|
+
limitToBounds: false,
|
|
7847
|
+
wheel: { disabled: true },
|
|
7848
|
+
pinch: { step: 5 },
|
|
7849
|
+
panning: { velocityDisabled: true },
|
|
7850
|
+
trackPadPanning: { velocityDisabled: true },
|
|
7851
|
+
alignmentAnimation: { disabled: true },
|
|
7852
|
+
autoAlignment: { disabled: true, sizeX: 0, sizeY: 0 },
|
|
7991
7853
|
children: [
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
{
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
}
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
7854
|
+
/* @__PURE__ */ jsx47(ZoomConfigSync, {}),
|
|
7855
|
+
/* @__PURE__ */ jsxs19("div", { className: getClassName27("toolbar"), children: [
|
|
7856
|
+
chrome.showThemeToggle && /* @__PURE__ */ jsxs19(Fragment13, { children: [
|
|
7857
|
+
/* @__PURE__ */ jsx47(
|
|
7858
|
+
IconButton,
|
|
7859
|
+
{
|
|
7860
|
+
type: "button",
|
|
7861
|
+
title: theme === "dark" ? "Switch to light mode" : "Switch to dark mode",
|
|
7862
|
+
onClick: toggleTheme,
|
|
7863
|
+
children: theme === "dark" ? /* @__PURE__ */ jsx47(Sun, { size: 14 }) : /* @__PURE__ */ jsx47(Moon, { size: 14 })
|
|
7864
|
+
}
|
|
7865
|
+
),
|
|
7866
|
+
(chrome.showDeviceToggle || chrome.showFullScreenToggle) && /* @__PURE__ */ jsx47("div", { className: getClassName27("toolbarDivider") })
|
|
7867
|
+
] }),
|
|
7868
|
+
chrome.showDeviceToggle && /* @__PURE__ */ jsx47(
|
|
7869
|
+
IconButton,
|
|
7870
|
+
{
|
|
7871
|
+
type: "button",
|
|
7872
|
+
title: `Switch to ${nextDeviceLabel} viewport`,
|
|
7873
|
+
onClick: cycleDevice,
|
|
7874
|
+
children: DEVICE_ICONS[activeDevice]
|
|
8006
7875
|
}
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
7876
|
+
),
|
|
7877
|
+
chrome.showFullScreenToggle && /* @__PURE__ */ jsx47(
|
|
7878
|
+
IconButton,
|
|
7879
|
+
{
|
|
7880
|
+
type: "button",
|
|
7881
|
+
title: canvasFullScreen ? "Exit full screen" : "Enter full screen",
|
|
7882
|
+
onClick: toggleFullScreen,
|
|
7883
|
+
children: canvasFullScreen ? /* @__PURE__ */ jsx47(Minimize, { size: 14 }) : /* @__PURE__ */ jsx47(Maximize, { size: 14 })
|
|
7884
|
+
}
|
|
7885
|
+
),
|
|
7886
|
+
(chrome.showDeviceToggle || chrome.showFullScreenToggle) && /* @__PURE__ */ jsx47("div", { className: getClassName27("toolbarDivider") }),
|
|
7887
|
+
/* @__PURE__ */ jsx47(
|
|
7888
|
+
IconButton,
|
|
7889
|
+
{
|
|
7890
|
+
type: "button",
|
|
7891
|
+
title: "Zoom out",
|
|
7892
|
+
onClick: handleZoomOut,
|
|
7893
|
+
children: /* @__PURE__ */ jsx47(Minus, { size: 14 })
|
|
7894
|
+
}
|
|
7895
|
+
),
|
|
7896
|
+
/* @__PURE__ */ jsx47(ZoomLevel, { className: getClassName27("zoomLevel") }),
|
|
7897
|
+
/* @__PURE__ */ jsx47(
|
|
7898
|
+
IconButton,
|
|
7899
|
+
{
|
|
7900
|
+
type: "button",
|
|
7901
|
+
title: "Zoom in",
|
|
7902
|
+
onClick: handleZoomIn,
|
|
7903
|
+
children: /* @__PURE__ */ jsx47(Plus, { size: 14 })
|
|
7904
|
+
}
|
|
7905
|
+
),
|
|
7906
|
+
/* @__PURE__ */ jsx47(
|
|
7907
|
+
IconButton,
|
|
7908
|
+
{
|
|
7909
|
+
type: "button",
|
|
7910
|
+
title: "Reset zoom",
|
|
7911
|
+
onClick: handleResetZoom,
|
|
7912
|
+
children: /* @__PURE__ */ jsx47(RotateCcw, { size: 14 })
|
|
7913
|
+
}
|
|
7914
|
+
)
|
|
7915
|
+
] }),
|
|
7916
|
+
/* @__PURE__ */ jsx47(
|
|
7917
|
+
TransformComponent,
|
|
8011
7918
|
{
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
onTransitionEnd: () => {
|
|
8016
|
-
setShowTransition(false);
|
|
8017
|
-
isResizingRef.current = false;
|
|
8018
|
-
},
|
|
8019
|
-
children: /* @__PURE__ */ jsx50(CustomPreview, { children: /* @__PURE__ */ jsx50(Preview2, {}) })
|
|
7919
|
+
infinite: true,
|
|
7920
|
+
wrapperStyle: { width: "100%", height: "100%" },
|
|
7921
|
+
children: frameContents
|
|
8020
7922
|
}
|
|
8021
7923
|
)
|
|
8022
7924
|
]
|
|
8023
7925
|
}
|
|
8024
|
-
),
|
|
8025
|
-
/* @__PURE__ */
|
|
7926
|
+
) }),
|
|
7927
|
+
/* @__PURE__ */ jsx47("div", { className: getClassName27("loader"), children: /* @__PURE__ */ jsx47(Loader, { size: 24 }) })
|
|
8026
7928
|
] })
|
|
8027
7929
|
}
|
|
8028
7930
|
);
|
|
8029
7931
|
};
|
|
8030
7932
|
|
|
8031
|
-
// lib/use-sidebar-resize.ts
|
|
8032
|
-
init_react_import();
|
|
8033
|
-
import { useCallback as useCallback20, useEffect as useEffect24, useRef as useRef16, useState as useState22 } from "react";
|
|
8034
|
-
function useSidebarResize(position, dispatch) {
|
|
8035
|
-
const [width, setWidth] = useState22(null);
|
|
8036
|
-
const sidebarRef = useRef16(null);
|
|
8037
|
-
const storeWidth = useAppStore(
|
|
8038
|
-
(s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
|
|
8039
|
-
);
|
|
8040
|
-
useEffect24(() => {
|
|
8041
|
-
if (typeof window !== "undefined" && !storeWidth) {
|
|
8042
|
-
try {
|
|
8043
|
-
const savedWidths = localStorage.getItem("editor-sidebar-widths");
|
|
8044
|
-
if (savedWidths) {
|
|
8045
|
-
const widths = JSON.parse(savedWidths);
|
|
8046
|
-
const savedWidth = widths[position];
|
|
8047
|
-
const key = position === "left" ? "leftSideBarWidth" : "rightSideBarWidth";
|
|
8048
|
-
if (savedWidth) {
|
|
8049
|
-
dispatch({
|
|
8050
|
-
type: "setUi",
|
|
8051
|
-
ui: {
|
|
8052
|
-
[key]: savedWidth
|
|
8053
|
-
}
|
|
8054
|
-
});
|
|
8055
|
-
}
|
|
8056
|
-
}
|
|
8057
|
-
} catch (error) {
|
|
8058
|
-
console.error(
|
|
8059
|
-
`Failed to load ${position} sidebar width from localStorage`,
|
|
8060
|
-
error
|
|
8061
|
-
);
|
|
8062
|
-
}
|
|
8063
|
-
}
|
|
8064
|
-
}, [dispatch, position, storeWidth]);
|
|
8065
|
-
useEffect24(() => {
|
|
8066
|
-
if (storeWidth !== void 0) {
|
|
8067
|
-
setWidth(storeWidth);
|
|
8068
|
-
}
|
|
8069
|
-
}, [storeWidth]);
|
|
8070
|
-
const handleResizeEnd = useCallback20(
|
|
8071
|
-
(width2) => {
|
|
8072
|
-
dispatch({
|
|
8073
|
-
type: "setUi",
|
|
8074
|
-
ui: {
|
|
8075
|
-
[position === "left" ? "leftSideBarWidth" : "rightSideBarWidth"]: width2
|
|
8076
|
-
}
|
|
8077
|
-
});
|
|
8078
|
-
let widths = {};
|
|
8079
|
-
try {
|
|
8080
|
-
const savedWidths = localStorage.getItem("editor-sidebar-widths");
|
|
8081
|
-
widths = savedWidths ? JSON.parse(savedWidths) : {};
|
|
8082
|
-
} catch (error) {
|
|
8083
|
-
console.error(
|
|
8084
|
-
`Failed to save ${position} sidebar width to localStorage`,
|
|
8085
|
-
error
|
|
8086
|
-
);
|
|
8087
|
-
} finally {
|
|
8088
|
-
localStorage.setItem(
|
|
8089
|
-
"editor-sidebar-widths",
|
|
8090
|
-
JSON.stringify(__spreadProps(__spreadValues({}, widths), {
|
|
8091
|
-
[position]: width2
|
|
8092
|
-
}))
|
|
8093
|
-
);
|
|
8094
|
-
}
|
|
8095
|
-
window.dispatchEvent(
|
|
8096
|
-
new CustomEvent("viewportchange", {
|
|
8097
|
-
bubbles: true,
|
|
8098
|
-
cancelable: false
|
|
8099
|
-
})
|
|
8100
|
-
);
|
|
8101
|
-
},
|
|
8102
|
-
[dispatch, position]
|
|
8103
|
-
);
|
|
8104
|
-
return {
|
|
8105
|
-
width,
|
|
8106
|
-
setWidth,
|
|
8107
|
-
sidebarRef,
|
|
8108
|
-
handleResizeEnd
|
|
8109
|
-
};
|
|
8110
|
-
}
|
|
8111
|
-
|
|
8112
7933
|
// components/Editor/components/Sidebar/index.tsx
|
|
8113
7934
|
init_react_import();
|
|
8114
7935
|
|
|
8115
|
-
// components/Editor/components/ResizeHandle/index.tsx
|
|
8116
|
-
init_react_import();
|
|
8117
|
-
import { useCallback as useCallback21, useRef as useRef17 } from "react";
|
|
8118
|
-
|
|
8119
|
-
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/ResizeHandle/styles.module.css#css-module
|
|
8120
|
-
init_react_import();
|
|
8121
|
-
var styles_module_default27 = { "ResizeHandle": "_ResizeHandle_1u3rv_2", "ResizeHandle--left": "_ResizeHandle--left_1u3rv_16", "ResizeHandle--right": "_ResizeHandle--right_1u3rv_20" };
|
|
8122
|
-
|
|
8123
|
-
// components/Editor/components/ResizeHandle/index.tsx
|
|
8124
|
-
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
8125
|
-
var getClassName31 = get_class_name_factory_default("ResizeHandle", styles_module_default27);
|
|
8126
|
-
var ResizeHandle = ({
|
|
8127
|
-
position,
|
|
8128
|
-
sidebarRef,
|
|
8129
|
-
onResize,
|
|
8130
|
-
onResizeEnd
|
|
8131
|
-
}) => {
|
|
8132
|
-
const handleRef = useRef17(null);
|
|
8133
|
-
const isDragging = useRef17(false);
|
|
8134
|
-
const startX = useRef17(0);
|
|
8135
|
-
const startWidth = useRef17(0);
|
|
8136
|
-
const handleMouseMove = useCallback21(
|
|
8137
|
-
(e) => {
|
|
8138
|
-
if (!isDragging.current) return;
|
|
8139
|
-
const delta = e.clientX - startX.current;
|
|
8140
|
-
const newWidth = position === "left" ? startWidth.current + delta : startWidth.current - delta;
|
|
8141
|
-
const width = Math.max(192, newWidth);
|
|
8142
|
-
onResize(width);
|
|
8143
|
-
e.preventDefault();
|
|
8144
|
-
},
|
|
8145
|
-
[onResize, position]
|
|
8146
|
-
);
|
|
8147
|
-
const handleMouseUp = useCallback21(() => {
|
|
8148
|
-
var _a;
|
|
8149
|
-
if (!isDragging.current) return;
|
|
8150
|
-
isDragging.current = false;
|
|
8151
|
-
document.body.style.cursor = "";
|
|
8152
|
-
document.body.style.userSelect = "";
|
|
8153
|
-
const overlay = document.getElementById("resize-overlay");
|
|
8154
|
-
if (overlay) {
|
|
8155
|
-
document.body.removeChild(overlay);
|
|
8156
|
-
}
|
|
8157
|
-
document.removeEventListener("mousemove", handleMouseMove);
|
|
8158
|
-
document.removeEventListener("mouseup", handleMouseUp);
|
|
8159
|
-
const finalWidth = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
|
|
8160
|
-
onResizeEnd(finalWidth);
|
|
8161
|
-
}, [onResizeEnd]);
|
|
8162
|
-
const handleMouseDown = useCallback21(
|
|
8163
|
-
(e) => {
|
|
8164
|
-
var _a;
|
|
8165
|
-
isDragging.current = true;
|
|
8166
|
-
startX.current = e.clientX;
|
|
8167
|
-
startWidth.current = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
|
|
8168
|
-
document.body.style.cursor = "col-resize";
|
|
8169
|
-
document.body.style.userSelect = "none";
|
|
8170
|
-
const overlay = document.createElement("div");
|
|
8171
|
-
overlay.id = "resize-overlay";
|
|
8172
|
-
overlay.setAttribute("data-resize-overlay", "");
|
|
8173
|
-
document.body.appendChild(overlay);
|
|
8174
|
-
document.addEventListener("mousemove", handleMouseMove);
|
|
8175
|
-
document.addEventListener("mouseup", handleMouseUp);
|
|
8176
|
-
e.preventDefault();
|
|
8177
|
-
},
|
|
8178
|
-
[position, handleMouseMove, handleMouseUp]
|
|
8179
|
-
);
|
|
8180
|
-
return /* @__PURE__ */ jsx51(
|
|
8181
|
-
"div",
|
|
8182
|
-
{
|
|
8183
|
-
ref: handleRef,
|
|
8184
|
-
className: getClassName31({ [position]: true }),
|
|
8185
|
-
onMouseDown: handleMouseDown
|
|
8186
|
-
}
|
|
8187
|
-
);
|
|
8188
|
-
};
|
|
8189
|
-
|
|
8190
7936
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Sidebar/styles.module.css#css-module
|
|
8191
7937
|
init_react_import();
|
|
8192
|
-
var
|
|
7938
|
+
var styles_module_default24 = { "Sidebar": "_Sidebar_1ynke_8", "Sidebar--left": "_Sidebar--left_1ynke_20", "Sidebar--right": "_Sidebar--right_1ynke_25", "Sidebar-body": "_Sidebar-body_1ynke_30" };
|
|
8193
7939
|
|
|
8194
7940
|
// components/Editor/components/Sidebar/index.tsx
|
|
8195
|
-
import {
|
|
8196
|
-
var
|
|
8197
|
-
var Sidebar = ({
|
|
8198
|
-
position,
|
|
8199
|
-
sidebarRef,
|
|
8200
|
-
isVisible,
|
|
8201
|
-
onResize,
|
|
8202
|
-
onResizeEnd,
|
|
8203
|
-
children
|
|
8204
|
-
}) => {
|
|
8205
|
-
return /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
8206
|
-
/* @__PURE__ */ jsx52(
|
|
8207
|
-
"div",
|
|
8208
|
-
{
|
|
8209
|
-
ref: sidebarRef,
|
|
8210
|
-
className: getClassName32({ [position]: true, isVisible }),
|
|
8211
|
-
children
|
|
8212
|
-
}
|
|
8213
|
-
),
|
|
8214
|
-
/* @__PURE__ */ jsx52("div", { className: `${getClassName32("resizeHandle")}`, children: /* @__PURE__ */ jsx52(
|
|
8215
|
-
ResizeHandle,
|
|
8216
|
-
{
|
|
8217
|
-
position,
|
|
8218
|
-
sidebarRef,
|
|
8219
|
-
onResize,
|
|
8220
|
-
onResizeEnd
|
|
8221
|
-
}
|
|
8222
|
-
) })
|
|
8223
|
-
] });
|
|
7941
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
7942
|
+
var getClassName28 = get_class_name_factory_default("Sidebar", styles_module_default24);
|
|
7943
|
+
var Sidebar = ({ position, children }) => {
|
|
7944
|
+
return /* @__PURE__ */ jsx48("aside", { className: getClassName28({ [position]: true }), children: /* @__PURE__ */ jsx48("div", { className: getClassName28("body"), children }) });
|
|
8224
7945
|
};
|
|
8225
7946
|
|
|
8226
7947
|
// lib/use-delete-hotkeys.ts
|
|
8227
7948
|
init_react_import();
|
|
8228
|
-
import { useCallback as
|
|
7949
|
+
import { useCallback as useCallback20 } from "react";
|
|
8229
7950
|
|
|
8230
7951
|
// lib/should-block-editing-hotkey.ts
|
|
8231
7952
|
init_react_import();
|
|
@@ -8265,7 +7986,7 @@ var shouldBlockEditingHotkey = (e) => {
|
|
|
8265
7986
|
// lib/use-delete-hotkeys.ts
|
|
8266
7987
|
var useDeleteHotkeys = () => {
|
|
8267
7988
|
const appStore = useAppStoreApi();
|
|
8268
|
-
const deleteSelectedComponent =
|
|
7989
|
+
const deleteSelectedComponent = useCallback20(
|
|
8269
7990
|
(e) => {
|
|
8270
7991
|
var _a;
|
|
8271
7992
|
if (shouldBlockEditingHotkey(e)) {
|
|
@@ -8291,7 +8012,7 @@ var useDeleteHotkeys = () => {
|
|
|
8291
8012
|
|
|
8292
8013
|
// lib/use-clipboard-hotkeys.ts
|
|
8293
8014
|
init_react_import();
|
|
8294
|
-
import { useCallback as
|
|
8015
|
+
import { useCallback as useCallback21 } from "react";
|
|
8295
8016
|
var CLIPBOARD_MARKER = "reacteditor/component";
|
|
8296
8017
|
var isComponentData = (value) => {
|
|
8297
8018
|
var _a;
|
|
@@ -8311,7 +8032,7 @@ var parsePayload = (text) => {
|
|
|
8311
8032
|
};
|
|
8312
8033
|
var useClipboardHotkeys = () => {
|
|
8313
8034
|
const appStore = useAppStoreApi();
|
|
8314
|
-
const writeSelectionToClipboard =
|
|
8035
|
+
const writeSelectionToClipboard = useCallback21(() => {
|
|
8315
8036
|
var _a;
|
|
8316
8037
|
const { selectedItem } = appStore.getState();
|
|
8317
8038
|
if (!selectedItem) return false;
|
|
@@ -8323,14 +8044,14 @@ var useClipboardHotkeys = () => {
|
|
|
8323
8044
|
});
|
|
8324
8045
|
return true;
|
|
8325
8046
|
}, [appStore]);
|
|
8326
|
-
const copySelectedComponent =
|
|
8047
|
+
const copySelectedComponent = useCallback21(
|
|
8327
8048
|
(e) => {
|
|
8328
8049
|
if (shouldBlockEditingHotkey(e)) return false;
|
|
8329
8050
|
return writeSelectionToClipboard();
|
|
8330
8051
|
},
|
|
8331
8052
|
[writeSelectionToClipboard]
|
|
8332
8053
|
);
|
|
8333
|
-
const cutSelectedComponent =
|
|
8054
|
+
const cutSelectedComponent = useCallback21(
|
|
8334
8055
|
(e) => {
|
|
8335
8056
|
var _a;
|
|
8336
8057
|
if (shouldBlockEditingHotkey(e)) return false;
|
|
@@ -8349,143 +8070,322 @@ var useClipboardHotkeys = () => {
|
|
|
8349
8070
|
},
|
|
8350
8071
|
[appStore, writeSelectionToClipboard]
|
|
8351
8072
|
);
|
|
8352
|
-
const pasteComponent =
|
|
8353
|
-
(e) => {
|
|
8354
|
-
var _a, _b;
|
|
8355
|
-
if (shouldBlockEditingHotkey(e)) return false;
|
|
8356
|
-
const { state, dispatch, config } = appStore.getState();
|
|
8357
|
-
const sel = (_a = state.ui) == null ? void 0 : _a.itemSelector;
|
|
8358
|
-
if (!(sel == null ? void 0 : sel.zone)) return false;
|
|
8359
|
-
(_b = navigator.clipboard) == null ? void 0 : _b.readText().then((text) => {
|
|
8360
|
-
const data = parsePayload(text);
|
|
8361
|
-
if (!data) return;
|
|
8362
|
-
if (!config.components[data.type]) return;
|
|
8363
|
-
dispatch({
|
|
8364
|
-
type: "insert",
|
|
8365
|
-
componentType: data.type,
|
|
8366
|
-
destinationIndex: sel.index + 1,
|
|
8367
|
-
destinationZone: sel.zone,
|
|
8368
|
-
data
|
|
8369
|
-
});
|
|
8370
|
-
}).catch(() => {
|
|
8371
|
-
});
|
|
8372
|
-
return true;
|
|
8373
|
-
},
|
|
8374
|
-
[appStore]
|
|
8073
|
+
const pasteComponent = useCallback21(
|
|
8074
|
+
(e) => {
|
|
8075
|
+
var _a, _b;
|
|
8076
|
+
if (shouldBlockEditingHotkey(e)) return false;
|
|
8077
|
+
const { state, dispatch, config } = appStore.getState();
|
|
8078
|
+
const sel = (_a = state.ui) == null ? void 0 : _a.itemSelector;
|
|
8079
|
+
if (!(sel == null ? void 0 : sel.zone)) return false;
|
|
8080
|
+
(_b = navigator.clipboard) == null ? void 0 : _b.readText().then((text) => {
|
|
8081
|
+
const data = parsePayload(text);
|
|
8082
|
+
if (!data) return;
|
|
8083
|
+
if (!config.components[data.type]) return;
|
|
8084
|
+
dispatch({
|
|
8085
|
+
type: "insert",
|
|
8086
|
+
componentType: data.type,
|
|
8087
|
+
destinationIndex: sel.index + 1,
|
|
8088
|
+
destinationZone: sel.zone,
|
|
8089
|
+
data
|
|
8090
|
+
});
|
|
8091
|
+
}).catch(() => {
|
|
8092
|
+
});
|
|
8093
|
+
return true;
|
|
8094
|
+
},
|
|
8095
|
+
[appStore]
|
|
8096
|
+
);
|
|
8097
|
+
useHotkey({ meta: true, c: true }, copySelectedComponent);
|
|
8098
|
+
useHotkey({ ctrl: true, c: true }, copySelectedComponent);
|
|
8099
|
+
useHotkey({ meta: true, v: true }, pasteComponent);
|
|
8100
|
+
useHotkey({ ctrl: true, v: true }, pasteComponent);
|
|
8101
|
+
useHotkey({ meta: true, x: true }, cutSelectedComponent);
|
|
8102
|
+
useHotkey({ ctrl: true, x: true }, cutSelectedComponent);
|
|
8103
|
+
};
|
|
8104
|
+
|
|
8105
|
+
// components/Editor/components/Nav/index.tsx
|
|
8106
|
+
init_react_import();
|
|
8107
|
+
|
|
8108
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Nav/styles.module.css#css-module
|
|
8109
|
+
init_react_import();
|
|
8110
|
+
var styles_module_default25 = { "Nav": "_Nav_1ft0o_1", "Nav--horizontal": "_Nav--horizontal_1ft0o_20", "Nav-list": "_Nav-list_1ft0o_36", "Nav-footer": "_Nav-footer_1ft0o_83", "NavItem-link": "_NavItem-link_1ft0o_96", "NavItem-linkLabel": "_NavItem-linkLabel_1ft0o_124", "NavItem": "_NavItem_1ft0o_96", "NavItem-linkIcon": "_NavItem-linkIcon_1ft0o_149", "NavItem--active": "_NavItem--active_1ft0o_162", "NavItem--mobileOnly": "_NavItem--mobileOnly_1ft0o_173", "NavItem--desktopOnly": "_NavItem--desktopOnly_1ft0o_178" };
|
|
8111
|
+
|
|
8112
|
+
// components/Editor/components/Nav/index.tsx
|
|
8113
|
+
import { jsx as jsx49, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
8114
|
+
var getClassName29 = get_class_name_factory_default("Nav", styles_module_default25);
|
|
8115
|
+
var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default25);
|
|
8116
|
+
var MenuItem = ({
|
|
8117
|
+
label,
|
|
8118
|
+
icon,
|
|
8119
|
+
onClick,
|
|
8120
|
+
isActive,
|
|
8121
|
+
mobileOnly,
|
|
8122
|
+
desktopOnly
|
|
8123
|
+
}) => {
|
|
8124
|
+
return /* @__PURE__ */ jsx49(
|
|
8125
|
+
"li",
|
|
8126
|
+
{
|
|
8127
|
+
className: getClassNameItem3({
|
|
8128
|
+
active: isActive,
|
|
8129
|
+
mobileOnly,
|
|
8130
|
+
desktopOnly
|
|
8131
|
+
}),
|
|
8132
|
+
children: onClick && /* @__PURE__ */ jsxs20("div", { className: getClassNameItem3("link"), onClick, children: [
|
|
8133
|
+
icon && /* @__PURE__ */ jsx49("span", { className: getClassNameItem3("linkIcon"), children: icon }),
|
|
8134
|
+
/* @__PURE__ */ jsx49("span", { className: getClassNameItem3("linkLabel"), children: label })
|
|
8135
|
+
] })
|
|
8136
|
+
}
|
|
8137
|
+
);
|
|
8138
|
+
};
|
|
8139
|
+
var Nav = ({
|
|
8140
|
+
items,
|
|
8141
|
+
footer,
|
|
8142
|
+
orientation = "vertical"
|
|
8143
|
+
}) => {
|
|
8144
|
+
return /* @__PURE__ */ jsxs20("nav", { className: getClassName29({ horizontal: orientation === "horizontal" }), children: [
|
|
8145
|
+
/* @__PURE__ */ jsx49("ul", { className: getClassName29("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx49(MenuItem, __spreadValues({}, item), key)) }),
|
|
8146
|
+
footer && /* @__PURE__ */ jsx49("div", { className: getClassName29("footer"), children: footer })
|
|
8147
|
+
] });
|
|
8148
|
+
};
|
|
8149
|
+
|
|
8150
|
+
// components/BrowserBar/index.tsx
|
|
8151
|
+
init_react_import();
|
|
8152
|
+
import { useRef as useRef15, useState as useState21 } from "react";
|
|
8153
|
+
|
|
8154
|
+
// components/ui/Combobox/index.tsx
|
|
8155
|
+
init_react_import();
|
|
8156
|
+
import { Combobox as ComboboxPrimitive } from "@base-ui/react";
|
|
8157
|
+
|
|
8158
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ui/Combobox/styles.module.css#css-module
|
|
8159
|
+
init_react_import();
|
|
8160
|
+
var styles_module_default26 = { "EditorCombobox-input": "_EditorCombobox-input_12a2a_4", "EditorCombobox-trigger": "_EditorCombobox-trigger_12a2a_21", "EditorCombobox-triggerIcon": "_EditorCombobox-triggerIcon_12a2a_42", "EditorCombobox-positioner": "_EditorCombobox-positioner_12a2a_46", "EditorCombobox-content": "_EditorCombobox-content_12a2a_50", "EditorCombobox-list": "_EditorCombobox-list_12a2a_65", "EditorCombobox-item": "_EditorCombobox-item_12a2a_71", "EditorCombobox-itemIndicator": "_EditorCombobox-itemIndicator_12a2a_97", "EditorCombobox-empty": "_EditorCombobox-empty_12a2a_110" };
|
|
8161
|
+
|
|
8162
|
+
// components/ui/Combobox/index.tsx
|
|
8163
|
+
import { jsx as jsx50, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
8164
|
+
var getClassName30 = get_class_name_factory_default("EditorCombobox", styles_module_default26);
|
|
8165
|
+
var join = (...values) => values.filter(Boolean).join(" ");
|
|
8166
|
+
var mergeClassName = (base, override) => {
|
|
8167
|
+
if (!override) return base;
|
|
8168
|
+
if (typeof override === "function") {
|
|
8169
|
+
return (state) => join(base, override(state));
|
|
8170
|
+
}
|
|
8171
|
+
return join(base, override);
|
|
8172
|
+
};
|
|
8173
|
+
var Combobox = ComboboxPrimitive.Root;
|
|
8174
|
+
function ComboboxInput(_a) {
|
|
8175
|
+
var _b = _a, {
|
|
8176
|
+
className
|
|
8177
|
+
} = _b, props = __objRest(_b, [
|
|
8178
|
+
"className"
|
|
8179
|
+
]);
|
|
8180
|
+
return /* @__PURE__ */ jsx50(
|
|
8181
|
+
ComboboxPrimitive.Input,
|
|
8182
|
+
__spreadValues({
|
|
8183
|
+
"data-slot": "combobox-input",
|
|
8184
|
+
className: mergeClassName(getClassName30("input"), className)
|
|
8185
|
+
}, props)
|
|
8186
|
+
);
|
|
8187
|
+
}
|
|
8188
|
+
function ComboboxContent(_a) {
|
|
8189
|
+
var _b = _a, {
|
|
8190
|
+
className,
|
|
8191
|
+
side = "bottom",
|
|
8192
|
+
sideOffset = 4,
|
|
8193
|
+
align = "start",
|
|
8194
|
+
alignOffset = 0,
|
|
8195
|
+
children
|
|
8196
|
+
} = _b, props = __objRest(_b, [
|
|
8197
|
+
"className",
|
|
8198
|
+
"side",
|
|
8199
|
+
"sideOffset",
|
|
8200
|
+
"align",
|
|
8201
|
+
"alignOffset",
|
|
8202
|
+
"children"
|
|
8203
|
+
]);
|
|
8204
|
+
return /* @__PURE__ */ jsx50(ComboboxPrimitive.Portal, { children: /* @__PURE__ */ jsx50(
|
|
8205
|
+
ComboboxPrimitive.Positioner,
|
|
8206
|
+
{
|
|
8207
|
+
side,
|
|
8208
|
+
sideOffset,
|
|
8209
|
+
align,
|
|
8210
|
+
alignOffset,
|
|
8211
|
+
className: getClassName30("positioner"),
|
|
8212
|
+
children: /* @__PURE__ */ jsx50(
|
|
8213
|
+
ComboboxPrimitive.Popup,
|
|
8214
|
+
__spreadProps(__spreadValues({
|
|
8215
|
+
"data-slot": "combobox-content",
|
|
8216
|
+
className: mergeClassName(getClassName30("content"), className)
|
|
8217
|
+
}, props), {
|
|
8218
|
+
children
|
|
8219
|
+
})
|
|
8220
|
+
)
|
|
8221
|
+
}
|
|
8222
|
+
) });
|
|
8223
|
+
}
|
|
8224
|
+
function ComboboxList(_a) {
|
|
8225
|
+
var _b = _a, {
|
|
8226
|
+
className
|
|
8227
|
+
} = _b, props = __objRest(_b, [
|
|
8228
|
+
"className"
|
|
8229
|
+
]);
|
|
8230
|
+
return /* @__PURE__ */ jsx50(
|
|
8231
|
+
ComboboxPrimitive.List,
|
|
8232
|
+
__spreadValues({
|
|
8233
|
+
"data-slot": "combobox-list",
|
|
8234
|
+
className: mergeClassName(getClassName30("list"), className)
|
|
8235
|
+
}, props)
|
|
8236
|
+
);
|
|
8237
|
+
}
|
|
8238
|
+
function ComboboxItem(_a) {
|
|
8239
|
+
var _b = _a, {
|
|
8240
|
+
className,
|
|
8241
|
+
children
|
|
8242
|
+
} = _b, props = __objRest(_b, [
|
|
8243
|
+
"className",
|
|
8244
|
+
"children"
|
|
8245
|
+
]);
|
|
8246
|
+
return /* @__PURE__ */ jsxs21(
|
|
8247
|
+
ComboboxPrimitive.Item,
|
|
8248
|
+
__spreadProps(__spreadValues({
|
|
8249
|
+
"data-slot": "combobox-item",
|
|
8250
|
+
className: mergeClassName(getClassName30("item"), className)
|
|
8251
|
+
}, props), {
|
|
8252
|
+
children: [
|
|
8253
|
+
/* @__PURE__ */ jsx50("span", { className: getClassName30("itemIndicator"), children: /* @__PURE__ */ jsx50(ComboboxPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx50(Check, { size: 14 }) }) }),
|
|
8254
|
+
children
|
|
8255
|
+
]
|
|
8256
|
+
})
|
|
8257
|
+
);
|
|
8258
|
+
}
|
|
8259
|
+
function ComboboxEmpty(_a) {
|
|
8260
|
+
var _b = _a, {
|
|
8261
|
+
className
|
|
8262
|
+
} = _b, props = __objRest(_b, [
|
|
8263
|
+
"className"
|
|
8264
|
+
]);
|
|
8265
|
+
return /* @__PURE__ */ jsx50(
|
|
8266
|
+
ComboboxPrimitive.Empty,
|
|
8267
|
+
__spreadValues({
|
|
8268
|
+
"data-slot": "combobox-empty",
|
|
8269
|
+
className: mergeClassName(getClassName30("empty"), className)
|
|
8270
|
+
}, props)
|
|
8375
8271
|
);
|
|
8376
|
-
|
|
8377
|
-
useHotkey({ ctrl: true, c: true }, copySelectedComponent);
|
|
8378
|
-
useHotkey({ meta: true, v: true }, pasteComponent);
|
|
8379
|
-
useHotkey({ ctrl: true, v: true }, pasteComponent);
|
|
8380
|
-
useHotkey({ meta: true, x: true }, cutSelectedComponent);
|
|
8381
|
-
useHotkey({ ctrl: true, x: true }, cutSelectedComponent);
|
|
8382
|
-
};
|
|
8383
|
-
|
|
8384
|
-
// components/Editor/components/Nav/index.tsx
|
|
8385
|
-
init_react_import();
|
|
8272
|
+
}
|
|
8386
8273
|
|
|
8387
|
-
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/
|
|
8274
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/BrowserBar/styles.module.css#css-module
|
|
8388
8275
|
init_react_import();
|
|
8389
|
-
var
|
|
8276
|
+
var styles_module_default27 = { "BrowserBar": "_BrowserBar_ey7dt_3", "BrowserBar-urlTrigger": "_BrowserBar-urlTrigger_ey7dt_13", "BrowserBar-urlIcon": "_BrowserBar-urlIcon_ey7dt_43", "BrowserBar-urlText": "_BrowserBar-urlText_ey7dt_48", "BrowserBar-urlInput": "_BrowserBar-urlInput_ey7dt_60", "BrowserBar-itemPath": "_BrowserBar-itemPath_ey7dt_66", "BrowserBar-itemTitle": "_BrowserBar-itemTitle_ey7dt_71" };
|
|
8390
8277
|
|
|
8391
|
-
// components/
|
|
8392
|
-
import { jsx as
|
|
8393
|
-
var
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8278
|
+
// components/BrowserBar/index.tsx
|
|
8279
|
+
import { jsx as jsx51, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
8280
|
+
var normalizeRoute = (raw) => {
|
|
8281
|
+
const trimmed = raw.trim();
|
|
8282
|
+
if (!trimmed) return trimmed;
|
|
8283
|
+
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
8284
|
+
};
|
|
8285
|
+
var getClassName31 = get_class_name_factory_default("BrowserBar", styles_module_default27);
|
|
8286
|
+
var BrowserBar = ({}) => {
|
|
8287
|
+
const { routes, currentRoute, onRouteChange } = usePropsContext();
|
|
8288
|
+
const chrome = useChromeConfig();
|
|
8289
|
+
const showRoutePicker = !!routes && currentRoute !== void 0 && !!onRouteChange;
|
|
8290
|
+
const [inputValue, setInputValue] = useState21(currentRoute != null ? currentRoute : "");
|
|
8291
|
+
const lastSyncedPath = useRef15(currentRoute);
|
|
8292
|
+
if (lastSyncedPath.current !== currentRoute) {
|
|
8293
|
+
lastSyncedPath.current = currentRoute;
|
|
8294
|
+
setInputValue(currentRoute != null ? currentRoute : "");
|
|
8295
|
+
}
|
|
8296
|
+
const submit = (raw) => {
|
|
8297
|
+
const next = normalizeRoute(raw);
|
|
8298
|
+
if (!next || next === currentRoute) return;
|
|
8299
|
+
void (onRouteChange == null ? void 0 : onRouteChange(next));
|
|
8300
|
+
};
|
|
8301
|
+
if (!chrome.showUrlBar) return null;
|
|
8302
|
+
return /* @__PURE__ */ jsx51("div", { className: getClassName31(), children: showRoutePicker ? /* @__PURE__ */ jsxs22(
|
|
8303
|
+
Combobox,
|
|
8405
8304
|
{
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
}
|
|
8411
|
-
|
|
8412
|
-
|
|
8413
|
-
|
|
8414
|
-
|
|
8305
|
+
items: routes,
|
|
8306
|
+
value: currentRoute,
|
|
8307
|
+
onValueChange: (next) => {
|
|
8308
|
+
if (typeof next === "string") submit(next);
|
|
8309
|
+
},
|
|
8310
|
+
inputValue,
|
|
8311
|
+
onInputValueChange: (next) => setInputValue(next),
|
|
8312
|
+
autoHighlight: false,
|
|
8313
|
+
children: [
|
|
8314
|
+
/* @__PURE__ */ jsxs22(
|
|
8315
|
+
"form",
|
|
8316
|
+
{
|
|
8317
|
+
className: getClassName31("urlTrigger"),
|
|
8318
|
+
onSubmit: (event) => {
|
|
8319
|
+
event.preventDefault();
|
|
8320
|
+
submit(inputValue);
|
|
8321
|
+
},
|
|
8322
|
+
children: [
|
|
8323
|
+
/* @__PURE__ */ jsx51(Globe, { className: getClassName31("urlIcon"), size: 14 }),
|
|
8324
|
+
/* @__PURE__ */ jsx51(
|
|
8325
|
+
ComboboxInput,
|
|
8326
|
+
{
|
|
8327
|
+
className: getClassName31("urlInput"),
|
|
8328
|
+
placeholder: "/",
|
|
8329
|
+
spellCheck: false,
|
|
8330
|
+
autoCorrect: "off",
|
|
8331
|
+
autoCapitalize: "off"
|
|
8332
|
+
}
|
|
8333
|
+
)
|
|
8334
|
+
]
|
|
8335
|
+
}
|
|
8336
|
+
),
|
|
8337
|
+
/* @__PURE__ */ jsxs22(ComboboxContent, { children: [
|
|
8338
|
+
/* @__PURE__ */ jsx51(ComboboxEmpty, { children: "Press Enter to go to this path" }),
|
|
8339
|
+
/* @__PURE__ */ jsx51(ComboboxList, { children: (path) => /* @__PURE__ */ jsx51(ComboboxItem, { value: path, children: /* @__PURE__ */ jsx51("span", { className: getClassName31("itemPath"), children: path }) }, path) })
|
|
8340
|
+
] })
|
|
8341
|
+
]
|
|
8415
8342
|
}
|
|
8416
|
-
)
|
|
8417
|
-
}
|
|
8418
|
-
|
|
8419
|
-
|
|
8420
|
-
footer
|
|
8421
|
-
}) => {
|
|
8422
|
-
return /* @__PURE__ */ jsxs23("nav", { className: getClassName33(), children: [
|
|
8423
|
-
/* @__PURE__ */ jsx53("ul", { className: getClassName33("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx53(MenuItem, __spreadValues({}, item), key)) }),
|
|
8424
|
-
footer && /* @__PURE__ */ jsx53("div", { className: getClassName33("footer"), children: footer })
|
|
8425
|
-
] });
|
|
8343
|
+
) : /* @__PURE__ */ jsxs22("div", { className: getClassName31("urlTrigger"), children: [
|
|
8344
|
+
/* @__PURE__ */ jsx51(Globe, { className: getClassName31("urlIcon"), size: 14 }),
|
|
8345
|
+
/* @__PURE__ */ jsx51("span", { className: getClassName31("urlText"), children: "/" })
|
|
8346
|
+
] }) });
|
|
8426
8347
|
};
|
|
8427
8348
|
|
|
8428
8349
|
// components/Editor/components/Layout/index.tsx
|
|
8429
|
-
import {
|
|
8430
|
-
var
|
|
8431
|
-
var getLayoutClassName = get_class_name_factory_default("EditorLayout",
|
|
8432
|
-
var getPluginTabClassName = get_class_name_factory_default("EditorPluginTab",
|
|
8433
|
-
var
|
|
8350
|
+
import { jsx as jsx52, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
8351
|
+
var getClassName32 = get_class_name_factory_default("Editor", styles_module_default21);
|
|
8352
|
+
var getLayoutClassName = get_class_name_factory_default("EditorLayout", styles_module_default21);
|
|
8353
|
+
var getPluginTabClassName = get_class_name_factory_default("EditorPluginTab", styles_module_default21);
|
|
8354
|
+
var FieldSideBarBody = () => /* @__PURE__ */ jsx52(SidebarSection, { noBorderTop: true, title: null, children: /* @__PURE__ */ jsx52(Fields, {}) });
|
|
8355
|
+
var HeaderPublish = () => {
|
|
8434
8356
|
const appStore = useAppStoreApi();
|
|
8435
8357
|
const { onPublish, currentRoute } = usePropsContext();
|
|
8436
|
-
const
|
|
8358
|
+
const CustomHeaderActions = useAppStore(
|
|
8359
|
+
(s) => s.overrides.headerActions || DefaultOverride
|
|
8360
|
+
);
|
|
8361
|
+
return /* @__PURE__ */ jsx52(CustomHeaderActions, { children: /* @__PURE__ */ jsx52(
|
|
8362
|
+
Button,
|
|
8363
|
+
{
|
|
8364
|
+
onClick: () => {
|
|
8365
|
+
const data = appStore.getState().state.data;
|
|
8366
|
+
onPublish && onPublish(data, currentRoute);
|
|
8367
|
+
},
|
|
8368
|
+
children: "Publish"
|
|
8369
|
+
}
|
|
8370
|
+
) });
|
|
8371
|
+
};
|
|
8372
|
+
var HeaderHistory = () => {
|
|
8437
8373
|
const back = useAppStore((s) => s.history.back);
|
|
8438
8374
|
const forward = useAppStore((s) => s.history.forward);
|
|
8439
8375
|
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
|
8440
8376
|
const hasPast = useAppStore((s) => s.history.hasPast());
|
|
8441
|
-
|
|
8442
|
-
(
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
chrome.showHistoryControls ? /* @__PURE__ */ jsxs24("div", { className: getClassName34("fieldSideBarHistory"), children: [
|
|
8446
|
-
/* @__PURE__ */ jsx54(
|
|
8447
|
-
IconButton,
|
|
8448
|
-
{
|
|
8449
|
-
type: "button",
|
|
8450
|
-
title: "undo",
|
|
8451
|
-
disabled: !hasPast,
|
|
8452
|
-
onClick: back,
|
|
8453
|
-
children: /* @__PURE__ */ jsx54(Undo2, { size: 18 })
|
|
8454
|
-
}
|
|
8455
|
-
),
|
|
8456
|
-
/* @__PURE__ */ jsx54(
|
|
8457
|
-
IconButton,
|
|
8458
|
-
{
|
|
8459
|
-
type: "button",
|
|
8460
|
-
title: "redo",
|
|
8461
|
-
disabled: !hasFuture,
|
|
8462
|
-
onClick: forward,
|
|
8463
|
-
children: /* @__PURE__ */ jsx54(Redo2, { size: 18 })
|
|
8464
|
-
}
|
|
8465
|
-
)
|
|
8466
|
-
] }) : /* @__PURE__ */ jsx54("div", {}),
|
|
8467
|
-
/* @__PURE__ */ jsx54("div", { className: getClassName34("fieldSideBarActions"), children: /* @__PURE__ */ jsx54(CustomHeaderActions, { children: /* @__PURE__ */ jsx54(
|
|
8468
|
-
Button,
|
|
8377
|
+
return /* @__PURE__ */ jsxs23("div", { className: getLayoutClassName("headerHistory"), children: [
|
|
8378
|
+
/* @__PURE__ */ jsx52(IconButton, { type: "button", title: "Undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ jsx52(Undo2, { size: 16 }) }),
|
|
8379
|
+
/* @__PURE__ */ jsx52(
|
|
8380
|
+
IconButton,
|
|
8469
8381
|
{
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
children:
|
|
8382
|
+
type: "button",
|
|
8383
|
+
title: "Redo",
|
|
8384
|
+
disabled: !hasFuture,
|
|
8385
|
+
onClick: forward,
|
|
8386
|
+
children: /* @__PURE__ */ jsx52(Redo2, { size: 16 })
|
|
8475
8387
|
}
|
|
8476
|
-
)
|
|
8477
|
-
] });
|
|
8478
|
-
};
|
|
8479
|
-
var FieldSideBar = () => {
|
|
8480
|
-
const title = useAppStore(
|
|
8481
|
-
(s) => {
|
|
8482
|
-
var _a, _b, _c;
|
|
8483
|
-
return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : ((_c = s.config.root) == null ? void 0 : _c.label) || "Page";
|
|
8484
|
-
}
|
|
8485
|
-
);
|
|
8486
|
-
return /* @__PURE__ */ jsxs24(Fragment15, { children: [
|
|
8487
|
-
/* @__PURE__ */ jsx54(FieldSideBarToolbar, {}),
|
|
8488
|
-
/* @__PURE__ */ jsx54(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx54(Fields, {}) })
|
|
8388
|
+
)
|
|
8489
8389
|
] });
|
|
8490
8390
|
};
|
|
8491
8391
|
var PluginTab = ({
|
|
@@ -8493,17 +8393,16 @@ var PluginTab = ({
|
|
|
8493
8393
|
visible,
|
|
8494
8394
|
mobileOnly
|
|
8495
8395
|
}) => {
|
|
8496
|
-
return /* @__PURE__ */
|
|
8396
|
+
return /* @__PURE__ */ jsx52("div", { className: getPluginTabClassName({ visible, mobileOnly }), children: /* @__PURE__ */ jsx52("div", { className: getPluginTabClassName("body"), children }) });
|
|
8497
8397
|
};
|
|
8498
8398
|
var Layout = ({ children }) => {
|
|
8499
8399
|
const {
|
|
8500
8400
|
iframe: _iframe,
|
|
8501
8401
|
dnd,
|
|
8502
|
-
initialHistory: _initialHistory,
|
|
8503
8402
|
plugins,
|
|
8504
8403
|
height
|
|
8505
8404
|
} = usePropsContext();
|
|
8506
|
-
const iframe =
|
|
8405
|
+
const iframe = useMemo22(
|
|
8507
8406
|
() => __spreadValues({
|
|
8508
8407
|
enabled: true,
|
|
8509
8408
|
waitForStyles: true
|
|
@@ -8511,7 +8410,7 @@ var Layout = ({ children }) => {
|
|
|
8511
8410
|
[_iframe]
|
|
8512
8411
|
);
|
|
8513
8412
|
useInjectGlobalCss(iframe.enabled);
|
|
8514
|
-
const
|
|
8413
|
+
const setUi = useAppStore((s) => s.setUi);
|
|
8515
8414
|
const leftSideBarVisible = useAppStore((s) => s.state.ui.leftSideBarVisible);
|
|
8516
8415
|
const rightSideBarVisible = useAppStore(
|
|
8517
8416
|
(s) => s.state.ui.rightSideBarVisible
|
|
@@ -8519,53 +8418,14 @@ var Layout = ({ children }) => {
|
|
|
8519
8418
|
const chrome = useChromeConfig();
|
|
8520
8419
|
const navBarVisible = chrome.showNavBar;
|
|
8521
8420
|
const instanceId = useAppStore((s) => s.instanceId);
|
|
8522
|
-
const {
|
|
8523
|
-
width: leftWidth,
|
|
8524
|
-
setWidth: setLeftWidth,
|
|
8525
|
-
sidebarRef: leftSidebarRef,
|
|
8526
|
-
handleResizeEnd: handleLeftSidebarResizeEnd
|
|
8527
|
-
} = useSidebarResize("left", dispatch);
|
|
8528
|
-
const {
|
|
8529
|
-
width: rightWidth,
|
|
8530
|
-
setWidth: setRightWidth,
|
|
8531
|
-
sidebarRef: rightSidebarRef,
|
|
8532
|
-
handleResizeEnd: handleRightSidebarResizeEnd
|
|
8533
|
-
} = useSidebarResize("right", dispatch);
|
|
8534
|
-
useEffect25(() => {
|
|
8535
|
-
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
8536
|
-
dispatch({
|
|
8537
|
-
type: "setUi",
|
|
8538
|
-
ui: {
|
|
8539
|
-
leftSideBarVisible: false,
|
|
8540
|
-
rightSideBarVisible: false
|
|
8541
|
-
}
|
|
8542
|
-
});
|
|
8543
|
-
}
|
|
8544
|
-
const handleResize = () => {
|
|
8545
|
-
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
8546
|
-
dispatch({
|
|
8547
|
-
type: "setUi",
|
|
8548
|
-
ui: (ui) => __spreadValues(__spreadValues({}, ui), ui.rightSideBarVisible ? { leftSideBarVisible: false } : {})
|
|
8549
|
-
});
|
|
8550
|
-
}
|
|
8551
|
-
};
|
|
8552
|
-
window.addEventListener("resize", handleResize);
|
|
8553
|
-
return () => {
|
|
8554
|
-
window.removeEventListener("resize", handleResize);
|
|
8555
|
-
};
|
|
8556
|
-
}, []);
|
|
8557
8421
|
const overrides = useAppStore((s) => s.overrides);
|
|
8558
|
-
const CustomEditor =
|
|
8422
|
+
const CustomEditor = useMemo22(
|
|
8559
8423
|
() => overrides.editor || DefaultOverride,
|
|
8560
8424
|
[overrides]
|
|
8561
8425
|
);
|
|
8562
|
-
const [mounted, setMounted] = useState23(false);
|
|
8563
|
-
useEffect25(() => {
|
|
8564
|
-
setMounted(true);
|
|
8565
|
-
}, []);
|
|
8566
8426
|
const ready = useAppStore((s) => s.status === "READY");
|
|
8567
8427
|
useMonitorHotkeys();
|
|
8568
|
-
|
|
8428
|
+
useEffect24(() => {
|
|
8569
8429
|
if (ready && iframe.enabled) {
|
|
8570
8430
|
const frameDoc = getFrame();
|
|
8571
8431
|
if (frameDoc) {
|
|
@@ -8576,106 +8436,36 @@ var Layout = ({ children }) => {
|
|
|
8576
8436
|
usePreviewModeHotkeys();
|
|
8577
8437
|
useDeleteHotkeys();
|
|
8578
8438
|
useClipboardHotkeys();
|
|
8579
|
-
const layoutOptions = {};
|
|
8580
|
-
if (leftWidth) {
|
|
8581
|
-
layoutOptions["--editor-user-left-side-bar-width"] = `${leftWidth}px`;
|
|
8582
|
-
}
|
|
8583
|
-
if (rightWidth) {
|
|
8584
|
-
layoutOptions["--editor-user-right-side-bar-width"] = `${rightWidth}px`;
|
|
8585
|
-
}
|
|
8586
|
-
const setUi = useAppStore((s) => s.setUi);
|
|
8587
8439
|
const currentPlugin = useAppStore((s) => {
|
|
8588
8440
|
var _a;
|
|
8589
8441
|
return (_a = s.state.ui.plugin) == null ? void 0 : _a.current;
|
|
8590
8442
|
});
|
|
8591
8443
|
const appStoreApi = useAppStoreApi();
|
|
8592
|
-
const [
|
|
8593
|
-
const [mobilePanelHeight, setMobilePanelHeight] = useState23(
|
|
8594
|
-
null
|
|
8595
|
-
);
|
|
8596
|
-
const mobilePanelRef = useRef18(null);
|
|
8597
|
-
const isDraggingMobile = useRef18(false);
|
|
8598
|
-
const dragStartY = useRef18(0);
|
|
8599
|
-
const dragStartHeight = useRef18(0);
|
|
8600
|
-
const handleMobileDragStart = useCallback24(
|
|
8601
|
-
(clientY) => {
|
|
8602
|
-
isDraggingMobile.current = true;
|
|
8603
|
-
dragStartY.current = clientY;
|
|
8604
|
-
const panel = mobilePanelRef.current;
|
|
8605
|
-
dragStartHeight.current = panel ? panel.getBoundingClientRect().height : 0;
|
|
8606
|
-
document.body.style.userSelect = "none";
|
|
8607
|
-
document.body.style.touchAction = "none";
|
|
8608
|
-
},
|
|
8609
|
-
[]
|
|
8610
|
-
);
|
|
8611
|
-
const handleMobileDragMove = useCallback24((clientY) => {
|
|
8612
|
-
if (!isDraggingMobile.current) return;
|
|
8613
|
-
const delta = dragStartY.current - clientY;
|
|
8614
|
-
const viewportHeight = window.innerHeight;
|
|
8615
|
-
const minH = viewportHeight * 0.15;
|
|
8616
|
-
const maxH = viewportHeight * 0.75;
|
|
8617
|
-
const newH = Math.min(maxH, Math.max(minH, dragStartHeight.current + delta));
|
|
8618
|
-
setMobilePanelHeight(newH);
|
|
8619
|
-
}, []);
|
|
8620
|
-
const handleMobileDragEnd = useCallback24(() => {
|
|
8621
|
-
if (!isDraggingMobile.current) return;
|
|
8622
|
-
isDraggingMobile.current = false;
|
|
8623
|
-
document.body.style.userSelect = "";
|
|
8624
|
-
document.body.style.touchAction = "";
|
|
8625
|
-
}, []);
|
|
8626
|
-
useEffect25(() => {
|
|
8627
|
-
const onTouchMove = (e) => {
|
|
8628
|
-
if (isDraggingMobile.current) {
|
|
8629
|
-
e.preventDefault();
|
|
8630
|
-
handleMobileDragMove(e.touches[0].clientY);
|
|
8631
|
-
}
|
|
8632
|
-
};
|
|
8633
|
-
const onTouchEnd = () => handleMobileDragEnd();
|
|
8634
|
-
const onMouseMove = (e) => {
|
|
8635
|
-
if (isDraggingMobile.current) {
|
|
8636
|
-
e.preventDefault();
|
|
8637
|
-
handleMobileDragMove(e.clientY);
|
|
8638
|
-
}
|
|
8639
|
-
};
|
|
8640
|
-
const onMouseUp = () => handleMobileDragEnd();
|
|
8641
|
-
document.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
8642
|
-
document.addEventListener("touchend", onTouchEnd);
|
|
8643
|
-
document.addEventListener("mousemove", onMouseMove);
|
|
8644
|
-
document.addEventListener("mouseup", onMouseUp);
|
|
8645
|
-
return () => {
|
|
8646
|
-
document.removeEventListener("touchmove", onTouchMove);
|
|
8647
|
-
document.removeEventListener("touchend", onTouchEnd);
|
|
8648
|
-
document.removeEventListener("mousemove", onMouseMove);
|
|
8649
|
-
document.removeEventListener("mouseup", onMouseUp);
|
|
8650
|
-
};
|
|
8651
|
-
}, [handleMobileDragMove, handleMobileDragEnd]);
|
|
8652
|
-
const [theme, setTheme] = useState23(() => {
|
|
8444
|
+
const [theme, setTheme] = useState22(() => {
|
|
8653
8445
|
if (typeof window === "undefined") return "light";
|
|
8654
8446
|
const stored = window.localStorage.getItem("editor-theme");
|
|
8655
8447
|
if (stored === "light" || stored === "dark") return stored;
|
|
8656
8448
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
8657
8449
|
});
|
|
8658
|
-
|
|
8450
|
+
useEffect24(() => {
|
|
8659
8451
|
if (typeof window === "undefined") return;
|
|
8660
8452
|
window.localStorage.setItem("editor-theme", theme);
|
|
8661
8453
|
}, [theme]);
|
|
8662
8454
|
const toggleTheme = () => {
|
|
8663
8455
|
setTheme((t) => t === "dark" ? "light" : "dark");
|
|
8664
8456
|
};
|
|
8665
|
-
const themeIcon = theme === "dark" ? /* @__PURE__ */
|
|
8457
|
+
const themeIcon = theme === "dark" ? /* @__PURE__ */ jsx52(Sun, { size: 18 }) : /* @__PURE__ */ jsx52(Moon, { size: 18 });
|
|
8666
8458
|
const themeLabel = theme === "dark" ? "Switch to light mode" : "Switch to dark mode";
|
|
8667
|
-
const hasLegacySideBarPlugin =
|
|
8459
|
+
const hasLegacySideBarPlugin = useMemo22(
|
|
8668
8460
|
() => !!(plugins == null ? void 0 : plugins.find((p) => p.name === "legacy-side-bar")),
|
|
8669
8461
|
[plugins]
|
|
8670
8462
|
);
|
|
8671
|
-
const pluginItems =
|
|
8463
|
+
const pluginItems = useMemo22(() => {
|
|
8672
8464
|
const details = {};
|
|
8673
|
-
const defaultPlugins = [blocksPlugin()];
|
|
8674
8465
|
const isLegacy = (plugin) => plugin.name === "legacy-side-bar" ? -1 : 0;
|
|
8675
|
-
const combinedPlugins = [
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
].sort((a, b) => isLegacy(a) - isLegacy(b));
|
|
8466
|
+
const combinedPlugins = [...plugins != null ? plugins : []].sort(
|
|
8467
|
+
(a, b) => isLegacy(a) - isLegacy(b)
|
|
8468
|
+
);
|
|
8679
8469
|
if (!(plugins == null ? void 0 : plugins.some((p) => p.name === "fields"))) {
|
|
8680
8470
|
combinedPlugins.push(fieldsPlugin());
|
|
8681
8471
|
}
|
|
@@ -8687,23 +8477,15 @@ var Layout = ({ children }) => {
|
|
|
8687
8477
|
}
|
|
8688
8478
|
details[plugin.name] = {
|
|
8689
8479
|
label: (_a = plugin.label) != null ? _a : plugin.name,
|
|
8690
|
-
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */
|
|
8480
|
+
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ jsx52(ToyBrick, {}),
|
|
8691
8481
|
onClick: () => {
|
|
8692
|
-
var _a2;
|
|
8693
|
-
setMobilePanelHeightMode((_a2 = plugin.mobilePanelHeight) != null ? _a2 : "toggle");
|
|
8694
8482
|
if (plugin.name === currentPlugin) {
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
if (plugin.name) {
|
|
8702
|
-
setUi({
|
|
8703
|
-
plugin: { current: plugin.name },
|
|
8704
|
-
leftSideBarVisible: true
|
|
8705
|
-
});
|
|
8706
|
-
}
|
|
8483
|
+
setUi({ leftSideBarVisible: !leftSideBarVisible });
|
|
8484
|
+
} else if (plugin.name) {
|
|
8485
|
+
setUi({
|
|
8486
|
+
plugin: { current: plugin.name },
|
|
8487
|
+
leftSideBarVisible: true
|
|
8488
|
+
});
|
|
8707
8489
|
}
|
|
8708
8490
|
},
|
|
8709
8491
|
isActive: leftSideBarVisible && currentPlugin === plugin.name,
|
|
@@ -8715,147 +8497,65 @@ var Layout = ({ children }) => {
|
|
|
8715
8497
|
});
|
|
8716
8498
|
return details;
|
|
8717
8499
|
}, [plugins, currentPlugin, appStoreApi, leftSideBarVisible]);
|
|
8718
|
-
|
|
8500
|
+
useEffect24(() => {
|
|
8719
8501
|
if (!currentPlugin) {
|
|
8720
8502
|
const names = Object.keys(pluginItems);
|
|
8721
8503
|
setUi({ plugin: { current: names[0] } });
|
|
8722
8504
|
}
|
|
8723
8505
|
}, [pluginItems, currentPlugin]);
|
|
8724
8506
|
const hasDesktopFieldsPlugin = pluginItems["fields"] && pluginItems["fields"].mobileOnly === false;
|
|
8725
|
-
|
|
8726
|
-
if (mobilePanelHeight && leftSideBarVisible) {
|
|
8727
|
-
mobilePanelStyle["--editor-mobile-panel-height"] = `${mobilePanelHeight}px`;
|
|
8728
|
-
}
|
|
8729
|
-
return /* @__PURE__ */ jsxs24(
|
|
8507
|
+
return /* @__PURE__ */ jsx52(ThemeContext.Provider, { value: { theme, toggleTheme }, children: /* @__PURE__ */ jsxs23(
|
|
8730
8508
|
"div",
|
|
8731
8509
|
{
|
|
8732
|
-
className: `Editor ${
|
|
8510
|
+
className: `Editor ${getClassName32({
|
|
8733
8511
|
hidePlugins: hasLegacySideBarPlugin
|
|
8734
8512
|
})}`,
|
|
8735
8513
|
id: instanceId,
|
|
8736
8514
|
"data-theme": theme,
|
|
8737
8515
|
style: { height },
|
|
8738
8516
|
children: [
|
|
8739
|
-
/* @__PURE__ */
|
|
8517
|
+
/* @__PURE__ */ jsx52(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx52(CustomEditor, { children: children || /* @__PURE__ */ jsx52(FrameProvider, { children: /* @__PURE__ */ jsx52(
|
|
8740
8518
|
"div",
|
|
8741
8519
|
{
|
|
8742
8520
|
className: getLayoutClassName({
|
|
8743
8521
|
leftSideBarVisible,
|
|
8744
|
-
mounted,
|
|
8745
8522
|
rightSideBarVisible: !hasDesktopFieldsPlugin && rightSideBarVisible,
|
|
8746
|
-
navBarVisible
|
|
8747
|
-
mobilePanelHeightToggle: mobilePanelHeightMode === "toggle",
|
|
8748
|
-
mobilePanelHeightMinContent: mobilePanelHeightMode === "min-content",
|
|
8749
|
-
mobilePanelCustomHeight: mobilePanelHeight !== null && leftSideBarVisible
|
|
8523
|
+
navBarVisible
|
|
8750
8524
|
}),
|
|
8751
8525
|
style: { height },
|
|
8752
|
-
children: /* @__PURE__ */
|
|
8753
|
-
"
|
|
8754
|
-
|
|
8755
|
-
className: getLayoutClassName("
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
|
|
8770
|
-
|
|
8771
|
-
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
{
|
|
8776
|
-
ref: mobilePanelRef,
|
|
8777
|
-
className: getLayoutClassName("mobilePanel"),
|
|
8778
|
-
children: [
|
|
8779
|
-
/* @__PURE__ */ jsx54(
|
|
8780
|
-
"div",
|
|
8781
|
-
{
|
|
8782
|
-
className: getLayoutClassName("mobileDragHandle"),
|
|
8783
|
-
onTouchStart: (e) => handleMobileDragStart(e.touches[0].clientY),
|
|
8784
|
-
onMouseDown: (e) => handleMobileDragStart(e.clientY),
|
|
8785
|
-
children: /* @__PURE__ */ jsx54(
|
|
8786
|
-
"div",
|
|
8787
|
-
{
|
|
8788
|
-
className: getLayoutClassName("mobileDragHandlePill")
|
|
8789
|
-
}
|
|
8790
|
-
)
|
|
8791
|
-
}
|
|
8792
|
-
),
|
|
8793
|
-
/* @__PURE__ */ jsx54(
|
|
8794
|
-
"div",
|
|
8795
|
-
{
|
|
8796
|
-
className: getLayoutClassName("mobilePanelContent"),
|
|
8797
|
-
children: Object.entries(pluginItems).map(
|
|
8798
|
-
([id, { mobileOnly, render: Render2 }]) => /* @__PURE__ */ jsx54(
|
|
8799
|
-
PluginTab,
|
|
8800
|
-
{
|
|
8801
|
-
visible: currentPlugin === id,
|
|
8802
|
-
mobileOnly,
|
|
8803
|
-
children: /* @__PURE__ */ jsx54(Render2, {})
|
|
8804
|
-
},
|
|
8805
|
-
id
|
|
8806
|
-
)
|
|
8807
|
-
)
|
|
8808
|
-
}
|
|
8809
|
-
)
|
|
8810
|
-
]
|
|
8811
|
-
}
|
|
8812
|
-
),
|
|
8813
|
-
/* @__PURE__ */ jsx54(
|
|
8814
|
-
Sidebar,
|
|
8815
|
-
{
|
|
8816
|
-
position: "left",
|
|
8817
|
-
sidebarRef: leftSidebarRef,
|
|
8818
|
-
isVisible: leftSideBarVisible,
|
|
8819
|
-
onResize: setLeftWidth,
|
|
8820
|
-
onResizeEnd: handleLeftSidebarResizeEnd,
|
|
8821
|
-
children: Object.entries(pluginItems).map(
|
|
8822
|
-
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */ jsx54(
|
|
8823
|
-
PluginTab,
|
|
8824
|
-
{
|
|
8825
|
-
visible: currentPlugin === id,
|
|
8826
|
-
mobileOnly,
|
|
8827
|
-
children: /* @__PURE__ */ jsx54(Render2, {})
|
|
8828
|
-
},
|
|
8829
|
-
id
|
|
8830
|
-
)
|
|
8831
|
-
)
|
|
8832
|
-
}
|
|
8833
|
-
),
|
|
8834
|
-
/* @__PURE__ */ jsx54(Canvas, {}),
|
|
8835
|
-
!hasDesktopFieldsPlugin && /* @__PURE__ */ jsx54(
|
|
8836
|
-
Sidebar,
|
|
8837
|
-
{
|
|
8838
|
-
position: "right",
|
|
8839
|
-
sidebarRef: rightSidebarRef,
|
|
8840
|
-
isVisible: rightSideBarVisible,
|
|
8841
|
-
onResize: setRightWidth,
|
|
8842
|
-
onResizeEnd: handleRightSidebarResizeEnd,
|
|
8843
|
-
children: /* @__PURE__ */ jsx54(FieldSideBar, {})
|
|
8844
|
-
}
|
|
8845
|
-
)
|
|
8846
|
-
]
|
|
8847
|
-
}
|
|
8848
|
-
)
|
|
8526
|
+
children: /* @__PURE__ */ jsxs23("div", { className: getLayoutClassName("inner"), children: [
|
|
8527
|
+
navBarVisible && /* @__PURE__ */ jsxs23("header", { className: getLayoutClassName("header"), children: [
|
|
8528
|
+
/* @__PURE__ */ jsx52("div", { className: getLayoutClassName("headerStart"), children: /* @__PURE__ */ jsx52(Nav, { items: pluginItems, orientation: "horizontal" }) }),
|
|
8529
|
+
/* @__PURE__ */ jsx52("div", { className: getLayoutClassName("headerCenter"), children: chrome.showUrlBar && /* @__PURE__ */ jsx52(BrowserBar, {}) }),
|
|
8530
|
+
/* @__PURE__ */ jsxs23("div", { className: getLayoutClassName("headerEnd"), children: [
|
|
8531
|
+
chrome.showHistoryControls && /* @__PURE__ */ jsx52(HeaderHistory, {}),
|
|
8532
|
+
/* @__PURE__ */ jsx52(HeaderPublish, {})
|
|
8533
|
+
] })
|
|
8534
|
+
] }),
|
|
8535
|
+
leftSideBarVisible && /* @__PURE__ */ jsx52(Sidebar, { position: "left", children: Object.entries(pluginItems).map(
|
|
8536
|
+
([id, { mobileOnly, render: Render2 }]) => /* @__PURE__ */ jsx52(
|
|
8537
|
+
PluginTab,
|
|
8538
|
+
{
|
|
8539
|
+
visible: currentPlugin === id,
|
|
8540
|
+
mobileOnly,
|
|
8541
|
+
children: /* @__PURE__ */ jsx52(Render2, {})
|
|
8542
|
+
},
|
|
8543
|
+
id
|
|
8544
|
+
)
|
|
8545
|
+
) }),
|
|
8546
|
+
/* @__PURE__ */ jsx52(Canvas, {}),
|
|
8547
|
+
!hasDesktopFieldsPlugin && rightSideBarVisible && /* @__PURE__ */ jsx52(Sidebar, { position: "right", children: /* @__PURE__ */ jsx52(FieldSideBarBody, {}) })
|
|
8548
|
+
] })
|
|
8849
8549
|
}
|
|
8850
8550
|
) }) }) }),
|
|
8851
|
-
/* @__PURE__ */
|
|
8551
|
+
/* @__PURE__ */ jsx52("div", { id: "editor-portal-root", className: getClassName32("portal") })
|
|
8852
8552
|
]
|
|
8853
8553
|
}
|
|
8854
|
-
);
|
|
8554
|
+
) });
|
|
8855
8555
|
};
|
|
8856
8556
|
|
|
8857
8557
|
// components/Editor/index.tsx
|
|
8858
|
-
import { jsx as
|
|
8558
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
8859
8559
|
var CHROME_KEYS = [
|
|
8860
8560
|
"showNavBar",
|
|
8861
8561
|
"showThemeToggle",
|
|
@@ -8885,11 +8585,11 @@ var splitUiConfig = (ui) => {
|
|
|
8885
8585
|
}
|
|
8886
8586
|
return { runtime, chrome };
|
|
8887
8587
|
};
|
|
8888
|
-
var propsContext =
|
|
8588
|
+
var propsContext = createContext9({});
|
|
8889
8589
|
function PropsProvider(props) {
|
|
8890
|
-
return /* @__PURE__ */
|
|
8590
|
+
return /* @__PURE__ */ jsx53(propsContext.Provider, { value: props, children: props.children });
|
|
8891
8591
|
}
|
|
8892
|
-
var usePropsContext = () =>
|
|
8592
|
+
var usePropsContext = () => useContext16(propsContext);
|
|
8893
8593
|
var useChromeConfig = () => {
|
|
8894
8594
|
const { ui } = usePropsContext();
|
|
8895
8595
|
const { chrome } = splitUiConfig(ui);
|
|
@@ -8913,14 +8613,14 @@ function EditorProvider({ children }) {
|
|
|
8913
8613
|
fullScreenCanvas,
|
|
8914
8614
|
_experimentalVirtualization
|
|
8915
8615
|
} = usePropsContext();
|
|
8916
|
-
const iframe =
|
|
8616
|
+
const iframe = useMemo23(
|
|
8917
8617
|
() => __spreadValues({
|
|
8918
8618
|
enabled: true,
|
|
8919
8619
|
waitForStyles: true
|
|
8920
8620
|
}, _iframe),
|
|
8921
8621
|
[_iframe]
|
|
8922
8622
|
);
|
|
8923
|
-
const [generatedAppState] =
|
|
8623
|
+
const [generatedAppState] = useState23(() => {
|
|
8924
8624
|
var _a, _b, _c, _d, _e, _f;
|
|
8925
8625
|
const { runtime: initialUiRuntime } = splitUiConfig(initialUi);
|
|
8926
8626
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUiRuntime);
|
|
@@ -8973,7 +8673,7 @@ function EditorProvider({ children }) {
|
|
|
8973
8673
|
return walkAppState(newAppState, config);
|
|
8974
8674
|
});
|
|
8975
8675
|
const { appendData = true } = _initialHistory || {};
|
|
8976
|
-
const [blendedHistories] =
|
|
8676
|
+
const [blendedHistories] = useState23(
|
|
8977
8677
|
[
|
|
8978
8678
|
...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
|
|
8979
8679
|
...appendData ? [{ state: generatedAppState }] : []
|
|
@@ -8987,7 +8687,7 @@ function EditorProvider({ children }) {
|
|
|
8987
8687
|
});
|
|
8988
8688
|
})
|
|
8989
8689
|
);
|
|
8990
|
-
const initialHistoryIndex =
|
|
8690
|
+
const initialHistoryIndex = useMemo23(() => {
|
|
8991
8691
|
if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
|
|
8992
8692
|
return _initialHistory == null ? void 0 : _initialHistory.index;
|
|
8993
8693
|
}
|
|
@@ -8998,7 +8698,7 @@ function EditorProvider({ children }) {
|
|
|
8998
8698
|
overrides,
|
|
8999
8699
|
plugins
|
|
9000
8700
|
});
|
|
9001
|
-
const loadedFieldTransforms =
|
|
8701
|
+
const loadedFieldTransforms = useMemo23(() => {
|
|
9002
8702
|
const _plugins = plugins || [];
|
|
9003
8703
|
const pluginFieldTransforms = _plugins.reduce(
|
|
9004
8704
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
@@ -9007,7 +8707,7 @@ function EditorProvider({ children }) {
|
|
|
9007
8707
|
return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
|
|
9008
8708
|
}, [fieldTransforms, plugins]);
|
|
9009
8709
|
const instanceId = useSafeId();
|
|
9010
|
-
const generateAppStore =
|
|
8710
|
+
const generateAppStore = useCallback22(
|
|
9011
8711
|
(state) => {
|
|
9012
8712
|
return {
|
|
9013
8713
|
instanceId,
|
|
@@ -9039,15 +8739,15 @@ function EditorProvider({ children }) {
|
|
|
9039
8739
|
loadedFieldTransforms
|
|
9040
8740
|
]
|
|
9041
8741
|
);
|
|
9042
|
-
const [appStore] =
|
|
8742
|
+
const [appStore] = useState23(
|
|
9043
8743
|
() => createAppStore(generateAppStore(initialAppState))
|
|
9044
8744
|
);
|
|
9045
|
-
|
|
8745
|
+
useEffect25(() => {
|
|
9046
8746
|
if (process.env.NODE_ENV !== "production") {
|
|
9047
8747
|
window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
|
|
9048
8748
|
}
|
|
9049
8749
|
}, [appStore]);
|
|
9050
|
-
|
|
8750
|
+
useEffect25(() => {
|
|
9051
8751
|
const state = appStore.getState().state;
|
|
9052
8752
|
appStore.setState(__spreadValues({}, generateAppStore(state)));
|
|
9053
8753
|
}, [generateAppStore]);
|
|
@@ -9056,8 +8756,8 @@ function EditorProvider({ children }) {
|
|
|
9056
8756
|
index: initialHistoryIndex,
|
|
9057
8757
|
initialAppState
|
|
9058
8758
|
});
|
|
9059
|
-
const previousData =
|
|
9060
|
-
|
|
8759
|
+
const previousData = useRef16(null);
|
|
8760
|
+
useEffect25(() => {
|
|
9061
8761
|
return appStore.subscribe(
|
|
9062
8762
|
(s) => s.state.data,
|
|
9063
8763
|
(data) => {
|
|
@@ -9071,16 +8771,16 @@ function EditorProvider({ children }) {
|
|
|
9071
8771
|
}, [onChange, config]);
|
|
9072
8772
|
useRegisterPermissionsSlice(appStore, permissions);
|
|
9073
8773
|
const uEditorStore = useRegisterUseEditorStore(appStore);
|
|
9074
|
-
|
|
8774
|
+
useEffect25(() => {
|
|
9075
8775
|
const { resolveAndCommitData } = appStore.getState();
|
|
9076
8776
|
setTimeout(() => {
|
|
9077
8777
|
resolveAndCommitData();
|
|
9078
8778
|
}, 0);
|
|
9079
8779
|
}, []);
|
|
9080
|
-
return /* @__PURE__ */
|
|
8780
|
+
return /* @__PURE__ */ jsx53(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx53(UseEditorStoreContext.Provider, { value: uEditorStore, children }) });
|
|
9081
8781
|
}
|
|
9082
8782
|
function Editor3(props) {
|
|
9083
|
-
return /* @__PURE__ */
|
|
8783
|
+
return /* @__PURE__ */ jsx53(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx53(EditorProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx53(Layout, { children: props.children }) })) }));
|
|
9084
8784
|
}
|
|
9085
8785
|
Editor3.Components = Components;
|
|
9086
8786
|
Editor3.Fields = Fields;
|
|
@@ -9090,10 +8790,10 @@ Editor3.Preview = Preview2;
|
|
|
9090
8790
|
|
|
9091
8791
|
// lib/use-stable-value.ts
|
|
9092
8792
|
init_react_import();
|
|
9093
|
-
import { useRef as
|
|
8793
|
+
import { useRef as useRef17 } from "react";
|
|
9094
8794
|
import { deepEqual as deepEqual3 } from "fast-equals";
|
|
9095
8795
|
var useStableValue = (value) => {
|
|
9096
|
-
const ref =
|
|
8796
|
+
const ref = useRef17(value);
|
|
9097
8797
|
if (!deepEqual3(ref.current, value)) {
|
|
9098
8798
|
ref.current = value;
|
|
9099
8799
|
}
|
|
@@ -9102,11 +8802,11 @@ var useStableValue = (value) => {
|
|
|
9102
8802
|
|
|
9103
8803
|
// components/App/context.ts
|
|
9104
8804
|
init_react_import();
|
|
9105
|
-
import { createContext as
|
|
8805
|
+
import { createContext as createContext10, useContext as useContext17, useMemo as useMemo24 } from "react";
|
|
9106
8806
|
import { matchRoutes, useLocation, useNavigate } from "react-router";
|
|
9107
|
-
var appConfigContext =
|
|
8807
|
+
var appConfigContext = createContext10(null);
|
|
9108
8808
|
var useAppConfigContext = () => {
|
|
9109
|
-
const ctx =
|
|
8809
|
+
const ctx = useContext17(appConfigContext);
|
|
9110
8810
|
if (!ctx) {
|
|
9111
8811
|
throw new Error("useApp must be called inside an <AppProvider> or <App>");
|
|
9112
8812
|
}
|
|
@@ -9125,7 +8825,7 @@ var useApp = () => {
|
|
|
9125
8825
|
const currentPath = location.pathname || "/";
|
|
9126
8826
|
const isEditing = cfg.editorPath !== null && (currentPath === cfg.editorPath || currentPath.startsWith(`${cfg.editorPath}/`));
|
|
9127
8827
|
const matchRoute = isEditing ? stripPrefix(currentPath, cfg.editorPath) : currentPath;
|
|
9128
|
-
const matched =
|
|
8828
|
+
const matched = useMemo24(() => {
|
|
9129
8829
|
const routeKeys = Object.keys(cfg.pages);
|
|
9130
8830
|
if (routeKeys.length === 0) return null;
|
|
9131
8831
|
const matches = matchRoutes(
|
|
@@ -9141,7 +8841,7 @@ var useApp = () => {
|
|
|
9141
8841
|
data: cfg.pages[key]
|
|
9142
8842
|
};
|
|
9143
8843
|
}, [cfg.pages, matchRoute]);
|
|
9144
|
-
const routes =
|
|
8844
|
+
const routes = useMemo24(() => Object.keys(cfg.pages), [cfg.pages]);
|
|
9145
8845
|
const navigate = (route) => {
|
|
9146
8846
|
const target = isEditing && cfg.editorPath ? `${cfg.editorPath}${route === "/" ? "" : route}` || "/" : route;
|
|
9147
8847
|
rrNavigate(target || "/");
|
|
@@ -9158,14 +8858,14 @@ var useApp = () => {
|
|
|
9158
8858
|
|
|
9159
8859
|
// components/App/AppProvider.tsx
|
|
9160
8860
|
init_react_import();
|
|
9161
|
-
import { useMemo as
|
|
8861
|
+
import { useMemo as useMemo25 } from "react";
|
|
9162
8862
|
import {
|
|
9163
8863
|
BrowserRouter,
|
|
9164
8864
|
HashRouter,
|
|
9165
8865
|
MemoryRouter,
|
|
9166
8866
|
StaticRouter
|
|
9167
8867
|
} from "react-router";
|
|
9168
|
-
import { jsx as
|
|
8868
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
9169
8869
|
var EDITOR_PATH = "/editor";
|
|
9170
8870
|
var isServer = typeof window === "undefined";
|
|
9171
8871
|
function AppProvider({
|
|
@@ -9178,7 +8878,7 @@ function AppProvider({
|
|
|
9178
8878
|
}) {
|
|
9179
8879
|
const stablePages = useStableValue(pages);
|
|
9180
8880
|
const resolvedEditorPath = editorPath === null ? null : editorPath || EDITOR_PATH;
|
|
9181
|
-
const ctxValue =
|
|
8881
|
+
const ctxValue = useMemo25(
|
|
9182
8882
|
() => ({
|
|
9183
8883
|
config,
|
|
9184
8884
|
pages: stablePages,
|
|
@@ -9186,28 +8886,28 @@ function AppProvider({
|
|
|
9186
8886
|
}),
|
|
9187
8887
|
[config, stablePages, resolvedEditorPath]
|
|
9188
8888
|
);
|
|
9189
|
-
const inner = /* @__PURE__ */
|
|
8889
|
+
const inner = /* @__PURE__ */ jsx54(appConfigContext.Provider, { value: ctxValue, children });
|
|
9190
8890
|
if (isServer) {
|
|
9191
|
-
return /* @__PURE__ */
|
|
8891
|
+
return /* @__PURE__ */ jsx54(StaticRouter, { location: currentPath != null ? currentPath : "/", children: inner });
|
|
9192
8892
|
}
|
|
9193
8893
|
if (router === "hash") {
|
|
9194
|
-
return /* @__PURE__ */
|
|
8894
|
+
return /* @__PURE__ */ jsx54(HashRouter, { children: inner });
|
|
9195
8895
|
}
|
|
9196
8896
|
if (router === "memory") {
|
|
9197
|
-
return /* @__PURE__ */
|
|
8897
|
+
return /* @__PURE__ */ jsx54(MemoryRouter, { initialEntries: [currentPath != null ? currentPath : "/"], children: inner });
|
|
9198
8898
|
}
|
|
9199
|
-
return /* @__PURE__ */
|
|
8899
|
+
return /* @__PURE__ */ jsx54(BrowserRouter, { children: inner });
|
|
9200
8900
|
}
|
|
9201
8901
|
|
|
9202
8902
|
// components/App/App.tsx
|
|
9203
8903
|
init_react_import();
|
|
9204
8904
|
import { Route, Routes } from "react-router";
|
|
9205
|
-
import { Fragment as
|
|
8905
|
+
import { Fragment as Fragment14, jsx as jsx55, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
9206
8906
|
var joinEditorPath = (editorPath, route) => {
|
|
9207
8907
|
if (route === "/") return editorPath;
|
|
9208
8908
|
return `${editorPath}${route}`;
|
|
9209
8909
|
};
|
|
9210
|
-
var DefaultNotFound = () => /* @__PURE__ */
|
|
8910
|
+
var DefaultNotFound = () => /* @__PURE__ */ jsx55(
|
|
9211
8911
|
"div",
|
|
9212
8912
|
{
|
|
9213
8913
|
style: {
|
|
@@ -9217,9 +8917,9 @@ var DefaultNotFound = () => /* @__PURE__ */ jsx57(
|
|
|
9217
8917
|
justifyContent: "center",
|
|
9218
8918
|
alignItems: "center"
|
|
9219
8919
|
},
|
|
9220
|
-
children: /* @__PURE__ */
|
|
9221
|
-
/* @__PURE__ */
|
|
9222
|
-
/* @__PURE__ */
|
|
8920
|
+
children: /* @__PURE__ */ jsxs24("div", { children: [
|
|
8921
|
+
/* @__PURE__ */ jsx55("h1", { children: "404" }),
|
|
8922
|
+
/* @__PURE__ */ jsx55("p", { children: "No page matches this route." })
|
|
9223
8923
|
] })
|
|
9224
8924
|
}
|
|
9225
8925
|
);
|
|
@@ -9230,7 +8930,7 @@ function RenderForKey({
|
|
|
9230
8930
|
const { config, pages } = useApp();
|
|
9231
8931
|
const data = pages[routeKey];
|
|
9232
8932
|
if (!data) return null;
|
|
9233
|
-
return /* @__PURE__ */
|
|
8933
|
+
return /* @__PURE__ */ jsx55(
|
|
9234
8934
|
Render,
|
|
9235
8935
|
{
|
|
9236
8936
|
config,
|
|
@@ -9248,7 +8948,7 @@ function EditorForKey({
|
|
|
9248
8948
|
const { config, pages, routes, navigate } = useApp();
|
|
9249
8949
|
const data = pages[routeKey];
|
|
9250
8950
|
if (!data) return null;
|
|
9251
|
-
return /* @__PURE__ */
|
|
8951
|
+
return /* @__PURE__ */ jsx55(
|
|
9252
8952
|
Editor3,
|
|
9253
8953
|
{
|
|
9254
8954
|
config,
|
|
@@ -9285,12 +8985,12 @@ function AppRender({ metadata, renderNotFound }) {
|
|
|
9285
8985
|
const { pages, isEditing } = useApp();
|
|
9286
8986
|
if (isEditing) return null;
|
|
9287
8987
|
const routeKeys = Object.keys(pages);
|
|
9288
|
-
return /* @__PURE__ */
|
|
9289
|
-
routeKeys.map((routeKey) => /* @__PURE__ */
|
|
8988
|
+
return /* @__PURE__ */ jsxs24(Routes, { children: [
|
|
8989
|
+
routeKeys.map((routeKey) => /* @__PURE__ */ jsx55(
|
|
9290
8990
|
Route,
|
|
9291
8991
|
{
|
|
9292
8992
|
path: routeKey,
|
|
9293
|
-
element: /* @__PURE__ */
|
|
8993
|
+
element: /* @__PURE__ */ jsx55(
|
|
9294
8994
|
RenderForKey,
|
|
9295
8995
|
{
|
|
9296
8996
|
routeKey,
|
|
@@ -9300,11 +9000,11 @@ function AppRender({ metadata, renderNotFound }) {
|
|
|
9300
9000
|
},
|
|
9301
9001
|
`render:${routeKey}`
|
|
9302
9002
|
)),
|
|
9303
|
-
/* @__PURE__ */
|
|
9003
|
+
/* @__PURE__ */ jsx55(
|
|
9304
9004
|
Route,
|
|
9305
9005
|
{
|
|
9306
9006
|
path: "*",
|
|
9307
|
-
element: renderNotFound ? /* @__PURE__ */
|
|
9007
|
+
element: renderNotFound ? /* @__PURE__ */ jsx55(Fragment14, { children: renderNotFound() }) : /* @__PURE__ */ jsx55(DefaultNotFound, {})
|
|
9308
9008
|
}
|
|
9309
9009
|
)
|
|
9310
9010
|
] });
|
|
@@ -9314,12 +9014,12 @@ function AppEditor(props) {
|
|
|
9314
9014
|
const { pages, isEditing, editorPath } = useApp();
|
|
9315
9015
|
if (!isEditing || editorPath === null) return null;
|
|
9316
9016
|
const routeKeys = Object.keys(pages);
|
|
9317
|
-
return /* @__PURE__ */
|
|
9318
|
-
routeKeys.map((routeKey) => /* @__PURE__ */
|
|
9017
|
+
return /* @__PURE__ */ jsxs24(Routes, { children: [
|
|
9018
|
+
routeKeys.map((routeKey) => /* @__PURE__ */ jsx55(
|
|
9319
9019
|
Route,
|
|
9320
9020
|
{
|
|
9321
9021
|
path: joinEditorPath(editorPath, routeKey),
|
|
9322
|
-
element: /* @__PURE__ */
|
|
9022
|
+
element: /* @__PURE__ */ jsx55(
|
|
9323
9023
|
EditorForKey,
|
|
9324
9024
|
{
|
|
9325
9025
|
routeKey,
|
|
@@ -9330,26 +9030,26 @@ function AppEditor(props) {
|
|
|
9330
9030
|
},
|
|
9331
9031
|
`edit:${routeKey}`
|
|
9332
9032
|
)),
|
|
9333
|
-
/* @__PURE__ */
|
|
9033
|
+
/* @__PURE__ */ jsx55(
|
|
9334
9034
|
Route,
|
|
9335
9035
|
{
|
|
9336
9036
|
path: "*",
|
|
9337
|
-
element: renderNotFound ? /* @__PURE__ */
|
|
9037
|
+
element: renderNotFound ? /* @__PURE__ */ jsx55(Fragment14, { children: renderNotFound() }) : /* @__PURE__ */ jsx55(DefaultNotFound, {})
|
|
9338
9038
|
}
|
|
9339
9039
|
)
|
|
9340
9040
|
] });
|
|
9341
9041
|
}
|
|
9342
9042
|
function DefaultAppLayout(props) {
|
|
9343
9043
|
const _a = props, { renderNotFound } = _a, editorProps = __objRest(_a, ["renderNotFound"]);
|
|
9344
|
-
return /* @__PURE__ */
|
|
9345
|
-
/* @__PURE__ */
|
|
9044
|
+
return /* @__PURE__ */ jsxs24(Fragment14, { children: [
|
|
9045
|
+
/* @__PURE__ */ jsx55(
|
|
9346
9046
|
AppRender,
|
|
9347
9047
|
{
|
|
9348
9048
|
metadata: editorProps.metadata,
|
|
9349
9049
|
renderNotFound
|
|
9350
9050
|
}
|
|
9351
9051
|
),
|
|
9352
|
-
/* @__PURE__ */
|
|
9052
|
+
/* @__PURE__ */ jsx55(AppEditor, __spreadProps(__spreadValues({}, editorProps), { renderNotFound }))
|
|
9353
9053
|
] });
|
|
9354
9054
|
}
|
|
9355
9055
|
function App(props) {
|
|
@@ -9368,7 +9068,7 @@ function App(props) {
|
|
|
9368
9068
|
"router",
|
|
9369
9069
|
"children"
|
|
9370
9070
|
]);
|
|
9371
|
-
return /* @__PURE__ */
|
|
9071
|
+
return /* @__PURE__ */ jsx55(
|
|
9372
9072
|
AppProvider,
|
|
9373
9073
|
{
|
|
9374
9074
|
config,
|
|
@@ -9376,7 +9076,7 @@ function App(props) {
|
|
|
9376
9076
|
currentPath,
|
|
9377
9077
|
editorPath,
|
|
9378
9078
|
router,
|
|
9379
|
-
children: children != null ? children : /* @__PURE__ */
|
|
9079
|
+
children: children != null ? children : /* @__PURE__ */ jsx55(DefaultAppLayout, __spreadValues({}, layoutProps))
|
|
9380
9080
|
}
|
|
9381
9081
|
);
|
|
9382
9082
|
}
|
|
@@ -9414,31 +9114,48 @@ function pageMetadata(data) {
|
|
|
9414
9114
|
return out;
|
|
9415
9115
|
}
|
|
9416
9116
|
|
|
9117
|
+
// plugins/blocks/index.tsx
|
|
9118
|
+
init_react_import();
|
|
9119
|
+
|
|
9120
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/blocks/styles.module.css#css-module
|
|
9121
|
+
init_react_import();
|
|
9122
|
+
var styles_module_default28 = { "BlocksPlugin": "_BlocksPlugin_15ud0_1" };
|
|
9123
|
+
|
|
9124
|
+
// plugins/blocks/index.tsx
|
|
9125
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
9126
|
+
var getClassName33 = get_class_name_factory_default("BlocksPlugin", styles_module_default28);
|
|
9127
|
+
var blocksPlugin = () => ({
|
|
9128
|
+
name: "blocks",
|
|
9129
|
+
label: "Blocks",
|
|
9130
|
+
render: () => /* @__PURE__ */ jsx56("div", { className: getClassName33(), children: /* @__PURE__ */ jsx56(Components, {}) }),
|
|
9131
|
+
icon: /* @__PURE__ */ jsx56(Plus, {})
|
|
9132
|
+
});
|
|
9133
|
+
|
|
9417
9134
|
// plugins/outline/index.tsx
|
|
9418
9135
|
init_react_import();
|
|
9419
9136
|
|
|
9420
9137
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/outline/styles.module.css#css-module
|
|
9421
9138
|
init_react_import();
|
|
9422
|
-
var
|
|
9139
|
+
var styles_module_default29 = { "OutlinePlugin": "_OutlinePlugin_q92j6_1" };
|
|
9423
9140
|
|
|
9424
9141
|
// plugins/outline/index.tsx
|
|
9425
|
-
import { jsx as
|
|
9426
|
-
var
|
|
9142
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
9143
|
+
var getClassName34 = get_class_name_factory_default("OutlinePlugin", styles_module_default29);
|
|
9427
9144
|
var outlinePlugin = () => ({
|
|
9428
9145
|
name: "outline",
|
|
9429
9146
|
label: "Outline",
|
|
9430
|
-
render: () => /* @__PURE__ */
|
|
9431
|
-
icon: /* @__PURE__ */
|
|
9147
|
+
render: () => /* @__PURE__ */ jsx57("div", { className: getClassName34(), children: /* @__PURE__ */ jsx57(Outline, {}) }),
|
|
9148
|
+
icon: /* @__PURE__ */ jsx57(Layers, {})
|
|
9432
9149
|
});
|
|
9433
9150
|
|
|
9434
9151
|
// plugins/legacy-side-bar/index.tsx
|
|
9435
9152
|
init_react_import();
|
|
9436
|
-
import { jsx as
|
|
9153
|
+
import { jsx as jsx58, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
9437
9154
|
var legacySideBarPlugin = () => ({
|
|
9438
9155
|
name: "legacy-side-bar",
|
|
9439
|
-
render: () => /* @__PURE__ */
|
|
9440
|
-
/* @__PURE__ */
|
|
9441
|
-
/* @__PURE__ */
|
|
9156
|
+
render: () => /* @__PURE__ */ jsxs25("div", { style: { overflowY: "auto" }, children: [
|
|
9157
|
+
/* @__PURE__ */ jsx58(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx58(Components, {}) }),
|
|
9158
|
+
/* @__PURE__ */ jsx58(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx58(Outline, {}) })
|
|
9442
9159
|
] })
|
|
9443
9160
|
});
|
|
9444
9161
|
|
|
@@ -9498,7 +9215,6 @@ export {
|
|
|
9498
9215
|
createUseEditor,
|
|
9499
9216
|
useEditor,
|
|
9500
9217
|
useGetEditor,
|
|
9501
|
-
blocksPlugin,
|
|
9502
9218
|
fieldsPlugin,
|
|
9503
9219
|
usePropsContext,
|
|
9504
9220
|
Editor3 as Editor,
|
|
@@ -9509,6 +9225,7 @@ export {
|
|
|
9509
9225
|
App,
|
|
9510
9226
|
useRouteParams,
|
|
9511
9227
|
pageMetadata,
|
|
9228
|
+
blocksPlugin,
|
|
9512
9229
|
outlinePlugin,
|
|
9513
9230
|
legacySideBarPlugin
|
|
9514
9231
|
};
|