@reacteditor/core 0.0.13 → 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-3COFH5WN.mjs → Editor-7UIJWCPN.mjs} +7 -7
- package/dist/{actions-DDpLL_TR.d.mts → actions-BxLinRKD.d.mts} +5 -0
- package/dist/{actions-DDpLL_TR.d.ts → actions-BxLinRKD.d.ts} +5 -0
- package/dist/{chunk-PUDWMFBH.mjs → chunk-3CGBQNX4.mjs} +1 -1
- package/dist/{chunk-BZ4BQZJR.mjs → chunk-647NZJYM.mjs} +3 -3
- package/dist/{chunk-FT6UFK7G.mjs → chunk-C2KWANIN.mjs} +1 -1
- package/dist/{chunk-AD7BMXAA.mjs → chunk-GIGXMGTZ.mjs} +1 -1
- package/dist/{chunk-OIFPBVSF.mjs → chunk-NKHR722W.mjs} +1 -1
- package/dist/{chunk-IIRJMJFU.mjs → chunk-NPC7A3V3.mjs} +4 -13
- package/dist/{chunk-KX5XDJF6.mjs → chunk-RAMNEU3M.mjs} +1044 -1323
- package/dist/{chunk-LRFRIIKG.mjs → chunk-T43H325W.mjs} +21 -122
- package/dist/{chunk-BUR5T7IX.mjs → chunk-TFAZFGYZ.mjs} +7 -7
- package/dist/{full-QT5KXRDP.mjs → full-PM3VSLYA.mjs} +6 -6
- package/dist/{index-BTatdZaE.d.mts → index-BZRpxcwy.d.mts} +1 -1
- package/dist/{index-zhUFD8aP.d.ts → index-B_21fGrq.d.ts} +1 -1
- package/dist/index.css +411 -517
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +846 -1247
- package/dist/index.mjs +9 -9
- package/dist/internal.d.mts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/{loaded-O4QHGE26.mjs → loaded-5MUU76TF.mjs} +3 -3
- package/dist/{loaded-R34BR6I5.mjs → loaded-IIHO4UZS.mjs} +3 -3
- package/dist/{loaded-GLBLMTBL.mjs → loaded-ULJY3YN5.mjs} +3 -3
- package/dist/no-external.css +411 -517
- package/dist/no-external.d.mts +3 -3
- package/dist/no-external.d.ts +3 -3
- package/dist/no-external.js +846 -1247
- package/dist/no-external.mjs +9 -9
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +4 -14
- package/dist/rsc.mjs +2 -2
- package/dist/{walk-tree-Cxbt1UVr.d.mts → walk-tree-BvYigWFL.d.mts} +1 -1
- package/dist/{walk-tree-Cnyva5MB.d.ts → walk-tree-Clklc1Ql.d.ts} +1 -1
- 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-IIRJMJFU.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,323 +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_x10eb_1", "BrowserBar-urlTrigger": "_BrowserBar-urlTrigger_x10eb_16", "BrowserBar-urlIcon": "_BrowserBar-urlIcon_x10eb_46", "BrowserBar-urlText": "_BrowserBar-urlText_x10eb_51", "BrowserBar-urlInput": "_BrowserBar-urlInput_x10eb_63", "BrowserBar-itemPath": "_BrowserBar-itemPath_x10eb_69", "BrowserBar-itemTitle": "_BrowserBar-itemTitle_x10eb_74", "BrowserBar-actions": "_BrowserBar-actions_x10eb_82", "BrowserBar-deviceIcon": "_BrowserBar-deviceIcon_x10eb_89" };
|
|
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" }
|
|
7635
|
-
};
|
|
7636
|
-
var BrowserBar = ({
|
|
7637
|
-
onViewportChange
|
|
7638
|
-
}) => {
|
|
7639
|
-
const { routes, currentRoute, onRouteChange } = usePropsContext();
|
|
7640
|
-
const chrome = useChromeConfig();
|
|
7641
|
-
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
7642
|
-
const dispatch = useAppStore((s) => s.dispatch);
|
|
7643
|
-
const leftSideBarVisible = useAppStore((s) => s.state.ui.leftSideBarVisible);
|
|
7644
|
-
const rightSideBarVisible = useAppStore(
|
|
7645
|
-
(s) => s.state.ui.rightSideBarVisible
|
|
7646
|
-
);
|
|
7647
|
-
const isFullScreen = !leftSideBarVisible && !rightSideBarVisible;
|
|
7648
|
-
const toggleFullScreen = () => {
|
|
7649
|
-
const next = !isFullScreen;
|
|
7650
|
-
dispatch({
|
|
7651
|
-
type: "setUi",
|
|
7652
|
-
ui: {
|
|
7653
|
-
leftSideBarVisible: !next,
|
|
7654
|
-
rightSideBarVisible: !next
|
|
7655
|
-
}
|
|
7656
|
-
});
|
|
7657
|
-
};
|
|
7658
|
-
const activeDevice = useMemo20(() => {
|
|
7659
|
-
const w = viewports.current.width;
|
|
7660
|
-
if (typeof w === "number" && w <= 640) return "mobile";
|
|
7661
|
-
return "desktop";
|
|
7662
|
-
}, [viewports.current.width]);
|
|
7663
|
-
const setDevice = (device) => {
|
|
7664
|
-
onViewportChange == null ? void 0 : onViewportChange(DEVICE_VIEWPORTS[device]);
|
|
7665
|
-
};
|
|
7666
|
-
const showRoutePicker = !!routes && currentRoute !== void 0 && !!onRouteChange;
|
|
7667
|
-
const [inputValue, setInputValue] = useState20(currentRoute != null ? currentRoute : "");
|
|
7668
|
-
const lastSyncedPath = useRef13(currentRoute);
|
|
7669
|
-
if (lastSyncedPath.current !== currentRoute) {
|
|
7670
|
-
lastSyncedPath.current = currentRoute;
|
|
7671
|
-
setInputValue(currentRoute != null ? currentRoute : "");
|
|
7672
|
-
}
|
|
7673
|
-
const submit = (raw) => {
|
|
7674
|
-
const next = normalizeRoute(raw);
|
|
7675
|
-
if (!next || next === currentRoute) return;
|
|
7676
|
-
void (onRouteChange == null ? void 0 : onRouteChange(next));
|
|
7677
|
-
};
|
|
7678
|
-
if (!chrome.showUrlBar && !chrome.showDeviceToggle && !chrome.showFullScreenToggle) {
|
|
7679
|
-
return null;
|
|
7680
|
-
}
|
|
7681
|
-
return /* @__PURE__ */ jsxs20("div", { className: getClassName29(), children: [
|
|
7682
|
-
chrome.showUrlBar && (showRoutePicker ? /* @__PURE__ */ jsxs20(
|
|
7683
|
-
Combobox,
|
|
7684
|
-
{
|
|
7685
|
-
items: routes,
|
|
7686
|
-
value: currentRoute,
|
|
7687
|
-
onValueChange: (next) => {
|
|
7688
|
-
if (typeof next === "string") submit(next);
|
|
7689
|
-
},
|
|
7690
|
-
inputValue,
|
|
7691
|
-
onInputValueChange: (next) => setInputValue(next),
|
|
7692
|
-
autoHighlight: false,
|
|
7693
|
-
children: [
|
|
7694
|
-
/* @__PURE__ */ jsxs20(
|
|
7695
|
-
"form",
|
|
7696
|
-
{
|
|
7697
|
-
className: getClassName29("urlTrigger"),
|
|
7698
|
-
onSubmit: (event) => {
|
|
7699
|
-
event.preventDefault();
|
|
7700
|
-
submit(inputValue);
|
|
7701
|
-
},
|
|
7702
|
-
children: [
|
|
7703
|
-
/* @__PURE__ */ jsx48(Globe, { className: getClassName29("urlIcon"), size: 14 }),
|
|
7704
|
-
/* @__PURE__ */ jsx48(
|
|
7705
|
-
ComboboxInput,
|
|
7706
|
-
{
|
|
7707
|
-
className: getClassName29("urlInput"),
|
|
7708
|
-
placeholder: "/",
|
|
7709
|
-
spellCheck: false,
|
|
7710
|
-
autoCorrect: "off",
|
|
7711
|
-
autoCapitalize: "off"
|
|
7712
|
-
}
|
|
7713
|
-
)
|
|
7714
|
-
]
|
|
7715
|
-
}
|
|
7716
|
-
),
|
|
7717
|
-
/* @__PURE__ */ jsxs20(ComboboxContent, { children: [
|
|
7718
|
-
/* @__PURE__ */ jsx48(ComboboxEmpty, { children: "Press Enter to go to this path" }),
|
|
7719
|
-
/* @__PURE__ */ jsx48(ComboboxList, { children: (path) => /* @__PURE__ */ jsx48(ComboboxItem, { value: path, children: /* @__PURE__ */ jsx48("span", { className: getClassName29("itemPath"), children: path }) }, path) })
|
|
7720
|
-
] })
|
|
7721
|
-
]
|
|
7722
|
-
}
|
|
7723
|
-
) : /* @__PURE__ */ jsxs20("div", { className: getClassName29("urlTrigger"), children: [
|
|
7724
|
-
/* @__PURE__ */ jsx48(Globe, { className: getClassName29("urlIcon"), size: 14 }),
|
|
7725
|
-
/* @__PURE__ */ jsx48("span", { className: getClassName29("urlText"), children: "/" })
|
|
7726
|
-
] })),
|
|
7727
|
-
(chrome.showDeviceToggle || chrome.showFullScreenToggle) && /* @__PURE__ */ jsxs20("div", { className: getClassName29("actions"), children: [
|
|
7728
|
-
chrome.showDeviceToggle && /* @__PURE__ */ jsx48(
|
|
7729
|
-
IconButton,
|
|
7730
|
-
{
|
|
7731
|
-
type: "button",
|
|
7732
|
-
title: activeDevice === "desktop" ? "Switch to mobile viewport" : "Switch to desktop viewport",
|
|
7733
|
-
onClick: () => setDevice(activeDevice === "desktop" ? "mobile" : "desktop"),
|
|
7734
|
-
children: /* @__PURE__ */ jsx48("span", { className: getClassName29("deviceIcon"), children: activeDevice === "desktop" ? /* @__PURE__ */ jsx48(Monitor, { size: 16 }) : /* @__PURE__ */ jsx48(Smartphone, { size: 16 }) })
|
|
7735
|
-
}
|
|
7736
|
-
),
|
|
7737
|
-
chrome.showFullScreenToggle && /* @__PURE__ */ jsx48(
|
|
7738
|
-
IconButton,
|
|
7739
|
-
{
|
|
7740
|
-
type: "button",
|
|
7741
|
-
title: isFullScreen ? "Exit full screen" : "Enter full screen",
|
|
7742
|
-
onClick: toggleFullScreen,
|
|
7743
|
-
children: /* @__PURE__ */ jsx48("span", { className: getClassName29("deviceIcon"), children: isFullScreen ? /* @__PURE__ */ jsx48(Minimize, { size: 16 }) : /* @__PURE__ */ jsx48(Maximize, { size: 16 }) })
|
|
7744
|
-
}
|
|
7745
|
-
)
|
|
7746
|
-
] })
|
|
7747
|
-
] });
|
|
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 })
|
|
7748
7587
|
};
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
init_react_import();
|
|
7759
|
-
import {
|
|
7760
|
-
createContext as createContext7,
|
|
7761
|
-
useContext as useContext14,
|
|
7762
|
-
useRef as useRef14,
|
|
7763
|
-
useMemo as useMemo21
|
|
7764
|
-
} from "react";
|
|
7765
|
-
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
7766
|
-
var FrameContext = createContext7(null);
|
|
7767
|
-
var FrameProvider = ({
|
|
7768
|
-
children
|
|
7769
|
-
}) => {
|
|
7770
|
-
const frameRef = useRef14(null);
|
|
7771
|
-
const value = useMemo21(
|
|
7772
|
-
() => ({
|
|
7773
|
-
frameRef
|
|
7774
|
-
}),
|
|
7775
|
-
[]
|
|
7776
|
-
);
|
|
7777
|
-
return /* @__PURE__ */ jsx49(FrameContext.Provider, { value, children });
|
|
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 }));
|
|
7594
|
+
}
|
|
7595
|
+
});
|
|
7596
|
+
return null;
|
|
7778
7597
|
};
|
|
7779
|
-
var
|
|
7780
|
-
const
|
|
7781
|
-
|
|
7782
|
-
throw new Error("useCanvasFrame must be used within a FrameProvider");
|
|
7783
|
-
}
|
|
7784
|
-
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)}%` });
|
|
7785
7601
|
};
|
|
7786
|
-
|
|
7787
|
-
// components/Editor/components/Canvas/index.tsx
|
|
7788
|
-
import { Fragment as Fragment13, jsx as jsx50, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7789
|
-
var getClassName30 = get_class_name_factory_default("EditorCanvas", styles_module_default26);
|
|
7790
|
-
var ZOOM_STEP = 0.15;
|
|
7791
|
-
var MIN_ZOOM = 0.25;
|
|
7792
|
-
var MAX_ZOOM = 3;
|
|
7793
|
-
var TRANSITION_DURATION = 150;
|
|
7794
7602
|
var Canvas = () => {
|
|
7795
|
-
var _a, _b;
|
|
7796
7603
|
const { frameRef } = useCanvasFrame();
|
|
7797
|
-
const {
|
|
7798
|
-
viewports: viewportOptions = defaultViewports,
|
|
7799
|
-
ui: uiProp,
|
|
7800
|
-
disableZoomControls
|
|
7801
|
-
} = usePropsContext();
|
|
7604
|
+
const { disableZoomControls } = usePropsContext();
|
|
7802
7605
|
const {
|
|
7803
7606
|
dispatch,
|
|
7804
7607
|
overrides,
|
|
7805
7608
|
setUi,
|
|
7806
|
-
zoomConfig,
|
|
7807
|
-
setZoomConfig,
|
|
7808
7609
|
status,
|
|
7809
7610
|
iframe,
|
|
7810
7611
|
fullScreenCanvas
|
|
@@ -7813,150 +7614,215 @@ var Canvas = () => {
|
|
|
7813
7614
|
dispatch: s.dispatch,
|
|
7814
7615
|
overrides: s.overrides,
|
|
7815
7616
|
setUi: s.setUi,
|
|
7816
|
-
zoomConfig: s.zoomConfig,
|
|
7817
|
-
setZoomConfig: s.setZoomConfig,
|
|
7818
7617
|
status: s.status,
|
|
7819
7618
|
iframe: s.iframe,
|
|
7820
7619
|
fullScreenCanvas: s.fullScreenCanvas
|
|
7821
7620
|
}))
|
|
7822
7621
|
);
|
|
7823
7622
|
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
7824
|
-
const
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
const
|
|
7831
|
-
|
|
7623
|
+
const canvasFullScreen = useAppStore(
|
|
7624
|
+
(s) => {
|
|
7625
|
+
var _a;
|
|
7626
|
+
return (_a = s.state.ui.canvasFullScreen) != null ? _a : false;
|
|
7627
|
+
}
|
|
7628
|
+
);
|
|
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 });
|
|
7832
7654
|
return EditorDefault;
|
|
7833
7655
|
}, []);
|
|
7834
|
-
const CustomPreview =
|
|
7656
|
+
const CustomPreview = useMemo21(
|
|
7835
7657
|
() => overrides.preview || defaultRender,
|
|
7836
7658
|
[overrides]
|
|
7837
7659
|
);
|
|
7838
|
-
const
|
|
7839
|
-
if (frameRef.current) {
|
|
7840
|
-
const frame = frameRef.current;
|
|
7841
|
-
const box = getBox(frame);
|
|
7842
|
-
return { width: box.contentBox.width, height: box.contentBox.height };
|
|
7843
|
-
}
|
|
7844
|
-
return { width: 0, height: 0 };
|
|
7845
|
-
}, [frameRef]);
|
|
7846
|
-
useEffect23(() => {
|
|
7847
|
-
const { height: frameHeight } = getFrameDimensions();
|
|
7848
|
-
if (viewports.current.height === "auto") {
|
|
7849
|
-
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom: 1, rootHeight: frameHeight }));
|
|
7850
|
-
}
|
|
7851
|
-
}, [getFrameDimensions, setZoomConfig, viewports.current.height]);
|
|
7852
|
-
const [showLoader, setShowLoader] = useState21(false);
|
|
7660
|
+
const [showLoader, setShowLoader] = useState20(false);
|
|
7853
7661
|
useEffect23(() => {
|
|
7854
7662
|
setTimeout(() => {
|
|
7855
7663
|
setShowLoader(true);
|
|
7856
7664
|
}, 500);
|
|
7857
7665
|
}, []);
|
|
7858
|
-
const
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
value
|
|
7877
|
-
})).sort((a, b) => a.diff > b.diff ? 1 : -1);
|
|
7878
|
-
let closestViewport = (_b2 = viewportDifferences[0]) == null ? void 0 : _b2.value;
|
|
7879
|
-
if (!closestViewport) return null;
|
|
7880
|
-
if (closestViewport.width < frameWidth && fullWidthViewport) {
|
|
7881
|
-
closestViewport = fullWidthViewport;
|
|
7882
|
-
}
|
|
7883
|
-
return closestViewport;
|
|
7884
|
-
}, [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
|
+
}, []);
|
|
7885
7684
|
useEffect23(() => {
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
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
|
+
}
|
|
7891
7766
|
if (iframe.enabled) {
|
|
7892
|
-
const
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
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;
|
|
7904
7782
|
};
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7783
|
+
if (!tryAttach()) {
|
|
7784
|
+
const interval = window.setInterval(() => {
|
|
7785
|
+
if (tryAttach()) window.clearInterval(interval);
|
|
7786
|
+
}, 100);
|
|
7787
|
+
cleanups.push(() => window.clearInterval(interval));
|
|
7908
7788
|
}
|
|
7909
|
-
appStoreApi.setState(__spreadProps(__spreadValues({}, appState), { history }));
|
|
7910
7789
|
}
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
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
|
-
observer.observe(target);
|
|
7944
|
-
return () => observer.disconnect();
|
|
7945
|
-
}, [
|
|
7946
|
-
pickClosestViewport,
|
|
7947
|
-
frameRef,
|
|
7948
|
-
iframe.enabled,
|
|
7949
|
-
(_b = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _b.current,
|
|
7950
|
-
appStoreApi,
|
|
7951
|
-
setUi
|
|
7952
|
-
]);
|
|
7953
|
-
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(
|
|
7954
7819
|
"div",
|
|
7955
7820
|
{
|
|
7956
|
-
className:
|
|
7821
|
+
className: getClassName27({
|
|
7957
7822
|
ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
|
|
7958
7823
|
showLoader,
|
|
7959
|
-
fullScreen: fullScreenCanvas
|
|
7824
|
+
fullScreen: fullScreenCanvas,
|
|
7825
|
+
canvasFullScreen
|
|
7960
7826
|
}),
|
|
7961
7827
|
onClick: (e) => {
|
|
7962
7828
|
const el = e.target;
|
|
@@ -7968,260 +7834,119 @@ var Canvas = () => {
|
|
|
7968
7834
|
});
|
|
7969
7835
|
}
|
|
7970
7836
|
},
|
|
7971
|
-
children: /* @__PURE__ */
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
/* @__PURE__ */ jsx50(IconButton, { type: "button", title: "Reset zoom", onClick: resetZoom, children: /* @__PURE__ */ jsx50(RotateCcw, { size: 14 }) }),
|
|
7975
|
-
/* @__PURE__ */ jsx50(IconButton, { type: "button", title: "Zoom in", onClick: zoomIn, children: /* @__PURE__ */ jsx50(Plus, { size: 14 }) })
|
|
7976
|
-
] }),
|
|
7977
|
-
/* @__PURE__ */ jsxs21(
|
|
7978
|
-
"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,
|
|
7979
7840
|
{
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
},
|
|
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 },
|
|
7987
7853
|
children: [
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
{
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
}
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
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]
|
|
8002
7875
|
}
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
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,
|
|
8007
7918
|
{
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
onTransitionEnd: () => {
|
|
8012
|
-
setShowTransition(false);
|
|
8013
|
-
isResizingRef.current = false;
|
|
8014
|
-
},
|
|
8015
|
-
children: /* @__PURE__ */ jsx50(CustomPreview, { children: /* @__PURE__ */ jsx50(Preview2, {}) })
|
|
7919
|
+
infinite: true,
|
|
7920
|
+
wrapperStyle: { width: "100%", height: "100%" },
|
|
7921
|
+
children: frameContents
|
|
8016
7922
|
}
|
|
8017
7923
|
)
|
|
8018
7924
|
]
|
|
8019
7925
|
}
|
|
8020
|
-
),
|
|
8021
|
-
/* @__PURE__ */
|
|
7926
|
+
) }),
|
|
7927
|
+
/* @__PURE__ */ jsx47("div", { className: getClassName27("loader"), children: /* @__PURE__ */ jsx47(Loader, { size: 24 }) })
|
|
8022
7928
|
] })
|
|
8023
7929
|
}
|
|
8024
7930
|
);
|
|
8025
7931
|
};
|
|
8026
7932
|
|
|
8027
|
-
// lib/use-sidebar-resize.ts
|
|
8028
|
-
init_react_import();
|
|
8029
|
-
import { useCallback as useCallback20, useEffect as useEffect24, useRef as useRef16, useState as useState22 } from "react";
|
|
8030
|
-
function useSidebarResize(position, dispatch) {
|
|
8031
|
-
const [width, setWidth] = useState22(null);
|
|
8032
|
-
const sidebarRef = useRef16(null);
|
|
8033
|
-
const storeWidth = useAppStore(
|
|
8034
|
-
(s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
|
|
8035
|
-
);
|
|
8036
|
-
useEffect24(() => {
|
|
8037
|
-
if (typeof window !== "undefined" && !storeWidth) {
|
|
8038
|
-
try {
|
|
8039
|
-
const savedWidths = localStorage.getItem("editor-sidebar-widths");
|
|
8040
|
-
if (savedWidths) {
|
|
8041
|
-
const widths = JSON.parse(savedWidths);
|
|
8042
|
-
const savedWidth = widths[position];
|
|
8043
|
-
const key = position === "left" ? "leftSideBarWidth" : "rightSideBarWidth";
|
|
8044
|
-
if (savedWidth) {
|
|
8045
|
-
dispatch({
|
|
8046
|
-
type: "setUi",
|
|
8047
|
-
ui: {
|
|
8048
|
-
[key]: savedWidth
|
|
8049
|
-
}
|
|
8050
|
-
});
|
|
8051
|
-
}
|
|
8052
|
-
}
|
|
8053
|
-
} catch (error) {
|
|
8054
|
-
console.error(
|
|
8055
|
-
`Failed to load ${position} sidebar width from localStorage`,
|
|
8056
|
-
error
|
|
8057
|
-
);
|
|
8058
|
-
}
|
|
8059
|
-
}
|
|
8060
|
-
}, [dispatch, position, storeWidth]);
|
|
8061
|
-
useEffect24(() => {
|
|
8062
|
-
if (storeWidth !== void 0) {
|
|
8063
|
-
setWidth(storeWidth);
|
|
8064
|
-
}
|
|
8065
|
-
}, [storeWidth]);
|
|
8066
|
-
const handleResizeEnd = useCallback20(
|
|
8067
|
-
(width2) => {
|
|
8068
|
-
dispatch({
|
|
8069
|
-
type: "setUi",
|
|
8070
|
-
ui: {
|
|
8071
|
-
[position === "left" ? "leftSideBarWidth" : "rightSideBarWidth"]: width2
|
|
8072
|
-
}
|
|
8073
|
-
});
|
|
8074
|
-
let widths = {};
|
|
8075
|
-
try {
|
|
8076
|
-
const savedWidths = localStorage.getItem("editor-sidebar-widths");
|
|
8077
|
-
widths = savedWidths ? JSON.parse(savedWidths) : {};
|
|
8078
|
-
} catch (error) {
|
|
8079
|
-
console.error(
|
|
8080
|
-
`Failed to save ${position} sidebar width to localStorage`,
|
|
8081
|
-
error
|
|
8082
|
-
);
|
|
8083
|
-
} finally {
|
|
8084
|
-
localStorage.setItem(
|
|
8085
|
-
"editor-sidebar-widths",
|
|
8086
|
-
JSON.stringify(__spreadProps(__spreadValues({}, widths), {
|
|
8087
|
-
[position]: width2
|
|
8088
|
-
}))
|
|
8089
|
-
);
|
|
8090
|
-
}
|
|
8091
|
-
window.dispatchEvent(
|
|
8092
|
-
new CustomEvent("viewportchange", {
|
|
8093
|
-
bubbles: true,
|
|
8094
|
-
cancelable: false
|
|
8095
|
-
})
|
|
8096
|
-
);
|
|
8097
|
-
},
|
|
8098
|
-
[dispatch, position]
|
|
8099
|
-
);
|
|
8100
|
-
return {
|
|
8101
|
-
width,
|
|
8102
|
-
setWidth,
|
|
8103
|
-
sidebarRef,
|
|
8104
|
-
handleResizeEnd
|
|
8105
|
-
};
|
|
8106
|
-
}
|
|
8107
|
-
|
|
8108
7933
|
// components/Editor/components/Sidebar/index.tsx
|
|
8109
7934
|
init_react_import();
|
|
8110
7935
|
|
|
8111
|
-
// components/Editor/components/ResizeHandle/index.tsx
|
|
8112
|
-
init_react_import();
|
|
8113
|
-
import { useCallback as useCallback21, useRef as useRef17 } from "react";
|
|
8114
|
-
|
|
8115
|
-
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/ResizeHandle/styles.module.css#css-module
|
|
8116
|
-
init_react_import();
|
|
8117
|
-
var styles_module_default27 = { "ResizeHandle": "_ResizeHandle_1u3rv_2", "ResizeHandle--left": "_ResizeHandle--left_1u3rv_16", "ResizeHandle--right": "_ResizeHandle--right_1u3rv_20" };
|
|
8118
|
-
|
|
8119
|
-
// components/Editor/components/ResizeHandle/index.tsx
|
|
8120
|
-
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
8121
|
-
var getClassName31 = get_class_name_factory_default("ResizeHandle", styles_module_default27);
|
|
8122
|
-
var ResizeHandle = ({
|
|
8123
|
-
position,
|
|
8124
|
-
sidebarRef,
|
|
8125
|
-
onResize,
|
|
8126
|
-
onResizeEnd
|
|
8127
|
-
}) => {
|
|
8128
|
-
const handleRef = useRef17(null);
|
|
8129
|
-
const isDragging = useRef17(false);
|
|
8130
|
-
const startX = useRef17(0);
|
|
8131
|
-
const startWidth = useRef17(0);
|
|
8132
|
-
const handleMouseMove = useCallback21(
|
|
8133
|
-
(e) => {
|
|
8134
|
-
if (!isDragging.current) return;
|
|
8135
|
-
const delta = e.clientX - startX.current;
|
|
8136
|
-
const newWidth = position === "left" ? startWidth.current + delta : startWidth.current - delta;
|
|
8137
|
-
const width = Math.max(192, newWidth);
|
|
8138
|
-
onResize(width);
|
|
8139
|
-
e.preventDefault();
|
|
8140
|
-
},
|
|
8141
|
-
[onResize, position]
|
|
8142
|
-
);
|
|
8143
|
-
const handleMouseUp = useCallback21(() => {
|
|
8144
|
-
var _a;
|
|
8145
|
-
if (!isDragging.current) return;
|
|
8146
|
-
isDragging.current = false;
|
|
8147
|
-
document.body.style.cursor = "";
|
|
8148
|
-
document.body.style.userSelect = "";
|
|
8149
|
-
const overlay = document.getElementById("resize-overlay");
|
|
8150
|
-
if (overlay) {
|
|
8151
|
-
document.body.removeChild(overlay);
|
|
8152
|
-
}
|
|
8153
|
-
document.removeEventListener("mousemove", handleMouseMove);
|
|
8154
|
-
document.removeEventListener("mouseup", handleMouseUp);
|
|
8155
|
-
const finalWidth = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
|
|
8156
|
-
onResizeEnd(finalWidth);
|
|
8157
|
-
}, [onResizeEnd]);
|
|
8158
|
-
const handleMouseDown = useCallback21(
|
|
8159
|
-
(e) => {
|
|
8160
|
-
var _a;
|
|
8161
|
-
isDragging.current = true;
|
|
8162
|
-
startX.current = e.clientX;
|
|
8163
|
-
startWidth.current = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
|
|
8164
|
-
document.body.style.cursor = "col-resize";
|
|
8165
|
-
document.body.style.userSelect = "none";
|
|
8166
|
-
const overlay = document.createElement("div");
|
|
8167
|
-
overlay.id = "resize-overlay";
|
|
8168
|
-
overlay.setAttribute("data-resize-overlay", "");
|
|
8169
|
-
document.body.appendChild(overlay);
|
|
8170
|
-
document.addEventListener("mousemove", handleMouseMove);
|
|
8171
|
-
document.addEventListener("mouseup", handleMouseUp);
|
|
8172
|
-
e.preventDefault();
|
|
8173
|
-
},
|
|
8174
|
-
[position, handleMouseMove, handleMouseUp]
|
|
8175
|
-
);
|
|
8176
|
-
return /* @__PURE__ */ jsx51(
|
|
8177
|
-
"div",
|
|
8178
|
-
{
|
|
8179
|
-
ref: handleRef,
|
|
8180
|
-
className: getClassName31({ [position]: true }),
|
|
8181
|
-
onMouseDown: handleMouseDown
|
|
8182
|
-
}
|
|
8183
|
-
);
|
|
8184
|
-
};
|
|
8185
|
-
|
|
8186
7936
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Sidebar/styles.module.css#css-module
|
|
8187
7937
|
init_react_import();
|
|
8188
|
-
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" };
|
|
8189
7939
|
|
|
8190
7940
|
// components/Editor/components/Sidebar/index.tsx
|
|
8191
|
-
import {
|
|
8192
|
-
var
|
|
8193
|
-
var Sidebar = ({
|
|
8194
|
-
position,
|
|
8195
|
-
sidebarRef,
|
|
8196
|
-
isVisible,
|
|
8197
|
-
onResize,
|
|
8198
|
-
onResizeEnd,
|
|
8199
|
-
children
|
|
8200
|
-
}) => {
|
|
8201
|
-
return /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
8202
|
-
/* @__PURE__ */ jsx52(
|
|
8203
|
-
"div",
|
|
8204
|
-
{
|
|
8205
|
-
ref: sidebarRef,
|
|
8206
|
-
className: getClassName32({ [position]: true, isVisible }),
|
|
8207
|
-
children
|
|
8208
|
-
}
|
|
8209
|
-
),
|
|
8210
|
-
/* @__PURE__ */ jsx52("div", { className: `${getClassName32("resizeHandle")}`, children: /* @__PURE__ */ jsx52(
|
|
8211
|
-
ResizeHandle,
|
|
8212
|
-
{
|
|
8213
|
-
position,
|
|
8214
|
-
sidebarRef,
|
|
8215
|
-
onResize,
|
|
8216
|
-
onResizeEnd
|
|
8217
|
-
}
|
|
8218
|
-
) })
|
|
8219
|
-
] });
|
|
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 }) });
|
|
8220
7945
|
};
|
|
8221
7946
|
|
|
8222
7947
|
// lib/use-delete-hotkeys.ts
|
|
8223
7948
|
init_react_import();
|
|
8224
|
-
import { useCallback as
|
|
7949
|
+
import { useCallback as useCallback20 } from "react";
|
|
8225
7950
|
|
|
8226
7951
|
// lib/should-block-editing-hotkey.ts
|
|
8227
7952
|
init_react_import();
|
|
@@ -8261,7 +7986,7 @@ var shouldBlockEditingHotkey = (e) => {
|
|
|
8261
7986
|
// lib/use-delete-hotkeys.ts
|
|
8262
7987
|
var useDeleteHotkeys = () => {
|
|
8263
7988
|
const appStore = useAppStoreApi();
|
|
8264
|
-
const deleteSelectedComponent =
|
|
7989
|
+
const deleteSelectedComponent = useCallback20(
|
|
8265
7990
|
(e) => {
|
|
8266
7991
|
var _a;
|
|
8267
7992
|
if (shouldBlockEditingHotkey(e)) {
|
|
@@ -8287,7 +8012,7 @@ var useDeleteHotkeys = () => {
|
|
|
8287
8012
|
|
|
8288
8013
|
// lib/use-clipboard-hotkeys.ts
|
|
8289
8014
|
init_react_import();
|
|
8290
|
-
import { useCallback as
|
|
8015
|
+
import { useCallback as useCallback21 } from "react";
|
|
8291
8016
|
var CLIPBOARD_MARKER = "reacteditor/component";
|
|
8292
8017
|
var isComponentData = (value) => {
|
|
8293
8018
|
var _a;
|
|
@@ -8307,7 +8032,7 @@ var parsePayload = (text) => {
|
|
|
8307
8032
|
};
|
|
8308
8033
|
var useClipboardHotkeys = () => {
|
|
8309
8034
|
const appStore = useAppStoreApi();
|
|
8310
|
-
const writeSelectionToClipboard =
|
|
8035
|
+
const writeSelectionToClipboard = useCallback21(() => {
|
|
8311
8036
|
var _a;
|
|
8312
8037
|
const { selectedItem } = appStore.getState();
|
|
8313
8038
|
if (!selectedItem) return false;
|
|
@@ -8319,14 +8044,14 @@ var useClipboardHotkeys = () => {
|
|
|
8319
8044
|
});
|
|
8320
8045
|
return true;
|
|
8321
8046
|
}, [appStore]);
|
|
8322
|
-
const copySelectedComponent =
|
|
8047
|
+
const copySelectedComponent = useCallback21(
|
|
8323
8048
|
(e) => {
|
|
8324
8049
|
if (shouldBlockEditingHotkey(e)) return false;
|
|
8325
8050
|
return writeSelectionToClipboard();
|
|
8326
8051
|
},
|
|
8327
8052
|
[writeSelectionToClipboard]
|
|
8328
8053
|
);
|
|
8329
|
-
const cutSelectedComponent =
|
|
8054
|
+
const cutSelectedComponent = useCallback21(
|
|
8330
8055
|
(e) => {
|
|
8331
8056
|
var _a;
|
|
8332
8057
|
if (shouldBlockEditingHotkey(e)) return false;
|
|
@@ -8345,143 +8070,322 @@ var useClipboardHotkeys = () => {
|
|
|
8345
8070
|
},
|
|
8346
8071
|
[appStore, writeSelectionToClipboard]
|
|
8347
8072
|
);
|
|
8348
|
-
const pasteComponent =
|
|
8349
|
-
(e) => {
|
|
8350
|
-
var _a, _b;
|
|
8351
|
-
if (shouldBlockEditingHotkey(e)) return false;
|
|
8352
|
-
const { state, dispatch, config } = appStore.getState();
|
|
8353
|
-
const sel = (_a = state.ui) == null ? void 0 : _a.itemSelector;
|
|
8354
|
-
if (!(sel == null ? void 0 : sel.zone)) return false;
|
|
8355
|
-
(_b = navigator.clipboard) == null ? void 0 : _b.readText().then((text) => {
|
|
8356
|
-
const data = parsePayload(text);
|
|
8357
|
-
if (!data) return;
|
|
8358
|
-
if (!config.components[data.type]) return;
|
|
8359
|
-
dispatch({
|
|
8360
|
-
type: "insert",
|
|
8361
|
-
componentType: data.type,
|
|
8362
|
-
destinationIndex: sel.index + 1,
|
|
8363
|
-
destinationZone: sel.zone,
|
|
8364
|
-
data
|
|
8365
|
-
});
|
|
8366
|
-
}).catch(() => {
|
|
8367
|
-
});
|
|
8368
|
-
return true;
|
|
8369
|
-
},
|
|
8370
|
-
[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)
|
|
8371
8271
|
);
|
|
8372
|
-
|
|
8373
|
-
useHotkey({ ctrl: true, c: true }, copySelectedComponent);
|
|
8374
|
-
useHotkey({ meta: true, v: true }, pasteComponent);
|
|
8375
|
-
useHotkey({ ctrl: true, v: true }, pasteComponent);
|
|
8376
|
-
useHotkey({ meta: true, x: true }, cutSelectedComponent);
|
|
8377
|
-
useHotkey({ ctrl: true, x: true }, cutSelectedComponent);
|
|
8378
|
-
};
|
|
8379
|
-
|
|
8380
|
-
// components/Editor/components/Nav/index.tsx
|
|
8381
|
-
init_react_import();
|
|
8272
|
+
}
|
|
8382
8273
|
|
|
8383
|
-
// 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
|
|
8384
8275
|
init_react_import();
|
|
8385
|
-
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" };
|
|
8386
8277
|
|
|
8387
|
-
// components/
|
|
8388
|
-
import { jsx as
|
|
8389
|
-
var
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
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,
|
|
8401
8304
|
{
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
}
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8410
|
-
|
|
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
|
+
]
|
|
8411
8342
|
}
|
|
8412
|
-
)
|
|
8413
|
-
}
|
|
8414
|
-
|
|
8415
|
-
|
|
8416
|
-
footer
|
|
8417
|
-
}) => {
|
|
8418
|
-
return /* @__PURE__ */ jsxs23("nav", { className: getClassName33(), children: [
|
|
8419
|
-
/* @__PURE__ */ jsx53("ul", { className: getClassName33("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx53(MenuItem, __spreadValues({}, item), key)) }),
|
|
8420
|
-
footer && /* @__PURE__ */ jsx53("div", { className: getClassName33("footer"), children: footer })
|
|
8421
|
-
] });
|
|
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
|
+
] }) });
|
|
8422
8347
|
};
|
|
8423
8348
|
|
|
8424
8349
|
// components/Editor/components/Layout/index.tsx
|
|
8425
|
-
import {
|
|
8426
|
-
var
|
|
8427
|
-
var getLayoutClassName = get_class_name_factory_default("EditorLayout",
|
|
8428
|
-
var getPluginTabClassName = get_class_name_factory_default("EditorPluginTab",
|
|
8429
|
-
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 = () => {
|
|
8430
8356
|
const appStore = useAppStoreApi();
|
|
8431
8357
|
const { onPublish, currentRoute } = usePropsContext();
|
|
8432
|
-
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 = () => {
|
|
8433
8373
|
const back = useAppStore((s) => s.history.back);
|
|
8434
8374
|
const forward = useAppStore((s) => s.history.forward);
|
|
8435
8375
|
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
|
8436
8376
|
const hasPast = useAppStore((s) => s.history.hasPast());
|
|
8437
|
-
|
|
8438
|
-
(
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
chrome.showHistoryControls ? /* @__PURE__ */ jsxs24("div", { className: getClassName34("fieldSideBarHistory"), children: [
|
|
8442
|
-
/* @__PURE__ */ jsx54(
|
|
8443
|
-
IconButton,
|
|
8444
|
-
{
|
|
8445
|
-
type: "button",
|
|
8446
|
-
title: "undo",
|
|
8447
|
-
disabled: !hasPast,
|
|
8448
|
-
onClick: back,
|
|
8449
|
-
children: /* @__PURE__ */ jsx54(Undo2, { size: 18 })
|
|
8450
|
-
}
|
|
8451
|
-
),
|
|
8452
|
-
/* @__PURE__ */ jsx54(
|
|
8453
|
-
IconButton,
|
|
8454
|
-
{
|
|
8455
|
-
type: "button",
|
|
8456
|
-
title: "redo",
|
|
8457
|
-
disabled: !hasFuture,
|
|
8458
|
-
onClick: forward,
|
|
8459
|
-
children: /* @__PURE__ */ jsx54(Redo2, { size: 18 })
|
|
8460
|
-
}
|
|
8461
|
-
)
|
|
8462
|
-
] }) : /* @__PURE__ */ jsx54("div", {}),
|
|
8463
|
-
/* @__PURE__ */ jsx54("div", { className: getClassName34("fieldSideBarActions"), children: /* @__PURE__ */ jsx54(CustomHeaderActions, { children: /* @__PURE__ */ jsx54(
|
|
8464
|
-
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,
|
|
8465
8381
|
{
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
children:
|
|
8382
|
+
type: "button",
|
|
8383
|
+
title: "Redo",
|
|
8384
|
+
disabled: !hasFuture,
|
|
8385
|
+
onClick: forward,
|
|
8386
|
+
children: /* @__PURE__ */ jsx52(Redo2, { size: 16 })
|
|
8471
8387
|
}
|
|
8472
|
-
)
|
|
8473
|
-
] });
|
|
8474
|
-
};
|
|
8475
|
-
var FieldSideBar = () => {
|
|
8476
|
-
const title = useAppStore(
|
|
8477
|
-
(s) => {
|
|
8478
|
-
var _a, _b, _c;
|
|
8479
|
-
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";
|
|
8480
|
-
}
|
|
8481
|
-
);
|
|
8482
|
-
return /* @__PURE__ */ jsxs24(Fragment15, { children: [
|
|
8483
|
-
/* @__PURE__ */ jsx54(FieldSideBarToolbar, {}),
|
|
8484
|
-
/* @__PURE__ */ jsx54(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx54(Fields, {}) })
|
|
8388
|
+
)
|
|
8485
8389
|
] });
|
|
8486
8390
|
};
|
|
8487
8391
|
var PluginTab = ({
|
|
@@ -8489,17 +8393,16 @@ var PluginTab = ({
|
|
|
8489
8393
|
visible,
|
|
8490
8394
|
mobileOnly
|
|
8491
8395
|
}) => {
|
|
8492
|
-
return /* @__PURE__ */
|
|
8396
|
+
return /* @__PURE__ */ jsx52("div", { className: getPluginTabClassName({ visible, mobileOnly }), children: /* @__PURE__ */ jsx52("div", { className: getPluginTabClassName("body"), children }) });
|
|
8493
8397
|
};
|
|
8494
8398
|
var Layout = ({ children }) => {
|
|
8495
8399
|
const {
|
|
8496
8400
|
iframe: _iframe,
|
|
8497
8401
|
dnd,
|
|
8498
|
-
initialHistory: _initialHistory,
|
|
8499
8402
|
plugins,
|
|
8500
8403
|
height
|
|
8501
8404
|
} = usePropsContext();
|
|
8502
|
-
const iframe =
|
|
8405
|
+
const iframe = useMemo22(
|
|
8503
8406
|
() => __spreadValues({
|
|
8504
8407
|
enabled: true,
|
|
8505
8408
|
waitForStyles: true
|
|
@@ -8507,7 +8410,7 @@ var Layout = ({ children }) => {
|
|
|
8507
8410
|
[_iframe]
|
|
8508
8411
|
);
|
|
8509
8412
|
useInjectGlobalCss(iframe.enabled);
|
|
8510
|
-
const
|
|
8413
|
+
const setUi = useAppStore((s) => s.setUi);
|
|
8511
8414
|
const leftSideBarVisible = useAppStore((s) => s.state.ui.leftSideBarVisible);
|
|
8512
8415
|
const rightSideBarVisible = useAppStore(
|
|
8513
8416
|
(s) => s.state.ui.rightSideBarVisible
|
|
@@ -8515,53 +8418,14 @@ var Layout = ({ children }) => {
|
|
|
8515
8418
|
const chrome = useChromeConfig();
|
|
8516
8419
|
const navBarVisible = chrome.showNavBar;
|
|
8517
8420
|
const instanceId = useAppStore((s) => s.instanceId);
|
|
8518
|
-
const {
|
|
8519
|
-
width: leftWidth,
|
|
8520
|
-
setWidth: setLeftWidth,
|
|
8521
|
-
sidebarRef: leftSidebarRef,
|
|
8522
|
-
handleResizeEnd: handleLeftSidebarResizeEnd
|
|
8523
|
-
} = useSidebarResize("left", dispatch);
|
|
8524
|
-
const {
|
|
8525
|
-
width: rightWidth,
|
|
8526
|
-
setWidth: setRightWidth,
|
|
8527
|
-
sidebarRef: rightSidebarRef,
|
|
8528
|
-
handleResizeEnd: handleRightSidebarResizeEnd
|
|
8529
|
-
} = useSidebarResize("right", dispatch);
|
|
8530
|
-
useEffect25(() => {
|
|
8531
|
-
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
8532
|
-
dispatch({
|
|
8533
|
-
type: "setUi",
|
|
8534
|
-
ui: {
|
|
8535
|
-
leftSideBarVisible: false,
|
|
8536
|
-
rightSideBarVisible: false
|
|
8537
|
-
}
|
|
8538
|
-
});
|
|
8539
|
-
}
|
|
8540
|
-
const handleResize = () => {
|
|
8541
|
-
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
8542
|
-
dispatch({
|
|
8543
|
-
type: "setUi",
|
|
8544
|
-
ui: (ui) => __spreadValues(__spreadValues({}, ui), ui.rightSideBarVisible ? { leftSideBarVisible: false } : {})
|
|
8545
|
-
});
|
|
8546
|
-
}
|
|
8547
|
-
};
|
|
8548
|
-
window.addEventListener("resize", handleResize);
|
|
8549
|
-
return () => {
|
|
8550
|
-
window.removeEventListener("resize", handleResize);
|
|
8551
|
-
};
|
|
8552
|
-
}, []);
|
|
8553
8421
|
const overrides = useAppStore((s) => s.overrides);
|
|
8554
|
-
const CustomEditor =
|
|
8422
|
+
const CustomEditor = useMemo22(
|
|
8555
8423
|
() => overrides.editor || DefaultOverride,
|
|
8556
8424
|
[overrides]
|
|
8557
8425
|
);
|
|
8558
|
-
const [mounted, setMounted] = useState23(false);
|
|
8559
|
-
useEffect25(() => {
|
|
8560
|
-
setMounted(true);
|
|
8561
|
-
}, []);
|
|
8562
8426
|
const ready = useAppStore((s) => s.status === "READY");
|
|
8563
8427
|
useMonitorHotkeys();
|
|
8564
|
-
|
|
8428
|
+
useEffect24(() => {
|
|
8565
8429
|
if (ready && iframe.enabled) {
|
|
8566
8430
|
const frameDoc = getFrame();
|
|
8567
8431
|
if (frameDoc) {
|
|
@@ -8572,106 +8436,36 @@ var Layout = ({ children }) => {
|
|
|
8572
8436
|
usePreviewModeHotkeys();
|
|
8573
8437
|
useDeleteHotkeys();
|
|
8574
8438
|
useClipboardHotkeys();
|
|
8575
|
-
const layoutOptions = {};
|
|
8576
|
-
if (leftWidth) {
|
|
8577
|
-
layoutOptions["--editor-user-left-side-bar-width"] = `${leftWidth}px`;
|
|
8578
|
-
}
|
|
8579
|
-
if (rightWidth) {
|
|
8580
|
-
layoutOptions["--editor-user-right-side-bar-width"] = `${rightWidth}px`;
|
|
8581
|
-
}
|
|
8582
|
-
const setUi = useAppStore((s) => s.setUi);
|
|
8583
8439
|
const currentPlugin = useAppStore((s) => {
|
|
8584
8440
|
var _a;
|
|
8585
8441
|
return (_a = s.state.ui.plugin) == null ? void 0 : _a.current;
|
|
8586
8442
|
});
|
|
8587
8443
|
const appStoreApi = useAppStoreApi();
|
|
8588
|
-
const [
|
|
8589
|
-
const [mobilePanelHeight, setMobilePanelHeight] = useState23(
|
|
8590
|
-
null
|
|
8591
|
-
);
|
|
8592
|
-
const mobilePanelRef = useRef18(null);
|
|
8593
|
-
const isDraggingMobile = useRef18(false);
|
|
8594
|
-
const dragStartY = useRef18(0);
|
|
8595
|
-
const dragStartHeight = useRef18(0);
|
|
8596
|
-
const handleMobileDragStart = useCallback24(
|
|
8597
|
-
(clientY) => {
|
|
8598
|
-
isDraggingMobile.current = true;
|
|
8599
|
-
dragStartY.current = clientY;
|
|
8600
|
-
const panel = mobilePanelRef.current;
|
|
8601
|
-
dragStartHeight.current = panel ? panel.getBoundingClientRect().height : 0;
|
|
8602
|
-
document.body.style.userSelect = "none";
|
|
8603
|
-
document.body.style.touchAction = "none";
|
|
8604
|
-
},
|
|
8605
|
-
[]
|
|
8606
|
-
);
|
|
8607
|
-
const handleMobileDragMove = useCallback24((clientY) => {
|
|
8608
|
-
if (!isDraggingMobile.current) return;
|
|
8609
|
-
const delta = dragStartY.current - clientY;
|
|
8610
|
-
const viewportHeight = window.innerHeight;
|
|
8611
|
-
const minH = viewportHeight * 0.15;
|
|
8612
|
-
const maxH = viewportHeight * 0.75;
|
|
8613
|
-
const newH = Math.min(maxH, Math.max(minH, dragStartHeight.current + delta));
|
|
8614
|
-
setMobilePanelHeight(newH);
|
|
8615
|
-
}, []);
|
|
8616
|
-
const handleMobileDragEnd = useCallback24(() => {
|
|
8617
|
-
if (!isDraggingMobile.current) return;
|
|
8618
|
-
isDraggingMobile.current = false;
|
|
8619
|
-
document.body.style.userSelect = "";
|
|
8620
|
-
document.body.style.touchAction = "";
|
|
8621
|
-
}, []);
|
|
8622
|
-
useEffect25(() => {
|
|
8623
|
-
const onTouchMove = (e) => {
|
|
8624
|
-
if (isDraggingMobile.current) {
|
|
8625
|
-
e.preventDefault();
|
|
8626
|
-
handleMobileDragMove(e.touches[0].clientY);
|
|
8627
|
-
}
|
|
8628
|
-
};
|
|
8629
|
-
const onTouchEnd = () => handleMobileDragEnd();
|
|
8630
|
-
const onMouseMove = (e) => {
|
|
8631
|
-
if (isDraggingMobile.current) {
|
|
8632
|
-
e.preventDefault();
|
|
8633
|
-
handleMobileDragMove(e.clientY);
|
|
8634
|
-
}
|
|
8635
|
-
};
|
|
8636
|
-
const onMouseUp = () => handleMobileDragEnd();
|
|
8637
|
-
document.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
8638
|
-
document.addEventListener("touchend", onTouchEnd);
|
|
8639
|
-
document.addEventListener("mousemove", onMouseMove);
|
|
8640
|
-
document.addEventListener("mouseup", onMouseUp);
|
|
8641
|
-
return () => {
|
|
8642
|
-
document.removeEventListener("touchmove", onTouchMove);
|
|
8643
|
-
document.removeEventListener("touchend", onTouchEnd);
|
|
8644
|
-
document.removeEventListener("mousemove", onMouseMove);
|
|
8645
|
-
document.removeEventListener("mouseup", onMouseUp);
|
|
8646
|
-
};
|
|
8647
|
-
}, [handleMobileDragMove, handleMobileDragEnd]);
|
|
8648
|
-
const [theme, setTheme] = useState23(() => {
|
|
8444
|
+
const [theme, setTheme] = useState22(() => {
|
|
8649
8445
|
if (typeof window === "undefined") return "light";
|
|
8650
8446
|
const stored = window.localStorage.getItem("editor-theme");
|
|
8651
8447
|
if (stored === "light" || stored === "dark") return stored;
|
|
8652
8448
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
8653
8449
|
});
|
|
8654
|
-
|
|
8450
|
+
useEffect24(() => {
|
|
8655
8451
|
if (typeof window === "undefined") return;
|
|
8656
8452
|
window.localStorage.setItem("editor-theme", theme);
|
|
8657
8453
|
}, [theme]);
|
|
8658
8454
|
const toggleTheme = () => {
|
|
8659
8455
|
setTheme((t) => t === "dark" ? "light" : "dark");
|
|
8660
8456
|
};
|
|
8661
|
-
const themeIcon = theme === "dark" ? /* @__PURE__ */
|
|
8457
|
+
const themeIcon = theme === "dark" ? /* @__PURE__ */ jsx52(Sun, { size: 18 }) : /* @__PURE__ */ jsx52(Moon, { size: 18 });
|
|
8662
8458
|
const themeLabel = theme === "dark" ? "Switch to light mode" : "Switch to dark mode";
|
|
8663
|
-
const hasLegacySideBarPlugin =
|
|
8459
|
+
const hasLegacySideBarPlugin = useMemo22(
|
|
8664
8460
|
() => !!(plugins == null ? void 0 : plugins.find((p) => p.name === "legacy-side-bar")),
|
|
8665
8461
|
[plugins]
|
|
8666
8462
|
);
|
|
8667
|
-
const pluginItems =
|
|
8463
|
+
const pluginItems = useMemo22(() => {
|
|
8668
8464
|
const details = {};
|
|
8669
|
-
const defaultPlugins = [blocksPlugin()];
|
|
8670
8465
|
const isLegacy = (plugin) => plugin.name === "legacy-side-bar" ? -1 : 0;
|
|
8671
|
-
const combinedPlugins = [
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
].sort((a, b) => isLegacy(a) - isLegacy(b));
|
|
8466
|
+
const combinedPlugins = [...plugins != null ? plugins : []].sort(
|
|
8467
|
+
(a, b) => isLegacy(a) - isLegacy(b)
|
|
8468
|
+
);
|
|
8675
8469
|
if (!(plugins == null ? void 0 : plugins.some((p) => p.name === "fields"))) {
|
|
8676
8470
|
combinedPlugins.push(fieldsPlugin());
|
|
8677
8471
|
}
|
|
@@ -8683,23 +8477,15 @@ var Layout = ({ children }) => {
|
|
|
8683
8477
|
}
|
|
8684
8478
|
details[plugin.name] = {
|
|
8685
8479
|
label: (_a = plugin.label) != null ? _a : plugin.name,
|
|
8686
|
-
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */
|
|
8480
|
+
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ jsx52(ToyBrick, {}),
|
|
8687
8481
|
onClick: () => {
|
|
8688
|
-
var _a2;
|
|
8689
|
-
setMobilePanelHeightMode((_a2 = plugin.mobilePanelHeight) != null ? _a2 : "toggle");
|
|
8690
8482
|
if (plugin.name === currentPlugin) {
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
if (plugin.name) {
|
|
8698
|
-
setUi({
|
|
8699
|
-
plugin: { current: plugin.name },
|
|
8700
|
-
leftSideBarVisible: true
|
|
8701
|
-
});
|
|
8702
|
-
}
|
|
8483
|
+
setUi({ leftSideBarVisible: !leftSideBarVisible });
|
|
8484
|
+
} else if (plugin.name) {
|
|
8485
|
+
setUi({
|
|
8486
|
+
plugin: { current: plugin.name },
|
|
8487
|
+
leftSideBarVisible: true
|
|
8488
|
+
});
|
|
8703
8489
|
}
|
|
8704
8490
|
},
|
|
8705
8491
|
isActive: leftSideBarVisible && currentPlugin === plugin.name,
|
|
@@ -8711,147 +8497,65 @@ var Layout = ({ children }) => {
|
|
|
8711
8497
|
});
|
|
8712
8498
|
return details;
|
|
8713
8499
|
}, [plugins, currentPlugin, appStoreApi, leftSideBarVisible]);
|
|
8714
|
-
|
|
8500
|
+
useEffect24(() => {
|
|
8715
8501
|
if (!currentPlugin) {
|
|
8716
8502
|
const names = Object.keys(pluginItems);
|
|
8717
8503
|
setUi({ plugin: { current: names[0] } });
|
|
8718
8504
|
}
|
|
8719
8505
|
}, [pluginItems, currentPlugin]);
|
|
8720
8506
|
const hasDesktopFieldsPlugin = pluginItems["fields"] && pluginItems["fields"].mobileOnly === false;
|
|
8721
|
-
|
|
8722
|
-
if (mobilePanelHeight && leftSideBarVisible) {
|
|
8723
|
-
mobilePanelStyle["--editor-mobile-panel-height"] = `${mobilePanelHeight}px`;
|
|
8724
|
-
}
|
|
8725
|
-
return /* @__PURE__ */ jsxs24(
|
|
8507
|
+
return /* @__PURE__ */ jsx52(ThemeContext.Provider, { value: { theme, toggleTheme }, children: /* @__PURE__ */ jsxs23(
|
|
8726
8508
|
"div",
|
|
8727
8509
|
{
|
|
8728
|
-
className: `Editor ${
|
|
8510
|
+
className: `Editor ${getClassName32({
|
|
8729
8511
|
hidePlugins: hasLegacySideBarPlugin
|
|
8730
8512
|
})}`,
|
|
8731
8513
|
id: instanceId,
|
|
8732
8514
|
"data-theme": theme,
|
|
8733
8515
|
style: { height },
|
|
8734
8516
|
children: [
|
|
8735
|
-
/* @__PURE__ */
|
|
8517
|
+
/* @__PURE__ */ jsx52(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx52(CustomEditor, { children: children || /* @__PURE__ */ jsx52(FrameProvider, { children: /* @__PURE__ */ jsx52(
|
|
8736
8518
|
"div",
|
|
8737
8519
|
{
|
|
8738
8520
|
className: getLayoutClassName({
|
|
8739
8521
|
leftSideBarVisible,
|
|
8740
|
-
mounted,
|
|
8741
8522
|
rightSideBarVisible: !hasDesktopFieldsPlugin && rightSideBarVisible,
|
|
8742
|
-
navBarVisible
|
|
8743
|
-
mobilePanelHeightToggle: mobilePanelHeightMode === "toggle",
|
|
8744
|
-
mobilePanelHeightMinContent: mobilePanelHeightMode === "min-content",
|
|
8745
|
-
mobilePanelCustomHeight: mobilePanelHeight !== null && leftSideBarVisible
|
|
8523
|
+
navBarVisible
|
|
8746
8524
|
}),
|
|
8747
8525
|
style: { height },
|
|
8748
|
-
children: /* @__PURE__ */
|
|
8749
|
-
"
|
|
8750
|
-
|
|
8751
|
-
className: getLayoutClassName("
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
|
|
8770
|
-
|
|
8771
|
-
{
|
|
8772
|
-
ref: mobilePanelRef,
|
|
8773
|
-
className: getLayoutClassName("mobilePanel"),
|
|
8774
|
-
children: [
|
|
8775
|
-
/* @__PURE__ */ jsx54(
|
|
8776
|
-
"div",
|
|
8777
|
-
{
|
|
8778
|
-
className: getLayoutClassName("mobileDragHandle"),
|
|
8779
|
-
onTouchStart: (e) => handleMobileDragStart(e.touches[0].clientY),
|
|
8780
|
-
onMouseDown: (e) => handleMobileDragStart(e.clientY),
|
|
8781
|
-
children: /* @__PURE__ */ jsx54(
|
|
8782
|
-
"div",
|
|
8783
|
-
{
|
|
8784
|
-
className: getLayoutClassName("mobileDragHandlePill")
|
|
8785
|
-
}
|
|
8786
|
-
)
|
|
8787
|
-
}
|
|
8788
|
-
),
|
|
8789
|
-
/* @__PURE__ */ jsx54(
|
|
8790
|
-
"div",
|
|
8791
|
-
{
|
|
8792
|
-
className: getLayoutClassName("mobilePanelContent"),
|
|
8793
|
-
children: Object.entries(pluginItems).map(
|
|
8794
|
-
([id, { mobileOnly, render: Render2 }]) => /* @__PURE__ */ jsx54(
|
|
8795
|
-
PluginTab,
|
|
8796
|
-
{
|
|
8797
|
-
visible: currentPlugin === id,
|
|
8798
|
-
mobileOnly,
|
|
8799
|
-
children: /* @__PURE__ */ jsx54(Render2, {})
|
|
8800
|
-
},
|
|
8801
|
-
id
|
|
8802
|
-
)
|
|
8803
|
-
)
|
|
8804
|
-
}
|
|
8805
|
-
)
|
|
8806
|
-
]
|
|
8807
|
-
}
|
|
8808
|
-
),
|
|
8809
|
-
/* @__PURE__ */ jsx54(
|
|
8810
|
-
Sidebar,
|
|
8811
|
-
{
|
|
8812
|
-
position: "left",
|
|
8813
|
-
sidebarRef: leftSidebarRef,
|
|
8814
|
-
isVisible: leftSideBarVisible,
|
|
8815
|
-
onResize: setLeftWidth,
|
|
8816
|
-
onResizeEnd: handleLeftSidebarResizeEnd,
|
|
8817
|
-
children: Object.entries(pluginItems).map(
|
|
8818
|
-
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */ jsx54(
|
|
8819
|
-
PluginTab,
|
|
8820
|
-
{
|
|
8821
|
-
visible: currentPlugin === id,
|
|
8822
|
-
mobileOnly,
|
|
8823
|
-
children: /* @__PURE__ */ jsx54(Render2, {})
|
|
8824
|
-
},
|
|
8825
|
-
id
|
|
8826
|
-
)
|
|
8827
|
-
)
|
|
8828
|
-
}
|
|
8829
|
-
),
|
|
8830
|
-
/* @__PURE__ */ jsx54(Canvas, {}),
|
|
8831
|
-
!hasDesktopFieldsPlugin && /* @__PURE__ */ jsx54(
|
|
8832
|
-
Sidebar,
|
|
8833
|
-
{
|
|
8834
|
-
position: "right",
|
|
8835
|
-
sidebarRef: rightSidebarRef,
|
|
8836
|
-
isVisible: rightSideBarVisible,
|
|
8837
|
-
onResize: setRightWidth,
|
|
8838
|
-
onResizeEnd: handleRightSidebarResizeEnd,
|
|
8839
|
-
children: /* @__PURE__ */ jsx54(FieldSideBar, {})
|
|
8840
|
-
}
|
|
8841
|
-
)
|
|
8842
|
-
]
|
|
8843
|
-
}
|
|
8844
|
-
)
|
|
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
|
+
] })
|
|
8845
8549
|
}
|
|
8846
8550
|
) }) }) }),
|
|
8847
|
-
/* @__PURE__ */
|
|
8551
|
+
/* @__PURE__ */ jsx52("div", { id: "editor-portal-root", className: getClassName32("portal") })
|
|
8848
8552
|
]
|
|
8849
8553
|
}
|
|
8850
|
-
);
|
|
8554
|
+
) });
|
|
8851
8555
|
};
|
|
8852
8556
|
|
|
8853
8557
|
// components/Editor/index.tsx
|
|
8854
|
-
import { jsx as
|
|
8558
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
8855
8559
|
var CHROME_KEYS = [
|
|
8856
8560
|
"showNavBar",
|
|
8857
8561
|
"showThemeToggle",
|
|
@@ -8881,11 +8585,11 @@ var splitUiConfig = (ui) => {
|
|
|
8881
8585
|
}
|
|
8882
8586
|
return { runtime, chrome };
|
|
8883
8587
|
};
|
|
8884
|
-
var propsContext =
|
|
8588
|
+
var propsContext = createContext9({});
|
|
8885
8589
|
function PropsProvider(props) {
|
|
8886
|
-
return /* @__PURE__ */
|
|
8590
|
+
return /* @__PURE__ */ jsx53(propsContext.Provider, { value: props, children: props.children });
|
|
8887
8591
|
}
|
|
8888
|
-
var usePropsContext = () =>
|
|
8592
|
+
var usePropsContext = () => useContext16(propsContext);
|
|
8889
8593
|
var useChromeConfig = () => {
|
|
8890
8594
|
const { ui } = usePropsContext();
|
|
8891
8595
|
const { chrome } = splitUiConfig(ui);
|
|
@@ -8909,14 +8613,14 @@ function EditorProvider({ children }) {
|
|
|
8909
8613
|
fullScreenCanvas,
|
|
8910
8614
|
_experimentalVirtualization
|
|
8911
8615
|
} = usePropsContext();
|
|
8912
|
-
const iframe =
|
|
8616
|
+
const iframe = useMemo23(
|
|
8913
8617
|
() => __spreadValues({
|
|
8914
8618
|
enabled: true,
|
|
8915
8619
|
waitForStyles: true
|
|
8916
8620
|
}, _iframe),
|
|
8917
8621
|
[_iframe]
|
|
8918
8622
|
);
|
|
8919
|
-
const [generatedAppState] =
|
|
8623
|
+
const [generatedAppState] = useState23(() => {
|
|
8920
8624
|
var _a, _b, _c, _d, _e, _f;
|
|
8921
8625
|
const { runtime: initialUiRuntime } = splitUiConfig(initialUi);
|
|
8922
8626
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUiRuntime);
|
|
@@ -8969,7 +8673,7 @@ function EditorProvider({ children }) {
|
|
|
8969
8673
|
return walkAppState(newAppState, config);
|
|
8970
8674
|
});
|
|
8971
8675
|
const { appendData = true } = _initialHistory || {};
|
|
8972
|
-
const [blendedHistories] =
|
|
8676
|
+
const [blendedHistories] = useState23(
|
|
8973
8677
|
[
|
|
8974
8678
|
...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
|
|
8975
8679
|
...appendData ? [{ state: generatedAppState }] : []
|
|
@@ -8983,7 +8687,7 @@ function EditorProvider({ children }) {
|
|
|
8983
8687
|
});
|
|
8984
8688
|
})
|
|
8985
8689
|
);
|
|
8986
|
-
const initialHistoryIndex =
|
|
8690
|
+
const initialHistoryIndex = useMemo23(() => {
|
|
8987
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) {
|
|
8988
8692
|
return _initialHistory == null ? void 0 : _initialHistory.index;
|
|
8989
8693
|
}
|
|
@@ -8994,7 +8698,7 @@ function EditorProvider({ children }) {
|
|
|
8994
8698
|
overrides,
|
|
8995
8699
|
plugins
|
|
8996
8700
|
});
|
|
8997
|
-
const loadedFieldTransforms =
|
|
8701
|
+
const loadedFieldTransforms = useMemo23(() => {
|
|
8998
8702
|
const _plugins = plugins || [];
|
|
8999
8703
|
const pluginFieldTransforms = _plugins.reduce(
|
|
9000
8704
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
@@ -9003,7 +8707,7 @@ function EditorProvider({ children }) {
|
|
|
9003
8707
|
return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
|
|
9004
8708
|
}, [fieldTransforms, plugins]);
|
|
9005
8709
|
const instanceId = useSafeId();
|
|
9006
|
-
const generateAppStore =
|
|
8710
|
+
const generateAppStore = useCallback22(
|
|
9007
8711
|
(state) => {
|
|
9008
8712
|
return {
|
|
9009
8713
|
instanceId,
|
|
@@ -9035,15 +8739,15 @@ function EditorProvider({ children }) {
|
|
|
9035
8739
|
loadedFieldTransforms
|
|
9036
8740
|
]
|
|
9037
8741
|
);
|
|
9038
|
-
const [appStore] =
|
|
8742
|
+
const [appStore] = useState23(
|
|
9039
8743
|
() => createAppStore(generateAppStore(initialAppState))
|
|
9040
8744
|
);
|
|
9041
|
-
|
|
8745
|
+
useEffect25(() => {
|
|
9042
8746
|
if (process.env.NODE_ENV !== "production") {
|
|
9043
8747
|
window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
|
|
9044
8748
|
}
|
|
9045
8749
|
}, [appStore]);
|
|
9046
|
-
|
|
8750
|
+
useEffect25(() => {
|
|
9047
8751
|
const state = appStore.getState().state;
|
|
9048
8752
|
appStore.setState(__spreadValues({}, generateAppStore(state)));
|
|
9049
8753
|
}, [generateAppStore]);
|
|
@@ -9052,8 +8756,8 @@ function EditorProvider({ children }) {
|
|
|
9052
8756
|
index: initialHistoryIndex,
|
|
9053
8757
|
initialAppState
|
|
9054
8758
|
});
|
|
9055
|
-
const previousData =
|
|
9056
|
-
|
|
8759
|
+
const previousData = useRef16(null);
|
|
8760
|
+
useEffect25(() => {
|
|
9057
8761
|
return appStore.subscribe(
|
|
9058
8762
|
(s) => s.state.data,
|
|
9059
8763
|
(data) => {
|
|
@@ -9067,16 +8771,16 @@ function EditorProvider({ children }) {
|
|
|
9067
8771
|
}, [onChange, config]);
|
|
9068
8772
|
useRegisterPermissionsSlice(appStore, permissions);
|
|
9069
8773
|
const uEditorStore = useRegisterUseEditorStore(appStore);
|
|
9070
|
-
|
|
8774
|
+
useEffect25(() => {
|
|
9071
8775
|
const { resolveAndCommitData } = appStore.getState();
|
|
9072
8776
|
setTimeout(() => {
|
|
9073
8777
|
resolveAndCommitData();
|
|
9074
8778
|
}, 0);
|
|
9075
8779
|
}, []);
|
|
9076
|
-
return /* @__PURE__ */
|
|
8780
|
+
return /* @__PURE__ */ jsx53(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx53(UseEditorStoreContext.Provider, { value: uEditorStore, children }) });
|
|
9077
8781
|
}
|
|
9078
8782
|
function Editor3(props) {
|
|
9079
|
-
return /* @__PURE__ */
|
|
8783
|
+
return /* @__PURE__ */ jsx53(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx53(EditorProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx53(Layout, { children: props.children }) })) }));
|
|
9080
8784
|
}
|
|
9081
8785
|
Editor3.Components = Components;
|
|
9082
8786
|
Editor3.Fields = Fields;
|
|
@@ -9086,10 +8790,10 @@ Editor3.Preview = Preview2;
|
|
|
9086
8790
|
|
|
9087
8791
|
// lib/use-stable-value.ts
|
|
9088
8792
|
init_react_import();
|
|
9089
|
-
import { useRef as
|
|
8793
|
+
import { useRef as useRef17 } from "react";
|
|
9090
8794
|
import { deepEqual as deepEqual3 } from "fast-equals";
|
|
9091
8795
|
var useStableValue = (value) => {
|
|
9092
|
-
const ref =
|
|
8796
|
+
const ref = useRef17(value);
|
|
9093
8797
|
if (!deepEqual3(ref.current, value)) {
|
|
9094
8798
|
ref.current = value;
|
|
9095
8799
|
}
|
|
@@ -9098,11 +8802,11 @@ var useStableValue = (value) => {
|
|
|
9098
8802
|
|
|
9099
8803
|
// components/App/context.ts
|
|
9100
8804
|
init_react_import();
|
|
9101
|
-
import { createContext as
|
|
8805
|
+
import { createContext as createContext10, useContext as useContext17, useMemo as useMemo24 } from "react";
|
|
9102
8806
|
import { matchRoutes, useLocation, useNavigate } from "react-router";
|
|
9103
|
-
var appConfigContext =
|
|
8807
|
+
var appConfigContext = createContext10(null);
|
|
9104
8808
|
var useAppConfigContext = () => {
|
|
9105
|
-
const ctx =
|
|
8809
|
+
const ctx = useContext17(appConfigContext);
|
|
9106
8810
|
if (!ctx) {
|
|
9107
8811
|
throw new Error("useApp must be called inside an <AppProvider> or <App>");
|
|
9108
8812
|
}
|
|
@@ -9121,7 +8825,7 @@ var useApp = () => {
|
|
|
9121
8825
|
const currentPath = location.pathname || "/";
|
|
9122
8826
|
const isEditing = cfg.editorPath !== null && (currentPath === cfg.editorPath || currentPath.startsWith(`${cfg.editorPath}/`));
|
|
9123
8827
|
const matchRoute = isEditing ? stripPrefix(currentPath, cfg.editorPath) : currentPath;
|
|
9124
|
-
const matched =
|
|
8828
|
+
const matched = useMemo24(() => {
|
|
9125
8829
|
const routeKeys = Object.keys(cfg.pages);
|
|
9126
8830
|
if (routeKeys.length === 0) return null;
|
|
9127
8831
|
const matches = matchRoutes(
|
|
@@ -9137,7 +8841,7 @@ var useApp = () => {
|
|
|
9137
8841
|
data: cfg.pages[key]
|
|
9138
8842
|
};
|
|
9139
8843
|
}, [cfg.pages, matchRoute]);
|
|
9140
|
-
const routes =
|
|
8844
|
+
const routes = useMemo24(() => Object.keys(cfg.pages), [cfg.pages]);
|
|
9141
8845
|
const navigate = (route) => {
|
|
9142
8846
|
const target = isEditing && cfg.editorPath ? `${cfg.editorPath}${route === "/" ? "" : route}` || "/" : route;
|
|
9143
8847
|
rrNavigate(target || "/");
|
|
@@ -9154,14 +8858,14 @@ var useApp = () => {
|
|
|
9154
8858
|
|
|
9155
8859
|
// components/App/AppProvider.tsx
|
|
9156
8860
|
init_react_import();
|
|
9157
|
-
import { useMemo as
|
|
8861
|
+
import { useMemo as useMemo25 } from "react";
|
|
9158
8862
|
import {
|
|
9159
8863
|
BrowserRouter,
|
|
9160
8864
|
HashRouter,
|
|
9161
8865
|
MemoryRouter,
|
|
9162
8866
|
StaticRouter
|
|
9163
8867
|
} from "react-router";
|
|
9164
|
-
import { jsx as
|
|
8868
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
9165
8869
|
var EDITOR_PATH = "/editor";
|
|
9166
8870
|
var isServer = typeof window === "undefined";
|
|
9167
8871
|
function AppProvider({
|
|
@@ -9174,7 +8878,7 @@ function AppProvider({
|
|
|
9174
8878
|
}) {
|
|
9175
8879
|
const stablePages = useStableValue(pages);
|
|
9176
8880
|
const resolvedEditorPath = editorPath === null ? null : editorPath || EDITOR_PATH;
|
|
9177
|
-
const ctxValue =
|
|
8881
|
+
const ctxValue = useMemo25(
|
|
9178
8882
|
() => ({
|
|
9179
8883
|
config,
|
|
9180
8884
|
pages: stablePages,
|
|
@@ -9182,28 +8886,28 @@ function AppProvider({
|
|
|
9182
8886
|
}),
|
|
9183
8887
|
[config, stablePages, resolvedEditorPath]
|
|
9184
8888
|
);
|
|
9185
|
-
const inner = /* @__PURE__ */
|
|
8889
|
+
const inner = /* @__PURE__ */ jsx54(appConfigContext.Provider, { value: ctxValue, children });
|
|
9186
8890
|
if (isServer) {
|
|
9187
|
-
return /* @__PURE__ */
|
|
8891
|
+
return /* @__PURE__ */ jsx54(StaticRouter, { location: currentPath != null ? currentPath : "/", children: inner });
|
|
9188
8892
|
}
|
|
9189
8893
|
if (router === "hash") {
|
|
9190
|
-
return /* @__PURE__ */
|
|
8894
|
+
return /* @__PURE__ */ jsx54(HashRouter, { children: inner });
|
|
9191
8895
|
}
|
|
9192
8896
|
if (router === "memory") {
|
|
9193
|
-
return /* @__PURE__ */
|
|
8897
|
+
return /* @__PURE__ */ jsx54(MemoryRouter, { initialEntries: [currentPath != null ? currentPath : "/"], children: inner });
|
|
9194
8898
|
}
|
|
9195
|
-
return /* @__PURE__ */
|
|
8899
|
+
return /* @__PURE__ */ jsx54(BrowserRouter, { children: inner });
|
|
9196
8900
|
}
|
|
9197
8901
|
|
|
9198
8902
|
// components/App/App.tsx
|
|
9199
8903
|
init_react_import();
|
|
9200
8904
|
import { Route, Routes } from "react-router";
|
|
9201
|
-
import { Fragment as
|
|
8905
|
+
import { Fragment as Fragment14, jsx as jsx55, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
9202
8906
|
var joinEditorPath = (editorPath, route) => {
|
|
9203
8907
|
if (route === "/") return editorPath;
|
|
9204
8908
|
return `${editorPath}${route}`;
|
|
9205
8909
|
};
|
|
9206
|
-
var DefaultNotFound = () => /* @__PURE__ */
|
|
8910
|
+
var DefaultNotFound = () => /* @__PURE__ */ jsx55(
|
|
9207
8911
|
"div",
|
|
9208
8912
|
{
|
|
9209
8913
|
style: {
|
|
@@ -9213,9 +8917,9 @@ var DefaultNotFound = () => /* @__PURE__ */ jsx57(
|
|
|
9213
8917
|
justifyContent: "center",
|
|
9214
8918
|
alignItems: "center"
|
|
9215
8919
|
},
|
|
9216
|
-
children: /* @__PURE__ */
|
|
9217
|
-
/* @__PURE__ */
|
|
9218
|
-
/* @__PURE__ */
|
|
8920
|
+
children: /* @__PURE__ */ jsxs24("div", { children: [
|
|
8921
|
+
/* @__PURE__ */ jsx55("h1", { children: "404" }),
|
|
8922
|
+
/* @__PURE__ */ jsx55("p", { children: "No page matches this route." })
|
|
9219
8923
|
] })
|
|
9220
8924
|
}
|
|
9221
8925
|
);
|
|
@@ -9226,7 +8930,7 @@ function RenderForKey({
|
|
|
9226
8930
|
const { config, pages } = useApp();
|
|
9227
8931
|
const data = pages[routeKey];
|
|
9228
8932
|
if (!data) return null;
|
|
9229
|
-
return /* @__PURE__ */
|
|
8933
|
+
return /* @__PURE__ */ jsx55(
|
|
9230
8934
|
Render,
|
|
9231
8935
|
{
|
|
9232
8936
|
config,
|
|
@@ -9244,7 +8948,7 @@ function EditorForKey({
|
|
|
9244
8948
|
const { config, pages, routes, navigate } = useApp();
|
|
9245
8949
|
const data = pages[routeKey];
|
|
9246
8950
|
if (!data) return null;
|
|
9247
|
-
return /* @__PURE__ */
|
|
8951
|
+
return /* @__PURE__ */ jsx55(
|
|
9248
8952
|
Editor3,
|
|
9249
8953
|
{
|
|
9250
8954
|
config,
|
|
@@ -9281,12 +8985,12 @@ function AppRender({ metadata, renderNotFound }) {
|
|
|
9281
8985
|
const { pages, isEditing } = useApp();
|
|
9282
8986
|
if (isEditing) return null;
|
|
9283
8987
|
const routeKeys = Object.keys(pages);
|
|
9284
|
-
return /* @__PURE__ */
|
|
9285
|
-
routeKeys.map((routeKey) => /* @__PURE__ */
|
|
8988
|
+
return /* @__PURE__ */ jsxs24(Routes, { children: [
|
|
8989
|
+
routeKeys.map((routeKey) => /* @__PURE__ */ jsx55(
|
|
9286
8990
|
Route,
|
|
9287
8991
|
{
|
|
9288
8992
|
path: routeKey,
|
|
9289
|
-
element: /* @__PURE__ */
|
|
8993
|
+
element: /* @__PURE__ */ jsx55(
|
|
9290
8994
|
RenderForKey,
|
|
9291
8995
|
{
|
|
9292
8996
|
routeKey,
|
|
@@ -9296,11 +9000,11 @@ function AppRender({ metadata, renderNotFound }) {
|
|
|
9296
9000
|
},
|
|
9297
9001
|
`render:${routeKey}`
|
|
9298
9002
|
)),
|
|
9299
|
-
/* @__PURE__ */
|
|
9003
|
+
/* @__PURE__ */ jsx55(
|
|
9300
9004
|
Route,
|
|
9301
9005
|
{
|
|
9302
9006
|
path: "*",
|
|
9303
|
-
element: renderNotFound ? /* @__PURE__ */
|
|
9007
|
+
element: renderNotFound ? /* @__PURE__ */ jsx55(Fragment14, { children: renderNotFound() }) : /* @__PURE__ */ jsx55(DefaultNotFound, {})
|
|
9304
9008
|
}
|
|
9305
9009
|
)
|
|
9306
9010
|
] });
|
|
@@ -9310,12 +9014,12 @@ function AppEditor(props) {
|
|
|
9310
9014
|
const { pages, isEditing, editorPath } = useApp();
|
|
9311
9015
|
if (!isEditing || editorPath === null) return null;
|
|
9312
9016
|
const routeKeys = Object.keys(pages);
|
|
9313
|
-
return /* @__PURE__ */
|
|
9314
|
-
routeKeys.map((routeKey) => /* @__PURE__ */
|
|
9017
|
+
return /* @__PURE__ */ jsxs24(Routes, { children: [
|
|
9018
|
+
routeKeys.map((routeKey) => /* @__PURE__ */ jsx55(
|
|
9315
9019
|
Route,
|
|
9316
9020
|
{
|
|
9317
9021
|
path: joinEditorPath(editorPath, routeKey),
|
|
9318
|
-
element: /* @__PURE__ */
|
|
9022
|
+
element: /* @__PURE__ */ jsx55(
|
|
9319
9023
|
EditorForKey,
|
|
9320
9024
|
{
|
|
9321
9025
|
routeKey,
|
|
@@ -9326,26 +9030,26 @@ function AppEditor(props) {
|
|
|
9326
9030
|
},
|
|
9327
9031
|
`edit:${routeKey}`
|
|
9328
9032
|
)),
|
|
9329
|
-
/* @__PURE__ */
|
|
9033
|
+
/* @__PURE__ */ jsx55(
|
|
9330
9034
|
Route,
|
|
9331
9035
|
{
|
|
9332
9036
|
path: "*",
|
|
9333
|
-
element: renderNotFound ? /* @__PURE__ */
|
|
9037
|
+
element: renderNotFound ? /* @__PURE__ */ jsx55(Fragment14, { children: renderNotFound() }) : /* @__PURE__ */ jsx55(DefaultNotFound, {})
|
|
9334
9038
|
}
|
|
9335
9039
|
)
|
|
9336
9040
|
] });
|
|
9337
9041
|
}
|
|
9338
9042
|
function DefaultAppLayout(props) {
|
|
9339
9043
|
const _a = props, { renderNotFound } = _a, editorProps = __objRest(_a, ["renderNotFound"]);
|
|
9340
|
-
return /* @__PURE__ */
|
|
9341
|
-
/* @__PURE__ */
|
|
9044
|
+
return /* @__PURE__ */ jsxs24(Fragment14, { children: [
|
|
9045
|
+
/* @__PURE__ */ jsx55(
|
|
9342
9046
|
AppRender,
|
|
9343
9047
|
{
|
|
9344
9048
|
metadata: editorProps.metadata,
|
|
9345
9049
|
renderNotFound
|
|
9346
9050
|
}
|
|
9347
9051
|
),
|
|
9348
|
-
/* @__PURE__ */
|
|
9052
|
+
/* @__PURE__ */ jsx55(AppEditor, __spreadProps(__spreadValues({}, editorProps), { renderNotFound }))
|
|
9349
9053
|
] });
|
|
9350
9054
|
}
|
|
9351
9055
|
function App(props) {
|
|
@@ -9364,7 +9068,7 @@ function App(props) {
|
|
|
9364
9068
|
"router",
|
|
9365
9069
|
"children"
|
|
9366
9070
|
]);
|
|
9367
|
-
return /* @__PURE__ */
|
|
9071
|
+
return /* @__PURE__ */ jsx55(
|
|
9368
9072
|
AppProvider,
|
|
9369
9073
|
{
|
|
9370
9074
|
config,
|
|
@@ -9372,7 +9076,7 @@ function App(props) {
|
|
|
9372
9076
|
currentPath,
|
|
9373
9077
|
editorPath,
|
|
9374
9078
|
router,
|
|
9375
|
-
children: children != null ? children : /* @__PURE__ */
|
|
9079
|
+
children: children != null ? children : /* @__PURE__ */ jsx55(DefaultAppLayout, __spreadValues({}, layoutProps))
|
|
9376
9080
|
}
|
|
9377
9081
|
);
|
|
9378
9082
|
}
|
|
@@ -9410,31 +9114,48 @@ function pageMetadata(data) {
|
|
|
9410
9114
|
return out;
|
|
9411
9115
|
}
|
|
9412
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
|
+
|
|
9413
9134
|
// plugins/outline/index.tsx
|
|
9414
9135
|
init_react_import();
|
|
9415
9136
|
|
|
9416
9137
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/outline/styles.module.css#css-module
|
|
9417
9138
|
init_react_import();
|
|
9418
|
-
var
|
|
9139
|
+
var styles_module_default29 = { "OutlinePlugin": "_OutlinePlugin_q92j6_1" };
|
|
9419
9140
|
|
|
9420
9141
|
// plugins/outline/index.tsx
|
|
9421
|
-
import { jsx as
|
|
9422
|
-
var
|
|
9142
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
9143
|
+
var getClassName34 = get_class_name_factory_default("OutlinePlugin", styles_module_default29);
|
|
9423
9144
|
var outlinePlugin = () => ({
|
|
9424
9145
|
name: "outline",
|
|
9425
9146
|
label: "Outline",
|
|
9426
|
-
render: () => /* @__PURE__ */
|
|
9427
|
-
icon: /* @__PURE__ */
|
|
9147
|
+
render: () => /* @__PURE__ */ jsx57("div", { className: getClassName34(), children: /* @__PURE__ */ jsx57(Outline, {}) }),
|
|
9148
|
+
icon: /* @__PURE__ */ jsx57(Layers, {})
|
|
9428
9149
|
});
|
|
9429
9150
|
|
|
9430
9151
|
// plugins/legacy-side-bar/index.tsx
|
|
9431
9152
|
init_react_import();
|
|
9432
|
-
import { jsx as
|
|
9153
|
+
import { jsx as jsx58, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
9433
9154
|
var legacySideBarPlugin = () => ({
|
|
9434
9155
|
name: "legacy-side-bar",
|
|
9435
|
-
render: () => /* @__PURE__ */
|
|
9436
|
-
/* @__PURE__ */
|
|
9437
|
-
/* @__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, {}) })
|
|
9438
9159
|
] })
|
|
9439
9160
|
});
|
|
9440
9161
|
|
|
@@ -9494,7 +9215,6 @@ export {
|
|
|
9494
9215
|
createUseEditor,
|
|
9495
9216
|
useEditor,
|
|
9496
9217
|
useGetEditor,
|
|
9497
|
-
blocksPlugin,
|
|
9498
9218
|
fieldsPlugin,
|
|
9499
9219
|
usePropsContext,
|
|
9500
9220
|
Editor3 as Editor,
|
|
@@ -9505,6 +9225,7 @@ export {
|
|
|
9505
9225
|
App,
|
|
9506
9226
|
useRouteParams,
|
|
9507
9227
|
pageMetadata,
|
|
9228
|
+
blocksPlugin,
|
|
9508
9229
|
outlinePlugin,
|
|
9509
9230
|
legacySideBarPlugin
|
|
9510
9231
|
};
|