@reacteditor/core 0.0.15 → 0.0.16
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-J7XDD77B.mjs} +7 -7
- package/dist/{chunk-RAMNEU3M.mjs → chunk-3NSI5XES.mjs} +1387 -1097
- package/dist/{chunk-3CGBQNX4.mjs → chunk-4L7H4JV4.mjs} +1 -1
- package/dist/{chunk-647NZJYM.mjs → chunk-5QKQ3LQJ.mjs} +3 -3
- package/dist/{chunk-NPC7A3V3.mjs → chunk-FTVOCMGV.mjs} +13 -3
- package/dist/{chunk-T43H325W.mjs → chunk-JHURG5NN.mjs} +122 -21
- package/dist/{chunk-TFAZFGYZ.mjs → chunk-Q667J2EG.mjs} +7 -7
- package/dist/{chunk-NKHR722W.mjs → chunk-RGC274VM.mjs} +1 -1
- package/dist/{chunk-C2KWANIN.mjs → chunk-RQZQMS6E.mjs} +1 -1
- package/dist/{chunk-GIGXMGTZ.mjs → chunk-TG2KTWSB.mjs} +1 -1
- package/dist/{full-PM3VSLYA.mjs → full-T5SGODJ2.mjs} +6 -6
- package/dist/index.css +530 -471
- package/dist/index.js +1271 -859
- package/dist/index.mjs +9 -9
- package/dist/{loaded-IIHO4UZS.mjs → loaded-6YKSFCCD.mjs} +3 -3
- package/dist/{loaded-5MUU76TF.mjs → loaded-DUBT6SP5.mjs} +3 -3
- package/dist/{loaded-ULJY3YN5.mjs → loaded-ZQCRSG65.mjs} +3 -3
- package/dist/no-external.css +530 -471
- package/dist/no-external.js +1271 -859
- package/dist/no-external.mjs +9 -9
- package/dist/rsc.js +14 -3
- package/dist/rsc.mjs +2 -2
- package/package.json +1 -2
package/dist/no-external.js
CHANGED
|
@@ -1072,20 +1072,6 @@ var init_sun = __esm({
|
|
|
1072
1072
|
}
|
|
1073
1073
|
});
|
|
1074
1074
|
|
|
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
1075
|
// ../../node_modules/lucide-react/dist/esm/icons/toy-brick.js
|
|
1090
1076
|
var ToyBrick;
|
|
1091
1077
|
var init_toy_brick = __esm({
|
|
@@ -1219,7 +1205,6 @@ var init_lucide_react = __esm({
|
|
|
1219
1205
|
init_smartphone();
|
|
1220
1206
|
init_strikethrough();
|
|
1221
1207
|
init_sun();
|
|
1222
|
-
init_tablet();
|
|
1223
1208
|
init_toy_brick();
|
|
1224
1209
|
init_trash();
|
|
1225
1210
|
init_underline();
|
|
@@ -3174,6 +3159,7 @@ var init_default_app_state = __esm({
|
|
|
3174
3159
|
"store/default-app-state.ts"() {
|
|
3175
3160
|
"use strict";
|
|
3176
3161
|
init_react_import();
|
|
3162
|
+
init_default_viewports();
|
|
3177
3163
|
defaultAppState = {
|
|
3178
3164
|
data: { content: [], root: {}, zones: {} },
|
|
3179
3165
|
ui: {
|
|
@@ -3186,9 +3172,10 @@ var init_default_app_state = __esm({
|
|
|
3186
3172
|
isDragging: false,
|
|
3187
3173
|
previewMode: "edit",
|
|
3188
3174
|
viewports: {
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3175
|
+
current: {
|
|
3176
|
+
width: defaultViewports[0].width,
|
|
3177
|
+
height: defaultViewports[0].height || "auto"
|
|
3178
|
+
},
|
|
3192
3179
|
options: [],
|
|
3193
3180
|
controlsVisible: true
|
|
3194
3181
|
},
|
|
@@ -3429,6 +3416,136 @@ var init_store = __esm({
|
|
|
3429
3416
|
}
|
|
3430
3417
|
});
|
|
3431
3418
|
|
|
3419
|
+
// ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
3420
|
+
function invariant(condition, message) {
|
|
3421
|
+
if (condition) {
|
|
3422
|
+
return;
|
|
3423
|
+
}
|
|
3424
|
+
if (isProduction) {
|
|
3425
|
+
throw new Error(prefix);
|
|
3426
|
+
}
|
|
3427
|
+
var provided = typeof message === "function" ? message() : message;
|
|
3428
|
+
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|
3429
|
+
throw new Error(value);
|
|
3430
|
+
}
|
|
3431
|
+
var isProduction, prefix;
|
|
3432
|
+
var init_tiny_invariant = __esm({
|
|
3433
|
+
"../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js"() {
|
|
3434
|
+
"use strict";
|
|
3435
|
+
init_react_import();
|
|
3436
|
+
isProduction = process.env.NODE_ENV === "production";
|
|
3437
|
+
prefix = "Invariant failed";
|
|
3438
|
+
}
|
|
3439
|
+
});
|
|
3440
|
+
|
|
3441
|
+
// ../../node_modules/css-box-model/dist/css-box-model.esm.js
|
|
3442
|
+
var getRect, expand, shrink, noSpacing, createBox, parse, calculateBox, getBox;
|
|
3443
|
+
var init_css_box_model_esm = __esm({
|
|
3444
|
+
"../../node_modules/css-box-model/dist/css-box-model.esm.js"() {
|
|
3445
|
+
"use strict";
|
|
3446
|
+
init_react_import();
|
|
3447
|
+
init_tiny_invariant();
|
|
3448
|
+
getRect = function getRect2(_ref) {
|
|
3449
|
+
var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
|
|
3450
|
+
var width = right - left;
|
|
3451
|
+
var height = bottom - top;
|
|
3452
|
+
var rect = {
|
|
3453
|
+
top,
|
|
3454
|
+
right,
|
|
3455
|
+
bottom,
|
|
3456
|
+
left,
|
|
3457
|
+
width,
|
|
3458
|
+
height,
|
|
3459
|
+
x: left,
|
|
3460
|
+
y: top,
|
|
3461
|
+
center: {
|
|
3462
|
+
x: (right + left) / 2,
|
|
3463
|
+
y: (bottom + top) / 2
|
|
3464
|
+
}
|
|
3465
|
+
};
|
|
3466
|
+
return rect;
|
|
3467
|
+
};
|
|
3468
|
+
expand = function expand2(target, expandBy) {
|
|
3469
|
+
return {
|
|
3470
|
+
top: target.top - expandBy.top,
|
|
3471
|
+
left: target.left - expandBy.left,
|
|
3472
|
+
bottom: target.bottom + expandBy.bottom,
|
|
3473
|
+
right: target.right + expandBy.right
|
|
3474
|
+
};
|
|
3475
|
+
};
|
|
3476
|
+
shrink = function shrink2(target, shrinkBy) {
|
|
3477
|
+
return {
|
|
3478
|
+
top: target.top + shrinkBy.top,
|
|
3479
|
+
left: target.left + shrinkBy.left,
|
|
3480
|
+
bottom: target.bottom - shrinkBy.bottom,
|
|
3481
|
+
right: target.right - shrinkBy.right
|
|
3482
|
+
};
|
|
3483
|
+
};
|
|
3484
|
+
noSpacing = {
|
|
3485
|
+
top: 0,
|
|
3486
|
+
right: 0,
|
|
3487
|
+
bottom: 0,
|
|
3488
|
+
left: 0
|
|
3489
|
+
};
|
|
3490
|
+
createBox = function createBox2(_ref2) {
|
|
3491
|
+
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;
|
|
3492
|
+
var marginBox = getRect(expand(borderBox, margin));
|
|
3493
|
+
var paddingBox = getRect(shrink(borderBox, border));
|
|
3494
|
+
var contentBox = getRect(shrink(paddingBox, padding));
|
|
3495
|
+
return {
|
|
3496
|
+
marginBox,
|
|
3497
|
+
borderBox: getRect(borderBox),
|
|
3498
|
+
paddingBox,
|
|
3499
|
+
contentBox,
|
|
3500
|
+
margin,
|
|
3501
|
+
border,
|
|
3502
|
+
padding
|
|
3503
|
+
};
|
|
3504
|
+
};
|
|
3505
|
+
parse = function parse2(raw) {
|
|
3506
|
+
var value = raw.slice(0, -2);
|
|
3507
|
+
var suffix = raw.slice(-2);
|
|
3508
|
+
if (suffix !== "px") {
|
|
3509
|
+
return 0;
|
|
3510
|
+
}
|
|
3511
|
+
var result = Number(value);
|
|
3512
|
+
!!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
|
|
3513
|
+
return result;
|
|
3514
|
+
};
|
|
3515
|
+
calculateBox = function calculateBox2(borderBox, styles2) {
|
|
3516
|
+
var margin = {
|
|
3517
|
+
top: parse(styles2.marginTop),
|
|
3518
|
+
right: parse(styles2.marginRight),
|
|
3519
|
+
bottom: parse(styles2.marginBottom),
|
|
3520
|
+
left: parse(styles2.marginLeft)
|
|
3521
|
+
};
|
|
3522
|
+
var padding = {
|
|
3523
|
+
top: parse(styles2.paddingTop),
|
|
3524
|
+
right: parse(styles2.paddingRight),
|
|
3525
|
+
bottom: parse(styles2.paddingBottom),
|
|
3526
|
+
left: parse(styles2.paddingLeft)
|
|
3527
|
+
};
|
|
3528
|
+
var border = {
|
|
3529
|
+
top: parse(styles2.borderTopWidth),
|
|
3530
|
+
right: parse(styles2.borderRightWidth),
|
|
3531
|
+
bottom: parse(styles2.borderBottomWidth),
|
|
3532
|
+
left: parse(styles2.borderLeftWidth)
|
|
3533
|
+
};
|
|
3534
|
+
return createBox({
|
|
3535
|
+
borderBox,
|
|
3536
|
+
margin,
|
|
3537
|
+
padding,
|
|
3538
|
+
border
|
|
3539
|
+
});
|
|
3540
|
+
};
|
|
3541
|
+
getBox = function getBox2(el) {
|
|
3542
|
+
var borderBox = el.getBoundingClientRect();
|
|
3543
|
+
var styles2 = window.getComputedStyle(el);
|
|
3544
|
+
return calculateBox(borderBox, styles2);
|
|
3545
|
+
};
|
|
3546
|
+
}
|
|
3547
|
+
});
|
|
3548
|
+
|
|
3432
3549
|
// lib/get-zoom-config.ts
|
|
3433
3550
|
var init_get_zoom_config = __esm({
|
|
3434
3551
|
"lib/get-zoom-config.ts"() {
|
|
@@ -7805,7 +7922,7 @@ var import_react_router3 = require("react-router");
|
|
|
7805
7922
|
|
|
7806
7923
|
// components/Editor/index.tsx
|
|
7807
7924
|
init_react_import();
|
|
7808
|
-
var
|
|
7925
|
+
var import_react95 = require("react");
|
|
7809
7926
|
init_store();
|
|
7810
7927
|
|
|
7811
7928
|
// components/Editor/components/Fields/index.tsx
|
|
@@ -11862,55 +11979,12 @@ function AutoFrame(_a) {
|
|
|
11862
11979
|
}
|
|
11863
11980
|
}
|
|
11864
11981
|
}, [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
11982
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
11909
11983
|
"iframe",
|
|
11910
11984
|
__spreadProps(__spreadValues({}, props), {
|
|
11911
11985
|
className,
|
|
11912
11986
|
id,
|
|
11913
|
-
srcDoc: '<!DOCTYPE html><html><head
|
|
11987
|
+
srcDoc: '<!DOCTYPE html><html><head></head><body><div id="frame-root" data-editor-entry></div></body></html>',
|
|
11914
11988
|
ref: frameRef,
|
|
11915
11989
|
onLoad: () => {
|
|
11916
11990
|
setLoaded(true);
|
|
@@ -11931,7 +12005,7 @@ var AutoFrame_default = AutoFrame;
|
|
|
11931
12005
|
|
|
11932
12006
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Preview/styles.module.css#css-module
|
|
11933
12007
|
init_react_import();
|
|
11934
|
-
var styles_module_default23 = { "EditorPreview": "
|
|
12008
|
+
var styles_module_default23 = { "EditorPreview": "_EditorPreview_1ybfe_1", "EditorPreview-frame": "_EditorPreview-frame_1ybfe_6" };
|
|
11935
12009
|
|
|
11936
12010
|
// components/Editor/components/Preview/index.tsx
|
|
11937
12011
|
init_lib();
|
|
@@ -12893,12 +12967,12 @@ init_to_component();
|
|
|
12893
12967
|
|
|
12894
12968
|
// components/Editor/components/Layout/index.tsx
|
|
12895
12969
|
init_react_import();
|
|
12896
|
-
var
|
|
12970
|
+
var import_react94 = require("react");
|
|
12897
12971
|
init_lib();
|
|
12898
12972
|
|
|
12899
12973
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Layout/styles.module.css#css-module
|
|
12900
12974
|
init_react_import();
|
|
12901
|
-
var styles_module_default25 = { "Editor": "
|
|
12975
|
+
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
12976
|
|
|
12903
12977
|
// lib/use-inject-css.ts
|
|
12904
12978
|
init_react_import();
|
|
@@ -13063,12 +13137,10 @@ var SidebarSection = ({
|
|
|
13063
13137
|
noBorderTop,
|
|
13064
13138
|
isLoading
|
|
13065
13139
|
}) => {
|
|
13066
|
-
const showTitleBar = title !== null && title !== void 0;
|
|
13067
|
-
const showBreadcrumbsRow = !!showBreadcrumbs;
|
|
13068
13140
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: getClassName34({ noBorderTop }), style: { background }, children: [
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
13141
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: getClassName34("title"), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: getClassName34("breadcrumbs"), children: [
|
|
13142
|
+
showBreadcrumbs && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Breadcrumbs, {}),
|
|
13143
|
+
/* @__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
13144
|
] }) }),
|
|
13073
13145
|
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: getClassName34("content"), children }),
|
|
13074
13146
|
isLoading && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: getClassName34("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Loader, { size: 32 }) })
|
|
@@ -13077,14 +13149,269 @@ var SidebarSection = ({
|
|
|
13077
13149
|
|
|
13078
13150
|
// components/Editor/components/Canvas/index.tsx
|
|
13079
13151
|
init_react_import();
|
|
13080
|
-
|
|
13152
|
+
init_css_box_model_esm();
|
|
13153
|
+
var import_react89 = require("react");
|
|
13154
|
+
init_lucide_react();
|
|
13155
|
+
init_store();
|
|
13156
|
+
|
|
13157
|
+
// components/BrowserBar/index.tsx
|
|
13158
|
+
init_react_import();
|
|
13081
13159
|
init_lucide_react();
|
|
13082
|
-
var
|
|
13160
|
+
var import_react87 = require("react");
|
|
13083
13161
|
init_store();
|
|
13162
|
+
init_lib();
|
|
13163
|
+
init_IconButton2();
|
|
13164
|
+
|
|
13165
|
+
// components/ui/Combobox/index.tsx
|
|
13166
|
+
init_react_import();
|
|
13167
|
+
var import_react86 = require("@base-ui/react");
|
|
13168
|
+
init_lucide_react();
|
|
13169
|
+
init_lib();
|
|
13170
|
+
|
|
13171
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ui/Combobox/styles.module.css#css-module
|
|
13172
|
+
init_react_import();
|
|
13173
|
+
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" };
|
|
13174
|
+
|
|
13175
|
+
// components/ui/Combobox/index.tsx
|
|
13176
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
13177
|
+
var getClassName35 = get_class_name_factory_default("EditorCombobox", styles_module_default28);
|
|
13178
|
+
var join = (...values) => values.filter(Boolean).join(" ");
|
|
13179
|
+
var mergeClassName = (base, override) => {
|
|
13180
|
+
if (!override) return base;
|
|
13181
|
+
if (typeof override === "function") {
|
|
13182
|
+
return (state) => join(base, override(state));
|
|
13183
|
+
}
|
|
13184
|
+
return join(base, override);
|
|
13185
|
+
};
|
|
13186
|
+
var Combobox = import_react86.Combobox.Root;
|
|
13187
|
+
function ComboboxInput(_a) {
|
|
13188
|
+
var _b = _a, {
|
|
13189
|
+
className
|
|
13190
|
+
} = _b, props = __objRest(_b, [
|
|
13191
|
+
"className"
|
|
13192
|
+
]);
|
|
13193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
13194
|
+
import_react86.Combobox.Input,
|
|
13195
|
+
__spreadValues({
|
|
13196
|
+
"data-slot": "combobox-input",
|
|
13197
|
+
className: mergeClassName(getClassName35("input"), className)
|
|
13198
|
+
}, props)
|
|
13199
|
+
);
|
|
13200
|
+
}
|
|
13201
|
+
function ComboboxContent(_a) {
|
|
13202
|
+
var _b = _a, {
|
|
13203
|
+
className,
|
|
13204
|
+
side = "bottom",
|
|
13205
|
+
sideOffset = 4,
|
|
13206
|
+
align = "start",
|
|
13207
|
+
alignOffset = 0,
|
|
13208
|
+
children
|
|
13209
|
+
} = _b, props = __objRest(_b, [
|
|
13210
|
+
"className",
|
|
13211
|
+
"side",
|
|
13212
|
+
"sideOffset",
|
|
13213
|
+
"align",
|
|
13214
|
+
"alignOffset",
|
|
13215
|
+
"children"
|
|
13216
|
+
]);
|
|
13217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_react86.Combobox.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
13218
|
+
import_react86.Combobox.Positioner,
|
|
13219
|
+
{
|
|
13220
|
+
side,
|
|
13221
|
+
sideOffset,
|
|
13222
|
+
align,
|
|
13223
|
+
alignOffset,
|
|
13224
|
+
className: getClassName35("positioner"),
|
|
13225
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
13226
|
+
import_react86.Combobox.Popup,
|
|
13227
|
+
__spreadProps(__spreadValues({
|
|
13228
|
+
"data-slot": "combobox-content",
|
|
13229
|
+
className: mergeClassName(getClassName35("content"), className)
|
|
13230
|
+
}, props), {
|
|
13231
|
+
children
|
|
13232
|
+
})
|
|
13233
|
+
)
|
|
13234
|
+
}
|
|
13235
|
+
) });
|
|
13236
|
+
}
|
|
13237
|
+
function ComboboxList(_a) {
|
|
13238
|
+
var _b = _a, {
|
|
13239
|
+
className
|
|
13240
|
+
} = _b, props = __objRest(_b, [
|
|
13241
|
+
"className"
|
|
13242
|
+
]);
|
|
13243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
13244
|
+
import_react86.Combobox.List,
|
|
13245
|
+
__spreadValues({
|
|
13246
|
+
"data-slot": "combobox-list",
|
|
13247
|
+
className: mergeClassName(getClassName35("list"), className)
|
|
13248
|
+
}, props)
|
|
13249
|
+
);
|
|
13250
|
+
}
|
|
13251
|
+
function ComboboxItem(_a) {
|
|
13252
|
+
var _b = _a, {
|
|
13253
|
+
className,
|
|
13254
|
+
children
|
|
13255
|
+
} = _b, props = __objRest(_b, [
|
|
13256
|
+
"className",
|
|
13257
|
+
"children"
|
|
13258
|
+
]);
|
|
13259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
13260
|
+
import_react86.Combobox.Item,
|
|
13261
|
+
__spreadProps(__spreadValues({
|
|
13262
|
+
"data-slot": "combobox-item",
|
|
13263
|
+
className: mergeClassName(getClassName35("item"), className)
|
|
13264
|
+
}, props), {
|
|
13265
|
+
children: [
|
|
13266
|
+
/* @__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 }) }) }),
|
|
13267
|
+
children
|
|
13268
|
+
]
|
|
13269
|
+
})
|
|
13270
|
+
);
|
|
13271
|
+
}
|
|
13272
|
+
function ComboboxEmpty(_a) {
|
|
13273
|
+
var _b = _a, {
|
|
13274
|
+
className
|
|
13275
|
+
} = _b, props = __objRest(_b, [
|
|
13276
|
+
"className"
|
|
13277
|
+
]);
|
|
13278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
13279
|
+
import_react86.Combobox.Empty,
|
|
13280
|
+
__spreadValues({
|
|
13281
|
+
"data-slot": "combobox-empty",
|
|
13282
|
+
className: mergeClassName(getClassName35("empty"), className)
|
|
13283
|
+
}, props)
|
|
13284
|
+
);
|
|
13285
|
+
}
|
|
13286
|
+
|
|
13287
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/BrowserBar/styles.module.css#css-module
|
|
13288
|
+
init_react_import();
|
|
13289
|
+
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" };
|
|
13290
|
+
|
|
13291
|
+
// components/BrowserBar/index.tsx
|
|
13292
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
13293
|
+
var normalizeRoute = (raw) => {
|
|
13294
|
+
const trimmed = raw.trim();
|
|
13295
|
+
if (!trimmed) return trimmed;
|
|
13296
|
+
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
13297
|
+
};
|
|
13298
|
+
var getClassName36 = get_class_name_factory_default("BrowserBar", styles_module_default29);
|
|
13299
|
+
var DEVICE_VIEWPORTS = {
|
|
13300
|
+
desktop: { width: "100%", height: "auto", icon: "Monitor", label: "Desktop" },
|
|
13301
|
+
mobile: { width: 360, height: "auto", icon: "Smartphone", label: "Mobile" }
|
|
13302
|
+
};
|
|
13303
|
+
var UrlBar = () => {
|
|
13304
|
+
const { routes, currentRoute, onRouteChange } = usePropsContext();
|
|
13305
|
+
const chrome = useChromeConfig();
|
|
13306
|
+
const showRoutePicker = !!routes && currentRoute !== void 0 && !!onRouteChange;
|
|
13307
|
+
const [inputValue, setInputValue] = (0, import_react87.useState)(currentRoute != null ? currentRoute : "");
|
|
13308
|
+
const lastSyncedPath = (0, import_react87.useRef)(currentRoute);
|
|
13309
|
+
if (lastSyncedPath.current !== currentRoute) {
|
|
13310
|
+
lastSyncedPath.current = currentRoute;
|
|
13311
|
+
setInputValue(currentRoute != null ? currentRoute : "");
|
|
13312
|
+
}
|
|
13313
|
+
const submit = (raw) => {
|
|
13314
|
+
const next = normalizeRoute(raw);
|
|
13315
|
+
if (!next || next === currentRoute) return;
|
|
13316
|
+
void (onRouteChange == null ? void 0 : onRouteChange(next));
|
|
13317
|
+
};
|
|
13318
|
+
if (!chrome.showUrlBar) return null;
|
|
13319
|
+
if (showRoutePicker) {
|
|
13320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
13321
|
+
Combobox,
|
|
13322
|
+
{
|
|
13323
|
+
items: routes,
|
|
13324
|
+
value: currentRoute,
|
|
13325
|
+
onValueChange: (next) => {
|
|
13326
|
+
if (typeof next === "string") submit(next);
|
|
13327
|
+
},
|
|
13328
|
+
inputValue,
|
|
13329
|
+
onInputValueChange: (next) => setInputValue(next),
|
|
13330
|
+
autoHighlight: false,
|
|
13331
|
+
children: [
|
|
13332
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
13333
|
+
"form",
|
|
13334
|
+
{
|
|
13335
|
+
className: getClassName36("urlTrigger"),
|
|
13336
|
+
onSubmit: (event) => {
|
|
13337
|
+
event.preventDefault();
|
|
13338
|
+
submit(inputValue);
|
|
13339
|
+
},
|
|
13340
|
+
children: [
|
|
13341
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Globe, { className: getClassName36("urlIcon"), size: 14 }),
|
|
13342
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13343
|
+
ComboboxInput,
|
|
13344
|
+
{
|
|
13345
|
+
className: getClassName36("urlInput"),
|
|
13346
|
+
placeholder: "/",
|
|
13347
|
+
spellCheck: false,
|
|
13348
|
+
autoCorrect: "off",
|
|
13349
|
+
autoCapitalize: "off"
|
|
13350
|
+
}
|
|
13351
|
+
)
|
|
13352
|
+
]
|
|
13353
|
+
}
|
|
13354
|
+
),
|
|
13355
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(ComboboxContent, { children: [
|
|
13356
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ComboboxEmpty, { children: "Press Enter to go to this path" }),
|
|
13357
|
+
/* @__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) })
|
|
13358
|
+
] })
|
|
13359
|
+
]
|
|
13360
|
+
}
|
|
13361
|
+
);
|
|
13362
|
+
}
|
|
13363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: getClassName36("urlTrigger"), children: [
|
|
13364
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Globe, { className: getClassName36("urlIcon"), size: 14 }),
|
|
13365
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: getClassName36("urlText"), children: "/" })
|
|
13366
|
+
] });
|
|
13367
|
+
};
|
|
13368
|
+
var DeviceToggle = ({
|
|
13369
|
+
onViewportChange
|
|
13370
|
+
}) => {
|
|
13371
|
+
const chrome = useChromeConfig();
|
|
13372
|
+
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
13373
|
+
const activeDevice = (0, import_react87.useMemo)(() => {
|
|
13374
|
+
const w = viewports.current.width;
|
|
13375
|
+
if (typeof w === "number" && w <= 640) return "mobile";
|
|
13376
|
+
return "desktop";
|
|
13377
|
+
}, [viewports.current.width]);
|
|
13378
|
+
if (!chrome.showDeviceToggle) return null;
|
|
13379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13380
|
+
IconButton,
|
|
13381
|
+
{
|
|
13382
|
+
type: "button",
|
|
13383
|
+
title: activeDevice === "desktop" ? "Switch to mobile viewport" : "Switch to desktop viewport",
|
|
13384
|
+
onClick: () => onViewportChange == null ? void 0 : onViewportChange(
|
|
13385
|
+
DEVICE_VIEWPORTS[activeDevice === "desktop" ? "mobile" : "desktop"]
|
|
13386
|
+
),
|
|
13387
|
+
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 }) })
|
|
13388
|
+
}
|
|
13389
|
+
);
|
|
13390
|
+
};
|
|
13391
|
+
var FullScreenToggle = () => {
|
|
13392
|
+
const chrome = useChromeConfig();
|
|
13393
|
+
const dispatch = useAppStore((s) => s.dispatch);
|
|
13394
|
+
const isFullScreen = useAppStore(
|
|
13395
|
+
(s) => {
|
|
13396
|
+
var _a;
|
|
13397
|
+
return (_a = s.state.ui.canvasFullScreen) != null ? _a : false;
|
|
13398
|
+
}
|
|
13399
|
+
);
|
|
13400
|
+
if (!chrome.showFullScreenToggle) return null;
|
|
13401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
13402
|
+
IconButton,
|
|
13403
|
+
{
|
|
13404
|
+
type: "button",
|
|
13405
|
+
title: isFullScreen ? "Exit full screen" : "Enter full screen",
|
|
13406
|
+
onClick: () => dispatch({ type: "setUi", ui: { canvasFullScreen: !isFullScreen } }),
|
|
13407
|
+
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 }) })
|
|
13408
|
+
}
|
|
13409
|
+
);
|
|
13410
|
+
};
|
|
13084
13411
|
|
|
13085
13412
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Canvas/styles.module.css#css-module
|
|
13086
13413
|
init_react_import();
|
|
13087
|
-
var
|
|
13414
|
+
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
13415
|
|
|
13089
13416
|
// components/Editor/components/Canvas/index.tsx
|
|
13090
13417
|
init_lib();
|
|
@@ -13094,77 +13421,56 @@ var import_shallow9 = require("zustand/react/shallow");
|
|
|
13094
13421
|
|
|
13095
13422
|
// lib/frame-context.tsx
|
|
13096
13423
|
init_react_import();
|
|
13097
|
-
var
|
|
13098
|
-
var
|
|
13099
|
-
var FrameContext = (0,
|
|
13424
|
+
var import_react88 = require("react");
|
|
13425
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
13426
|
+
var FrameContext = (0, import_react88.createContext)(null);
|
|
13100
13427
|
var FrameProvider = ({
|
|
13101
13428
|
children
|
|
13102
13429
|
}) => {
|
|
13103
|
-
const frameRef = (0,
|
|
13104
|
-
const value = (0,
|
|
13430
|
+
const frameRef = (0, import_react88.useRef)(null);
|
|
13431
|
+
const value = (0, import_react88.useMemo)(
|
|
13105
13432
|
() => ({
|
|
13106
13433
|
frameRef
|
|
13107
13434
|
}),
|
|
13108
13435
|
[]
|
|
13109
13436
|
);
|
|
13110
|
-
return /* @__PURE__ */ (0,
|
|
13437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(FrameContext.Provider, { value, children });
|
|
13111
13438
|
};
|
|
13112
13439
|
var useCanvasFrame = () => {
|
|
13113
|
-
const context = (0,
|
|
13440
|
+
const context = (0, import_react88.useContext)(FrameContext);
|
|
13114
13441
|
if (context === null) {
|
|
13115
13442
|
throw new Error("useCanvasFrame must be used within a FrameProvider");
|
|
13116
13443
|
}
|
|
13117
13444
|
return context;
|
|
13118
13445
|
};
|
|
13119
13446
|
|
|
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
13447
|
// components/Editor/components/Canvas/index.tsx
|
|
13131
|
-
|
|
13132
|
-
var
|
|
13448
|
+
init_default_viewports();
|
|
13449
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
13450
|
+
var getClassName37 = get_class_name_factory_default("EditorCanvas", styles_module_default30);
|
|
13451
|
+
var ZOOM_STEP = 0.15;
|
|
13133
13452
|
var MIN_ZOOM = 0.25;
|
|
13134
13453
|
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 = () => {
|
|
13454
|
+
var TRANSITION_DURATION = 150;
|
|
13455
|
+
var Canvas = ({
|
|
13456
|
+
themeIcon,
|
|
13457
|
+
themeLabel,
|
|
13458
|
+
onToggleTheme
|
|
13459
|
+
} = {}) => {
|
|
13460
|
+
var _a, _b;
|
|
13162
13461
|
const { frameRef } = useCanvasFrame();
|
|
13163
|
-
const
|
|
13462
|
+
const chrome = useChromeConfig();
|
|
13463
|
+
const {
|
|
13464
|
+
viewports: viewportOptions = defaultViewports,
|
|
13465
|
+
ui: uiProp,
|
|
13466
|
+
disableZoomControls
|
|
13467
|
+
} = usePropsContext();
|
|
13164
13468
|
const {
|
|
13165
13469
|
dispatch,
|
|
13166
13470
|
overrides,
|
|
13167
13471
|
setUi,
|
|
13472
|
+
zoomConfig,
|
|
13473
|
+
setZoomConfig,
|
|
13168
13474
|
status,
|
|
13169
13475
|
iframe,
|
|
13170
13476
|
fullScreenCanvas
|
|
@@ -13173,6 +13479,8 @@ var Canvas = () => {
|
|
|
13173
13479
|
dispatch: s.dispatch,
|
|
13174
13480
|
overrides: s.overrides,
|
|
13175
13481
|
setUi: s.setUi,
|
|
13482
|
+
zoomConfig: s.zoomConfig,
|
|
13483
|
+
setZoomConfig: s.setZoomConfig,
|
|
13176
13484
|
status: s.status,
|
|
13177
13485
|
iframe: s.iframe,
|
|
13178
13486
|
fullScreenCanvas: s.fullScreenCanvas
|
|
@@ -13181,203 +13489,143 @@ var Canvas = () => {
|
|
|
13181
13489
|
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
13182
13490
|
const canvasFullScreen = useAppStore(
|
|
13183
13491
|
(s) => {
|
|
13184
|
-
var
|
|
13185
|
-
return (
|
|
13492
|
+
var _a2;
|
|
13493
|
+
return (_a2 = s.state.ui.canvasFullScreen) != null ? _a2 : false;
|
|
13186
13494
|
}
|
|
13187
13495
|
);
|
|
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 });
|
|
13496
|
+
const [canvasZoom, setCanvasZoom] = (0, import_react89.useState)(1);
|
|
13497
|
+
const zoomIn = () => setCanvasZoom((z) => Math.min(z + ZOOM_STEP, MAX_ZOOM));
|
|
13498
|
+
const zoomOut = () => setCanvasZoom((z) => Math.max(z - ZOOM_STEP, MIN_ZOOM));
|
|
13499
|
+
const resetZoom = () => setCanvasZoom(1);
|
|
13500
|
+
const [showTransition, setShowTransition] = (0, import_react89.useState)(false);
|
|
13501
|
+
const isResizingRef = (0, import_react89.useRef)(false);
|
|
13502
|
+
const defaultRender = (0, import_react89.useMemo)(() => {
|
|
13503
|
+
const EditorDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_jsx_runtime86.Fragment, { children });
|
|
13213
13504
|
return EditorDefault;
|
|
13214
13505
|
}, []);
|
|
13215
|
-
const CustomPreview = (0,
|
|
13506
|
+
const CustomPreview = (0, import_react89.useMemo)(
|
|
13216
13507
|
() => overrides.preview || defaultRender,
|
|
13217
13508
|
[overrides]
|
|
13218
13509
|
);
|
|
13219
|
-
const
|
|
13220
|
-
|
|
13510
|
+
const getFrameDimensions = (0, import_react89.useCallback)(() => {
|
|
13511
|
+
if (frameRef.current) {
|
|
13512
|
+
const frame = frameRef.current;
|
|
13513
|
+
const box = getBox(frame);
|
|
13514
|
+
return { width: box.contentBox.width, height: box.contentBox.height };
|
|
13515
|
+
}
|
|
13516
|
+
return { width: 0, height: 0 };
|
|
13517
|
+
}, [frameRef]);
|
|
13518
|
+
(0, import_react89.useEffect)(() => {
|
|
13519
|
+
const { height: frameHeight } = getFrameDimensions();
|
|
13520
|
+
if (viewports.current.height === "auto") {
|
|
13521
|
+
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom: 1, rootHeight: frameHeight }));
|
|
13522
|
+
}
|
|
13523
|
+
}, [getFrameDimensions, setZoomConfig, viewports.current.height]);
|
|
13524
|
+
const [showLoader, setShowLoader] = (0, import_react89.useState)(false);
|
|
13525
|
+
(0, import_react89.useEffect)(() => {
|
|
13221
13526
|
setTimeout(() => {
|
|
13222
13527
|
setShowLoader(true);
|
|
13223
13528
|
}, 500);
|
|
13224
13529
|
}, []);
|
|
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)
|
|
13530
|
+
const appStoreApi = useAppStoreApi();
|
|
13531
|
+
const autoSelectingRef = (0, import_react89.useRef)(true);
|
|
13532
|
+
const pickClosestViewport = (0, import_react89.useCallback)(() => {
|
|
13533
|
+
var _a2, _b2;
|
|
13534
|
+
if (typeof window === "undefined") return null;
|
|
13535
|
+
const viewportWidth = window.innerWidth;
|
|
13536
|
+
const frameWidth = (_a2 = frameRef.current) == null ? void 0 : _a2.getBoundingClientRect().width;
|
|
13537
|
+
if (!viewportWidth) return null;
|
|
13538
|
+
if (!frameWidth) return null;
|
|
13539
|
+
if (viewportOptions.length === 0) return null;
|
|
13540
|
+
const fullWidthViewport = Object.values(viewportOptions).find(
|
|
13541
|
+
(v) => v.width === "100%"
|
|
13317
13542
|
);
|
|
13318
|
-
const
|
|
13319
|
-
|
|
13320
|
-
|
|
13321
|
-
|
|
13322
|
-
|
|
13323
|
-
|
|
13324
|
-
}
|
|
13543
|
+
const viewportDifferences = Object.entries(viewportOptions).filter(([_, value]) => value.width !== "100%").map(([key, value]) => ({
|
|
13544
|
+
key,
|
|
13545
|
+
diff: Math.abs(
|
|
13546
|
+
viewportWidth - (typeof value.width === "string" ? viewportWidth : value.width)
|
|
13547
|
+
),
|
|
13548
|
+
value
|
|
13549
|
+
})).sort((a, b) => a.diff > b.diff ? 1 : -1);
|
|
13550
|
+
let closestViewport = (_b2 = viewportDifferences[0]) == null ? void 0 : _b2.value;
|
|
13551
|
+
if (!closestViewport) return null;
|
|
13552
|
+
if (closestViewport.width < frameWidth && fullWidthViewport) {
|
|
13553
|
+
closestViewport = fullWidthViewport;
|
|
13554
|
+
}
|
|
13555
|
+
return closestViewport;
|
|
13556
|
+
}, [viewportOptions, frameRef]);
|
|
13557
|
+
(0, import_react89.useEffect)(() => {
|
|
13558
|
+
var _a2;
|
|
13559
|
+
if (typeof window === "undefined") return;
|
|
13560
|
+
if ((_a2 = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _a2.current) return;
|
|
13561
|
+
const closestViewport = pickClosestViewport();
|
|
13562
|
+
if (!closestViewport) return;
|
|
13325
13563
|
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;
|
|
13564
|
+
const s = appStoreApi.getState();
|
|
13565
|
+
const appState = {
|
|
13566
|
+
state: __spreadProps(__spreadValues({}, s.state), {
|
|
13567
|
+
ui: __spreadProps(__spreadValues({}, s.state.ui), {
|
|
13568
|
+
viewports: __spreadProps(__spreadValues({}, s.state.ui.viewports), {
|
|
13569
|
+
current: __spreadProps(__spreadValues({}, s.state.ui.viewports.current), {
|
|
13570
|
+
height: (closestViewport == null ? void 0 : closestViewport.height) || "auto",
|
|
13571
|
+
width: closestViewport == null ? void 0 : closestViewport.width
|
|
13572
|
+
})
|
|
13573
|
+
})
|
|
13574
|
+
})
|
|
13575
|
+
})
|
|
13341
13576
|
};
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
|
|
13345
|
-
}, 100);
|
|
13346
|
-
cleanups.push(() => window.clearInterval(interval));
|
|
13577
|
+
let history = s.history;
|
|
13578
|
+
if (s.history.histories.length === 1) {
|
|
13579
|
+
history = __spreadProps(__spreadValues({}, history), { histories: [appState] });
|
|
13347
13580
|
}
|
|
13581
|
+
appStoreApi.setState(__spreadProps(__spreadValues({}, appState), { history }));
|
|
13348
13582
|
}
|
|
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
|
-
|
|
13583
|
+
}, [
|
|
13584
|
+
pickClosestViewport,
|
|
13585
|
+
frameRef.current,
|
|
13586
|
+
iframe,
|
|
13587
|
+
appStoreApi,
|
|
13588
|
+
(_a = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _a.current
|
|
13589
|
+
]);
|
|
13590
|
+
(0, import_react89.useEffect)(() => {
|
|
13591
|
+
var _a2;
|
|
13592
|
+
if (typeof window === "undefined") return;
|
|
13593
|
+
if (!iframe.enabled) return;
|
|
13594
|
+
if ((_a2 = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _a2.current) return;
|
|
13595
|
+
const target = frameRef.current;
|
|
13596
|
+
if (!target) return;
|
|
13597
|
+
const observer = new ResizeObserver(() => {
|
|
13598
|
+
if (!autoSelectingRef.current) return;
|
|
13599
|
+
const closestViewport = pickClosestViewport();
|
|
13600
|
+
if (!closestViewport) return;
|
|
13601
|
+
const s = appStoreApi.getState();
|
|
13602
|
+
const current = s.state.ui.viewports.current;
|
|
13603
|
+
if (current.width === closestViewport.width && current.height === (closestViewport.height || "auto")) {
|
|
13604
|
+
return;
|
|
13605
|
+
}
|
|
13606
|
+
setUi({
|
|
13607
|
+
viewports: __spreadProps(__spreadValues({}, s.state.ui.viewports), {
|
|
13608
|
+
current: __spreadProps(__spreadValues({}, current), {
|
|
13609
|
+
width: closestViewport.width,
|
|
13610
|
+
height: closestViewport.height || "auto"
|
|
13611
|
+
})
|
|
13612
|
+
})
|
|
13613
|
+
});
|
|
13614
|
+
});
|
|
13615
|
+
observer.observe(target);
|
|
13616
|
+
return () => observer.disconnect();
|
|
13617
|
+
}, [
|
|
13618
|
+
pickClosestViewport,
|
|
13619
|
+
frameRef,
|
|
13620
|
+
iframe.enabled,
|
|
13621
|
+
(_b = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _b.current,
|
|
13622
|
+
appStoreApi,
|
|
13623
|
+
setUi
|
|
13624
|
+
]);
|
|
13625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13378
13626
|
"div",
|
|
13379
13627
|
{
|
|
13380
|
-
className:
|
|
13628
|
+
className: getClassName37({
|
|
13381
13629
|
ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
|
|
13382
13630
|
showLoader,
|
|
13383
13631
|
fullScreen: fullScreenCanvas,
|
|
@@ -13393,120 +13641,296 @@ var Canvas = () => {
|
|
|
13393
13641
|
});
|
|
13394
13642
|
}
|
|
13395
13643
|
},
|
|
13396
|
-
children: /* @__PURE__ */ (0,
|
|
13397
|
-
/* @__PURE__ */ (0,
|
|
13398
|
-
|
|
13644
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: getClassName37("inner"), ref: frameRef, children: [
|
|
13645
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13646
|
+
"div",
|
|
13399
13647
|
{
|
|
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
|
-
]
|
|
13648
|
+
className: getClassName37("rootColumn"),
|
|
13649
|
+
style: {
|
|
13650
|
+
width: iframe.enabled ? viewports.current.width : "100%",
|
|
13651
|
+
transform: disableZoomControls ? void 0 : `scale(${canvasZoom})`,
|
|
13652
|
+
transformOrigin: disableZoomControls ? void 0 : "center center",
|
|
13653
|
+
transition: showTransition ? `width ${TRANSITION_DURATION}ms ease-out, transform ${TRANSITION_DURATION}ms ease-out` : disableZoomControls ? void 0 : "transform 150ms ease-out"
|
|
13654
|
+
},
|
|
13655
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13656
|
+
"div",
|
|
13657
|
+
{
|
|
13658
|
+
className: getClassName37("root"),
|
|
13659
|
+
suppressHydrationWarning: true,
|
|
13660
|
+
id: "editor-canvas-root",
|
|
13661
|
+
onTransitionEnd: () => {
|
|
13662
|
+
setShowTransition(false);
|
|
13663
|
+
isResizingRef.current = false;
|
|
13664
|
+
},
|
|
13665
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Preview2, {}) })
|
|
13666
|
+
}
|
|
13667
|
+
)
|
|
13484
13668
|
}
|
|
13485
|
-
)
|
|
13486
|
-
/* @__PURE__ */ (0,
|
|
13669
|
+
),
|
|
13670
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: getClassName37("bottomBar"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: getClassName37("bottomBarPill"), children: [
|
|
13671
|
+
chrome.showThemeToggle && onToggleTheme && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13672
|
+
IconButton,
|
|
13673
|
+
{
|
|
13674
|
+
type: "button",
|
|
13675
|
+
title: themeLabel != null ? themeLabel : "Toggle theme",
|
|
13676
|
+
onClick: onToggleTheme,
|
|
13677
|
+
children: themeIcon
|
|
13678
|
+
}
|
|
13679
|
+
),
|
|
13680
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13681
|
+
DeviceToggle,
|
|
13682
|
+
{
|
|
13683
|
+
onViewportChange: (viewport) => {
|
|
13684
|
+
autoSelectingRef.current = false;
|
|
13685
|
+
setShowTransition(true);
|
|
13686
|
+
isResizingRef.current = true;
|
|
13687
|
+
const uiViewport = __spreadProps(__spreadValues({}, viewport), {
|
|
13688
|
+
height: viewport.height || "auto",
|
|
13689
|
+
zoom: 1
|
|
13690
|
+
});
|
|
13691
|
+
setUi({
|
|
13692
|
+
viewports: __spreadProps(__spreadValues({}, viewports), { current: uiViewport })
|
|
13693
|
+
});
|
|
13694
|
+
}
|
|
13695
|
+
}
|
|
13696
|
+
),
|
|
13697
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(FullScreenToggle, {}),
|
|
13698
|
+
!disableZoomControls && /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_jsx_runtime86.Fragment, { children: [
|
|
13699
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: getClassName37("bottomBarDivider") }),
|
|
13700
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13701
|
+
IconButton,
|
|
13702
|
+
{
|
|
13703
|
+
type: "button",
|
|
13704
|
+
title: "Zoom out",
|
|
13705
|
+
onClick: zoomOut,
|
|
13706
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Minus, { size: 14 })
|
|
13707
|
+
}
|
|
13708
|
+
),
|
|
13709
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("span", { className: getClassName37("zoomLevel"), children: [
|
|
13710
|
+
Math.round(canvasZoom * 100),
|
|
13711
|
+
"%"
|
|
13712
|
+
] }),
|
|
13713
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(IconButton, { type: "button", title: "Zoom in", onClick: zoomIn, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Plus, { size: 14 }) }),
|
|
13714
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13715
|
+
IconButton,
|
|
13716
|
+
{
|
|
13717
|
+
type: "button",
|
|
13718
|
+
title: "Reset zoom",
|
|
13719
|
+
onClick: resetZoom,
|
|
13720
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(RotateCcw, { size: 14 })
|
|
13721
|
+
}
|
|
13722
|
+
)
|
|
13723
|
+
] })
|
|
13724
|
+
] }) }),
|
|
13725
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: getClassName37("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Loader, { size: 24 }) })
|
|
13487
13726
|
] })
|
|
13488
13727
|
}
|
|
13489
13728
|
);
|
|
13490
13729
|
};
|
|
13491
13730
|
|
|
13731
|
+
// lib/use-sidebar-resize.ts
|
|
13732
|
+
init_react_import();
|
|
13733
|
+
var import_react90 = require("react");
|
|
13734
|
+
init_store();
|
|
13735
|
+
function useSidebarResize(position, dispatch) {
|
|
13736
|
+
const [width, setWidth] = (0, import_react90.useState)(null);
|
|
13737
|
+
const sidebarRef = (0, import_react90.useRef)(null);
|
|
13738
|
+
const storeWidth = useAppStore(
|
|
13739
|
+
(s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
|
|
13740
|
+
);
|
|
13741
|
+
(0, import_react90.useEffect)(() => {
|
|
13742
|
+
if (typeof window !== "undefined" && !storeWidth) {
|
|
13743
|
+
try {
|
|
13744
|
+
const savedWidths = localStorage.getItem("editor-sidebar-widths");
|
|
13745
|
+
if (savedWidths) {
|
|
13746
|
+
const widths = JSON.parse(savedWidths);
|
|
13747
|
+
const savedWidth = widths[position];
|
|
13748
|
+
const key = position === "left" ? "leftSideBarWidth" : "rightSideBarWidth";
|
|
13749
|
+
if (savedWidth) {
|
|
13750
|
+
dispatch({
|
|
13751
|
+
type: "setUi",
|
|
13752
|
+
ui: {
|
|
13753
|
+
[key]: savedWidth
|
|
13754
|
+
}
|
|
13755
|
+
});
|
|
13756
|
+
}
|
|
13757
|
+
}
|
|
13758
|
+
} catch (error) {
|
|
13759
|
+
console.error(
|
|
13760
|
+
`Failed to load ${position} sidebar width from localStorage`,
|
|
13761
|
+
error
|
|
13762
|
+
);
|
|
13763
|
+
}
|
|
13764
|
+
}
|
|
13765
|
+
}, [dispatch, position, storeWidth]);
|
|
13766
|
+
(0, import_react90.useEffect)(() => {
|
|
13767
|
+
if (storeWidth !== void 0) {
|
|
13768
|
+
setWidth(storeWidth);
|
|
13769
|
+
}
|
|
13770
|
+
}, [storeWidth]);
|
|
13771
|
+
const handleResizeEnd = (0, import_react90.useCallback)(
|
|
13772
|
+
(width2) => {
|
|
13773
|
+
dispatch({
|
|
13774
|
+
type: "setUi",
|
|
13775
|
+
ui: {
|
|
13776
|
+
[position === "left" ? "leftSideBarWidth" : "rightSideBarWidth"]: width2
|
|
13777
|
+
}
|
|
13778
|
+
});
|
|
13779
|
+
let widths = {};
|
|
13780
|
+
try {
|
|
13781
|
+
const savedWidths = localStorage.getItem("editor-sidebar-widths");
|
|
13782
|
+
widths = savedWidths ? JSON.parse(savedWidths) : {};
|
|
13783
|
+
} catch (error) {
|
|
13784
|
+
console.error(
|
|
13785
|
+
`Failed to save ${position} sidebar width to localStorage`,
|
|
13786
|
+
error
|
|
13787
|
+
);
|
|
13788
|
+
} finally {
|
|
13789
|
+
localStorage.setItem(
|
|
13790
|
+
"editor-sidebar-widths",
|
|
13791
|
+
JSON.stringify(__spreadProps(__spreadValues({}, widths), {
|
|
13792
|
+
[position]: width2
|
|
13793
|
+
}))
|
|
13794
|
+
);
|
|
13795
|
+
}
|
|
13796
|
+
window.dispatchEvent(
|
|
13797
|
+
new CustomEvent("viewportchange", {
|
|
13798
|
+
bubbles: true,
|
|
13799
|
+
cancelable: false
|
|
13800
|
+
})
|
|
13801
|
+
);
|
|
13802
|
+
},
|
|
13803
|
+
[dispatch, position]
|
|
13804
|
+
);
|
|
13805
|
+
return {
|
|
13806
|
+
width,
|
|
13807
|
+
setWidth,
|
|
13808
|
+
sidebarRef,
|
|
13809
|
+
handleResizeEnd
|
|
13810
|
+
};
|
|
13811
|
+
}
|
|
13812
|
+
|
|
13492
13813
|
// components/Editor/components/Sidebar/index.tsx
|
|
13493
13814
|
init_react_import();
|
|
13815
|
+
|
|
13816
|
+
// components/Editor/components/ResizeHandle/index.tsx
|
|
13817
|
+
init_react_import();
|
|
13818
|
+
var import_react91 = require("react");
|
|
13819
|
+
init_get_class_name_factory();
|
|
13820
|
+
|
|
13821
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/ResizeHandle/styles.module.css#css-module
|
|
13822
|
+
init_react_import();
|
|
13823
|
+
var styles_module_default31 = { "ResizeHandle": "_ResizeHandle_1u3rv_2", "ResizeHandle--left": "_ResizeHandle--left_1u3rv_16", "ResizeHandle--right": "_ResizeHandle--right_1u3rv_20" };
|
|
13824
|
+
|
|
13825
|
+
// components/Editor/components/ResizeHandle/index.tsx
|
|
13826
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
13827
|
+
var getClassName38 = get_class_name_factory_default("ResizeHandle", styles_module_default31);
|
|
13828
|
+
var ResizeHandle = ({
|
|
13829
|
+
position,
|
|
13830
|
+
sidebarRef,
|
|
13831
|
+
onResize,
|
|
13832
|
+
onResizeEnd
|
|
13833
|
+
}) => {
|
|
13834
|
+
const handleRef = (0, import_react91.useRef)(null);
|
|
13835
|
+
const isDragging = (0, import_react91.useRef)(false);
|
|
13836
|
+
const startX = (0, import_react91.useRef)(0);
|
|
13837
|
+
const startWidth = (0, import_react91.useRef)(0);
|
|
13838
|
+
const handleMouseMove = (0, import_react91.useCallback)(
|
|
13839
|
+
(e) => {
|
|
13840
|
+
if (!isDragging.current) return;
|
|
13841
|
+
const delta = e.clientX - startX.current;
|
|
13842
|
+
const newWidth = position === "left" ? startWidth.current + delta : startWidth.current - delta;
|
|
13843
|
+
const width = Math.max(192, newWidth);
|
|
13844
|
+
onResize(width);
|
|
13845
|
+
e.preventDefault();
|
|
13846
|
+
},
|
|
13847
|
+
[onResize, position]
|
|
13848
|
+
);
|
|
13849
|
+
const handleMouseUp = (0, import_react91.useCallback)(() => {
|
|
13850
|
+
var _a;
|
|
13851
|
+
if (!isDragging.current) return;
|
|
13852
|
+
isDragging.current = false;
|
|
13853
|
+
document.body.style.cursor = "";
|
|
13854
|
+
document.body.style.userSelect = "";
|
|
13855
|
+
const overlay = document.getElementById("resize-overlay");
|
|
13856
|
+
if (overlay) {
|
|
13857
|
+
document.body.removeChild(overlay);
|
|
13858
|
+
}
|
|
13859
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
13860
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
13861
|
+
const finalWidth = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
|
|
13862
|
+
onResizeEnd(finalWidth);
|
|
13863
|
+
}, [onResizeEnd]);
|
|
13864
|
+
const handleMouseDown = (0, import_react91.useCallback)(
|
|
13865
|
+
(e) => {
|
|
13866
|
+
var _a;
|
|
13867
|
+
isDragging.current = true;
|
|
13868
|
+
startX.current = e.clientX;
|
|
13869
|
+
startWidth.current = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
|
|
13870
|
+
document.body.style.cursor = "col-resize";
|
|
13871
|
+
document.body.style.userSelect = "none";
|
|
13872
|
+
const overlay = document.createElement("div");
|
|
13873
|
+
overlay.id = "resize-overlay";
|
|
13874
|
+
overlay.setAttribute("data-resize-overlay", "");
|
|
13875
|
+
document.body.appendChild(overlay);
|
|
13876
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
13877
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
13878
|
+
e.preventDefault();
|
|
13879
|
+
},
|
|
13880
|
+
[position, handleMouseMove, handleMouseUp]
|
|
13881
|
+
);
|
|
13882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
13883
|
+
"div",
|
|
13884
|
+
{
|
|
13885
|
+
ref: handleRef,
|
|
13886
|
+
className: getClassName38({ [position]: true }),
|
|
13887
|
+
onMouseDown: handleMouseDown
|
|
13888
|
+
}
|
|
13889
|
+
);
|
|
13890
|
+
};
|
|
13891
|
+
|
|
13892
|
+
// components/Editor/components/Sidebar/index.tsx
|
|
13494
13893
|
init_get_class_name_factory();
|
|
13495
13894
|
|
|
13496
13895
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Sidebar/styles.module.css#css-module
|
|
13497
13896
|
init_react_import();
|
|
13498
|
-
var
|
|
13897
|
+
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
13898
|
|
|
13500
13899
|
// components/Editor/components/Sidebar/index.tsx
|
|
13501
|
-
var
|
|
13502
|
-
var
|
|
13503
|
-
var Sidebar = ({
|
|
13504
|
-
|
|
13900
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
13901
|
+
var getClassName39 = get_class_name_factory_default("Sidebar", styles_module_default32);
|
|
13902
|
+
var Sidebar = ({
|
|
13903
|
+
position,
|
|
13904
|
+
sidebarRef,
|
|
13905
|
+
isVisible,
|
|
13906
|
+
onResize,
|
|
13907
|
+
onResizeEnd,
|
|
13908
|
+
children
|
|
13909
|
+
}) => {
|
|
13910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
|
|
13911
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13912
|
+
"div",
|
|
13913
|
+
{
|
|
13914
|
+
ref: sidebarRef,
|
|
13915
|
+
className: getClassName39({ [position]: true, isVisible }),
|
|
13916
|
+
children
|
|
13917
|
+
}
|
|
13918
|
+
),
|
|
13919
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: `${getClassName39("resizeHandle")}`, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13920
|
+
ResizeHandle,
|
|
13921
|
+
{
|
|
13922
|
+
position,
|
|
13923
|
+
sidebarRef,
|
|
13924
|
+
onResize,
|
|
13925
|
+
onResizeEnd
|
|
13926
|
+
}
|
|
13927
|
+
) })
|
|
13928
|
+
] });
|
|
13505
13929
|
};
|
|
13506
13930
|
|
|
13507
13931
|
// lib/use-delete-hotkeys.ts
|
|
13508
13932
|
init_react_import();
|
|
13509
|
-
var
|
|
13933
|
+
var import_react92 = require("react");
|
|
13510
13934
|
init_use_hotkey();
|
|
13511
13935
|
init_store();
|
|
13512
13936
|
|
|
@@ -13548,7 +13972,7 @@ var shouldBlockEditingHotkey = (e) => {
|
|
|
13548
13972
|
// lib/use-delete-hotkeys.ts
|
|
13549
13973
|
var useDeleteHotkeys = () => {
|
|
13550
13974
|
const appStore = useAppStoreApi();
|
|
13551
|
-
const deleteSelectedComponent = (0,
|
|
13975
|
+
const deleteSelectedComponent = (0, import_react92.useCallback)(
|
|
13552
13976
|
(e) => {
|
|
13553
13977
|
var _a;
|
|
13554
13978
|
if (shouldBlockEditingHotkey(e)) {
|
|
@@ -13574,7 +13998,7 @@ var useDeleteHotkeys = () => {
|
|
|
13574
13998
|
|
|
13575
13999
|
// lib/use-clipboard-hotkeys.ts
|
|
13576
14000
|
init_react_import();
|
|
13577
|
-
var
|
|
14001
|
+
var import_react93 = require("react");
|
|
13578
14002
|
init_use_hotkey();
|
|
13579
14003
|
init_store();
|
|
13580
14004
|
var CLIPBOARD_MARKER = "reacteditor/component";
|
|
@@ -13596,7 +14020,7 @@ var parsePayload = (text) => {
|
|
|
13596
14020
|
};
|
|
13597
14021
|
var useClipboardHotkeys = () => {
|
|
13598
14022
|
const appStore = useAppStoreApi();
|
|
13599
|
-
const writeSelectionToClipboard = (0,
|
|
14023
|
+
const writeSelectionToClipboard = (0, import_react93.useCallback)(() => {
|
|
13600
14024
|
var _a;
|
|
13601
14025
|
const { selectedItem } = appStore.getState();
|
|
13602
14026
|
if (!selectedItem) return false;
|
|
@@ -13608,14 +14032,14 @@ var useClipboardHotkeys = () => {
|
|
|
13608
14032
|
});
|
|
13609
14033
|
return true;
|
|
13610
14034
|
}, [appStore]);
|
|
13611
|
-
const copySelectedComponent = (0,
|
|
14035
|
+
const copySelectedComponent = (0, import_react93.useCallback)(
|
|
13612
14036
|
(e) => {
|
|
13613
14037
|
if (shouldBlockEditingHotkey(e)) return false;
|
|
13614
14038
|
return writeSelectionToClipboard();
|
|
13615
14039
|
},
|
|
13616
14040
|
[writeSelectionToClipboard]
|
|
13617
14041
|
);
|
|
13618
|
-
const cutSelectedComponent = (0,
|
|
14042
|
+
const cutSelectedComponent = (0, import_react93.useCallback)(
|
|
13619
14043
|
(e) => {
|
|
13620
14044
|
var _a;
|
|
13621
14045
|
if (shouldBlockEditingHotkey(e)) return false;
|
|
@@ -13634,7 +14058,7 @@ var useClipboardHotkeys = () => {
|
|
|
13634
14058
|
},
|
|
13635
14059
|
[appStore, writeSelectionToClipboard]
|
|
13636
14060
|
);
|
|
13637
|
-
const pasteComponent = (0,
|
|
14061
|
+
const pasteComponent = (0, import_react93.useCallback)(
|
|
13638
14062
|
(e) => {
|
|
13639
14063
|
var _a, _b;
|
|
13640
14064
|
if (shouldBlockEditingHotkey(e)) return false;
|
|
@@ -13645,369 +14069,184 @@ var useClipboardHotkeys = () => {
|
|
|
13645
14069
|
const data = parsePayload(text);
|
|
13646
14070
|
if (!data) return;
|
|
13647
14071
|
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)
|
|
14072
|
+
dispatch({
|
|
14073
|
+
type: "insert",
|
|
14074
|
+
componentType: data.type,
|
|
14075
|
+
destinationIndex: sel.index + 1,
|
|
14076
|
+
destinationZone: sel.zone,
|
|
14077
|
+
data
|
|
14078
|
+
});
|
|
14079
|
+
}).catch(() => {
|
|
14080
|
+
});
|
|
14081
|
+
return true;
|
|
14082
|
+
},
|
|
14083
|
+
[appStore]
|
|
13876
14084
|
);
|
|
13877
|
-
}
|
|
14085
|
+
useHotkey({ meta: true, c: true }, copySelectedComponent);
|
|
14086
|
+
useHotkey({ ctrl: true, c: true }, copySelectedComponent);
|
|
14087
|
+
useHotkey({ meta: true, v: true }, pasteComponent);
|
|
14088
|
+
useHotkey({ ctrl: true, v: true }, pasteComponent);
|
|
14089
|
+
useHotkey({ meta: true, x: true }, cutSelectedComponent);
|
|
14090
|
+
useHotkey({ ctrl: true, x: true }, cutSelectedComponent);
|
|
14091
|
+
};
|
|
13878
14092
|
|
|
13879
|
-
//
|
|
14093
|
+
// components/Editor/components/Layout/index.tsx
|
|
14094
|
+
init_IconButton2();
|
|
14095
|
+
init_lucide_react();
|
|
14096
|
+
|
|
14097
|
+
// plugins/blocks/index.tsx
|
|
13880
14098
|
init_react_import();
|
|
13881
|
-
|
|
14099
|
+
init_lucide_react();
|
|
13882
14100
|
|
|
13883
|
-
//
|
|
14101
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/blocks/styles.module.css#css-module
|
|
14102
|
+
init_react_import();
|
|
14103
|
+
var styles_module_default33 = { "BlocksPlugin": "_BlocksPlugin_15ud0_1" };
|
|
14104
|
+
|
|
14105
|
+
// plugins/blocks/index.tsx
|
|
14106
|
+
init_lib();
|
|
13884
14107
|
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
|
-
] }) });
|
|
14108
|
+
var getClassName40 = get_class_name_factory_default("BlocksPlugin", styles_module_default33);
|
|
14109
|
+
var blocksPlugin = () => ({
|
|
14110
|
+
name: "blocks",
|
|
14111
|
+
label: "Blocks",
|
|
14112
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: getClassName40(), children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Components, {}) }),
|
|
14113
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Plus, {})
|
|
14114
|
+
});
|
|
14115
|
+
|
|
14116
|
+
// plugins/fields/index.tsx
|
|
14117
|
+
init_react_import();
|
|
14118
|
+
init_lucide_react();
|
|
14119
|
+
init_store();
|
|
14120
|
+
|
|
14121
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css#css-module
|
|
14122
|
+
init_react_import();
|
|
14123
|
+
var styles_module_default34 = { "FieldsPlugin": "_FieldsPlugin_262zt_1", "FieldsPlugin-header": "_FieldsPlugin-header_262zt_7" };
|
|
14124
|
+
|
|
14125
|
+
// plugins/fields/index.tsx
|
|
14126
|
+
init_lib();
|
|
14127
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
14128
|
+
var getClassName41 = get_class_name_factory_default("FieldsPlugin", styles_module_default34);
|
|
14129
|
+
var CurrentTitle = () => {
|
|
14130
|
+
const label = useAppStore((s) => {
|
|
14131
|
+
var _a, _b;
|
|
14132
|
+
const selectedItem = s.selectedItem;
|
|
14133
|
+
return selectedItem ? (_b = (_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.label) != null ? _b : selectedItem.type : "Page";
|
|
14134
|
+
});
|
|
14135
|
+
return label;
|
|
13952
14136
|
};
|
|
14137
|
+
var fieldsPlugin = ({ desktopSideBar = "right" } = {}) => ({
|
|
14138
|
+
name: "fields",
|
|
14139
|
+
label: "Fields",
|
|
14140
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: getClassName41(), children: [
|
|
14141
|
+
/* @__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, {}) }) }),
|
|
14142
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Fields, {})
|
|
14143
|
+
] }),
|
|
14144
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(RectangleEllipsis, {}),
|
|
14145
|
+
mobileOnly: desktopSideBar === "right"
|
|
14146
|
+
});
|
|
13953
14147
|
|
|
13954
14148
|
// components/Editor/components/Layout/index.tsx
|
|
13955
|
-
var
|
|
13956
|
-
var
|
|
14149
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
14150
|
+
var getClassName42 = get_class_name_factory_default("Editor", styles_module_default25);
|
|
13957
14151
|
var getLayoutClassName = get_class_name_factory_default("EditorLayout", styles_module_default25);
|
|
13958
14152
|
var getPluginTabClassName = get_class_name_factory_default("EditorPluginTab", styles_module_default25);
|
|
13959
|
-
var
|
|
13960
|
-
var
|
|
14153
|
+
var getHeaderClassName = get_class_name_factory_default("EditorHeader", styles_module_default25);
|
|
14154
|
+
var TopHeader = ({
|
|
14155
|
+
pluginItems
|
|
14156
|
+
}) => {
|
|
13961
14157
|
const appStore = useAppStoreApi();
|
|
13962
14158
|
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 = () => {
|
|
14159
|
+
const chrome = useChromeConfig();
|
|
13978
14160
|
const back = useAppStore((s) => s.history.back);
|
|
13979
14161
|
const forward = useAppStore((s) => s.history.forward);
|
|
13980
14162
|
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
|
13981
14163
|
const hasPast = useAppStore((s) => s.history.hasPast());
|
|
13982
|
-
|
|
13983
|
-
|
|
13984
|
-
|
|
13985
|
-
|
|
14164
|
+
const CustomHeaderActions = useAppStore(
|
|
14165
|
+
(s) => s.overrides.headerActions || DefaultOverride
|
|
14166
|
+
);
|
|
14167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("header", { className: getHeaderClassName(), children: [
|
|
14168
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: getHeaderClassName("plugins"), children: Object.entries(pluginItems).map(([key, item]) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14169
|
+
"span",
|
|
13986
14170
|
{
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
13991
|
-
children: /* @__PURE__ */ (0,
|
|
13992
|
-
|
|
13993
|
-
|
|
14171
|
+
className: getHeaderClassName("pluginItem", {
|
|
14172
|
+
mobileOnly: item.mobileOnly,
|
|
14173
|
+
desktopOnly: item.desktopOnly
|
|
14174
|
+
}),
|
|
14175
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14176
|
+
IconButton,
|
|
14177
|
+
{
|
|
14178
|
+
type: "button",
|
|
14179
|
+
title: item.label,
|
|
14180
|
+
onClick: item.onClick,
|
|
14181
|
+
active: item.isActive,
|
|
14182
|
+
children: item.icon
|
|
14183
|
+
}
|
|
14184
|
+
)
|
|
14185
|
+
},
|
|
14186
|
+
key
|
|
14187
|
+
)) }),
|
|
14188
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: getHeaderClassName("urlBarSlot"), children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(UrlBar, {}) }),
|
|
14189
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: getHeaderClassName("actions"), children: [
|
|
14190
|
+
chrome.showHistoryControls && /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: getHeaderClassName("history"), children: [
|
|
14191
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14192
|
+
IconButton,
|
|
14193
|
+
{
|
|
14194
|
+
type: "button",
|
|
14195
|
+
title: "undo",
|
|
14196
|
+
disabled: !hasPast,
|
|
14197
|
+
onClick: back,
|
|
14198
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Undo2, { size: 18 })
|
|
14199
|
+
}
|
|
14200
|
+
),
|
|
14201
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14202
|
+
IconButton,
|
|
14203
|
+
{
|
|
14204
|
+
type: "button",
|
|
14205
|
+
title: "redo",
|
|
14206
|
+
disabled: !hasFuture,
|
|
14207
|
+
onClick: forward,
|
|
14208
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Redo2, { size: 18 })
|
|
14209
|
+
}
|
|
14210
|
+
)
|
|
14211
|
+
] }),
|
|
14212
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14213
|
+
Button,
|
|
14214
|
+
{
|
|
14215
|
+
onClick: () => {
|
|
14216
|
+
const data = appStore.getState().state.data;
|
|
14217
|
+
onPublish && onPublish(data, currentRoute);
|
|
14218
|
+
},
|
|
14219
|
+
children: "Publish"
|
|
14220
|
+
}
|
|
14221
|
+
) })
|
|
14222
|
+
] })
|
|
13994
14223
|
] });
|
|
13995
14224
|
};
|
|
14225
|
+
var FieldSideBar = () => {
|
|
14226
|
+
const title = useAppStore(
|
|
14227
|
+
(s) => {
|
|
14228
|
+
var _a, _b, _c;
|
|
14229
|
+
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";
|
|
14230
|
+
}
|
|
14231
|
+
);
|
|
14232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Fields, {}) });
|
|
14233
|
+
};
|
|
13996
14234
|
var PluginTab = ({
|
|
13997
14235
|
children,
|
|
13998
14236
|
visible,
|
|
13999
14237
|
mobileOnly
|
|
14000
14238
|
}) => {
|
|
14001
|
-
return /* @__PURE__ */ (0,
|
|
14239
|
+
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
14240
|
};
|
|
14003
14241
|
var Layout = ({ children }) => {
|
|
14004
14242
|
const {
|
|
14005
14243
|
iframe: _iframe,
|
|
14006
14244
|
dnd,
|
|
14245
|
+
initialHistory: _initialHistory,
|
|
14007
14246
|
plugins,
|
|
14008
14247
|
height
|
|
14009
14248
|
} = usePropsContext();
|
|
14010
|
-
const iframe = (0,
|
|
14249
|
+
const iframe = (0, import_react94.useMemo)(
|
|
14011
14250
|
() => __spreadValues({
|
|
14012
14251
|
enabled: true,
|
|
14013
14252
|
waitForStyles: true
|
|
@@ -14015,7 +14254,7 @@ var Layout = ({ children }) => {
|
|
|
14015
14254
|
[_iframe]
|
|
14016
14255
|
);
|
|
14017
14256
|
useInjectGlobalCss(iframe.enabled);
|
|
14018
|
-
const
|
|
14257
|
+
const dispatch = useAppStore((s) => s.dispatch);
|
|
14019
14258
|
const leftSideBarVisible = useAppStore((s) => s.state.ui.leftSideBarVisible);
|
|
14020
14259
|
const rightSideBarVisible = useAppStore(
|
|
14021
14260
|
(s) => s.state.ui.rightSideBarVisible
|
|
@@ -14023,14 +14262,53 @@ var Layout = ({ children }) => {
|
|
|
14023
14262
|
const chrome = useChromeConfig();
|
|
14024
14263
|
const navBarVisible = chrome.showNavBar;
|
|
14025
14264
|
const instanceId = useAppStore((s) => s.instanceId);
|
|
14265
|
+
const {
|
|
14266
|
+
width: leftWidth,
|
|
14267
|
+
setWidth: setLeftWidth,
|
|
14268
|
+
sidebarRef: leftSidebarRef,
|
|
14269
|
+
handleResizeEnd: handleLeftSidebarResizeEnd
|
|
14270
|
+
} = useSidebarResize("left", dispatch);
|
|
14271
|
+
const {
|
|
14272
|
+
width: rightWidth,
|
|
14273
|
+
setWidth: setRightWidth,
|
|
14274
|
+
sidebarRef: rightSidebarRef,
|
|
14275
|
+
handleResizeEnd: handleRightSidebarResizeEnd
|
|
14276
|
+
} = useSidebarResize("right", dispatch);
|
|
14277
|
+
(0, import_react94.useEffect)(() => {
|
|
14278
|
+
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
14279
|
+
dispatch({
|
|
14280
|
+
type: "setUi",
|
|
14281
|
+
ui: {
|
|
14282
|
+
leftSideBarVisible: false,
|
|
14283
|
+
rightSideBarVisible: false
|
|
14284
|
+
}
|
|
14285
|
+
});
|
|
14286
|
+
}
|
|
14287
|
+
const handleResize = () => {
|
|
14288
|
+
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
14289
|
+
dispatch({
|
|
14290
|
+
type: "setUi",
|
|
14291
|
+
ui: (ui) => __spreadValues(__spreadValues({}, ui), ui.rightSideBarVisible ? { leftSideBarVisible: false } : {})
|
|
14292
|
+
});
|
|
14293
|
+
}
|
|
14294
|
+
};
|
|
14295
|
+
window.addEventListener("resize", handleResize);
|
|
14296
|
+
return () => {
|
|
14297
|
+
window.removeEventListener("resize", handleResize);
|
|
14298
|
+
};
|
|
14299
|
+
}, []);
|
|
14026
14300
|
const overrides = useAppStore((s) => s.overrides);
|
|
14027
|
-
const CustomEditor = (0,
|
|
14301
|
+
const CustomEditor = (0, import_react94.useMemo)(
|
|
14028
14302
|
() => overrides.editor || DefaultOverride,
|
|
14029
14303
|
[overrides]
|
|
14030
14304
|
);
|
|
14305
|
+
const [mounted, setMounted] = (0, import_react94.useState)(false);
|
|
14306
|
+
(0, import_react94.useEffect)(() => {
|
|
14307
|
+
setMounted(true);
|
|
14308
|
+
}, []);
|
|
14031
14309
|
const ready = useAppStore((s) => s.status === "READY");
|
|
14032
14310
|
useMonitorHotkeys();
|
|
14033
|
-
(0,
|
|
14311
|
+
(0, import_react94.useEffect)(() => {
|
|
14034
14312
|
if (ready && iframe.enabled) {
|
|
14035
14313
|
const frameDoc = getFrame();
|
|
14036
14314
|
if (frameDoc) {
|
|
@@ -14041,36 +14319,106 @@ var Layout = ({ children }) => {
|
|
|
14041
14319
|
usePreviewModeHotkeys();
|
|
14042
14320
|
useDeleteHotkeys();
|
|
14043
14321
|
useClipboardHotkeys();
|
|
14322
|
+
const layoutOptions = {};
|
|
14323
|
+
if (leftWidth) {
|
|
14324
|
+
layoutOptions["--editor-user-left-side-bar-width"] = `${leftWidth}px`;
|
|
14325
|
+
}
|
|
14326
|
+
if (rightWidth) {
|
|
14327
|
+
layoutOptions["--editor-user-right-side-bar-width"] = `${rightWidth}px`;
|
|
14328
|
+
}
|
|
14329
|
+
const setUi = useAppStore((s) => s.setUi);
|
|
14044
14330
|
const currentPlugin = useAppStore((s) => {
|
|
14045
14331
|
var _a;
|
|
14046
14332
|
return (_a = s.state.ui.plugin) == null ? void 0 : _a.current;
|
|
14047
14333
|
});
|
|
14048
14334
|
const appStoreApi = useAppStoreApi();
|
|
14049
|
-
const [
|
|
14335
|
+
const [mobilePanelHeightMode, setMobilePanelHeightMode] = (0, import_react94.useState)("toggle");
|
|
14336
|
+
const [mobilePanelHeight, setMobilePanelHeight] = (0, import_react94.useState)(
|
|
14337
|
+
null
|
|
14338
|
+
);
|
|
14339
|
+
const mobilePanelRef = (0, import_react94.useRef)(null);
|
|
14340
|
+
const isDraggingMobile = (0, import_react94.useRef)(false);
|
|
14341
|
+
const dragStartY = (0, import_react94.useRef)(0);
|
|
14342
|
+
const dragStartHeight = (0, import_react94.useRef)(0);
|
|
14343
|
+
const handleMobileDragStart = (0, import_react94.useCallback)(
|
|
14344
|
+
(clientY) => {
|
|
14345
|
+
isDraggingMobile.current = true;
|
|
14346
|
+
dragStartY.current = clientY;
|
|
14347
|
+
const panel = mobilePanelRef.current;
|
|
14348
|
+
dragStartHeight.current = panel ? panel.getBoundingClientRect().height : 0;
|
|
14349
|
+
document.body.style.userSelect = "none";
|
|
14350
|
+
document.body.style.touchAction = "none";
|
|
14351
|
+
},
|
|
14352
|
+
[]
|
|
14353
|
+
);
|
|
14354
|
+
const handleMobileDragMove = (0, import_react94.useCallback)((clientY) => {
|
|
14355
|
+
if (!isDraggingMobile.current) return;
|
|
14356
|
+
const delta = dragStartY.current - clientY;
|
|
14357
|
+
const viewportHeight = window.innerHeight;
|
|
14358
|
+
const minH = viewportHeight * 0.15;
|
|
14359
|
+
const maxH = viewportHeight * 0.75;
|
|
14360
|
+
const newH = Math.min(maxH, Math.max(minH, dragStartHeight.current + delta));
|
|
14361
|
+
setMobilePanelHeight(newH);
|
|
14362
|
+
}, []);
|
|
14363
|
+
const handleMobileDragEnd = (0, import_react94.useCallback)(() => {
|
|
14364
|
+
if (!isDraggingMobile.current) return;
|
|
14365
|
+
isDraggingMobile.current = false;
|
|
14366
|
+
document.body.style.userSelect = "";
|
|
14367
|
+
document.body.style.touchAction = "";
|
|
14368
|
+
}, []);
|
|
14369
|
+
(0, import_react94.useEffect)(() => {
|
|
14370
|
+
const onTouchMove = (e) => {
|
|
14371
|
+
if (isDraggingMobile.current) {
|
|
14372
|
+
e.preventDefault();
|
|
14373
|
+
handleMobileDragMove(e.touches[0].clientY);
|
|
14374
|
+
}
|
|
14375
|
+
};
|
|
14376
|
+
const onTouchEnd = () => handleMobileDragEnd();
|
|
14377
|
+
const onMouseMove = (e) => {
|
|
14378
|
+
if (isDraggingMobile.current) {
|
|
14379
|
+
e.preventDefault();
|
|
14380
|
+
handleMobileDragMove(e.clientY);
|
|
14381
|
+
}
|
|
14382
|
+
};
|
|
14383
|
+
const onMouseUp = () => handleMobileDragEnd();
|
|
14384
|
+
document.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
14385
|
+
document.addEventListener("touchend", onTouchEnd);
|
|
14386
|
+
document.addEventListener("mousemove", onMouseMove);
|
|
14387
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
14388
|
+
return () => {
|
|
14389
|
+
document.removeEventListener("touchmove", onTouchMove);
|
|
14390
|
+
document.removeEventListener("touchend", onTouchEnd);
|
|
14391
|
+
document.removeEventListener("mousemove", onMouseMove);
|
|
14392
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
14393
|
+
};
|
|
14394
|
+
}, [handleMobileDragMove, handleMobileDragEnd]);
|
|
14395
|
+
const [theme, setTheme] = (0, import_react94.useState)(() => {
|
|
14050
14396
|
if (typeof window === "undefined") return "light";
|
|
14051
14397
|
const stored = window.localStorage.getItem("editor-theme");
|
|
14052
14398
|
if (stored === "light" || stored === "dark") return stored;
|
|
14053
14399
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
14054
14400
|
});
|
|
14055
|
-
(0,
|
|
14401
|
+
(0, import_react94.useEffect)(() => {
|
|
14056
14402
|
if (typeof window === "undefined") return;
|
|
14057
14403
|
window.localStorage.setItem("editor-theme", theme);
|
|
14058
14404
|
}, [theme]);
|
|
14059
14405
|
const toggleTheme = () => {
|
|
14060
14406
|
setTheme((t) => t === "dark" ? "light" : "dark");
|
|
14061
14407
|
};
|
|
14062
|
-
const themeIcon = theme === "dark" ? /* @__PURE__ */ (0,
|
|
14408
|
+
const themeIcon = theme === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Sun, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Moon, { size: 14 });
|
|
14063
14409
|
const themeLabel = theme === "dark" ? "Switch to light mode" : "Switch to dark mode";
|
|
14064
|
-
const hasLegacySideBarPlugin = (0,
|
|
14410
|
+
const hasLegacySideBarPlugin = (0, import_react94.useMemo)(
|
|
14065
14411
|
() => !!(plugins == null ? void 0 : plugins.find((p) => p.name === "legacy-side-bar")),
|
|
14066
14412
|
[plugins]
|
|
14067
14413
|
);
|
|
14068
|
-
const pluginItems = (0,
|
|
14414
|
+
const pluginItems = (0, import_react94.useMemo)(() => {
|
|
14069
14415
|
const details = {};
|
|
14416
|
+
const defaultPlugins = [blocksPlugin()];
|
|
14070
14417
|
const isLegacy = (plugin) => plugin.name === "legacy-side-bar" ? -1 : 0;
|
|
14071
|
-
const combinedPlugins = [
|
|
14072
|
-
|
|
14073
|
-
|
|
14418
|
+
const combinedPlugins = [
|
|
14419
|
+
...defaultPlugins,
|
|
14420
|
+
...plugins != null ? plugins : []
|
|
14421
|
+
].sort((a, b) => isLegacy(a) - isLegacy(b));
|
|
14074
14422
|
if (!(plugins == null ? void 0 : plugins.some((p) => p.name === "fields"))) {
|
|
14075
14423
|
combinedPlugins.push(fieldsPlugin());
|
|
14076
14424
|
}
|
|
@@ -14082,15 +14430,23 @@ var Layout = ({ children }) => {
|
|
|
14082
14430
|
}
|
|
14083
14431
|
details[plugin.name] = {
|
|
14084
14432
|
label: (_a = plugin.label) != null ? _a : plugin.name,
|
|
14085
|
-
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ (0,
|
|
14433
|
+
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ToyBrick, {}),
|
|
14086
14434
|
onClick: () => {
|
|
14435
|
+
var _a2;
|
|
14436
|
+
setMobilePanelHeightMode((_a2 = plugin.mobilePanelHeight) != null ? _a2 : "toggle");
|
|
14087
14437
|
if (plugin.name === currentPlugin) {
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14438
|
+
if (leftSideBarVisible) {
|
|
14439
|
+
setUi({ leftSideBarVisible: false });
|
|
14440
|
+
} else {
|
|
14441
|
+
setUi({ leftSideBarVisible: true });
|
|
14442
|
+
}
|
|
14443
|
+
} else {
|
|
14444
|
+
if (plugin.name) {
|
|
14445
|
+
setUi({
|
|
14446
|
+
plugin: { current: plugin.name },
|
|
14447
|
+
leftSideBarVisible: true
|
|
14448
|
+
});
|
|
14449
|
+
}
|
|
14094
14450
|
}
|
|
14095
14451
|
},
|
|
14096
14452
|
isActive: leftSideBarVisible && currentPlugin === plugin.name,
|
|
@@ -14102,65 +14458,141 @@ var Layout = ({ children }) => {
|
|
|
14102
14458
|
});
|
|
14103
14459
|
return details;
|
|
14104
14460
|
}, [plugins, currentPlugin, appStoreApi, leftSideBarVisible]);
|
|
14105
|
-
(0,
|
|
14461
|
+
(0, import_react94.useEffect)(() => {
|
|
14106
14462
|
if (!currentPlugin) {
|
|
14107
14463
|
const names = Object.keys(pluginItems);
|
|
14108
14464
|
setUi({ plugin: { current: names[0] } });
|
|
14109
14465
|
}
|
|
14110
14466
|
}, [pluginItems, currentPlugin]);
|
|
14111
14467
|
const hasDesktopFieldsPlugin = pluginItems["fields"] && pluginItems["fields"].mobileOnly === false;
|
|
14112
|
-
|
|
14468
|
+
const mobilePanelStyle = {};
|
|
14469
|
+
if (mobilePanelHeight && leftSideBarVisible) {
|
|
14470
|
+
mobilePanelStyle["--editor-mobile-panel-height"] = `${mobilePanelHeight}px`;
|
|
14471
|
+
}
|
|
14472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
14113
14473
|
"div",
|
|
14114
14474
|
{
|
|
14115
|
-
className: `Editor ${
|
|
14475
|
+
className: `Editor ${getClassName42({
|
|
14116
14476
|
hidePlugins: hasLegacySideBarPlugin
|
|
14117
14477
|
})}`,
|
|
14118
14478
|
id: instanceId,
|
|
14119
14479
|
"data-theme": theme,
|
|
14120
14480
|
style: { height },
|
|
14121
14481
|
children: [
|
|
14122
|
-
/* @__PURE__ */ (0,
|
|
14482
|
+
/* @__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
14483
|
"div",
|
|
14124
14484
|
{
|
|
14125
14485
|
className: getLayoutClassName({
|
|
14126
14486
|
leftSideBarVisible,
|
|
14487
|
+
mounted,
|
|
14127
14488
|
rightSideBarVisible: !hasDesktopFieldsPlugin && rightSideBarVisible,
|
|
14128
|
-
navBarVisible
|
|
14489
|
+
navBarVisible,
|
|
14490
|
+
mobilePanelHeightToggle: mobilePanelHeightMode === "toggle",
|
|
14491
|
+
mobilePanelHeightMinContent: mobilePanelHeightMode === "min-content",
|
|
14492
|
+
mobilePanelCustomHeight: mobilePanelHeight !== null && leftSideBarVisible
|
|
14129
14493
|
}),
|
|
14130
14494
|
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
|
-
|
|
14495
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
14496
|
+
"div",
|
|
14497
|
+
{
|
|
14498
|
+
className: getLayoutClassName("inner"),
|
|
14499
|
+
style: __spreadValues(__spreadValues({}, layoutOptions), mobilePanelStyle),
|
|
14500
|
+
children: [
|
|
14501
|
+
navBarVisible && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(TopHeader, { pluginItems }) }),
|
|
14502
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
|
|
14503
|
+
"div",
|
|
14504
|
+
{
|
|
14505
|
+
ref: mobilePanelRef,
|
|
14506
|
+
className: getLayoutClassName("mobilePanel"),
|
|
14507
|
+
children: [
|
|
14508
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14509
|
+
"div",
|
|
14510
|
+
{
|
|
14511
|
+
className: getLayoutClassName("mobileDragHandle"),
|
|
14512
|
+
onTouchStart: (e) => handleMobileDragStart(e.touches[0].clientY),
|
|
14513
|
+
onMouseDown: (e) => handleMobileDragStart(e.clientY),
|
|
14514
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14515
|
+
"div",
|
|
14516
|
+
{
|
|
14517
|
+
className: getLayoutClassName("mobileDragHandlePill")
|
|
14518
|
+
}
|
|
14519
|
+
)
|
|
14520
|
+
}
|
|
14521
|
+
),
|
|
14522
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14523
|
+
"div",
|
|
14524
|
+
{
|
|
14525
|
+
className: getLayoutClassName("mobilePanelContent"),
|
|
14526
|
+
children: Object.entries(pluginItems).map(
|
|
14527
|
+
([id, { mobileOnly, render: Render2 }]) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14528
|
+
PluginTab,
|
|
14529
|
+
{
|
|
14530
|
+
visible: currentPlugin === id,
|
|
14531
|
+
mobileOnly,
|
|
14532
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Render2, {})
|
|
14533
|
+
},
|
|
14534
|
+
id
|
|
14535
|
+
)
|
|
14536
|
+
)
|
|
14537
|
+
}
|
|
14538
|
+
)
|
|
14539
|
+
]
|
|
14540
|
+
}
|
|
14541
|
+
),
|
|
14542
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14543
|
+
Sidebar,
|
|
14544
|
+
{
|
|
14545
|
+
position: "left",
|
|
14546
|
+
sidebarRef: leftSidebarRef,
|
|
14547
|
+
isVisible: leftSideBarVisible,
|
|
14548
|
+
onResize: setLeftWidth,
|
|
14549
|
+
onResizeEnd: handleLeftSidebarResizeEnd,
|
|
14550
|
+
children: Object.entries(pluginItems).map(
|
|
14551
|
+
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14552
|
+
PluginTab,
|
|
14553
|
+
{
|
|
14554
|
+
visible: currentPlugin === id,
|
|
14555
|
+
mobileOnly,
|
|
14556
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Render2, {})
|
|
14557
|
+
},
|
|
14558
|
+
id
|
|
14559
|
+
)
|
|
14560
|
+
)
|
|
14561
|
+
}
|
|
14562
|
+
),
|
|
14563
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14564
|
+
Canvas,
|
|
14565
|
+
{
|
|
14566
|
+
theme,
|
|
14567
|
+
themeIcon,
|
|
14568
|
+
themeLabel,
|
|
14569
|
+
onToggleTheme: toggleTheme
|
|
14570
|
+
}
|
|
14571
|
+
),
|
|
14572
|
+
!hasDesktopFieldsPlugin && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
14573
|
+
Sidebar,
|
|
14574
|
+
{
|
|
14575
|
+
position: "right",
|
|
14576
|
+
sidebarRef: rightSidebarRef,
|
|
14577
|
+
isVisible: rightSideBarVisible,
|
|
14578
|
+
onResize: setRightWidth,
|
|
14579
|
+
onResizeEnd: handleRightSidebarResizeEnd,
|
|
14580
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(FieldSideBar, {})
|
|
14581
|
+
}
|
|
14582
|
+
)
|
|
14583
|
+
]
|
|
14584
|
+
}
|
|
14585
|
+
)
|
|
14154
14586
|
}
|
|
14155
14587
|
) }) }) }),
|
|
14156
|
-
/* @__PURE__ */ (0,
|
|
14588
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { id: "editor-portal-root", className: getClassName42("portal") })
|
|
14157
14589
|
]
|
|
14158
14590
|
}
|
|
14159
|
-
)
|
|
14591
|
+
);
|
|
14160
14592
|
};
|
|
14161
14593
|
|
|
14162
14594
|
// components/Editor/index.tsx
|
|
14163
|
-
var
|
|
14595
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
14164
14596
|
var CHROME_KEYS = [
|
|
14165
14597
|
"showNavBar",
|
|
14166
14598
|
"showThemeToggle",
|
|
@@ -14190,11 +14622,11 @@ var splitUiConfig = (ui) => {
|
|
|
14190
14622
|
}
|
|
14191
14623
|
return { runtime, chrome };
|
|
14192
14624
|
};
|
|
14193
|
-
var propsContext = (0,
|
|
14625
|
+
var propsContext = (0, import_react95.createContext)({});
|
|
14194
14626
|
function PropsProvider(props) {
|
|
14195
|
-
return /* @__PURE__ */ (0,
|
|
14627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(propsContext.Provider, { value: props, children: props.children });
|
|
14196
14628
|
}
|
|
14197
|
-
var usePropsContext = () => (0,
|
|
14629
|
+
var usePropsContext = () => (0, import_react95.useContext)(propsContext);
|
|
14198
14630
|
var useChromeConfig = () => {
|
|
14199
14631
|
const { ui } = usePropsContext();
|
|
14200
14632
|
const { chrome } = splitUiConfig(ui);
|
|
@@ -14218,14 +14650,14 @@ function EditorProvider({ children }) {
|
|
|
14218
14650
|
fullScreenCanvas,
|
|
14219
14651
|
_experimentalVirtualization
|
|
14220
14652
|
} = usePropsContext();
|
|
14221
|
-
const iframe = (0,
|
|
14653
|
+
const iframe = (0, import_react95.useMemo)(
|
|
14222
14654
|
() => __spreadValues({
|
|
14223
14655
|
enabled: true,
|
|
14224
14656
|
waitForStyles: true
|
|
14225
14657
|
}, _iframe),
|
|
14226
14658
|
[_iframe]
|
|
14227
14659
|
);
|
|
14228
|
-
const [generatedAppState] = (0,
|
|
14660
|
+
const [generatedAppState] = (0, import_react95.useState)(() => {
|
|
14229
14661
|
var _a, _b, _c, _d, _e, _f;
|
|
14230
14662
|
const { runtime: initialUiRuntime } = splitUiConfig(initialUi);
|
|
14231
14663
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUiRuntime);
|
|
@@ -14278,7 +14710,7 @@ function EditorProvider({ children }) {
|
|
|
14278
14710
|
return walkAppState(newAppState, config);
|
|
14279
14711
|
});
|
|
14280
14712
|
const { appendData = true } = _initialHistory || {};
|
|
14281
|
-
const [blendedHistories] = (0,
|
|
14713
|
+
const [blendedHistories] = (0, import_react95.useState)(
|
|
14282
14714
|
[
|
|
14283
14715
|
...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
|
|
14284
14716
|
...appendData ? [{ state: generatedAppState }] : []
|
|
@@ -14292,7 +14724,7 @@ function EditorProvider({ children }) {
|
|
|
14292
14724
|
});
|
|
14293
14725
|
})
|
|
14294
14726
|
);
|
|
14295
|
-
const initialHistoryIndex = (0,
|
|
14727
|
+
const initialHistoryIndex = (0, import_react95.useMemo)(() => {
|
|
14296
14728
|
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
14729
|
return _initialHistory == null ? void 0 : _initialHistory.index;
|
|
14298
14730
|
}
|
|
@@ -14303,7 +14735,7 @@ function EditorProvider({ children }) {
|
|
|
14303
14735
|
overrides,
|
|
14304
14736
|
plugins
|
|
14305
14737
|
});
|
|
14306
|
-
const loadedFieldTransforms = (0,
|
|
14738
|
+
const loadedFieldTransforms = (0, import_react95.useMemo)(() => {
|
|
14307
14739
|
const _plugins = plugins || [];
|
|
14308
14740
|
const pluginFieldTransforms = _plugins.reduce(
|
|
14309
14741
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
@@ -14312,7 +14744,7 @@ function EditorProvider({ children }) {
|
|
|
14312
14744
|
return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
|
|
14313
14745
|
}, [fieldTransforms, plugins]);
|
|
14314
14746
|
const instanceId = useSafeId();
|
|
14315
|
-
const generateAppStore = (0,
|
|
14747
|
+
const generateAppStore = (0, import_react95.useCallback)(
|
|
14316
14748
|
(state) => {
|
|
14317
14749
|
return {
|
|
14318
14750
|
instanceId,
|
|
@@ -14344,15 +14776,15 @@ function EditorProvider({ children }) {
|
|
|
14344
14776
|
loadedFieldTransforms
|
|
14345
14777
|
]
|
|
14346
14778
|
);
|
|
14347
|
-
const [appStore] = (0,
|
|
14779
|
+
const [appStore] = (0, import_react95.useState)(
|
|
14348
14780
|
() => createAppStore(generateAppStore(initialAppState))
|
|
14349
14781
|
);
|
|
14350
|
-
(0,
|
|
14782
|
+
(0, import_react95.useEffect)(() => {
|
|
14351
14783
|
if (process.env.NODE_ENV !== "production") {
|
|
14352
14784
|
window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
|
|
14353
14785
|
}
|
|
14354
14786
|
}, [appStore]);
|
|
14355
|
-
(0,
|
|
14787
|
+
(0, import_react95.useEffect)(() => {
|
|
14356
14788
|
const state = appStore.getState().state;
|
|
14357
14789
|
appStore.setState(__spreadValues({}, generateAppStore(state)));
|
|
14358
14790
|
}, [generateAppStore]);
|
|
@@ -14361,8 +14793,8 @@ function EditorProvider({ children }) {
|
|
|
14361
14793
|
index: initialHistoryIndex,
|
|
14362
14794
|
initialAppState
|
|
14363
14795
|
});
|
|
14364
|
-
const previousData = (0,
|
|
14365
|
-
(0,
|
|
14796
|
+
const previousData = (0, import_react95.useRef)(null);
|
|
14797
|
+
(0, import_react95.useEffect)(() => {
|
|
14366
14798
|
return appStore.subscribe(
|
|
14367
14799
|
(s) => s.state.data,
|
|
14368
14800
|
(data) => {
|
|
@@ -14376,16 +14808,16 @@ function EditorProvider({ children }) {
|
|
|
14376
14808
|
}, [onChange, config]);
|
|
14377
14809
|
useRegisterPermissionsSlice(appStore, permissions);
|
|
14378
14810
|
const uEditorStore = useRegisterUseEditorStore(appStore);
|
|
14379
|
-
(0,
|
|
14811
|
+
(0, import_react95.useEffect)(() => {
|
|
14380
14812
|
const { resolveAndCommitData } = appStore.getState();
|
|
14381
14813
|
setTimeout(() => {
|
|
14382
14814
|
resolveAndCommitData();
|
|
14383
14815
|
}, 0);
|
|
14384
14816
|
}, []);
|
|
14385
|
-
return /* @__PURE__ */ (0,
|
|
14817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(UseEditorStoreContext.Provider, { value: uEditorStore, children }) });
|
|
14386
14818
|
}
|
|
14387
14819
|
function Editor4(props) {
|
|
14388
|
-
return /* @__PURE__ */ (0,
|
|
14820
|
+
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
14821
|
}
|
|
14390
14822
|
Editor4.Components = Components;
|
|
14391
14823
|
Editor4.Fields = Fields;
|
|
@@ -14395,15 +14827,15 @@ Editor4.Preview = Preview2;
|
|
|
14395
14827
|
|
|
14396
14828
|
// components/App/AppProvider.tsx
|
|
14397
14829
|
init_react_import();
|
|
14398
|
-
var
|
|
14830
|
+
var import_react98 = require("react");
|
|
14399
14831
|
var import_react_router2 = require("react-router");
|
|
14400
14832
|
|
|
14401
14833
|
// lib/use-stable-value.ts
|
|
14402
14834
|
init_react_import();
|
|
14403
|
-
var
|
|
14835
|
+
var import_react96 = require("react");
|
|
14404
14836
|
var import_fast_equals5 = require("fast-equals");
|
|
14405
14837
|
var useStableValue = (value) => {
|
|
14406
|
-
const ref = (0,
|
|
14838
|
+
const ref = (0, import_react96.useRef)(value);
|
|
14407
14839
|
if (!(0, import_fast_equals5.deepEqual)(ref.current, value)) {
|
|
14408
14840
|
ref.current = value;
|
|
14409
14841
|
}
|
|
@@ -14412,20 +14844,20 @@ var useStableValue = (value) => {
|
|
|
14412
14844
|
|
|
14413
14845
|
// components/App/context.ts
|
|
14414
14846
|
init_react_import();
|
|
14415
|
-
var
|
|
14847
|
+
var import_react97 = require("react");
|
|
14416
14848
|
var import_react_router = require("react-router");
|
|
14417
|
-
var appConfigContext = (0,
|
|
14849
|
+
var appConfigContext = (0, import_react97.createContext)(null);
|
|
14418
14850
|
var useAppConfigContext = () => {
|
|
14419
|
-
const ctx = (0,
|
|
14851
|
+
const ctx = (0, import_react97.useContext)(appConfigContext);
|
|
14420
14852
|
if (!ctx) {
|
|
14421
14853
|
throw new Error("useApp must be called inside an <AppProvider> or <App>");
|
|
14422
14854
|
}
|
|
14423
14855
|
return ctx;
|
|
14424
14856
|
};
|
|
14425
|
-
var stripPrefix = (path,
|
|
14426
|
-
if (path ===
|
|
14427
|
-
if (!path.startsWith(`${
|
|
14428
|
-
const rest = path.slice(
|
|
14857
|
+
var stripPrefix = (path, prefix2) => {
|
|
14858
|
+
if (path === prefix2) return "/";
|
|
14859
|
+
if (!path.startsWith(`${prefix2}/`)) return path;
|
|
14860
|
+
const rest = path.slice(prefix2.length);
|
|
14429
14861
|
return rest.startsWith("/") ? rest : `/${rest}`;
|
|
14430
14862
|
};
|
|
14431
14863
|
var useApp = () => {
|
|
@@ -14435,7 +14867,7 @@ var useApp = () => {
|
|
|
14435
14867
|
const currentPath = location.pathname || "/";
|
|
14436
14868
|
const isEditing = cfg.editorPath !== null && (currentPath === cfg.editorPath || currentPath.startsWith(`${cfg.editorPath}/`));
|
|
14437
14869
|
const matchRoute = isEditing ? stripPrefix(currentPath, cfg.editorPath) : currentPath;
|
|
14438
|
-
const matched = (0,
|
|
14870
|
+
const matched = (0, import_react97.useMemo)(() => {
|
|
14439
14871
|
const routeKeys = Object.keys(cfg.pages);
|
|
14440
14872
|
if (routeKeys.length === 0) return null;
|
|
14441
14873
|
const matches = (0, import_react_router.matchRoutes)(
|
|
@@ -14451,7 +14883,7 @@ var useApp = () => {
|
|
|
14451
14883
|
data: cfg.pages[key]
|
|
14452
14884
|
};
|
|
14453
14885
|
}, [cfg.pages, matchRoute]);
|
|
14454
|
-
const routes = (0,
|
|
14886
|
+
const routes = (0, import_react97.useMemo)(() => Object.keys(cfg.pages), [cfg.pages]);
|
|
14455
14887
|
const navigate = (route) => {
|
|
14456
14888
|
const target = isEditing && cfg.editorPath ? `${cfg.editorPath}${route === "/" ? "" : route}` || "/" : route;
|
|
14457
14889
|
rrNavigate(target || "/");
|
|
@@ -14467,7 +14899,7 @@ var useApp = () => {
|
|
|
14467
14899
|
};
|
|
14468
14900
|
|
|
14469
14901
|
// components/App/AppProvider.tsx
|
|
14470
|
-
var
|
|
14902
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
14471
14903
|
var EDITOR_PATH = "/editor";
|
|
14472
14904
|
var isServer = typeof window === "undefined";
|
|
14473
14905
|
function AppProvider({
|
|
@@ -14480,7 +14912,7 @@ function AppProvider({
|
|
|
14480
14912
|
}) {
|
|
14481
14913
|
const stablePages = useStableValue(pages);
|
|
14482
14914
|
const resolvedEditorPath = editorPath === null ? null : editorPath || EDITOR_PATH;
|
|
14483
|
-
const ctxValue = (0,
|
|
14915
|
+
const ctxValue = (0, import_react98.useMemo)(
|
|
14484
14916
|
() => ({
|
|
14485
14917
|
config,
|
|
14486
14918
|
pages: stablePages,
|
|
@@ -14488,26 +14920,26 @@ function AppProvider({
|
|
|
14488
14920
|
}),
|
|
14489
14921
|
[config, stablePages, resolvedEditorPath]
|
|
14490
14922
|
);
|
|
14491
|
-
const inner = /* @__PURE__ */ (0,
|
|
14923
|
+
const inner = /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(appConfigContext.Provider, { value: ctxValue, children });
|
|
14492
14924
|
if (isServer) {
|
|
14493
|
-
return /* @__PURE__ */ (0,
|
|
14925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react_router2.StaticRouter, { location: currentPath != null ? currentPath : "/", children: inner });
|
|
14494
14926
|
}
|
|
14495
14927
|
if (router === "hash") {
|
|
14496
|
-
return /* @__PURE__ */ (0,
|
|
14928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react_router2.HashRouter, { children: inner });
|
|
14497
14929
|
}
|
|
14498
14930
|
if (router === "memory") {
|
|
14499
|
-
return /* @__PURE__ */ (0,
|
|
14931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react_router2.MemoryRouter, { initialEntries: [currentPath != null ? currentPath : "/"], children: inner });
|
|
14500
14932
|
}
|
|
14501
|
-
return /* @__PURE__ */ (0,
|
|
14933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react_router2.BrowserRouter, { children: inner });
|
|
14502
14934
|
}
|
|
14503
14935
|
|
|
14504
14936
|
// components/App/App.tsx
|
|
14505
|
-
var
|
|
14937
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
14506
14938
|
var joinEditorPath = (editorPath, route) => {
|
|
14507
14939
|
if (route === "/") return editorPath;
|
|
14508
14940
|
return `${editorPath}${route}`;
|
|
14509
14941
|
};
|
|
14510
|
-
var DefaultNotFound = () => /* @__PURE__ */ (0,
|
|
14942
|
+
var DefaultNotFound = () => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14511
14943
|
"div",
|
|
14512
14944
|
{
|
|
14513
14945
|
style: {
|
|
@@ -14517,9 +14949,9 @@ var DefaultNotFound = () => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
|
14517
14949
|
justifyContent: "center",
|
|
14518
14950
|
alignItems: "center"
|
|
14519
14951
|
},
|
|
14520
|
-
children: /* @__PURE__ */ (0,
|
|
14521
|
-
/* @__PURE__ */ (0,
|
|
14522
|
-
/* @__PURE__ */ (0,
|
|
14952
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { children: [
|
|
14953
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("h1", { children: "404" }),
|
|
14954
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { children: "No page matches this route." })
|
|
14523
14955
|
] })
|
|
14524
14956
|
}
|
|
14525
14957
|
);
|
|
@@ -14530,7 +14962,7 @@ function RenderForKey({
|
|
|
14530
14962
|
const { config, pages } = useApp();
|
|
14531
14963
|
const data = pages[routeKey];
|
|
14532
14964
|
if (!data) return null;
|
|
14533
|
-
return /* @__PURE__ */ (0,
|
|
14965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14534
14966
|
Render,
|
|
14535
14967
|
{
|
|
14536
14968
|
config,
|
|
@@ -14548,7 +14980,7 @@ function EditorForKey({
|
|
|
14548
14980
|
const { config, pages, routes, navigate } = useApp();
|
|
14549
14981
|
const data = pages[routeKey];
|
|
14550
14982
|
if (!data) return null;
|
|
14551
|
-
return /* @__PURE__ */ (0,
|
|
14983
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14552
14984
|
Editor4,
|
|
14553
14985
|
{
|
|
14554
14986
|
config,
|
|
@@ -14585,12 +15017,12 @@ function AppRender({ metadata, renderNotFound }) {
|
|
|
14585
15017
|
const { pages, isEditing } = useApp();
|
|
14586
15018
|
if (isEditing) return null;
|
|
14587
15019
|
const routeKeys = Object.keys(pages);
|
|
14588
|
-
return /* @__PURE__ */ (0,
|
|
14589
|
-
routeKeys.map((routeKey) => /* @__PURE__ */ (0,
|
|
15020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_react_router3.Routes, { children: [
|
|
15021
|
+
routeKeys.map((routeKey) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14590
15022
|
import_react_router3.Route,
|
|
14591
15023
|
{
|
|
14592
15024
|
path: routeKey,
|
|
14593
|
-
element: /* @__PURE__ */ (0,
|
|
15025
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14594
15026
|
RenderForKey,
|
|
14595
15027
|
{
|
|
14596
15028
|
routeKey,
|
|
@@ -14600,11 +15032,11 @@ function AppRender({ metadata, renderNotFound }) {
|
|
|
14600
15032
|
},
|
|
14601
15033
|
`render:${routeKey}`
|
|
14602
15034
|
)),
|
|
14603
|
-
/* @__PURE__ */ (0,
|
|
15035
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14604
15036
|
import_react_router3.Route,
|
|
14605
15037
|
{
|
|
14606
15038
|
path: "*",
|
|
14607
|
-
element: renderNotFound ? /* @__PURE__ */ (0,
|
|
15039
|
+
element: renderNotFound ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_jsx_runtime94.Fragment, { children: renderNotFound() }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(DefaultNotFound, {})
|
|
14608
15040
|
}
|
|
14609
15041
|
)
|
|
14610
15042
|
] });
|
|
@@ -14614,12 +15046,12 @@ function AppEditor(props) {
|
|
|
14614
15046
|
const { pages, isEditing, editorPath } = useApp();
|
|
14615
15047
|
if (!isEditing || editorPath === null) return null;
|
|
14616
15048
|
const routeKeys = Object.keys(pages);
|
|
14617
|
-
return /* @__PURE__ */ (0,
|
|
14618
|
-
routeKeys.map((routeKey) => /* @__PURE__ */ (0,
|
|
15049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_react_router3.Routes, { children: [
|
|
15050
|
+
routeKeys.map((routeKey) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14619
15051
|
import_react_router3.Route,
|
|
14620
15052
|
{
|
|
14621
15053
|
path: joinEditorPath(editorPath, routeKey),
|
|
14622
|
-
element: /* @__PURE__ */ (0,
|
|
15054
|
+
element: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14623
15055
|
EditorForKey,
|
|
14624
15056
|
{
|
|
14625
15057
|
routeKey,
|
|
@@ -14630,26 +15062,26 @@ function AppEditor(props) {
|
|
|
14630
15062
|
},
|
|
14631
15063
|
`edit:${routeKey}`
|
|
14632
15064
|
)),
|
|
14633
|
-
/* @__PURE__ */ (0,
|
|
15065
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14634
15066
|
import_react_router3.Route,
|
|
14635
15067
|
{
|
|
14636
15068
|
path: "*",
|
|
14637
|
-
element: renderNotFound ? /* @__PURE__ */ (0,
|
|
15069
|
+
element: renderNotFound ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_jsx_runtime94.Fragment, { children: renderNotFound() }) : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(DefaultNotFound, {})
|
|
14638
15070
|
}
|
|
14639
15071
|
)
|
|
14640
15072
|
] });
|
|
14641
15073
|
}
|
|
14642
15074
|
function DefaultAppLayout(props) {
|
|
14643
15075
|
const _a = props, { renderNotFound } = _a, editorProps = __objRest(_a, ["renderNotFound"]);
|
|
14644
|
-
return /* @__PURE__ */ (0,
|
|
14645
|
-
/* @__PURE__ */ (0,
|
|
15076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
|
|
15077
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14646
15078
|
AppRender,
|
|
14647
15079
|
{
|
|
14648
15080
|
metadata: editorProps.metadata,
|
|
14649
15081
|
renderNotFound
|
|
14650
15082
|
}
|
|
14651
15083
|
),
|
|
14652
|
-
/* @__PURE__ */ (0,
|
|
15084
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(AppEditor, __spreadProps(__spreadValues({}, editorProps), { renderNotFound }))
|
|
14653
15085
|
] });
|
|
14654
15086
|
}
|
|
14655
15087
|
function App(props) {
|
|
@@ -14668,7 +15100,7 @@ function App(props) {
|
|
|
14668
15100
|
"router",
|
|
14669
15101
|
"children"
|
|
14670
15102
|
]);
|
|
14671
|
-
return /* @__PURE__ */ (0,
|
|
15103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
14672
15104
|
AppProvider,
|
|
14673
15105
|
{
|
|
14674
15106
|
config,
|
|
@@ -14676,7 +15108,7 @@ function App(props) {
|
|
|
14676
15108
|
currentPath,
|
|
14677
15109
|
editorPath,
|
|
14678
15110
|
router,
|
|
14679
|
-
children: children != null ? children : /* @__PURE__ */ (0,
|
|
15111
|
+
children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(DefaultAppLayout, __spreadValues({}, layoutProps))
|
|
14680
15112
|
}
|
|
14681
15113
|
);
|
|
14682
15114
|
}
|
|
@@ -15009,25 +15441,6 @@ function resolveAllData(_0, _1) {
|
|
|
15009
15441
|
// bundle/core.ts
|
|
15010
15442
|
init_walk_tree();
|
|
15011
15443
|
|
|
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
15444
|
// plugins/outline/index.tsx
|
|
15032
15445
|
init_react_import();
|
|
15033
15446
|
init_lucide_react();
|
|
@@ -15155,7 +15568,6 @@ lucide-react/dist/esm/icons/smartphone.js:
|
|
|
15155
15568
|
lucide-react/dist/esm/icons/square-code.js:
|
|
15156
15569
|
lucide-react/dist/esm/icons/strikethrough.js:
|
|
15157
15570
|
lucide-react/dist/esm/icons/sun.js:
|
|
15158
|
-
lucide-react/dist/esm/icons/tablet.js:
|
|
15159
15571
|
lucide-react/dist/esm/icons/toy-brick.js:
|
|
15160
15572
|
lucide-react/dist/esm/icons/trash.js:
|
|
15161
15573
|
lucide-react/dist/esm/icons/underline.js:
|