@reacteditor/core 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  defaultAppState,
6
6
  resolveComponentData
7
- } from "./chunk-NPC7A3V3.mjs";
7
+ } from "./chunk-FTVOCMGV.mjs";
8
8
  import {
9
9
  get_class_name_factory_default
10
10
  } from "./chunk-Y2EFNT5P.mjs";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  LoadedRichTextMenuInner
3
- } from "./chunk-TFAZFGYZ.mjs";
3
+ } from "./chunk-Q667J2EG.mjs";
4
4
  import {
5
5
  styles_module_default
6
6
  } from "./chunk-6QJ2HF4O.mjs";
7
7
  import {
8
8
  useAppStore,
9
9
  useAppStoreApi
10
- } from "./chunk-T43H325W.mjs";
10
+ } from "./chunk-JHURG5NN.mjs";
11
11
  import {
12
12
  get_class_name_factory_default
13
13
  } from "./chunk-Y2EFNT5P.mjs";
@@ -100,7 +100,7 @@ init_react_import();
100
100
  import { lazy, Suspense } from "react";
101
101
  import { jsx as jsx2 } from "react/jsx-runtime";
102
102
  var LoadedRichTextMenuFull = lazy(
103
- () => import("./full-PM3VSLYA.mjs").then((m) => ({
103
+ () => import("./full-T5SGODJ2.mjs").then((m) => ({
104
104
  default: m.LoadedRichTextMenuFull
105
105
  }))
106
106
  );
@@ -9,6 +9,14 @@ import {
9
9
  init_react_import
10
10
  } from "./chunk-M6W7YEVX.mjs";
11
11
 
12
+ // components/ViewportControls/default-viewports.ts
13
+ init_react_import();
14
+ var defaultViewports = [
15
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
16
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
17
+ { width: "100%", height: "auto", icon: "Monitor", label: "Desktop" }
18
+ ];
19
+
12
20
  // lib/resolve-component-data.ts
13
21
  init_react_import();
14
22
 
@@ -115,9 +123,10 @@ var defaultAppState = {
115
123
  isDragging: false,
116
124
  previewMode: "edit",
117
125
  viewports: {
118
- // Default to the tablet viewport (the middle option) so the canvas
119
- // opens at a comfortable preview width on most screens.
120
- current: { width: 768, height: "auto" },
126
+ current: {
127
+ width: defaultViewports[0].width,
128
+ height: defaultViewports[0].height || "auto"
129
+ },
121
130
  options: [],
122
131
  controlsVisible: true
123
132
  },
@@ -131,6 +140,7 @@ var defaultAppState = {
131
140
  };
132
141
 
133
142
  export {
143
+ defaultViewports,
134
144
  getChanged,
135
145
  resolveComponentData,
136
146
  defaultAppState
@@ -5,9 +5,10 @@ import {
5
5
  } from "./chunk-M4JDRFYB.mjs";
6
6
  import {
7
7
  defaultAppState,
8
+ defaultViewports,
8
9
  getChanged,
9
10
  resolveComponentData
10
- } from "./chunk-NPC7A3V3.mjs";
11
+ } from "./chunk-FTVOCMGV.mjs";
11
12
  import {
12
13
  get_class_name_factory_default
13
14
  } from "./chunk-Y2EFNT5P.mjs";
@@ -517,13 +518,6 @@ var Sun = createLucideIcon("Sun", [
517
518
  ["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
518
519
  ]);
519
520
 
520
- // ../../node_modules/lucide-react/dist/esm/icons/tablet.js
521
- init_react_import();
522
- var Tablet = createLucideIcon("Tablet", [
523
- ["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
524
- ["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
525
- ]);
526
-
527
521
  // ../../node_modules/lucide-react/dist/esm/icons/toy-brick.js
528
522
  init_react_import();
529
523
  var ToyBrick = createLucideIcon("ToyBrick", [
@@ -569,16 +563,6 @@ var X = createLucideIcon("X", [
569
563
 
570
564
  // store/index.ts
571
565
  init_react_import();
572
-
573
- // components/ViewportControls/default-viewports.ts
574
- init_react_import();
575
- var defaultViewports = [
576
- { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
577
- { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
578
- { width: "100%", height: "auto", icon: "Monitor", label: "Desktop" }
579
- ];
580
-
581
- // store/index.ts
582
566
  import { create as create2, useStore } from "zustand";
583
567
  import { subscribeWithSelector as subscribeWithSelector2 } from "zustand/middleware";
584
568
  import { createContext, useContext } from "react";
@@ -1393,6 +1377,125 @@ init_react_import();
1393
1377
  // lib/get-zoom-config.ts
1394
1378
  init_react_import();
1395
1379
 
1380
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
1381
+ init_react_import();
1382
+
1383
+ // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
1384
+ init_react_import();
1385
+ var isProduction = process.env.NODE_ENV === "production";
1386
+ var prefix = "Invariant failed";
1387
+ function invariant(condition, message) {
1388
+ if (condition) {
1389
+ return;
1390
+ }
1391
+ if (isProduction) {
1392
+ throw new Error(prefix);
1393
+ }
1394
+ var provided = typeof message === "function" ? message() : message;
1395
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
1396
+ throw new Error(value);
1397
+ }
1398
+
1399
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
1400
+ var getRect = function getRect2(_ref) {
1401
+ var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
1402
+ var width = right - left;
1403
+ var height = bottom - top;
1404
+ var rect = {
1405
+ top,
1406
+ right,
1407
+ bottom,
1408
+ left,
1409
+ width,
1410
+ height,
1411
+ x: left,
1412
+ y: top,
1413
+ center: {
1414
+ x: (right + left) / 2,
1415
+ y: (bottom + top) / 2
1416
+ }
1417
+ };
1418
+ return rect;
1419
+ };
1420
+ var expand = function expand2(target, expandBy) {
1421
+ return {
1422
+ top: target.top - expandBy.top,
1423
+ left: target.left - expandBy.left,
1424
+ bottom: target.bottom + expandBy.bottom,
1425
+ right: target.right + expandBy.right
1426
+ };
1427
+ };
1428
+ var shrink = function shrink2(target, shrinkBy) {
1429
+ return {
1430
+ top: target.top + shrinkBy.top,
1431
+ left: target.left + shrinkBy.left,
1432
+ bottom: target.bottom - shrinkBy.bottom,
1433
+ right: target.right - shrinkBy.right
1434
+ };
1435
+ };
1436
+ var noSpacing = {
1437
+ top: 0,
1438
+ right: 0,
1439
+ bottom: 0,
1440
+ left: 0
1441
+ };
1442
+ var createBox = function createBox2(_ref2) {
1443
+ var borderBox = _ref2.borderBox, _ref2$margin = _ref2.margin, margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin, _ref2$border = _ref2.border, border = _ref2$border === void 0 ? noSpacing : _ref2$border, _ref2$padding = _ref2.padding, padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
1444
+ var marginBox = getRect(expand(borderBox, margin));
1445
+ var paddingBox = getRect(shrink(borderBox, border));
1446
+ var contentBox = getRect(shrink(paddingBox, padding));
1447
+ return {
1448
+ marginBox,
1449
+ borderBox: getRect(borderBox),
1450
+ paddingBox,
1451
+ contentBox,
1452
+ margin,
1453
+ border,
1454
+ padding
1455
+ };
1456
+ };
1457
+ var parse = function parse2(raw) {
1458
+ var value = raw.slice(0, -2);
1459
+ var suffix = raw.slice(-2);
1460
+ if (suffix !== "px") {
1461
+ return 0;
1462
+ }
1463
+ var result = Number(value);
1464
+ !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
1465
+ return result;
1466
+ };
1467
+ var calculateBox = function calculateBox2(borderBox, styles) {
1468
+ var margin = {
1469
+ top: parse(styles.marginTop),
1470
+ right: parse(styles.marginRight),
1471
+ bottom: parse(styles.marginBottom),
1472
+ left: parse(styles.marginLeft)
1473
+ };
1474
+ var padding = {
1475
+ top: parse(styles.paddingTop),
1476
+ right: parse(styles.paddingRight),
1477
+ bottom: parse(styles.paddingBottom),
1478
+ left: parse(styles.paddingLeft)
1479
+ };
1480
+ var border = {
1481
+ top: parse(styles.borderTopWidth),
1482
+ right: parse(styles.borderRightWidth),
1483
+ bottom: parse(styles.borderBottomWidth),
1484
+ left: parse(styles.borderLeftWidth)
1485
+ };
1486
+ return createBox({
1487
+ borderBox,
1488
+ margin,
1489
+ padding,
1490
+ border
1491
+ });
1492
+ };
1493
+ var getBox = function getBox2(el) {
1494
+ var borderBox = el.getBoundingClientRect();
1495
+ var styles = window.getComputedStyle(el);
1496
+ return calculateBox(borderBox, styles);
1497
+ };
1498
+
1396
1499
  // components/Select/index.tsx
1397
1500
  import { jsx, jsxs } from "react/jsx-runtime";
1398
1501
  var getClassName = get_class_name_factory_default("Select", styles_module_default);
@@ -1533,7 +1636,6 @@ export {
1533
1636
  SquareCode,
1534
1637
  Strikethrough,
1535
1638
  Sun,
1536
- Tablet,
1537
1639
  ToyBrick,
1538
1640
  Trash,
1539
1641
  Underline,
@@ -1542,7 +1644,6 @@ export {
1542
1644
  X,
1543
1645
  reorder,
1544
1646
  replace,
1545
- defaultViewports,
1546
1647
  monitorHotkeys,
1547
1648
  useMonitorHotkeys,
1548
1649
  useHotkey,
@@ -1553,6 +1654,7 @@ export {
1553
1654
  appStoreContext,
1554
1655
  useAppStore,
1555
1656
  useAppStoreApi,
1657
+ getBox,
1556
1658
  ControlContext,
1557
1659
  useControlContext,
1558
1660
  SelectControl
@@ -1606,7 +1708,6 @@ lucide-react/dist/esm/icons/smartphone.js:
1606
1708
  lucide-react/dist/esm/icons/square-code.js:
1607
1709
  lucide-react/dist/esm/icons/strikethrough.js:
1608
1710
  lucide-react/dist/esm/icons/sun.js:
1609
- lucide-react/dist/esm/icons/tablet.js:
1610
1711
  lucide-react/dist/esm/icons/toy-brick.js:
1611
1712
  lucide-react/dist/esm/icons/trash.js:
1612
1713
  lucide-react/dist/esm/icons/underline.js:
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  useListOptions
3
- } from "./chunk-C2KWANIN.mjs";
3
+ } from "./chunk-RQZQMS6E.mjs";
4
4
  import {
5
5
  useAlignOptions
6
- } from "./chunk-NKHR722W.mjs";
6
+ } from "./chunk-RGC274VM.mjs";
7
7
  import {
8
8
  useHeadingOptions
9
- } from "./chunk-GIGXMGTZ.mjs";
9
+ } from "./chunk-TG2KTWSB.mjs";
10
10
  import {
11
11
  AlignCenter,
12
12
  AlignJustify,
@@ -26,7 +26,7 @@ import {
26
26
  Strikethrough,
27
27
  Underline,
28
28
  useControlContext
29
- } from "./chunk-T43H325W.mjs";
29
+ } from "./chunk-JHURG5NN.mjs";
30
30
  import {
31
31
  get_class_name_factory_default
32
32
  } from "./chunk-Y2EFNT5P.mjs";
@@ -349,7 +349,7 @@ function AlignSelectFallback() {
349
349
  // components/RichTextMenu/controls/AlignSelect/index.tsx
350
350
  import { jsx as jsx10 } from "react/jsx-runtime";
351
351
  var AlignSelectLoaded = lazy(
352
- () => import("./loaded-ULJY3YN5.mjs").then((m) => ({
352
+ () => import("./loaded-ZQCRSG65.mjs").then((m) => ({
353
353
  default: m.AlignSelectLoaded
354
354
  }))
355
355
  );
@@ -580,7 +580,7 @@ function HeadingSelectFallback() {
580
580
  // components/RichTextMenu/controls/HeadingSelect/index.tsx
581
581
  import { jsx as jsx22 } from "react/jsx-runtime";
582
582
  var HeadingSelectLoaded = lazy2(
583
- () => import("./loaded-IIHO4UZS.mjs").then((m) => ({
583
+ () => import("./loaded-6YKSFCCD.mjs").then((m) => ({
584
584
  default: m.HeadingSelectLoaded
585
585
  }))
586
586
  );
@@ -612,7 +612,7 @@ function ListSelectFallback() {
612
612
  // components/RichTextMenu/controls/ListSelect/index.tsx
613
613
  import { jsx as jsx24 } from "react/jsx-runtime";
614
614
  var ListSelectLoaded = lazy3(
615
- () => import("./loaded-5MUU76TF.mjs").then((m) => ({
615
+ () => import("./loaded-DUBT6SP5.mjs").then((m) => ({
616
616
  default: m.ListSelectLoaded
617
617
  }))
618
618
  );
@@ -3,7 +3,7 @@ import {
3
3
  AlignJustify,
4
4
  AlignLeft,
5
5
  AlignRight
6
- } from "./chunk-T43H325W.mjs";
6
+ } from "./chunk-JHURG5NN.mjs";
7
7
  import {
8
8
  init_react_import
9
9
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  List,
3
3
  ListOrdered
4
- } from "./chunk-T43H325W.mjs";
4
+ } from "./chunk-JHURG5NN.mjs";
5
5
  import {
6
6
  init_react_import
7
7
  } from "./chunk-M6W7YEVX.mjs";
@@ -5,7 +5,7 @@ import {
5
5
  Heading4,
6
6
  Heading5,
7
7
  Heading6
8
- } from "./chunk-T43H325W.mjs";
8
+ } from "./chunk-JHURG5NN.mjs";
9
9
  import {
10
10
  init_react_import
11
11
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  LoadedRichTextMenuInner
3
- } from "./chunk-TFAZFGYZ.mjs";
4
- import "./chunk-C2KWANIN.mjs";
5
- import "./chunk-NKHR722W.mjs";
6
- import "./chunk-GIGXMGTZ.mjs";
7
- import "./chunk-T43H325W.mjs";
3
+ } from "./chunk-Q667J2EG.mjs";
4
+ import "./chunk-RQZQMS6E.mjs";
5
+ import "./chunk-RGC274VM.mjs";
6
+ import "./chunk-TG2KTWSB.mjs";
7
+ import "./chunk-JHURG5NN.mjs";
8
8
  import "./chunk-M4JDRFYB.mjs";
9
- import "./chunk-NPC7A3V3.mjs";
9
+ import "./chunk-FTVOCMGV.mjs";
10
10
  import "./chunk-Y2EFNT5P.mjs";
11
11
  import "./chunk-JIXMPJZA.mjs";
12
12
  import {