@reacteditor/core 0.0.6 → 0.0.8
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-YNFB7B6Z.mjs → Editor-KXEVJBNG.mjs} +9 -9
- package/dist/{actions-CQmL3wwa.d.mts → actions-2L-1hQ7r.d.mts} +7 -2
- package/dist/{actions-CQmL3wwa.d.ts → actions-2L-1hQ7r.d.ts} +7 -2
- package/dist/{chunk-6LG4Q4HO.mjs → chunk-AD7BMXAA.mjs} +1 -1
- package/dist/{chunk-DB4R5IWG.mjs → chunk-AJWRDM22.mjs} +3 -3
- package/dist/{chunk-WGPCLAZR.mjs → chunk-FT6UFK7G.mjs} +1 -1
- package/dist/{chunk-VOLQMQPK.mjs → chunk-IIRJMJFU.mjs} +1 -1
- package/dist/{chunk-CRF2GWQA.mjs → chunk-LRFRIIKG.mjs} +6 -4
- package/dist/{chunk-UB2DES2O.mjs → chunk-M4JDRFYB.mjs} +8 -6
- package/dist/{chunk-Z6IIVDFY.mjs → chunk-OIFPBVSF.mjs} +1 -1
- package/dist/{chunk-HCFEY5Y7.mjs → chunk-R5DQGUQS.mjs} +949 -610
- package/dist/{chunk-275EJPEB.mjs → chunk-TI3KC54Y.mjs} +18 -18
- package/dist/{chunk-BRDUM7MJ.mjs → chunk-U7VW3V3W.mjs} +7 -7
- package/dist/{full-24FOTNTB.mjs → full-ZFZZ626B.mjs} +8 -8
- package/dist/{index-BOP2qNVA.d.mts → index-BNsSzMCj.d.ts} +2 -1
- package/dist/{index-_G46lHpL.d.ts → index-BXuSeNez.d.mts} +2 -1
- package/dist/index.css +99 -26
- package/dist/index.d.mts +36 -8
- package/dist/index.d.ts +36 -8
- package/dist/index.js +1448 -1097
- package/dist/index.mjs +14 -14
- package/dist/internal.d.mts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +7 -5
- package/dist/internal.mjs +2 -2
- package/dist/{loaded-BQVZGQG2.mjs → loaded-GLBLMTBL.mjs} +5 -5
- package/dist/{loaded-6IBSSOXD.mjs → loaded-O4QHGE26.mjs} +5 -5
- package/dist/{loaded-6NPDD7SF.mjs → loaded-R34BR6I5.mjs} +5 -5
- package/dist/no-external.css +99 -26
- package/dist/no-external.d.mts +4 -4
- package/dist/no-external.d.ts +4 -4
- package/dist/no-external.js +1448 -1097
- package/dist/no-external.mjs +14 -14
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.mjs +3 -3
- package/dist/{walk-tree-Dwv3c_9M.d.mts → walk-tree-4C3ODO3X.d.mts} +1 -1
- package/dist/{walk-tree-DxSkPLnl.d.ts → walk-tree-C9GrSWsR.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/{chunk-GAUBBDIR.mjs → chunk-JIXMPJZA.mjs} +37 -37
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EditorInner,
|
|
3
3
|
LoadedRichTextMenu
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AJWRDM22.mjs";
|
|
5
5
|
import {
|
|
6
6
|
RichTextRenderFallback,
|
|
7
7
|
SlotRender,
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
getSlotTransform,
|
|
11
11
|
useRichtextProps,
|
|
12
12
|
useSlots
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-TI3KC54Y.mjs";
|
|
14
14
|
import {
|
|
15
15
|
ActionBar,
|
|
16
16
|
IconButton,
|
|
17
17
|
LoadedRichTextMenuInner,
|
|
18
18
|
Loader
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-U7VW3V3W.mjs";
|
|
20
20
|
import {
|
|
21
21
|
Check,
|
|
22
22
|
ChevronDown,
|
|
@@ -60,18 +60,18 @@ import {
|
|
|
60
60
|
useRegisterFieldsSlice,
|
|
61
61
|
useRegisterHistorySlice,
|
|
62
62
|
useRegisterPermissionsSlice
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-LRFRIIKG.mjs";
|
|
64
64
|
import {
|
|
65
65
|
getItem,
|
|
66
66
|
insert,
|
|
67
67
|
insertAction,
|
|
68
68
|
makeStatePublic,
|
|
69
69
|
populateIds
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-M4JDRFYB.mjs";
|
|
71
71
|
import {
|
|
72
72
|
defaultAppState,
|
|
73
73
|
defaultViewports
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-IIRJMJFU.mjs";
|
|
75
75
|
import {
|
|
76
76
|
get_class_name_factory_default
|
|
77
77
|
} from "./chunk-Y2EFNT5P.mjs";
|
|
@@ -87,7 +87,7 @@ import {
|
|
|
87
87
|
toComponent,
|
|
88
88
|
walkAppState,
|
|
89
89
|
walkField
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-JIXMPJZA.mjs";
|
|
91
91
|
import {
|
|
92
92
|
__async,
|
|
93
93
|
__objRest,
|
|
@@ -240,7 +240,7 @@ init_react_import();
|
|
|
240
240
|
|
|
241
241
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/AutoField/styles.module.css#css-module
|
|
242
242
|
init_react_import();
|
|
243
|
-
var styles_module_default = { "InputWrapper": "
|
|
243
|
+
var styles_module_default = { "InputWrapper": "_InputWrapper_zwh6e_1", "Input-label": "_Input-label_zwh6e_5", "Input-labelIcon": "_Input-labelIcon_zwh6e_15", "Input-disabledIcon": "_Input-disabledIcon_zwh6e_22", "Input-input": "_Input-input_zwh6e_27", "Input": "_Input_zwh6e_1", "Input--readOnly": "_Input--readOnly_zwh6e_87", "Input-radioGroupItems": "_Input-radioGroupItems_zwh6e_98", "Input-radio": "_Input-radio_zwh6e_98", "Input-radioInner": "_Input-radioInner_zwh6e_115", "Input-radioInput": "_Input-radioInput_zwh6e_147" };
|
|
244
244
|
|
|
245
245
|
// components/AutoField/FieldLabel.tsx
|
|
246
246
|
import { useMemo } from "react";
|
|
@@ -294,7 +294,7 @@ var FieldLabelInternal = ({
|
|
|
294
294
|
// components/AutoField/index.tsx
|
|
295
295
|
init_react_import();
|
|
296
296
|
import {
|
|
297
|
-
useCallback as
|
|
297
|
+
useCallback as useCallback5,
|
|
298
298
|
useContext as useContext4,
|
|
299
299
|
useEffect as useEffect7,
|
|
300
300
|
useMemo as useMemo5
|
|
@@ -1277,8 +1277,9 @@ var ArrayField = ({
|
|
|
1277
1277
|
);
|
|
1278
1278
|
};
|
|
1279
1279
|
|
|
1280
|
-
// components/AutoField/fields/
|
|
1280
|
+
// components/AutoField/fields/ColorField/index.tsx
|
|
1281
1281
|
init_react_import();
|
|
1282
|
+
import { useCallback as useCallback3, useRef as useRef2 } from "react";
|
|
1282
1283
|
|
|
1283
1284
|
// components/AutoField/lib/use-local-value.ts
|
|
1284
1285
|
init_react_import();
|
|
@@ -1316,9 +1317,107 @@ var useLocalValue = (path, onChange) => {
|
|
|
1316
1317
|
return [localValue != null ? localValue : "", onChangeLocal];
|
|
1317
1318
|
};
|
|
1318
1319
|
|
|
1320
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/AutoField/fields/ColorField/styles.module.css#css-module
|
|
1321
|
+
init_react_import();
|
|
1322
|
+
var styles_module_default4 = { "ColorField": "_ColorField_1nsbe_1", "ColorField--readOnly": "_ColorField--readOnly_1nsbe_24", "ColorField-swatch": "_ColorField-swatch_1nsbe_34", "ColorField-picker": "_ColorField-picker_1nsbe_57", "ColorField-text": "_ColorField-text_1nsbe_64" };
|
|
1323
|
+
|
|
1324
|
+
// components/AutoField/fields/ColorField/index.tsx
|
|
1325
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1326
|
+
var getClassName5 = get_class_name_factory_default("ColorField", styles_module_default4);
|
|
1327
|
+
var toHexInput = (val) => {
|
|
1328
|
+
if (typeof val !== "string") return "#000000";
|
|
1329
|
+
const trimmed = val.trim();
|
|
1330
|
+
const m = trimmed.match(/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);
|
|
1331
|
+
if (!m) return "#000000";
|
|
1332
|
+
const hex = m[1];
|
|
1333
|
+
if (hex.length === 3) {
|
|
1334
|
+
return `#${hex.split("").map((c) => c + c).join("")}`;
|
|
1335
|
+
}
|
|
1336
|
+
return `#${hex}`.toLowerCase();
|
|
1337
|
+
};
|
|
1338
|
+
var canonicalize = (val) => {
|
|
1339
|
+
const trimmed = val.trim();
|
|
1340
|
+
const m = trimmed.match(/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);
|
|
1341
|
+
if (!m) return null;
|
|
1342
|
+
const hex = m[1];
|
|
1343
|
+
if (hex.length === 3) {
|
|
1344
|
+
return `#${hex.split("").map((c) => c + c).join("")}`.toLowerCase();
|
|
1345
|
+
}
|
|
1346
|
+
return `#${hex}`.toLowerCase();
|
|
1347
|
+
};
|
|
1348
|
+
var ColorField = ({
|
|
1349
|
+
field,
|
|
1350
|
+
onChange,
|
|
1351
|
+
readOnly,
|
|
1352
|
+
id,
|
|
1353
|
+
name = id,
|
|
1354
|
+
label,
|
|
1355
|
+
labelIcon,
|
|
1356
|
+
Label: Label2
|
|
1357
|
+
}) => {
|
|
1358
|
+
var _a;
|
|
1359
|
+
const [localValue, onChangeLocal] = useLocalValue(name, onChange);
|
|
1360
|
+
const pickerRef = useRef2(null);
|
|
1361
|
+
if (field.type !== "color") return null;
|
|
1362
|
+
const swatchHex = toHexInput(localValue);
|
|
1363
|
+
const openPicker = useCallback3(() => {
|
|
1364
|
+
var _a2;
|
|
1365
|
+
if (readOnly) return;
|
|
1366
|
+
(_a2 = pickerRef.current) == null ? void 0 : _a2.click();
|
|
1367
|
+
}, [readOnly]);
|
|
1368
|
+
return /* @__PURE__ */ jsx9(Label2, { label: label || name, icon: labelIcon, readOnly, children: /* @__PURE__ */ jsxs4("div", { className: getClassName5({ readOnly }), children: [
|
|
1369
|
+
/* @__PURE__ */ jsx9(
|
|
1370
|
+
"button",
|
|
1371
|
+
{
|
|
1372
|
+
type: "button",
|
|
1373
|
+
"aria-label": "Open color picker",
|
|
1374
|
+
className: getClassName5("swatch"),
|
|
1375
|
+
disabled: readOnly,
|
|
1376
|
+
onClick: openPicker,
|
|
1377
|
+
style: { color: swatchHex },
|
|
1378
|
+
children: /* @__PURE__ */ jsx9(
|
|
1379
|
+
"input",
|
|
1380
|
+
{
|
|
1381
|
+
ref: pickerRef,
|
|
1382
|
+
className: getClassName5("picker"),
|
|
1383
|
+
type: "color",
|
|
1384
|
+
tabIndex: -1,
|
|
1385
|
+
"aria-hidden": true,
|
|
1386
|
+
value: swatchHex,
|
|
1387
|
+
disabled: readOnly,
|
|
1388
|
+
onChange: (e) => onChangeLocal(e.currentTarget.value)
|
|
1389
|
+
}
|
|
1390
|
+
)
|
|
1391
|
+
}
|
|
1392
|
+
),
|
|
1393
|
+
/* @__PURE__ */ jsx9(
|
|
1394
|
+
"input",
|
|
1395
|
+
{
|
|
1396
|
+
className: getClassName5("text"),
|
|
1397
|
+
autoComplete: "off",
|
|
1398
|
+
type: "text",
|
|
1399
|
+
name,
|
|
1400
|
+
id,
|
|
1401
|
+
value: localValue != null ? localValue : "",
|
|
1402
|
+
placeholder: (_a = field.placeholder) != null ? _a : "#000000",
|
|
1403
|
+
readOnly,
|
|
1404
|
+
tabIndex: readOnly ? -1 : void 0,
|
|
1405
|
+
onChange: (e) => onChangeLocal(e.currentTarget.value),
|
|
1406
|
+
onBlur: (e) => {
|
|
1407
|
+
const canonical = canonicalize(e.currentTarget.value);
|
|
1408
|
+
if (canonical && canonical !== e.currentTarget.value) {
|
|
1409
|
+
onChangeLocal(canonical);
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
)
|
|
1414
|
+
] }) });
|
|
1415
|
+
};
|
|
1416
|
+
|
|
1319
1417
|
// components/AutoField/fields/DefaultField/index.tsx
|
|
1320
|
-
|
|
1321
|
-
|
|
1418
|
+
init_react_import();
|
|
1419
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1420
|
+
var getClassName6 = get_class_name_factory_default("Input", styles_module_default);
|
|
1322
1421
|
var DefaultField = ({
|
|
1323
1422
|
field,
|
|
1324
1423
|
onChange,
|
|
@@ -1330,16 +1429,16 @@ var DefaultField = ({
|
|
|
1330
1429
|
Label: Label2
|
|
1331
1430
|
}) => {
|
|
1332
1431
|
const [localValue, onChangeLocal] = useLocalValue(name, onChange);
|
|
1333
|
-
return /* @__PURE__ */
|
|
1432
|
+
return /* @__PURE__ */ jsx10(
|
|
1334
1433
|
Label2,
|
|
1335
1434
|
{
|
|
1336
1435
|
label: label || name,
|
|
1337
1436
|
icon: labelIcon,
|
|
1338
1437
|
readOnly,
|
|
1339
|
-
children: /* @__PURE__ */
|
|
1438
|
+
children: /* @__PURE__ */ jsx10(
|
|
1340
1439
|
"input",
|
|
1341
1440
|
{
|
|
1342
|
-
className:
|
|
1441
|
+
className: getClassName6("input"),
|
|
1343
1442
|
autoComplete: "off",
|
|
1344
1443
|
type: field.type,
|
|
1345
1444
|
title: label || name,
|
|
@@ -1382,13 +1481,13 @@ import {
|
|
|
1382
1481
|
useMemo as useMemo4,
|
|
1383
1482
|
useEffect as useEffect5,
|
|
1384
1483
|
useState as useState7,
|
|
1385
|
-
useCallback as
|
|
1484
|
+
useCallback as useCallback4,
|
|
1386
1485
|
isValidElement
|
|
1387
1486
|
} from "react";
|
|
1388
1487
|
|
|
1389
1488
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ExternalInput/styles.module.css#css-module
|
|
1390
1489
|
init_react_import();
|
|
1391
|
-
var
|
|
1490
|
+
var styles_module_default5 = { "ExternalInput-actions": "_ExternalInput-actions_142hz_1", "ExternalInput-button": "_ExternalInput-button_142hz_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_142hz_25", "ExternalInput--readOnly": "_ExternalInput--readOnly_142hz_32", "ExternalInput-detachButton": "_ExternalInput-detachButton_142hz_36", "ExternalInput": "_ExternalInput_142hz_1", "ExternalInputModal": "_ExternalInputModal_142hz_82", "ExternalInputModal-grid": "_ExternalInputModal-grid_142hz_92", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_142hz_103", "ExternalInputModal-filters": "_ExternalInputModal-filters_142hz_108", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_142hz_127", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_142hz_136", "ExternalInputModal-table": "_ExternalInputModal-table_142hz_136", "ExternalInputModal-thead": "_ExternalInputModal-thead_142hz_152", "ExternalInputModal-th": "_ExternalInputModal-th_142hz_152", "ExternalInputModal-td": "_ExternalInputModal-td_142hz_167", "ExternalInputModal-tr": "_ExternalInputModal-tr_142hz_172", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_142hz_179", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_142hz_205", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_142hz_209", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_142hz_226", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_142hz_230", "ExternalInputModal-search": "_ExternalInputModal-search_142hz_230", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_142hz_267", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_142hz_292", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_142hz_302", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_142hz_316", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_142hz_329", "ExternalInputModal-footerContainer": "_ExternalInputModal-footerContainer_142hz_333", "ExternalInputModal-footer": "_ExternalInputModal-footer_142hz_333", "ExternalInputModal-field": "_ExternalInputModal-field_142hz_346" };
|
|
1392
1491
|
|
|
1393
1492
|
// components/Modal/index.tsx
|
|
1394
1493
|
init_react_import();
|
|
@@ -1396,12 +1495,12 @@ import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
|
1396
1495
|
|
|
1397
1496
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Modal/styles.module.css#css-module
|
|
1398
1497
|
init_react_import();
|
|
1399
|
-
var
|
|
1498
|
+
var styles_module_default6 = { "Modal": "_Modal_vim19_1", "Modal--isOpen": "_Modal--isOpen_vim19_15", "Modal-inner": "_Modal-inner_vim19_19" };
|
|
1400
1499
|
|
|
1401
1500
|
// components/Modal/index.tsx
|
|
1402
1501
|
import { createPortal } from "react-dom";
|
|
1403
|
-
import { jsx as
|
|
1404
|
-
var
|
|
1502
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1503
|
+
var getClassName7 = get_class_name_factory_default("Modal", styles_module_default6);
|
|
1405
1504
|
var Modal = ({
|
|
1406
1505
|
children,
|
|
1407
1506
|
onClose,
|
|
@@ -1412,13 +1511,13 @@ var Modal = ({
|
|
|
1412
1511
|
setRootEl(document.getElementById("editor-portal-root"));
|
|
1413
1512
|
}, []);
|
|
1414
1513
|
if (!rootEl) {
|
|
1415
|
-
return /* @__PURE__ */
|
|
1514
|
+
return /* @__PURE__ */ jsx11("div", {});
|
|
1416
1515
|
}
|
|
1417
1516
|
return createPortal(
|
|
1418
|
-
/* @__PURE__ */
|
|
1517
|
+
/* @__PURE__ */ jsx11("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ jsx11(
|
|
1419
1518
|
"div",
|
|
1420
1519
|
{
|
|
1421
|
-
className:
|
|
1520
|
+
className: getClassName7("inner"),
|
|
1422
1521
|
onClick: (e) => e.stopPropagation(),
|
|
1423
1522
|
children
|
|
1424
1523
|
}
|
|
@@ -1432,17 +1531,17 @@ init_react_import();
|
|
|
1432
1531
|
|
|
1433
1532
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Heading/styles.module.css#css-module
|
|
1434
1533
|
init_react_import();
|
|
1435
|
-
var
|
|
1534
|
+
var styles_module_default7 = { "Heading": "_Heading_1537i_1", "Heading--xxxxl": "_Heading--xxxxl_1537i_13", "Heading--xxxl": "_Heading--xxxl_1537i_19", "Heading--xxl": "_Heading--xxl_1537i_23", "Heading--xl": "_Heading--xl_1537i_27", "Heading--l": "_Heading--l_1537i_31", "Heading--m": "_Heading--m_1537i_35", "Heading--s": "_Heading--s_1537i_39", "Heading--xs": "_Heading--xs_1537i_43" };
|
|
1436
1535
|
|
|
1437
1536
|
// components/Heading/index.tsx
|
|
1438
|
-
import { jsx as
|
|
1439
|
-
var
|
|
1537
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1538
|
+
var getClassName8 = get_class_name_factory_default("Heading", styles_module_default7);
|
|
1440
1539
|
var Heading = ({ children, rank, size = "m" }) => {
|
|
1441
1540
|
const Tag = rank ? `h${rank}` : "span";
|
|
1442
|
-
return /* @__PURE__ */
|
|
1541
|
+
return /* @__PURE__ */ jsx12(
|
|
1443
1542
|
Tag,
|
|
1444
1543
|
{
|
|
1445
|
-
className:
|
|
1544
|
+
className: getClassName8({
|
|
1446
1545
|
[size]: true
|
|
1447
1546
|
}),
|
|
1448
1547
|
children
|
|
@@ -1454,9 +1553,9 @@ var Heading = ({ children, rank, size = "m" }) => {
|
|
|
1454
1553
|
init_react_import();
|
|
1455
1554
|
|
|
1456
1555
|
// components/ExternalInput/index.tsx
|
|
1457
|
-
import { jsx as
|
|
1458
|
-
var
|
|
1459
|
-
var getClassNameModal = get_class_name_factory_default("ExternalInputModal",
|
|
1556
|
+
import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1557
|
+
var getClassName9 = get_class_name_factory_default("ExternalInput", styles_module_default5);
|
|
1558
|
+
var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default5);
|
|
1460
1559
|
var dataCache = {};
|
|
1461
1560
|
var ExternalInput = ({
|
|
1462
1561
|
field,
|
|
@@ -1494,7 +1593,7 @@ var ExternalInput = ({
|
|
|
1494
1593
|
return Array.from(validKeys);
|
|
1495
1594
|
}, [mappedData]);
|
|
1496
1595
|
const [searchQuery, setSearchQuery] = useState7(field.initialQuery || "");
|
|
1497
|
-
const search =
|
|
1596
|
+
const search = useCallback4(
|
|
1498
1597
|
(query, filters2) => __async(null, null, function* () {
|
|
1499
1598
|
setIsLoading(true);
|
|
1500
1599
|
const cacheKey = `${id}-${query}-${JSON.stringify(filters2)}`;
|
|
@@ -1514,8 +1613,8 @@ var ExternalInput = ({
|
|
|
1514
1613
|
}),
|
|
1515
1614
|
[id, field]
|
|
1516
1615
|
);
|
|
1517
|
-
const Footer =
|
|
1518
|
-
(props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */
|
|
1616
|
+
const Footer = useCallback4(
|
|
1617
|
+
(props) => field.renderFooter ? field.renderFooter(props) : /* @__PURE__ */ jsxs5("span", { className: getClassNameModal("footer"), children: [
|
|
1519
1618
|
props.items.length,
|
|
1520
1619
|
" result",
|
|
1521
1620
|
props.items.length === 1 ? "" : "s"
|
|
@@ -1525,41 +1624,41 @@ var ExternalInput = ({
|
|
|
1525
1624
|
useEffect5(() => {
|
|
1526
1625
|
search(searchQuery, filters);
|
|
1527
1626
|
}, []);
|
|
1528
|
-
return /* @__PURE__ */
|
|
1627
|
+
return /* @__PURE__ */ jsxs5(
|
|
1529
1628
|
"div",
|
|
1530
1629
|
{
|
|
1531
|
-
className:
|
|
1630
|
+
className: getClassName9({
|
|
1532
1631
|
dataSelected: !!value,
|
|
1533
1632
|
modalVisible: isOpen,
|
|
1534
1633
|
readOnly
|
|
1535
1634
|
}),
|
|
1536
1635
|
id,
|
|
1537
1636
|
children: [
|
|
1538
|
-
/* @__PURE__ */
|
|
1539
|
-
/* @__PURE__ */
|
|
1637
|
+
/* @__PURE__ */ jsxs5("div", { className: getClassName9("actions"), children: [
|
|
1638
|
+
/* @__PURE__ */ jsx13(
|
|
1540
1639
|
"button",
|
|
1541
1640
|
{
|
|
1542
1641
|
type: "button",
|
|
1543
1642
|
onClick: () => setOpen(true),
|
|
1544
|
-
className:
|
|
1643
|
+
className: getClassName9("button"),
|
|
1545
1644
|
disabled: readOnly,
|
|
1546
|
-
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */
|
|
1645
|
+
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ jsx13("span", { children: field.placeholder })
|
|
1547
1646
|
}
|
|
1548
1647
|
),
|
|
1549
|
-
value && /* @__PURE__ */
|
|
1648
|
+
value && /* @__PURE__ */ jsx13(
|
|
1550
1649
|
"button",
|
|
1551
1650
|
{
|
|
1552
1651
|
type: "button",
|
|
1553
|
-
className:
|
|
1652
|
+
className: getClassName9("detachButton"),
|
|
1554
1653
|
onClick: () => {
|
|
1555
1654
|
onChange(null);
|
|
1556
1655
|
},
|
|
1557
1656
|
disabled: readOnly,
|
|
1558
|
-
children: /* @__PURE__ */
|
|
1657
|
+
children: /* @__PURE__ */ jsx13(X, { size: 16 })
|
|
1559
1658
|
}
|
|
1560
1659
|
)
|
|
1561
1660
|
] }),
|
|
1562
|
-
/* @__PURE__ */
|
|
1661
|
+
/* @__PURE__ */ jsx13(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ jsxs5(
|
|
1563
1662
|
"form",
|
|
1564
1663
|
{
|
|
1565
1664
|
className: getClassNameModal({
|
|
@@ -1574,11 +1673,11 @@ var ExternalInput = ({
|
|
|
1574
1673
|
search(searchQuery, filters);
|
|
1575
1674
|
},
|
|
1576
1675
|
children: [
|
|
1577
|
-
/* @__PURE__ */
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1580
|
-
/* @__PURE__ */
|
|
1581
|
-
/* @__PURE__ */
|
|
1676
|
+
/* @__PURE__ */ jsx13("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ jsxs5("div", { className: getClassNameModal("searchForm"), children: [
|
|
1677
|
+
/* @__PURE__ */ jsxs5("label", { className: getClassNameModal("search"), children: [
|
|
1678
|
+
/* @__PURE__ */ jsx13("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
|
|
1679
|
+
/* @__PURE__ */ jsx13("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ jsx13(Search, { size: "18" }) }),
|
|
1680
|
+
/* @__PURE__ */ jsx13(
|
|
1582
1681
|
"input",
|
|
1583
1682
|
{
|
|
1584
1683
|
className: getClassNameModal("searchInput"),
|
|
@@ -1593,9 +1692,9 @@ var ExternalInput = ({
|
|
|
1593
1692
|
}
|
|
1594
1693
|
)
|
|
1595
1694
|
] }),
|
|
1596
|
-
/* @__PURE__ */
|
|
1597
|
-
/* @__PURE__ */
|
|
1598
|
-
hasFilterFields && /* @__PURE__ */
|
|
1695
|
+
/* @__PURE__ */ jsxs5("div", { className: getClassNameModal("searchActions"), children: [
|
|
1696
|
+
/* @__PURE__ */ jsx13(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
|
|
1697
|
+
hasFilterFields && /* @__PURE__ */ jsx13("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ jsx13(
|
|
1599
1698
|
IconButton,
|
|
1600
1699
|
{
|
|
1601
1700
|
type: "button",
|
|
@@ -1605,19 +1704,19 @@ var ExternalInput = ({
|
|
|
1605
1704
|
e.stopPropagation();
|
|
1606
1705
|
setFiltersToggled(!filtersToggled);
|
|
1607
1706
|
},
|
|
1608
|
-
children: /* @__PURE__ */
|
|
1707
|
+
children: /* @__PURE__ */ jsx13(SlidersHorizontal, { size: 20 })
|
|
1609
1708
|
}
|
|
1610
1709
|
) })
|
|
1611
1710
|
] })
|
|
1612
|
-
] }) : /* @__PURE__ */
|
|
1613
|
-
/* @__PURE__ */
|
|
1614
|
-
hasFilterFields && /* @__PURE__ */
|
|
1711
|
+
] }) : /* @__PURE__ */ jsx13(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
|
|
1712
|
+
/* @__PURE__ */ jsxs5("div", { className: getClassNameModal("grid"), children: [
|
|
1713
|
+
hasFilterFields && /* @__PURE__ */ jsx13("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
|
|
1615
1714
|
const filterField = filterFields[fieldName];
|
|
1616
|
-
return /* @__PURE__ */
|
|
1715
|
+
return /* @__PURE__ */ jsx13(
|
|
1617
1716
|
"div",
|
|
1618
1717
|
{
|
|
1619
1718
|
className: getClassNameModal("field"),
|
|
1620
|
-
children: /* @__PURE__ */
|
|
1719
|
+
children: /* @__PURE__ */ jsx13(FieldLabel, { label: filterField.label || fieldName, children: /* @__PURE__ */ jsx13(
|
|
1621
1720
|
AutoField,
|
|
1622
1721
|
{
|
|
1623
1722
|
field: filterField,
|
|
@@ -1638,9 +1737,9 @@ var ExternalInput = ({
|
|
|
1638
1737
|
fieldName
|
|
1639
1738
|
);
|
|
1640
1739
|
}) }),
|
|
1641
|
-
/* @__PURE__ */
|
|
1642
|
-
/* @__PURE__ */
|
|
1643
|
-
/* @__PURE__ */
|
|
1740
|
+
/* @__PURE__ */ jsxs5("div", { className: getClassNameModal("tableWrapper"), children: [
|
|
1741
|
+
/* @__PURE__ */ jsxs5("table", { className: getClassNameModal("table"), children: [
|
|
1742
|
+
/* @__PURE__ */ jsx13("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ jsx13("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ jsx13(
|
|
1644
1743
|
"th",
|
|
1645
1744
|
{
|
|
1646
1745
|
className: getClassNameModal("th"),
|
|
@@ -1649,8 +1748,8 @@ var ExternalInput = ({
|
|
|
1649
1748
|
},
|
|
1650
1749
|
key
|
|
1651
1750
|
)) }) }),
|
|
1652
|
-
/* @__PURE__ */
|
|
1653
|
-
return /* @__PURE__ */
|
|
1751
|
+
/* @__PURE__ */ jsx13("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
|
|
1752
|
+
return /* @__PURE__ */ jsx13(
|
|
1654
1753
|
"tr",
|
|
1655
1754
|
{
|
|
1656
1755
|
style: { whiteSpace: "nowrap" },
|
|
@@ -1659,16 +1758,16 @@ var ExternalInput = ({
|
|
|
1659
1758
|
onChange(mapProp(data[i]));
|
|
1660
1759
|
setOpen(false);
|
|
1661
1760
|
},
|
|
1662
|
-
children: keys.map((key) => /* @__PURE__ */
|
|
1761
|
+
children: keys.map((key) => /* @__PURE__ */ jsx13("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
|
1663
1762
|
},
|
|
1664
1763
|
i
|
|
1665
1764
|
);
|
|
1666
1765
|
}) })
|
|
1667
1766
|
] }),
|
|
1668
|
-
/* @__PURE__ */
|
|
1767
|
+
/* @__PURE__ */ jsx13("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ jsx13(Loader, { size: 24 }) })
|
|
1669
1768
|
] })
|
|
1670
1769
|
] }),
|
|
1671
|
-
/* @__PURE__ */
|
|
1770
|
+
/* @__PURE__ */ jsx13("div", { className: getClassNameModal("footerContainer"), children: /* @__PURE__ */ jsx13(Footer, { items: mappedData }) })
|
|
1672
1771
|
]
|
|
1673
1772
|
}
|
|
1674
1773
|
) })
|
|
@@ -1678,7 +1777,7 @@ var ExternalInput = ({
|
|
|
1678
1777
|
};
|
|
1679
1778
|
|
|
1680
1779
|
// components/AutoField/fields/ExternalField/index.tsx
|
|
1681
|
-
import { jsx as
|
|
1780
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1682
1781
|
var ExternalField = ({
|
|
1683
1782
|
field,
|
|
1684
1783
|
onChange,
|
|
@@ -1703,13 +1802,13 @@ var ExternalField = ({
|
|
|
1703
1802
|
if (field.type !== "external") {
|
|
1704
1803
|
return null;
|
|
1705
1804
|
}
|
|
1706
|
-
return /* @__PURE__ */
|
|
1805
|
+
return /* @__PURE__ */ jsx14(
|
|
1707
1806
|
Label2,
|
|
1708
1807
|
{
|
|
1709
1808
|
label: label || name,
|
|
1710
1809
|
icon: labelIcon,
|
|
1711
1810
|
el: "div",
|
|
1712
|
-
children: /* @__PURE__ */
|
|
1811
|
+
children: /* @__PURE__ */ jsx14(
|
|
1713
1812
|
ExternalInput,
|
|
1714
1813
|
{
|
|
1715
1814
|
name,
|
|
@@ -1736,8 +1835,8 @@ var ExternalField = ({
|
|
|
1736
1835
|
|
|
1737
1836
|
// components/AutoField/fields/RadioField/index.tsx
|
|
1738
1837
|
init_react_import();
|
|
1739
|
-
import { jsx as
|
|
1740
|
-
var
|
|
1838
|
+
import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1839
|
+
var getClassName10 = get_class_name_factory_default("Input", styles_module_default);
|
|
1741
1840
|
var RadioField = ({
|
|
1742
1841
|
field,
|
|
1743
1842
|
onChange,
|
|
@@ -1752,25 +1851,25 @@ var RadioField = ({
|
|
|
1752
1851
|
if (field.type !== "radio" || !field.options) {
|
|
1753
1852
|
return null;
|
|
1754
1853
|
}
|
|
1755
|
-
return /* @__PURE__ */
|
|
1854
|
+
return /* @__PURE__ */ jsx15(
|
|
1756
1855
|
Label2,
|
|
1757
1856
|
{
|
|
1758
1857
|
icon: labelIcon,
|
|
1759
1858
|
label: label || name,
|
|
1760
1859
|
readOnly,
|
|
1761
1860
|
el: "div",
|
|
1762
|
-
children: /* @__PURE__ */
|
|
1861
|
+
children: /* @__PURE__ */ jsx15("div", { className: getClassName10("radioGroupItems"), id, children: field.options.map((option) => {
|
|
1763
1862
|
var _a;
|
|
1764
|
-
return /* @__PURE__ */
|
|
1863
|
+
return /* @__PURE__ */ jsxs6(
|
|
1765
1864
|
"label",
|
|
1766
1865
|
{
|
|
1767
|
-
className:
|
|
1866
|
+
className: getClassName10("radio"),
|
|
1768
1867
|
children: [
|
|
1769
|
-
/* @__PURE__ */
|
|
1868
|
+
/* @__PURE__ */ jsx15(
|
|
1770
1869
|
"input",
|
|
1771
1870
|
{
|
|
1772
1871
|
type: "radio",
|
|
1773
|
-
className:
|
|
1872
|
+
className: getClassName10("radioInput"),
|
|
1774
1873
|
value: JSON.stringify({ value: option.value }),
|
|
1775
1874
|
name,
|
|
1776
1875
|
onChange: (e) => {
|
|
@@ -1780,7 +1879,7 @@ var RadioField = ({
|
|
|
1780
1879
|
checked: value === option.value
|
|
1781
1880
|
}
|
|
1782
1881
|
),
|
|
1783
|
-
/* @__PURE__ */
|
|
1882
|
+
/* @__PURE__ */ jsx15("div", { className: getClassName10("radioInner"), children: option.label || ((_a = option.value) == null ? void 0 : _a.toString()) })
|
|
1784
1883
|
]
|
|
1785
1884
|
},
|
|
1786
1885
|
option.label + option.value
|
|
@@ -1799,19 +1898,19 @@ import * as SelectPrimitive from "@radix-ui/react-select";
|
|
|
1799
1898
|
|
|
1800
1899
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ui/Select/styles.module.css#css-module
|
|
1801
1900
|
init_react_import();
|
|
1802
|
-
var
|
|
1901
|
+
var styles_module_default8 = { "EditorSelect-trigger": "_EditorSelect-trigger_13s1k_3", "EditorSelect-triggerIcon": "_EditorSelect-triggerIcon_13s1k_54", "EditorSelect-content": "_EditorSelect-content_13s1k_61", "EditorSelect-viewport": "_EditorSelect-viewport_13s1k_84", "EditorSelect-item": "_EditorSelect-item_13s1k_93", "EditorSelect-itemIndicator": "_EditorSelect-itemIndicator_13s1k_119", "EditorSelect-group": "_EditorSelect-group_13s1k_131", "EditorSelect-label": "_EditorSelect-label_13s1k_135", "EditorSelect-separator": "_EditorSelect-separator_13s1k_144", "EditorSelect-scrollButton": "_EditorSelect-scrollButton_13s1k_152" };
|
|
1803
1902
|
|
|
1804
1903
|
// components/ui/Select/index.tsx
|
|
1805
|
-
import { jsx as
|
|
1806
|
-
var
|
|
1904
|
+
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1905
|
+
var getClassName11 = get_class_name_factory_default("EditorSelect", styles_module_default8);
|
|
1807
1906
|
var joinClassNames = (...values) => values.filter(Boolean).join(" ");
|
|
1808
1907
|
function Select(_a) {
|
|
1809
1908
|
var props = __objRest(_a, []);
|
|
1810
|
-
return /* @__PURE__ */
|
|
1909
|
+
return /* @__PURE__ */ jsx16(SelectPrimitive.Root, __spreadValues({ "data-slot": "select" }, props));
|
|
1811
1910
|
}
|
|
1812
1911
|
function SelectValue(_a) {
|
|
1813
1912
|
var props = __objRest(_a, []);
|
|
1814
|
-
return /* @__PURE__ */
|
|
1913
|
+
return /* @__PURE__ */ jsx16(SelectPrimitive.Value, __spreadValues({ "data-slot": "select-value" }, props));
|
|
1815
1914
|
}
|
|
1816
1915
|
function SelectTrigger(_a) {
|
|
1817
1916
|
var _b = _a, {
|
|
@@ -1823,16 +1922,16 @@ function SelectTrigger(_a) {
|
|
|
1823
1922
|
"size",
|
|
1824
1923
|
"children"
|
|
1825
1924
|
]);
|
|
1826
|
-
return /* @__PURE__ */
|
|
1925
|
+
return /* @__PURE__ */ jsxs7(
|
|
1827
1926
|
SelectPrimitive.Trigger,
|
|
1828
1927
|
__spreadProps(__spreadValues({
|
|
1829
1928
|
"data-slot": "select-trigger",
|
|
1830
1929
|
"data-size": size,
|
|
1831
|
-
className: joinClassNames(
|
|
1930
|
+
className: joinClassNames(getClassName11("trigger"), className)
|
|
1832
1931
|
}, props), {
|
|
1833
1932
|
children: [
|
|
1834
1933
|
children,
|
|
1835
|
-
/* @__PURE__ */
|
|
1934
|
+
/* @__PURE__ */ jsx16(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx16(ChevronDown, { size: 16, className: getClassName11("triggerIcon") }) })
|
|
1836
1935
|
]
|
|
1837
1936
|
})
|
|
1838
1937
|
);
|
|
@@ -1849,27 +1948,27 @@ function SelectContent(_a) {
|
|
|
1849
1948
|
"position",
|
|
1850
1949
|
"align"
|
|
1851
1950
|
]);
|
|
1852
|
-
return /* @__PURE__ */
|
|
1951
|
+
return /* @__PURE__ */ jsx16(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs7(
|
|
1853
1952
|
SelectPrimitive.Content,
|
|
1854
1953
|
__spreadProps(__spreadValues({
|
|
1855
1954
|
"data-slot": "select-content",
|
|
1856
1955
|
"data-align-trigger": position === "item-aligned",
|
|
1857
1956
|
"data-position": position,
|
|
1858
|
-
className: joinClassNames(
|
|
1957
|
+
className: joinClassNames(getClassName11("content"), className),
|
|
1859
1958
|
position,
|
|
1860
1959
|
align
|
|
1861
1960
|
}, props), {
|
|
1862
1961
|
children: [
|
|
1863
|
-
/* @__PURE__ */
|
|
1864
|
-
/* @__PURE__ */
|
|
1962
|
+
/* @__PURE__ */ jsx16(SelectScrollUpButton, {}),
|
|
1963
|
+
/* @__PURE__ */ jsx16(
|
|
1865
1964
|
SelectPrimitive.Viewport,
|
|
1866
1965
|
{
|
|
1867
1966
|
"data-position": position,
|
|
1868
|
-
className:
|
|
1967
|
+
className: getClassName11("viewport"),
|
|
1869
1968
|
children
|
|
1870
1969
|
}
|
|
1871
1970
|
),
|
|
1872
|
-
/* @__PURE__ */
|
|
1971
|
+
/* @__PURE__ */ jsx16(SelectScrollDownButton, {})
|
|
1873
1972
|
]
|
|
1874
1973
|
})
|
|
1875
1974
|
) });
|
|
@@ -1882,15 +1981,15 @@ function SelectItem(_a) {
|
|
|
1882
1981
|
"className",
|
|
1883
1982
|
"children"
|
|
1884
1983
|
]);
|
|
1885
|
-
return /* @__PURE__ */
|
|
1984
|
+
return /* @__PURE__ */ jsxs7(
|
|
1886
1985
|
SelectPrimitive.Item,
|
|
1887
1986
|
__spreadProps(__spreadValues({
|
|
1888
1987
|
"data-slot": "select-item",
|
|
1889
|
-
className: joinClassNames(
|
|
1988
|
+
className: joinClassNames(getClassName11("item"), className)
|
|
1890
1989
|
}, props), {
|
|
1891
1990
|
children: [
|
|
1892
|
-
/* @__PURE__ */
|
|
1893
|
-
/* @__PURE__ */
|
|
1991
|
+
/* @__PURE__ */ jsx16("span", { className: getClassName11("itemIndicator"), children: /* @__PURE__ */ jsx16(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx16(Check, { size: 14 }) }) }),
|
|
1992
|
+
/* @__PURE__ */ jsx16(SelectPrimitive.ItemText, { children })
|
|
1894
1993
|
]
|
|
1895
1994
|
})
|
|
1896
1995
|
);
|
|
@@ -1901,13 +2000,13 @@ function SelectScrollUpButton(_a) {
|
|
|
1901
2000
|
} = _b, props = __objRest(_b, [
|
|
1902
2001
|
"className"
|
|
1903
2002
|
]);
|
|
1904
|
-
return /* @__PURE__ */
|
|
2003
|
+
return /* @__PURE__ */ jsx16(
|
|
1905
2004
|
SelectPrimitive.ScrollUpButton,
|
|
1906
2005
|
__spreadProps(__spreadValues({
|
|
1907
2006
|
"data-slot": "select-scroll-up-button",
|
|
1908
|
-
className: joinClassNames(
|
|
2007
|
+
className: joinClassNames(getClassName11("scrollButton"), className)
|
|
1909
2008
|
}, props), {
|
|
1910
|
-
children: /* @__PURE__ */
|
|
2009
|
+
children: /* @__PURE__ */ jsx16(ChevronUp, { size: 14 })
|
|
1911
2010
|
})
|
|
1912
2011
|
);
|
|
1913
2012
|
}
|
|
@@ -1917,19 +2016,19 @@ function SelectScrollDownButton(_a) {
|
|
|
1917
2016
|
} = _b, props = __objRest(_b, [
|
|
1918
2017
|
"className"
|
|
1919
2018
|
]);
|
|
1920
|
-
return /* @__PURE__ */
|
|
2019
|
+
return /* @__PURE__ */ jsx16(
|
|
1921
2020
|
SelectPrimitive.ScrollDownButton,
|
|
1922
2021
|
__spreadProps(__spreadValues({
|
|
1923
2022
|
"data-slot": "select-scroll-down-button",
|
|
1924
|
-
className: joinClassNames(
|
|
2023
|
+
className: joinClassNames(getClassName11("scrollButton"), className)
|
|
1925
2024
|
}, props), {
|
|
1926
|
-
children: /* @__PURE__ */
|
|
2025
|
+
children: /* @__PURE__ */ jsx16(ChevronDown, { size: 14 })
|
|
1927
2026
|
})
|
|
1928
2027
|
);
|
|
1929
2028
|
}
|
|
1930
2029
|
|
|
1931
2030
|
// components/AutoField/fields/SelectField/index.tsx
|
|
1932
|
-
import { jsx as
|
|
2031
|
+
import { jsx as jsx17, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1933
2032
|
var SelectField = ({
|
|
1934
2033
|
field,
|
|
1935
2034
|
onChange,
|
|
@@ -1945,7 +2044,7 @@ var SelectField = ({
|
|
|
1945
2044
|
return null;
|
|
1946
2045
|
}
|
|
1947
2046
|
const serializedValue = JSON.stringify({ value });
|
|
1948
|
-
return /* @__PURE__ */
|
|
2047
|
+
return /* @__PURE__ */ jsx17(Label2, { label: label || name, icon: labelIcon, readOnly, children: /* @__PURE__ */ jsxs8(
|
|
1949
2048
|
Select,
|
|
1950
2049
|
{
|
|
1951
2050
|
value: serializedValue,
|
|
@@ -1954,8 +2053,8 @@ var SelectField = ({
|
|
|
1954
2053
|
},
|
|
1955
2054
|
disabled: readOnly,
|
|
1956
2055
|
children: [
|
|
1957
|
-
/* @__PURE__ */
|
|
1958
|
-
/* @__PURE__ */
|
|
2056
|
+
/* @__PURE__ */ jsx17(SelectTrigger, { id, style: { width: "100%" }, children: /* @__PURE__ */ jsx17(SelectValue, { placeholder: label || name }) }),
|
|
2057
|
+
/* @__PURE__ */ jsx17(SelectContent, { children: field.options.map((option) => /* @__PURE__ */ jsx17(
|
|
1959
2058
|
SelectItem,
|
|
1960
2059
|
{
|
|
1961
2060
|
value: JSON.stringify({ value: option.value }),
|
|
@@ -1970,8 +2069,8 @@ var SelectField = ({
|
|
|
1970
2069
|
|
|
1971
2070
|
// components/AutoField/fields/TextareaField/index.tsx
|
|
1972
2071
|
init_react_import();
|
|
1973
|
-
import { jsx as
|
|
1974
|
-
var
|
|
2072
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
2073
|
+
var getClassName12 = get_class_name_factory_default("Input", styles_module_default);
|
|
1975
2074
|
var TextareaField = ({
|
|
1976
2075
|
field,
|
|
1977
2076
|
onChange,
|
|
@@ -1983,17 +2082,17 @@ var TextareaField = ({
|
|
|
1983
2082
|
Label: Label2
|
|
1984
2083
|
}) => {
|
|
1985
2084
|
const [localValue, onChangeLocal] = useLocalValue(name, onChange);
|
|
1986
|
-
return /* @__PURE__ */
|
|
2085
|
+
return /* @__PURE__ */ jsx18(
|
|
1987
2086
|
Label2,
|
|
1988
2087
|
{
|
|
1989
2088
|
label: label || name,
|
|
1990
2089
|
icon: labelIcon,
|
|
1991
2090
|
readOnly,
|
|
1992
|
-
children: /* @__PURE__ */
|
|
2091
|
+
children: /* @__PURE__ */ jsx18(
|
|
1993
2092
|
"textarea",
|
|
1994
2093
|
{
|
|
1995
2094
|
id,
|
|
1996
|
-
className:
|
|
2095
|
+
className: getClassName12("input"),
|
|
1997
2096
|
autoComplete: "off",
|
|
1998
2097
|
name,
|
|
1999
2098
|
value: typeof localValue === "undefined" ? "" : localValue,
|
|
@@ -2015,14 +2114,14 @@ import { lazy, Suspense } from "react";
|
|
|
2015
2114
|
// components/RichTextEditor/components/EditorFallback.tsx
|
|
2016
2115
|
init_react_import();
|
|
2017
2116
|
import { memo as memo3 } from "react";
|
|
2018
|
-
import { jsx as
|
|
2117
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
2019
2118
|
var EditorFallback = memo3((props) => {
|
|
2020
2119
|
var _a;
|
|
2021
|
-
return /* @__PURE__ */
|
|
2120
|
+
return /* @__PURE__ */ jsx19(
|
|
2022
2121
|
EditorInner,
|
|
2023
2122
|
__spreadProps(__spreadValues({}, props), {
|
|
2024
2123
|
editor: null,
|
|
2025
|
-
menu: /* @__PURE__ */
|
|
2124
|
+
menu: /* @__PURE__ */ jsx19(
|
|
2026
2125
|
LoadedRichTextMenuInner,
|
|
2027
2126
|
{
|
|
2028
2127
|
field: props.field,
|
|
@@ -2031,7 +2130,7 @@ var EditorFallback = memo3((props) => {
|
|
|
2031
2130
|
readOnly: (_a = props.readOnly) != null ? _a : false
|
|
2032
2131
|
}
|
|
2033
2132
|
),
|
|
2034
|
-
children: /* @__PURE__ */
|
|
2133
|
+
children: /* @__PURE__ */ jsx19(
|
|
2035
2134
|
"div",
|
|
2036
2135
|
{
|
|
2037
2136
|
className: "rich-text",
|
|
@@ -2045,9 +2144,9 @@ var EditorFallback = memo3((props) => {
|
|
|
2045
2144
|
EditorFallback.displayName = "EditorFallback";
|
|
2046
2145
|
|
|
2047
2146
|
// components/AutoField/fields/RichtextField/index.tsx
|
|
2048
|
-
import { Fragment as Fragment3, jsx as
|
|
2147
|
+
import { Fragment as Fragment3, jsx as jsx20 } from "react/jsx-runtime";
|
|
2049
2148
|
var Editor = lazy(
|
|
2050
|
-
() => import("./Editor-
|
|
2149
|
+
() => import("./Editor-KXEVJBNG.mjs").then((m) => ({
|
|
2051
2150
|
default: m.Editor
|
|
2052
2151
|
}))
|
|
2053
2152
|
);
|
|
@@ -2070,14 +2169,14 @@ var RichtextField = ({
|
|
|
2070
2169
|
id,
|
|
2071
2170
|
name
|
|
2072
2171
|
};
|
|
2073
|
-
return /* @__PURE__ */
|
|
2172
|
+
return /* @__PURE__ */ jsx20(Fragment3, { children: /* @__PURE__ */ jsx20(
|
|
2074
2173
|
Label2,
|
|
2075
2174
|
{
|
|
2076
2175
|
label: label || name,
|
|
2077
2176
|
icon: labelIcon,
|
|
2078
2177
|
readOnly,
|
|
2079
2178
|
el: "div",
|
|
2080
|
-
children: /* @__PURE__ */
|
|
2179
|
+
children: /* @__PURE__ */ jsx20(Suspense, { fallback: /* @__PURE__ */ jsx20(EditorFallback, __spreadValues({}, editorProps)), children: /* @__PURE__ */ jsx20(Editor, __spreadValues({}, editorProps)) })
|
|
2081
2180
|
}
|
|
2082
2181
|
) });
|
|
2083
2182
|
};
|
|
@@ -2087,11 +2186,11 @@ init_react_import();
|
|
|
2087
2186
|
|
|
2088
2187
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/AutoField/fields/ObjectField/styles.module.css#css-module
|
|
2089
2188
|
init_react_import();
|
|
2090
|
-
var
|
|
2189
|
+
var styles_module_default9 = { "ObjectField": "_ObjectField_1byjv_5", "ObjectField-fieldset": "_ObjectField-fieldset_1byjv_13" };
|
|
2091
2190
|
|
|
2092
2191
|
// components/AutoField/fields/ObjectField/index.tsx
|
|
2093
|
-
import { jsx as
|
|
2094
|
-
var
|
|
2192
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2193
|
+
var getClassName13 = get_class_name_factory_default("ObjectField", styles_module_default9);
|
|
2095
2194
|
var ObjectField = ({
|
|
2096
2195
|
field,
|
|
2097
2196
|
onChange,
|
|
@@ -2114,17 +2213,17 @@ var ObjectField = ({
|
|
|
2114
2213
|
if (field.type !== "object" || !field.objectFields) {
|
|
2115
2214
|
return null;
|
|
2116
2215
|
}
|
|
2117
|
-
return /* @__PURE__ */
|
|
2216
|
+
return /* @__PURE__ */ jsx21(
|
|
2118
2217
|
Label2,
|
|
2119
2218
|
{
|
|
2120
2219
|
label: label || name,
|
|
2121
2220
|
icon: labelIcon,
|
|
2122
2221
|
el: "div",
|
|
2123
2222
|
readOnly,
|
|
2124
|
-
children: /* @__PURE__ */
|
|
2223
|
+
children: /* @__PURE__ */ jsx21("div", { className: getClassName13(), children: /* @__PURE__ */ jsx21("fieldset", { className: getClassName13("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
|
|
2125
2224
|
const subField = field.objectFields[subName];
|
|
2126
2225
|
const subPath = `${localName}.${subName}`;
|
|
2127
|
-
return /* @__PURE__ */
|
|
2226
|
+
return /* @__PURE__ */ jsx21(
|
|
2128
2227
|
SubField,
|
|
2129
2228
|
{
|
|
2130
2229
|
id: `${id}_${subName}`,
|
|
@@ -2161,8 +2260,8 @@ var useSafeId = () => {
|
|
|
2161
2260
|
|
|
2162
2261
|
// components/AutoField/index.tsx
|
|
2163
2262
|
import { useShallow as useShallow3 } from "zustand/react/shallow";
|
|
2164
|
-
import { jsx as
|
|
2165
|
-
var
|
|
2263
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2264
|
+
var getClassName14 = get_class_name_factory_default("Input", styles_module_default);
|
|
2166
2265
|
var getClassNameWrapper = get_class_name_factory_default("InputWrapper", styles_module_default);
|
|
2167
2266
|
var defaultFields = {
|
|
2168
2267
|
array: ArrayField,
|
|
@@ -2173,6 +2272,7 @@ var defaultFields = {
|
|
|
2173
2272
|
radio: RadioField,
|
|
2174
2273
|
text: DefaultField,
|
|
2175
2274
|
number: DefaultField,
|
|
2275
|
+
color: ColorField,
|
|
2176
2276
|
richtext: RichtextField
|
|
2177
2277
|
};
|
|
2178
2278
|
function AutoFieldInternal(props) {
|
|
@@ -2192,7 +2292,7 @@ function AutoFieldInternal(props) {
|
|
|
2192
2292
|
const resolvedId = id || defaultId;
|
|
2193
2293
|
const render = useMemo5(
|
|
2194
2294
|
() => {
|
|
2195
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2295
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2196
2296
|
return __spreadProps(__spreadValues({}, overrides.fieldTypes), {
|
|
2197
2297
|
custom: (_a2 = overrides.fieldTypes) == null ? void 0 : _a2.custom,
|
|
2198
2298
|
array: ((_b = overrides.fieldTypes) == null ? void 0 : _b.array) || defaultFields.array,
|
|
@@ -2203,7 +2303,8 @@ function AutoFieldInternal(props) {
|
|
|
2203
2303
|
radio: ((_g = overrides.fieldTypes) == null ? void 0 : _g.radio) || defaultFields.radio,
|
|
2204
2304
|
text: ((_h = overrides.fieldTypes) == null ? void 0 : _h.text) || defaultFields.text,
|
|
2205
2305
|
number: ((_i = overrides.fieldTypes) == null ? void 0 : _i.number) || defaultFields.number,
|
|
2206
|
-
|
|
2306
|
+
color: ((_j = overrides.fieldTypes) == null ? void 0 : _j.color) || defaultFields.color,
|
|
2307
|
+
richtext: ((_k = overrides.fieldTypes) == null ? void 0 : _k.richtext) || defaultFields.richtext
|
|
2207
2308
|
});
|
|
2208
2309
|
},
|
|
2209
2310
|
[overrides]
|
|
@@ -2225,7 +2326,7 @@ function AutoFieldInternal(props) {
|
|
|
2225
2326
|
}),
|
|
2226
2327
|
[props, field, label, labelIcon, Label2, resolvedId, fieldValue]
|
|
2227
2328
|
);
|
|
2228
|
-
const onFocus =
|
|
2329
|
+
const onFocus = useCallback5(
|
|
2229
2330
|
(e) => {
|
|
2230
2331
|
if (mergedProps.name && (e.target.nodeName === "INPUT" || e.target.nodeName === "TEXTAREA")) {
|
|
2231
2332
|
e.stopPropagation();
|
|
@@ -2239,7 +2340,7 @@ function AutoFieldInternal(props) {
|
|
|
2239
2340
|
},
|
|
2240
2341
|
[mergedProps.name]
|
|
2241
2342
|
);
|
|
2242
|
-
const onBlur =
|
|
2343
|
+
const onBlur = useCallback5((e) => {
|
|
2243
2344
|
if ("name" in e.target) {
|
|
2244
2345
|
dispatch({
|
|
2245
2346
|
type: "setUi",
|
|
@@ -2276,14 +2377,14 @@ function AutoFieldInternal(props) {
|
|
|
2276
2377
|
if (!FieldComponent) {
|
|
2277
2378
|
throw new Error(`Field type for ${field.type} did not exist.`);
|
|
2278
2379
|
}
|
|
2279
|
-
return /* @__PURE__ */
|
|
2380
|
+
return /* @__PURE__ */ jsx22(
|
|
2280
2381
|
NestedFieldContext.Provider,
|
|
2281
2382
|
{
|
|
2282
2383
|
value: {
|
|
2283
2384
|
readOnlyFields: nestedFieldContext.readOnlyFields || readOnly || {},
|
|
2284
2385
|
localName: (_a = nestedFieldContext.localName) != null ? _a : mergedProps.name
|
|
2285
2386
|
},
|
|
2286
|
-
children: /* @__PURE__ */
|
|
2387
|
+
children: /* @__PURE__ */ jsx22(
|
|
2287
2388
|
"div",
|
|
2288
2389
|
{
|
|
2289
2390
|
className: getClassNameWrapper(),
|
|
@@ -2292,28 +2393,28 @@ function AutoFieldInternal(props) {
|
|
|
2292
2393
|
onClick: (e) => {
|
|
2293
2394
|
e.stopPropagation();
|
|
2294
2395
|
},
|
|
2295
|
-
children: /* @__PURE__ */
|
|
2396
|
+
children: /* @__PURE__ */ jsx22(FieldComponent, __spreadProps(__spreadValues({}, mergedProps), { children: /* @__PURE__ */ jsx22(Children, __spreadValues({}, mergedProps)) }))
|
|
2296
2397
|
}
|
|
2297
2398
|
)
|
|
2298
2399
|
}
|
|
2299
2400
|
);
|
|
2300
2401
|
}
|
|
2301
2402
|
function AutoFieldPrivate(props) {
|
|
2302
|
-
return /* @__PURE__ */
|
|
2403
|
+
return /* @__PURE__ */ jsx22(AutoFieldInternal, __spreadValues({}, props));
|
|
2303
2404
|
}
|
|
2304
2405
|
function AutoFieldPublicInternal(_a) {
|
|
2305
2406
|
var _b = _a, { value } = _b, props = __objRest(_b, ["value"]);
|
|
2306
2407
|
const DefaultLabel = useMemo5(() => {
|
|
2307
|
-
const DefaultLabel2 = (labelProps) => /* @__PURE__ */
|
|
2408
|
+
const DefaultLabel2 = (labelProps) => /* @__PURE__ */ jsx22(
|
|
2308
2409
|
"div",
|
|
2309
2410
|
__spreadProps(__spreadValues({}, labelProps), {
|
|
2310
|
-
className:
|
|
2411
|
+
className: getClassName14({ readOnly: props.readOnly })
|
|
2311
2412
|
})
|
|
2312
2413
|
);
|
|
2313
2414
|
return DefaultLabel2;
|
|
2314
2415
|
}, [props.readOnly]);
|
|
2315
2416
|
const fieldStore = useFieldStoreApi();
|
|
2316
|
-
const onChange =
|
|
2417
|
+
const onChange = useCallback5(
|
|
2317
2418
|
(value2) => {
|
|
2318
2419
|
if (!props.id) return;
|
|
2319
2420
|
fieldStore.setState({ [props.id]: value2 });
|
|
@@ -2325,7 +2426,7 @@ function AutoFieldPublicInternal(_a) {
|
|
|
2325
2426
|
if (!props.id) return;
|
|
2326
2427
|
fieldStore.setState({ [props.id]: value });
|
|
2327
2428
|
}, [props.id, value, fieldStore]);
|
|
2328
|
-
return /* @__PURE__ */
|
|
2429
|
+
return /* @__PURE__ */ jsx22(
|
|
2329
2430
|
AutoFieldInternal,
|
|
2330
2431
|
__spreadProps(__spreadValues({}, props), {
|
|
2331
2432
|
onChange,
|
|
@@ -2338,7 +2439,7 @@ function AutoField(props) {
|
|
|
2338
2439
|
if (props.field.type === "slot") {
|
|
2339
2440
|
return null;
|
|
2340
2441
|
}
|
|
2341
|
-
return /* @__PURE__ */
|
|
2442
|
+
return /* @__PURE__ */ jsx22(fieldContextStore.Provider, { value: { [id]: props.value }, children: /* @__PURE__ */ jsx22(AutoFieldPublicInternal, __spreadProps(__spreadValues({}, props), { id })) });
|
|
2342
2443
|
}
|
|
2343
2444
|
|
|
2344
2445
|
// components/Render/index.tsx
|
|
@@ -2349,29 +2450,29 @@ init_react_import();
|
|
|
2349
2450
|
import {
|
|
2350
2451
|
forwardRef,
|
|
2351
2452
|
memo as memo7,
|
|
2352
|
-
useCallback as
|
|
2453
|
+
useCallback as useCallback14,
|
|
2353
2454
|
useContext as useContext9,
|
|
2354
2455
|
useEffect as useEffect16,
|
|
2355
2456
|
useMemo as useMemo12,
|
|
2356
|
-
useRef as
|
|
2457
|
+
useRef as useRef10
|
|
2357
2458
|
} from "react";
|
|
2358
2459
|
|
|
2359
2460
|
// components/DraggableComponent/index.tsx
|
|
2360
2461
|
init_react_import();
|
|
2361
2462
|
import {
|
|
2362
|
-
useCallback as
|
|
2463
|
+
useCallback as useCallback8,
|
|
2363
2464
|
useContext as useContext5,
|
|
2364
2465
|
useEffect as useEffect8,
|
|
2365
2466
|
useLayoutEffect,
|
|
2366
2467
|
useMemo as useMemo7,
|
|
2367
|
-
useRef as
|
|
2468
|
+
useRef as useRef3,
|
|
2368
2469
|
useState as useState9,
|
|
2369
2470
|
useTransition
|
|
2370
2471
|
} from "react";
|
|
2371
2472
|
|
|
2372
2473
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/DraggableComponent/styles.module.css#css-module
|
|
2373
2474
|
init_react_import();
|
|
2374
|
-
var
|
|
2475
|
+
var styles_module_default10 = { "DraggableComponent": "_DraggableComponent_ie0on_1", "DraggableComponent-overlayWrapper": "_DraggableComponent-overlayWrapper_ie0on_12", "DraggableComponent-overlay": "_DraggableComponent-overlay_ie0on_12", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_ie0on_36", "DraggableComponent--hover": "_DraggableComponent--hover_ie0on_53", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_ie0on_60", "DraggableComponent--isGlobal": "_DraggableComponent--isGlobal_ie0on_69", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_ie0on_105", "DraggableComponent-actions": "_DraggableComponent-actions_ie0on_105" };
|
|
2375
2476
|
|
|
2376
2477
|
// components/DraggableComponent/index.tsx
|
|
2377
2478
|
import { createPortal as createPortal2 } from "react-dom";
|
|
@@ -2399,11 +2500,11 @@ function getDeepScrollPosition(element) {
|
|
|
2399
2500
|
init_react_import();
|
|
2400
2501
|
import {
|
|
2401
2502
|
createContext as createContext3,
|
|
2402
|
-
useCallback as
|
|
2503
|
+
useCallback as useCallback6,
|
|
2403
2504
|
useMemo as useMemo6
|
|
2404
2505
|
} from "react";
|
|
2405
2506
|
import { createStore as createStore3 } from "zustand";
|
|
2406
|
-
import { Fragment as Fragment4, jsx as
|
|
2507
|
+
import { Fragment as Fragment4, jsx as jsx23 } from "react/jsx-runtime";
|
|
2407
2508
|
var dropZoneContext = createContext3(null);
|
|
2408
2509
|
var ZoneStoreContext = createContext3(
|
|
2409
2510
|
createStore3(() => ({
|
|
@@ -2426,14 +2527,14 @@ var ZoneStoreProvider = ({
|
|
|
2426
2527
|
children,
|
|
2427
2528
|
store
|
|
2428
2529
|
}) => {
|
|
2429
|
-
return /* @__PURE__ */
|
|
2530
|
+
return /* @__PURE__ */ jsx23(ZoneStoreContext.Provider, { value: store, children });
|
|
2430
2531
|
};
|
|
2431
2532
|
var DropZoneProvider = ({
|
|
2432
2533
|
children,
|
|
2433
2534
|
value
|
|
2434
2535
|
}) => {
|
|
2435
2536
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
2436
|
-
const registerZone =
|
|
2537
|
+
const registerZone = useCallback6(
|
|
2437
2538
|
(zoneCompound) => {
|
|
2438
2539
|
dispatch({
|
|
2439
2540
|
type: "registerZone",
|
|
@@ -2448,7 +2549,7 @@ var DropZoneProvider = ({
|
|
|
2448
2549
|
}, value),
|
|
2449
2550
|
[value]
|
|
2450
2551
|
);
|
|
2451
|
-
return /* @__PURE__ */
|
|
2552
|
+
return /* @__PURE__ */ jsx23(Fragment4, { children: memoValue && /* @__PURE__ */ jsx23(dropZoneContext.Provider, { value: memoValue, children }) });
|
|
2452
2553
|
};
|
|
2453
2554
|
|
|
2454
2555
|
// components/DraggableComponent/index.tsx
|
|
@@ -2458,10 +2559,10 @@ import { Feedback } from "@dnd-kit/dom";
|
|
|
2458
2559
|
|
|
2459
2560
|
// lib/dnd/use-on-drag-finished.ts
|
|
2460
2561
|
init_react_import();
|
|
2461
|
-
import { useCallback as
|
|
2562
|
+
import { useCallback as useCallback7 } from "react";
|
|
2462
2563
|
var useOnDragFinished = (cb, deps = []) => {
|
|
2463
2564
|
const appStore = useAppStoreApi();
|
|
2464
|
-
return
|
|
2565
|
+
return useCallback7(() => {
|
|
2465
2566
|
let dispose = () => {
|
|
2466
2567
|
};
|
|
2467
2568
|
const processDragging = (isDragging2) => {
|
|
@@ -2504,8 +2605,8 @@ function assignRefs(refs, node) {
|
|
|
2504
2605
|
}
|
|
2505
2606
|
|
|
2506
2607
|
// components/DraggableComponent/index.tsx
|
|
2507
|
-
import { Fragment as Fragment5, jsx as
|
|
2508
|
-
var
|
|
2608
|
+
import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2609
|
+
var getClassName15 = get_class_name_factory_default("DraggableComponent", styles_module_default10);
|
|
2509
2610
|
var DEBUG2 = false;
|
|
2510
2611
|
var MEASURE_EVERY_MS = 100;
|
|
2511
2612
|
var space = 8;
|
|
@@ -2516,16 +2617,16 @@ var DefaultActionBar = ({
|
|
|
2516
2617
|
label,
|
|
2517
2618
|
children,
|
|
2518
2619
|
parentAction
|
|
2519
|
-
}) => /* @__PURE__ */
|
|
2520
|
-
/* @__PURE__ */
|
|
2620
|
+
}) => /* @__PURE__ */ jsxs9(ActionBar, { children: [
|
|
2621
|
+
/* @__PURE__ */ jsxs9(ActionBar.Group, { children: [
|
|
2521
2622
|
parentAction,
|
|
2522
|
-
label && /* @__PURE__ */
|
|
2623
|
+
label && /* @__PURE__ */ jsx24(ActionBar.Label, { label })
|
|
2523
2624
|
] }),
|
|
2524
|
-
/* @__PURE__ */
|
|
2625
|
+
/* @__PURE__ */ jsx24(ActionBar.Group, { children })
|
|
2525
2626
|
] });
|
|
2526
2627
|
var DefaultOverlay = ({
|
|
2527
2628
|
children
|
|
2528
|
-
}) => /* @__PURE__ */
|
|
2629
|
+
}) => /* @__PURE__ */ jsx24(Fragment5, { children });
|
|
2529
2630
|
var DraggableComponent = ({
|
|
2530
2631
|
children,
|
|
2531
2632
|
depth,
|
|
@@ -2558,10 +2659,10 @@ var DraggableComponent = ({
|
|
|
2558
2659
|
return ((_a = s.config.components[componentType]) == null ? void 0 : _a.global) === true;
|
|
2559
2660
|
}
|
|
2560
2661
|
);
|
|
2561
|
-
const lastMeasureRef =
|
|
2662
|
+
const lastMeasureRef = useRef3(0);
|
|
2562
2663
|
const ctx = useContext5(dropZoneContext);
|
|
2563
2664
|
const [localZones, setLocalZones] = useState9({});
|
|
2564
|
-
const registerLocalZone =
|
|
2665
|
+
const registerLocalZone = useCallback8(
|
|
2565
2666
|
(zoneCompound2, active) => {
|
|
2566
2667
|
var _a;
|
|
2567
2668
|
(_a = ctx == null ? void 0 : ctx.registerLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2, active);
|
|
@@ -2571,7 +2672,7 @@ var DraggableComponent = ({
|
|
|
2571
2672
|
},
|
|
2572
2673
|
[setLocalZones]
|
|
2573
2674
|
);
|
|
2574
|
-
const unregisterLocalZone =
|
|
2675
|
+
const unregisterLocalZone = useCallback8(
|
|
2575
2676
|
(zoneCompound2) => {
|
|
2576
2677
|
var _a;
|
|
2577
2678
|
(_a = ctx == null ? void 0 : ctx.unregisterLocalZone) == null ? void 0 : _a.call(ctx, zoneCompound2);
|
|
@@ -2652,8 +2753,8 @@ var DraggableComponent = ({
|
|
|
2652
2753
|
return cleanup;
|
|
2653
2754
|
}, [permissions.drag, zoneCompound]);
|
|
2654
2755
|
const [, setRerender] = useState9(0);
|
|
2655
|
-
const ref =
|
|
2656
|
-
const refSetter =
|
|
2756
|
+
const ref = useRef3(null);
|
|
2757
|
+
const refSetter = useCallback8(
|
|
2657
2758
|
(el) => {
|
|
2658
2759
|
sortableRef(el);
|
|
2659
2760
|
if (ref.current !== el) {
|
|
@@ -2673,7 +2774,7 @@ var DraggableComponent = ({
|
|
|
2673
2774
|
iframe.enabled ? (_a = ref.current) == null ? void 0 : _a.ownerDocument.body : (_c = (_b = ref.current) == null ? void 0 : _b.closest("[data-editor-preview]")) != null ? _c : document.body
|
|
2674
2775
|
);
|
|
2675
2776
|
}, [iframe.enabled]);
|
|
2676
|
-
const getStyle =
|
|
2777
|
+
const getStyle = useCallback8(() => {
|
|
2677
2778
|
var _a, _b;
|
|
2678
2779
|
if (!ref.current) return;
|
|
2679
2780
|
const el = ref.current;
|
|
@@ -2706,15 +2807,15 @@ var DraggableComponent = ({
|
|
|
2706
2807
|
return style2;
|
|
2707
2808
|
}, [iframe.enabled]);
|
|
2708
2809
|
const [style, setStyle] = useState9();
|
|
2709
|
-
const lastRectRef =
|
|
2710
|
-
const syncRafRef =
|
|
2711
|
-
const sync =
|
|
2810
|
+
const lastRectRef = useRef3(null);
|
|
2811
|
+
const syncRafRef = useRef3(null);
|
|
2812
|
+
const sync = useCallback8(() => {
|
|
2712
2813
|
setStyle(getStyle());
|
|
2713
2814
|
if (itemRef) {
|
|
2714
2815
|
assignRefs([itemRef], ref.current);
|
|
2715
2816
|
}
|
|
2716
2817
|
}, [getStyle, itemRef]);
|
|
2717
|
-
const scheduleSync =
|
|
2818
|
+
const scheduleSync = useCallback8(() => {
|
|
2718
2819
|
if (syncRafRef.current != null) return;
|
|
2719
2820
|
syncRafRef.current = requestAnimationFrame(() => {
|
|
2720
2821
|
syncRafRef.current = null;
|
|
@@ -2742,13 +2843,13 @@ var DraggableComponent = ({
|
|
|
2742
2843
|
}, [scheduleSync, itemRef]);
|
|
2743
2844
|
const registerNode = useAppStore((s) => s.nodes.registerNode);
|
|
2744
2845
|
const unregisterNode = useAppStore((s) => s.nodes.unregisterNode);
|
|
2745
|
-
const hideOverlay =
|
|
2846
|
+
const hideOverlay = useCallback8(() => {
|
|
2746
2847
|
setIsVisible(false);
|
|
2747
2848
|
}, []);
|
|
2748
|
-
const showOverlay =
|
|
2849
|
+
const showOverlay = useCallback8(() => {
|
|
2749
2850
|
setIsVisible(true);
|
|
2750
2851
|
}, []);
|
|
2751
|
-
const nodeHandleRef =
|
|
2852
|
+
const nodeHandleRef = useRef3({
|
|
2752
2853
|
sync: () => null,
|
|
2753
2854
|
hideOverlay: () => null,
|
|
2754
2855
|
showOverlay: () => null
|
|
@@ -2772,7 +2873,7 @@ var DraggableComponent = ({
|
|
|
2772
2873
|
() => overrides.componentOverlay || DefaultOverlay,
|
|
2773
2874
|
[overrides.componentOverlay]
|
|
2774
2875
|
);
|
|
2775
|
-
const onClick =
|
|
2876
|
+
const onClick = useCallback8(
|
|
2776
2877
|
(e) => {
|
|
2777
2878
|
const userIsDragging = !!zoneStore.getState().draggedItem;
|
|
2778
2879
|
if (userIsDragging) {
|
|
@@ -2801,7 +2902,7 @@ var DraggableComponent = ({
|
|
|
2801
2902
|
[index, zoneCompound, id, isSelected, fullScreenCanvas]
|
|
2802
2903
|
);
|
|
2803
2904
|
const appStore = useAppStoreApi();
|
|
2804
|
-
const onSelectParent =
|
|
2905
|
+
const onSelectParent = useCallback8(() => {
|
|
2805
2906
|
const { nodes, zones } = appStore.getState().state.indexes;
|
|
2806
2907
|
const node = nodes[id];
|
|
2807
2908
|
const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node == null ? void 0 : node.parentId] : null;
|
|
@@ -2822,14 +2923,14 @@ var DraggableComponent = ({
|
|
|
2822
2923
|
}
|
|
2823
2924
|
});
|
|
2824
2925
|
}, [ctx, path]);
|
|
2825
|
-
const onDuplicate =
|
|
2926
|
+
const onDuplicate = useCallback8(() => {
|
|
2826
2927
|
dispatch({
|
|
2827
2928
|
type: "duplicate",
|
|
2828
2929
|
sourceIndex: index,
|
|
2829
2930
|
sourceZone: zoneCompound
|
|
2830
2931
|
});
|
|
2831
2932
|
}, [index, zoneCompound]);
|
|
2832
|
-
const onDelete =
|
|
2933
|
+
const onDelete = useCallback8(() => {
|
|
2833
2934
|
dispatch({
|
|
2834
2935
|
type: "remove",
|
|
2835
2936
|
index,
|
|
@@ -2956,7 +3057,7 @@ var DraggableComponent = ({
|
|
|
2956
3057
|
cancelAnimationFrame(frame);
|
|
2957
3058
|
};
|
|
2958
3059
|
}, [dragFinished, isSelected, thisIsDragging, scheduleSync]);
|
|
2959
|
-
const syncActionsPosition =
|
|
3060
|
+
const syncActionsPosition = useCallback8(
|
|
2960
3061
|
(el) => {
|
|
2961
3062
|
if (el) {
|
|
2962
3063
|
const view = el.ownerDocument.defaultView;
|
|
@@ -2996,7 +3097,7 @@ var DraggableComponent = ({
|
|
|
2996
3097
|
setDragAxis(autoDragAxis);
|
|
2997
3098
|
}, [ref, userDragAxis, autoDragAxis]);
|
|
2998
3099
|
const parentAction = useMemo7(
|
|
2999
|
-
() => (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */
|
|
3100
|
+
() => (ctx == null ? void 0 : ctx.areaId) && (ctx == null ? void 0 : ctx.areaId) !== "root" && /* @__PURE__ */ jsx24(ActionBar.Action, { onClick: onSelectParent, label: "Select parent", children: /* @__PURE__ */ jsx24(CornerLeftUp, { size: 16 }) }),
|
|
3000
3101
|
[ctx == null ? void 0 : ctx.areaId]
|
|
3001
3102
|
);
|
|
3002
3103
|
const nextContextValue = useMemo7(
|
|
@@ -3025,12 +3126,12 @@ var DraggableComponent = ({
|
|
|
3025
3126
|
}
|
|
3026
3127
|
);
|
|
3027
3128
|
const hasNormalActions = permissions.duplicate || permissions.delete;
|
|
3028
|
-
return /* @__PURE__ */
|
|
3129
|
+
return /* @__PURE__ */ jsxs9(DropZoneProvider, { value: nextContextValue, children: [
|
|
3029
3130
|
dragFinished && isVisible && createPortal2(
|
|
3030
|
-
/* @__PURE__ */
|
|
3131
|
+
/* @__PURE__ */ jsxs9(
|
|
3031
3132
|
"div",
|
|
3032
3133
|
{
|
|
3033
|
-
className:
|
|
3134
|
+
className: getClassName15({
|
|
3034
3135
|
isSelected,
|
|
3035
3136
|
isDragging: thisIsDragging,
|
|
3036
3137
|
hover: hover || indicativeHover,
|
|
@@ -3040,18 +3141,18 @@ var DraggableComponent = ({
|
|
|
3040
3141
|
"data-editor-overlay": true,
|
|
3041
3142
|
children: [
|
|
3042
3143
|
debug,
|
|
3043
|
-
isLoading && /* @__PURE__ */
|
|
3044
|
-
/* @__PURE__ */
|
|
3144
|
+
isLoading && /* @__PURE__ */ jsx24("div", { className: getClassName15("loadingOverlay"), children: /* @__PURE__ */ jsx24(Loader, {}) }),
|
|
3145
|
+
/* @__PURE__ */ jsx24(
|
|
3045
3146
|
"div",
|
|
3046
3147
|
{
|
|
3047
|
-
className:
|
|
3148
|
+
className: getClassName15("actionsOverlay"),
|
|
3048
3149
|
style: {
|
|
3049
3150
|
top: actionsOverlayTop / zoom
|
|
3050
3151
|
},
|
|
3051
|
-
children: /* @__PURE__ */
|
|
3152
|
+
children: /* @__PURE__ */ jsx24(
|
|
3052
3153
|
"div",
|
|
3053
3154
|
{
|
|
3054
|
-
className:
|
|
3155
|
+
className: getClassName15("actions"),
|
|
3055
3156
|
style: {
|
|
3056
3157
|
transform: `scale(${1 / zoom}`,
|
|
3057
3158
|
top: actionsTop / zoom,
|
|
@@ -3060,14 +3161,14 @@ var DraggableComponent = ({
|
|
|
3060
3161
|
paddingRight: actionsSide
|
|
3061
3162
|
},
|
|
3062
3163
|
ref: syncActionsPosition,
|
|
3063
|
-
children: /* @__PURE__ */
|
|
3164
|
+
children: /* @__PURE__ */ jsxs9(
|
|
3064
3165
|
CustomActionBar,
|
|
3065
3166
|
{
|
|
3066
3167
|
parentAction,
|
|
3067
3168
|
label: DEBUG2 ? id : label,
|
|
3068
3169
|
children: [
|
|
3069
|
-
richText && /* @__PURE__ */
|
|
3070
|
-
/* @__PURE__ */
|
|
3170
|
+
richText && /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
3171
|
+
/* @__PURE__ */ jsx24(
|
|
3071
3172
|
LoadedRichTextMenu,
|
|
3072
3173
|
{
|
|
3073
3174
|
editor: richText.editor,
|
|
@@ -3076,10 +3177,10 @@ var DraggableComponent = ({
|
|
|
3076
3177
|
readOnly: false
|
|
3077
3178
|
}
|
|
3078
3179
|
),
|
|
3079
|
-
hasNormalActions && /* @__PURE__ */
|
|
3180
|
+
hasNormalActions && /* @__PURE__ */ jsx24(ActionBar.Separator, {})
|
|
3080
3181
|
] }),
|
|
3081
|
-
permissions.duplicate && /* @__PURE__ */
|
|
3082
|
-
permissions.delete && /* @__PURE__ */
|
|
3182
|
+
permissions.duplicate && /* @__PURE__ */ jsx24(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ jsx24(Copy, { size: 16 }) }),
|
|
3183
|
+
permissions.delete && /* @__PURE__ */ jsx24(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ jsx24(Trash, { size: 16 }) })
|
|
3083
3184
|
]
|
|
3084
3185
|
}
|
|
3085
3186
|
)
|
|
@@ -3087,14 +3188,14 @@ var DraggableComponent = ({
|
|
|
3087
3188
|
)
|
|
3088
3189
|
}
|
|
3089
3190
|
),
|
|
3090
|
-
/* @__PURE__ */
|
|
3191
|
+
/* @__PURE__ */ jsx24("div", { className: getClassName15("overlayWrapper"), children: /* @__PURE__ */ jsx24(
|
|
3091
3192
|
CustomOverlay,
|
|
3092
3193
|
{
|
|
3093
3194
|
componentId: id,
|
|
3094
3195
|
componentType,
|
|
3095
3196
|
hover,
|
|
3096
3197
|
isSelected,
|
|
3097
|
-
children: /* @__PURE__ */
|
|
3198
|
+
children: /* @__PURE__ */ jsx24("div", { className: getClassName15("overlay") })
|
|
3098
3199
|
}
|
|
3099
3200
|
) })
|
|
3100
3201
|
]
|
|
@@ -3108,7 +3209,7 @@ var DraggableComponent = ({
|
|
|
3108
3209
|
|
|
3109
3210
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/DropZone/styles.module.css#css-module
|
|
3110
3211
|
init_react_import();
|
|
3111
|
-
var
|
|
3212
|
+
var styles_module_default11 = { "DropZone": "_DropZone_1h108_1", "DropZone--hasChildren": "_DropZone--hasChildren_1h108_11", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_1h108_24", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_1h108_25", "DropZone--isRootZone": "_DropZone--isRootZone_1h108_25", "DropZone--isDestination": "_DropZone--isDestination_1h108_39", "DropZone-item": "_DropZone-item_1h108_48", "DropZone-hitbox": "_DropZone-hitbox_1h108_52", "DropZone--isEnabled": "_DropZone--isEnabled_1h108_60", "DropZone--isAnimating": "_DropZone--isAnimating_1h108_70" };
|
|
3112
3213
|
|
|
3113
3214
|
// components/DropZone/index.tsx
|
|
3114
3215
|
import { useDroppable as useDroppable2 } from "@dnd-kit/react";
|
|
@@ -3118,7 +3219,7 @@ init_react_import();
|
|
|
3118
3219
|
|
|
3119
3220
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Drawer/styles.module.css#css-module
|
|
3120
3221
|
init_react_import();
|
|
3121
|
-
var
|
|
3222
|
+
var styles_module_default12 = { "Drawer": "_Drawer_146py_1", "Drawer--tile": "_Drawer--tile_146py_8", "Drawer-draggable": "_Drawer-draggable_146py_19", "Drawer-draggableBg": "_Drawer-draggableBg_146py_23", "DrawerItem-draggable": "_DrawerItem-draggable_146py_33", "DrawerItem-icon": "_DrawerItem-icon_146py_50", "DrawerItem--disabled": "_DrawerItem--disabled_146py_56", "DrawerItem": "_DrawerItem_146py_33", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_146py_66", "DrawerItem-name": "_DrawerItem-name_146py_91" };
|
|
3122
3223
|
|
|
3123
3224
|
// components/Drawer/index.tsx
|
|
3124
3225
|
import { useMemo as useMemo9, useState as useState11 } from "react";
|
|
@@ -3128,11 +3229,11 @@ init_react_import();
|
|
|
3128
3229
|
import { DragDropProvider as DragDropProvider2 } from "@dnd-kit/react";
|
|
3129
3230
|
import {
|
|
3130
3231
|
createContext as createContext4,
|
|
3131
|
-
useCallback as
|
|
3232
|
+
useCallback as useCallback9,
|
|
3132
3233
|
useContext as useContext6,
|
|
3133
3234
|
useEffect as useEffect9,
|
|
3134
3235
|
useMemo as useMemo8,
|
|
3135
|
-
useRef as
|
|
3236
|
+
useRef as useRef4,
|
|
3136
3237
|
useState as useState10
|
|
3137
3238
|
} from "react";
|
|
3138
3239
|
import {
|
|
@@ -3539,7 +3640,7 @@ function getDeepDir(el) {
|
|
|
3539
3640
|
|
|
3540
3641
|
// components/DragDropContext/index.tsx
|
|
3541
3642
|
import { effect } from "@dnd-kit/state";
|
|
3542
|
-
import { jsx as
|
|
3643
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
3543
3644
|
var DEBUG3 = false;
|
|
3544
3645
|
var dragListenerContext = createContext4({
|
|
3545
3646
|
dragListeners: {}
|
|
@@ -3556,8 +3657,8 @@ function useDragListener(type, fn, deps = []) {
|
|
|
3556
3657
|
}
|
|
3557
3658
|
var AREA_CHANGE_DEBOUNCE_MS = 100;
|
|
3558
3659
|
var useTempDisableFallback = (timeout3) => {
|
|
3559
|
-
const lastFallbackDisable =
|
|
3560
|
-
return
|
|
3660
|
+
const lastFallbackDisable = useRef4(null);
|
|
3661
|
+
return useCallback9((manager) => {
|
|
3561
3662
|
collisionStore.setState({ fallbackEnabled: false });
|
|
3562
3663
|
const fallbackId = generateId();
|
|
3563
3664
|
lastFallbackDisable.current = fallbackId;
|
|
@@ -3576,7 +3677,7 @@ var DragDropContextClient = ({
|
|
|
3576
3677
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
3577
3678
|
const instanceId = useAppStore((s) => s.instanceId);
|
|
3578
3679
|
const appStore = useAppStoreApi();
|
|
3579
|
-
const debouncedParamsRef =
|
|
3680
|
+
const debouncedParamsRef = useRef4(null);
|
|
3580
3681
|
const tempDisableFallback = useTempDisableFallback(100);
|
|
3581
3682
|
const [zoneStore] = useState10(() => {
|
|
3582
3683
|
const rootVirtualizers = /* @__PURE__ */ new Map();
|
|
@@ -3617,7 +3718,16 @@ var DragDropContextClient = ({
|
|
|
3617
3718
|
}
|
|
3618
3719
|
}));
|
|
3619
3720
|
});
|
|
3620
|
-
|
|
3721
|
+
useEffect9(() => {
|
|
3722
|
+
appStore.setState({
|
|
3723
|
+
scrollToComponent: (id) => zoneStore.getState().scrollToComponent(id)
|
|
3724
|
+
});
|
|
3725
|
+
return () => {
|
|
3726
|
+
appStore.setState({ scrollToComponent: () => {
|
|
3727
|
+
} });
|
|
3728
|
+
};
|
|
3729
|
+
}, [appStore, zoneStore]);
|
|
3730
|
+
const getChanged = useCallback9(
|
|
3621
3731
|
(params) => {
|
|
3622
3732
|
const { zoneDepthIndex = {}, areaDepthIndex = {} } = zoneStore.getState() || {};
|
|
3623
3733
|
const stateHasZone = Object.keys(zoneDepthIndex).length > 0;
|
|
@@ -3638,7 +3748,7 @@ var DragDropContextClient = ({
|
|
|
3638
3748
|
},
|
|
3639
3749
|
[zoneStore]
|
|
3640
3750
|
);
|
|
3641
|
-
const setDeepestAndCollide =
|
|
3751
|
+
const setDeepestAndCollide = useCallback9(
|
|
3642
3752
|
(params, manager) => {
|
|
3643
3753
|
const { zoneChanged, areaChanged } = getChanged(params);
|
|
3644
3754
|
if (!zoneChanged && !areaChanged) return;
|
|
@@ -3727,8 +3837,8 @@ var DragDropContextClient = ({
|
|
|
3727
3837
|
]);
|
|
3728
3838
|
const sensors = useSensors();
|
|
3729
3839
|
const [dragListeners, setDragListeners] = useState10({});
|
|
3730
|
-
const dragMode =
|
|
3731
|
-
const initialSelector =
|
|
3840
|
+
const dragMode = useRef4(null);
|
|
3841
|
+
const initialSelector = useRef4(void 0);
|
|
3732
3842
|
const nextContextValue = useMemo8(
|
|
3733
3843
|
() => ({
|
|
3734
3844
|
mode: "edit",
|
|
@@ -3737,14 +3847,14 @@ var DragDropContextClient = ({
|
|
|
3737
3847
|
}),
|
|
3738
3848
|
[]
|
|
3739
3849
|
);
|
|
3740
|
-
return /* @__PURE__ */
|
|
3850
|
+
return /* @__PURE__ */ jsx25(
|
|
3741
3851
|
dragListenerContext.Provider,
|
|
3742
3852
|
{
|
|
3743
3853
|
value: {
|
|
3744
3854
|
dragListeners,
|
|
3745
3855
|
setDragListeners
|
|
3746
3856
|
},
|
|
3747
|
-
children: /* @__PURE__ */
|
|
3857
|
+
children: /* @__PURE__ */ jsx25(
|
|
3748
3858
|
DragDropProvider2,
|
|
3749
3859
|
{
|
|
3750
3860
|
plugins,
|
|
@@ -3960,7 +4070,7 @@ var DragDropContextClient = ({
|
|
|
3960
4070
|
const entryEl = (_d = getFrame()) == null ? void 0 : _d.querySelector("[data-editor-entry]");
|
|
3961
4071
|
entryEl == null ? void 0 : entryEl.setAttribute("data-editor-dragging", "true");
|
|
3962
4072
|
},
|
|
3963
|
-
children: /* @__PURE__ */
|
|
4073
|
+
children: /* @__PURE__ */ jsx25(ZoneStoreProvider, { store: zoneStore, children: /* @__PURE__ */ jsx25(DropZoneProvider, { value: nextContextValue, children }) })
|
|
3964
4074
|
}
|
|
3965
4075
|
)
|
|
3966
4076
|
}
|
|
@@ -3974,14 +4084,14 @@ var DragDropContext = ({
|
|
|
3974
4084
|
if (status === "LOADING") {
|
|
3975
4085
|
return children;
|
|
3976
4086
|
}
|
|
3977
|
-
return /* @__PURE__ */
|
|
4087
|
+
return /* @__PURE__ */ jsx25(DragDropContextClient, { disableAutoScroll, children });
|
|
3978
4088
|
};
|
|
3979
4089
|
|
|
3980
4090
|
// components/Drawer/index.tsx
|
|
3981
4091
|
import { useDraggable, useDroppable } from "@dnd-kit/react";
|
|
3982
|
-
import { jsx as
|
|
3983
|
-
var
|
|
3984
|
-
var getClassNameItem2 = get_class_name_factory_default("DrawerItem",
|
|
4092
|
+
import { jsx as jsx26, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4093
|
+
var getClassName16 = get_class_name_factory_default("Drawer", styles_module_default12);
|
|
4094
|
+
var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default12);
|
|
3985
4095
|
var DrawerItemInner = ({
|
|
3986
4096
|
children,
|
|
3987
4097
|
name,
|
|
@@ -3991,10 +4101,10 @@ var DrawerItemInner = ({
|
|
|
3991
4101
|
isDragDisabled
|
|
3992
4102
|
}) => {
|
|
3993
4103
|
const CustomInner = useMemo9(
|
|
3994
|
-
() => children || (({ children: children2 }) => /* @__PURE__ */
|
|
4104
|
+
() => children || (({ children: children2 }) => /* @__PURE__ */ jsx26("div", { className: getClassNameItem2("default"), children: children2 })),
|
|
3995
4105
|
[children]
|
|
3996
4106
|
);
|
|
3997
|
-
return /* @__PURE__ */
|
|
4107
|
+
return /* @__PURE__ */ jsx26(
|
|
3998
4108
|
"div",
|
|
3999
4109
|
{
|
|
4000
4110
|
className: getClassNameItem2({ disabled: isDragDisabled }),
|
|
@@ -4002,9 +4112,9 @@ var DrawerItemInner = ({
|
|
|
4002
4112
|
onMouseDown: (e) => e.preventDefault(),
|
|
4003
4113
|
"data-testid": dragRef ? `drawer-item:${name}` : "",
|
|
4004
4114
|
"data-editor-drawer-item": true,
|
|
4005
|
-
children: /* @__PURE__ */
|
|
4006
|
-
icon && /* @__PURE__ */
|
|
4007
|
-
/* @__PURE__ */
|
|
4115
|
+
children: /* @__PURE__ */ jsx26(CustomInner, { name, children: /* @__PURE__ */ jsx26("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ jsxs10("div", { className: getClassNameItem2("draggable"), children: [
|
|
4116
|
+
icon && /* @__PURE__ */ jsx26("div", { className: getClassNameItem2("icon"), children: icon }),
|
|
4117
|
+
/* @__PURE__ */ jsx26("div", { className: getClassNameItem2("name"), children: label != null ? label : name })
|
|
4008
4118
|
] }) }) })
|
|
4009
4119
|
}
|
|
4010
4120
|
);
|
|
@@ -4023,9 +4133,9 @@ var DrawerItemDraggable = ({
|
|
|
4023
4133
|
disabled: isDragDisabled,
|
|
4024
4134
|
type: "drawer"
|
|
4025
4135
|
});
|
|
4026
|
-
return /* @__PURE__ */
|
|
4027
|
-
/* @__PURE__ */
|
|
4028
|
-
/* @__PURE__ */
|
|
4136
|
+
return /* @__PURE__ */ jsxs10("div", { className: getClassName16("draggable"), children: [
|
|
4137
|
+
/* @__PURE__ */ jsx26("div", { className: getClassName16("draggableBg"), children: /* @__PURE__ */ jsx26(DrawerItemInner, { name, label, icon, children }) }),
|
|
4138
|
+
/* @__PURE__ */ jsx26("div", { className: getClassName16("draggableFg"), children: /* @__PURE__ */ jsx26(
|
|
4029
4139
|
DrawerItemInner,
|
|
4030
4140
|
{
|
|
4031
4141
|
name,
|
|
@@ -4061,7 +4171,7 @@ var DrawerItem = ({
|
|
|
4061
4171
|
},
|
|
4062
4172
|
[resolvedId]
|
|
4063
4173
|
);
|
|
4064
|
-
return /* @__PURE__ */
|
|
4174
|
+
return /* @__PURE__ */ jsx26("div", { children: /* @__PURE__ */ jsx26(
|
|
4065
4175
|
DrawerItemDraggable,
|
|
4066
4176
|
{
|
|
4067
4177
|
name,
|
|
@@ -4096,10 +4206,10 @@ var Drawer = ({
|
|
|
4096
4206
|
collisionPriority: 0
|
|
4097
4207
|
// Never collide with this, but we use it so NestedDroppablePlugin respects the Drawer
|
|
4098
4208
|
});
|
|
4099
|
-
return /* @__PURE__ */
|
|
4209
|
+
return /* @__PURE__ */ jsx26(
|
|
4100
4210
|
"div",
|
|
4101
4211
|
{
|
|
4102
|
-
className:
|
|
4212
|
+
className: getClassName16({ [variant]: variant }),
|
|
4103
4213
|
ref,
|
|
4104
4214
|
"data-editor-dnd": id,
|
|
4105
4215
|
"data-editor-drawer": true,
|
|
@@ -4115,7 +4225,7 @@ import { pointerIntersection } from "@dnd-kit/collision";
|
|
|
4115
4225
|
|
|
4116
4226
|
// components/DropZone/lib/use-min-empty-height.ts
|
|
4117
4227
|
init_react_import();
|
|
4118
|
-
import { useEffect as useEffect10, useRef as
|
|
4228
|
+
import { useEffect as useEffect10, useRef as useRef5, useState as useState12 } from "react";
|
|
4119
4229
|
var getNumItems = (appStore, zoneCompound) => appStore.getState().state.indexes.zones[zoneCompound].contentIds.length;
|
|
4120
4230
|
var useMinEmptyHeight = ({
|
|
4121
4231
|
zoneCompound,
|
|
@@ -4132,7 +4242,7 @@ var useMinEmptyHeight = ({
|
|
|
4132
4242
|
isZone: ((_b = s.draggedItem) == null ? void 0 : _b.data.zone) === zoneCompound
|
|
4133
4243
|
};
|
|
4134
4244
|
});
|
|
4135
|
-
const numItems =
|
|
4245
|
+
const numItems = useRef5(0);
|
|
4136
4246
|
const onDragFinished = useOnDragFinished(
|
|
4137
4247
|
(finished) => {
|
|
4138
4248
|
if (finished) {
|
|
@@ -4184,10 +4294,10 @@ import { useContext as useContext7, useEffect as useEffect11, useState as useSta
|
|
|
4184
4294
|
// lib/dnd/use-rendered-callback.ts
|
|
4185
4295
|
init_react_import();
|
|
4186
4296
|
import { useDragDropManager } from "@dnd-kit/react";
|
|
4187
|
-
import { useCallback as
|
|
4297
|
+
import { useCallback as useCallback10 } from "react";
|
|
4188
4298
|
function useRenderedCallback(callback, deps) {
|
|
4189
4299
|
const manager = useDragDropManager();
|
|
4190
|
-
return
|
|
4300
|
+
return useCallback10(
|
|
4191
4301
|
(...args) => __async(null, null, function* () {
|
|
4192
4302
|
yield manager == null ? void 0 : manager.renderer.rendering;
|
|
4193
4303
|
return callback(...args);
|
|
@@ -4258,7 +4368,7 @@ var useContentIdsWithPreview = (contentIds, zoneCompound) => {
|
|
|
4258
4368
|
|
|
4259
4369
|
// components/DropZone/lib/use-drag-axis.ts
|
|
4260
4370
|
init_react_import();
|
|
4261
|
-
import { useCallback as
|
|
4371
|
+
import { useCallback as useCallback11, useEffect as useEffect12, useState as useState14 } from "react";
|
|
4262
4372
|
var GRID_DRAG_AXIS = "dynamic";
|
|
4263
4373
|
var FLEX_ROW_DRAG_AXIS = "x";
|
|
4264
4374
|
var DEFAULT_DRAG_AXIS = "y";
|
|
@@ -4267,7 +4377,7 @@ var useDragAxis = (ref, collisionAxis) => {
|
|
|
4267
4377
|
const [dragAxis, setDragAxis] = useState14(
|
|
4268
4378
|
collisionAxis || DEFAULT_DRAG_AXIS
|
|
4269
4379
|
);
|
|
4270
|
-
const calculateDragAxis =
|
|
4380
|
+
const calculateDragAxis = useCallback11(() => {
|
|
4271
4381
|
if (ref.current) {
|
|
4272
4382
|
const computedStyle = window.getComputedStyle(ref.current);
|
|
4273
4383
|
if (computedStyle.display === "grid") {
|
|
@@ -4298,7 +4408,7 @@ import { useShallow as useShallow6 } from "zustand/react/shallow";
|
|
|
4298
4408
|
// components/SlotRender/index.tsx
|
|
4299
4409
|
init_react_import();
|
|
4300
4410
|
import { useShallow as useShallow5 } from "zustand/react/shallow";
|
|
4301
|
-
import { jsx as
|
|
4411
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
4302
4412
|
var ContextSlotRender = ({
|
|
4303
4413
|
componentId,
|
|
4304
4414
|
zone
|
|
@@ -4313,7 +4423,7 @@ var ContextSlotRender = ({
|
|
|
4313
4423
|
return contentIds.map((contentId) => indexes.nodes[contentId].flatData);
|
|
4314
4424
|
})
|
|
4315
4425
|
);
|
|
4316
|
-
return /* @__PURE__ */
|
|
4426
|
+
return /* @__PURE__ */ jsx27(
|
|
4317
4427
|
SlotRenderPure,
|
|
4318
4428
|
{
|
|
4319
4429
|
content: slotContent,
|
|
@@ -4326,10 +4436,10 @@ var ContextSlotRender = ({
|
|
|
4326
4436
|
|
|
4327
4437
|
// lib/field-transforms/use-field-transforms-tracked.tsx
|
|
4328
4438
|
init_react_import();
|
|
4329
|
-
import { useMemo as useMemo10, useRef as
|
|
4439
|
+
import { useMemo as useMemo10, useRef as useRef6 } from "react";
|
|
4330
4440
|
function useFieldTransformsTracked(config, item, transforms, readOnly, forceReadOnly) {
|
|
4331
|
-
const prevProps =
|
|
4332
|
-
const prevResult =
|
|
4441
|
+
const prevProps = useRef6(null);
|
|
4442
|
+
const prevResult = useRef6(item.props);
|
|
4333
4443
|
const mappers = useMemo10(
|
|
4334
4444
|
() => buildMappers(transforms, readOnly, forceReadOnly),
|
|
4335
4445
|
[transforms, readOnly, forceReadOnly]
|
|
@@ -4372,7 +4482,7 @@ init_react_import();
|
|
|
4372
4482
|
|
|
4373
4483
|
// components/InlineTextField/index.tsx
|
|
4374
4484
|
init_react_import();
|
|
4375
|
-
import { memo as memo4, useEffect as useEffect13, useRef as
|
|
4485
|
+
import { memo as memo4, useEffect as useEffect13, useRef as useRef7, useState as useState15 } from "react";
|
|
4376
4486
|
|
|
4377
4487
|
// lib/overlay-portal/index.tsx
|
|
4378
4488
|
init_react_import();
|
|
@@ -4424,11 +4534,11 @@ var registerOverlayPortal = (el, opts = {}) => {
|
|
|
4424
4534
|
|
|
4425
4535
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/InlineTextField/styles.module.css#css-module
|
|
4426
4536
|
init_react_import();
|
|
4427
|
-
var
|
|
4537
|
+
var styles_module_default13 = { "InlineTextField": "_InlineTextField_104qp_1" };
|
|
4428
4538
|
|
|
4429
4539
|
// components/InlineTextField/index.tsx
|
|
4430
|
-
import { jsx as
|
|
4431
|
-
var
|
|
4540
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
4541
|
+
var getClassName17 = get_class_name_factory_default("InlineTextField", styles_module_default13);
|
|
4432
4542
|
var InlineTextFieldInternal = ({
|
|
4433
4543
|
propPath,
|
|
4434
4544
|
componentId,
|
|
@@ -4437,7 +4547,7 @@ var InlineTextFieldInternal = ({
|
|
|
4437
4547
|
opts = {}
|
|
4438
4548
|
}) => {
|
|
4439
4549
|
var _a;
|
|
4440
|
-
const ref =
|
|
4550
|
+
const ref = useRef7(null);
|
|
4441
4551
|
const appStoreApi = useAppStoreApi();
|
|
4442
4552
|
const disableLineBreaks = (_a = opts.disableLineBreaks) != null ? _a : false;
|
|
4443
4553
|
useEffect13(() => {
|
|
@@ -4488,10 +4598,10 @@ var InlineTextFieldInternal = ({
|
|
|
4488
4598
|
}, [appStoreApi, ref.current, value, disableLineBreaks]);
|
|
4489
4599
|
const [isHovering, setIsHovering] = useState15(false);
|
|
4490
4600
|
const [isFocused, setIsFocused] = useState15(false);
|
|
4491
|
-
return /* @__PURE__ */
|
|
4601
|
+
return /* @__PURE__ */ jsx28(
|
|
4492
4602
|
"span",
|
|
4493
4603
|
{
|
|
4494
|
-
className:
|
|
4604
|
+
className: getClassName17(),
|
|
4495
4605
|
ref,
|
|
4496
4606
|
contentEditable: isHovering || isFocused ? "plaintext-only" : "false",
|
|
4497
4607
|
onClick: (e) => {
|
|
@@ -4527,11 +4637,11 @@ var InlineTextFieldInternal = ({
|
|
|
4527
4637
|
var InlineTextField = memo4(InlineTextFieldInternal);
|
|
4528
4638
|
|
|
4529
4639
|
// lib/field-transforms/default-transforms/inline-text-transform.tsx
|
|
4530
|
-
import { jsx as
|
|
4640
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
4531
4641
|
var getInlineTextTransform = () => ({
|
|
4532
4642
|
text: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
4533
4643
|
if (field.contentEditable) {
|
|
4534
|
-
return /* @__PURE__ */
|
|
4644
|
+
return /* @__PURE__ */ jsx29(
|
|
4535
4645
|
InlineTextField,
|
|
4536
4646
|
{
|
|
4537
4647
|
propPath,
|
|
@@ -4546,7 +4656,7 @@ var getInlineTextTransform = () => ({
|
|
|
4546
4656
|
},
|
|
4547
4657
|
textarea: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
4548
4658
|
if (field.contentEditable) {
|
|
4549
|
-
return /* @__PURE__ */
|
|
4659
|
+
return /* @__PURE__ */ jsx29(
|
|
4550
4660
|
InlineTextField,
|
|
4551
4661
|
{
|
|
4552
4662
|
propPath,
|
|
@@ -4560,7 +4670,7 @@ var getInlineTextTransform = () => ({
|
|
|
4560
4670
|
},
|
|
4561
4671
|
custom: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
4562
4672
|
if (field.contentEditable && typeof value === "string") {
|
|
4563
|
-
return /* @__PURE__ */
|
|
4673
|
+
return /* @__PURE__ */ jsx29(
|
|
4564
4674
|
InlineTextField,
|
|
4565
4675
|
{
|
|
4566
4676
|
propPath,
|
|
@@ -4578,15 +4688,15 @@ var getInlineTextTransform = () => ({
|
|
|
4578
4688
|
init_react_import();
|
|
4579
4689
|
import {
|
|
4580
4690
|
useEffect as useEffect14,
|
|
4581
|
-
useRef as
|
|
4582
|
-
useCallback as
|
|
4691
|
+
useRef as useRef8,
|
|
4692
|
+
useCallback as useCallback12,
|
|
4583
4693
|
memo as memo5,
|
|
4584
4694
|
lazy as lazy2,
|
|
4585
4695
|
Suspense as Suspense2
|
|
4586
4696
|
} from "react";
|
|
4587
|
-
import { jsx as
|
|
4697
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
4588
4698
|
var Editor2 = lazy2(
|
|
4589
|
-
() => import("./Editor-
|
|
4699
|
+
() => import("./Editor-KXEVJBNG.mjs").then((m) => ({
|
|
4590
4700
|
default: m.Editor
|
|
4591
4701
|
}))
|
|
4592
4702
|
);
|
|
@@ -4603,7 +4713,7 @@ var InlineEditorWrapper = memo5(
|
|
|
4603
4713
|
field,
|
|
4604
4714
|
id
|
|
4605
4715
|
}) => {
|
|
4606
|
-
const portalRef =
|
|
4716
|
+
const portalRef = useRef8(null);
|
|
4607
4717
|
const appStoreApi = useAppStoreApi();
|
|
4608
4718
|
const onClickHandler = (e) => {
|
|
4609
4719
|
e.preventDefault();
|
|
@@ -4625,7 +4735,7 @@ var InlineEditorWrapper = memo5(
|
|
|
4625
4735
|
});
|
|
4626
4736
|
return () => cleanup == null ? void 0 : cleanup();
|
|
4627
4737
|
}, [portalRef.current]);
|
|
4628
|
-
const handleChange =
|
|
4738
|
+
const handleChange = useCallback12(
|
|
4629
4739
|
(content, ui) => __async(null, null, function* () {
|
|
4630
4740
|
var _a;
|
|
4631
4741
|
const appStore = appStoreApi.getState();
|
|
@@ -4649,7 +4759,7 @@ var InlineEditorWrapper = memo5(
|
|
|
4649
4759
|
}),
|
|
4650
4760
|
[appStoreApi, componentId, propPath]
|
|
4651
4761
|
);
|
|
4652
|
-
const handleFocus =
|
|
4762
|
+
const handleFocus = useCallback12(
|
|
4653
4763
|
(editor) => {
|
|
4654
4764
|
appStoreApi.setState({
|
|
4655
4765
|
currentRichText: {
|
|
@@ -4664,7 +4774,7 @@ var InlineEditorWrapper = memo5(
|
|
|
4664
4774
|
[field, componentId]
|
|
4665
4775
|
);
|
|
4666
4776
|
if (!field.contentEditable)
|
|
4667
|
-
return /* @__PURE__ */
|
|
4777
|
+
return /* @__PURE__ */ jsx30(Suspense2, { fallback: /* @__PURE__ */ jsx30(RichTextRenderFallback, { content: value }), children: /* @__PURE__ */ jsx30(RichTextRender, { content: value, field }) });
|
|
4668
4778
|
const editorProps = {
|
|
4669
4779
|
content: value,
|
|
4670
4780
|
onChange: handleChange,
|
|
@@ -4674,13 +4784,13 @@ var InlineEditorWrapper = memo5(
|
|
|
4674
4784
|
id,
|
|
4675
4785
|
name: propPath
|
|
4676
4786
|
};
|
|
4677
|
-
return /* @__PURE__ */
|
|
4787
|
+
return /* @__PURE__ */ jsx30(
|
|
4678
4788
|
"div",
|
|
4679
4789
|
{
|
|
4680
4790
|
ref: portalRef,
|
|
4681
4791
|
onClick: onClickHandler,
|
|
4682
4792
|
onClickCapture: onClickCaptureHandler,
|
|
4683
|
-
children: /* @__PURE__ */
|
|
4793
|
+
children: /* @__PURE__ */ jsx30(Suspense2, { fallback: /* @__PURE__ */ jsx30(EditorFallback, __spreadValues({}, editorProps)), children: /* @__PURE__ */ jsx30(Editor2, __spreadValues({}, editorProps)) })
|
|
4684
4794
|
}
|
|
4685
4795
|
);
|
|
4686
4796
|
}
|
|
@@ -4690,10 +4800,10 @@ var getRichTextTransform = () => ({
|
|
|
4690
4800
|
richtext: ({ value, componentId, field, propPath, isReadOnly }) => {
|
|
4691
4801
|
const { contentEditable = true, tiptap } = field;
|
|
4692
4802
|
if (contentEditable === false || isReadOnly) {
|
|
4693
|
-
return /* @__PURE__ */
|
|
4803
|
+
return /* @__PURE__ */ jsx30(RichTextRender, { content: value, field });
|
|
4694
4804
|
}
|
|
4695
4805
|
const id = `${componentId}_${field.type}_${propPath}`;
|
|
4696
|
-
return /* @__PURE__ */
|
|
4806
|
+
return /* @__PURE__ */ jsx30(
|
|
4697
4807
|
InlineEditorWrapper,
|
|
4698
4808
|
{
|
|
4699
4809
|
value,
|
|
@@ -4737,12 +4847,12 @@ function shallowEqual(obj1, obj2, keysToIgnore = []) {
|
|
|
4737
4847
|
}
|
|
4738
4848
|
|
|
4739
4849
|
// components/MemoizeComponent/index.tsx
|
|
4740
|
-
import { jsx as
|
|
4850
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
4741
4851
|
var RenderComponent = ({
|
|
4742
4852
|
Component: Component2,
|
|
4743
4853
|
componentProps: renderProps
|
|
4744
4854
|
}) => {
|
|
4745
|
-
return /* @__PURE__ */
|
|
4855
|
+
return /* @__PURE__ */ jsx31(Component2, __spreadValues({}, renderProps));
|
|
4746
4856
|
};
|
|
4747
4857
|
var MemoizeComponent = memo6(RenderComponent, (prev, next) => {
|
|
4748
4858
|
let editorEquals = true;
|
|
@@ -4755,11 +4865,11 @@ var MemoizeComponent = memo6(RenderComponent, (prev, next) => {
|
|
|
4755
4865
|
// components/DropZone/VirtualizedDropZone.tsx
|
|
4756
4866
|
init_react_import();
|
|
4757
4867
|
import {
|
|
4758
|
-
useCallback as
|
|
4868
|
+
useCallback as useCallback13,
|
|
4759
4869
|
useContext as useContext8,
|
|
4760
4870
|
useEffect as useEffect15,
|
|
4761
4871
|
useMemo as useMemo11,
|
|
4762
|
-
useRef as
|
|
4872
|
+
useRef as useRef9
|
|
4763
4873
|
} from "react";
|
|
4764
4874
|
import {
|
|
4765
4875
|
defaultRangeExtractor,
|
|
@@ -4771,7 +4881,7 @@ import {
|
|
|
4771
4881
|
useVirtualizer,
|
|
4772
4882
|
windowScroll
|
|
4773
4883
|
} from "@tanstack/react-virtual";
|
|
4774
|
-
import { Fragment as Fragment6, jsx as
|
|
4884
|
+
import { Fragment as Fragment6, jsx as jsx32 } from "react/jsx-runtime";
|
|
4775
4885
|
var ROOT_ZONE_VIRTUALIZATION_OVERSCAN = 5;
|
|
4776
4886
|
var DEFAULT_VIRTUALIZED_ITEM_HEIGHT = 320;
|
|
4777
4887
|
var measuredItemHeights = /* @__PURE__ */ new Map();
|
|
@@ -4810,9 +4920,9 @@ var VirtualizedDropZone = ({
|
|
|
4810
4920
|
return null;
|
|
4811
4921
|
});
|
|
4812
4922
|
const iframeWindow = frame == null ? void 0 : frame.defaultView;
|
|
4813
|
-
const measureRefsRef =
|
|
4923
|
+
const measureRefsRef = useRef9(/* @__PURE__ */ new Map());
|
|
4814
4924
|
const appStoreApi = useAppStoreApi();
|
|
4815
|
-
const resolveIndex =
|
|
4925
|
+
const resolveIndex = useCallback13(
|
|
4816
4926
|
(targetId) => {
|
|
4817
4927
|
var _a, _b, _c, _d;
|
|
4818
4928
|
if (!targetId || targetId === "root") {
|
|
@@ -4847,7 +4957,7 @@ var VirtualizedDropZone = ({
|
|
|
4847
4957
|
});
|
|
4848
4958
|
return Array.from(nextPinnedIndexes).sort((a, b) => a - b);
|
|
4849
4959
|
}, [dragTargetParentId, draggedItemId, resolveIndex, selectedId]);
|
|
4850
|
-
const rangeExtractor =
|
|
4960
|
+
const rangeExtractor = useCallback13(
|
|
4851
4961
|
(range) => {
|
|
4852
4962
|
const indexes = defaultRangeExtractor(range);
|
|
4853
4963
|
pinnedIndexes.forEach((index) => {
|
|
@@ -4881,7 +4991,7 @@ var VirtualizedDropZone = ({
|
|
|
4881
4991
|
zoneStore.getState().unregisterRootVirtualizer(zoneCompound);
|
|
4882
4992
|
};
|
|
4883
4993
|
}, [resolveIndex, virtualizer, zoneCompound, zoneStore]);
|
|
4884
|
-
const getMeasureRef =
|
|
4994
|
+
const getMeasureRef = useCallback13((componentId) => {
|
|
4885
4995
|
const cachedRef = measureRefsRef.current.get(componentId);
|
|
4886
4996
|
if (cachedRef) {
|
|
4887
4997
|
return cachedRef;
|
|
@@ -4918,7 +5028,7 @@ var VirtualizedDropZone = ({
|
|
|
4918
5028
|
const gapSize = Math.max(virtualItem.start - previousEnd, 0);
|
|
4919
5029
|
if (gapSize > 0) {
|
|
4920
5030
|
items.push(
|
|
4921
|
-
/* @__PURE__ */
|
|
5031
|
+
/* @__PURE__ */ jsx32(
|
|
4922
5032
|
"div",
|
|
4923
5033
|
{
|
|
4924
5034
|
style: { height: `${gapSize}px` }
|
|
@@ -4940,7 +5050,7 @@ var VirtualizedDropZone = ({
|
|
|
4940
5050
|
const trailingGap = Math.max(totalSize - previousEnd, 0);
|
|
4941
5051
|
if (trailingGap > 0) {
|
|
4942
5052
|
items.push(
|
|
4943
|
-
/* @__PURE__ */
|
|
5053
|
+
/* @__PURE__ */ jsx32(
|
|
4944
5054
|
"div",
|
|
4945
5055
|
{
|
|
4946
5056
|
style: { height: `${trailingGap}px` }
|
|
@@ -4951,12 +5061,12 @@ var VirtualizedDropZone = ({
|
|
|
4951
5061
|
}
|
|
4952
5062
|
return items;
|
|
4953
5063
|
}, [totalSize, virtualItems, getMeasureRef]);
|
|
4954
|
-
return /* @__PURE__ */
|
|
5064
|
+
return /* @__PURE__ */ jsx32(Fragment6, { children: renderedItems });
|
|
4955
5065
|
};
|
|
4956
5066
|
|
|
4957
5067
|
// components/DropZone/index.tsx
|
|
4958
|
-
import { Fragment as Fragment7, jsx as
|
|
4959
|
-
var
|
|
5068
|
+
import { Fragment as Fragment7, jsx as jsx33, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5069
|
+
var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default11);
|
|
4960
5070
|
var getRandomColor = () => `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
|
4961
5071
|
var RENDER_DEBUG = false;
|
|
4962
5072
|
var InsertPreview = ({
|
|
@@ -4967,12 +5077,12 @@ var InsertPreview = ({
|
|
|
4967
5077
|
if (element) {
|
|
4968
5078
|
return (
|
|
4969
5079
|
// Safe to use this since the HTML is set by the user
|
|
4970
|
-
/* @__PURE__ */
|
|
5080
|
+
/* @__PURE__ */ jsx33("div", { dangerouslySetInnerHTML: { __html: element.outerHTML } })
|
|
4971
5081
|
);
|
|
4972
5082
|
}
|
|
4973
|
-
return /* @__PURE__ */
|
|
5083
|
+
return /* @__PURE__ */ jsx33(DrawerItemInner, { name: label, children: override });
|
|
4974
5084
|
};
|
|
4975
|
-
var DropZoneEditPure = (props) => /* @__PURE__ */
|
|
5085
|
+
var DropZoneEditPure = (props) => /* @__PURE__ */ jsx33(DropZoneEdit, __spreadValues({}, props));
|
|
4976
5086
|
var DropZoneChild = ({
|
|
4977
5087
|
zoneCompound,
|
|
4978
5088
|
componentId,
|
|
@@ -5070,7 +5180,7 @@ var DropZoneChild = ({
|
|
|
5070
5180
|
const plugins = useAppStore((s) => s.plugins);
|
|
5071
5181
|
const userFieldTransforms = useAppStore((s) => s.fieldTransforms);
|
|
5072
5182
|
const combinedFieldTransforms = useMemo12(
|
|
5073
|
-
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */
|
|
5183
|
+
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, getSlotTransform(DropZoneEditPure, (slotProps) => /* @__PURE__ */ jsx33(ContextSlotRender, { componentId, zone: slotProps.zone }))), getInlineTextTransform()), getRichTextTransform()), plugins.reduce(
|
|
5074
5184
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
5075
5185
|
{}
|
|
5076
5186
|
)), userFieldTransforms),
|
|
@@ -5084,13 +5194,13 @@ var DropZoneChild = ({
|
|
|
5084
5194
|
isLoading
|
|
5085
5195
|
);
|
|
5086
5196
|
if (!item) return;
|
|
5087
|
-
const Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */
|
|
5197
|
+
const Render2 = componentConfig ? componentConfig.render : () => /* @__PURE__ */ jsxs11("div", { style: { padding: 48, textAlign: "center" }, children: [
|
|
5088
5198
|
"No configuration for ",
|
|
5089
5199
|
item.type
|
|
5090
5200
|
] });
|
|
5091
5201
|
let componentType = item.type;
|
|
5092
5202
|
const isInserting = "previewType" in item ? item.previewType === "insert" : false;
|
|
5093
|
-
return /* @__PURE__ */
|
|
5203
|
+
return /* @__PURE__ */ jsx33(
|
|
5094
5204
|
DraggableComponent,
|
|
5095
5205
|
{
|
|
5096
5206
|
id: componentId,
|
|
@@ -5108,7 +5218,7 @@ var DropZoneChild = ({
|
|
|
5108
5218
|
children: (dragRef) => {
|
|
5109
5219
|
var _a2;
|
|
5110
5220
|
if ((componentConfig == null ? void 0 : componentConfig.inline) && !isInserting) {
|
|
5111
|
-
return /* @__PURE__ */
|
|
5221
|
+
return /* @__PURE__ */ jsx33(
|
|
5112
5222
|
MemoizeComponent,
|
|
5113
5223
|
{
|
|
5114
5224
|
Component: Render2,
|
|
@@ -5118,14 +5228,14 @@ var DropZoneChild = ({
|
|
|
5118
5228
|
}
|
|
5119
5229
|
);
|
|
5120
5230
|
}
|
|
5121
|
-
return /* @__PURE__ */
|
|
5231
|
+
return /* @__PURE__ */ jsx33("div", { ref: dragRef, children: isInserting ? /* @__PURE__ */ jsx33(
|
|
5122
5232
|
InsertPreview,
|
|
5123
5233
|
{
|
|
5124
5234
|
label,
|
|
5125
5235
|
override: (_a2 = overrides.componentItem) != null ? _a2 : overrides.drawerItem,
|
|
5126
5236
|
element: "element" in item && item.element ? item.element : void 0
|
|
5127
5237
|
}
|
|
5128
|
-
) : /* @__PURE__ */
|
|
5238
|
+
) : /* @__PURE__ */ jsx33(
|
|
5129
5239
|
MemoizeComponent,
|
|
5130
5240
|
{
|
|
5131
5241
|
Component: Render2,
|
|
@@ -5205,8 +5315,8 @@ var DropZoneEdit = forwardRef(
|
|
|
5205
5315
|
const contentIds = useMemo12(() => {
|
|
5206
5316
|
return zoneContentIds || [];
|
|
5207
5317
|
}, [zoneContentIds]);
|
|
5208
|
-
const ref =
|
|
5209
|
-
const acceptsTarget =
|
|
5318
|
+
const ref = useRef10(null);
|
|
5319
|
+
const acceptsTarget = useCallback14(
|
|
5210
5320
|
(componentType) => {
|
|
5211
5321
|
if (!componentType) {
|
|
5212
5322
|
return true;
|
|
@@ -5289,7 +5399,7 @@ var DropZoneEdit = forwardRef(
|
|
|
5289
5399
|
userMinEmptyHeight,
|
|
5290
5400
|
ref
|
|
5291
5401
|
});
|
|
5292
|
-
const setRefs =
|
|
5402
|
+
const setRefs = useCallback14(
|
|
5293
5403
|
(node) => {
|
|
5294
5404
|
assignRefs([ref, dropRef, userRef], node);
|
|
5295
5405
|
},
|
|
@@ -5301,10 +5411,10 @@ var DropZoneEdit = forwardRef(
|
|
|
5301
5411
|
const El = as != null ? as : "div";
|
|
5302
5412
|
const isRootAreaZone = (areaId != null ? areaId : rootAreaId) === rootAreaId && depth === 0;
|
|
5303
5413
|
const shouldVirtualizeItems = _experimentalVirtualization && isRootAreaZone;
|
|
5304
|
-
return /* @__PURE__ */
|
|
5414
|
+
return /* @__PURE__ */ jsx33(
|
|
5305
5415
|
El,
|
|
5306
5416
|
{
|
|
5307
|
-
className: `${
|
|
5417
|
+
className: `${getClassName18({
|
|
5308
5418
|
isRootZone,
|
|
5309
5419
|
hoveringOverArea,
|
|
5310
5420
|
isEnabled,
|
|
@@ -5319,12 +5429,12 @@ var DropZoneEdit = forwardRef(
|
|
|
5319
5429
|
"--min-empty-height": minEmptyHeight,
|
|
5320
5430
|
backgroundColor: RENDER_DEBUG ? getRandomColor() : style == null ? void 0 : style.backgroundColor
|
|
5321
5431
|
}),
|
|
5322
|
-
children: shouldVirtualizeItems ? /* @__PURE__ */
|
|
5432
|
+
children: shouldVirtualizeItems ? /* @__PURE__ */ jsx33(
|
|
5323
5433
|
VirtualizedDropZone,
|
|
5324
5434
|
{
|
|
5325
5435
|
contentIds: contentIdsWithPreview,
|
|
5326
5436
|
zoneCompound,
|
|
5327
|
-
renderItem: (props) => /* @__PURE__ */
|
|
5437
|
+
renderItem: (props) => /* @__PURE__ */ jsx33(
|
|
5328
5438
|
DropZoneChildMemo,
|
|
5329
5439
|
{
|
|
5330
5440
|
zoneCompound,
|
|
@@ -5338,7 +5448,7 @@ var DropZoneEdit = forwardRef(
|
|
|
5338
5448
|
props.componentId
|
|
5339
5449
|
)
|
|
5340
5450
|
}
|
|
5341
|
-
) : contentIdsWithPreview.map((componentId, i) => /* @__PURE__ */
|
|
5451
|
+
) : contentIdsWithPreview.map((componentId, i) => /* @__PURE__ */ jsx33(
|
|
5342
5452
|
DropZoneChildMemo,
|
|
5343
5453
|
{
|
|
5344
5454
|
zoneCompound,
|
|
@@ -5360,7 +5470,7 @@ var DropZoneRenderItem = ({
|
|
|
5360
5470
|
metadata
|
|
5361
5471
|
}) => {
|
|
5362
5472
|
const Component2 = config.components[item.type];
|
|
5363
|
-
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */
|
|
5473
|
+
const props = useSlots(config, item, (slotProps) => /* @__PURE__ */ jsx33(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
|
|
5364
5474
|
const nextContextValue = useMemo12(
|
|
5365
5475
|
() => ({
|
|
5366
5476
|
areaId: props.id,
|
|
@@ -5369,7 +5479,7 @@ var DropZoneRenderItem = ({
|
|
|
5369
5479
|
[props]
|
|
5370
5480
|
);
|
|
5371
5481
|
const richtextProps = useRichtextProps(Component2.fields, props);
|
|
5372
|
-
return /* @__PURE__ */
|
|
5482
|
+
return /* @__PURE__ */ jsx33(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx33(
|
|
5373
5483
|
Component2.render,
|
|
5374
5484
|
__spreadProps(__spreadValues(__spreadValues({}, props), richtextProps), {
|
|
5375
5485
|
editor: __spreadProps(__spreadValues({}, props.editor), {
|
|
@@ -5379,7 +5489,7 @@ var DropZoneRenderItem = ({
|
|
|
5379
5489
|
})
|
|
5380
5490
|
) }, props.id);
|
|
5381
5491
|
};
|
|
5382
|
-
var DropZoneRenderPure = (props) => /* @__PURE__ */
|
|
5492
|
+
var DropZoneRenderPure = (props) => /* @__PURE__ */ jsx33(DropZoneRender, __spreadValues({}, props));
|
|
5383
5493
|
var DropZoneRender = forwardRef(
|
|
5384
5494
|
function DropZoneRenderInternal({ className, style, zone, as }, ref) {
|
|
5385
5495
|
const ctx = useContext9(dropZoneContext);
|
|
@@ -5401,10 +5511,10 @@ var DropZoneRender = forwardRef(
|
|
|
5401
5511
|
if (zoneCompound !== rootDroppableId) {
|
|
5402
5512
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
|
5403
5513
|
}
|
|
5404
|
-
return /* @__PURE__ */
|
|
5514
|
+
return /* @__PURE__ */ jsx33(El, { className, style, ref, children: content.map((item) => {
|
|
5405
5515
|
const Component2 = config.components[item.type];
|
|
5406
5516
|
if (Component2) {
|
|
5407
|
-
return /* @__PURE__ */
|
|
5517
|
+
return /* @__PURE__ */ jsx33(
|
|
5408
5518
|
DropZoneRenderItem,
|
|
5409
5519
|
{
|
|
5410
5520
|
config,
|
|
@@ -5418,14 +5528,14 @@ var DropZoneRender = forwardRef(
|
|
|
5418
5528
|
}) });
|
|
5419
5529
|
}
|
|
5420
5530
|
);
|
|
5421
|
-
var DropZonePure = (props) => /* @__PURE__ */
|
|
5531
|
+
var DropZonePure = (props) => /* @__PURE__ */ jsx33(DropZone, __spreadValues({}, props));
|
|
5422
5532
|
var DropZone = forwardRef(
|
|
5423
5533
|
function DropZone2(props, ref) {
|
|
5424
5534
|
const ctx = useContext9(dropZoneContext);
|
|
5425
5535
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
|
5426
|
-
return /* @__PURE__ */
|
|
5536
|
+
return /* @__PURE__ */ jsx33(Fragment7, { children: /* @__PURE__ */ jsx33(DropZoneEdit, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
5427
5537
|
}
|
|
5428
|
-
return /* @__PURE__ */
|
|
5538
|
+
return /* @__PURE__ */ jsx33(Fragment7, { children: /* @__PURE__ */ jsx33(DropZoneRender, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
5429
5539
|
}
|
|
5430
5540
|
);
|
|
5431
5541
|
|
|
@@ -5482,7 +5592,7 @@ function resolveGlobals(data, config) {
|
|
|
5482
5592
|
}
|
|
5483
5593
|
|
|
5484
5594
|
// components/Render/index.tsx
|
|
5485
|
-
import { jsx as
|
|
5595
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
5486
5596
|
var renderContext = React3.createContext({
|
|
5487
5597
|
config: { components: {} },
|
|
5488
5598
|
data: { root: {}, content: [] },
|
|
@@ -5517,7 +5627,7 @@ function Render({
|
|
|
5517
5627
|
const propsWithSlots = useSlots(
|
|
5518
5628
|
config,
|
|
5519
5629
|
{ type: "root", props: pageProps },
|
|
5520
|
-
(props) => /* @__PURE__ */
|
|
5630
|
+
(props) => /* @__PURE__ */ jsx34(SlotRender, __spreadProps(__spreadValues({}, props), { config, metadata }))
|
|
5521
5631
|
);
|
|
5522
5632
|
const richtextProps = useRichtextProps((_a = config.root) == null ? void 0 : _a.fields, pageProps);
|
|
5523
5633
|
const nextContextValue = useMemo13(
|
|
@@ -5528,9 +5638,9 @@ function Render({
|
|
|
5528
5638
|
[]
|
|
5529
5639
|
);
|
|
5530
5640
|
if ((_b = config.root) == null ? void 0 : _b.render) {
|
|
5531
|
-
return /* @__PURE__ */
|
|
5641
|
+
return /* @__PURE__ */ jsx34(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ jsx34(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx34(config.root.render, __spreadProps(__spreadValues(__spreadValues({}, propsWithSlots), richtextProps), { children: /* @__PURE__ */ jsx34(DropZoneRenderPure, { zone: rootZone }) })) }) });
|
|
5532
5642
|
}
|
|
5533
|
-
return /* @__PURE__ */
|
|
5643
|
+
return /* @__PURE__ */ jsx34(renderContext.Provider, { value: { config, data: defaultedData, metadata }, children: /* @__PURE__ */ jsx34(DropZoneProvider, { value: nextContextValue, children: /* @__PURE__ */ jsx34(DropZoneRenderPure, { zone: rootZone }) }) });
|
|
5534
5644
|
}
|
|
5535
5645
|
|
|
5536
5646
|
// components/ComponentList/index.tsx
|
|
@@ -5538,12 +5648,12 @@ init_react_import();
|
|
|
5538
5648
|
|
|
5539
5649
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ComponentList/styles.module.css#css-module
|
|
5540
5650
|
init_react_import();
|
|
5541
|
-
var
|
|
5651
|
+
var styles_module_default14 = { "ComponentList": "_ComponentList_1mlcu_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_1mlcu_5", "ComponentList-content": "_ComponentList-content_1mlcu_9", "ComponentList-title": "_ComponentList-title_1mlcu_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_1mlcu_54" };
|
|
5542
5652
|
|
|
5543
5653
|
// components/ComponentList/index.tsx
|
|
5544
5654
|
import { useEffect as useEffect17 } from "react";
|
|
5545
|
-
import { jsx as
|
|
5546
|
-
var
|
|
5655
|
+
import { jsx as jsx35, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5656
|
+
var getClassName19 = get_class_name_factory_default("ComponentList", styles_module_default14);
|
|
5547
5657
|
var ComponentListItem = ({
|
|
5548
5658
|
name,
|
|
5549
5659
|
label,
|
|
@@ -5563,7 +5673,7 @@ var ComponentListItem = ({
|
|
|
5563
5673
|
);
|
|
5564
5674
|
}
|
|
5565
5675
|
}, [overrides]);
|
|
5566
|
-
return /* @__PURE__ */
|
|
5676
|
+
return /* @__PURE__ */ jsx35(Drawer.Item, { label, name, icon, isDragDisabled: !canInsert, children: (_a = overrides.componentItem) != null ? _a : overrides.drawerItem });
|
|
5567
5677
|
};
|
|
5568
5678
|
var ComponentList = ({
|
|
5569
5679
|
children,
|
|
@@ -5574,12 +5684,12 @@ var ComponentList = ({
|
|
|
5574
5684
|
const setUi = useAppStore((s) => s.setUi);
|
|
5575
5685
|
const componentList = useAppStore((s) => s.state.ui.componentList);
|
|
5576
5686
|
const { expanded = true } = componentList[id] || {};
|
|
5577
|
-
return /* @__PURE__ */
|
|
5578
|
-
title && /* @__PURE__ */
|
|
5687
|
+
return /* @__PURE__ */ jsxs12("div", { className: getClassName19({ isExpanded: expanded }), children: [
|
|
5688
|
+
title && /* @__PURE__ */ jsxs12(
|
|
5579
5689
|
"button",
|
|
5580
5690
|
{
|
|
5581
5691
|
type: "button",
|
|
5582
|
-
className:
|
|
5692
|
+
className: getClassName19("title"),
|
|
5583
5693
|
onClick: () => setUi({
|
|
5584
5694
|
componentList: __spreadProps(__spreadValues({}, componentList), {
|
|
5585
5695
|
[id]: __spreadProps(__spreadValues({}, componentList[id]), {
|
|
@@ -5589,15 +5699,15 @@ var ComponentList = ({
|
|
|
5589
5699
|
}),
|
|
5590
5700
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
|
5591
5701
|
children: [
|
|
5592
|
-
/* @__PURE__ */
|
|
5593
|
-
/* @__PURE__ */
|
|
5702
|
+
/* @__PURE__ */ jsx35("div", { className: getClassName19("titleIcon"), children: /* @__PURE__ */ jsx35(ChevronRight, { size: 12 }) }),
|
|
5703
|
+
/* @__PURE__ */ jsx35("div", { children: title })
|
|
5594
5704
|
]
|
|
5595
5705
|
}
|
|
5596
5706
|
),
|
|
5597
|
-
/* @__PURE__ */
|
|
5707
|
+
/* @__PURE__ */ jsx35("div", { className: getClassName19("content"), children: /* @__PURE__ */ jsx35(Drawer, { variant: "tile", children: children || Object.keys(config.components).map((componentKey) => {
|
|
5598
5708
|
var _a;
|
|
5599
5709
|
const componentConf = config.components[componentKey] || {};
|
|
5600
|
-
return /* @__PURE__ */
|
|
5710
|
+
return /* @__PURE__ */ jsx35(
|
|
5601
5711
|
ComponentListItem,
|
|
5602
5712
|
{
|
|
5603
5713
|
label: (_a = componentConf["label"]) != null ? _a : componentKey,
|
|
@@ -5679,8 +5789,135 @@ function resolveDataBySelector(selector, getState, trigger) {
|
|
|
5679
5789
|
});
|
|
5680
5790
|
}
|
|
5681
5791
|
|
|
5792
|
+
// lib/editor-commands.ts
|
|
5793
|
+
init_react_import();
|
|
5794
|
+
var parentToZone = (parent) => parent ? `${parent.id}:${parent.slot}` : rootDroppableId;
|
|
5795
|
+
var createEditorCommands = (appStore) => {
|
|
5796
|
+
const { getState } = appStore;
|
|
5797
|
+
const getZoneLength = (zone) => {
|
|
5798
|
+
var _a, _b;
|
|
5799
|
+
return (_b = (_a = getState().state.indexes.zones[zone]) == null ? void 0 : _a.contentIds.length) != null ? _b : 0;
|
|
5800
|
+
};
|
|
5801
|
+
const insertComponent2 = ({
|
|
5802
|
+
type,
|
|
5803
|
+
parent,
|
|
5804
|
+
index,
|
|
5805
|
+
data,
|
|
5806
|
+
select = true
|
|
5807
|
+
}) => {
|
|
5808
|
+
var _a;
|
|
5809
|
+
const id = (_a = data == null ? void 0 : data.props.id) != null ? _a : generateId(type);
|
|
5810
|
+
const zone = parentToZone(parent);
|
|
5811
|
+
const destIndex = index != null ? index : getZoneLength(zone);
|
|
5812
|
+
const dispatch = getState().dispatch;
|
|
5813
|
+
dispatch(__spreadValues({
|
|
5814
|
+
type: "insert",
|
|
5815
|
+
componentType: type,
|
|
5816
|
+
destinationIndex: destIndex,
|
|
5817
|
+
destinationZone: zone,
|
|
5818
|
+
id
|
|
5819
|
+
}, data ? { data: __spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { id }) }) } : {}));
|
|
5820
|
+
if (select) {
|
|
5821
|
+
dispatch({
|
|
5822
|
+
type: "setUi",
|
|
5823
|
+
ui: { itemSelector: { index: destIndex, zone } }
|
|
5824
|
+
});
|
|
5825
|
+
}
|
|
5826
|
+
return { id };
|
|
5827
|
+
};
|
|
5828
|
+
const removeComponent = (id) => {
|
|
5829
|
+
const sel = getSelectorForId(getState().state, id);
|
|
5830
|
+
if (!(sel == null ? void 0 : sel.zone)) return;
|
|
5831
|
+
getState().dispatch({ type: "remove", index: sel.index, zone: sel.zone });
|
|
5832
|
+
};
|
|
5833
|
+
const duplicateComponent = (id) => {
|
|
5834
|
+
const sel = getSelectorForId(getState().state, id);
|
|
5835
|
+
if (!(sel == null ? void 0 : sel.zone)) return;
|
|
5836
|
+
getState().dispatch({
|
|
5837
|
+
type: "duplicate",
|
|
5838
|
+
sourceIndex: sel.index,
|
|
5839
|
+
sourceZone: sel.zone
|
|
5840
|
+
});
|
|
5841
|
+
};
|
|
5842
|
+
const moveComponent2 = (id, to) => {
|
|
5843
|
+
const sel = getSelectorForId(getState().state, id);
|
|
5844
|
+
if (!(sel == null ? void 0 : sel.zone)) return;
|
|
5845
|
+
getState().dispatch({
|
|
5846
|
+
type: "move",
|
|
5847
|
+
sourceIndex: sel.index,
|
|
5848
|
+
sourceZone: sel.zone,
|
|
5849
|
+
destinationIndex: to.index,
|
|
5850
|
+
destinationZone: parentToZone(to.parent)
|
|
5851
|
+
});
|
|
5852
|
+
};
|
|
5853
|
+
const replaceComponent = (id, data) => {
|
|
5854
|
+
const sel = getSelectorForId(getState().state, id);
|
|
5855
|
+
if (!(sel == null ? void 0 : sel.zone)) return;
|
|
5856
|
+
const existing = getItem(sel, getState().state);
|
|
5857
|
+
if (!existing) return;
|
|
5858
|
+
getState().dispatch({
|
|
5859
|
+
type: "replace",
|
|
5860
|
+
destinationIndex: sel.index,
|
|
5861
|
+
destinationZone: sel.zone,
|
|
5862
|
+
data: __spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { id: existing.props.id }) })
|
|
5863
|
+
});
|
|
5864
|
+
};
|
|
5865
|
+
const updateProps = (id, updater) => {
|
|
5866
|
+
const sel = getSelectorForId(getState().state, id);
|
|
5867
|
+
if (!sel) return;
|
|
5868
|
+
const existing = getItem(sel, getState().state);
|
|
5869
|
+
if (!existing) return;
|
|
5870
|
+
const patch = typeof updater === "function" ? updater(existing.props) : updater;
|
|
5871
|
+
getState().dispatch({
|
|
5872
|
+
type: "replace",
|
|
5873
|
+
destinationIndex: sel.index,
|
|
5874
|
+
destinationZone: sel.zone,
|
|
5875
|
+
data: __spreadProps(__spreadValues({}, existing), {
|
|
5876
|
+
props: __spreadProps(__spreadValues(__spreadValues({}, existing.props), patch), { id: existing.props.id })
|
|
5877
|
+
})
|
|
5878
|
+
});
|
|
5879
|
+
};
|
|
5880
|
+
const updateRoot = (updater) => {
|
|
5881
|
+
var _a, _b;
|
|
5882
|
+
const root = (_a = getState().state.data.root) != null ? _a : { props: {} };
|
|
5883
|
+
const prevProps = (_b = root.props) != null ? _b : {};
|
|
5884
|
+
const patch = typeof updater === "function" ? updater(prevProps) : updater;
|
|
5885
|
+
getState().dispatch({
|
|
5886
|
+
type: "replaceRoot",
|
|
5887
|
+
root: __spreadProps(__spreadValues({}, root), { props: __spreadValues(__spreadValues({}, prevProps), patch) })
|
|
5888
|
+
});
|
|
5889
|
+
};
|
|
5890
|
+
const scrollToComponent = (id) => {
|
|
5891
|
+
getState().scrollToComponent(id);
|
|
5892
|
+
};
|
|
5893
|
+
const selectComponent = (id) => {
|
|
5894
|
+
const dispatch = getState().dispatch;
|
|
5895
|
+
if (id === null) {
|
|
5896
|
+
dispatch({ type: "setUi", ui: { itemSelector: null } });
|
|
5897
|
+
return;
|
|
5898
|
+
}
|
|
5899
|
+
const sel = getSelectorForId(getState().state, id);
|
|
5900
|
+
if (!(sel == null ? void 0 : sel.zone)) return;
|
|
5901
|
+
dispatch({
|
|
5902
|
+
type: "setUi",
|
|
5903
|
+
ui: { itemSelector: { index: sel.index, zone: sel.zone } }
|
|
5904
|
+
});
|
|
5905
|
+
};
|
|
5906
|
+
return {
|
|
5907
|
+
insertComponent: insertComponent2,
|
|
5908
|
+
removeComponent,
|
|
5909
|
+
duplicateComponent,
|
|
5910
|
+
moveComponent: moveComponent2,
|
|
5911
|
+
replaceComponent,
|
|
5912
|
+
updateProps,
|
|
5913
|
+
updateRoot,
|
|
5914
|
+
selectComponent,
|
|
5915
|
+
scrollToComponent
|
|
5916
|
+
};
|
|
5917
|
+
};
|
|
5918
|
+
|
|
5682
5919
|
// lib/use-editor.ts
|
|
5683
|
-
var generateUseEditor = (store, getState) => {
|
|
5920
|
+
var generateUseEditor = (store, getState, commands) => {
|
|
5684
5921
|
const history = {
|
|
5685
5922
|
back: store.history.back,
|
|
5686
5923
|
forward: store.history.forward,
|
|
@@ -5691,7 +5928,7 @@ var generateUseEditor = (store, getState) => {
|
|
|
5691
5928
|
histories: store.history.histories,
|
|
5692
5929
|
index: store.history.index
|
|
5693
5930
|
};
|
|
5694
|
-
const storeData = {
|
|
5931
|
+
const storeData = __spreadProps(__spreadValues({}, commands), {
|
|
5695
5932
|
appState: makeStatePublic(store.state),
|
|
5696
5933
|
config: store.config,
|
|
5697
5934
|
dispatch: store.dispatch,
|
|
@@ -5712,7 +5949,7 @@ var generateUseEditor = (store, getState) => {
|
|
|
5712
5949
|
if (!parentNode) return;
|
|
5713
5950
|
return parentNode.data;
|
|
5714
5951
|
}
|
|
5715
|
-
};
|
|
5952
|
+
});
|
|
5716
5953
|
storeData.__private = {
|
|
5717
5954
|
appState: store.state
|
|
5718
5955
|
};
|
|
@@ -5732,11 +5969,13 @@ var convertToPickedStore = (store) => {
|
|
|
5732
5969
|
};
|
|
5733
5970
|
};
|
|
5734
5971
|
var useRegisterUseEditorStore = (appStore) => {
|
|
5972
|
+
const [commands] = useState16(() => createEditorCommands(appStore));
|
|
5735
5973
|
const [useEditorStore] = useState16(
|
|
5736
5974
|
() => createStore5(
|
|
5737
5975
|
() => generateUseEditor(
|
|
5738
5976
|
convertToPickedStore(appStore.getState()),
|
|
5739
|
-
appStore.getState
|
|
5977
|
+
appStore.getState,
|
|
5978
|
+
commands
|
|
5740
5979
|
)
|
|
5741
5980
|
)
|
|
5742
5981
|
);
|
|
@@ -5744,10 +5983,12 @@ var useRegisterUseEditorStore = (appStore) => {
|
|
|
5744
5983
|
return appStore.subscribe(
|
|
5745
5984
|
(store) => convertToPickedStore(store),
|
|
5746
5985
|
(pickedStore) => {
|
|
5747
|
-
useEditorStore.setState(
|
|
5986
|
+
useEditorStore.setState(
|
|
5987
|
+
generateUseEditor(pickedStore, appStore.getState, commands)
|
|
5988
|
+
);
|
|
5748
5989
|
}
|
|
5749
5990
|
);
|
|
5750
|
-
}, []);
|
|
5991
|
+
}, [commands]);
|
|
5751
5992
|
return useEditorStore;
|
|
5752
5993
|
};
|
|
5753
5994
|
function createUseEditor() {
|
|
@@ -5788,11 +6029,11 @@ import { useMemo as useMemo14, useState as useState17 } from "react";
|
|
|
5788
6029
|
|
|
5789
6030
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Components/styles.module.css#css-module
|
|
5790
6031
|
init_react_import();
|
|
5791
|
-
var
|
|
6032
|
+
var styles_module_default15 = { "Components-search": "_Components-search_recer_1", "Components-searchIcon": "_Components-searchIcon_recer_8", "Components-searchInput": "_Components-searchInput_recer_16", "Components-empty": "_Components-empty_recer_39" };
|
|
5792
6033
|
|
|
5793
6034
|
// components/Editor/components/Components/index.tsx
|
|
5794
|
-
import { jsx as
|
|
5795
|
-
var
|
|
6035
|
+
import { jsx as jsx36, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6036
|
+
var getClassName20 = get_class_name_factory_default("Components", styles_module_default15);
|
|
5796
6037
|
var Components = () => {
|
|
5797
6038
|
var _a;
|
|
5798
6039
|
const overrides = useAppStore((s) => s.overrides);
|
|
@@ -5827,23 +6068,23 @@ var Components = () => {
|
|
|
5827
6068
|
}
|
|
5828
6069
|
return Array.from(buckets.entries());
|
|
5829
6070
|
}, [components, search]);
|
|
5830
|
-
return /* @__PURE__ */
|
|
5831
|
-
/* @__PURE__ */
|
|
5832
|
-
/* @__PURE__ */
|
|
5833
|
-
/* @__PURE__ */
|
|
6071
|
+
return /* @__PURE__ */ jsxs13(Wrapper, { children: [
|
|
6072
|
+
/* @__PURE__ */ jsxs13("div", { className: getClassName20("search"), children: [
|
|
6073
|
+
/* @__PURE__ */ jsx36("div", { className: getClassName20("searchIcon"), children: /* @__PURE__ */ jsx36(Search, { size: 14 }) }),
|
|
6074
|
+
/* @__PURE__ */ jsx36(
|
|
5834
6075
|
"input",
|
|
5835
6076
|
{
|
|
5836
6077
|
type: "search",
|
|
5837
|
-
className:
|
|
6078
|
+
className: getClassName20("searchInput"),
|
|
5838
6079
|
placeholder: "search",
|
|
5839
6080
|
value: search,
|
|
5840
6081
|
onChange: (e) => setSearch(e.target.value)
|
|
5841
6082
|
}
|
|
5842
6083
|
)
|
|
5843
6084
|
] }),
|
|
5844
|
-
groups.length === 0 ? /* @__PURE__ */
|
|
6085
|
+
groups.length === 0 ? /* @__PURE__ */ jsx36("div", { className: getClassName20("empty"), children: "No results match your search" }) : groups.length <= 1 && !((_a = groups[0]) == null ? void 0 : _a[0]) ? /* @__PURE__ */ jsx36(ComponentList, { id: "all", children: groups[0][1].map(([name, conf]) => {
|
|
5845
6086
|
var _a2;
|
|
5846
|
-
return /* @__PURE__ */
|
|
6087
|
+
return /* @__PURE__ */ jsx36(
|
|
5847
6088
|
ComponentList.Item,
|
|
5848
6089
|
{
|
|
5849
6090
|
name,
|
|
@@ -5856,14 +6097,14 @@ var Components = () => {
|
|
|
5856
6097
|
var _a2, _b;
|
|
5857
6098
|
const categoryKey = category != null ? category : "other";
|
|
5858
6099
|
const title = (_b = (_a2 = categoriesConfig == null ? void 0 : categoriesConfig[categoryKey]) == null ? void 0 : _a2.title) != null ? _b : category != null ? category : "Other";
|
|
5859
|
-
return /* @__PURE__ */
|
|
6100
|
+
return /* @__PURE__ */ jsx36(
|
|
5860
6101
|
ComponentList,
|
|
5861
6102
|
{
|
|
5862
6103
|
id: categoryKey,
|
|
5863
6104
|
title,
|
|
5864
6105
|
children: entries.map(([name, conf]) => {
|
|
5865
6106
|
var _a3;
|
|
5866
|
-
return /* @__PURE__ */
|
|
6107
|
+
return /* @__PURE__ */ jsx36(
|
|
5867
6108
|
ComponentList.Item,
|
|
5868
6109
|
{
|
|
5869
6110
|
name,
|
|
@@ -5882,16 +6123,16 @@ var Components = () => {
|
|
|
5882
6123
|
|
|
5883
6124
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/blocks/styles.module.css#css-module
|
|
5884
6125
|
init_react_import();
|
|
5885
|
-
var
|
|
6126
|
+
var styles_module_default16 = { "BlocksPlugin": "_BlocksPlugin_15ud0_1" };
|
|
5886
6127
|
|
|
5887
6128
|
// plugins/blocks/index.tsx
|
|
5888
|
-
import { jsx as
|
|
5889
|
-
var
|
|
6129
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
6130
|
+
var getClassName21 = get_class_name_factory_default("BlocksPlugin", styles_module_default16);
|
|
5890
6131
|
var blocksPlugin = () => ({
|
|
5891
6132
|
name: "blocks",
|
|
5892
6133
|
label: "Blocks",
|
|
5893
|
-
render: () => /* @__PURE__ */
|
|
5894
|
-
icon: /* @__PURE__ */
|
|
6134
|
+
render: () => /* @__PURE__ */ jsx37("div", { className: getClassName21(), children: /* @__PURE__ */ jsx37(Components, {}) }),
|
|
6135
|
+
icon: /* @__PURE__ */ jsx37(Plus, {})
|
|
5895
6136
|
});
|
|
5896
6137
|
|
|
5897
6138
|
// plugins/outline/index.tsx
|
|
@@ -5905,19 +6146,19 @@ init_react_import();
|
|
|
5905
6146
|
|
|
5906
6147
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/LayerTree/styles.module.css#css-module
|
|
5907
6148
|
init_react_import();
|
|
5908
|
-
var
|
|
6149
|
+
var styles_module_default17 = { "LayerTree": "_LayerTree_3eixb_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_3eixb_11", "LayerTree-helper": "_LayerTree-helper_3eixb_17", "Layer": "_Layer_3eixb_1", "Layer-inner": "_Layer-inner_3eixb_34", "Layer--containsZone": "_Layer--containsZone_3eixb_42", "Layer-clickable": "_Layer-clickable_3eixb_46", "Layer--isSelected": "_Layer--isSelected_3eixb_68", "Layer-icon": "_Layer-icon_3eixb_80", "Layer-zoneIcon": "_Layer-zoneIcon_3eixb_81", "Layer-chevron": "_Layer-chevron_3eixb_85", "Layer--childIsSelected": "_Layer--childIsSelected_3eixb_97", "Layer-zones": "_Layer-zones_3eixb_101", "Layer-title": "_Layer-title_3eixb_117", "Layer-name": "_Layer-name_3eixb_130", "Layer--isGlobal": "_Layer--isGlobal_3eixb_150", "Layer--isUnlinked": "_Layer--isUnlinked_3eixb_171", "Layer-unlinkedGlyph": "_Layer-unlinkedGlyph_3eixb_175" };
|
|
5909
6150
|
|
|
5910
6151
|
// components/LayerTree/index.tsx
|
|
5911
6152
|
import {
|
|
5912
6153
|
forwardRef as forwardRef2,
|
|
5913
|
-
useCallback as
|
|
6154
|
+
useCallback as useCallback15,
|
|
5914
6155
|
useContext as useContext11,
|
|
5915
|
-
useRef as
|
|
6156
|
+
useRef as useRef11
|
|
5916
6157
|
} from "react";
|
|
5917
6158
|
import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
|
|
5918
|
-
import { Fragment as Fragment8, jsx as
|
|
5919
|
-
var
|
|
5920
|
-
var getClassNameLayer = get_class_name_factory_default("Layer",
|
|
6159
|
+
import { Fragment as Fragment8, jsx as jsx38, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
6160
|
+
var getClassName22 = get_class_name_factory_default("LayerTree", styles_module_default17);
|
|
6161
|
+
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default17);
|
|
5921
6162
|
var DEFAULT_LAYER_ROW_HEIGHT = 32;
|
|
5922
6163
|
var LAYER_TREE_VIRTUALIZATION_OVERSCAN = 8;
|
|
5923
6164
|
var MIN_VIRTUALIZED_LAYER_COUNT = 25;
|
|
@@ -6049,14 +6290,14 @@ var Layer = forwardRef2(function Layer2({
|
|
|
6049
6290
|
}
|
|
6050
6291
|
);
|
|
6051
6292
|
const containsZone = node.childZones.length > 0;
|
|
6052
|
-
const setItemSelector =
|
|
6293
|
+
const setItemSelector = useCallback15(
|
|
6053
6294
|
(itemSelector) => {
|
|
6054
6295
|
dispatch({ type: "setUi", ui: { itemSelector } });
|
|
6055
6296
|
},
|
|
6056
6297
|
[dispatch]
|
|
6057
6298
|
);
|
|
6058
6299
|
const shouldRenderChildren = isSelected || childIsSelected;
|
|
6059
|
-
return /* @__PURE__ */
|
|
6300
|
+
return /* @__PURE__ */ jsxs14(
|
|
6060
6301
|
"li",
|
|
6061
6302
|
{
|
|
6062
6303
|
ref,
|
|
@@ -6071,7 +6312,7 @@ var Layer = forwardRef2(function Layer2({
|
|
|
6071
6312
|
"data-index": dataIndex,
|
|
6072
6313
|
"data-editor-layer-tree-id": node.itemId,
|
|
6073
6314
|
children: [
|
|
6074
|
-
/* @__PURE__ */
|
|
6315
|
+
/* @__PURE__ */ jsx38("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs14(
|
|
6075
6316
|
"button",
|
|
6076
6317
|
{
|
|
6077
6318
|
type: "button",
|
|
@@ -6096,34 +6337,34 @@ var Layer = forwardRef2(function Layer2({
|
|
|
6096
6337
|
zoneStore.setState({ hoveringComponent: null });
|
|
6097
6338
|
},
|
|
6098
6339
|
children: [
|
|
6099
|
-
/* @__PURE__ */
|
|
6340
|
+
/* @__PURE__ */ jsx38(
|
|
6100
6341
|
"div",
|
|
6101
6342
|
{
|
|
6102
6343
|
className: getClassNameLayer("chevron"),
|
|
6103
6344
|
title: containsZone ? isSelected ? "Collapse" : "Expand" : void 0,
|
|
6104
|
-
children: containsZone && /* @__PURE__ */
|
|
6345
|
+
children: containsZone && /* @__PURE__ */ jsx38(ChevronRight, { size: "12" })
|
|
6105
6346
|
}
|
|
6106
6347
|
),
|
|
6107
|
-
/* @__PURE__ */
|
|
6108
|
-
/* @__PURE__ */
|
|
6109
|
-
/* @__PURE__ */
|
|
6110
|
-
isGlobal && isUnlinked && /* @__PURE__ */
|
|
6348
|
+
/* @__PURE__ */ jsxs14("div", { className: getClassNameLayer("title"), children: [
|
|
6349
|
+
/* @__PURE__ */ jsx38("div", { className: getClassNameLayer("icon"), children: /* @__PURE__ */ jsx38(Component, { size: "16" }) }),
|
|
6350
|
+
/* @__PURE__ */ jsx38("div", { className: getClassNameLayer("name"), children: node.label }),
|
|
6351
|
+
isGlobal && isUnlinked && /* @__PURE__ */ jsx38(
|
|
6111
6352
|
"div",
|
|
6112
6353
|
{
|
|
6113
6354
|
className: getClassNameLayer("unlinkedGlyph"),
|
|
6114
6355
|
title: "Unlinked from shared",
|
|
6115
|
-
children: /* @__PURE__ */
|
|
6356
|
+
children: /* @__PURE__ */ jsx38(Unlink2, { size: "12" })
|
|
6116
6357
|
}
|
|
6117
6358
|
)
|
|
6118
6359
|
] })
|
|
6119
6360
|
]
|
|
6120
6361
|
}
|
|
6121
6362
|
) }),
|
|
6122
|
-
containsZone && shouldRenderChildren && node.childZones.map((childZone) => /* @__PURE__ */
|
|
6363
|
+
containsZone && shouldRenderChildren && node.childZones.map((childZone) => /* @__PURE__ */ jsx38(
|
|
6123
6364
|
"div",
|
|
6124
6365
|
{
|
|
6125
6366
|
className: getClassNameLayer("zones"),
|
|
6126
|
-
children: /* @__PURE__ */
|
|
6367
|
+
children: /* @__PURE__ */ jsx38(
|
|
6127
6368
|
LayerTreeZone,
|
|
6128
6369
|
{
|
|
6129
6370
|
depth: depth + 1,
|
|
@@ -6146,9 +6387,9 @@ var LayerTreeZone = ({
|
|
|
6146
6387
|
tree
|
|
6147
6388
|
}) => {
|
|
6148
6389
|
const shouldVirtualize = depth === 0 && tree.items.length >= MIN_VIRTUALIZED_LAYER_COUNT;
|
|
6149
|
-
return /* @__PURE__ */
|
|
6150
|
-
tree.label && /* @__PURE__ */
|
|
6151
|
-
shouldVirtualize ? /* @__PURE__ */
|
|
6390
|
+
return /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
6391
|
+
tree.label && /* @__PURE__ */ jsx38("div", { className: getClassName22("zoneTitle"), children: tree.label }),
|
|
6392
|
+
shouldVirtualize ? /* @__PURE__ */ jsx38(
|
|
6152
6393
|
VirtualizedLayerTreeItems,
|
|
6153
6394
|
{
|
|
6154
6395
|
depth,
|
|
@@ -6156,7 +6397,7 @@ var LayerTreeZone = ({
|
|
|
6156
6397
|
selectedPathIds,
|
|
6157
6398
|
tree
|
|
6158
6399
|
}
|
|
6159
|
-
) : /* @__PURE__ */
|
|
6400
|
+
) : /* @__PURE__ */ jsx38(
|
|
6160
6401
|
StaticLayerTreeItems,
|
|
6161
6402
|
{
|
|
6162
6403
|
depth,
|
|
@@ -6173,9 +6414,9 @@ var StaticLayerTreeItems = ({
|
|
|
6173
6414
|
selectedPathIds,
|
|
6174
6415
|
tree
|
|
6175
6416
|
}) => {
|
|
6176
|
-
return /* @__PURE__ */
|
|
6177
|
-
tree.items.length === 0 && /* @__PURE__ */
|
|
6178
|
-
tree.items.map((node) => /* @__PURE__ */
|
|
6417
|
+
return /* @__PURE__ */ jsxs14("ul", { className: getClassName22(), children: [
|
|
6418
|
+
tree.items.length === 0 && /* @__PURE__ */ jsx38("div", { className: getClassName22("helper"), children: "empty" }),
|
|
6419
|
+
tree.items.map((node) => /* @__PURE__ */ jsx38(
|
|
6179
6420
|
Layer,
|
|
6180
6421
|
{
|
|
6181
6422
|
childIsSelected: selectedPathIds.has(node.itemId),
|
|
@@ -6195,7 +6436,7 @@ var VirtualizedLayerTreeItems = ({
|
|
|
6195
6436
|
selectedPathIds,
|
|
6196
6437
|
tree
|
|
6197
6438
|
}) => {
|
|
6198
|
-
const listRef =
|
|
6439
|
+
const listRef = useRef11(null);
|
|
6199
6440
|
const virtualizer = useVirtualizer2({
|
|
6200
6441
|
count: tree.items.length,
|
|
6201
6442
|
estimateSize: (index) => getEstimatedRowHeight(tree.items[index].itemId),
|
|
@@ -6221,7 +6462,7 @@ var VirtualizedLayerTreeItems = ({
|
|
|
6221
6462
|
const gapSize = Math.max(virtualItem.start - previousEnd, 0);
|
|
6222
6463
|
if (gapSize > 0) {
|
|
6223
6464
|
renderedItems.push(
|
|
6224
|
-
/* @__PURE__ */
|
|
6465
|
+
/* @__PURE__ */ jsx38(
|
|
6225
6466
|
"li",
|
|
6226
6467
|
{
|
|
6227
6468
|
"aria-hidden": "true",
|
|
@@ -6232,7 +6473,7 @@ var VirtualizedLayerTreeItems = ({
|
|
|
6232
6473
|
);
|
|
6233
6474
|
}
|
|
6234
6475
|
renderedItems.push(
|
|
6235
|
-
/* @__PURE__ */
|
|
6476
|
+
/* @__PURE__ */ jsx38(
|
|
6236
6477
|
Layer,
|
|
6237
6478
|
{
|
|
6238
6479
|
childIsSelected: selectedPathIds.has(node.itemId),
|
|
@@ -6253,7 +6494,7 @@ var VirtualizedLayerTreeItems = ({
|
|
|
6253
6494
|
const trailingGap = Math.max(totalSize - previousEnd, 0);
|
|
6254
6495
|
if (trailingGap > 0) {
|
|
6255
6496
|
renderedItems.push(
|
|
6256
|
-
/* @__PURE__ */
|
|
6497
|
+
/* @__PURE__ */ jsx38(
|
|
6257
6498
|
"li",
|
|
6258
6499
|
{
|
|
6259
6500
|
"aria-hidden": "true",
|
|
@@ -6263,8 +6504,8 @@ var VirtualizedLayerTreeItems = ({
|
|
|
6263
6504
|
)
|
|
6264
6505
|
);
|
|
6265
6506
|
}
|
|
6266
|
-
return /* @__PURE__ */
|
|
6267
|
-
tree.items.length === 0 && /* @__PURE__ */
|
|
6507
|
+
return /* @__PURE__ */ jsxs14("ul", { className: getClassName22(), ref: listRef, children: [
|
|
6508
|
+
tree.items.length === 0 && /* @__PURE__ */ jsx38("div", { className: getClassName22("helper"), children: "empty" }),
|
|
6268
6509
|
renderedItems
|
|
6269
6510
|
] });
|
|
6270
6511
|
};
|
|
@@ -6273,7 +6514,7 @@ var LayerTree = ({
|
|
|
6273
6514
|
selectedPathIds,
|
|
6274
6515
|
trees
|
|
6275
6516
|
}) => {
|
|
6276
|
-
return /* @__PURE__ */
|
|
6517
|
+
return /* @__PURE__ */ jsx38(Fragment8, { children: trees.map((tree) => /* @__PURE__ */ jsx38(
|
|
6277
6518
|
LayerTreeZone,
|
|
6278
6519
|
{
|
|
6279
6520
|
depth: 0,
|
|
@@ -6298,7 +6539,7 @@ var findZonesForArea = (state, area) => {
|
|
|
6298
6539
|
|
|
6299
6540
|
// components/Editor/components/Outline/index.tsx
|
|
6300
6541
|
import { useShallow as useShallow7 } from "zustand/react/shallow";
|
|
6301
|
-
import { jsx as
|
|
6542
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
6302
6543
|
var Outline = () => {
|
|
6303
6544
|
const outlineOverride = useAppStore((s) => s.overrides.outline);
|
|
6304
6545
|
const config = useAppStore((s) => s.config);
|
|
@@ -6331,7 +6572,7 @@ var Outline = () => {
|
|
|
6331
6572
|
[config, nodes, rootZones, zones]
|
|
6332
6573
|
);
|
|
6333
6574
|
const Wrapper = useMemo15(() => outlineOverride || "div", [outlineOverride]);
|
|
6334
|
-
return /* @__PURE__ */
|
|
6575
|
+
return /* @__PURE__ */ jsx39(Wrapper, { children: /* @__PURE__ */ jsx39(
|
|
6335
6576
|
LayerTree,
|
|
6336
6577
|
{
|
|
6337
6578
|
selectedId,
|
|
@@ -6343,16 +6584,16 @@ var Outline = () => {
|
|
|
6343
6584
|
|
|
6344
6585
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/outline/styles.module.css#css-module
|
|
6345
6586
|
init_react_import();
|
|
6346
|
-
var
|
|
6587
|
+
var styles_module_default18 = { "OutlinePlugin": "_OutlinePlugin_q92j6_1" };
|
|
6347
6588
|
|
|
6348
6589
|
// plugins/outline/index.tsx
|
|
6349
|
-
import { jsx as
|
|
6350
|
-
var
|
|
6590
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
6591
|
+
var getClassName23 = get_class_name_factory_default("OutlinePlugin", styles_module_default18);
|
|
6351
6592
|
var outlinePlugin = () => ({
|
|
6352
6593
|
name: "outline",
|
|
6353
6594
|
label: "Outline",
|
|
6354
|
-
render: () => /* @__PURE__ */
|
|
6355
|
-
icon: /* @__PURE__ */
|
|
6595
|
+
render: () => /* @__PURE__ */ jsx40("div", { className: getClassName23(), children: /* @__PURE__ */ jsx40(Outline, {}) }),
|
|
6596
|
+
icon: /* @__PURE__ */ jsx40(Layers, {})
|
|
6356
6597
|
});
|
|
6357
6598
|
|
|
6358
6599
|
// plugins/fields/index.tsx
|
|
@@ -6363,7 +6604,7 @@ init_react_import();
|
|
|
6363
6604
|
|
|
6364
6605
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Breadcrumbs/styles.module.css#css-module
|
|
6365
6606
|
init_react_import();
|
|
6366
|
-
var
|
|
6607
|
+
var styles_module_default19 = { "Breadcrumbs": "_Breadcrumbs_1cjxk_1", "Breadcrumbs-breadcrumb": "_Breadcrumbs-breadcrumb_1cjxk_10", "Breadcrumbs-breadcrumbLabel": "_Breadcrumbs-breadcrumbLabel_1cjxk_17" };
|
|
6367
6608
|
|
|
6368
6609
|
// lib/use-breadcrumbs.ts
|
|
6369
6610
|
init_react_import();
|
|
@@ -6410,26 +6651,26 @@ var useBreadcrumbs = (renderCount) => {
|
|
|
6410
6651
|
};
|
|
6411
6652
|
|
|
6412
6653
|
// components/Breadcrumbs/index.tsx
|
|
6413
|
-
import { jsx as
|
|
6414
|
-
var
|
|
6654
|
+
import { jsx as jsx41, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
6655
|
+
var getClassName24 = get_class_name_factory_default("Breadcrumbs", styles_module_default19);
|
|
6415
6656
|
var Breadcrumbs = ({
|
|
6416
6657
|
children,
|
|
6417
6658
|
numParents = 1
|
|
6418
6659
|
}) => {
|
|
6419
6660
|
const setUi = useAppStore((s) => s.setUi);
|
|
6420
6661
|
const breadcrumbs = useBreadcrumbs(numParents);
|
|
6421
|
-
return /* @__PURE__ */
|
|
6422
|
-
breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */
|
|
6423
|
-
/* @__PURE__ */
|
|
6662
|
+
return /* @__PURE__ */ jsxs15("div", { className: getClassName24(), children: [
|
|
6663
|
+
breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs15("div", { className: getClassName24("breadcrumb"), children: [
|
|
6664
|
+
/* @__PURE__ */ jsx41(
|
|
6424
6665
|
"button",
|
|
6425
6666
|
{
|
|
6426
6667
|
type: "button",
|
|
6427
|
-
className:
|
|
6668
|
+
className: getClassName24("breadcrumbLabel"),
|
|
6428
6669
|
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
|
6429
6670
|
children: breadcrumb.label
|
|
6430
6671
|
}
|
|
6431
6672
|
),
|
|
6432
|
-
/* @__PURE__ */
|
|
6673
|
+
/* @__PURE__ */ jsx41(ChevronRight, { size: 14 })
|
|
6433
6674
|
] }, i)),
|
|
6434
6675
|
children
|
|
6435
6676
|
] });
|
|
@@ -6440,23 +6681,23 @@ init_react_import();
|
|
|
6440
6681
|
|
|
6441
6682
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Fields/styles.module.css#css-module
|
|
6442
6683
|
init_react_import();
|
|
6443
|
-
var
|
|
6684
|
+
var styles_module_default20 = { "EditorFields": "_EditorFields_3dnua_1", "EditorFields--isLoading": "_EditorFields--isLoading_3dnua_6", "EditorFields-loadingOverlay": "_EditorFields-loadingOverlay_3dnua_10", "EditorFields-loadingOverlayInner": "_EditorFields-loadingOverlayInner_3dnua_25", "EditorFields-field": "_EditorFields-field_3dnua_32", "EditorFields--wrapFields": "_EditorFields--wrapFields_3dnua_36", "EditorFields-syncButton": "_EditorFields-syncButton_3dnua_46", "EditorFields-syncButton--unlinked": "_EditorFields-syncButton--unlinked_3dnua_78" };
|
|
6444
6685
|
|
|
6445
6686
|
// components/Editor/components/Fields/index.tsx
|
|
6446
6687
|
import {
|
|
6447
6688
|
memo as memo8,
|
|
6448
|
-
useCallback as
|
|
6689
|
+
useCallback as useCallback16,
|
|
6449
6690
|
useContext as useContext12,
|
|
6450
6691
|
useEffect as useEffect19,
|
|
6451
6692
|
useMemo as useMemo17
|
|
6452
6693
|
} from "react";
|
|
6453
6694
|
import { useShallow as useShallow8 } from "zustand/react/shallow";
|
|
6454
|
-
import { Fragment as Fragment9, jsx as
|
|
6455
|
-
var
|
|
6695
|
+
import { Fragment as Fragment9, jsx as jsx42, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6696
|
+
var getClassName25 = get_class_name_factory_default("EditorFields", styles_module_default20);
|
|
6456
6697
|
var DefaultFields = ({
|
|
6457
6698
|
children
|
|
6458
6699
|
}) => {
|
|
6459
|
-
return /* @__PURE__ */
|
|
6700
|
+
return /* @__PURE__ */ jsx42(Fragment9, { children });
|
|
6460
6701
|
};
|
|
6461
6702
|
var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
|
|
6462
6703
|
const { dispatch, state, selectedItem, resolveComponentData } = appStore.getState();
|
|
@@ -6517,7 +6758,7 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
6517
6758
|
})
|
|
6518
6759
|
);
|
|
6519
6760
|
const appStore = useAppStoreApi();
|
|
6520
|
-
const onChange =
|
|
6761
|
+
const onChange = useCallback16(createOnChange(fieldName, appStore), [
|
|
6521
6762
|
fieldName
|
|
6522
6763
|
]);
|
|
6523
6764
|
const { visible = true } = field != null ? field : {};
|
|
@@ -6536,7 +6777,7 @@ var FieldsChildInner = ({ fieldName }) => {
|
|
|
6536
6777
|
}, [appStore, fieldStore]);
|
|
6537
6778
|
if (!field || !id || !visible) return null;
|
|
6538
6779
|
if (field.type === "slot") return null;
|
|
6539
|
-
return /* @__PURE__ */
|
|
6780
|
+
return /* @__PURE__ */ jsx42("div", { className: getClassName25("field"), children: /* @__PURE__ */ jsx42(
|
|
6540
6781
|
AutoFieldPrivate,
|
|
6541
6782
|
{
|
|
6542
6783
|
field,
|
|
@@ -6554,7 +6795,7 @@ var FieldsChild = ({ fieldName }) => {
|
|
|
6554
6795
|
const value = (_a = appStore.getState().getCurrentData().props) == null ? void 0 : _a[fieldName];
|
|
6555
6796
|
return { [fieldName]: value };
|
|
6556
6797
|
}, []);
|
|
6557
|
-
return /* @__PURE__ */
|
|
6798
|
+
return /* @__PURE__ */ jsx42(fieldContextStore.Provider, { value: initialValue, children: /* @__PURE__ */ jsx42(FieldsChildInner, { fieldName }) });
|
|
6558
6799
|
};
|
|
6559
6800
|
var FieldsChildMemo = memo8(FieldsChild);
|
|
6560
6801
|
var GlobalSyncButton = () => {
|
|
@@ -6584,12 +6825,12 @@ var GlobalSyncButton = () => {
|
|
|
6584
6825
|
});
|
|
6585
6826
|
});
|
|
6586
6827
|
const syncButtonClass = [
|
|
6587
|
-
|
|
6588
|
-
isUnlinked ?
|
|
6828
|
+
getClassName25("syncButton"),
|
|
6829
|
+
isUnlinked ? styles_module_default20["EditorFields-syncButton--unlinked"] : null
|
|
6589
6830
|
].filter(Boolean).join(" ");
|
|
6590
|
-
return /* @__PURE__ */
|
|
6591
|
-
/* @__PURE__ */
|
|
6592
|
-
/* @__PURE__ */
|
|
6831
|
+
return /* @__PURE__ */ jsxs16("button", { type: "button", className: syncButtonClass, onClick, children: [
|
|
6832
|
+
/* @__PURE__ */ jsx42(Link, { size: 14 }),
|
|
6833
|
+
/* @__PURE__ */ jsx42("span", { children: isUnlinked ? "Link to shared" : "Linked to shared" })
|
|
6593
6834
|
] });
|
|
6594
6835
|
};
|
|
6595
6836
|
var FieldsInternal = ({ wrapFields = true }) => {
|
|
@@ -6617,19 +6858,19 @@ var FieldsInternal = ({ wrapFields = true }) => {
|
|
|
6617
6858
|
);
|
|
6618
6859
|
const isLoading = fieldsLoading || componentResolving;
|
|
6619
6860
|
const Wrapper = useMemo17(() => overrides.fields || DefaultFields, [overrides]);
|
|
6620
|
-
return /* @__PURE__ */
|
|
6861
|
+
return /* @__PURE__ */ jsxs16(
|
|
6621
6862
|
"form",
|
|
6622
6863
|
{
|
|
6623
|
-
className:
|
|
6864
|
+
className: getClassName25({ wrapFields }),
|
|
6624
6865
|
onSubmit: (e) => {
|
|
6625
6866
|
e.preventDefault();
|
|
6626
6867
|
},
|
|
6627
6868
|
children: [
|
|
6628
|
-
/* @__PURE__ */
|
|
6629
|
-
/* @__PURE__ */
|
|
6630
|
-
fieldNames.map((fieldName) => /* @__PURE__ */
|
|
6869
|
+
/* @__PURE__ */ jsxs16(Wrapper, { isLoading, itemSelector, children: [
|
|
6870
|
+
/* @__PURE__ */ jsx42(GlobalSyncButton, {}),
|
|
6871
|
+
fieldNames.map((fieldName) => /* @__PURE__ */ jsx42(FieldsChildMemo, { fieldName }, fieldName))
|
|
6631
6872
|
] }),
|
|
6632
|
-
isLoading && /* @__PURE__ */
|
|
6873
|
+
isLoading && /* @__PURE__ */ jsx42("div", { className: getClassName25("loadingOverlay"), children: /* @__PURE__ */ jsx42("div", { className: getClassName25("loadingOverlayInner"), children: /* @__PURE__ */ jsx42(Loader, { size: 16 }) }) })
|
|
6633
6874
|
]
|
|
6634
6875
|
}
|
|
6635
6876
|
);
|
|
@@ -6638,11 +6879,11 @@ var Fields = memo8(FieldsInternal);
|
|
|
6638
6879
|
|
|
6639
6880
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css#css-module
|
|
6640
6881
|
init_react_import();
|
|
6641
|
-
var
|
|
6882
|
+
var styles_module_default21 = { "FieldsPlugin": "_FieldsPlugin_262zt_1", "FieldsPlugin-header": "_FieldsPlugin-header_262zt_7" };
|
|
6642
6883
|
|
|
6643
6884
|
// plugins/fields/index.tsx
|
|
6644
|
-
import { jsx as
|
|
6645
|
-
var
|
|
6885
|
+
import { jsx as jsx43, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6886
|
+
var getClassName26 = get_class_name_factory_default("FieldsPlugin", styles_module_default21);
|
|
6646
6887
|
var CurrentTitle = () => {
|
|
6647
6888
|
const label = useAppStore((s) => {
|
|
6648
6889
|
var _a, _b;
|
|
@@ -6654,11 +6895,11 @@ var CurrentTitle = () => {
|
|
|
6654
6895
|
var fieldsPlugin = ({ desktopSideBar = "right" } = {}) => ({
|
|
6655
6896
|
name: "fields",
|
|
6656
6897
|
label: "Fields",
|
|
6657
|
-
render: () => /* @__PURE__ */
|
|
6658
|
-
/* @__PURE__ */
|
|
6659
|
-
/* @__PURE__ */
|
|
6898
|
+
render: () => /* @__PURE__ */ jsxs17("div", { className: getClassName26(), children: [
|
|
6899
|
+
/* @__PURE__ */ jsx43("div", { className: getClassName26("header"), children: /* @__PURE__ */ jsx43(Breadcrumbs, { numParents: 2, children: /* @__PURE__ */ jsx43(CurrentTitle, {}) }) }),
|
|
6900
|
+
/* @__PURE__ */ jsx43(Fields, {})
|
|
6660
6901
|
] }),
|
|
6661
|
-
icon: /* @__PURE__ */
|
|
6902
|
+
icon: /* @__PURE__ */ jsx43(RectangleEllipsis, {}),
|
|
6662
6903
|
mobileOnly: desktopSideBar === "right"
|
|
6663
6904
|
});
|
|
6664
6905
|
|
|
@@ -6666,17 +6907,17 @@ var fieldsPlugin = ({ desktopSideBar = "right" } = {}) => ({
|
|
|
6666
6907
|
init_react_import();
|
|
6667
6908
|
import {
|
|
6668
6909
|
createContext as createContext8,
|
|
6669
|
-
useCallback as
|
|
6910
|
+
useCallback as useCallback25,
|
|
6670
6911
|
useContext as useContext15,
|
|
6671
6912
|
useEffect as useEffect26,
|
|
6672
6913
|
useMemo as useMemo24,
|
|
6673
|
-
useRef as
|
|
6914
|
+
useRef as useRef19,
|
|
6674
6915
|
useState as useState24
|
|
6675
6916
|
} from "react";
|
|
6676
6917
|
|
|
6677
6918
|
// components/Editor/components/Preview/index.tsx
|
|
6678
6919
|
init_react_import();
|
|
6679
|
-
import { useCallback as
|
|
6920
|
+
import { useCallback as useCallback17, useEffect as useEffect21, useRef as useRef12, useMemo as useMemo18 } from "react";
|
|
6680
6921
|
|
|
6681
6922
|
// components/AutoFrame/index.tsx
|
|
6682
6923
|
init_react_import();
|
|
@@ -6688,7 +6929,7 @@ import {
|
|
|
6688
6929
|
} from "react";
|
|
6689
6930
|
import hash from "object-hash";
|
|
6690
6931
|
import { createPortal as createPortal3 } from "react-dom";
|
|
6691
|
-
import { Fragment as Fragment10, jsx as
|
|
6932
|
+
import { Fragment as Fragment10, jsx as jsx44 } from "react/jsx-runtime";
|
|
6692
6933
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
|
6693
6934
|
var collectStyles = (doc) => {
|
|
6694
6935
|
const collected = [];
|
|
@@ -6905,7 +7146,7 @@ var CopyHostStyles = ({
|
|
|
6905
7146
|
observer.disconnect();
|
|
6906
7147
|
};
|
|
6907
7148
|
}, []);
|
|
6908
|
-
return /* @__PURE__ */
|
|
7149
|
+
return /* @__PURE__ */ jsx44(Fragment10, { children });
|
|
6909
7150
|
};
|
|
6910
7151
|
var autoFrameContext = createContext6({});
|
|
6911
7152
|
var useFrame = () => useContext13(autoFrameContext);
|
|
@@ -6952,7 +7193,7 @@ function AutoFrame(_a) {
|
|
|
6952
7193
|
}
|
|
6953
7194
|
}
|
|
6954
7195
|
}, [frameRef, loaded, stylesLoaded]);
|
|
6955
|
-
return /* @__PURE__ */
|
|
7196
|
+
return /* @__PURE__ */ jsx44(
|
|
6956
7197
|
"iframe",
|
|
6957
7198
|
__spreadProps(__spreadValues({}, props), {
|
|
6958
7199
|
className,
|
|
@@ -6962,7 +7203,7 @@ function AutoFrame(_a) {
|
|
|
6962
7203
|
onLoad: () => {
|
|
6963
7204
|
setLoaded(true);
|
|
6964
7205
|
},
|
|
6965
|
-
children: /* @__PURE__ */
|
|
7206
|
+
children: /* @__PURE__ */ jsx44(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx44(
|
|
6966
7207
|
CopyHostStyles,
|
|
6967
7208
|
{
|
|
6968
7209
|
debug,
|
|
@@ -6978,11 +7219,11 @@ var AutoFrame_default = AutoFrame;
|
|
|
6978
7219
|
|
|
6979
7220
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Preview/styles.module.css#css-module
|
|
6980
7221
|
init_react_import();
|
|
6981
|
-
var
|
|
7222
|
+
var styles_module_default22 = { "EditorPreview": "_EditorPreview_xou64_1", "EditorPreview-frame": "_EditorPreview-frame_xou64_6" };
|
|
6982
7223
|
|
|
6983
7224
|
// components/Editor/components/Preview/index.tsx
|
|
6984
|
-
import { Fragment as Fragment11, jsx as
|
|
6985
|
-
var
|
|
7225
|
+
import { Fragment as Fragment11, jsx as jsx45 } from "react/jsx-runtime";
|
|
7226
|
+
var getClassName27 = get_class_name_factory_default("EditorPreview", styles_module_default22);
|
|
6986
7227
|
var Preview2 = ({ id = "editor-preview" }) => {
|
|
6987
7228
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
6988
7229
|
const root = useAppStore((s) => s.state.data.root);
|
|
@@ -6994,7 +7235,7 @@ var Preview2 = ({ id = "editor-preview" }) => {
|
|
|
6994
7235
|
const renderData = useAppStore(
|
|
6995
7236
|
(s) => s.state.ui.previewMode === "edit" ? null : s.state.data
|
|
6996
7237
|
);
|
|
6997
|
-
const Page =
|
|
7238
|
+
const Page = useCallback17(
|
|
6998
7239
|
(pageProps) => {
|
|
6999
7240
|
var _a, _b, _c, _d;
|
|
7000
7241
|
const propsWithSlots = useSlots(
|
|
@@ -7008,14 +7249,14 @@ var Preview2 = ({ id = "editor-preview" }) => {
|
|
|
7008
7249
|
);
|
|
7009
7250
|
return ((_c = config.root) == null ? void 0 : _c.render) ? (_d = config.root) == null ? void 0 : _d.render(__spreadValues(__spreadValues({
|
|
7010
7251
|
id: "editor-root"
|
|
7011
|
-
}, propsWithSlots), richtextProps)) : /* @__PURE__ */
|
|
7252
|
+
}, propsWithSlots), richtextProps)) : /* @__PURE__ */ jsx45(Fragment11, { children: propsWithSlots.children });
|
|
7012
7253
|
},
|
|
7013
7254
|
[config]
|
|
7014
7255
|
);
|
|
7015
7256
|
const Frame = useMemo18(() => overrides.iframe, [overrides]);
|
|
7016
7257
|
const rootProps = root.props || root;
|
|
7017
|
-
const ref =
|
|
7018
|
-
const inner = !renderData ? /* @__PURE__ */
|
|
7258
|
+
const ref = useRef12(null);
|
|
7259
|
+
const inner = !renderData ? /* @__PURE__ */ jsx45(
|
|
7019
7260
|
Page,
|
|
7020
7261
|
__spreadProps(__spreadValues({}, rootProps), {
|
|
7021
7262
|
editor: {
|
|
@@ -7025,18 +7266,18 @@ var Preview2 = ({ id = "editor-preview" }) => {
|
|
|
7025
7266
|
metadata
|
|
7026
7267
|
},
|
|
7027
7268
|
editMode: true,
|
|
7028
|
-
children: /* @__PURE__ */
|
|
7269
|
+
children: /* @__PURE__ */ jsx45(DropZonePure, { zone: rootDroppableId })
|
|
7029
7270
|
})
|
|
7030
|
-
) : /* @__PURE__ */
|
|
7271
|
+
) : /* @__PURE__ */ jsx45(Render, { data: renderData, config, metadata });
|
|
7031
7272
|
useEffect21(() => {
|
|
7032
7273
|
if (!iframe.enabled) {
|
|
7033
7274
|
setStatus("READY");
|
|
7034
7275
|
}
|
|
7035
7276
|
}, [iframe.enabled]);
|
|
7036
|
-
return /* @__PURE__ */
|
|
7277
|
+
return /* @__PURE__ */ jsx45(
|
|
7037
7278
|
"div",
|
|
7038
7279
|
{
|
|
7039
|
-
className:
|
|
7280
|
+
className: getClassName27(),
|
|
7040
7281
|
id,
|
|
7041
7282
|
"data-editor-preview": true,
|
|
7042
7283
|
onClick: (e) => {
|
|
@@ -7045,11 +7286,11 @@ var Preview2 = ({ id = "editor-preview" }) => {
|
|
|
7045
7286
|
dispatch({ type: "setUi", ui: { itemSelector: null } });
|
|
7046
7287
|
}
|
|
7047
7288
|
},
|
|
7048
|
-
children: iframe.enabled ? /* @__PURE__ */
|
|
7289
|
+
children: iframe.enabled ? /* @__PURE__ */ jsx45(
|
|
7049
7290
|
AutoFrame_default,
|
|
7050
7291
|
{
|
|
7051
7292
|
id: "preview-frame",
|
|
7052
|
-
className:
|
|
7293
|
+
className: getClassName27("frame"),
|
|
7053
7294
|
"data-rfd-iframe": true,
|
|
7054
7295
|
onReady: () => {
|
|
7055
7296
|
setStatus("READY");
|
|
@@ -7058,18 +7299,18 @@ var Preview2 = ({ id = "editor-preview" }) => {
|
|
|
7058
7299
|
setStatus("MOUNTED");
|
|
7059
7300
|
},
|
|
7060
7301
|
frameRef: ref,
|
|
7061
|
-
children: /* @__PURE__ */
|
|
7302
|
+
children: /* @__PURE__ */ jsx45(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
|
|
7062
7303
|
if (Frame) {
|
|
7063
|
-
return /* @__PURE__ */
|
|
7304
|
+
return /* @__PURE__ */ jsx45(Frame, { document: document2, children: inner });
|
|
7064
7305
|
}
|
|
7065
7306
|
return inner;
|
|
7066
7307
|
} })
|
|
7067
7308
|
}
|
|
7068
|
-
) : /* @__PURE__ */
|
|
7309
|
+
) : /* @__PURE__ */ jsx45(
|
|
7069
7310
|
"div",
|
|
7070
7311
|
{
|
|
7071
7312
|
id: "preview-frame",
|
|
7072
|
-
className:
|
|
7313
|
+
className: getClassName27("frame"),
|
|
7073
7314
|
ref,
|
|
7074
7315
|
"data-editor-entry": true,
|
|
7075
7316
|
children: inner
|
|
@@ -7177,16 +7418,16 @@ function splitGlobals(data, config) {
|
|
|
7177
7418
|
// components/Editor/components/Layout/index.tsx
|
|
7178
7419
|
init_react_import();
|
|
7179
7420
|
import {
|
|
7180
|
-
useCallback as
|
|
7421
|
+
useCallback as useCallback24,
|
|
7181
7422
|
useEffect as useEffect25,
|
|
7182
7423
|
useMemo as useMemo23,
|
|
7183
|
-
useRef as
|
|
7424
|
+
useRef as useRef18,
|
|
7184
7425
|
useState as useState23
|
|
7185
7426
|
} from "react";
|
|
7186
7427
|
|
|
7187
7428
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Layout/styles.module.css#css-module
|
|
7188
7429
|
init_react_import();
|
|
7189
|
-
var
|
|
7430
|
+
var styles_module_default23 = { "Editor": "_Editor_1ty8s_19", "Editor-portal": "_Editor-portal_1ty8s_32", "EditorLayout": "_EditorLayout_1ty8s_37", "EditorLayout-inner": "_EditorLayout-inner_1ty8s_41", "Editor--hidePlugins": "_Editor--hidePlugins_1ty8s_73", "EditorLayout--mounted": "_EditorLayout--mounted_1ty8s_78", "EditorLayout--mobilePanelHeightToggle": "_EditorLayout--mobilePanelHeightToggle_1ty8s_82", "EditorLayout--leftSideBarVisible": "_EditorLayout--leftSideBarVisible_1ty8s_82", "EditorLayout--mobilePanelCustomHeight": "_EditorLayout--mobilePanelCustomHeight_1ty8s_87", "EditorLayout--mobilePanelHeightMinContent": "_EditorLayout--mobilePanelHeightMinContent_1ty8s_105", "EditorLayout--rightSideBarVisible": "_EditorLayout--rightSideBarVisible_1ty8s_127", "EditorLayout-mounted": "_EditorLayout-mounted_1ty8s_146", "EditorLayout-nav": "_EditorLayout-nav_1ty8s_187", "Editor-fieldSideBarToolbar": "_Editor-fieldSideBarToolbar_1ty8s_203", "Editor-fieldSideBarHistory": "_Editor-fieldSideBarHistory_1ty8s_213", "Editor-fieldSideBarActions": "_Editor-fieldSideBarActions_1ty8s_219", "EditorLayout-mobilePanel": "_EditorLayout-mobilePanel_1ty8s_225", "EditorLayout-mobilePanelContent": "_EditorLayout-mobilePanelContent_1ty8s_245", "EditorLayout-mobileDragHandle": "_EditorLayout-mobileDragHandle_1ty8s_252", "EditorLayout-mobileDragHandlePill": "_EditorLayout-mobileDragHandlePill_1ty8s_266", "EditorPluginTab": "_EditorPluginTab_1ty8s_273", "EditorPluginTab--visible": "_EditorPluginTab--visible_1ty8s_279", "EditorPluginTab-body": "_EditorPluginTab-body_1ty8s_284" };
|
|
7190
7431
|
|
|
7191
7432
|
// lib/use-inject-css.ts
|
|
7192
7433
|
init_react_import();
|
|
@@ -7217,15 +7458,15 @@ var useInjectGlobalCss = (iframeEnabled) => {
|
|
|
7217
7458
|
|
|
7218
7459
|
// components/DefaultOverride/index.tsx
|
|
7219
7460
|
init_react_import();
|
|
7220
|
-
import { Fragment as Fragment12, jsx as
|
|
7221
|
-
var DefaultOverride = ({ children }) => /* @__PURE__ */
|
|
7461
|
+
import { Fragment as Fragment12, jsx as jsx46 } from "react/jsx-runtime";
|
|
7462
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx46(Fragment12, { children });
|
|
7222
7463
|
|
|
7223
7464
|
// lib/use-preview-mode-hotkeys.ts
|
|
7224
7465
|
init_react_import();
|
|
7225
|
-
import { useCallback as
|
|
7466
|
+
import { useCallback as useCallback18 } from "react";
|
|
7226
7467
|
var usePreviewModeHotkeys = () => {
|
|
7227
7468
|
const appStore = useAppStoreApi();
|
|
7228
|
-
const toggleInteractive =
|
|
7469
|
+
const toggleInteractive = useCallback18(() => {
|
|
7229
7470
|
const dispatch = appStore.getState().dispatch;
|
|
7230
7471
|
dispatch({
|
|
7231
7472
|
type: "setUi",
|
|
@@ -7243,11 +7484,11 @@ init_react_import();
|
|
|
7243
7484
|
|
|
7244
7485
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/SidebarSection/styles.module.css#css-module
|
|
7245
7486
|
init_react_import();
|
|
7246
|
-
var
|
|
7487
|
+
var styles_module_default24 = { "SidebarSection": "_SidebarSection_tt2oy_1", "SidebarSection-title": "_SidebarSection-title_tt2oy_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_tt2oy_20", "SidebarSection-content": "_SidebarSection-content_tt2oy_24", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_tt2oy_33", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_tt2oy_62", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_tt2oy_33", "SidebarSection-heading": "_SidebarSection-heading_tt2oy_74", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_tt2oy_88" };
|
|
7247
7488
|
|
|
7248
7489
|
// components/SidebarSection/index.tsx
|
|
7249
|
-
import { jsx as
|
|
7250
|
-
var
|
|
7490
|
+
import { jsx as jsx47, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7491
|
+
var getClassName28 = get_class_name_factory_default("SidebarSection", styles_module_default24);
|
|
7251
7492
|
var SidebarSection = ({
|
|
7252
7493
|
children,
|
|
7253
7494
|
title,
|
|
@@ -7256,29 +7497,29 @@ var SidebarSection = ({
|
|
|
7256
7497
|
noBorderTop,
|
|
7257
7498
|
isLoading
|
|
7258
7499
|
}) => {
|
|
7259
|
-
return /* @__PURE__ */
|
|
7260
|
-
/* @__PURE__ */
|
|
7261
|
-
showBreadcrumbs && /* @__PURE__ */
|
|
7262
|
-
/* @__PURE__ */
|
|
7500
|
+
return /* @__PURE__ */ jsxs18("div", { className: getClassName28({ noBorderTop }), style: { background }, children: [
|
|
7501
|
+
/* @__PURE__ */ jsx47("div", { className: getClassName28("title"), children: /* @__PURE__ */ jsxs18("div", { className: getClassName28("breadcrumbs"), children: [
|
|
7502
|
+
showBreadcrumbs && /* @__PURE__ */ jsx47(Breadcrumbs, {}),
|
|
7503
|
+
/* @__PURE__ */ jsx47("div", { className: getClassName28("heading"), children: /* @__PURE__ */ jsx47(Heading, { rank: "2", size: "xs", children: title }) })
|
|
7263
7504
|
] }) }),
|
|
7264
|
-
/* @__PURE__ */
|
|
7265
|
-
isLoading && /* @__PURE__ */
|
|
7505
|
+
/* @__PURE__ */ jsx47("div", { className: getClassName28("content"), children }),
|
|
7506
|
+
isLoading && /* @__PURE__ */ jsx47("div", { className: getClassName28("loadingOverlay"), children: /* @__PURE__ */ jsx47(Loader, { size: 32 }) })
|
|
7266
7507
|
] });
|
|
7267
7508
|
};
|
|
7268
7509
|
|
|
7269
7510
|
// components/Editor/components/Canvas/index.tsx
|
|
7270
7511
|
init_react_import();
|
|
7271
7512
|
import {
|
|
7272
|
-
useCallback as
|
|
7513
|
+
useCallback as useCallback19,
|
|
7273
7514
|
useEffect as useEffect23,
|
|
7274
7515
|
useMemo as useMemo22,
|
|
7275
|
-
useRef as
|
|
7516
|
+
useRef as useRef15,
|
|
7276
7517
|
useState as useState21
|
|
7277
7518
|
} from "react";
|
|
7278
7519
|
|
|
7279
7520
|
// components/BrowserBar/index.tsx
|
|
7280
7521
|
init_react_import();
|
|
7281
|
-
import { useMemo as useMemo20, useRef as
|
|
7522
|
+
import { useMemo as useMemo20, useRef as useRef13, useState as useState20 } from "react";
|
|
7282
7523
|
|
|
7283
7524
|
// components/ui/Combobox/index.tsx
|
|
7284
7525
|
init_react_import();
|
|
@@ -7286,11 +7527,11 @@ import { Combobox as ComboboxPrimitive } from "@base-ui/react";
|
|
|
7286
7527
|
|
|
7287
7528
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ui/Combobox/styles.module.css#css-module
|
|
7288
7529
|
init_react_import();
|
|
7289
|
-
var
|
|
7530
|
+
var styles_module_default25 = { "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" };
|
|
7290
7531
|
|
|
7291
7532
|
// components/ui/Combobox/index.tsx
|
|
7292
|
-
import { jsx as
|
|
7293
|
-
var
|
|
7533
|
+
import { jsx as jsx48, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7534
|
+
var getClassName29 = get_class_name_factory_default("EditorCombobox", styles_module_default25);
|
|
7294
7535
|
var join = (...values) => values.filter(Boolean).join(" ");
|
|
7295
7536
|
var mergeClassName = (base, override) => {
|
|
7296
7537
|
if (!override) return base;
|
|
@@ -7306,11 +7547,11 @@ function ComboboxInput(_a) {
|
|
|
7306
7547
|
} = _b, props = __objRest(_b, [
|
|
7307
7548
|
"className"
|
|
7308
7549
|
]);
|
|
7309
|
-
return /* @__PURE__ */
|
|
7550
|
+
return /* @__PURE__ */ jsx48(
|
|
7310
7551
|
ComboboxPrimitive.Input,
|
|
7311
7552
|
__spreadValues({
|
|
7312
7553
|
"data-slot": "combobox-input",
|
|
7313
|
-
className: mergeClassName(
|
|
7554
|
+
className: mergeClassName(getClassName29("input"), className)
|
|
7314
7555
|
}, props)
|
|
7315
7556
|
);
|
|
7316
7557
|
}
|
|
@@ -7330,19 +7571,19 @@ function ComboboxContent(_a) {
|
|
|
7330
7571
|
"alignOffset",
|
|
7331
7572
|
"children"
|
|
7332
7573
|
]);
|
|
7333
|
-
return /* @__PURE__ */
|
|
7574
|
+
return /* @__PURE__ */ jsx48(ComboboxPrimitive.Portal, { children: /* @__PURE__ */ jsx48(
|
|
7334
7575
|
ComboboxPrimitive.Positioner,
|
|
7335
7576
|
{
|
|
7336
7577
|
side,
|
|
7337
7578
|
sideOffset,
|
|
7338
7579
|
align,
|
|
7339
7580
|
alignOffset,
|
|
7340
|
-
className:
|
|
7341
|
-
children: /* @__PURE__ */
|
|
7581
|
+
className: getClassName29("positioner"),
|
|
7582
|
+
children: /* @__PURE__ */ jsx48(
|
|
7342
7583
|
ComboboxPrimitive.Popup,
|
|
7343
7584
|
__spreadProps(__spreadValues({
|
|
7344
7585
|
"data-slot": "combobox-content",
|
|
7345
|
-
className: mergeClassName(
|
|
7586
|
+
className: mergeClassName(getClassName29("content"), className)
|
|
7346
7587
|
}, props), {
|
|
7347
7588
|
children
|
|
7348
7589
|
})
|
|
@@ -7356,11 +7597,11 @@ function ComboboxList(_a) {
|
|
|
7356
7597
|
} = _b, props = __objRest(_b, [
|
|
7357
7598
|
"className"
|
|
7358
7599
|
]);
|
|
7359
|
-
return /* @__PURE__ */
|
|
7600
|
+
return /* @__PURE__ */ jsx48(
|
|
7360
7601
|
ComboboxPrimitive.List,
|
|
7361
7602
|
__spreadValues({
|
|
7362
7603
|
"data-slot": "combobox-list",
|
|
7363
|
-
className: mergeClassName(
|
|
7604
|
+
className: mergeClassName(getClassName29("list"), className)
|
|
7364
7605
|
}, props)
|
|
7365
7606
|
);
|
|
7366
7607
|
}
|
|
@@ -7372,14 +7613,14 @@ function ComboboxItem(_a) {
|
|
|
7372
7613
|
"className",
|
|
7373
7614
|
"children"
|
|
7374
7615
|
]);
|
|
7375
|
-
return /* @__PURE__ */
|
|
7616
|
+
return /* @__PURE__ */ jsxs19(
|
|
7376
7617
|
ComboboxPrimitive.Item,
|
|
7377
7618
|
__spreadProps(__spreadValues({
|
|
7378
7619
|
"data-slot": "combobox-item",
|
|
7379
|
-
className: mergeClassName(
|
|
7620
|
+
className: mergeClassName(getClassName29("item"), className)
|
|
7380
7621
|
}, props), {
|
|
7381
7622
|
children: [
|
|
7382
|
-
/* @__PURE__ */
|
|
7623
|
+
/* @__PURE__ */ jsx48("span", { className: getClassName29("itemIndicator"), children: /* @__PURE__ */ jsx48(ComboboxPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx48(Check, { size: 14 }) }) }),
|
|
7383
7624
|
children
|
|
7384
7625
|
]
|
|
7385
7626
|
})
|
|
@@ -7391,27 +7632,27 @@ function ComboboxEmpty(_a) {
|
|
|
7391
7632
|
} = _b, props = __objRest(_b, [
|
|
7392
7633
|
"className"
|
|
7393
7634
|
]);
|
|
7394
|
-
return /* @__PURE__ */
|
|
7635
|
+
return /* @__PURE__ */ jsx48(
|
|
7395
7636
|
ComboboxPrimitive.Empty,
|
|
7396
7637
|
__spreadValues({
|
|
7397
7638
|
"data-slot": "combobox-empty",
|
|
7398
|
-
className: mergeClassName(
|
|
7639
|
+
className: mergeClassName(getClassName29("empty"), className)
|
|
7399
7640
|
}, props)
|
|
7400
7641
|
);
|
|
7401
7642
|
}
|
|
7402
7643
|
|
|
7403
7644
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/BrowserBar/styles.module.css#css-module
|
|
7404
7645
|
init_react_import();
|
|
7405
|
-
var
|
|
7646
|
+
var styles_module_default26 = { "BrowserBar": "_BrowserBar_x10eb_1", "BrowserBar-urlTrigger": "_BrowserBar-urlTrigger_x10eb_16", "BrowserBar-urlIcon": "_BrowserBar-urlIcon_x10eb_46", "BrowserBar-urlText": "_BrowserBar-urlText_x10eb_51", "BrowserBar-urlInput": "_BrowserBar-urlInput_x10eb_63", "BrowserBar-itemPath": "_BrowserBar-itemPath_x10eb_69", "BrowserBar-itemTitle": "_BrowserBar-itemTitle_x10eb_74", "BrowserBar-actions": "_BrowserBar-actions_x10eb_82", "BrowserBar-deviceIcon": "_BrowserBar-deviceIcon_x10eb_89" };
|
|
7406
7647
|
|
|
7407
7648
|
// components/BrowserBar/index.tsx
|
|
7408
|
-
import { jsx as
|
|
7649
|
+
import { jsx as jsx49, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7409
7650
|
var normalizeRoute = (raw) => {
|
|
7410
7651
|
const trimmed = raw.trim();
|
|
7411
7652
|
if (!trimmed) return trimmed;
|
|
7412
7653
|
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
7413
7654
|
};
|
|
7414
|
-
var
|
|
7655
|
+
var getClassName30 = get_class_name_factory_default("BrowserBar", styles_module_default26);
|
|
7415
7656
|
var DEVICE_VIEWPORTS = {
|
|
7416
7657
|
desktop: { width: "100%", height: "auto", icon: "Monitor", label: "Desktop" },
|
|
7417
7658
|
mobile: { width: 360, height: "auto", icon: "Smartphone", label: "Mobile" }
|
|
@@ -7447,7 +7688,7 @@ var BrowserBar = ({
|
|
|
7447
7688
|
};
|
|
7448
7689
|
const showRoutePicker = !!routes && currentPath !== void 0 && !!onRouteChange;
|
|
7449
7690
|
const [inputValue, setInputValue] = useState20(currentPath != null ? currentPath : "");
|
|
7450
|
-
const lastSyncedPath =
|
|
7691
|
+
const lastSyncedPath = useRef13(currentPath);
|
|
7451
7692
|
if (lastSyncedPath.current !== currentPath) {
|
|
7452
7693
|
lastSyncedPath.current = currentPath;
|
|
7453
7694
|
setInputValue(currentPath != null ? currentPath : "");
|
|
@@ -7457,8 +7698,8 @@ var BrowserBar = ({
|
|
|
7457
7698
|
if (!next || next === currentPath) return;
|
|
7458
7699
|
void (onRouteChange == null ? void 0 : onRouteChange(next));
|
|
7459
7700
|
};
|
|
7460
|
-
return /* @__PURE__ */
|
|
7461
|
-
showRoutePicker ? /* @__PURE__ */
|
|
7701
|
+
return /* @__PURE__ */ jsxs20("div", { className: getClassName30(), children: [
|
|
7702
|
+
showRoutePicker ? /* @__PURE__ */ jsxs20(
|
|
7462
7703
|
Combobox,
|
|
7463
7704
|
{
|
|
7464
7705
|
items: routes.map((r) => r.path),
|
|
@@ -7470,20 +7711,20 @@ var BrowserBar = ({
|
|
|
7470
7711
|
onInputValueChange: (next) => setInputValue(next),
|
|
7471
7712
|
autoHighlight: false,
|
|
7472
7713
|
children: [
|
|
7473
|
-
/* @__PURE__ */
|
|
7714
|
+
/* @__PURE__ */ jsxs20(
|
|
7474
7715
|
"form",
|
|
7475
7716
|
{
|
|
7476
|
-
className:
|
|
7717
|
+
className: getClassName30("urlTrigger"),
|
|
7477
7718
|
onSubmit: (event) => {
|
|
7478
7719
|
event.preventDefault();
|
|
7479
7720
|
submit(inputValue);
|
|
7480
7721
|
},
|
|
7481
7722
|
children: [
|
|
7482
|
-
/* @__PURE__ */
|
|
7483
|
-
/* @__PURE__ */
|
|
7723
|
+
/* @__PURE__ */ jsx49(Globe, { className: getClassName30("urlIcon"), size: 14 }),
|
|
7724
|
+
/* @__PURE__ */ jsx49(
|
|
7484
7725
|
ComboboxInput,
|
|
7485
7726
|
{
|
|
7486
|
-
className:
|
|
7727
|
+
className: getClassName30("urlInput"),
|
|
7487
7728
|
placeholder: "/",
|
|
7488
7729
|
spellCheck: false,
|
|
7489
7730
|
autoCorrect: "off",
|
|
@@ -7493,39 +7734,39 @@ var BrowserBar = ({
|
|
|
7493
7734
|
]
|
|
7494
7735
|
}
|
|
7495
7736
|
),
|
|
7496
|
-
/* @__PURE__ */
|
|
7497
|
-
/* @__PURE__ */
|
|
7498
|
-
/* @__PURE__ */
|
|
7737
|
+
/* @__PURE__ */ jsxs20(ComboboxContent, { children: [
|
|
7738
|
+
/* @__PURE__ */ jsx49(ComboboxEmpty, { children: "Press Enter to go to this path" }),
|
|
7739
|
+
/* @__PURE__ */ jsx49(ComboboxList, { children: (path) => {
|
|
7499
7740
|
const route = routes.find((r) => r.path === path);
|
|
7500
|
-
return /* @__PURE__ */
|
|
7501
|
-
/* @__PURE__ */
|
|
7502
|
-
(route == null ? void 0 : route.title) ? /* @__PURE__ */
|
|
7741
|
+
return /* @__PURE__ */ jsxs20(ComboboxItem, { value: path, children: [
|
|
7742
|
+
/* @__PURE__ */ jsx49("span", { className: getClassName30("itemPath"), children: path }),
|
|
7743
|
+
(route == null ? void 0 : route.title) ? /* @__PURE__ */ jsx49("span", { className: getClassName30("itemTitle"), children: route.title }) : null
|
|
7503
7744
|
] }, path);
|
|
7504
7745
|
} })
|
|
7505
7746
|
] })
|
|
7506
7747
|
]
|
|
7507
7748
|
}
|
|
7508
|
-
) : /* @__PURE__ */
|
|
7509
|
-
/* @__PURE__ */
|
|
7510
|
-
/* @__PURE__ */
|
|
7749
|
+
) : /* @__PURE__ */ jsxs20("div", { className: getClassName30("urlTrigger"), children: [
|
|
7750
|
+
/* @__PURE__ */ jsx49(Globe, { className: getClassName30("urlIcon"), size: 14 }),
|
|
7751
|
+
/* @__PURE__ */ jsx49("span", { className: getClassName30("urlText"), children: "/" })
|
|
7511
7752
|
] }),
|
|
7512
|
-
/* @__PURE__ */
|
|
7513
|
-
/* @__PURE__ */
|
|
7753
|
+
/* @__PURE__ */ jsxs20("div", { className: getClassName30("actions"), children: [
|
|
7754
|
+
/* @__PURE__ */ jsx49(
|
|
7514
7755
|
IconButton,
|
|
7515
7756
|
{
|
|
7516
7757
|
type: "button",
|
|
7517
7758
|
title: activeDevice === "desktop" ? "Switch to mobile viewport" : "Switch to desktop viewport",
|
|
7518
7759
|
onClick: () => setDevice(activeDevice === "desktop" ? "mobile" : "desktop"),
|
|
7519
|
-
children: /* @__PURE__ */
|
|
7760
|
+
children: /* @__PURE__ */ jsx49("span", { className: getClassName30("deviceIcon"), children: activeDevice === "desktop" ? /* @__PURE__ */ jsx49(Monitor, { size: 16 }) : /* @__PURE__ */ jsx49(Smartphone, { size: 16 }) })
|
|
7520
7761
|
}
|
|
7521
7762
|
),
|
|
7522
|
-
/* @__PURE__ */
|
|
7763
|
+
/* @__PURE__ */ jsx49(
|
|
7523
7764
|
IconButton,
|
|
7524
7765
|
{
|
|
7525
7766
|
type: "button",
|
|
7526
7767
|
title: isFullScreen ? "Exit full screen" : "Enter full screen",
|
|
7527
7768
|
onClick: toggleFullScreen,
|
|
7528
|
-
children: /* @__PURE__ */
|
|
7769
|
+
children: /* @__PURE__ */ jsx49("span", { className: getClassName30("deviceIcon"), children: isFullScreen ? /* @__PURE__ */ jsx49(Minimize, { size: 16 }) : /* @__PURE__ */ jsx49(Maximize, { size: 16 }) })
|
|
7529
7770
|
}
|
|
7530
7771
|
)
|
|
7531
7772
|
] })
|
|
@@ -7534,7 +7775,7 @@ var BrowserBar = ({
|
|
|
7534
7775
|
|
|
7535
7776
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Canvas/styles.module.css#css-module
|
|
7536
7777
|
init_react_import();
|
|
7537
|
-
var
|
|
7778
|
+
var styles_module_default27 = { "EditorCanvas": "_EditorCanvas_es8bv_1", "EditorCanvas-controls": "_EditorCanvas-controls_es8bv_17", "EditorCanvas--fullScreen": "_EditorCanvas--fullScreen_es8bv_22", "EditorCanvas-inner": "_EditorCanvas-inner_es8bv_33", "EditorCanvas-rootColumn": "_EditorCanvas-rootColumn_es8bv_46", "EditorCanvas-root": "_EditorCanvas-root_es8bv_46", "EditorCanvas--ready": "_EditorCanvas--ready_es8bv_83", "EditorCanvas-loader": "_EditorCanvas-loader_es8bv_88", "EditorCanvas--showLoader": "_EditorCanvas--showLoader_es8bv_100", "EditorCanvas-browserBar": "_EditorCanvas-browserBar_es8bv_109", "EditorCanvas-zoomControls": "_EditorCanvas-zoomControls_es8bv_114" };
|
|
7538
7779
|
|
|
7539
7780
|
// components/Editor/components/Canvas/index.tsx
|
|
7540
7781
|
import { useShallow as useShallow9 } from "zustand/react/shallow";
|
|
@@ -7544,22 +7785,22 @@ init_react_import();
|
|
|
7544
7785
|
import {
|
|
7545
7786
|
createContext as createContext7,
|
|
7546
7787
|
useContext as useContext14,
|
|
7547
|
-
useRef as
|
|
7788
|
+
useRef as useRef14,
|
|
7548
7789
|
useMemo as useMemo21
|
|
7549
7790
|
} from "react";
|
|
7550
|
-
import { jsx as
|
|
7791
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
7551
7792
|
var FrameContext = createContext7(null);
|
|
7552
7793
|
var FrameProvider = ({
|
|
7553
7794
|
children
|
|
7554
7795
|
}) => {
|
|
7555
|
-
const frameRef =
|
|
7796
|
+
const frameRef = useRef14(null);
|
|
7556
7797
|
const value = useMemo21(
|
|
7557
7798
|
() => ({
|
|
7558
7799
|
frameRef
|
|
7559
7800
|
}),
|
|
7560
7801
|
[]
|
|
7561
7802
|
);
|
|
7562
|
-
return /* @__PURE__ */
|
|
7803
|
+
return /* @__PURE__ */ jsx50(FrameContext.Provider, { value, children });
|
|
7563
7804
|
};
|
|
7564
7805
|
var useCanvasFrame = () => {
|
|
7565
7806
|
const context = useContext14(FrameContext);
|
|
@@ -7570,8 +7811,8 @@ var useCanvasFrame = () => {
|
|
|
7570
7811
|
};
|
|
7571
7812
|
|
|
7572
7813
|
// components/Editor/components/Canvas/index.tsx
|
|
7573
|
-
import { Fragment as Fragment13, jsx as
|
|
7574
|
-
var
|
|
7814
|
+
import { Fragment as Fragment13, jsx as jsx51, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7815
|
+
var getClassName31 = get_class_name_factory_default("EditorCanvas", styles_module_default27);
|
|
7575
7816
|
var ZOOM_STEP = 0.15;
|
|
7576
7817
|
var MIN_ZOOM = 0.25;
|
|
7577
7818
|
var MAX_ZOOM = 3;
|
|
@@ -7611,16 +7852,16 @@ var Canvas = () => {
|
|
|
7611
7852
|
const zoomOut = () => setCanvasZoom((z) => Math.max(z - ZOOM_STEP, MIN_ZOOM));
|
|
7612
7853
|
const resetZoom = () => setCanvasZoom(1);
|
|
7613
7854
|
const [showTransition, setShowTransition] = useState21(false);
|
|
7614
|
-
const isResizingRef =
|
|
7855
|
+
const isResizingRef = useRef15(false);
|
|
7615
7856
|
const defaultRender = useMemo22(() => {
|
|
7616
|
-
const EditorDefault = ({ children }) => /* @__PURE__ */
|
|
7857
|
+
const EditorDefault = ({ children }) => /* @__PURE__ */ jsx51(Fragment13, { children });
|
|
7617
7858
|
return EditorDefault;
|
|
7618
7859
|
}, []);
|
|
7619
7860
|
const CustomPreview = useMemo22(
|
|
7620
7861
|
() => overrides.preview || defaultRender,
|
|
7621
7862
|
[overrides]
|
|
7622
7863
|
);
|
|
7623
|
-
const getFrameDimensions =
|
|
7864
|
+
const getFrameDimensions = useCallback19(() => {
|
|
7624
7865
|
if (frameRef.current) {
|
|
7625
7866
|
const frame = frameRef.current;
|
|
7626
7867
|
const box = getBox(frame);
|
|
@@ -7641,8 +7882,8 @@ var Canvas = () => {
|
|
|
7641
7882
|
}, 500);
|
|
7642
7883
|
}, []);
|
|
7643
7884
|
const appStoreApi = useAppStoreApi();
|
|
7644
|
-
const autoSelectingRef =
|
|
7645
|
-
const pickClosestViewport =
|
|
7885
|
+
const autoSelectingRef = useRef15(true);
|
|
7886
|
+
const pickClosestViewport = useCallback19(() => {
|
|
7646
7887
|
var _a2, _b2;
|
|
7647
7888
|
if (typeof window === "undefined") return null;
|
|
7648
7889
|
const viewportWidth = window.innerWidth;
|
|
@@ -7735,10 +7976,10 @@ var Canvas = () => {
|
|
|
7735
7976
|
appStoreApi,
|
|
7736
7977
|
setUi
|
|
7737
7978
|
]);
|
|
7738
|
-
return /* @__PURE__ */
|
|
7979
|
+
return /* @__PURE__ */ jsx51(
|
|
7739
7980
|
"div",
|
|
7740
7981
|
{
|
|
7741
|
-
className:
|
|
7982
|
+
className: getClassName31({
|
|
7742
7983
|
ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
|
|
7743
7984
|
showLoader,
|
|
7744
7985
|
fullScreen: fullScreenCanvas
|
|
@@ -7753,16 +7994,16 @@ var Canvas = () => {
|
|
|
7753
7994
|
});
|
|
7754
7995
|
}
|
|
7755
7996
|
},
|
|
7756
|
-
children: /* @__PURE__ */
|
|
7757
|
-
!disableZoomControls && /* @__PURE__ */
|
|
7758
|
-
/* @__PURE__ */
|
|
7759
|
-
/* @__PURE__ */
|
|
7760
|
-
/* @__PURE__ */
|
|
7997
|
+
children: /* @__PURE__ */ jsxs21("div", { className: getClassName31("inner"), ref: frameRef, children: [
|
|
7998
|
+
!disableZoomControls && /* @__PURE__ */ jsxs21("div", { className: getClassName31("zoomControls"), children: [
|
|
7999
|
+
/* @__PURE__ */ jsx51(IconButton, { type: "button", title: "Zoom out", onClick: zoomOut, children: /* @__PURE__ */ jsx51(Minus, { size: 14 }) }),
|
|
8000
|
+
/* @__PURE__ */ jsx51(IconButton, { type: "button", title: "Reset zoom", onClick: resetZoom, children: /* @__PURE__ */ jsx51(RotateCcw, { size: 14 }) }),
|
|
8001
|
+
/* @__PURE__ */ jsx51(IconButton, { type: "button", title: "Zoom in", onClick: zoomIn, children: /* @__PURE__ */ jsx51(Plus, { size: 14 }) })
|
|
7761
8002
|
] }),
|
|
7762
|
-
/* @__PURE__ */
|
|
8003
|
+
/* @__PURE__ */ jsxs21(
|
|
7763
8004
|
"div",
|
|
7764
8005
|
{
|
|
7765
|
-
className:
|
|
8006
|
+
className: getClassName31("rootColumn"),
|
|
7766
8007
|
style: {
|
|
7767
8008
|
width: iframe.enabled ? viewports.current.width : "100%",
|
|
7768
8009
|
transform: disableZoomControls ? void 0 : `scale(${canvasZoom})`,
|
|
@@ -7770,7 +8011,7 @@ var Canvas = () => {
|
|
|
7770
8011
|
transition: showTransition ? `width ${TRANSITION_DURATION}ms ease-out, transform ${TRANSITION_DURATION}ms ease-out` : disableZoomControls ? void 0 : "transform 150ms ease-out"
|
|
7771
8012
|
},
|
|
7772
8013
|
children: [
|
|
7773
|
-
iframe.enabled && /* @__PURE__ */
|
|
8014
|
+
iframe.enabled && /* @__PURE__ */ jsx51("div", { className: getClassName31("browserBar"), children: /* @__PURE__ */ jsx51(
|
|
7774
8015
|
BrowserBar,
|
|
7775
8016
|
{
|
|
7776
8017
|
onViewportChange: (viewport) => {
|
|
@@ -7787,23 +8028,23 @@ var Canvas = () => {
|
|
|
7787
8028
|
}
|
|
7788
8029
|
}
|
|
7789
8030
|
) }),
|
|
7790
|
-
/* @__PURE__ */
|
|
8031
|
+
/* @__PURE__ */ jsx51(
|
|
7791
8032
|
"div",
|
|
7792
8033
|
{
|
|
7793
|
-
className:
|
|
8034
|
+
className: getClassName31("root"),
|
|
7794
8035
|
suppressHydrationWarning: true,
|
|
7795
8036
|
id: "editor-canvas-root",
|
|
7796
8037
|
onTransitionEnd: () => {
|
|
7797
8038
|
setShowTransition(false);
|
|
7798
8039
|
isResizingRef.current = false;
|
|
7799
8040
|
},
|
|
7800
|
-
children: /* @__PURE__ */
|
|
8041
|
+
children: /* @__PURE__ */ jsx51(CustomPreview, { children: /* @__PURE__ */ jsx51(Preview2, {}) })
|
|
7801
8042
|
}
|
|
7802
8043
|
)
|
|
7803
8044
|
]
|
|
7804
8045
|
}
|
|
7805
8046
|
),
|
|
7806
|
-
/* @__PURE__ */
|
|
8047
|
+
/* @__PURE__ */ jsx51("div", { className: getClassName31("loader"), children: /* @__PURE__ */ jsx51(Loader, { size: 24 }) })
|
|
7807
8048
|
] })
|
|
7808
8049
|
}
|
|
7809
8050
|
);
|
|
@@ -7811,10 +8052,10 @@ var Canvas = () => {
|
|
|
7811
8052
|
|
|
7812
8053
|
// lib/use-sidebar-resize.ts
|
|
7813
8054
|
init_react_import();
|
|
7814
|
-
import { useCallback as
|
|
8055
|
+
import { useCallback as useCallback20, useEffect as useEffect24, useRef as useRef16, useState as useState22 } from "react";
|
|
7815
8056
|
function useSidebarResize(position, dispatch) {
|
|
7816
8057
|
const [width, setWidth] = useState22(null);
|
|
7817
|
-
const sidebarRef =
|
|
8058
|
+
const sidebarRef = useRef16(null);
|
|
7818
8059
|
const storeWidth = useAppStore(
|
|
7819
8060
|
(s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
|
|
7820
8061
|
);
|
|
@@ -7848,7 +8089,7 @@ function useSidebarResize(position, dispatch) {
|
|
|
7848
8089
|
setWidth(storeWidth);
|
|
7849
8090
|
}
|
|
7850
8091
|
}, [storeWidth]);
|
|
7851
|
-
const handleResizeEnd =
|
|
8092
|
+
const handleResizeEnd = useCallback20(
|
|
7852
8093
|
(width2) => {
|
|
7853
8094
|
dispatch({
|
|
7854
8095
|
type: "setUi",
|
|
@@ -7895,26 +8136,26 @@ init_react_import();
|
|
|
7895
8136
|
|
|
7896
8137
|
// components/Editor/components/ResizeHandle/index.tsx
|
|
7897
8138
|
init_react_import();
|
|
7898
|
-
import { useCallback as
|
|
8139
|
+
import { useCallback as useCallback21, useRef as useRef17 } from "react";
|
|
7899
8140
|
|
|
7900
8141
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/ResizeHandle/styles.module.css#css-module
|
|
7901
8142
|
init_react_import();
|
|
7902
|
-
var
|
|
8143
|
+
var styles_module_default28 = { "ResizeHandle": "_ResizeHandle_1u3rv_2", "ResizeHandle--left": "_ResizeHandle--left_1u3rv_16", "ResizeHandle--right": "_ResizeHandle--right_1u3rv_20" };
|
|
7903
8144
|
|
|
7904
8145
|
// components/Editor/components/ResizeHandle/index.tsx
|
|
7905
|
-
import { jsx as
|
|
7906
|
-
var
|
|
8146
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
8147
|
+
var getClassName32 = get_class_name_factory_default("ResizeHandle", styles_module_default28);
|
|
7907
8148
|
var ResizeHandle = ({
|
|
7908
8149
|
position,
|
|
7909
8150
|
sidebarRef,
|
|
7910
8151
|
onResize,
|
|
7911
8152
|
onResizeEnd
|
|
7912
8153
|
}) => {
|
|
7913
|
-
const handleRef =
|
|
7914
|
-
const isDragging =
|
|
7915
|
-
const startX =
|
|
7916
|
-
const startWidth =
|
|
7917
|
-
const handleMouseMove =
|
|
8154
|
+
const handleRef = useRef17(null);
|
|
8155
|
+
const isDragging = useRef17(false);
|
|
8156
|
+
const startX = useRef17(0);
|
|
8157
|
+
const startWidth = useRef17(0);
|
|
8158
|
+
const handleMouseMove = useCallback21(
|
|
7918
8159
|
(e) => {
|
|
7919
8160
|
if (!isDragging.current) return;
|
|
7920
8161
|
const delta = e.clientX - startX.current;
|
|
@@ -7925,7 +8166,7 @@ var ResizeHandle = ({
|
|
|
7925
8166
|
},
|
|
7926
8167
|
[onResize, position]
|
|
7927
8168
|
);
|
|
7928
|
-
const handleMouseUp =
|
|
8169
|
+
const handleMouseUp = useCallback21(() => {
|
|
7929
8170
|
var _a;
|
|
7930
8171
|
if (!isDragging.current) return;
|
|
7931
8172
|
isDragging.current = false;
|
|
@@ -7940,7 +8181,7 @@ var ResizeHandle = ({
|
|
|
7940
8181
|
const finalWidth = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
|
|
7941
8182
|
onResizeEnd(finalWidth);
|
|
7942
8183
|
}, [onResizeEnd]);
|
|
7943
|
-
const handleMouseDown =
|
|
8184
|
+
const handleMouseDown = useCallback21(
|
|
7944
8185
|
(e) => {
|
|
7945
8186
|
var _a;
|
|
7946
8187
|
isDragging.current = true;
|
|
@@ -7958,11 +8199,11 @@ var ResizeHandle = ({
|
|
|
7958
8199
|
},
|
|
7959
8200
|
[position, handleMouseMove, handleMouseUp]
|
|
7960
8201
|
);
|
|
7961
|
-
return /* @__PURE__ */
|
|
8202
|
+
return /* @__PURE__ */ jsx52(
|
|
7962
8203
|
"div",
|
|
7963
8204
|
{
|
|
7964
8205
|
ref: handleRef,
|
|
7965
|
-
className:
|
|
8206
|
+
className: getClassName32({ [position]: true }),
|
|
7966
8207
|
onMouseDown: handleMouseDown
|
|
7967
8208
|
}
|
|
7968
8209
|
);
|
|
@@ -7970,11 +8211,11 @@ var ResizeHandle = ({
|
|
|
7970
8211
|
|
|
7971
8212
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Sidebar/styles.module.css#css-module
|
|
7972
8213
|
init_react_import();
|
|
7973
|
-
var
|
|
8214
|
+
var styles_module_default29 = { "Sidebar": "_Sidebar_14k7q_1", "Sidebar--isVisible": "_Sidebar--isVisible_14k7q_9", "Sidebar--left": "_Sidebar--left_14k7q_13", "Sidebar--right": "_Sidebar--right_14k7q_25", "Sidebar-resizeHandle": "_Sidebar-resizeHandle_14k7q_37" };
|
|
7974
8215
|
|
|
7975
8216
|
// components/Editor/components/Sidebar/index.tsx
|
|
7976
|
-
import { Fragment as Fragment14, jsx as
|
|
7977
|
-
var
|
|
8217
|
+
import { Fragment as Fragment14, jsx as jsx53, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
8218
|
+
var getClassName33 = get_class_name_factory_default("Sidebar", styles_module_default29);
|
|
7978
8219
|
var Sidebar = ({
|
|
7979
8220
|
position,
|
|
7980
8221
|
sidebarRef,
|
|
@@ -7983,16 +8224,16 @@ var Sidebar = ({
|
|
|
7983
8224
|
onResizeEnd,
|
|
7984
8225
|
children
|
|
7985
8226
|
}) => {
|
|
7986
|
-
return /* @__PURE__ */
|
|
7987
|
-
/* @__PURE__ */
|
|
8227
|
+
return /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
8228
|
+
/* @__PURE__ */ jsx53(
|
|
7988
8229
|
"div",
|
|
7989
8230
|
{
|
|
7990
8231
|
ref: sidebarRef,
|
|
7991
|
-
className:
|
|
8232
|
+
className: getClassName33({ [position]: true, isVisible }),
|
|
7992
8233
|
children
|
|
7993
8234
|
}
|
|
7994
8235
|
),
|
|
7995
|
-
/* @__PURE__ */
|
|
8236
|
+
/* @__PURE__ */ jsx53("div", { className: `${getClassName33("resizeHandle")}`, children: /* @__PURE__ */ jsx53(
|
|
7996
8237
|
ResizeHandle,
|
|
7997
8238
|
{
|
|
7998
8239
|
position,
|
|
@@ -8006,7 +8247,10 @@ var Sidebar = ({
|
|
|
8006
8247
|
|
|
8007
8248
|
// lib/use-delete-hotkeys.ts
|
|
8008
8249
|
init_react_import();
|
|
8009
|
-
import { useCallback as
|
|
8250
|
+
import { useCallback as useCallback22 } from "react";
|
|
8251
|
+
|
|
8252
|
+
// lib/should-block-editing-hotkey.ts
|
|
8253
|
+
init_react_import();
|
|
8010
8254
|
var isElementVisible = (element) => {
|
|
8011
8255
|
let current = element;
|
|
8012
8256
|
while (current && current !== document.body) {
|
|
@@ -8018,7 +8262,7 @@ var isElementVisible = (element) => {
|
|
|
8018
8262
|
}
|
|
8019
8263
|
return true;
|
|
8020
8264
|
};
|
|
8021
|
-
var
|
|
8265
|
+
var shouldBlockEditingHotkey = (e) => {
|
|
8022
8266
|
var _a;
|
|
8023
8267
|
if (e == null ? void 0 : e.defaultPrevented) return true;
|
|
8024
8268
|
const origin = ((_a = e == null ? void 0 : e.composedPath) == null ? void 0 : _a.call(e)[0]) || (e == null ? void 0 : e.target) || document.activeElement;
|
|
@@ -8039,12 +8283,14 @@ var shouldBlockDeleteHotkey = (e) => {
|
|
|
8039
8283
|
}
|
|
8040
8284
|
return false;
|
|
8041
8285
|
};
|
|
8286
|
+
|
|
8287
|
+
// lib/use-delete-hotkeys.ts
|
|
8042
8288
|
var useDeleteHotkeys = () => {
|
|
8043
8289
|
const appStore = useAppStoreApi();
|
|
8044
|
-
const deleteSelectedComponent =
|
|
8290
|
+
const deleteSelectedComponent = useCallback22(
|
|
8045
8291
|
(e) => {
|
|
8046
8292
|
var _a;
|
|
8047
|
-
if (
|
|
8293
|
+
if (shouldBlockEditingHotkey(e)) {
|
|
8048
8294
|
return false;
|
|
8049
8295
|
}
|
|
8050
8296
|
const { state, dispatch, permissions, selectedItem } = appStore.getState();
|
|
@@ -8065,17 +8311,109 @@ var useDeleteHotkeys = () => {
|
|
|
8065
8311
|
useHotkey({ backspace: true }, deleteSelectedComponent);
|
|
8066
8312
|
};
|
|
8067
8313
|
|
|
8314
|
+
// lib/use-clipboard-hotkeys.ts
|
|
8315
|
+
init_react_import();
|
|
8316
|
+
import { useCallback as useCallback23 } from "react";
|
|
8317
|
+
var CLIPBOARD_MARKER = "reacteditor/component";
|
|
8318
|
+
var isComponentData = (value) => {
|
|
8319
|
+
var _a;
|
|
8320
|
+
if (!value || typeof value !== "object") return false;
|
|
8321
|
+
const v = value;
|
|
8322
|
+
return typeof v.type === "string" && typeof ((_a = v.props) == null ? void 0 : _a.id) === "string";
|
|
8323
|
+
};
|
|
8324
|
+
var parsePayload = (text) => {
|
|
8325
|
+
try {
|
|
8326
|
+
const parsed = JSON.parse(text);
|
|
8327
|
+
if (parsed && typeof parsed === "object" && parsed.__reactEditor === CLIPBOARD_MARKER && isComponentData(parsed.data)) {
|
|
8328
|
+
return parsed.data;
|
|
8329
|
+
}
|
|
8330
|
+
} catch (e) {
|
|
8331
|
+
}
|
|
8332
|
+
return null;
|
|
8333
|
+
};
|
|
8334
|
+
var useClipboardHotkeys = () => {
|
|
8335
|
+
const appStore = useAppStoreApi();
|
|
8336
|
+
const writeSelectionToClipboard = useCallback23(() => {
|
|
8337
|
+
var _a;
|
|
8338
|
+
const { selectedItem } = appStore.getState();
|
|
8339
|
+
if (!selectedItem) return false;
|
|
8340
|
+
const payload = {
|
|
8341
|
+
__reactEditor: CLIPBOARD_MARKER,
|
|
8342
|
+
data: selectedItem
|
|
8343
|
+
};
|
|
8344
|
+
(_a = navigator.clipboard) == null ? void 0 : _a.writeText(JSON.stringify(payload)).catch(() => {
|
|
8345
|
+
});
|
|
8346
|
+
return true;
|
|
8347
|
+
}, [appStore]);
|
|
8348
|
+
const copySelectedComponent = useCallback23(
|
|
8349
|
+
(e) => {
|
|
8350
|
+
if (shouldBlockEditingHotkey(e)) return false;
|
|
8351
|
+
return writeSelectionToClipboard();
|
|
8352
|
+
},
|
|
8353
|
+
[writeSelectionToClipboard]
|
|
8354
|
+
);
|
|
8355
|
+
const cutSelectedComponent = useCallback23(
|
|
8356
|
+
(e) => {
|
|
8357
|
+
var _a;
|
|
8358
|
+
if (shouldBlockEditingHotkey(e)) return false;
|
|
8359
|
+
const { state, dispatch, permissions, selectedItem } = appStore.getState();
|
|
8360
|
+
const sel = (_a = state.ui) == null ? void 0 : _a.itemSelector;
|
|
8361
|
+
if (!(sel == null ? void 0 : sel.zone) || !selectedItem) return false;
|
|
8362
|
+
if (!permissions.getPermissions({ item: selectedItem }).delete)
|
|
8363
|
+
return true;
|
|
8364
|
+
if (!writeSelectionToClipboard()) return false;
|
|
8365
|
+
dispatch({
|
|
8366
|
+
type: "remove",
|
|
8367
|
+
index: sel.index,
|
|
8368
|
+
zone: sel.zone
|
|
8369
|
+
});
|
|
8370
|
+
return true;
|
|
8371
|
+
},
|
|
8372
|
+
[appStore, writeSelectionToClipboard]
|
|
8373
|
+
);
|
|
8374
|
+
const pasteComponent = useCallback23(
|
|
8375
|
+
(e) => {
|
|
8376
|
+
var _a, _b;
|
|
8377
|
+
if (shouldBlockEditingHotkey(e)) return false;
|
|
8378
|
+
const { state, dispatch, config } = appStore.getState();
|
|
8379
|
+
const sel = (_a = state.ui) == null ? void 0 : _a.itemSelector;
|
|
8380
|
+
if (!(sel == null ? void 0 : sel.zone)) return false;
|
|
8381
|
+
(_b = navigator.clipboard) == null ? void 0 : _b.readText().then((text) => {
|
|
8382
|
+
const data = parsePayload(text);
|
|
8383
|
+
if (!data) return;
|
|
8384
|
+
if (!config.components[data.type]) return;
|
|
8385
|
+
dispatch({
|
|
8386
|
+
type: "insert",
|
|
8387
|
+
componentType: data.type,
|
|
8388
|
+
destinationIndex: sel.index + 1,
|
|
8389
|
+
destinationZone: sel.zone,
|
|
8390
|
+
data
|
|
8391
|
+
});
|
|
8392
|
+
}).catch(() => {
|
|
8393
|
+
});
|
|
8394
|
+
return true;
|
|
8395
|
+
},
|
|
8396
|
+
[appStore]
|
|
8397
|
+
);
|
|
8398
|
+
useHotkey({ meta: true, c: true }, copySelectedComponent);
|
|
8399
|
+
useHotkey({ ctrl: true, c: true }, copySelectedComponent);
|
|
8400
|
+
useHotkey({ meta: true, v: true }, pasteComponent);
|
|
8401
|
+
useHotkey({ ctrl: true, v: true }, pasteComponent);
|
|
8402
|
+
useHotkey({ meta: true, x: true }, cutSelectedComponent);
|
|
8403
|
+
useHotkey({ ctrl: true, x: true }, cutSelectedComponent);
|
|
8404
|
+
};
|
|
8405
|
+
|
|
8068
8406
|
// components/Editor/components/Nav/index.tsx
|
|
8069
8407
|
init_react_import();
|
|
8070
8408
|
|
|
8071
8409
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Nav/styles.module.css#css-module
|
|
8072
8410
|
init_react_import();
|
|
8073
|
-
var
|
|
8411
|
+
var styles_module_default30 = { "Nav": "_Nav_1g4tk_1", "Nav-list": "_Nav-list_1g4tk_18", "Nav-footer": "_Nav-footer_1g4tk_42", "NavItem-link": "_NavItem-link_1g4tk_55", "NavItem-linkLabel": "_NavItem-linkLabel_1g4tk_83", "NavItem": "_NavItem_1g4tk_55", "NavItem-linkIcon": "_NavItem-linkIcon_1g4tk_108", "NavItem--active": "_NavItem--active_1g4tk_121", "NavItem--mobileOnly": "_NavItem--mobileOnly_1g4tk_132", "NavItem--desktopOnly": "_NavItem--desktopOnly_1g4tk_137" };
|
|
8074
8412
|
|
|
8075
8413
|
// components/Editor/components/Nav/index.tsx
|
|
8076
|
-
import { jsx as
|
|
8077
|
-
var
|
|
8078
|
-
var getClassNameItem3 = get_class_name_factory_default("NavItem",
|
|
8414
|
+
import { jsx as jsx54, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
8415
|
+
var getClassName34 = get_class_name_factory_default("Nav", styles_module_default30);
|
|
8416
|
+
var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default30);
|
|
8079
8417
|
var MenuItem = ({
|
|
8080
8418
|
label,
|
|
8081
8419
|
icon,
|
|
@@ -8084,7 +8422,7 @@ var MenuItem = ({
|
|
|
8084
8422
|
mobileOnly,
|
|
8085
8423
|
desktopOnly
|
|
8086
8424
|
}) => {
|
|
8087
|
-
return /* @__PURE__ */
|
|
8425
|
+
return /* @__PURE__ */ jsx54(
|
|
8088
8426
|
"li",
|
|
8089
8427
|
{
|
|
8090
8428
|
className: getClassNameItem3({
|
|
@@ -8092,9 +8430,9 @@ var MenuItem = ({
|
|
|
8092
8430
|
mobileOnly,
|
|
8093
8431
|
desktopOnly
|
|
8094
8432
|
}),
|
|
8095
|
-
children: onClick && /* @__PURE__ */
|
|
8096
|
-
icon && /* @__PURE__ */
|
|
8097
|
-
/* @__PURE__ */
|
|
8433
|
+
children: onClick && /* @__PURE__ */ jsxs23("div", { className: getClassNameItem3("link"), onClick, children: [
|
|
8434
|
+
icon && /* @__PURE__ */ jsx54("span", { className: getClassNameItem3("linkIcon"), children: icon }),
|
|
8435
|
+
/* @__PURE__ */ jsx54("span", { className: getClassNameItem3("linkLabel"), children: label })
|
|
8098
8436
|
] })
|
|
8099
8437
|
}
|
|
8100
8438
|
);
|
|
@@ -8103,17 +8441,17 @@ var Nav = ({
|
|
|
8103
8441
|
items,
|
|
8104
8442
|
footer
|
|
8105
8443
|
}) => {
|
|
8106
|
-
return /* @__PURE__ */
|
|
8107
|
-
/* @__PURE__ */
|
|
8108
|
-
footer && /* @__PURE__ */
|
|
8444
|
+
return /* @__PURE__ */ jsxs23("nav", { className: getClassName34(), children: [
|
|
8445
|
+
/* @__PURE__ */ jsx54("ul", { className: getClassName34("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx54(MenuItem, __spreadValues({}, item), key)) }),
|
|
8446
|
+
footer && /* @__PURE__ */ jsx54("div", { className: getClassName34("footer"), children: footer })
|
|
8109
8447
|
] });
|
|
8110
8448
|
};
|
|
8111
8449
|
|
|
8112
8450
|
// components/Editor/components/Layout/index.tsx
|
|
8113
|
-
import { Fragment as Fragment15, jsx as
|
|
8114
|
-
var
|
|
8115
|
-
var getLayoutClassName = get_class_name_factory_default("EditorLayout",
|
|
8116
|
-
var getPluginTabClassName = get_class_name_factory_default("EditorPluginTab",
|
|
8451
|
+
import { Fragment as Fragment15, jsx as jsx55, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
8452
|
+
var getClassName35 = get_class_name_factory_default("Editor", styles_module_default23);
|
|
8453
|
+
var getLayoutClassName = get_class_name_factory_default("EditorLayout", styles_module_default23);
|
|
8454
|
+
var getPluginTabClassName = get_class_name_factory_default("EditorPluginTab", styles_module_default23);
|
|
8117
8455
|
var FieldSideBarToolbar = () => {
|
|
8118
8456
|
const appStore = useAppStoreApi();
|
|
8119
8457
|
const { onPublish } = usePropsContext();
|
|
@@ -8124,30 +8462,30 @@ var FieldSideBarToolbar = () => {
|
|
|
8124
8462
|
const CustomHeaderActions = useAppStore(
|
|
8125
8463
|
(s) => s.overrides.headerActions || DefaultOverride
|
|
8126
8464
|
);
|
|
8127
|
-
return /* @__PURE__ */
|
|
8128
|
-
/* @__PURE__ */
|
|
8129
|
-
/* @__PURE__ */
|
|
8465
|
+
return /* @__PURE__ */ jsxs24("div", { className: getClassName35("fieldSideBarToolbar"), children: [
|
|
8466
|
+
/* @__PURE__ */ jsxs24("div", { className: getClassName35("fieldSideBarHistory"), children: [
|
|
8467
|
+
/* @__PURE__ */ jsx55(
|
|
8130
8468
|
IconButton,
|
|
8131
8469
|
{
|
|
8132
8470
|
type: "button",
|
|
8133
8471
|
title: "undo",
|
|
8134
8472
|
disabled: !hasPast,
|
|
8135
8473
|
onClick: back,
|
|
8136
|
-
children: /* @__PURE__ */
|
|
8474
|
+
children: /* @__PURE__ */ jsx55(Undo2, { size: 18 })
|
|
8137
8475
|
}
|
|
8138
8476
|
),
|
|
8139
|
-
/* @__PURE__ */
|
|
8477
|
+
/* @__PURE__ */ jsx55(
|
|
8140
8478
|
IconButton,
|
|
8141
8479
|
{
|
|
8142
8480
|
type: "button",
|
|
8143
8481
|
title: "redo",
|
|
8144
8482
|
disabled: !hasFuture,
|
|
8145
8483
|
onClick: forward,
|
|
8146
|
-
children: /* @__PURE__ */
|
|
8484
|
+
children: /* @__PURE__ */ jsx55(Redo2, { size: 18 })
|
|
8147
8485
|
}
|
|
8148
8486
|
)
|
|
8149
8487
|
] }),
|
|
8150
|
-
/* @__PURE__ */
|
|
8488
|
+
/* @__PURE__ */ jsx55("div", { className: getClassName35("fieldSideBarActions"), children: /* @__PURE__ */ jsx55(CustomHeaderActions, { children: /* @__PURE__ */ jsx55(
|
|
8151
8489
|
Button,
|
|
8152
8490
|
{
|
|
8153
8491
|
onClick: () => {
|
|
@@ -8166,9 +8504,9 @@ var FieldSideBar = () => {
|
|
|
8166
8504
|
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";
|
|
8167
8505
|
}
|
|
8168
8506
|
);
|
|
8169
|
-
return /* @__PURE__ */
|
|
8170
|
-
/* @__PURE__ */
|
|
8171
|
-
/* @__PURE__ */
|
|
8507
|
+
return /* @__PURE__ */ jsxs24(Fragment15, { children: [
|
|
8508
|
+
/* @__PURE__ */ jsx55(FieldSideBarToolbar, {}),
|
|
8509
|
+
/* @__PURE__ */ jsx55(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx55(Fields, {}) })
|
|
8172
8510
|
] });
|
|
8173
8511
|
};
|
|
8174
8512
|
var PluginTab = ({
|
|
@@ -8176,7 +8514,7 @@ var PluginTab = ({
|
|
|
8176
8514
|
visible,
|
|
8177
8515
|
mobileOnly
|
|
8178
8516
|
}) => {
|
|
8179
|
-
return /* @__PURE__ */
|
|
8517
|
+
return /* @__PURE__ */ jsx55("div", { className: getPluginTabClassName({ visible, mobileOnly }), children: /* @__PURE__ */ jsx55("div", { className: getPluginTabClassName("body"), children }) });
|
|
8180
8518
|
};
|
|
8181
8519
|
var Layout = ({ children }) => {
|
|
8182
8520
|
const {
|
|
@@ -8256,6 +8594,7 @@ var Layout = ({ children }) => {
|
|
|
8256
8594
|
}, [ready, iframe.enabled]);
|
|
8257
8595
|
usePreviewModeHotkeys();
|
|
8258
8596
|
useDeleteHotkeys();
|
|
8597
|
+
useClipboardHotkeys();
|
|
8259
8598
|
const layoutOptions = {};
|
|
8260
8599
|
if (leftWidth) {
|
|
8261
8600
|
layoutOptions["--editor-user-left-side-bar-width"] = `${leftWidth}px`;
|
|
@@ -8273,11 +8612,11 @@ var Layout = ({ children }) => {
|
|
|
8273
8612
|
const [mobilePanelHeight, setMobilePanelHeight] = useState23(
|
|
8274
8613
|
null
|
|
8275
8614
|
);
|
|
8276
|
-
const mobilePanelRef =
|
|
8277
|
-
const isDraggingMobile =
|
|
8278
|
-
const dragStartY =
|
|
8279
|
-
const dragStartHeight =
|
|
8280
|
-
const handleMobileDragStart =
|
|
8615
|
+
const mobilePanelRef = useRef18(null);
|
|
8616
|
+
const isDraggingMobile = useRef18(false);
|
|
8617
|
+
const dragStartY = useRef18(0);
|
|
8618
|
+
const dragStartHeight = useRef18(0);
|
|
8619
|
+
const handleMobileDragStart = useCallback24(
|
|
8281
8620
|
(clientY) => {
|
|
8282
8621
|
isDraggingMobile.current = true;
|
|
8283
8622
|
dragStartY.current = clientY;
|
|
@@ -8288,7 +8627,7 @@ var Layout = ({ children }) => {
|
|
|
8288
8627
|
},
|
|
8289
8628
|
[]
|
|
8290
8629
|
);
|
|
8291
|
-
const handleMobileDragMove =
|
|
8630
|
+
const handleMobileDragMove = useCallback24((clientY) => {
|
|
8292
8631
|
if (!isDraggingMobile.current) return;
|
|
8293
8632
|
const delta = dragStartY.current - clientY;
|
|
8294
8633
|
const viewportHeight = window.innerHeight;
|
|
@@ -8297,7 +8636,7 @@ var Layout = ({ children }) => {
|
|
|
8297
8636
|
const newH = Math.min(maxH, Math.max(minH, dragStartHeight.current + delta));
|
|
8298
8637
|
setMobilePanelHeight(newH);
|
|
8299
8638
|
}, []);
|
|
8300
|
-
const handleMobileDragEnd =
|
|
8639
|
+
const handleMobileDragEnd = useCallback24(() => {
|
|
8301
8640
|
if (!isDraggingMobile.current) return;
|
|
8302
8641
|
isDraggingMobile.current = false;
|
|
8303
8642
|
document.body.style.userSelect = "";
|
|
@@ -8342,7 +8681,7 @@ var Layout = ({ children }) => {
|
|
|
8342
8681
|
const toggleTheme = () => {
|
|
8343
8682
|
setTheme((t) => t === "dark" ? "light" : "dark");
|
|
8344
8683
|
};
|
|
8345
|
-
const themeIcon = theme === "dark" ? /* @__PURE__ */
|
|
8684
|
+
const themeIcon = theme === "dark" ? /* @__PURE__ */ jsx55(Sun, { size: 18 }) : /* @__PURE__ */ jsx55(Moon, { size: 18 });
|
|
8346
8685
|
const themeLabel = theme === "dark" ? "Switch to light mode" : "Switch to dark mode";
|
|
8347
8686
|
const hasLegacySideBarPlugin = useMemo23(
|
|
8348
8687
|
() => !!(plugins == null ? void 0 : plugins.find((p) => p.name === "legacy-side-bar")),
|
|
@@ -8367,7 +8706,7 @@ var Layout = ({ children }) => {
|
|
|
8367
8706
|
}
|
|
8368
8707
|
details[plugin.name] = {
|
|
8369
8708
|
label: (_a = plugin.label) != null ? _a : plugin.name,
|
|
8370
|
-
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */
|
|
8709
|
+
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ jsx55(ToyBrick, {}),
|
|
8371
8710
|
onClick: () => {
|
|
8372
8711
|
var _a2;
|
|
8373
8712
|
setMobilePanelHeightMode((_a2 = plugin.mobilePanelHeight) != null ? _a2 : "toggle");
|
|
@@ -8406,17 +8745,17 @@ var Layout = ({ children }) => {
|
|
|
8406
8745
|
if (mobilePanelHeight && leftSideBarVisible) {
|
|
8407
8746
|
mobilePanelStyle["--editor-mobile-panel-height"] = `${mobilePanelHeight}px`;
|
|
8408
8747
|
}
|
|
8409
|
-
return /* @__PURE__ */
|
|
8748
|
+
return /* @__PURE__ */ jsxs24(
|
|
8410
8749
|
"div",
|
|
8411
8750
|
{
|
|
8412
|
-
className: `Editor ${
|
|
8751
|
+
className: `Editor ${getClassName35({
|
|
8413
8752
|
hidePlugins: hasLegacySideBarPlugin
|
|
8414
8753
|
})}`,
|
|
8415
8754
|
id: instanceId,
|
|
8416
8755
|
"data-theme": theme,
|
|
8417
8756
|
style: { height },
|
|
8418
8757
|
children: [
|
|
8419
|
-
/* @__PURE__ */
|
|
8758
|
+
/* @__PURE__ */ jsx55(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx55(CustomEditor, { children: children || /* @__PURE__ */ jsx55(FrameProvider, { children: /* @__PURE__ */ jsx55(
|
|
8420
8759
|
"div",
|
|
8421
8760
|
{
|
|
8422
8761
|
className: getLayoutClassName({
|
|
@@ -8428,17 +8767,17 @@ var Layout = ({ children }) => {
|
|
|
8428
8767
|
mobilePanelCustomHeight: mobilePanelHeight !== null && leftSideBarVisible
|
|
8429
8768
|
}),
|
|
8430
8769
|
style: { height },
|
|
8431
|
-
children: /* @__PURE__ */
|
|
8770
|
+
children: /* @__PURE__ */ jsxs24(
|
|
8432
8771
|
"div",
|
|
8433
8772
|
{
|
|
8434
8773
|
className: getLayoutClassName("inner"),
|
|
8435
8774
|
style: __spreadValues(__spreadValues({}, layoutOptions), mobilePanelStyle),
|
|
8436
8775
|
children: [
|
|
8437
|
-
/* @__PURE__ */
|
|
8776
|
+
/* @__PURE__ */ jsx55("div", { className: getLayoutClassName("nav"), children: /* @__PURE__ */ jsx55(
|
|
8438
8777
|
Nav,
|
|
8439
8778
|
{
|
|
8440
8779
|
items: pluginItems,
|
|
8441
|
-
footer: /* @__PURE__ */
|
|
8780
|
+
footer: /* @__PURE__ */ jsx55(
|
|
8442
8781
|
IconButton,
|
|
8443
8782
|
{
|
|
8444
8783
|
type: "button",
|
|
@@ -8449,19 +8788,19 @@ var Layout = ({ children }) => {
|
|
|
8449
8788
|
)
|
|
8450
8789
|
}
|
|
8451
8790
|
) }),
|
|
8452
|
-
/* @__PURE__ */
|
|
8791
|
+
/* @__PURE__ */ jsxs24(
|
|
8453
8792
|
"div",
|
|
8454
8793
|
{
|
|
8455
8794
|
ref: mobilePanelRef,
|
|
8456
8795
|
className: getLayoutClassName("mobilePanel"),
|
|
8457
8796
|
children: [
|
|
8458
|
-
/* @__PURE__ */
|
|
8797
|
+
/* @__PURE__ */ jsx55(
|
|
8459
8798
|
"div",
|
|
8460
8799
|
{
|
|
8461
8800
|
className: getLayoutClassName("mobileDragHandle"),
|
|
8462
8801
|
onTouchStart: (e) => handleMobileDragStart(e.touches[0].clientY),
|
|
8463
8802
|
onMouseDown: (e) => handleMobileDragStart(e.clientY),
|
|
8464
|
-
children: /* @__PURE__ */
|
|
8803
|
+
children: /* @__PURE__ */ jsx55(
|
|
8465
8804
|
"div",
|
|
8466
8805
|
{
|
|
8467
8806
|
className: getLayoutClassName("mobileDragHandlePill")
|
|
@@ -8469,17 +8808,17 @@ var Layout = ({ children }) => {
|
|
|
8469
8808
|
)
|
|
8470
8809
|
}
|
|
8471
8810
|
),
|
|
8472
|
-
/* @__PURE__ */
|
|
8811
|
+
/* @__PURE__ */ jsx55(
|
|
8473
8812
|
"div",
|
|
8474
8813
|
{
|
|
8475
8814
|
className: getLayoutClassName("mobilePanelContent"),
|
|
8476
8815
|
children: Object.entries(pluginItems).map(
|
|
8477
|
-
([id, { mobileOnly, render: Render2 }]) => /* @__PURE__ */
|
|
8816
|
+
([id, { mobileOnly, render: Render2 }]) => /* @__PURE__ */ jsx55(
|
|
8478
8817
|
PluginTab,
|
|
8479
8818
|
{
|
|
8480
8819
|
visible: currentPlugin === id,
|
|
8481
8820
|
mobileOnly,
|
|
8482
|
-
children: /* @__PURE__ */
|
|
8821
|
+
children: /* @__PURE__ */ jsx55(Render2, {})
|
|
8483
8822
|
},
|
|
8484
8823
|
id
|
|
8485
8824
|
)
|
|
@@ -8489,7 +8828,7 @@ var Layout = ({ children }) => {
|
|
|
8489
8828
|
]
|
|
8490
8829
|
}
|
|
8491
8830
|
),
|
|
8492
|
-
/* @__PURE__ */
|
|
8831
|
+
/* @__PURE__ */ jsx55(
|
|
8493
8832
|
Sidebar,
|
|
8494
8833
|
{
|
|
8495
8834
|
position: "left",
|
|
@@ -8498,20 +8837,20 @@ var Layout = ({ children }) => {
|
|
|
8498
8837
|
onResize: setLeftWidth,
|
|
8499
8838
|
onResizeEnd: handleLeftSidebarResizeEnd,
|
|
8500
8839
|
children: Object.entries(pluginItems).map(
|
|
8501
|
-
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */
|
|
8840
|
+
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */ jsx55(
|
|
8502
8841
|
PluginTab,
|
|
8503
8842
|
{
|
|
8504
8843
|
visible: currentPlugin === id,
|
|
8505
8844
|
mobileOnly,
|
|
8506
|
-
children: /* @__PURE__ */
|
|
8845
|
+
children: /* @__PURE__ */ jsx55(Render2, {})
|
|
8507
8846
|
},
|
|
8508
8847
|
id
|
|
8509
8848
|
)
|
|
8510
8849
|
)
|
|
8511
8850
|
}
|
|
8512
8851
|
),
|
|
8513
|
-
/* @__PURE__ */
|
|
8514
|
-
!hasDesktopFieldsPlugin && /* @__PURE__ */
|
|
8852
|
+
/* @__PURE__ */ jsx55(Canvas, {}),
|
|
8853
|
+
!hasDesktopFieldsPlugin && /* @__PURE__ */ jsx55(
|
|
8515
8854
|
Sidebar,
|
|
8516
8855
|
{
|
|
8517
8856
|
position: "right",
|
|
@@ -8519,7 +8858,7 @@ var Layout = ({ children }) => {
|
|
|
8519
8858
|
isVisible: rightSideBarVisible,
|
|
8520
8859
|
onResize: setRightWidth,
|
|
8521
8860
|
onResizeEnd: handleRightSidebarResizeEnd,
|
|
8522
|
-
children: /* @__PURE__ */
|
|
8861
|
+
children: /* @__PURE__ */ jsx55(FieldSideBar, {})
|
|
8523
8862
|
}
|
|
8524
8863
|
)
|
|
8525
8864
|
]
|
|
@@ -8527,17 +8866,17 @@ var Layout = ({ children }) => {
|
|
|
8527
8866
|
)
|
|
8528
8867
|
}
|
|
8529
8868
|
) }) }) }),
|
|
8530
|
-
/* @__PURE__ */
|
|
8869
|
+
/* @__PURE__ */ jsx55("div", { id: "editor-portal-root", className: getClassName35("portal") })
|
|
8531
8870
|
]
|
|
8532
8871
|
}
|
|
8533
8872
|
);
|
|
8534
8873
|
};
|
|
8535
8874
|
|
|
8536
8875
|
// components/Editor/index.tsx
|
|
8537
|
-
import { jsx as
|
|
8876
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
8538
8877
|
var propsContext = createContext8({});
|
|
8539
8878
|
function PropsProvider(props) {
|
|
8540
|
-
return /* @__PURE__ */
|
|
8879
|
+
return /* @__PURE__ */ jsx56(propsContext.Provider, { value: props, children: props.children });
|
|
8541
8880
|
}
|
|
8542
8881
|
var usePropsContext = () => useContext15(propsContext);
|
|
8543
8882
|
function EditorProvider({ children }) {
|
|
@@ -8651,7 +8990,7 @@ function EditorProvider({ children }) {
|
|
|
8651
8990
|
return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
|
|
8652
8991
|
}, [fieldTransforms, plugins]);
|
|
8653
8992
|
const instanceId = useSafeId();
|
|
8654
|
-
const generateAppStore =
|
|
8993
|
+
const generateAppStore = useCallback25(
|
|
8655
8994
|
(state) => {
|
|
8656
8995
|
return {
|
|
8657
8996
|
instanceId,
|
|
@@ -8700,7 +9039,7 @@ function EditorProvider({ children }) {
|
|
|
8700
9039
|
index: initialHistoryIndex,
|
|
8701
9040
|
initialAppState
|
|
8702
9041
|
});
|
|
8703
|
-
const previousData =
|
|
9042
|
+
const previousData = useRef19(null);
|
|
8704
9043
|
useEffect26(() => {
|
|
8705
9044
|
return appStore.subscribe(
|
|
8706
9045
|
(s) => s.state.data,
|
|
@@ -8721,10 +9060,10 @@ function EditorProvider({ children }) {
|
|
|
8721
9060
|
resolveAndCommitData();
|
|
8722
9061
|
}, 0);
|
|
8723
9062
|
}, []);
|
|
8724
|
-
return /* @__PURE__ */
|
|
9063
|
+
return /* @__PURE__ */ jsx56(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx56(UseEditorStoreContext.Provider, { value: uEditorStore, children }) });
|
|
8725
9064
|
}
|
|
8726
9065
|
function Editor3(props) {
|
|
8727
|
-
return /* @__PURE__ */
|
|
9066
|
+
return /* @__PURE__ */ jsx56(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx56(EditorProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx56(Layout, { children: props.children }) })) }));
|
|
8728
9067
|
}
|
|
8729
9068
|
Editor3.Components = Components;
|
|
8730
9069
|
Editor3.Fields = Fields;
|
|
@@ -8757,12 +9096,12 @@ function pageMetadata(data) {
|
|
|
8757
9096
|
|
|
8758
9097
|
// plugins/legacy-side-bar/index.tsx
|
|
8759
9098
|
init_react_import();
|
|
8760
|
-
import { jsx as
|
|
9099
|
+
import { jsx as jsx57, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
8761
9100
|
var legacySideBarPlugin = () => ({
|
|
8762
9101
|
name: "legacy-side-bar",
|
|
8763
|
-
render: () => /* @__PURE__ */
|
|
8764
|
-
/* @__PURE__ */
|
|
8765
|
-
/* @__PURE__ */
|
|
9102
|
+
render: () => /* @__PURE__ */ jsxs25("div", { style: { overflowY: "auto" }, children: [
|
|
9103
|
+
/* @__PURE__ */ jsx57(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx57(Components, {}) }),
|
|
9104
|
+
/* @__PURE__ */ jsx57(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx57(Outline, {}) })
|
|
8766
9105
|
] })
|
|
8767
9106
|
});
|
|
8768
9107
|
|
|
@@ -8817,7 +9156,6 @@ export {
|
|
|
8817
9156
|
renderContext,
|
|
8818
9157
|
Render,
|
|
8819
9158
|
registerOverlayPortal,
|
|
8820
|
-
DropZone,
|
|
8821
9159
|
Drawer,
|
|
8822
9160
|
ComponentList,
|
|
8823
9161
|
createUseEditor,
|
|
@@ -8826,6 +9164,7 @@ export {
|
|
|
8826
9164
|
blocksPlugin,
|
|
8827
9165
|
outlinePlugin,
|
|
8828
9166
|
fieldsPlugin,
|
|
9167
|
+
usePropsContext,
|
|
8829
9168
|
Editor3 as Editor,
|
|
8830
9169
|
pageMetadata,
|
|
8831
9170
|
legacySideBarPlugin
|