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