@reacteditor/core 0.0.15 → 0.0.17
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-7UIJWCPN.mjs → Editor-RY6D73N6.mjs} +8 -8
- package/dist/{Render-STFB5CNO.mjs → Render-IDDFFANP.mjs} +1 -1
- package/dist/{chunk-647NZJYM.mjs → chunk-2A2HBRLV.mjs} +4 -4
- package/dist/{chunk-3CGBQNX4.mjs → chunk-AD67LVXW.mjs} +3 -3
- package/dist/{chunk-RAMNEU3M.mjs → chunk-AXB6UJ2P.mjs} +1389 -1099
- package/dist/{chunk-GIGXMGTZ.mjs → chunk-C5G7WUBQ.mjs} +1 -1
- package/dist/{chunk-C2KWANIN.mjs → chunk-CUGSM3PC.mjs} +1 -1
- package/dist/{chunk-Y2EFNT5P.mjs → chunk-DQU3HIP4.mjs} +16 -6
- package/dist/{chunk-NKHR722W.mjs → chunk-ESU6AYGB.mjs} +1 -1
- package/dist/{chunk-NPC7A3V3.mjs → chunk-FTVOCMGV.mjs} +13 -3
- package/dist/{chunk-T43H325W.mjs → chunk-NUBRSWFJ.mjs} +123 -22
- package/dist/{chunk-TFAZFGYZ.mjs → chunk-OAOKQORI.mjs} +8 -8
- package/dist/{full-PM3VSLYA.mjs → full-35622JEC.mjs} +7 -7
- package/dist/index.css +530 -471
- package/dist/index.js +1287 -865
- package/dist/index.mjs +10 -10
- package/dist/{loaded-5MUU76TF.mjs → loaded-GJMTZ3M5.mjs} +4 -4
- package/dist/{loaded-ULJY3YN5.mjs → loaded-HGQBTPJQ.mjs} +4 -4
- package/dist/{loaded-IIHO4UZS.mjs → loaded-I7V7FYES.mjs} +4 -4
- package/dist/no-external.css +530 -471
- package/dist/no-external.js +1287 -865
- package/dist/no-external.mjs +10 -10
- package/dist/rsc.js +30 -9
- package/dist/rsc.mjs +3 -3
- package/package.json +1 -2
package/dist/no-external.js
CHANGED
|
@@ -160,19 +160,29 @@ var init_get_class_name_factory = __esm({
|
|
|
160
160
|
"use strict";
|
|
161
161
|
init_react_import();
|
|
162
162
|
import_classnames = __toESM(require_classnames());
|
|
163
|
-
getClassNameFactory = (rootClass, styles2, config = { baseClass: "" }) => (options = {}) => {
|
|
163
|
+
getClassNameFactory = (rootClass, styles2, config = { baseClass: "" }) => (options = {}, modifiers) => {
|
|
164
164
|
if (typeof options === "string") {
|
|
165
165
|
const descendant = options;
|
|
166
|
-
const
|
|
166
|
+
const baseKey = `${rootClass}-${descendant}`;
|
|
167
|
+
const style = styles2[baseKey];
|
|
168
|
+
if (modifiers) {
|
|
169
|
+
const prefixedModifiers = {};
|
|
170
|
+
for (let modifier in modifiers) {
|
|
171
|
+
prefixedModifiers[styles2[`${baseKey}--${modifier}`]] = modifiers[modifier];
|
|
172
|
+
}
|
|
173
|
+
return config.baseClass + (0, import_classnames.default)(__spreadValues({
|
|
174
|
+
[style]: !!style
|
|
175
|
+
}, prefixedModifiers));
|
|
176
|
+
}
|
|
167
177
|
if (style) {
|
|
168
|
-
return config.baseClass +
|
|
178
|
+
return config.baseClass + style;
|
|
169
179
|
}
|
|
170
180
|
return "";
|
|
171
181
|
} else if (typeof options === "object") {
|
|
172
|
-
const
|
|
182
|
+
const modifiers2 = options;
|
|
173
183
|
const prefixedModifiers = {};
|
|
174
|
-
for (let modifier in
|
|
175
|
-
prefixedModifiers[styles2[`${rootClass}--${modifier}`]] =
|
|
184
|
+
for (let modifier in modifiers2) {
|
|
185
|
+
prefixedModifiers[styles2[`${rootClass}--${modifier}`]] = modifiers2[modifier];
|
|
176
186
|
}
|
|
177
187
|
const c = styles2[rootClass];
|
|
178
188
|
return config.baseClass + (0, import_classnames.default)(__spreadValues({
|
|
@@ -1072,20 +1082,6 @@ var init_sun = __esm({
|
|
|
1072
1082
|
}
|
|
1073
1083
|
});
|
|
1074
1084
|
|
|
1075
|
-
// ../../node_modules/lucide-react/dist/esm/icons/tablet.js
|
|
1076
|
-
var Tablet;
|
|
1077
|
-
var init_tablet = __esm({
|
|
1078
|
-
"../../node_modules/lucide-react/dist/esm/icons/tablet.js"() {
|
|
1079
|
-
"use strict";
|
|
1080
|
-
init_react_import();
|
|
1081
|
-
init_createLucideIcon();
|
|
1082
|
-
Tablet = createLucideIcon("Tablet", [
|
|
1083
|
-
["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
|
|
1084
|
-
["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
|
|
1085
|
-
]);
|
|
1086
|
-
}
|
|
1087
|
-
});
|
|
1088
|
-
|
|
1089
1085
|
// ../../node_modules/lucide-react/dist/esm/icons/toy-brick.js
|
|
1090
1086
|
var ToyBrick;
|
|
1091
1087
|
var init_toy_brick = __esm({
|
|
@@ -1219,7 +1215,6 @@ var init_lucide_react = __esm({
|
|
|
1219
1215
|
init_smartphone();
|
|
1220
1216
|
init_strikethrough();
|
|
1221
1217
|
init_sun();
|
|
1222
|
-
init_tablet();
|
|
1223
1218
|
init_toy_brick();
|
|
1224
1219
|
init_trash();
|
|
1225
1220
|
init_underline();
|
|
@@ -3174,6 +3169,7 @@ var init_default_app_state = __esm({
|
|
|
3174
3169
|
"store/default-app-state.ts"() {
|
|
3175
3170
|
"use strict";
|
|
3176
3171
|
init_react_import();
|
|
3172
|
+
init_default_viewports();
|
|
3177
3173
|
defaultAppState = {
|
|
3178
3174
|
data: { content: [], root: {}, zones: {} },
|
|
3179
3175
|
ui: {
|
|
@@ -3186,9 +3182,10 @@ var init_default_app_state = __esm({
|
|
|
3186
3182
|
isDragging: false,
|
|
3187
3183
|
previewMode: "edit",
|
|
3188
3184
|
viewports: {
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3185
|
+
current: {
|
|
3186
|
+
width: defaultViewports[0].width,
|
|
3187
|
+
height: defaultViewports[0].height || "auto"
|
|
3188
|
+
},
|
|
3192
3189
|
options: [],
|
|
3193
3190
|
controlsVisible: true
|
|
3194
3191
|
},
|
|
@@ -3429,6 +3426,136 @@ var init_store = __esm({
|
|
|
3429
3426
|
}
|
|
3430
3427
|
});
|
|
3431
3428
|
|
|
3429
|
+
// ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
3430
|
+
function invariant(condition, message) {
|
|
3431
|
+
if (condition) {
|
|
3432
|
+
return;
|
|
3433
|
+
}
|
|
3434
|
+
if (isProduction) {
|
|
3435
|
+
throw new Error(prefix);
|
|
3436
|
+
}
|
|
3437
|
+
var provided = typeof message === "function" ? message() : message;
|
|
3438
|
+
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|
3439
|
+
throw new Error(value);
|
|
3440
|
+
}
|
|
3441
|
+
var isProduction, prefix;
|
|
3442
|
+
var init_tiny_invariant = __esm({
|
|
3443
|
+
"../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js"() {
|
|
3444
|
+
"use strict";
|
|
3445
|
+
init_react_import();
|
|
3446
|
+
isProduction = process.env.NODE_ENV === "production";
|
|
3447
|
+
prefix = "Invariant failed";
|
|
3448
|
+
}
|
|
3449
|
+
});
|
|
3450
|
+
|
|
3451
|
+
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
|
3452
|
+
var getRect, expand, shrink, noSpacing, createBox, parse, calculateBox, getBox;
|
|
3453
|
+
var init_css_box_model_esm = __esm({
|
|
3454
|
+
"../../node_modules/css-box-model/dist/css-box-model.esm.js"() {
|
|
3455
|
+
"use strict";
|
|
3456
|
+
init_react_import();
|
|
3457
|
+
init_tiny_invariant();
|
|
3458
|
+
getRect = function getRect2(_ref) {
|
|
3459
|
+
var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
|
|
3460
|
+
var width = right - left;
|
|
3461
|
+
var height = bottom - top;
|
|
3462
|
+
var rect = {
|
|
3463
|
+
top,
|
|
3464
|
+
right,
|
|
3465
|
+
bottom,
|
|
3466
|
+
left,
|
|
3467
|
+
width,
|
|
3468
|
+
height,
|
|
3469
|
+
x: left,
|
|
3470
|
+
y: top,
|
|
3471
|
+
center: {
|
|
3472
|
+
x: (right + left) / 2,
|
|
3473
|
+
y: (bottom + top) / 2
|
|
3474
|
+
}
|
|
3475
|
+
};
|
|
3476
|
+
return rect;
|
|
3477
|
+
};
|
|
3478
|
+
expand = function expand2(target, expandBy) {
|
|
3479
|
+
return {
|
|
3480
|
+
top: target.top - expandBy.top,
|
|
3481
|
+
left: target.left - expandBy.left,
|
|
3482
|
+
bottom: target.bottom + expandBy.bottom,
|
|
3483
|
+
right: target.right + expandBy.right
|
|
3484
|
+
};
|
|
3485
|
+
};
|
|
3486
|
+
shrink = function shrink2(target, shrinkBy) {
|
|
3487
|
+
return {
|
|
3488
|
+
top: target.top + shrinkBy.top,
|
|
3489
|
+
left: target.left + shrinkBy.left,
|
|
3490
|
+
bottom: target.bottom - shrinkBy.bottom,
|
|
3491
|
+
right: target.right - shrinkBy.right
|
|
3492
|
+
};
|
|
3493
|
+
};
|
|
3494
|
+
noSpacing = {
|
|
3495
|
+
top: 0,
|
|
3496
|
+
right: 0,
|
|
3497
|
+
bottom: 0,
|
|
3498
|
+
left: 0
|
|
3499
|
+
};
|
|
3500
|
+
createBox = function createBox2(_ref2) {
|
|
3501
|
+
var borderBox = _ref2.borderBox, _ref2$margin = _ref2.margin, margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin, _ref2$border = _ref2.border, border = _ref2$border === void 0 ? noSpacing : _ref2$border, _ref2$padding = _ref2.padding, padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
|
|
3502
|
+
var marginBox = getRect(expand(borderBox, margin));
|
|
3503
|
+
var paddingBox = getRect(shrink(borderBox, border));
|
|
3504
|
+
var contentBox = getRect(shrink(paddingBox, padding));
|
|
3505
|
+
return {
|
|
3506
|
+
marginBox,
|
|
3507
|
+
borderBox: getRect(borderBox),
|
|
3508
|
+
paddingBox,
|
|
3509
|
+
contentBox,
|
|
3510
|
+
margin,
|
|
3511
|
+
border,
|
|
3512
|
+
padding
|
|
3513
|
+
};
|
|
3514
|
+
};
|
|
3515
|
+
parse = function parse2(raw) {
|
|
3516
|
+
var value = raw.slice(0, -2);
|
|
3517
|
+
var suffix = raw.slice(-2);
|
|
3518
|
+
if (suffix !== "px") {
|
|
3519
|
+
return 0;
|
|
3520
|
+
}
|
|
3521
|
+
var result = Number(value);
|
|
3522
|
+
!!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
|
|
3523
|
+
return result;
|
|
3524
|
+
};
|
|
3525
|
+
calculateBox = function calculateBox2(borderBox, styles2) {
|
|
3526
|
+
var margin = {
|
|
3527
|
+
top: parse(styles2.marginTop),
|
|
3528
|
+
right: parse(styles2.marginRight),
|
|
3529
|
+
bottom: parse(styles2.marginBottom),
|
|
3530
|
+
left: parse(styles2.marginLeft)
|
|
3531
|
+
};
|
|
3532
|
+
var padding = {
|
|
3533
|
+
top: parse(styles2.paddingTop),
|
|
3534
|
+
right: parse(styles2.paddingRight),
|
|
3535
|
+
bottom: parse(styles2.paddingBottom),
|
|
3536
|
+
left: parse(styles2.paddingLeft)
|
|
3537
|
+
};
|
|
3538
|
+
var border = {
|
|
3539
|
+
top: parse(styles2.borderTopWidth),
|
|
3540
|
+
right: parse(styles2.borderRightWidth),
|
|
3541
|
+
bottom: parse(styles2.borderBottomWidth),
|
|
3542
|
+
left: parse(styles2.borderLeftWidth)
|
|
3543
|
+
};
|
|
3544
|
+
return createBox({
|
|
3545
|
+
borderBox,
|
|
3546
|
+
margin,
|
|
3547
|
+
padding,
|
|
3548
|
+
border
|
|
3549
|
+
});
|
|
3550
|
+
};
|
|
3551
|
+
getBox = function getBox2(el) {
|
|
3552
|
+
var borderBox = el.getBoundingClientRect();
|
|
3553
|
+
var styles2 = window.getComputedStyle(el);
|
|
3554
|
+
return calculateBox(borderBox, styles2);
|
|
3555
|
+
};
|
|
3556
|
+
}
|
|
3557
|
+
});
|
|
3558
|
+
|
|
3432
3559
|
// lib/get-zoom-config.ts
|
|
3433
3560
|
var init_get_zoom_config = __esm({
|
|
3434
3561
|
"lib/get-zoom-config.ts"() {
|
|
@@ -7805,7 +7932,7 @@ var import_react_router3 = require("react-router");
|
|
|
7805
7932
|
|
|
7806
7933
|
// components/Editor/index.tsx
|
|
7807
7934
|
init_react_import();
|
|
7808
|
-
var
|
|
7935
|
+
var import_react95 = require("react");
|
|
7809
7936
|
init_store();
|
|
7810
7937
|
|
|
7811
7938
|
// components/Editor/components/Fields/index.tsx
|
|
@@ -11862,55 +11989,12 @@ function AutoFrame(_a) {
|
|
|
11862
11989
|
}
|
|
11863
11990
|
}
|
|
11864
11991
|
}, [frameRef, loaded, stylesLoaded]);
|
|
11865
|
-
(0, import_react77.useEffect)(() => {
|
|
11866
|
-
const doc = ctx.document;
|
|
11867
|
-
const iframeEl = frameRef.current;
|
|
11868
|
-
if (!doc || !iframeEl || !stylesLoaded) return;
|
|
11869
|
-
let scheduled = false;
|
|
11870
|
-
const update = () => {
|
|
11871
|
-
if (scheduled) return;
|
|
11872
|
-
scheduled = true;
|
|
11873
|
-
requestAnimationFrame(() => {
|
|
11874
|
-
scheduled = false;
|
|
11875
|
-
const html = doc.documentElement;
|
|
11876
|
-
const body = doc.body;
|
|
11877
|
-
if (!html || !body) return;
|
|
11878
|
-
iframeEl.style.height = "0px";
|
|
11879
|
-
const height = Math.max(
|
|
11880
|
-
body.scrollHeight,
|
|
11881
|
-
body.offsetHeight,
|
|
11882
|
-
html.scrollHeight,
|
|
11883
|
-
html.offsetHeight
|
|
11884
|
-
);
|
|
11885
|
-
if (height > 0) {
|
|
11886
|
-
iframeEl.style.height = `${height}px`;
|
|
11887
|
-
}
|
|
11888
|
-
});
|
|
11889
|
-
};
|
|
11890
|
-
update();
|
|
11891
|
-
const observer = new ResizeObserver(update);
|
|
11892
|
-
observer.observe(doc.body);
|
|
11893
|
-
observer.observe(doc.documentElement);
|
|
11894
|
-
const iframeObserver = new ResizeObserver(update);
|
|
11895
|
-
iframeObserver.observe(iframeEl);
|
|
11896
|
-
const mutationObserver = new MutationObserver(update);
|
|
11897
|
-
mutationObserver.observe(doc.body, {
|
|
11898
|
-
attributes: true,
|
|
11899
|
-
childList: true,
|
|
11900
|
-
subtree: true
|
|
11901
|
-
});
|
|
11902
|
-
return () => {
|
|
11903
|
-
observer.disconnect();
|
|
11904
|
-
iframeObserver.disconnect();
|
|
11905
|
-
mutationObserver.disconnect();
|
|
11906
|
-
};
|
|
11907
|
-
}, [ctx.document, frameRef, stylesLoaded]);
|
|
11908
11992
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11909
11993
|
"iframe",
|
|
11910
11994
|
__spreadProps(__spreadValues({}, props), {
|
|
11911
11995
|
className,
|
|
11912
11996
|
id,
|
|
11913
|
-
srcDoc: '<!DOCTYPE html><html><head
|
|
11997
|
+
srcDoc: '<!DOCTYPE html><html><head></head><body><div id="frame-root" data-editor-entry></div></body></html>',
|
|
11914
11998
|
ref: frameRef,
|
|
11915
11999
|
onLoad: () => {
|
|
11916
12000
|
setLoaded(true);
|
|
@@ -11931,7 +12015,7 @@ var AutoFrame_default = AutoFrame;
|
|
|
11931
12015
|
|
|
11932
12016
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Preview/styles.module.css#css-module
|
|
11933
12017
|
init_react_import();
|
|
11934
|
-
var styles_module_default23 = { "EditorPreview": "
|
|
12018
|
+
var styles_module_default23 = { "EditorPreview": "_EditorPreview_1ybfe_1", "EditorPreview-frame": "_EditorPreview-frame_1ybfe_6" };
|
|
11935
12019
|
|
|
11936
12020
|
// components/Editor/components/Preview/index.tsx
|
|
11937
12021
|
init_lib();
|
|
@@ -12893,12 +12977,12 @@ init_to_component();
|
|
|
12893
12977
|
|
|
12894
12978
|
// components/Editor/components/Layout/index.tsx
|
|
12895
12979
|
init_react_import();
|
|
12896
|
-
var
|
|
12980
|
+
var import_react94 = require("react");
|
|
12897
12981
|
init_lib();
|
|
12898
12982
|
|
|
12899
12983
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Layout/styles.module.css#css-module
|
|
12900
12984
|
init_react_import();
|
|
12901
|
-
var styles_module_default25 = { "Editor": "
|
|
12985
|
+
var styles_module_default25 = { "Editor": "_Editor_l0swf_19", "Editor-portal": "_Editor-portal_l0swf_32", "EditorLayout": "_EditorLayout_l0swf_37", "EditorLayout-inner": "_EditorLayout-inner_l0swf_41", "Editor--hidePlugins": "_Editor--hidePlugins_l0swf_72", "EditorLayout--navBarVisible": "_EditorLayout--navBarVisible_l0swf_73", "EditorLayout--mounted": "_EditorLayout--mounted_l0swf_82", "EditorLayout--mobilePanelHeightToggle": "_EditorLayout--mobilePanelHeightToggle_l0swf_86", "EditorLayout--leftSideBarVisible": "_EditorLayout--leftSideBarVisible_l0swf_86", "EditorLayout--mobilePanelCustomHeight": "_EditorLayout--mobilePanelCustomHeight_l0swf_91", "EditorLayout--mobilePanelHeightMinContent": "_EditorLayout--mobilePanelHeightMinContent_l0swf_109", "EditorLayout--rightSideBarVisible": "_EditorLayout--rightSideBarVisible_l0swf_129", "EditorLayout-mounted": "_EditorLayout-mounted_l0swf_146", "EditorLayout-header": "_EditorLayout-header_l0swf_187", "EditorHeader": "_EditorHeader_l0swf_194", "EditorHeader-plugins": "_EditorHeader-plugins_l0swf_221", "EditorHeader-pluginItem": "_EditorHeader-pluginItem_l0swf_235", "EditorHeader-pluginItem--mobileOnly": "_EditorHeader-pluginItem--mobileOnly_l0swf_241", "EditorHeader-pluginItem--desktopOnly": "_EditorHeader-pluginItem--desktopOnly_l0swf_246", "EditorHeader-urlBarSlot": "_EditorHeader-urlBarSlot_l0swf_256", "EditorHeader-actions": "_EditorHeader-actions_l0swf_274", "EditorHeader-history": "_EditorHeader-history_l0swf_282", "EditorLayout-mobilePanel": "_EditorLayout-mobilePanel_l0swf_288", "EditorLayout-mobilePanelContent": "_EditorLayout-mobilePanelContent_l0swf_308", "EditorLayout-mobileDragHandle": "_EditorLayout-mobileDragHandle_l0swf_315", "EditorLayout-mobileDragHandlePill": "_EditorLayout-mobileDragHandlePill_l0swf_329", "EditorPluginTab": "_EditorPluginTab_l0swf_336", "EditorPluginTab--visible": "_EditorPluginTab--visible_l0swf_342", "EditorPluginTab-body": "_EditorPluginTab-body_l0swf_347" };
|
|
12902
12986
|
|
|
12903
12987
|
// lib/use-inject-css.ts
|
|
12904
12988
|
init_react_import();
|
|
@@ -13063,12 +13147,10 @@ var SidebarSection = ({
|
|
|
13063
13147
|
noBorderTop,
|
|
13064
13148
|
isLoading
|
|
13065
13149
|
}) => {
|
|
13066
|
-
const showTitleBar = title !== null && title !== void 0;
|
|
13067
|
-
const showBreadcrumbsRow = !!showBreadcrumbs;
|
|
13068
13150
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: getClassName34({ noBorderTop }), style: { background }, children: [
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
13151
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: getClassName34("title"), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: getClassName34("breadcrumbs"), children: [
|
|
13152
|
+
showBreadcrumbs && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Breadcrumbs, {}),
|
|
13153
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: getClassName34("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Heading7, { rank: "2", size: "xs", children: title }) })
|
|
13072
13154
|
] }) }),
|
|
13073
13155
|
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: getClassName34("content"), children }),
|
|
13074
13156
|
isLoading && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: getClassName34("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Loader, { size: 32 }) })
|
|
@@ -13077,14 +13159,269 @@ var SidebarSection = ({
|
|
|
13077
13159
|
|
|
13078
13160
|
// components/Editor/components/Canvas/index.tsx
|
|
13079
13161
|
init_react_import();
|
|
13080
|
-
|
|
13162
|
+
init_css_box_model_esm();
|
|
13163
|
+
var import_react89 = require("react");
|
|
13164
|
+
init_lucide_react();
|
|
13165
|
+
init_store();
|
|
13166
|
+
|
|
13167
|
+
// components/BrowserBar/index.tsx
|
|
13168
|
+
init_react_import();
|
|
13081
13169
|
init_lucide_react();
|
|
13082
|
-
var
|
|
13170
|
+
var import_react87 = require("react");
|
|
13083
13171
|
init_store();
|
|
13172
|
+
init_lib();
|
|
13173
|
+
init_IconButton2();
|
|
13174
|
+
|
|
13175
|
+
// components/ui/Combobox/index.tsx
|
|
13176
|
+
init_react_import();
|
|
13177
|
+
var import_react86 = require("@base-ui/react");
|
|
13178
|
+
init_lucide_react();
|
|
13179
|
+
init_lib();
|
|
13180
|
+
|
|
13181
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ui/Combobox/styles.module.css#css-module
|
|
13182
|
+
init_react_import();
|
|
13183
|
+
var styles_module_default28 = { "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" };
|
|
13184
|
+
|
|
13185
|
+
// components/ui/Combobox/index.tsx
|
|
13186
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
13187
|
+
var getClassName35 = get_class_name_factory_default("EditorCombobox", styles_module_default28);
|
|
13188
|
+
var join = (...values) => values.filter(Boolean).join(" ");
|
|
13189
|
+
var mergeClassName = (base, override) => {
|
|
13190
|
+
if (!override) return base;
|
|
13191
|
+
if (typeof override === "function") {
|
|
13192
|
+
return (state) => join(base, override(state));
|
|
13193
|
+
}
|
|
13194
|
+
return join(base, override);
|
|
13195
|
+
};
|
|
13196
|
+
var Combobox = import_react86.Combobox.Root;
|
|
13197
|
+
function ComboboxInput(_a) {
|
|
13198
|
+
var _b = _a, {
|
|
13199
|
+
className
|
|
13200
|
+
} = _b, props = __objRest(_b, [
|
|
13201
|
+
"className"
|
|
13202
|
+
]);
|
|
13203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
13204
|
+
import_react86.Combobox.Input,
|
|
13205
|
+
__spreadValues({
|
|
13206
|
+
"data-slot": "combobox-input",
|
|
13207
|
+
className: mergeClassName(getClassName35("input"), className)
|
|
13208
|
+
}, props)
|
|
13209
|
+
);
|
|
13210
|
+
}
|
|
13211
|
+
function ComboboxContent(_a) {
|
|
13212
|
+
var _b = _a, {
|
|
13213
|
+
className,
|
|
13214
|
+
side = "bottom",
|
|
13215
|
+
sideOffset = 4,
|
|
13216
|
+
align = "start",
|
|
13217
|
+
alignOffset = 0,
|
|
13218
|
+
children
|
|
13219
|
+
} = _b, props = __objRest(_b, [
|
|
13220
|
+
"className",
|
|
13221
|
+
"side",
|
|
13222
|
+
"sideOffset",
|
|
13223
|
+
"align",
|
|
13224
|
+
"alignOffset",
|
|
13225
|
+
"children"
|
|
13226
|
+
]);
|
|
13227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_react86.Combobox.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
13228
|
+
import_react86.Combobox.Positioner,
|
|
13229
|
+
{
|
|
13230
|
+
side,
|
|
13231
|
+
sideOffset,
|
|
13232
|
+
align,
|
|
13233
|
+
alignOffset,
|
|
13234
|
+
className: getClassName35("positioner"),
|
|
13235
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
13236
|
+
import_react86.Combobox.Popup,
|
|
13237
|
+
__spreadProps(__spreadValues({
|
|
13238
|
+
"data-slot": "combobox-content",
|
|
13239
|
+
className: mergeClassName(getClassName35("content"), className)
|
|
13240
|
+
}, props), {
|
|
13241
|
+
children
|
|
13242
|
+
})
|
|
13243
|
+
)
|
|
13244
|
+
}
|
|
13245
|
+
) });
|
|
13246
|
+
}
|
|
13247
|
+
function ComboboxList(_a) {
|
|
13248
|
+
var _b = _a, {
|
|
13249
|
+
className
|
|
13250
|
+
} = _b, props = __objRest(_b, [
|
|
13251
|
+
"className"
|
|
13252
|
+
]);
|
|
13253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
13254
|
+
import_react86.Combobox.List,
|
|
13255
|
+
__spreadValues({
|
|
13256
|
+
"data-slot": "combobox-list",
|
|
13257
|
+
className: mergeClassName(getClassName35("list"), className)
|
|
13258
|
+
}, props)
|
|
13259
|
+
);
|
|
13260
|
+
}
|
|
13261
|
+
function ComboboxItem(_a) {
|
|
13262
|
+
var _b = _a, {
|
|
13263
|
+
className,
|
|
13264
|
+
children
|
|
13265
|
+
} = _b, props = __objRest(_b, [
|
|
13266
|
+
"className",
|
|
13267
|
+
"children"
|
|
13268
|
+
]);
|
|
13269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
13270
|
+
import_react86.Combobox.Item,
|
|
13271
|
+
__spreadProps(__spreadValues({
|
|
13272
|
+
"data-slot": "combobox-item",
|
|
13273
|
+
className: mergeClassName(getClassName35("item"), className)
|
|
13274
|
+
}, props), {
|
|
13275
|
+
children: [
|
|
13276
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: getClassName35("itemIndicator"), children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_react86.Combobox.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Check, { size: 14 }) }) }),
|
|
13277
|
+
children
|
|
13278
|
+
]
|
|
13279
|
+
})
|
|
13280
|
+
);
|
|
13281
|
+
}
|
|
13282
|
+
function ComboboxEmpty(_a) {
|
|
13283
|
+
var _b = _a, {
|
|
13284
|
+
className
|
|
13285
|
+
} = _b, props = __objRest(_b, [
|
|
13286
|
+
"className"
|
|
13287
|
+
]);
|
|
13288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
13289
|
+
import_react86.Combobox.Empty,
|
|
13290
|
+
__spreadValues({
|
|
13291
|
+
"data-slot": "combobox-empty",
|
|
13292
|
+
className: mergeClassName(getClassName35("empty"), className)
|
|
13293
|
+
}, props)
|
|
13294
|
+
);
|
|
13295
|
+
}
|
|
13296
|
+
|
|
13297
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/BrowserBar/styles.module.css#css-module
|
|
13298
|
+
init_react_import();
|
|
13299
|
+
var styles_module_default29 = { "BrowserBar": "_BrowserBar_glswb_1", "BrowserBar-urlTrigger": "_BrowserBar-urlTrigger_glswb_16", "BrowserBar-urlIcon": "_BrowserBar-urlIcon_glswb_46", "BrowserBar-urlText": "_BrowserBar-urlText_glswb_51", "BrowserBar-urlInput": "_BrowserBar-urlInput_glswb_63", "BrowserBar-itemPath": "_BrowserBar-itemPath_glswb_69", "BrowserBar-itemTitle": "_BrowserBar-itemTitle_glswb_74", "BrowserBar-actions": "_BrowserBar-actions_glswb_82", "BrowserBar-deviceIcon": "_BrowserBar-deviceIcon_glswb_92" };
|
|
13300
|
+
|
|
13301
|
+
// components/BrowserBar/index.tsx
|
|
13302
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
13303
|
+
var normalizeRoute = (raw) => {
|
|
13304
|
+
const trimmed = raw.trim();
|
|
13305
|
+
if (!trimmed) return trimmed;
|
|
13306
|
+
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
13307
|
+
};
|
|
13308
|
+
var getClassName36 = get_class_name_factory_default("BrowserBar", styles_module_default29);
|
|
13309
|
+
var DEVICE_VIEWPORTS = {
|
|
13310
|
+
desktop: { width: "100%", height: "auto", icon: "Monitor", label: "Desktop" },
|
|
13311
|
+
mobile: { width: 360, height: "auto", icon: "Smartphone", label: "Mobile" }
|
|
13312
|
+
};
|
|
13313
|
+
var UrlBar = () => {
|
|
13314
|
+
const { routes, currentRoute, onRouteChange } = usePropsContext();
|
|
13315
|
+
const chrome = useChromeConfig();
|
|
13316
|
+
const showRoutePicker = !!routes && currentRoute !== void 0 && !!onRouteChange;
|
|
13317
|
+
const [inputValue, setInputValue] = (0, import_react87.useState)(currentRoute != null ? currentRoute : "");
|
|
13318
|
+
const lastSyncedPath = (0, import_react87.useRef)(currentRoute);
|
|
13319
|
+
if (lastSyncedPath.current !== currentRoute) {
|
|
13320
|
+
lastSyncedPath.current = currentRoute;
|
|
13321
|
+
setInputValue(currentRoute != null ? currentRoute : "");
|
|
13322
|
+
}
|
|
13323
|
+
const submit = (raw) => {
|
|
13324
|
+
const next = normalizeRoute(raw);
|
|
13325
|
+
if (!next || next === currentRoute) return;
|
|
13326
|
+
void (onRouteChange == null ? void 0 : onRouteChange(next));
|
|
13327
|
+
};
|
|
13328
|
+
if (!chrome.showUrlBar) return null;
|
|
13329
|
+
if (showRoutePicker) {
|
|
13330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
13331
|
+
Combobox,
|
|
13332
|
+
{
|
|
13333
|
+
items: routes,
|
|
13334
|
+
value: currentRoute,
|
|
13335
|
+
onValueChange: (next) => {
|
|
13336
|
+
if (typeof next === "string") submit(next);
|
|
13337
|
+
},
|
|
13338
|
+
inputValue,
|
|
13339
|
+
onInputValueChange: (next) => setInputValue(next),
|
|
13340
|
+
autoHighlight: false,
|
|
13341
|
+
children: [
|
|
13342
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
13343
|
+
"form",
|
|
13344
|
+
{
|
|
13345
|
+
className: getClassName36("urlTrigger"),
|
|
13346
|
+
onSubmit: (event) => {
|
|
13347
|
+
event.preventDefault();
|
|
13348
|
+
submit(inputValue);
|
|
13349
|
+
},
|
|
13350
|
+
children: [
|
|
13351
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Globe, { className: getClassName36("urlIcon"), size: 14 }),
|
|
13352
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13353
|
+
ComboboxInput,
|
|
13354
|
+
{
|
|
13355
|
+
className: getClassName36("urlInput"),
|
|
13356
|
+
placeholder: "/",
|
|
13357
|
+
spellCheck: false,
|
|
13358
|
+
autoCorrect: "off",
|
|
13359
|
+
autoCapitalize: "off"
|
|
13360
|
+
}
|
|
13361
|
+
)
|
|
13362
|
+
]
|
|
13363
|
+
}
|
|
13364
|
+
),
|
|
13365
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(ComboboxContent, { children: [
|
|
13366
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ComboboxEmpty, { children: "Press Enter to go to this path" }),
|
|
13367
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ComboboxList, { children: (path) => /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ComboboxItem, { value: path, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: getClassName36("itemPath"), children: path }) }, path) })
|
|
13368
|
+
] })
|
|
13369
|
+
]
|
|
13370
|
+
}
|
|
13371
|
+
);
|
|
13372
|
+
}
|
|
13373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: getClassName36("urlTrigger"), children: [
|
|
13374
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Globe, { className: getClassName36("urlIcon"), size: 14 }),
|
|
13375
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: getClassName36("urlText"), children: "/" })
|
|
13376
|
+
] });
|
|
13377
|
+
};
|
|
13378
|
+
var DeviceToggle = ({
|
|
13379
|
+
onViewportChange
|
|
13380
|
+
}) => {
|
|
13381
|
+
const chrome = useChromeConfig();
|
|
13382
|
+
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
13383
|
+
const activeDevice = (0, import_react87.useMemo)(() => {
|
|
13384
|
+
const w = viewports.current.width;
|
|
13385
|
+
if (typeof w === "number" && w <= 640) return "mobile";
|
|
13386
|
+
return "desktop";
|
|
13387
|
+
}, [viewports.current.width]);
|
|
13388
|
+
if (!chrome.showDeviceToggle) return null;
|
|
13389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13390
|
+
IconButton,
|
|
13391
|
+
{
|
|
13392
|
+
type: "button",
|
|
13393
|
+
title: activeDevice === "desktop" ? "Switch to mobile viewport" : "Switch to desktop viewport",
|
|
13394
|
+
onClick: () => onViewportChange == null ? void 0 : onViewportChange(
|
|
13395
|
+
DEVICE_VIEWPORTS[activeDevice === "desktop" ? "mobile" : "desktop"]
|
|
13396
|
+
),
|
|
13397
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: getClassName36("deviceIcon"), children: activeDevice === "desktop" ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Monitor, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Smartphone, { size: 14 }) })
|
|
13398
|
+
}
|
|
13399
|
+
);
|
|
13400
|
+
};
|
|
13401
|
+
var FullScreenToggle = () => {
|
|
13402
|
+
const chrome = useChromeConfig();
|
|
13403
|
+
const dispatch = useAppStore((s) => s.dispatch);
|
|
13404
|
+
const isFullScreen = useAppStore(
|
|
13405
|
+
(s) => {
|
|
13406
|
+
var _a;
|
|
13407
|
+
return (_a = s.state.ui.canvasFullScreen) != null ? _a : false;
|
|
13408
|
+
}
|
|
13409
|
+
);
|
|
13410
|
+
if (!chrome.showFullScreenToggle) return null;
|
|
13411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13412
|
+
IconButton,
|
|
13413
|
+
{
|
|
13414
|
+
type: "button",
|
|
13415
|
+
title: isFullScreen ? "Exit full screen" : "Enter full screen",
|
|
13416
|
+
onClick: () => dispatch({ type: "setUi", ui: { canvasFullScreen: !isFullScreen } }),
|
|
13417
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: getClassName36("deviceIcon"), children: isFullScreen ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Minimize, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Maximize, { size: 14 }) })
|
|
13418
|
+
}
|
|
13419
|
+
);
|
|
13420
|
+
};
|
|
13084
13421
|
|
|
13085
13422
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Canvas/styles.module.css#css-module
|
|
13086
13423
|
init_react_import();
|
|
13087
|
-
var
|
|
13424
|
+
var styles_module_default30 = { "EditorCanvas": "_EditorCanvas_10xv6_1", "EditorCanvas--fullScreen": "_EditorCanvas--fullScreen_10xv6_24", "EditorCanvas--canvasFullScreen": "_EditorCanvas--canvasFullScreen_10xv6_40", "EditorCanvas-inner": "_EditorCanvas-inner_10xv6_47", "EditorCanvas-rootColumn": "_EditorCanvas-rootColumn_10xv6_56", "EditorCanvas-root": "_EditorCanvas-root_10xv6_56", "EditorCanvas--ready": "_EditorCanvas--ready_10xv6_93", "EditorCanvas-loader": "_EditorCanvas-loader_10xv6_98", "EditorCanvas--showLoader": "_EditorCanvas--showLoader_10xv6_110", "EditorCanvas-bottomBar": "_EditorCanvas-bottomBar_10xv6_119", "EditorCanvas-bottomBarPill": "_EditorCanvas-bottomBarPill_10xv6_131", "EditorCanvas-bottomBarDivider": "_EditorCanvas-bottomBarDivider_10xv6_144", "EditorCanvas-zoomLevel": "_EditorCanvas-zoomLevel_10xv6_151" };
|
|
13088
13425
|
|
|
13089
13426
|
// components/Editor/components/Canvas/index.tsx
|
|
13090
13427
|
init_lib();
|
|
@@ -13094,77 +13431,56 @@ var import_shallow9 = require("zustand/react/shallow");
|
|
|
13094
13431
|
|
|
13095
13432
|
// lib/frame-context.tsx
|
|
13096
13433
|
init_react_import();
|
|
13097
|
-
var
|
|
13098
|
-
var
|
|
13099
|
-
var FrameContext = (0,
|
|
13434
|
+
var import_react88 = require("react");
|
|
13435
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
13436
|
+
var FrameContext = (0, import_react88.createContext)(null);
|
|
13100
13437
|
var FrameProvider = ({
|
|
13101
13438
|
children
|
|
13102
13439
|
}) => {
|
|
13103
|
-
const frameRef = (0,
|
|
13104
|
-
const value = (0,
|
|
13440
|
+
const frameRef = (0, import_react88.useRef)(null);
|
|
13441
|
+
const value = (0, import_react88.useMemo)(
|
|
13105
13442
|
() => ({
|
|
13106
13443
|
frameRef
|
|
13107
13444
|
}),
|
|
13108
13445
|
[]
|
|
13109
13446
|
);
|
|
13110
|
-
return /* @__PURE__ */ (0,
|
|
13447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(FrameContext.Provider, { value, children });
|
|
13111
13448
|
};
|
|
13112
13449
|
var useCanvasFrame = () => {
|
|
13113
|
-
const context = (0,
|
|
13450
|
+
const context = (0, import_react88.useContext)(FrameContext);
|
|
13114
13451
|
if (context === null) {
|
|
13115
13452
|
throw new Error("useCanvasFrame must be used within a FrameProvider");
|
|
13116
13453
|
}
|
|
13117
13454
|
return context;
|
|
13118
13455
|
};
|
|
13119
13456
|
|
|
13120
|
-
// lib/theme-context.tsx
|
|
13121
|
-
init_react_import();
|
|
13122
|
-
var import_react87 = require("react");
|
|
13123
|
-
var ThemeContext = (0, import_react87.createContext)({
|
|
13124
|
-
theme: "light",
|
|
13125
|
-
toggleTheme: () => {
|
|
13126
|
-
}
|
|
13127
|
-
});
|
|
13128
|
-
var useEditorTheme = () => (0, import_react87.useContext)(ThemeContext);
|
|
13129
|
-
|
|
13130
13457
|
// components/Editor/components/Canvas/index.tsx
|
|
13131
|
-
|
|
13132
|
-
var
|
|
13458
|
+
init_default_viewports();
|
|
13459
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
13460
|
+
var getClassName37 = get_class_name_factory_default("EditorCanvas", styles_module_default30);
|
|
13461
|
+
var ZOOM_STEP = 0.15;
|
|
13133
13462
|
var MIN_ZOOM = 0.25;
|
|
13134
13463
|
var MAX_ZOOM = 3;
|
|
13135
|
-
var
|
|
13136
|
-
var
|
|
13137
|
-
|
|
13138
|
-
|
|
13139
|
-
|
|
13140
|
-
}
|
|
13141
|
-
var
|
|
13142
|
-
var DEVICE_ICONS = {
|
|
13143
|
-
desktop: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Monitor, { size: 14 }),
|
|
13144
|
-
tablet: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Tablet, { size: 14 }),
|
|
13145
|
-
mobile: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Smartphone, { size: 14 })
|
|
13146
|
-
};
|
|
13147
|
-
var ZoomConfigSync = () => {
|
|
13148
|
-
const appStoreApi = useAppStoreApi();
|
|
13149
|
-
(0, import_react_zoom_pan_pinch.useTransformEffect)((ref) => {
|
|
13150
|
-
const { zoomConfig, setZoomConfig } = appStoreApi.getState();
|
|
13151
|
-
if (zoomConfig.zoom !== ref.state.scale) {
|
|
13152
|
-
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom: ref.state.scale }));
|
|
13153
|
-
}
|
|
13154
|
-
});
|
|
13155
|
-
return null;
|
|
13156
|
-
};
|
|
13157
|
-
var ZoomLevel = ({ className }) => {
|
|
13158
|
-
const scale = (0, import_react_zoom_pan_pinch.useTransformComponent)((ctx) => ctx.state.scale);
|
|
13159
|
-
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className, children: `${Math.round(scale * 100)}%` });
|
|
13160
|
-
};
|
|
13161
|
-
var Canvas = () => {
|
|
13464
|
+
var TRANSITION_DURATION = 150;
|
|
13465
|
+
var Canvas = ({
|
|
13466
|
+
themeIcon,
|
|
13467
|
+
themeLabel,
|
|
13468
|
+
onToggleTheme
|
|
13469
|
+
} = {}) => {
|
|
13470
|
+
var _a, _b;
|
|
13162
13471
|
const { frameRef } = useCanvasFrame();
|
|
13163
|
-
const
|
|
13472
|
+
const chrome = useChromeConfig();
|
|
13473
|
+
const {
|
|
13474
|
+
viewports: viewportOptions = defaultViewports,
|
|
13475
|
+
ui: uiProp,
|
|
13476
|
+
disableZoomControls
|
|
13477
|
+
} = usePropsContext();
|
|
13164
13478
|
const {
|
|
13165
13479
|
dispatch,
|
|
13166
13480
|
overrides,
|
|
13167
13481
|
setUi,
|
|
13482
|
+
zoomConfig,
|
|
13483
|
+
setZoomConfig,
|
|
13168
13484
|
status,
|
|
13169
13485
|
iframe,
|
|
13170
13486
|
fullScreenCanvas
|
|
@@ -13173,6 +13489,8 @@ var Canvas = () => {
|
|
|
13173
13489
|
dispatch: s.dispatch,
|
|
13174
13490
|
overrides: s.overrides,
|
|
13175
13491
|
setUi: s.setUi,
|
|
13492
|
+
zoomConfig: s.zoomConfig,
|
|
13493
|
+
setZoomConfig: s.setZoomConfig,
|
|
13176
13494
|
status: s.status,
|
|
13177
13495
|
iframe: s.iframe,
|
|
13178
13496
|
fullScreenCanvas: s.fullScreenCanvas
|
|
@@ -13181,203 +13499,143 @@ var Canvas = () => {
|
|
|
13181
13499
|
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
13182
13500
|
const canvasFullScreen = useAppStore(
|
|
13183
13501
|
(s) => {
|
|
13184
|
-
var
|
|
13185
|
-
return (
|
|
13502
|
+
var _a2;
|
|
13503
|
+
return (_a2 = s.state.ui.canvasFullScreen) != null ? _a2 : false;
|
|
13186
13504
|
}
|
|
13187
13505
|
);
|
|
13188
|
-
const
|
|
13189
|
-
const
|
|
13190
|
-
const
|
|
13191
|
-
|
|
13192
|
-
|
|
13193
|
-
);
|
|
13194
|
-
const
|
|
13195
|
-
const
|
|
13196
|
-
if (w === "100%") return "desktop";
|
|
13197
|
-
if (typeof w === "number" && w <= 640) return "mobile";
|
|
13198
|
-
return "tablet";
|
|
13199
|
-
}, [viewports.current.width]);
|
|
13200
|
-
const cycleDevice = (0, import_react88.useCallback)(() => {
|
|
13201
|
-
const next = DEVICE_ORDER[(DEVICE_ORDER.indexOf(activeDevice) + 1) % DEVICE_ORDER.length];
|
|
13202
|
-
const v = DEVICE_VIEWPORTS[next];
|
|
13203
|
-
setUi({
|
|
13204
|
-
viewports: __spreadProps(__spreadValues({}, viewports), {
|
|
13205
|
-
current: { width: v.width, height: v.height }
|
|
13206
|
-
})
|
|
13207
|
-
});
|
|
13208
|
-
}, [activeDevice, setUi, viewports]);
|
|
13209
|
-
const nextDeviceLabel = DEVICE_VIEWPORTS[DEVICE_ORDER[(DEVICE_ORDER.indexOf(activeDevice) + 1) % DEVICE_ORDER.length]].label;
|
|
13210
|
-
const transformRef = (0, import_react88.useRef)(null);
|
|
13211
|
-
const defaultRender = (0, import_react88.useMemo)(() => {
|
|
13212
|
-
const EditorDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_jsx_runtime84.Fragment, { children });
|
|
13506
|
+
const [canvasZoom, setCanvasZoom] = (0, import_react89.useState)(1);
|
|
13507
|
+
const zoomIn = () => setCanvasZoom((z) => Math.min(z + ZOOM_STEP, MAX_ZOOM));
|
|
13508
|
+
const zoomOut = () => setCanvasZoom((z) => Math.max(z - ZOOM_STEP, MIN_ZOOM));
|
|
13509
|
+
const resetZoom = () => setCanvasZoom(1);
|
|
13510
|
+
const [showTransition, setShowTransition] = (0, import_react89.useState)(false);
|
|
13511
|
+
const isResizingRef = (0, import_react89.useRef)(false);
|
|
13512
|
+
const defaultRender = (0, import_react89.useMemo)(() => {
|
|
13513
|
+
const EditorDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_jsx_runtime86.Fragment, { children });
|
|
13213
13514
|
return EditorDefault;
|
|
13214
13515
|
}, []);
|
|
13215
|
-
const CustomPreview = (0,
|
|
13516
|
+
const CustomPreview = (0, import_react89.useMemo)(
|
|
13216
13517
|
() => overrides.preview || defaultRender,
|
|
13217
13518
|
[overrides]
|
|
13218
13519
|
);
|
|
13219
|
-
const
|
|
13220
|
-
|
|
13520
|
+
const getFrameDimensions = (0, import_react89.useCallback)(() => {
|
|
13521
|
+
if (frameRef.current) {
|
|
13522
|
+
const frame = frameRef.current;
|
|
13523
|
+
const box = getBox(frame);
|
|
13524
|
+
return { width: box.contentBox.width, height: box.contentBox.height };
|
|
13525
|
+
}
|
|
13526
|
+
return { width: 0, height: 0 };
|
|
13527
|
+
}, [frameRef]);
|
|
13528
|
+
(0, import_react89.useEffect)(() => {
|
|
13529
|
+
const { height: frameHeight } = getFrameDimensions();
|
|
13530
|
+
if (viewports.current.height === "auto") {
|
|
13531
|
+
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom: 1, rootHeight: frameHeight }));
|
|
13532
|
+
}
|
|
13533
|
+
}, [getFrameDimensions, setZoomConfig, viewports.current.height]);
|
|
13534
|
+
const [showLoader, setShowLoader] = (0, import_react89.useState)(false);
|
|
13535
|
+
(0, import_react89.useEffect)(() => {
|
|
13221
13536
|
setTimeout(() => {
|
|
13222
13537
|
setShowLoader(true);
|
|
13223
13538
|
}, 500);
|
|
13224
13539
|
}, []);
|
|
13225
|
-
const
|
|
13226
|
-
|
|
13227
|
-
|
|
13228
|
-
|
|
13229
|
-
|
|
13230
|
-
|
|
13231
|
-
|
|
13232
|
-
|
|
13233
|
-
|
|
13234
|
-
|
|
13235
|
-
|
|
13236
|
-
|
|
13237
|
-
});
|
|
13238
|
-
});
|
|
13239
|
-
return () => {
|
|
13240
|
-
canceled = true;
|
|
13241
|
-
};
|
|
13242
|
-
}, []);
|
|
13243
|
-
(0, import_react88.useEffect)(() => {
|
|
13244
|
-
return centerFrame();
|
|
13245
|
-
}, [centerFrame, viewports.current.width]);
|
|
13246
|
-
const handleZoomIn = (0, import_react88.useCallback)(
|
|
13247
|
-
() => {
|
|
13248
|
-
var _a;
|
|
13249
|
-
return (_a = transformRef.current) == null ? void 0 : _a.zoomIn();
|
|
13250
|
-
},
|
|
13251
|
-
[]
|
|
13252
|
-
);
|
|
13253
|
-
const handleZoomOut = (0, import_react88.useCallback)(
|
|
13254
|
-
() => {
|
|
13255
|
-
var _a;
|
|
13256
|
-
return (_a = transformRef.current) == null ? void 0 : _a.zoomOut();
|
|
13257
|
-
},
|
|
13258
|
-
[]
|
|
13259
|
-
);
|
|
13260
|
-
const handleResetZoom = (0, import_react88.useCallback)(() => {
|
|
13261
|
-
centerFrame();
|
|
13262
|
-
}, [centerFrame]);
|
|
13263
|
-
(0, import_react88.useEffect)(() => {
|
|
13264
|
-
var _a;
|
|
13265
|
-
const handler = (e) => {
|
|
13266
|
-
var _a2;
|
|
13267
|
-
e.preventDefault();
|
|
13268
|
-
const ref = transformRef.current;
|
|
13269
|
-
if (!ref) return;
|
|
13270
|
-
const isPinch = e.ctrlKey || e.metaKey;
|
|
13271
|
-
if (isPinch) {
|
|
13272
|
-
const wrapper = ref.instance.wrapperComponent;
|
|
13273
|
-
if (!wrapper) return;
|
|
13274
|
-
const factor = e.deltaY < 0 ? 1.05 : 1 / 1.05;
|
|
13275
|
-
const currentScale = ref.state.scale;
|
|
13276
|
-
const newScale = Math.max(
|
|
13277
|
-
MIN_ZOOM,
|
|
13278
|
-
Math.min(MAX_ZOOM, currentScale * factor)
|
|
13279
|
-
);
|
|
13280
|
-
if (newScale === currentScale) return;
|
|
13281
|
-
const wrapperRect = wrapper.getBoundingClientRect();
|
|
13282
|
-
const isIframeEvent = ((_a2 = e.target) == null ? void 0 : _a2.ownerDocument) !== document;
|
|
13283
|
-
let cursorX;
|
|
13284
|
-
let cursorY;
|
|
13285
|
-
if (isIframeEvent) {
|
|
13286
|
-
const iframeEl = document.getElementById(
|
|
13287
|
-
"preview-frame"
|
|
13288
|
-
);
|
|
13289
|
-
const iframeRect = iframeEl == null ? void 0 : iframeEl.getBoundingClientRect();
|
|
13290
|
-
if (!iframeRect) return;
|
|
13291
|
-
cursorX = iframeRect.left + e.clientX * currentScale - wrapperRect.left;
|
|
13292
|
-
cursorY = iframeRect.top + e.clientY * currentScale - wrapperRect.top;
|
|
13293
|
-
} else {
|
|
13294
|
-
cursorX = e.clientX - wrapperRect.left;
|
|
13295
|
-
cursorY = e.clientY - wrapperRect.top;
|
|
13296
|
-
}
|
|
13297
|
-
const ratio = newScale / currentScale;
|
|
13298
|
-
const newPositionX = cursorX - (cursorX - ref.state.positionX) * ratio;
|
|
13299
|
-
const newPositionY = cursorY - (cursorY - ref.state.positionY) * ratio;
|
|
13300
|
-
ref.setTransform(newPositionX, newPositionY, newScale, 0);
|
|
13301
|
-
return;
|
|
13302
|
-
}
|
|
13303
|
-
ref.setTransform(
|
|
13304
|
-
ref.state.positionX - e.deltaX,
|
|
13305
|
-
ref.state.positionY - e.deltaY,
|
|
13306
|
-
ref.state.scale,
|
|
13307
|
-
0
|
|
13308
|
-
);
|
|
13309
|
-
};
|
|
13310
|
-
const cleanups = [];
|
|
13311
|
-
const onWindowWheel = (e) => {
|
|
13312
|
-
if (e.ctrlKey || e.metaKey) e.preventDefault();
|
|
13313
|
-
};
|
|
13314
|
-
window.addEventListener("wheel", onWindowWheel, { passive: false });
|
|
13315
|
-
cleanups.push(
|
|
13316
|
-
() => window.removeEventListener("wheel", onWindowWheel)
|
|
13540
|
+
const appStoreApi = useAppStoreApi();
|
|
13541
|
+
const autoSelectingRef = (0, import_react89.useRef)(true);
|
|
13542
|
+
const pickClosestViewport = (0, import_react89.useCallback)(() => {
|
|
13543
|
+
var _a2, _b2;
|
|
13544
|
+
if (typeof window === "undefined") return null;
|
|
13545
|
+
const viewportWidth = window.innerWidth;
|
|
13546
|
+
const frameWidth = (_a2 = frameRef.current) == null ? void 0 : _a2.getBoundingClientRect().width;
|
|
13547
|
+
if (!viewportWidth) return null;
|
|
13548
|
+
if (!frameWidth) return null;
|
|
13549
|
+
if (viewportOptions.length === 0) return null;
|
|
13550
|
+
const fullWidthViewport = Object.values(viewportOptions).find(
|
|
13551
|
+
(v) => v.width === "100%"
|
|
13317
13552
|
);
|
|
13318
|
-
const
|
|
13319
|
-
|
|
13320
|
-
|
|
13321
|
-
|
|
13322
|
-
|
|
13323
|
-
|
|
13324
|
-
}
|
|
13553
|
+
const viewportDifferences = Object.entries(viewportOptions).filter(([_, value]) => value.width !== "100%").map(([key, value]) => ({
|
|
13554
|
+
key,
|
|
13555
|
+
diff: Math.abs(
|
|
13556
|
+
viewportWidth - (typeof value.width === "string" ? viewportWidth : value.width)
|
|
13557
|
+
),
|
|
13558
|
+
value
|
|
13559
|
+
})).sort((a, b) => a.diff > b.diff ? 1 : -1);
|
|
13560
|
+
let closestViewport = (_b2 = viewportDifferences[0]) == null ? void 0 : _b2.value;
|
|
13561
|
+
if (!closestViewport) return null;
|
|
13562
|
+
if (closestViewport.width < frameWidth && fullWidthViewport) {
|
|
13563
|
+
closestViewport = fullWidthViewport;
|
|
13564
|
+
}
|
|
13565
|
+
return closestViewport;
|
|
13566
|
+
}, [viewportOptions, frameRef]);
|
|
13567
|
+
(0, import_react89.useEffect)(() => {
|
|
13568
|
+
var _a2;
|
|
13569
|
+
if (typeof window === "undefined") return;
|
|
13570
|
+
if ((_a2 = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _a2.current) return;
|
|
13571
|
+
const closestViewport = pickClosestViewport();
|
|
13572
|
+
if (!closestViewport) return;
|
|
13325
13573
|
if (iframe.enabled) {
|
|
13326
|
-
const
|
|
13327
|
-
|
|
13328
|
-
|
|
13329
|
-
|
|
13330
|
-
|
|
13331
|
-
|
|
13332
|
-
|
|
13333
|
-
|
|
13334
|
-
|
|
13335
|
-
|
|
13336
|
-
|
|
13337
|
-
|
|
13338
|
-
win.removeEventListener("wheel", handler, opts);
|
|
13339
|
-
});
|
|
13340
|
-
return true;
|
|
13574
|
+
const s = appStoreApi.getState();
|
|
13575
|
+
const appState = {
|
|
13576
|
+
state: __spreadProps(__spreadValues({}, s.state), {
|
|
13577
|
+
ui: __spreadProps(__spreadValues({}, s.state.ui), {
|
|
13578
|
+
viewports: __spreadProps(__spreadValues({}, s.state.ui.viewports), {
|
|
13579
|
+
current: __spreadProps(__spreadValues({}, s.state.ui.viewports.current), {
|
|
13580
|
+
height: (closestViewport == null ? void 0 : closestViewport.height) || "auto",
|
|
13581
|
+
width: closestViewport == null ? void 0 : closestViewport.width
|
|
13582
|
+
})
|
|
13583
|
+
})
|
|
13584
|
+
})
|
|
13585
|
+
})
|
|
13341
13586
|
};
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
|
|
13345
|
-
}, 100);
|
|
13346
|
-
cleanups.push(() => window.clearInterval(interval));
|
|
13587
|
+
let history = s.history;
|
|
13588
|
+
if (s.history.histories.length === 1) {
|
|
13589
|
+
history = __spreadProps(__spreadValues({}, history), { histories: [appState] });
|
|
13347
13590
|
}
|
|
13591
|
+
appStoreApi.setState(__spreadProps(__spreadValues({}, appState), { history }));
|
|
13348
13592
|
}
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
|
|
13356
|
-
|
|
13357
|
-
|
|
13358
|
-
|
|
13359
|
-
|
|
13360
|
-
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
|
|
13364
|
-
|
|
13365
|
-
|
|
13366
|
-
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
}
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13377
|
-
|
|
13593
|
+
}, [
|
|
13594
|
+
pickClosestViewport,
|
|
13595
|
+
frameRef.current,
|
|
13596
|
+
iframe,
|
|
13597
|
+
appStoreApi,
|
|
13598
|
+
(_a = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _a.current
|
|
13599
|
+
]);
|
|
13600
|
+
(0, import_react89.useEffect)(() => {
|
|
13601
|
+
var _a2;
|
|
13602
|
+
if (typeof window === "undefined") return;
|
|
13603
|
+
if (!iframe.enabled) return;
|
|
13604
|
+
if ((_a2 = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _a2.current) return;
|
|
13605
|
+
const target = frameRef.current;
|
|
13606
|
+
if (!target) return;
|
|
13607
|
+
const observer = new ResizeObserver(() => {
|
|
13608
|
+
if (!autoSelectingRef.current) return;
|
|
13609
|
+
const closestViewport = pickClosestViewport();
|
|
13610
|
+
if (!closestViewport) return;
|
|
13611
|
+
const s = appStoreApi.getState();
|
|
13612
|
+
const current = s.state.ui.viewports.current;
|
|
13613
|
+
if (current.width === closestViewport.width && current.height === (closestViewport.height || "auto")) {
|
|
13614
|
+
return;
|
|
13615
|
+
}
|
|
13616
|
+
setUi({
|
|
13617
|
+
viewports: __spreadProps(__spreadValues({}, s.state.ui.viewports), {
|
|
13618
|
+
current: __spreadProps(__spreadValues({}, current), {
|
|
13619
|
+
width: closestViewport.width,
|
|
13620
|
+
height: closestViewport.height || "auto"
|
|
13621
|
+
})
|
|
13622
|
+
})
|
|
13623
|
+
});
|
|
13624
|
+
});
|
|
13625
|
+
observer.observe(target);
|
|
13626
|
+
return () => observer.disconnect();
|
|
13627
|
+
}, [
|
|
13628
|
+
pickClosestViewport,
|
|
13629
|
+
frameRef,
|
|
13630
|
+
iframe.enabled,
|
|
13631
|
+
(_b = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _b.current,
|
|
13632
|
+
appStoreApi,
|
|
13633
|
+
setUi
|
|
13634
|
+
]);
|
|
13635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13378
13636
|
"div",
|
|
13379
13637
|
{
|
|
13380
|
-
className:
|
|
13638
|
+
className: getClassName37({
|
|
13381
13639
|
ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
|
|
13382
13640
|
showLoader,
|
|
13383
13641
|
fullScreen: fullScreenCanvas,
|
|
@@ -13393,120 +13651,296 @@ var Canvas = () => {
|
|
|
13393
13651
|
});
|
|
13394
13652
|
}
|
|
13395
13653
|
},
|
|
13396
|
-
children: /* @__PURE__ */ (0,
|
|
13397
|
-
/* @__PURE__ */ (0,
|
|
13398
|
-
|
|
13654
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: getClassName37("inner"), ref: frameRef, children: [
|
|
13655
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13656
|
+
"div",
|
|
13399
13657
|
{
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13403
|
-
|
|
13404
|
-
|
|
13405
|
-
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
title: theme === "dark" ? "Switch to light mode" : "Switch to dark mode",
|
|
13421
|
-
onClick: toggleTheme,
|
|
13422
|
-
children: theme === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Sun, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Moon, { size: 14 })
|
|
13423
|
-
}
|
|
13424
|
-
),
|
|
13425
|
-
(chrome.showDeviceToggle || chrome.showFullScreenToggle) && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: getClassName35("toolbarDivider") })
|
|
13426
|
-
] }),
|
|
13427
|
-
chrome.showDeviceToggle && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13428
|
-
IconButton,
|
|
13429
|
-
{
|
|
13430
|
-
type: "button",
|
|
13431
|
-
title: `Switch to ${nextDeviceLabel} viewport`,
|
|
13432
|
-
onClick: cycleDevice,
|
|
13433
|
-
children: DEVICE_ICONS[activeDevice]
|
|
13434
|
-
}
|
|
13435
|
-
),
|
|
13436
|
-
chrome.showFullScreenToggle && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13437
|
-
IconButton,
|
|
13438
|
-
{
|
|
13439
|
-
type: "button",
|
|
13440
|
-
title: canvasFullScreen ? "Exit full screen" : "Enter full screen",
|
|
13441
|
-
onClick: toggleFullScreen,
|
|
13442
|
-
children: canvasFullScreen ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Minimize, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Maximize, { size: 14 })
|
|
13443
|
-
}
|
|
13444
|
-
),
|
|
13445
|
-
(chrome.showDeviceToggle || chrome.showFullScreenToggle) && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: getClassName35("toolbarDivider") }),
|
|
13446
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13447
|
-
IconButton,
|
|
13448
|
-
{
|
|
13449
|
-
type: "button",
|
|
13450
|
-
title: "Zoom out",
|
|
13451
|
-
onClick: handleZoomOut,
|
|
13452
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Minus, { size: 14 })
|
|
13453
|
-
}
|
|
13454
|
-
),
|
|
13455
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ZoomLevel, { className: getClassName35("zoomLevel") }),
|
|
13456
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13457
|
-
IconButton,
|
|
13458
|
-
{
|
|
13459
|
-
type: "button",
|
|
13460
|
-
title: "Zoom in",
|
|
13461
|
-
onClick: handleZoomIn,
|
|
13462
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Plus, { size: 14 })
|
|
13463
|
-
}
|
|
13464
|
-
),
|
|
13465
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13466
|
-
IconButton,
|
|
13467
|
-
{
|
|
13468
|
-
type: "button",
|
|
13469
|
-
title: "Reset zoom",
|
|
13470
|
-
onClick: handleResetZoom,
|
|
13471
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(RotateCcw, { size: 14 })
|
|
13472
|
-
}
|
|
13473
|
-
)
|
|
13474
|
-
] }),
|
|
13475
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13476
|
-
import_react_zoom_pan_pinch.TransformComponent,
|
|
13477
|
-
{
|
|
13478
|
-
infinite: true,
|
|
13479
|
-
wrapperStyle: { width: "100%", height: "100%" },
|
|
13480
|
-
children: frameContents
|
|
13481
|
-
}
|
|
13482
|
-
)
|
|
13483
|
-
]
|
|
13658
|
+
className: getClassName37("rootColumn"),
|
|
13659
|
+
style: {
|
|
13660
|
+
width: iframe.enabled ? viewports.current.width : "100%",
|
|
13661
|
+
transform: disableZoomControls ? void 0 : `scale(${canvasZoom})`,
|
|
13662
|
+
transformOrigin: disableZoomControls ? void 0 : "center center",
|
|
13663
|
+
transition: showTransition ? `width ${TRANSITION_DURATION}ms ease-out, transform ${TRANSITION_DURATION}ms ease-out` : disableZoomControls ? void 0 : "transform 150ms ease-out"
|
|
13664
|
+
},
|
|
13665
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13666
|
+
"div",
|
|
13667
|
+
{
|
|
13668
|
+
className: getClassName37("root"),
|
|
13669
|
+
suppressHydrationWarning: true,
|
|
13670
|
+
id: "editor-canvas-root",
|
|
13671
|
+
onTransitionEnd: () => {
|
|
13672
|
+
setShowTransition(false);
|
|
13673
|
+
isResizingRef.current = false;
|
|
13674
|
+
},
|
|
13675
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Preview2, {}) })
|
|
13676
|
+
}
|
|
13677
|
+
)
|
|
13484
13678
|
}
|
|
13485
|
-
)
|
|
13486
|
-
/* @__PURE__ */ (0,
|
|
13679
|
+
),
|
|
13680
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: getClassName37("bottomBar"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: getClassName37("bottomBarPill"), children: [
|
|
13681
|
+
chrome.showThemeToggle && onToggleTheme && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13682
|
+
IconButton,
|
|
13683
|
+
{
|
|
13684
|
+
type: "button",
|
|
13685
|
+
title: themeLabel != null ? themeLabel : "Toggle theme",
|
|
13686
|
+
onClick: onToggleTheme,
|
|
13687
|
+
children: themeIcon
|
|
13688
|
+
}
|
|
13689
|
+
),
|
|
13690
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13691
|
+
DeviceToggle,
|
|
13692
|
+
{
|
|
13693
|
+
onViewportChange: (viewport) => {
|
|
13694
|
+
autoSelectingRef.current = false;
|
|
13695
|
+
setShowTransition(true);
|
|
13696
|
+
isResizingRef.current = true;
|
|
13697
|
+
const uiViewport = __spreadProps(__spreadValues({}, viewport), {
|
|
13698
|
+
height: viewport.height || "auto",
|
|
13699
|
+
zoom: 1
|
|
13700
|
+
});
|
|
13701
|
+
setUi({
|
|
13702
|
+
viewports: __spreadProps(__spreadValues({}, viewports), { current: uiViewport })
|
|
13703
|
+
});
|
|
13704
|
+
}
|
|
13705
|
+
}
|
|
13706
|
+
),
|
|
13707
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(FullScreenToggle, {}),
|
|
13708
|
+
!disableZoomControls && /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, { children: [
|
|
13709
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: getClassName37("bottomBarDivider") }),
|
|
13710
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13711
|
+
IconButton,
|
|
13712
|
+
{
|
|
13713
|
+
type: "button",
|
|
13714
|
+
title: "Zoom out",
|
|
13715
|
+
onClick: zoomOut,
|
|
13716
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Minus, { size: 14 })
|
|
13717
|
+
}
|
|
13718
|
+
),
|
|
13719
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("span", { className: getClassName37("zoomLevel"), children: [
|
|
13720
|
+
Math.round(canvasZoom * 100),
|
|
13721
|
+
"%"
|
|
13722
|
+
] }),
|
|
13723
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(IconButton, { type: "button", title: "Zoom in", onClick: zoomIn, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Plus, { size: 14 }) }),
|
|
13724
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13725
|
+
IconButton,
|
|
13726
|
+
{
|
|
13727
|
+
type: "button",
|
|
13728
|
+
title: "Reset zoom",
|
|
13729
|
+
onClick: resetZoom,
|
|
13730
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(RotateCcw, { size: 14 })
|
|
13731
|
+
}
|
|
13732
|
+
)
|
|
13733
|
+
] })
|
|
13734
|
+
] }) }),
|
|
13735
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: getClassName37("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Loader, { size: 24 }) })
|
|
13487
13736
|
] })
|
|
13488
13737
|
}
|
|
13489
13738
|
);
|
|
13490
13739
|
};
|
|
13491
13740
|
|
|
13741
|
+
// lib/use-sidebar-resize.ts
|
|
13742
|
+
init_react_import();
|
|
13743
|
+
var import_react90 = require("react");
|
|
13744
|
+
init_store();
|
|
13745
|
+
function useSidebarResize(position, dispatch) {
|
|
13746
|
+
const [width, setWidth] = (0, import_react90.useState)(null);
|
|
13747
|
+
const sidebarRef = (0, import_react90.useRef)(null);
|
|
13748
|
+
const storeWidth = useAppStore(
|
|
13749
|
+
(s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
|
|
13750
|
+
);
|
|
13751
|
+
(0, import_react90.useEffect)(() => {
|
|
13752
|
+
if (typeof window !== "undefined" && !storeWidth) {
|
|
13753
|
+
try {
|
|
13754
|
+
const savedWidths = localStorage.getItem("editor-sidebar-widths");
|
|
13755
|
+
if (savedWidths) {
|
|
13756
|
+
const widths = JSON.parse(savedWidths);
|
|
13757
|
+
const savedWidth = widths[position];
|
|
13758
|
+
const key = position === "left" ? "leftSideBarWidth" : "rightSideBarWidth";
|
|
13759
|
+
if (savedWidth) {
|
|
13760
|
+
dispatch({
|
|
13761
|
+
type: "setUi",
|
|
13762
|
+
ui: {
|
|
13763
|
+
[key]: savedWidth
|
|
13764
|
+
}
|
|
13765
|
+
});
|
|
13766
|
+
}
|
|
13767
|
+
}
|
|
13768
|
+
} catch (error) {
|
|
13769
|
+
console.error(
|
|
13770
|
+
`Failed to load ${position} sidebar width from localStorage`,
|
|
13771
|
+
error
|
|
13772
|
+
);
|
|
13773
|
+
}
|
|
13774
|
+
}
|
|
13775
|
+
}, [dispatch, position, storeWidth]);
|
|
13776
|
+
(0, import_react90.useEffect)(() => {
|
|
13777
|
+
if (storeWidth !== void 0) {
|
|
13778
|
+
setWidth(storeWidth);
|
|
13779
|
+
}
|
|
13780
|
+
}, [storeWidth]);
|
|
13781
|
+
const handleResizeEnd = (0, import_react90.useCallback)(
|
|
13782
|
+
(width2) => {
|
|
13783
|
+
dispatch({
|
|
13784
|
+
type: "setUi",
|
|
13785
|
+
ui: {
|
|
13786
|
+
[position === "left" ? "leftSideBarWidth" : "rightSideBarWidth"]: width2
|
|
13787
|
+
}
|
|
13788
|
+
});
|
|
13789
|
+
let widths = {};
|
|
13790
|
+
try {
|
|
13791
|
+
const savedWidths = localStorage.getItem("editor-sidebar-widths");
|
|
13792
|
+
widths = savedWidths ? JSON.parse(savedWidths) : {};
|
|
13793
|
+
} catch (error) {
|
|
13794
|
+
console.error(
|
|
13795
|
+
`Failed to save ${position} sidebar width to localStorage`,
|
|
13796
|
+
error
|
|
13797
|
+
);
|
|
13798
|
+
} finally {
|
|
13799
|
+
localStorage.setItem(
|
|
13800
|
+
"editor-sidebar-widths",
|
|
13801
|
+
JSON.stringify(__spreadProps(__spreadValues({}, widths), {
|
|
13802
|
+
[position]: width2
|
|
13803
|
+
}))
|
|
13804
|
+
);
|
|
13805
|
+
}
|
|
13806
|
+
window.dispatchEvent(
|
|
13807
|
+
new CustomEvent("viewportchange", {
|
|
13808
|
+
bubbles: true,
|
|
13809
|
+
cancelable: false
|
|
13810
|
+
})
|
|
13811
|
+
);
|
|
13812
|
+
},
|
|
13813
|
+
[dispatch, position]
|
|
13814
|
+
);
|
|
13815
|
+
return {
|
|
13816
|
+
width,
|
|
13817
|
+
setWidth,
|
|
13818
|
+
sidebarRef,
|
|
13819
|
+
handleResizeEnd
|
|
13820
|
+
};
|
|
13821
|
+
}
|
|
13822
|
+
|
|
13492
13823
|
// components/Editor/components/Sidebar/index.tsx
|
|
13493
13824
|
init_react_import();
|
|
13825
|
+
|
|
13826
|
+
// components/Editor/components/ResizeHandle/index.tsx
|
|
13827
|
+
init_react_import();
|
|
13828
|
+
var import_react91 = require("react");
|
|
13829
|
+
init_get_class_name_factory();
|
|
13830
|
+
|
|
13831
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/ResizeHandle/styles.module.css#css-module
|
|
13832
|
+
init_react_import();
|
|
13833
|
+
var styles_module_default31 = { "ResizeHandle": "_ResizeHandle_1u3rv_2", "ResizeHandle--left": "_ResizeHandle--left_1u3rv_16", "ResizeHandle--right": "_ResizeHandle--right_1u3rv_20" };
|
|
13834
|
+
|
|
13835
|
+
// components/Editor/components/ResizeHandle/index.tsx
|
|
13836
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
13837
|
+
var getClassName38 = get_class_name_factory_default("ResizeHandle", styles_module_default31);
|
|
13838
|
+
var ResizeHandle = ({
|
|
13839
|
+
position,
|
|
13840
|
+
sidebarRef,
|
|
13841
|
+
onResize,
|
|
13842
|
+
onResizeEnd
|
|
13843
|
+
}) => {
|
|
13844
|
+
const handleRef = (0, import_react91.useRef)(null);
|
|
13845
|
+
const isDragging = (0, import_react91.useRef)(false);
|
|
13846
|
+
const startX = (0, import_react91.useRef)(0);
|
|
13847
|
+
const startWidth = (0, import_react91.useRef)(0);
|
|
13848
|
+
const handleMouseMove = (0, import_react91.useCallback)(
|
|
13849
|
+
(e) => {
|
|
13850
|
+
if (!isDragging.current) return;
|
|
13851
|
+
const delta = e.clientX - startX.current;
|
|
13852
|
+
const newWidth = position === "left" ? startWidth.current + delta : startWidth.current - delta;
|
|
13853
|
+
const width = Math.max(192, newWidth);
|
|
13854
|
+
onResize(width);
|
|
13855
|
+
e.preventDefault();
|
|
13856
|
+
},
|
|
13857
|
+
[onResize, position]
|
|
13858
|
+
);
|
|
13859
|
+
const handleMouseUp = (0, import_react91.useCallback)(() => {
|
|
13860
|
+
var _a;
|
|
13861
|
+
if (!isDragging.current) return;
|
|
13862
|
+
isDragging.current = false;
|
|
13863
|
+
document.body.style.cursor = "";
|
|
13864
|
+
document.body.style.userSelect = "";
|
|
13865
|
+
const overlay = document.getElementById("resize-overlay");
|
|
13866
|
+
if (overlay) {
|
|
13867
|
+
document.body.removeChild(overlay);
|
|
13868
|
+
}
|
|
13869
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
13870
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
13871
|
+
const finalWidth = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
|
|
13872
|
+
onResizeEnd(finalWidth);
|
|
13873
|
+
}, [onResizeEnd]);
|
|
13874
|
+
const handleMouseDown = (0, import_react91.useCallback)(
|
|
13875
|
+
(e) => {
|
|
13876
|
+
var _a;
|
|
13877
|
+
isDragging.current = true;
|
|
13878
|
+
startX.current = e.clientX;
|
|
13879
|
+
startWidth.current = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
|
|
13880
|
+
document.body.style.cursor = "col-resize";
|
|
13881
|
+
document.body.style.userSelect = "none";
|
|
13882
|
+
const overlay = document.createElement("div");
|
|
13883
|
+
overlay.id = "resize-overlay";
|
|
13884
|
+
overlay.setAttribute("data-resize-overlay", "");
|
|
13885
|
+
document.body.appendChild(overlay);
|
|
13886
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
13887
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
13888
|
+
e.preventDefault();
|
|
13889
|
+
},
|
|
13890
|
+
[position, handleMouseMove, handleMouseUp]
|
|
13891
|
+
);
|
|
13892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
13893
|
+
"div",
|
|
13894
|
+
{
|
|
13895
|
+
ref: handleRef,
|
|
13896
|
+
className: getClassName38({ [position]: true }),
|
|
13897
|
+
onMouseDown: handleMouseDown
|
|
13898
|
+
}
|
|
13899
|
+
);
|
|
13900
|
+
};
|
|
13901
|
+
|
|
13902
|
+
// components/Editor/components/Sidebar/index.tsx
|
|
13494
13903
|
init_get_class_name_factory();
|
|
13495
13904
|
|
|
13496
13905
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Sidebar/styles.module.css#css-module
|
|
13497
13906
|
init_react_import();
|
|
13498
|
-
var
|
|
13907
|
+
var styles_module_default32 = { "Sidebar": "_Sidebar_14k7q_1", "Sidebar--isVisible": "_Sidebar--isVisible_14k7q_9", "Sidebar--left": "_Sidebar--left_14k7q_13", "Sidebar--right": "_Sidebar--right_14k7q_25", "Sidebar-resizeHandle": "_Sidebar-resizeHandle_14k7q_37" };
|
|
13499
13908
|
|
|
13500
13909
|
// components/Editor/components/Sidebar/index.tsx
|
|
13501
|
-
var
|
|
13502
|
-
var
|
|
13503
|
-
var Sidebar = ({
|
|
13504
|
-
|
|
13910
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
13911
|
+
var getClassName39 = get_class_name_factory_default("Sidebar", styles_module_default32);
|
|
13912
|
+
var Sidebar = ({
|
|
13913
|
+
position,
|
|
13914
|
+
sidebarRef,
|
|
13915
|
+
isVisible,
|
|
13916
|
+
onResize,
|
|
13917
|
+
onResizeEnd,
|
|
13918
|
+
children
|
|
13919
|
+
}) => {
|
|
13920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
|
|
13921
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13922
|
+
"div",
|
|
13923
|
+
{
|
|
13924
|
+
ref: sidebarRef,
|
|
13925
|
+
className: getClassName39({ [position]: true, isVisible }),
|
|
13926
|
+
children
|
|
13927
|
+
}
|
|
13928
|
+
),
|
|
13929
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: `${getClassName39("resizeHandle")}`, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13930
|
+
ResizeHandle,
|
|
13931
|
+
{
|
|
13932
|
+
position,
|
|
13933
|
+
sidebarRef,
|
|
13934
|
+
onResize,
|
|
13935
|
+
onResizeEnd
|
|
13936
|
+
}
|
|
13937
|
+
) })
|
|
13938
|
+
] });
|
|
13505
13939
|
};
|
|
13506
13940
|
|
|
13507
13941
|
// lib/use-delete-hotkeys.ts
|
|
13508
13942
|
init_react_import();
|
|
13509
|
-
var
|
|
13943
|
+
var import_react92 = require("react");
|
|
13510
13944
|
init_use_hotkey();
|
|
13511
13945
|
init_store();
|
|
13512
13946
|
|
|
@@ -13548,7 +13982,7 @@ var shouldBlockEditingHotkey = (e) => {
|
|
|
13548
13982
|
// lib/use-delete-hotkeys.ts
|
|
13549
13983
|
var useDeleteHotkeys = () => {
|
|
13550
13984
|
const appStore = useAppStoreApi();
|
|
13551
|
-
const deleteSelectedComponent = (0,
|
|
13985
|
+
const deleteSelectedComponent = (0, import_react92.useCallback)(
|
|
13552
13986
|
(e) => {
|
|
13553
13987
|
var _a;
|
|
13554
13988
|
if (shouldBlockEditingHotkey(e)) {
|
|
@@ -13574,7 +14008,7 @@ var useDeleteHotkeys = () => {
|
|
|
13574
14008
|
|
|
13575
14009
|
// lib/use-clipboard-hotkeys.ts
|
|
13576
14010
|
init_react_import();
|
|
13577
|
-
var
|
|
14011
|
+
var import_react93 = require("react");
|
|
13578
14012
|
init_use_hotkey();
|
|
13579
14013
|
init_store();
|
|
13580
14014
|
var CLIPBOARD_MARKER = "reacteditor/component";
|
|
@@ -13596,7 +14030,7 @@ var parsePayload = (text) => {
|
|
|
13596
14030
|
};
|
|
13597
14031
|
var useClipboardHotkeys = () => {
|
|
13598
14032
|
const appStore = useAppStoreApi();
|
|
13599
|
-
const writeSelectionToClipboard = (0,
|
|
14033
|
+
const writeSelectionToClipboard = (0, import_react93.useCallback)(() => {
|
|
13600
14034
|
var _a;
|
|
13601
14035
|
const { selectedItem } = appStore.getState();
|
|
13602
14036
|
if (!selectedItem) return false;
|
|
@@ -13608,14 +14042,14 @@ var useClipboardHotkeys = () => {
|
|
|
13608
14042
|
});
|
|
13609
14043
|
return true;
|
|
13610
14044
|
}, [appStore]);
|
|
13611
|
-
const copySelectedComponent = (0,
|
|
14045
|
+
const copySelectedComponent = (0, import_react93.useCallback)(
|
|
13612
14046
|
(e) => {
|
|
13613
14047
|
if (shouldBlockEditingHotkey(e)) return false;
|
|
13614
14048
|
return writeSelectionToClipboard();
|
|
13615
14049
|
},
|
|
13616
14050
|
[writeSelectionToClipboard]
|
|
13617
14051
|
);
|
|
13618
|
-
const cutSelectedComponent = (0,
|
|
14052
|
+
const cutSelectedComponent = (0, import_react93.useCallback)(
|
|
13619
14053
|
(e) => {
|
|
13620
14054
|
var _a;
|
|
13621
14055
|
if (shouldBlockEditingHotkey(e)) return false;
|
|
@@ -13634,7 +14068,7 @@ var useClipboardHotkeys = () => {
|
|
|
13634
14068
|
},
|
|
13635
14069
|
[appStore, writeSelectionToClipboard]
|
|
13636
14070
|
);
|
|
13637
|
-
const pasteComponent = (0,
|
|
14071
|
+
const pasteComponent = (0, import_react93.useCallback)(
|
|
13638
14072
|
(e) => {
|
|
13639
14073
|
var _a, _b;
|
|
13640
14074
|
if (shouldBlockEditingHotkey(e)) return false;
|
|
@@ -13645,369 +14079,184 @@ var useClipboardHotkeys = () => {
|
|
|
13645
14079
|
const data = parsePayload(text);
|
|
13646
14080
|
if (!data) return;
|
|
13647
14081
|
if (!config.components[data.type]) return;
|
|
13648
|
-
dispatch({
|
|
13649
|
-
type: "insert",
|
|
13650
|
-
componentType: data.type,
|
|
13651
|
-
destinationIndex: sel.index + 1,
|
|
13652
|
-
destinationZone: sel.zone,
|
|
13653
|
-
data
|
|
13654
|
-
});
|
|
13655
|
-
}).catch(() => {
|
|
13656
|
-
});
|
|
13657
|
-
return true;
|
|
13658
|
-
},
|
|
13659
|
-
[appStore]
|
|
13660
|
-
);
|
|
13661
|
-
useHotkey({ meta: true, c: true }, copySelectedComponent);
|
|
13662
|
-
useHotkey({ ctrl: true, c: true }, copySelectedComponent);
|
|
13663
|
-
useHotkey({ meta: true, v: true }, pasteComponent);
|
|
13664
|
-
useHotkey({ ctrl: true, v: true }, pasteComponent);
|
|
13665
|
-
useHotkey({ meta: true, x: true }, cutSelectedComponent);
|
|
13666
|
-
useHotkey({ ctrl: true, x: true }, cutSelectedComponent);
|
|
13667
|
-
};
|
|
13668
|
-
|
|
13669
|
-
// components/Editor/components/Nav/index.tsx
|
|
13670
|
-
init_react_import();
|
|
13671
|
-
|
|
13672
|
-
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Nav/styles.module.css#css-module
|
|
13673
|
-
init_react_import();
|
|
13674
|
-
var styles_module_default30 = { "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" };
|
|
13675
|
-
|
|
13676
|
-
// components/Editor/components/Nav/index.tsx
|
|
13677
|
-
init_lib();
|
|
13678
|
-
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
13679
|
-
var getClassName37 = get_class_name_factory_default("Nav", styles_module_default30);
|
|
13680
|
-
var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default30);
|
|
13681
|
-
var MenuItem = ({
|
|
13682
|
-
label,
|
|
13683
|
-
icon,
|
|
13684
|
-
onClick,
|
|
13685
|
-
isActive,
|
|
13686
|
-
mobileOnly,
|
|
13687
|
-
desktopOnly
|
|
13688
|
-
}) => {
|
|
13689
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13690
|
-
"li",
|
|
13691
|
-
{
|
|
13692
|
-
className: getClassNameItem3({
|
|
13693
|
-
active: isActive,
|
|
13694
|
-
mobileOnly,
|
|
13695
|
-
desktopOnly
|
|
13696
|
-
}),
|
|
13697
|
-
children: onClick && /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: getClassNameItem3("link"), onClick, children: [
|
|
13698
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: getClassNameItem3("linkIcon"), children: icon }),
|
|
13699
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: getClassNameItem3("linkLabel"), children: label })
|
|
13700
|
-
] })
|
|
13701
|
-
}
|
|
13702
|
-
);
|
|
13703
|
-
};
|
|
13704
|
-
var Nav = ({
|
|
13705
|
-
items,
|
|
13706
|
-
footer,
|
|
13707
|
-
orientation = "vertical"
|
|
13708
|
-
}) => {
|
|
13709
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("nav", { className: getClassName37({ horizontal: orientation === "horizontal" }), children: [
|
|
13710
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("ul", { className: getClassName37("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MenuItem, __spreadValues({}, item), key)) }),
|
|
13711
|
-
footer && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: getClassName37("footer"), children: footer })
|
|
13712
|
-
] });
|
|
13713
|
-
};
|
|
13714
|
-
|
|
13715
|
-
// components/Editor/components/Layout/index.tsx
|
|
13716
|
-
init_IconButton2();
|
|
13717
|
-
init_lucide_react();
|
|
13718
|
-
|
|
13719
|
-
// plugins/fields/index.tsx
|
|
13720
|
-
init_react_import();
|
|
13721
|
-
init_lucide_react();
|
|
13722
|
-
init_store();
|
|
13723
|
-
|
|
13724
|
-
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css#css-module
|
|
13725
|
-
init_react_import();
|
|
13726
|
-
var styles_module_default31 = { "FieldsPlugin": "_FieldsPlugin_262zt_1", "FieldsPlugin-header": "_FieldsPlugin-header_262zt_7" };
|
|
13727
|
-
|
|
13728
|
-
// plugins/fields/index.tsx
|
|
13729
|
-
init_lib();
|
|
13730
|
-
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
13731
|
-
var getClassName38 = get_class_name_factory_default("FieldsPlugin", styles_module_default31);
|
|
13732
|
-
var CurrentTitle = () => {
|
|
13733
|
-
const label = useAppStore((s) => {
|
|
13734
|
-
var _a, _b;
|
|
13735
|
-
const selectedItem = s.selectedItem;
|
|
13736
|
-
return selectedItem ? (_b = (_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.label) != null ? _b : selectedItem.type : "Page";
|
|
13737
|
-
});
|
|
13738
|
-
return label;
|
|
13739
|
-
};
|
|
13740
|
-
var fieldsPlugin = ({ desktopSideBar = "right" } = {}) => ({
|
|
13741
|
-
name: "fields",
|
|
13742
|
-
label: "Fields",
|
|
13743
|
-
render: () => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: getClassName38(), children: [
|
|
13744
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: getClassName38("header"), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Breadcrumbs, { numParents: 2, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(CurrentTitle, {}) }) }),
|
|
13745
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Fields, {})
|
|
13746
|
-
] }),
|
|
13747
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(RectangleEllipsis, {}),
|
|
13748
|
-
mobileOnly: desktopSideBar === "right"
|
|
13749
|
-
});
|
|
13750
|
-
|
|
13751
|
-
// components/BrowserBar/index.tsx
|
|
13752
|
-
init_react_import();
|
|
13753
|
-
init_lucide_react();
|
|
13754
|
-
var import_react92 = require("react");
|
|
13755
|
-
init_lib();
|
|
13756
|
-
|
|
13757
|
-
// components/ui/Combobox/index.tsx
|
|
13758
|
-
init_react_import();
|
|
13759
|
-
var import_react91 = require("@base-ui/react");
|
|
13760
|
-
init_lucide_react();
|
|
13761
|
-
init_lib();
|
|
13762
|
-
|
|
13763
|
-
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ui/Combobox/styles.module.css#css-module
|
|
13764
|
-
init_react_import();
|
|
13765
|
-
var styles_module_default32 = { "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" };
|
|
13766
|
-
|
|
13767
|
-
// components/ui/Combobox/index.tsx
|
|
13768
|
-
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
13769
|
-
var getClassName39 = get_class_name_factory_default("EditorCombobox", styles_module_default32);
|
|
13770
|
-
var join = (...values) => values.filter(Boolean).join(" ");
|
|
13771
|
-
var mergeClassName = (base, override) => {
|
|
13772
|
-
if (!override) return base;
|
|
13773
|
-
if (typeof override === "function") {
|
|
13774
|
-
return (state) => join(base, override(state));
|
|
13775
|
-
}
|
|
13776
|
-
return join(base, override);
|
|
13777
|
-
};
|
|
13778
|
-
var Combobox = import_react91.Combobox.Root;
|
|
13779
|
-
function ComboboxInput(_a) {
|
|
13780
|
-
var _b = _a, {
|
|
13781
|
-
className
|
|
13782
|
-
} = _b, props = __objRest(_b, [
|
|
13783
|
-
"className"
|
|
13784
|
-
]);
|
|
13785
|
-
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13786
|
-
import_react91.Combobox.Input,
|
|
13787
|
-
__spreadValues({
|
|
13788
|
-
"data-slot": "combobox-input",
|
|
13789
|
-
className: mergeClassName(getClassName39("input"), className)
|
|
13790
|
-
}, props)
|
|
13791
|
-
);
|
|
13792
|
-
}
|
|
13793
|
-
function ComboboxContent(_a) {
|
|
13794
|
-
var _b = _a, {
|
|
13795
|
-
className,
|
|
13796
|
-
side = "bottom",
|
|
13797
|
-
sideOffset = 4,
|
|
13798
|
-
align = "start",
|
|
13799
|
-
alignOffset = 0,
|
|
13800
|
-
children
|
|
13801
|
-
} = _b, props = __objRest(_b, [
|
|
13802
|
-
"className",
|
|
13803
|
-
"side",
|
|
13804
|
-
"sideOffset",
|
|
13805
|
-
"align",
|
|
13806
|
-
"alignOffset",
|
|
13807
|
-
"children"
|
|
13808
|
-
]);
|
|
13809
|
-
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react91.Combobox.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13810
|
-
import_react91.Combobox.Positioner,
|
|
13811
|
-
{
|
|
13812
|
-
side,
|
|
13813
|
-
sideOffset,
|
|
13814
|
-
align,
|
|
13815
|
-
alignOffset,
|
|
13816
|
-
className: getClassName39("positioner"),
|
|
13817
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13818
|
-
import_react91.Combobox.Popup,
|
|
13819
|
-
__spreadProps(__spreadValues({
|
|
13820
|
-
"data-slot": "combobox-content",
|
|
13821
|
-
className: mergeClassName(getClassName39("content"), className)
|
|
13822
|
-
}, props), {
|
|
13823
|
-
children
|
|
13824
|
-
})
|
|
13825
|
-
)
|
|
13826
|
-
}
|
|
13827
|
-
) });
|
|
13828
|
-
}
|
|
13829
|
-
function ComboboxList(_a) {
|
|
13830
|
-
var _b = _a, {
|
|
13831
|
-
className
|
|
13832
|
-
} = _b, props = __objRest(_b, [
|
|
13833
|
-
"className"
|
|
13834
|
-
]);
|
|
13835
|
-
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13836
|
-
import_react91.Combobox.List,
|
|
13837
|
-
__spreadValues({
|
|
13838
|
-
"data-slot": "combobox-list",
|
|
13839
|
-
className: mergeClassName(getClassName39("list"), className)
|
|
13840
|
-
}, props)
|
|
13841
|
-
);
|
|
13842
|
-
}
|
|
13843
|
-
function ComboboxItem(_a) {
|
|
13844
|
-
var _b = _a, {
|
|
13845
|
-
className,
|
|
13846
|
-
children
|
|
13847
|
-
} = _b, props = __objRest(_b, [
|
|
13848
|
-
"className",
|
|
13849
|
-
"children"
|
|
13850
|
-
]);
|
|
13851
|
-
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
13852
|
-
import_react91.Combobox.Item,
|
|
13853
|
-
__spreadProps(__spreadValues({
|
|
13854
|
-
"data-slot": "combobox-item",
|
|
13855
|
-
className: mergeClassName(getClassName39("item"), className)
|
|
13856
|
-
}, props), {
|
|
13857
|
-
children: [
|
|
13858
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: getClassName39("itemIndicator"), children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react91.Combobox.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Check, { size: 14 }) }) }),
|
|
13859
|
-
children
|
|
13860
|
-
]
|
|
13861
|
-
})
|
|
13862
|
-
);
|
|
13863
|
-
}
|
|
13864
|
-
function ComboboxEmpty(_a) {
|
|
13865
|
-
var _b = _a, {
|
|
13866
|
-
className
|
|
13867
|
-
} = _b, props = __objRest(_b, [
|
|
13868
|
-
"className"
|
|
13869
|
-
]);
|
|
13870
|
-
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13871
|
-
import_react91.Combobox.Empty,
|
|
13872
|
-
__spreadValues({
|
|
13873
|
-
"data-slot": "combobox-empty",
|
|
13874
|
-
className: mergeClassName(getClassName39("empty"), className)
|
|
13875
|
-
}, props)
|
|
14082
|
+
dispatch({
|
|
14083
|
+
type: "insert",
|
|
14084
|
+
componentType: data.type,
|
|
14085
|
+
destinationIndex: sel.index + 1,
|
|
14086
|
+
destinationZone: sel.zone,
|
|
14087
|
+
data
|
|
14088
|
+
});
|
|
14089
|
+
}).catch(() => {
|
|
14090
|
+
});
|
|
14091
|
+
return true;
|
|
14092
|
+
},
|
|
14093
|
+
[appStore]
|
|
13876
14094
|
);
|
|
13877
|
-
}
|
|
14095
|
+
useHotkey({ meta: true, c: true }, copySelectedComponent);
|
|
14096
|
+
useHotkey({ ctrl: true, c: true }, copySelectedComponent);
|
|
14097
|
+
useHotkey({ meta: true, v: true }, pasteComponent);
|
|
14098
|
+
useHotkey({ ctrl: true, v: true }, pasteComponent);
|
|
14099
|
+
useHotkey({ meta: true, x: true }, cutSelectedComponent);
|
|
14100
|
+
useHotkey({ ctrl: true, x: true }, cutSelectedComponent);
|
|
14101
|
+
};
|
|
13878
14102
|
|
|
13879
|
-
//
|
|
14103
|
+
// components/Editor/components/Layout/index.tsx
|
|
14104
|
+
init_IconButton2();
|
|
14105
|
+
init_lucide_react();
|
|
14106
|
+
|
|
14107
|
+
// plugins/blocks/index.tsx
|
|
13880
14108
|
init_react_import();
|
|
13881
|
-
|
|
14109
|
+
init_lucide_react();
|
|
13882
14110
|
|
|
13883
|
-
//
|
|
14111
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/blocks/styles.module.css#css-module
|
|
14112
|
+
init_react_import();
|
|
14113
|
+
var styles_module_default33 = { "BlocksPlugin": "_BlocksPlugin_15ud0_1" };
|
|
14114
|
+
|
|
14115
|
+
// plugins/blocks/index.tsx
|
|
14116
|
+
init_lib();
|
|
13884
14117
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
13885
|
-
var
|
|
13886
|
-
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
}
|
|
13890
|
-
|
|
13891
|
-
|
|
13892
|
-
|
|
13893
|
-
|
|
13894
|
-
|
|
13895
|
-
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
13902
|
-
|
|
13903
|
-
|
|
13904
|
-
|
|
13905
|
-
|
|
13906
|
-
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
if (typeof next === "string") submit(next);
|
|
13914
|
-
},
|
|
13915
|
-
inputValue,
|
|
13916
|
-
onInputValueChange: (next) => setInputValue(next),
|
|
13917
|
-
autoHighlight: false,
|
|
13918
|
-
children: [
|
|
13919
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
13920
|
-
"form",
|
|
13921
|
-
{
|
|
13922
|
-
className: getClassName40("urlTrigger"),
|
|
13923
|
-
onSubmit: (event) => {
|
|
13924
|
-
event.preventDefault();
|
|
13925
|
-
submit(inputValue);
|
|
13926
|
-
},
|
|
13927
|
-
children: [
|
|
13928
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Globe, { className: getClassName40("urlIcon"), size: 14 }),
|
|
13929
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
13930
|
-
ComboboxInput,
|
|
13931
|
-
{
|
|
13932
|
-
className: getClassName40("urlInput"),
|
|
13933
|
-
placeholder: "/",
|
|
13934
|
-
spellCheck: false,
|
|
13935
|
-
autoCorrect: "off",
|
|
13936
|
-
autoCapitalize: "off"
|
|
13937
|
-
}
|
|
13938
|
-
)
|
|
13939
|
-
]
|
|
13940
|
-
}
|
|
13941
|
-
),
|
|
13942
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(ComboboxContent, { children: [
|
|
13943
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ComboboxEmpty, { children: "Press Enter to go to this path" }),
|
|
13944
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ComboboxList, { children: (path) => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ComboboxItem, { value: path, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: getClassName40("itemPath"), children: path }) }, path) })
|
|
13945
|
-
] })
|
|
13946
|
-
]
|
|
13947
|
-
}
|
|
13948
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: getClassName40("urlTrigger"), children: [
|
|
13949
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Globe, { className: getClassName40("urlIcon"), size: 14 }),
|
|
13950
|
-
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: getClassName40("urlText"), children: "/" })
|
|
13951
|
-
] }) });
|
|
14118
|
+
var getClassName40 = get_class_name_factory_default("BlocksPlugin", styles_module_default33);
|
|
14119
|
+
var blocksPlugin = () => ({
|
|
14120
|
+
name: "blocks",
|
|
14121
|
+
label: "Blocks",
|
|
14122
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: getClassName40(), children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Components, {}) }),
|
|
14123
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Plus, {})
|
|
14124
|
+
});
|
|
14125
|
+
|
|
14126
|
+
// plugins/fields/index.tsx
|
|
14127
|
+
init_react_import();
|
|
14128
|
+
init_lucide_react();
|
|
14129
|
+
init_store();
|
|
14130
|
+
|
|
14131
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css#css-module
|
|
14132
|
+
init_react_import();
|
|
14133
|
+
var styles_module_default34 = { "FieldsPlugin": "_FieldsPlugin_262zt_1", "FieldsPlugin-header": "_FieldsPlugin-header_262zt_7" };
|
|
14134
|
+
|
|
14135
|
+
// plugins/fields/index.tsx
|
|
14136
|
+
init_lib();
|
|
14137
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
14138
|
+
var getClassName41 = get_class_name_factory_default("FieldsPlugin", styles_module_default34);
|
|
14139
|
+
var CurrentTitle = () => {
|
|
14140
|
+
const label = useAppStore((s) => {
|
|
14141
|
+
var _a, _b;
|
|
14142
|
+
const selectedItem = s.selectedItem;
|
|
14143
|
+
return selectedItem ? (_b = (_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.label) != null ? _b : selectedItem.type : "Page";
|
|
14144
|
+
});
|
|
14145
|
+
return label;
|
|
13952
14146
|
};
|
|
14147
|
+
var fieldsPlugin = ({ desktopSideBar = "right" } = {}) => ({
|
|
14148
|
+
name: "fields",
|
|
14149
|
+
label: "Fields",
|
|
14150
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: getClassName41(), children: [
|
|
14151
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: getClassName41("header"), children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Breadcrumbs, { numParents: 2, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(CurrentTitle, {}) }) }),
|
|
14152
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Fields, {})
|
|
14153
|
+
] }),
|
|
14154
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(RectangleEllipsis, {}),
|
|
14155
|
+
mobileOnly: desktopSideBar === "right"
|
|
14156
|
+
});
|
|
13953
14157
|
|
|
13954
14158
|
// components/Editor/components/Layout/index.tsx
|
|
13955
|
-
var
|
|
13956
|
-
var
|
|
14159
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
14160
|
+
var getClassName42 = get_class_name_factory_default("Editor", styles_module_default25);
|
|
13957
14161
|
var getLayoutClassName = get_class_name_factory_default("EditorLayout", styles_module_default25);
|
|
13958
14162
|
var getPluginTabClassName = get_class_name_factory_default("EditorPluginTab", styles_module_default25);
|
|
13959
|
-
var
|
|
13960
|
-
var
|
|
14163
|
+
var getHeaderClassName = get_class_name_factory_default("EditorHeader", styles_module_default25);
|
|
14164
|
+
var TopHeader = ({
|
|
14165
|
+
pluginItems
|
|
14166
|
+
}) => {
|
|
13961
14167
|
const appStore = useAppStoreApi();
|
|
13962
14168
|
const { onPublish, currentRoute } = usePropsContext();
|
|
13963
|
-
const
|
|
13964
|
-
(s) => s.overrides.headerActions || DefaultOverride
|
|
13965
|
-
);
|
|
13966
|
-
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
13967
|
-
Button,
|
|
13968
|
-
{
|
|
13969
|
-
onClick: () => {
|
|
13970
|
-
const data = appStore.getState().state.data;
|
|
13971
|
-
onPublish && onPublish(data, currentRoute);
|
|
13972
|
-
},
|
|
13973
|
-
children: "Publish"
|
|
13974
|
-
}
|
|
13975
|
-
) });
|
|
13976
|
-
};
|
|
13977
|
-
var HeaderHistory = () => {
|
|
14169
|
+
const chrome = useChromeConfig();
|
|
13978
14170
|
const back = useAppStore((s) => s.history.back);
|
|
13979
14171
|
const forward = useAppStore((s) => s.history.forward);
|
|
13980
14172
|
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
|
13981
14173
|
const hasPast = useAppStore((s) => s.history.hasPast());
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
14174
|
+
const CustomHeaderActions = useAppStore(
|
|
14175
|
+
(s) => s.overrides.headerActions || DefaultOverride
|
|
14176
|
+
);
|
|
14177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("header", { className: getHeaderClassName(), children: [
|
|
14178
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: getHeaderClassName("plugins"), children: Object.entries(pluginItems).map(([key, item]) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14179
|
+
"span",
|
|
13986
14180
|
{
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
children: /* @__PURE__ */ (0,
|
|
13992
|
-
|
|
13993
|
-
|
|
14181
|
+
className: getHeaderClassName("pluginItem", {
|
|
14182
|
+
mobileOnly: item.mobileOnly,
|
|
14183
|
+
desktopOnly: item.desktopOnly
|
|
14184
|
+
}),
|
|
14185
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14186
|
+
IconButton,
|
|
14187
|
+
{
|
|
14188
|
+
type: "button",
|
|
14189
|
+
title: item.label,
|
|
14190
|
+
onClick: item.onClick,
|
|
14191
|
+
active: item.isActive,
|
|
14192
|
+
children: item.icon
|
|
14193
|
+
}
|
|
14194
|
+
)
|
|
14195
|
+
},
|
|
14196
|
+
key
|
|
14197
|
+
)) }),
|
|
14198
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: getHeaderClassName("urlBarSlot"), children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(UrlBar, {}) }),
|
|
14199
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: getHeaderClassName("actions"), children: [
|
|
14200
|
+
chrome.showHistoryControls && /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: getHeaderClassName("history"), children: [
|
|
14201
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14202
|
+
IconButton,
|
|
14203
|
+
{
|
|
14204
|
+
type: "button",
|
|
14205
|
+
title: "undo",
|
|
14206
|
+
disabled: !hasPast,
|
|
14207
|
+
onClick: back,
|
|
14208
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Undo2, { size: 18 })
|
|
14209
|
+
}
|
|
14210
|
+
),
|
|
14211
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14212
|
+
IconButton,
|
|
14213
|
+
{
|
|
14214
|
+
type: "button",
|
|
14215
|
+
title: "redo",
|
|
14216
|
+
disabled: !hasFuture,
|
|
14217
|
+
onClick: forward,
|
|
14218
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Redo2, { size: 18 })
|
|
14219
|
+
}
|
|
14220
|
+
)
|
|
14221
|
+
] }),
|
|
14222
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14223
|
+
Button,
|
|
14224
|
+
{
|
|
14225
|
+
onClick: () => {
|
|
14226
|
+
const data = appStore.getState().state.data;
|
|
14227
|
+
onPublish && onPublish(data, currentRoute);
|
|
14228
|
+
},
|
|
14229
|
+
children: "Publish"
|
|
14230
|
+
}
|
|
14231
|
+
) })
|
|
14232
|
+
] })
|
|
13994
14233
|
] });
|
|
13995
14234
|
};
|
|
14235
|
+
var FieldSideBar = () => {
|
|
14236
|
+
const title = useAppStore(
|
|
14237
|
+
(s) => {
|
|
14238
|
+
var _a, _b, _c;
|
|
14239
|
+
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";
|
|
14240
|
+
}
|
|
14241
|
+
);
|
|
14242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Fields, {}) });
|
|
14243
|
+
};
|
|
13996
14244
|
var PluginTab = ({
|
|
13997
14245
|
children,
|
|
13998
14246
|
visible,
|
|
13999
14247
|
mobileOnly
|
|
14000
14248
|
}) => {
|
|
14001
|
-
return /* @__PURE__ */ (0,
|
|
14249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: getPluginTabClassName({ visible, mobileOnly }), children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: getPluginTabClassName("body"), children }) });
|
|
14002
14250
|
};
|
|
14003
14251
|
var Layout = ({ children }) => {
|
|
14004
14252
|
const {
|
|
14005
14253
|
iframe: _iframe,
|
|
14006
14254
|
dnd,
|
|
14255
|
+
initialHistory: _initialHistory,
|
|
14007
14256
|
plugins,
|
|
14008
14257
|
height
|
|
14009
14258
|
} = usePropsContext();
|
|
14010
|
-
const iframe = (0,
|
|
14259
|
+
const iframe = (0, import_react94.useMemo)(
|
|
14011
14260
|
() => __spreadValues({
|
|
14012
14261
|
enabled: true,
|
|
14013
14262
|
waitForStyles: true
|
|
@@ -14015,7 +14264,7 @@ var Layout = ({ children }) => {
|
|
|
14015
14264
|
[_iframe]
|
|
14016
14265
|
);
|
|
14017
14266
|
useInjectGlobalCss(iframe.enabled);
|
|
14018
|
-
const
|
|
14267
|
+
const dispatch = useAppStore((s) => s.dispatch);
|
|
14019
14268
|
const leftSideBarVisible = useAppStore((s) => s.state.ui.leftSideBarVisible);
|
|
14020
14269
|
const rightSideBarVisible = useAppStore(
|
|
14021
14270
|
(s) => s.state.ui.rightSideBarVisible
|
|
@@ -14023,14 +14272,53 @@ var Layout = ({ children }) => {
|
|
|
14023
14272
|
const chrome = useChromeConfig();
|
|
14024
14273
|
const navBarVisible = chrome.showNavBar;
|
|
14025
14274
|
const instanceId = useAppStore((s) => s.instanceId);
|
|
14275
|
+
const {
|
|
14276
|
+
width: leftWidth,
|
|
14277
|
+
setWidth: setLeftWidth,
|
|
14278
|
+
sidebarRef: leftSidebarRef,
|
|
14279
|
+
handleResizeEnd: handleLeftSidebarResizeEnd
|
|
14280
|
+
} = useSidebarResize("left", dispatch);
|
|
14281
|
+
const {
|
|
14282
|
+
width: rightWidth,
|
|
14283
|
+
setWidth: setRightWidth,
|
|
14284
|
+
sidebarRef: rightSidebarRef,
|
|
14285
|
+
handleResizeEnd: handleRightSidebarResizeEnd
|
|
14286
|
+
} = useSidebarResize("right", dispatch);
|
|
14287
|
+
(0, import_react94.useEffect)(() => {
|
|
14288
|
+
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
14289
|
+
dispatch({
|
|
14290
|
+
type: "setUi",
|
|
14291
|
+
ui: {
|
|
14292
|
+
leftSideBarVisible: false,
|
|
14293
|
+
rightSideBarVisible: false
|
|
14294
|
+
}
|
|
14295
|
+
});
|
|
14296
|
+
}
|
|
14297
|
+
const handleResize = () => {
|
|
14298
|
+
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
14299
|
+
dispatch({
|
|
14300
|
+
type: "setUi",
|
|
14301
|
+
ui: (ui) => __spreadValues(__spreadValues({}, ui), ui.rightSideBarVisible ? { leftSideBarVisible: false } : {})
|
|
14302
|
+
});
|
|
14303
|
+
}
|
|
14304
|
+
};
|
|
14305
|
+
window.addEventListener("resize", handleResize);
|
|
14306
|
+
return () => {
|
|
14307
|
+
window.removeEventListener("resize", handleResize);
|
|
14308
|
+
};
|
|
14309
|
+
}, []);
|
|
14026
14310
|
const overrides = useAppStore((s) => s.overrides);
|
|
14027
|
-
const CustomEditor = (0,
|
|
14311
|
+
const CustomEditor = (0, import_react94.useMemo)(
|
|
14028
14312
|
() => overrides.editor || DefaultOverride,
|
|
14029
14313
|
[overrides]
|
|
14030
14314
|
);
|
|
14315
|
+
const [mounted, setMounted] = (0, import_react94.useState)(false);
|
|
14316
|
+
(0, import_react94.useEffect)(() => {
|
|
14317
|
+
setMounted(true);
|
|
14318
|
+
}, []);
|
|
14031
14319
|
const ready = useAppStore((s) => s.status === "READY");
|
|
14032
14320
|
useMonitorHotkeys();
|
|
14033
|
-
(0,
|
|
14321
|
+
(0, import_react94.useEffect)(() => {
|
|
14034
14322
|
if (ready && iframe.enabled) {
|
|
14035
14323
|
const frameDoc = getFrame();
|
|
14036
14324
|
if (frameDoc) {
|
|
@@ -14041,36 +14329,106 @@ var Layout = ({ children }) => {
|
|
|
14041
14329
|
usePreviewModeHotkeys();
|
|
14042
14330
|
useDeleteHotkeys();
|
|
14043
14331
|
useClipboardHotkeys();
|
|
14332
|
+
const layoutOptions = {};
|
|
14333
|
+
if (leftWidth) {
|
|
14334
|
+
layoutOptions["--editor-user-left-side-bar-width"] = `${leftWidth}px`;
|
|
14335
|
+
}
|
|
14336
|
+
if (rightWidth) {
|
|
14337
|
+
layoutOptions["--editor-user-right-side-bar-width"] = `${rightWidth}px`;
|
|
14338
|
+
}
|
|
14339
|
+
const setUi = useAppStore((s) => s.setUi);
|
|
14044
14340
|
const currentPlugin = useAppStore((s) => {
|
|
14045
14341
|
var _a;
|
|
14046
14342
|
return (_a = s.state.ui.plugin) == null ? void 0 : _a.current;
|
|
14047
14343
|
});
|
|
14048
14344
|
const appStoreApi = useAppStoreApi();
|
|
14049
|
-
const [
|
|
14345
|
+
const [mobilePanelHeightMode, setMobilePanelHeightMode] = (0, import_react94.useState)("toggle");
|
|
14346
|
+
const [mobilePanelHeight, setMobilePanelHeight] = (0, import_react94.useState)(
|
|
14347
|
+
null
|
|
14348
|
+
);
|
|
14349
|
+
const mobilePanelRef = (0, import_react94.useRef)(null);
|
|
14350
|
+
const isDraggingMobile = (0, import_react94.useRef)(false);
|
|
14351
|
+
const dragStartY = (0, import_react94.useRef)(0);
|
|
14352
|
+
const dragStartHeight = (0, import_react94.useRef)(0);
|
|
14353
|
+
const handleMobileDragStart = (0, import_react94.useCallback)(
|
|
14354
|
+
(clientY) => {
|
|
14355
|
+
isDraggingMobile.current = true;
|
|
14356
|
+
dragStartY.current = clientY;
|
|
14357
|
+
const panel = mobilePanelRef.current;
|
|
14358
|
+
dragStartHeight.current = panel ? panel.getBoundingClientRect().height : 0;
|
|
14359
|
+
document.body.style.userSelect = "none";
|
|
14360
|
+
document.body.style.touchAction = "none";
|
|
14361
|
+
},
|
|
14362
|
+
[]
|
|
14363
|
+
);
|
|
14364
|
+
const handleMobileDragMove = (0, import_react94.useCallback)((clientY) => {
|
|
14365
|
+
if (!isDraggingMobile.current) return;
|
|
14366
|
+
const delta = dragStartY.current - clientY;
|
|
14367
|
+
const viewportHeight = window.innerHeight;
|
|
14368
|
+
const minH = viewportHeight * 0.15;
|
|
14369
|
+
const maxH = viewportHeight * 0.75;
|
|
14370
|
+
const newH = Math.min(maxH, Math.max(minH, dragStartHeight.current + delta));
|
|
14371
|
+
setMobilePanelHeight(newH);
|
|
14372
|
+
}, []);
|
|
14373
|
+
const handleMobileDragEnd = (0, import_react94.useCallback)(() => {
|
|
14374
|
+
if (!isDraggingMobile.current) return;
|
|
14375
|
+
isDraggingMobile.current = false;
|
|
14376
|
+
document.body.style.userSelect = "";
|
|
14377
|
+
document.body.style.touchAction = "";
|
|
14378
|
+
}, []);
|
|
14379
|
+
(0, import_react94.useEffect)(() => {
|
|
14380
|
+
const onTouchMove = (e) => {
|
|
14381
|
+
if (isDraggingMobile.current) {
|
|
14382
|
+
e.preventDefault();
|
|
14383
|
+
handleMobileDragMove(e.touches[0].clientY);
|
|
14384
|
+
}
|
|
14385
|
+
};
|
|
14386
|
+
const onTouchEnd = () => handleMobileDragEnd();
|
|
14387
|
+
const onMouseMove = (e) => {
|
|
14388
|
+
if (isDraggingMobile.current) {
|
|
14389
|
+
e.preventDefault();
|
|
14390
|
+
handleMobileDragMove(e.clientY);
|
|
14391
|
+
}
|
|
14392
|
+
};
|
|
14393
|
+
const onMouseUp = () => handleMobileDragEnd();
|
|
14394
|
+
document.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
14395
|
+
document.addEventListener("touchend", onTouchEnd);
|
|
14396
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
14397
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
14398
|
+
return () => {
|
|
14399
|
+
document.removeEventListener("touchmove", onTouchMove);
|
|
14400
|
+
document.removeEventListener("touchend", onTouchEnd);
|
|
14401
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
14402
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
14403
|
+
};
|
|
14404
|
+
}, [handleMobileDragMove, handleMobileDragEnd]);
|
|
14405
|
+
const [theme, setTheme] = (0, import_react94.useState)(() => {
|
|
14050
14406
|
if (typeof window === "undefined") return "light";
|
|
14051
14407
|
const stored = window.localStorage.getItem("editor-theme");
|
|
14052
14408
|
if (stored === "light" || stored === "dark") return stored;
|
|
14053
14409
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
14054
14410
|
});
|
|
14055
|
-
(0,
|
|
14411
|
+
(0, import_react94.useEffect)(() => {
|
|
14056
14412
|
if (typeof window === "undefined") return;
|
|
14057
14413
|
window.localStorage.setItem("editor-theme", theme);
|
|
14058
14414
|
}, [theme]);
|
|
14059
14415
|
const toggleTheme = () => {
|
|
14060
14416
|
setTheme((t) => t === "dark" ? "light" : "dark");
|
|
14061
14417
|
};
|
|
14062
|
-
const themeIcon = theme === "dark" ? /* @__PURE__ */ (0,
|
|
14418
|
+
const themeIcon = theme === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Sun, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Moon, { size: 14 });
|
|
14063
14419
|
const themeLabel = theme === "dark" ? "Switch to light mode" : "Switch to dark mode";
|
|
14064
|
-
const hasLegacySideBarPlugin = (0,
|
|
14420
|
+
const hasLegacySideBarPlugin = (0, import_react94.useMemo)(
|
|
14065
14421
|
() => !!(plugins == null ? void 0 : plugins.find((p) => p.name === "legacy-side-bar")),
|
|
14066
14422
|
[plugins]
|
|
14067
14423
|
);
|
|
14068
|
-
const pluginItems = (0,
|
|
14424
|
+
const pluginItems = (0, import_react94.useMemo)(() => {
|
|
14069
14425
|
const details = {};
|
|
14426
|
+
const defaultPlugins = [blocksPlugin()];
|
|
14070
14427
|
const isLegacy = (plugin) => plugin.name === "legacy-side-bar" ? -1 : 0;
|
|
14071
|
-
const combinedPlugins = [
|
|
14072
|
-
|
|
14073
|
-
|
|
14428
|
+
const combinedPlugins = [
|
|
14429
|
+
...defaultPlugins,
|
|
14430
|
+
...plugins != null ? plugins : []
|
|
14431
|
+
].sort((a, b) => isLegacy(a) - isLegacy(b));
|
|
14074
14432
|
if (!(plugins == null ? void 0 : plugins.some((p) => p.name === "fields"))) {
|
|
14075
14433
|
combinedPlugins.push(fieldsPlugin());
|
|
14076
14434
|
}
|
|
@@ -14082,15 +14440,23 @@ var Layout = ({ children }) => {
|
|
|
14082
14440
|
}
|
|
14083
14441
|
details[plugin.name] = {
|
|
14084
14442
|
label: (_a = plugin.label) != null ? _a : plugin.name,
|
|
14085
|
-
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ (0,
|
|
14443
|
+
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ToyBrick, {}),
|
|
14086
14444
|
onClick: () => {
|
|
14445
|
+
var _a2;
|
|
14446
|
+
setMobilePanelHeightMode((_a2 = plugin.mobilePanelHeight) != null ? _a2 : "toggle");
|
|
14087
14447
|
if (plugin.name === currentPlugin) {
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14448
|
+
if (leftSideBarVisible) {
|
|
14449
|
+
setUi({ leftSideBarVisible: false });
|
|
14450
|
+
} else {
|
|
14451
|
+
setUi({ leftSideBarVisible: true });
|
|
14452
|
+
}
|
|
14453
|
+
} else {
|
|
14454
|
+
if (plugin.name) {
|
|
14455
|
+
setUi({
|
|
14456
|
+
plugin: { current: plugin.name },
|
|
14457
|
+
leftSideBarVisible: true
|
|
14458
|
+
});
|
|
14459
|
+
}
|
|
14094
14460
|
}
|
|
14095
14461
|
},
|
|
14096
14462
|
isActive: leftSideBarVisible && currentPlugin === plugin.name,
|
|
@@ -14102,65 +14468,141 @@ var Layout = ({ children }) => {
|
|
|
14102
14468
|
});
|
|
14103
14469
|
return details;
|
|
14104
14470
|
}, [plugins, currentPlugin, appStoreApi, leftSideBarVisible]);
|
|
14105
|
-
(0,
|
|
14471
|
+
(0, import_react94.useEffect)(() => {
|
|
14106
14472
|
if (!currentPlugin) {
|
|
14107
14473
|
const names = Object.keys(pluginItems);
|
|
14108
14474
|
setUi({ plugin: { current: names[0] } });
|
|
14109
14475
|
}
|
|
14110
14476
|
}, [pluginItems, currentPlugin]);
|
|
14111
14477
|
const hasDesktopFieldsPlugin = pluginItems["fields"] && pluginItems["fields"].mobileOnly === false;
|
|
14112
|
-
|
|
14478
|
+
const mobilePanelStyle = {};
|
|
14479
|
+
if (mobilePanelHeight && leftSideBarVisible) {
|
|
14480
|
+
mobilePanelStyle["--editor-mobile-panel-height"] = `${mobilePanelHeight}px`;
|
|
14481
|
+
}
|
|
14482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
14113
14483
|
"div",
|
|
14114
14484
|
{
|
|
14115
|
-
className: `Editor ${
|
|
14485
|
+
className: `Editor ${getClassName42({
|
|
14116
14486
|
hidePlugins: hasLegacySideBarPlugin
|
|
14117
14487
|
})}`,
|
|
14118
14488
|
id: instanceId,
|
|
14119
14489
|
"data-theme": theme,
|
|
14120
14490
|
style: { height },
|
|
14121
14491
|
children: [
|
|
14122
|
-
/* @__PURE__ */ (0,
|
|
14492
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(CustomEditor, { children: children || /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(FrameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14123
14493
|
"div",
|
|
14124
14494
|
{
|
|
14125
14495
|
className: getLayoutClassName({
|
|
14126
14496
|
leftSideBarVisible,
|
|
14497
|
+
mounted,
|
|
14127
14498
|
rightSideBarVisible: !hasDesktopFieldsPlugin && rightSideBarVisible,
|
|
14128
|
-
navBarVisible
|
|
14499
|
+
navBarVisible,
|
|
14500
|
+
mobilePanelHeightToggle: mobilePanelHeightMode === "toggle",
|
|
14501
|
+
mobilePanelHeightMinContent: mobilePanelHeightMode === "min-content",
|
|
14502
|
+
mobilePanelCustomHeight: mobilePanelHeight !== null && leftSideBarVisible
|
|
14129
14503
|
}),
|
|
14130
14504
|
style: { height },
|
|
14131
|
-
children: /* @__PURE__ */ (0,
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
/* @__PURE__ */ (0,
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14505
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
14506
|
+
"div",
|
|
14507
|
+
{
|
|
14508
|
+
className: getLayoutClassName("inner"),
|
|
14509
|
+
style: __spreadValues(__spreadValues({}, layoutOptions), mobilePanelStyle),
|
|
14510
|
+
children: [
|
|
14511
|
+
navBarVisible && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(TopHeader, { pluginItems }) }),
|
|
14512
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
14513
|
+
"div",
|
|
14514
|
+
{
|
|
14515
|
+
ref: mobilePanelRef,
|
|
14516
|
+
className: getLayoutClassName("mobilePanel"),
|
|
14517
|
+
children: [
|
|
14518
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14519
|
+
"div",
|
|
14520
|
+
{
|
|
14521
|
+
className: getLayoutClassName("mobileDragHandle"),
|
|
14522
|
+
onTouchStart: (e) => handleMobileDragStart(e.touches[0].clientY),
|
|
14523
|
+
onMouseDown: (e) => handleMobileDragStart(e.clientY),
|
|
14524
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14525
|
+
"div",
|
|
14526
|
+
{
|
|
14527
|
+
className: getLayoutClassName("mobileDragHandlePill")
|
|
14528
|
+
}
|
|
14529
|
+
)
|
|
14530
|
+
}
|
|
14531
|
+
),
|
|
14532
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14533
|
+
"div",
|
|
14534
|
+
{
|
|
14535
|
+
className: getLayoutClassName("mobilePanelContent"),
|
|
14536
|
+
children: Object.entries(pluginItems).map(
|
|
14537
|
+
([id, { mobileOnly, render: Render2 }]) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14538
|
+
PluginTab,
|
|
14539
|
+
{
|
|
14540
|
+
visible: currentPlugin === id,
|
|
14541
|
+
mobileOnly,
|
|
14542
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Render2, {})
|
|
14543
|
+
},
|
|
14544
|
+
id
|
|
14545
|
+
)
|
|
14546
|
+
)
|
|
14547
|
+
}
|
|
14548
|
+
)
|
|
14549
|
+
]
|
|
14550
|
+
}
|
|
14551
|
+
),
|
|
14552
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14553
|
+
Sidebar,
|
|
14554
|
+
{
|
|
14555
|
+
position: "left",
|
|
14556
|
+
sidebarRef: leftSidebarRef,
|
|
14557
|
+
isVisible: leftSideBarVisible,
|
|
14558
|
+
onResize: setLeftWidth,
|
|
14559
|
+
onResizeEnd: handleLeftSidebarResizeEnd,
|
|
14560
|
+
children: Object.entries(pluginItems).map(
|
|
14561
|
+
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14562
|
+
PluginTab,
|
|
14563
|
+
{
|
|
14564
|
+
visible: currentPlugin === id,
|
|
14565
|
+
mobileOnly,
|
|
14566
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Render2, {})
|
|
14567
|
+
},
|
|
14568
|
+
id
|
|
14569
|
+
)
|
|
14570
|
+
)
|
|
14571
|
+
}
|
|
14572
|
+
),
|
|
14573
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14574
|
+
Canvas,
|
|
14575
|
+
{
|
|
14576
|
+
theme,
|
|
14577
|
+
themeIcon,
|
|
14578
|
+
themeLabel,
|
|
14579
|
+
onToggleTheme: toggleTheme
|
|
14580
|
+
}
|
|
14581
|
+
),
|
|
14582
|
+
!hasDesktopFieldsPlugin && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14583
|
+
Sidebar,
|
|
14584
|
+
{
|
|
14585
|
+
position: "right",
|
|
14586
|
+
sidebarRef: rightSidebarRef,
|
|
14587
|
+
isVisible: rightSideBarVisible,
|
|
14588
|
+
onResize: setRightWidth,
|
|
14589
|
+
onResizeEnd: handleRightSidebarResizeEnd,
|
|
14590
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(FieldSideBar, {})
|
|
14591
|
+
}
|
|
14592
|
+
)
|
|
14593
|
+
]
|
|
14594
|
+
}
|
|
14595
|
+
)
|
|
14154
14596
|
}
|
|
14155
14597
|
) }) }) }),
|
|
14156
|
-
/* @__PURE__ */ (0,
|
|
14598
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { id: "editor-portal-root", className: getClassName42("portal") })
|
|
14157
14599
|
]
|
|
14158
14600
|
}
|
|
14159
|
-
)
|
|
14601
|
+
);
|
|
14160
14602
|
};
|
|
14161
14603
|
|
|
14162
14604
|
// components/Editor/index.tsx
|
|
14163
|
-
var
|
|
14605
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
14164
14606
|
var CHROME_KEYS = [
|
|
14165
14607
|
"showNavBar",
|
|
14166
14608
|
"showThemeToggle",
|
|
@@ -14190,11 +14632,11 @@ var splitUiConfig = (ui) => {
|
|
|
14190
14632
|
}
|
|
14191
14633
|
return { runtime, chrome };
|
|
14192
14634
|
};
|
|
14193
|
-
var propsContext = (0,
|
|
14635
|
+
var propsContext = (0, import_react95.createContext)({});
|
|
14194
14636
|
function PropsProvider(props) {
|
|
14195
|
-
return /* @__PURE__ */ (0,
|
|
14637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(propsContext.Provider, { value: props, children: props.children });
|
|
14196
14638
|
}
|
|
14197
|
-
var usePropsContext = () => (0,
|
|
14639
|
+
var usePropsContext = () => (0, import_react95.useContext)(propsContext);
|
|
14198
14640
|
var useChromeConfig = () => {
|
|
14199
14641
|
const { ui } = usePropsContext();
|
|
14200
14642
|
const { chrome } = splitUiConfig(ui);
|
|
@@ -14218,14 +14660,14 @@ function EditorProvider({ children }) {
|
|
|
14218
14660
|
fullScreenCanvas,
|
|
14219
14661
|
_experimentalVirtualization
|
|
14220
14662
|
} = usePropsContext();
|
|
14221
|
-
const iframe = (0,
|
|
14663
|
+
const iframe = (0, import_react95.useMemo)(
|
|
14222
14664
|
() => __spreadValues({
|
|
14223
14665
|
enabled: true,
|
|
14224
14666
|
waitForStyles: true
|
|
14225
14667
|
}, _iframe),
|
|
14226
14668
|
[_iframe]
|
|
14227
14669
|
);
|
|
14228
|
-
const [generatedAppState] = (0,
|
|
14670
|
+
const [generatedAppState] = (0, import_react95.useState)(() => {
|
|
14229
14671
|
var _a, _b, _c, _d, _e, _f;
|
|
14230
14672
|
const { runtime: initialUiRuntime } = splitUiConfig(initialUi);
|
|
14231
14673
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUiRuntime);
|
|
@@ -14278,7 +14720,7 @@ function EditorProvider({ children }) {
|
|
|
14278
14720
|
return walkAppState(newAppState, config);
|
|
14279
14721
|
});
|
|
14280
14722
|
const { appendData = true } = _initialHistory || {};
|
|
14281
|
-
const [blendedHistories] = (0,
|
|
14723
|
+
const [blendedHistories] = (0, import_react95.useState)(
|
|
14282
14724
|
[
|
|
14283
14725
|
...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
|
|
14284
14726
|
...appendData ? [{ state: generatedAppState }] : []
|
|
@@ -14292,7 +14734,7 @@ function EditorProvider({ children }) {
|
|
|
14292
14734
|
});
|
|
14293
14735
|
})
|
|
14294
14736
|
);
|
|
14295
|
-
const initialHistoryIndex = (0,
|
|
14737
|
+
const initialHistoryIndex = (0, import_react95.useMemo)(() => {
|
|
14296
14738
|
if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
|
|
14297
14739
|
return _initialHistory == null ? void 0 : _initialHistory.index;
|
|
14298
14740
|
}
|
|
@@ -14303,7 +14745,7 @@ function EditorProvider({ children }) {
|
|
|
14303
14745
|
overrides,
|
|
14304
14746
|
plugins
|
|
14305
14747
|
});
|
|
14306
|
-
const loadedFieldTransforms = (0,
|
|
14748
|
+
const loadedFieldTransforms = (0, import_react95.useMemo)(() => {
|
|
14307
14749
|
const _plugins = plugins || [];
|
|
14308
14750
|
const pluginFieldTransforms = _plugins.reduce(
|
|
14309
14751
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
@@ -14312,7 +14754,7 @@ function EditorProvider({ children }) {
|
|
|
14312
14754
|
return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
|
|
14313
14755
|
}, [fieldTransforms, plugins]);
|
|
14314
14756
|
const instanceId = useSafeId();
|
|
14315
|
-
const generateAppStore = (0,
|
|
14757
|
+
const generateAppStore = (0, import_react95.useCallback)(
|
|
14316
14758
|
(state) => {
|
|
14317
14759
|
return {
|
|
14318
14760
|
instanceId,
|
|
@@ -14344,15 +14786,15 @@ function EditorProvider({ children }) {
|
|
|
14344
14786
|
loadedFieldTransforms
|
|
14345
14787
|
]
|
|
14346
14788
|
);
|
|
14347
|
-
const [appStore] = (0,
|
|
14789
|
+
const [appStore] = (0, import_react95.useState)(
|
|
14348
14790
|
() => createAppStore(generateAppStore(initialAppState))
|
|
14349
14791
|
);
|
|
14350
|
-
(0,
|
|
14792
|
+
(0, import_react95.useEffect)(() => {
|
|
14351
14793
|
if (process.env.NODE_ENV !== "production") {
|
|
14352
14794
|
window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
|
|
14353
14795
|
}
|
|
14354
14796
|
}, [appStore]);
|
|
14355
|
-
(0,
|
|
14797
|
+
(0, import_react95.useEffect)(() => {
|
|
14356
14798
|
const state = appStore.getState().state;
|
|
14357
14799
|
appStore.setState(__spreadValues({}, generateAppStore(state)));
|
|
14358
14800
|
}, [generateAppStore]);
|
|
@@ -14361,8 +14803,8 @@ function EditorProvider({ children }) {
|
|
|
14361
14803
|
index: initialHistoryIndex,
|
|
14362
14804
|
initialAppState
|
|
14363
14805
|
});
|
|
14364
|
-
const previousData = (0,
|
|
14365
|
-
(0,
|
|
14806
|
+
const previousData = (0, import_react95.useRef)(null);
|
|
14807
|
+
(0, import_react95.useEffect)(() => {
|
|
14366
14808
|
return appStore.subscribe(
|
|
14367
14809
|
(s) => s.state.data,
|
|
14368
14810
|
(data) => {
|
|
@@ -14376,16 +14818,16 @@ function EditorProvider({ children }) {
|
|
|
14376
14818
|
}, [onChange, config]);
|
|
14377
14819
|
useRegisterPermissionsSlice(appStore, permissions);
|
|
14378
14820
|
const uEditorStore = useRegisterUseEditorStore(appStore);
|
|
14379
|
-
(0,
|
|
14821
|
+
(0, import_react95.useEffect)(() => {
|
|
14380
14822
|
const { resolveAndCommitData } = appStore.getState();
|
|
14381
14823
|
setTimeout(() => {
|
|
14382
14824
|
resolveAndCommitData();
|
|
14383
14825
|
}, 0);
|
|
14384
14826
|
}, []);
|
|
14385
|
-
return /* @__PURE__ */ (0,
|
|
14827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(UseEditorStoreContext.Provider, { value: uEditorStore, children }) });
|
|
14386
14828
|
}
|
|
14387
14829
|
function Editor4(props) {
|
|
14388
|
-
return /* @__PURE__ */ (0,
|
|
14830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(EditorProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Layout, { children: props.children }) })) }));
|
|
14389
14831
|
}
|
|
14390
14832
|
Editor4.Components = Components;
|
|
14391
14833
|
Editor4.Fields = Fields;
|
|
@@ -14395,15 +14837,15 @@ Editor4.Preview = Preview2;
|
|
|
14395
14837
|
|
|
14396
14838
|
// components/App/AppProvider.tsx
|
|
14397
14839
|
init_react_import();
|
|
14398
|
-
var
|
|
14840
|
+
var import_react98 = require("react");
|
|
14399
14841
|
var import_react_router2 = require("react-router");
|
|
14400
14842
|
|
|
14401
14843
|
// lib/use-stable-value.ts
|
|
14402
14844
|
init_react_import();
|
|
14403
|
-
var
|
|
14845
|
+
var import_react96 = require("react");
|
|
14404
14846
|
var import_fast_equals5 = require("fast-equals");
|
|
14405
14847
|
var useStableValue = (value) => {
|
|
14406
|
-
const ref = (0,
|
|
14848
|
+
const ref = (0, import_react96.useRef)(value);
|
|
14407
14849
|
if (!(0, import_fast_equals5.deepEqual)(ref.current, value)) {
|
|
14408
14850
|
ref.current = value;
|
|
14409
14851
|
}
|
|
@@ -14412,20 +14854,20 @@ var useStableValue = (value) => {
|
|
|
14412
14854
|
|
|
14413
14855
|
// components/App/context.ts
|
|
14414
14856
|
init_react_import();
|
|
14415
|
-
var
|
|
14857
|
+
var import_react97 = require("react");
|
|
14416
14858
|
var import_react_router = require("react-router");
|
|
14417
|
-
var appConfigContext = (0,
|
|
14859
|
+
var appConfigContext = (0, import_react97.createContext)(null);
|
|
14418
14860
|
var useAppConfigContext = () => {
|
|
14419
|
-
const ctx = (0,
|
|
14861
|
+
const ctx = (0, import_react97.useContext)(appConfigContext);
|
|
14420
14862
|
if (!ctx) {
|
|
14421
14863
|
throw new Error("useApp must be called inside an <AppProvider> or <App>");
|
|
14422
14864
|
}
|
|
14423
14865
|
return ctx;
|
|
14424
14866
|
};
|
|
14425
|
-
var stripPrefix = (path,
|
|
14426
|
-
if (path ===
|
|
14427
|
-
if (!path.startsWith(`${
|
|
14428
|
-
const rest = path.slice(
|
|
14867
|
+
var stripPrefix = (path, prefix2) => {
|
|
14868
|
+
if (path === prefix2) return "/";
|
|
14869
|
+
if (!path.startsWith(`${prefix2}/`)) return path;
|
|
14870
|
+
const rest = path.slice(prefix2.length);
|
|
14429
14871
|
return rest.startsWith("/") ? rest : `/${rest}`;
|
|
14430
14872
|
};
|
|
14431
14873
|
var useApp = () => {
|
|
@@ -14435,7 +14877,7 @@ var useApp = () => {
|
|
|
14435
14877
|
const currentPath = location.pathname || "/";
|
|
14436
14878
|
const isEditing = cfg.editorPath !== null && (currentPath === cfg.editorPath || currentPath.startsWith(`${cfg.editorPath}/`));
|
|
14437
14879
|
const matchRoute = isEditing ? stripPrefix(currentPath, cfg.editorPath) : currentPath;
|
|
14438
|
-
const matched = (0,
|
|
14880
|
+
const matched = (0, import_react97.useMemo)(() => {
|
|
14439
14881
|
const routeKeys = Object.keys(cfg.pages);
|
|
14440
14882
|
if (routeKeys.length === 0) return null;
|
|
14441
14883
|
const matches = (0, import_react_router.matchRoutes)(
|
|
@@ -14451,7 +14893,7 @@ var useApp = () => {
|
|
|
14451
14893
|
data: cfg.pages[key]
|
|
14452
14894
|
};
|
|
14453
14895
|
}, [cfg.pages, matchRoute]);
|
|
14454
|
-
const routes = (0,
|
|
14896
|
+
const routes = (0, import_react97.useMemo)(() => Object.keys(cfg.pages), [cfg.pages]);
|
|
14455
14897
|
const navigate = (route) => {
|
|
14456
14898
|
const target = isEditing && cfg.editorPath ? `${cfg.editorPath}${route === "/" ? "" : route}` || "/" : route;
|
|
14457
14899
|
rrNavigate(target || "/");
|
|
@@ -14467,7 +14909,7 @@ var useApp = () => {
|
|
|
14467
14909
|
};
|
|
14468
14910
|
|
|
14469
14911
|
// components/App/AppProvider.tsx
|
|
14470
|
-
var
|
|
14912
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
14471
14913
|
var EDITOR_PATH = "/editor";
|
|
14472
14914
|
var isServer = typeof window === "undefined";
|
|
14473
14915
|
function AppProvider({
|
|
@@ -14480,7 +14922,7 @@ function AppProvider({
|
|
|
14480
14922
|
}) {
|
|
14481
14923
|
const stablePages = useStableValue(pages);
|
|
14482
14924
|
const resolvedEditorPath = editorPath === null ? null : editorPath || EDITOR_PATH;
|
|
14483
|
-
const ctxValue = (0,
|
|
14925
|
+
const ctxValue = (0, import_react98.useMemo)(
|
|
14484
14926
|
() => ({
|
|
14485
14927
|
config,
|
|
14486
14928
|
pages: stablePages,
|
|
@@ -14488,26 +14930,26 @@ function AppProvider({
|
|
|
14488
14930
|
}),
|
|
14489
14931
|
[config, stablePages, resolvedEditorPath]
|
|
14490
14932
|
);
|
|
14491
|
-
const inner = /* @__PURE__ */ (0,
|
|
14933
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(appConfigContext.Provider, { value: ctxValue, children });
|
|
14492
14934
|
if (isServer) {
|
|
14493
|
-
return /* @__PURE__ */ (0,
|
|
14935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react_router2.StaticRouter, { location: currentPath != null ? currentPath : "/", children: inner });
|
|
14494
14936
|
}
|
|
14495
14937
|
if (router === "hash") {
|
|
14496
|
-
return /* @__PURE__ */ (0,
|
|
14938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react_router2.HashRouter, { children: inner });
|
|
14497
14939
|
}
|
|
14498
14940
|
if (router === "memory") {
|
|
14499
|
-
return /* @__PURE__ */ (0,
|
|
14941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react_router2.MemoryRouter, { initialEntries: [currentPath != null ? currentPath : "/"], children: inner });
|
|
14500
14942
|
}
|
|
14501
|
-
return /* @__PURE__ */ (0,
|
|
14943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react_router2.BrowserRouter, { children: inner });
|
|
14502
14944
|
}
|
|
14503
14945
|
|
|
14504
14946
|
// components/App/App.tsx
|
|
14505
|
-
var
|
|
14947
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
14506
14948
|
var joinEditorPath = (editorPath, route) => {
|
|
14507
14949
|
if (route === "/") return editorPath;
|
|
14508
14950
|
return `${editorPath}${route}`;
|
|
14509
14951
|
};
|
|
14510
|
-
var DefaultNotFound = () => /* @__PURE__ */ (0,
|
|
14952
|
+
var DefaultNotFound = () => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14511
14953
|
"div",
|
|
14512
14954
|
{
|
|
14513
14955
|
style: {
|
|
@@ -14517,9 +14959,9 @@ var DefaultNotFound = () => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
|
14517
14959
|
justifyContent: "center",
|
|
14518
14960
|
alignItems: "center"
|
|
14519
14961
|
},
|
|
14520
|
-
children: /* @__PURE__ */ (0,
|
|
14521
|
-
/* @__PURE__ */ (0,
|
|
14522
|
-
/* @__PURE__ */ (0,
|
|
14962
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { children: [
|
|
14963
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("h1", { children: "404" }),
|
|
14964
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { children: "No page matches this route." })
|
|
14523
14965
|
] })
|
|
14524
14966
|
}
|
|
14525
14967
|
);
|
|
@@ -14530,7 +14972,7 @@ function RenderForKey({
|
|
|
14530
14972
|
const { config, pages } = useApp();
|
|
14531
14973
|
const data = pages[routeKey];
|
|
14532
14974
|
if (!data) return null;
|
|
14533
|
-
return /* @__PURE__ */ (0,
|
|
14975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14534
14976
|
Render,
|
|
14535
14977
|
{
|
|
14536
14978
|
config,
|
|
@@ -14548,7 +14990,7 @@ function EditorForKey({
|
|
|
14548
14990
|
const { config, pages, routes, navigate } = useApp();
|
|
14549
14991
|
const data = pages[routeKey];
|
|
14550
14992
|
if (!data) return null;
|
|
14551
|
-
return /* @__PURE__ */ (0,
|
|
14993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14552
14994
|
Editor4,
|
|
14553
14995
|
{
|
|
14554
14996
|
config,
|
|
@@ -14585,12 +15027,12 @@ function AppRender({ metadata, renderNotFound }) {
|
|
|
14585
15027
|
const { pages, isEditing } = useApp();
|
|
14586
15028
|
if (isEditing) return null;
|
|
14587
15029
|
const routeKeys = Object.keys(pages);
|
|
14588
|
-
return /* @__PURE__ */ (0,
|
|
14589
|
-
routeKeys.map((routeKey) => /* @__PURE__ */ (0,
|
|
15030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_react_router3.Routes, { children: [
|
|
15031
|
+
routeKeys.map((routeKey) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14590
15032
|
import_react_router3.Route,
|
|
14591
15033
|
{
|
|
14592
15034
|
path: routeKey,
|
|
14593
|
-
element: /* @__PURE__ */ (0,
|
|
15035
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14594
15036
|
RenderForKey,
|
|
14595
15037
|
{
|
|
14596
15038
|
routeKey,
|
|
@@ -14600,11 +15042,11 @@ function AppRender({ metadata, renderNotFound }) {
|
|
|
14600
15042
|
},
|
|
14601
15043
|
`render:${routeKey}`
|
|
14602
15044
|
)),
|
|
14603
|
-
/* @__PURE__ */ (0,
|
|
15045
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14604
15046
|
import_react_router3.Route,
|
|
14605
15047
|
{
|
|
14606
15048
|
path: "*",
|
|
14607
|
-
element: renderNotFound ? /* @__PURE__ */ (0,
|
|
15049
|
+
element: renderNotFound ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_jsx_runtime94.Fragment, { children: renderNotFound() }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(DefaultNotFound, {})
|
|
14608
15050
|
}
|
|
14609
15051
|
)
|
|
14610
15052
|
] });
|
|
@@ -14614,12 +15056,12 @@ function AppEditor(props) {
|
|
|
14614
15056
|
const { pages, isEditing, editorPath } = useApp();
|
|
14615
15057
|
if (!isEditing || editorPath === null) return null;
|
|
14616
15058
|
const routeKeys = Object.keys(pages);
|
|
14617
|
-
return /* @__PURE__ */ (0,
|
|
14618
|
-
routeKeys.map((routeKey) => /* @__PURE__ */ (0,
|
|
15059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_react_router3.Routes, { children: [
|
|
15060
|
+
routeKeys.map((routeKey) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14619
15061
|
import_react_router3.Route,
|
|
14620
15062
|
{
|
|
14621
15063
|
path: joinEditorPath(editorPath, routeKey),
|
|
14622
|
-
element: /* @__PURE__ */ (0,
|
|
15064
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14623
15065
|
EditorForKey,
|
|
14624
15066
|
{
|
|
14625
15067
|
routeKey,
|
|
@@ -14630,26 +15072,26 @@ function AppEditor(props) {
|
|
|
14630
15072
|
},
|
|
14631
15073
|
`edit:${routeKey}`
|
|
14632
15074
|
)),
|
|
14633
|
-
/* @__PURE__ */ (0,
|
|
15075
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14634
15076
|
import_react_router3.Route,
|
|
14635
15077
|
{
|
|
14636
15078
|
path: "*",
|
|
14637
|
-
element: renderNotFound ? /* @__PURE__ */ (0,
|
|
15079
|
+
element: renderNotFound ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_jsx_runtime94.Fragment, { children: renderNotFound() }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(DefaultNotFound, {})
|
|
14638
15080
|
}
|
|
14639
15081
|
)
|
|
14640
15082
|
] });
|
|
14641
15083
|
}
|
|
14642
15084
|
function DefaultAppLayout(props) {
|
|
14643
15085
|
const _a = props, { renderNotFound } = _a, editorProps = __objRest(_a, ["renderNotFound"]);
|
|
14644
|
-
return /* @__PURE__ */ (0,
|
|
14645
|
-
/* @__PURE__ */ (0,
|
|
15086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
|
|
15087
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14646
15088
|
AppRender,
|
|
14647
15089
|
{
|
|
14648
15090
|
metadata: editorProps.metadata,
|
|
14649
15091
|
renderNotFound
|
|
14650
15092
|
}
|
|
14651
15093
|
),
|
|
14652
|
-
/* @__PURE__ */ (0,
|
|
15094
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(AppEditor, __spreadProps(__spreadValues({}, editorProps), { renderNotFound }))
|
|
14653
15095
|
] });
|
|
14654
15096
|
}
|
|
14655
15097
|
function App(props) {
|
|
@@ -14668,7 +15110,7 @@ function App(props) {
|
|
|
14668
15110
|
"router",
|
|
14669
15111
|
"children"
|
|
14670
15112
|
]);
|
|
14671
|
-
return /* @__PURE__ */ (0,
|
|
15113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14672
15114
|
AppProvider,
|
|
14673
15115
|
{
|
|
14674
15116
|
config,
|
|
@@ -14676,7 +15118,7 @@ function App(props) {
|
|
|
14676
15118
|
currentPath,
|
|
14677
15119
|
editorPath,
|
|
14678
15120
|
router,
|
|
14679
|
-
children: children != null ? children : /* @__PURE__ */ (0,
|
|
15121
|
+
children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(DefaultAppLayout, __spreadValues({}, layoutProps))
|
|
14680
15122
|
}
|
|
14681
15123
|
);
|
|
14682
15124
|
}
|
|
@@ -15009,25 +15451,6 @@ function resolveAllData(_0, _1) {
|
|
|
15009
15451
|
// bundle/core.ts
|
|
15010
15452
|
init_walk_tree();
|
|
15011
15453
|
|
|
15012
|
-
// plugins/blocks/index.tsx
|
|
15013
|
-
init_react_import();
|
|
15014
|
-
init_lucide_react();
|
|
15015
|
-
|
|
15016
|
-
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/blocks/styles.module.css#css-module
|
|
15017
|
-
init_react_import();
|
|
15018
|
-
var styles_module_default34 = { "BlocksPlugin": "_BlocksPlugin_15ud0_1" };
|
|
15019
|
-
|
|
15020
|
-
// plugins/blocks/index.tsx
|
|
15021
|
-
init_lib();
|
|
15022
|
-
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
15023
|
-
var getClassName42 = get_class_name_factory_default("BlocksPlugin", styles_module_default34);
|
|
15024
|
-
var blocksPlugin = () => ({
|
|
15025
|
-
name: "blocks",
|
|
15026
|
-
label: "Blocks",
|
|
15027
|
-
render: () => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: getClassName42(), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Components, {}) }),
|
|
15028
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Plus, {})
|
|
15029
|
-
});
|
|
15030
|
-
|
|
15031
15454
|
// plugins/outline/index.tsx
|
|
15032
15455
|
init_react_import();
|
|
15033
15456
|
init_lucide_react();
|
|
@@ -15155,7 +15578,6 @@ lucide-react/dist/esm/icons/smartphone.js:
|
|
|
15155
15578
|
lucide-react/dist/esm/icons/square-code.js:
|
|
15156
15579
|
lucide-react/dist/esm/icons/strikethrough.js:
|
|
15157
15580
|
lucide-react/dist/esm/icons/sun.js:
|
|
15158
|
-
lucide-react/dist/esm/icons/tablet.js:
|
|
15159
15581
|
lucide-react/dist/esm/icons/toy-brick.js:
|
|
15160
15582
|
lucide-react/dist/esm/icons/trash.js:
|
|
15161
15583
|
lucide-react/dist/esm/icons/underline.js:
|