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