@reacteditor/core 0.0.10 → 0.0.12

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.
Files changed (38) hide show
  1. package/README.md +7 -7
  2. package/dist/{Editor-3COFH5WN.mjs → Editor-GK6JTUPD.mjs} +7 -7
  3. package/dist/{actions-B8_EA7vy.d.mts → actions-C0LX6bI4.d.mts} +1 -0
  4. package/dist/{actions-B8_EA7vy.d.ts → actions-C0LX6bI4.d.ts} +1 -0
  5. package/dist/{chunk-LRFRIIKG.mjs → chunk-56I7ST5F.mjs} +1 -1
  6. package/dist/{chunk-IIRJMJFU.mjs → chunk-ERNSJXVF.mjs} +1 -0
  7. package/dist/{chunk-PUDWMFBH.mjs → chunk-II42EKFK.mjs} +1 -1
  8. package/dist/{chunk-AD7BMXAA.mjs → chunk-MJJPWASL.mjs} +1 -1
  9. package/dist/{chunk-3IP22OOD.mjs → chunk-OKTANBAI.mjs} +1140 -1118
  10. package/dist/{chunk-BUR5T7IX.mjs → chunk-TGVAC3JP.mjs} +7 -7
  11. package/dist/{chunk-FT6UFK7G.mjs → chunk-X4EUZIHA.mjs} +1 -1
  12. package/dist/{chunk-OIFPBVSF.mjs → chunk-XLVEWZWT.mjs} +1 -1
  13. package/dist/{chunk-BZ4BQZJR.mjs → chunk-YBG2RYVF.mjs} +3 -3
  14. package/dist/{full-QT5KXRDP.mjs → full-IUPXFMQP.mjs} +6 -6
  15. package/dist/{index-JoD48fK_.d.mts → index-DMbFEg8G.d.mts} +1 -1
  16. package/dist/{index-BrHy0cc_.d.ts → index-DmThy7vE.d.ts} +1 -1
  17. package/dist/index.css +69 -65
  18. package/dist/index.d.mts +52 -7
  19. package/dist/index.d.ts +52 -7
  20. package/dist/index.js +157 -134
  21. package/dist/index.mjs +9 -9
  22. package/dist/internal.d.mts +2 -2
  23. package/dist/internal.d.ts +2 -2
  24. package/dist/{loaded-GLBLMTBL.mjs → loaded-BT7NIVEO.mjs} +3 -3
  25. package/dist/{loaded-O4QHGE26.mjs → loaded-HVOKDVC3.mjs} +3 -3
  26. package/dist/{loaded-R34BR6I5.mjs → loaded-YFYCF5F4.mjs} +3 -3
  27. package/dist/no-external.css +69 -65
  28. package/dist/no-external.d.mts +4 -4
  29. package/dist/no-external.d.ts +4 -4
  30. package/dist/no-external.js +157 -134
  31. package/dist/no-external.mjs +9 -9
  32. package/dist/rsc.d.mts +2 -2
  33. package/dist/rsc.d.ts +2 -2
  34. package/dist/rsc.js +1 -0
  35. package/dist/rsc.mjs +2 -2
  36. package/dist/{walk-tree-BR2XIZ0W.d.mts → walk-tree-5oDs6qOL.d.mts} +1 -1
  37. package/dist/{walk-tree-DpUJ9kDx.d.ts → walk-tree-B1q6t5Jp.d.ts} +1 -1
  38. package/package.json +4 -4
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  EditorInner,
3
3
  LoadedRichTextMenu
4
- } from "./chunk-BZ4BQZJR.mjs";
4
+ } from "./chunk-YBG2RYVF.mjs";
5
5
  import {
6
6
  ActionBar,
7
7
  IconButton,
8
8
  LoadedRichTextMenuInner,
9
9
  Loader
10
- } from "./chunk-BUR5T7IX.mjs";
10
+ } from "./chunk-TGVAC3JP.mjs";
11
11
  import {
12
12
  RichTextRenderFallback,
13
13
  SlotRender,
@@ -16,7 +16,7 @@ import {
16
16
  getSlotTransform,
17
17
  useRichtextProps,
18
18
  useSlots
19
- } from "./chunk-PUDWMFBH.mjs";
19
+ } from "./chunk-II42EKFK.mjs";
20
20
  import {
21
21
  Check,
22
22
  ChevronDown,
@@ -60,7 +60,7 @@ import {
60
60
  useRegisterFieldsSlice,
61
61
  useRegisterHistorySlice,
62
62
  useRegisterPermissionsSlice
63
- } from "./chunk-LRFRIIKG.mjs";
63
+ } from "./chunk-56I7ST5F.mjs";
64
64
  import {
65
65
  getItem,
66
66
  insert,
@@ -71,7 +71,7 @@ import {
71
71
  import {
72
72
  defaultAppState,
73
73
  defaultViewports
74
- } from "./chunk-IIRJMJFU.mjs";
74
+ } from "./chunk-ERNSJXVF.mjs";
75
75
  import {
76
76
  get_class_name_factory_default
77
77
  } from "./chunk-Y2EFNT5P.mjs";
@@ -2146,7 +2146,7 @@ EditorFallback.displayName = "EditorFallback";
2146
2146
  // components/AutoField/fields/RichtextField/index.tsx
2147
2147
  import { Fragment as Fragment3, jsx as jsx20 } from "react/jsx-runtime";
2148
2148
  var Editor = lazy(
2149
- () => import("./Editor-3COFH5WN.mjs").then((m) => ({
2149
+ () => import("./Editor-GK6JTUPD.mjs").then((m) => ({
2150
2150
  default: m.Editor
2151
2151
  }))
2152
2152
  );
@@ -3219,7 +3219,7 @@ init_react_import();
3219
3219
 
3220
3220
  // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Drawer/styles.module.css#css-module
3221
3221
  init_react_import();
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" };
3222
+ var styles_module_default12 = { "Drawer": "_Drawer_1h4db_1", "Drawer--tile": "_Drawer--tile_1h4db_8", "Drawer-draggable": "_Drawer-draggable_1h4db_19", "Drawer-draggableBg": "_Drawer-draggableBg_1h4db_23", "DrawerItem-draggable": "_DrawerItem-draggable_1h4db_33", "DrawerItem-icon": "_DrawerItem-icon_1h4db_50", "DrawerItem--disabled": "_DrawerItem--disabled_1h4db_56", "DrawerItem": "_DrawerItem_1h4db_33", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_1h4db_66", "DrawerItem-name": "_DrawerItem-name_1h4db_91" };
3223
3223
 
3224
3224
  // components/Drawer/index.tsx
3225
3225
  import { useMemo as useMemo9, useState as useState11 } from "react";
@@ -4698,7 +4698,7 @@ import {
4698
4698
  } from "react";
4699
4699
  import { jsx as jsx30 } from "react/jsx-runtime";
4700
4700
  var Editor2 = lazy2(
4701
- () => import("./Editor-3COFH5WN.mjs").then((m) => ({
4701
+ () => import("./Editor-GK6JTUPD.mjs").then((m) => ({
4702
4702
  default: m.Editor
4703
4703
  }))
4704
4704
  );
@@ -5305,15 +5305,6 @@ var DropZoneEdit = forwardRef(
5305
5305
  }
5306
5306
  }
5307
5307
  }, [zoneType, appStoreApi]);
5308
- useEffect16(() => {
5309
- if (zoneType === "dropzone") {
5310
- if (zoneCompound !== rootDroppableId) {
5311
- console.warn(
5312
- "DropZones have been deprecated in favor of slot fields and will be removed in a future version of Editor. Please see the migration guide: https://www.frontend.co/docs/guides/migrations/dropzones-to-slots"
5313
- );
5314
- }
5315
- }
5316
- }, [zoneType]);
5317
5308
  const contentIds = useMemo12(() => {
5318
5309
  return zoneContentIds || [];
5319
5310
  }, [zoneContentIds]);
@@ -6137,848 +6128,387 @@ var blocksPlugin = () => ({
6137
6128
  icon: /* @__PURE__ */ jsx37(Plus, {})
6138
6129
  });
6139
6130
 
6140
- // plugins/outline/index.tsx
6131
+ // plugins/fields/index.tsx
6141
6132
  init_react_import();
6142
6133
 
6143
- // components/Editor/components/Outline/index.tsx
6134
+ // components/Breadcrumbs/index.tsx
6144
6135
  init_react_import();
6145
6136
 
6146
- // components/LayerTree/index.tsx
6137
+ // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Breadcrumbs/styles.module.css#css-module
6147
6138
  init_react_import();
6139
+ var styles_module_default17 = { "Breadcrumbs": "_Breadcrumbs_1cjxk_1", "Breadcrumbs-breadcrumb": "_Breadcrumbs-breadcrumb_1cjxk_10", "Breadcrumbs-breadcrumbLabel": "_Breadcrumbs-breadcrumbLabel_1cjxk_17" };
6148
6140
 
6149
- // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/LayerTree/styles.module.css#css-module
6141
+ // lib/use-breadcrumbs.ts
6150
6142
  init_react_import();
6151
- 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" };
6143
+ import { useMemo as useMemo15 } from "react";
6144
+ var useBreadcrumbs = (renderCount) => {
6145
+ const selectedId = useAppStore((s) => {
6146
+ var _a;
6147
+ return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
6148
+ });
6149
+ const config = useAppStore((s) => s.config);
6150
+ const path = useAppStore((s) => {
6151
+ var _a;
6152
+ return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
6153
+ });
6154
+ const appStore = useAppStoreApi();
6155
+ return useMemo15(() => {
6156
+ const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
6157
+ var _a, _b, _c, _d;
6158
+ const [componentId] = zoneCompound.split(":");
6159
+ if (componentId === "root") {
6160
+ return {
6161
+ label: ((_a = config == null ? void 0 : config.root) == null ? void 0 : _a.label) || "Page",
6162
+ selector: null
6163
+ };
6164
+ }
6165
+ const node = appStore.getState().state.indexes.nodes[componentId];
6166
+ const parentId = node.path[node.path.length - 1];
6167
+ const contentIds = ((_b = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _b.contentIds) || [];
6168
+ const index = contentIds.indexOf(componentId);
6169
+ const label = node ? (_d = (_c = config.components[node.data.type]) == null ? void 0 : _c.label) != null ? _d : node.data.type : "Component";
6170
+ return {
6171
+ label,
6172
+ selector: node ? {
6173
+ index,
6174
+ zone: node.path[node.path.length - 1]
6175
+ } : null
6176
+ };
6177
+ })) || [];
6178
+ if (renderCount) {
6179
+ return breadcrumbs.slice(breadcrumbs.length - renderCount);
6180
+ }
6181
+ return breadcrumbs;
6182
+ }, [path, renderCount]);
6183
+ };
6152
6184
 
6153
- // components/LayerTree/index.tsx
6185
+ // components/Breadcrumbs/index.tsx
6186
+ import { jsx as jsx38, jsxs as jsxs14 } from "react/jsx-runtime";
6187
+ var getClassName22 = get_class_name_factory_default("Breadcrumbs", styles_module_default17);
6188
+ var Breadcrumbs = ({
6189
+ children,
6190
+ numParents = 1
6191
+ }) => {
6192
+ const setUi = useAppStore((s) => s.setUi);
6193
+ const breadcrumbs = useBreadcrumbs(numParents);
6194
+ return /* @__PURE__ */ jsxs14("div", { className: getClassName22(), children: [
6195
+ breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs14("div", { className: getClassName22("breadcrumb"), children: [
6196
+ /* @__PURE__ */ jsx38(
6197
+ "button",
6198
+ {
6199
+ type: "button",
6200
+ className: getClassName22("breadcrumbLabel"),
6201
+ onClick: () => setUi({ itemSelector: breadcrumb.selector }),
6202
+ children: breadcrumb.label
6203
+ }
6204
+ ),
6205
+ /* @__PURE__ */ jsx38(ChevronRight, { size: 14 })
6206
+ ] }, i)),
6207
+ children
6208
+ ] });
6209
+ };
6210
+
6211
+ // components/Editor/components/Fields/index.tsx
6212
+ init_react_import();
6213
+
6214
+ // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Fields/styles.module.css#css-module
6215
+ init_react_import();
6216
+ var styles_module_default18 = { "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" };
6217
+
6218
+ // components/Editor/components/Fields/index.tsx
6154
6219
  import {
6155
- forwardRef as forwardRef2,
6220
+ memo as memo8,
6156
6221
  useCallback as useCallback15,
6157
6222
  useContext as useContext11,
6158
- useRef as useRef11
6223
+ useEffect as useEffect19,
6224
+ useMemo as useMemo16
6159
6225
  } from "react";
6160
- import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
6161
- import { Fragment as Fragment8, jsx as jsx38, jsxs as jsxs14 } from "react/jsx-runtime";
6162
- var getClassName22 = get_class_name_factory_default("LayerTree", styles_module_default17);
6163
- var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default17);
6164
- var DEFAULT_LAYER_ROW_HEIGHT = 32;
6165
- var LAYER_TREE_VIRTUALIZATION_OVERSCAN = 8;
6166
- var MIN_VIRTUALIZED_LAYER_COUNT = 25;
6167
- var measuredRowHeights = /* @__PURE__ */ new Map();
6168
- var getZonesByParent = (zones) => {
6169
- return Object.keys(zones).reduce((acc, zone) => {
6170
- const [parentId] = zone.split(":");
6171
- acc[parentId] = [...acc[parentId] || [], zone];
6172
- return acc;
6173
- }, {});
6174
- };
6175
- var getZoneLabel = (zoneCompound, nodes, config, label) => {
6176
- var _a, _b, _c, _d;
6177
- if (label !== void 0) {
6178
- return label;
6179
- }
6180
- const [componentId, slotId] = zoneCompound.split(":");
6181
- if (!slotId) {
6182
- return;
6183
- }
6184
- const componentType = (_a = nodes[componentId]) == null ? void 0 : _a.data.type;
6185
- const configForComponent = componentType && componentType !== rootAreaId ? config.components[componentType] : config.root;
6186
- return (_d = (_c = (_b = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _b[slotId]) == null ? void 0 : _c.label) != null ? _d : slotId;
6187
- };
6188
- var buildLayerNode = ({
6189
- config,
6190
- itemId,
6191
- index,
6192
- nodes,
6193
- zoneCompound,
6194
- zones,
6195
- zonesByParent
6196
- }) => {
6197
- var _a, _b, _c;
6198
- const nodeData = nodes[itemId];
6199
- const componentType = ((_a = nodeData == null ? void 0 : nodeData.data.type) == null ? void 0 : _a.toString()) || "Component";
6200
- const label = (_c = (_b = config.components[componentType]) == null ? void 0 : _b.label) != null ? _c : componentType;
6201
- const childZoneCompounds = zonesByParent[itemId] || [];
6202
- return {
6203
- childZones: childZoneCompounds.map(
6204
- (childZoneCompound) => buildLayerTree({
6205
- config,
6206
- nodes,
6207
- zoneCompound: childZoneCompound,
6208
- zones,
6209
- zonesByParent
6210
- })
6211
- ),
6212
- componentType,
6213
- index,
6214
- itemId,
6215
- label,
6216
- zoneCompound
6217
- };
6218
- };
6219
- var buildLayerTree = ({
6220
- config,
6221
- label,
6222
- nodes,
6223
- zoneCompound,
6224
- zones,
6225
- zonesByParent = getZonesByParent(zones)
6226
+ import { useShallow as useShallow7 } from "zustand/react/shallow";
6227
+ import { Fragment as Fragment8, jsx as jsx39, jsxs as jsxs15 } from "react/jsx-runtime";
6228
+ var getClassName23 = get_class_name_factory_default("EditorFields", styles_module_default18);
6229
+ var DefaultFields = ({
6230
+ children
6226
6231
  }) => {
6227
- var _a, _b;
6228
- const contentIds = (_b = (_a = zones[zoneCompound]) == null ? void 0 : _a.contentIds) != null ? _b : [];
6229
- return {
6230
- items: contentIds.map(
6231
- (itemId, index) => buildLayerNode({
6232
- config,
6233
- itemId,
6234
- index,
6235
- nodes,
6236
- zoneCompound,
6237
- zones,
6238
- zonesByParent
6239
- })
6240
- ),
6241
- label: getZoneLabel(zoneCompound, nodes, config, label),
6242
- zoneCompound
6243
- };
6244
- };
6245
- var getEstimatedRowHeight = (itemId) => {
6246
- var _a;
6247
- return (_a = measuredRowHeights.get(itemId)) != null ? _a : DEFAULT_LAYER_ROW_HEIGHT;
6232
+ return /* @__PURE__ */ jsx39(Fragment8, { children });
6248
6233
  };
6249
- var cacheMeasuredRowHeight = (itemId, height) => {
6250
- if (height <= 0) {
6234
+ var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
6235
+ const { dispatch, state, selectedItem, resolveComponentData } = appStore.getState();
6236
+ const { data, ui } = state;
6237
+ const { itemSelector } = ui;
6238
+ const rootProps = data.root.props || data.root;
6239
+ const currentProps = selectedItem ? selectedItem.props : rootProps;
6240
+ const newProps = __spreadProps(__spreadValues({}, currentProps), { [fieldName]: value });
6241
+ if (selectedItem && itemSelector) {
6242
+ const resolved = yield resolveComponentData(
6243
+ __spreadProps(__spreadValues({}, selectedItem), { props: newProps }),
6244
+ "replace"
6245
+ );
6246
+ const latestSelector = getSelectorForId(
6247
+ appStore.getState().state,
6248
+ selectedItem.props.id
6249
+ );
6250
+ if (!latestSelector) return;
6251
+ dispatch({
6252
+ type: "replace",
6253
+ destinationIndex: latestSelector.index,
6254
+ destinationZone: latestSelector.zone || rootDroppableId,
6255
+ data: resolved.node,
6256
+ ui: updatedUi
6257
+ });
6251
6258
  return;
6252
6259
  }
6253
- measuredRowHeights.set(itemId, height);
6254
- };
6255
- var getScrollParent = (el) => {
6256
- var _a;
6257
- let current = (_a = el == null ? void 0 : el.parentElement) != null ? _a : null;
6258
- while (current) {
6259
- const { overflow, overflowY } = getComputedStyle(current);
6260
- if ([overflow, overflowY].some((value) => /auto|scroll/.test(value))) {
6261
- return current;
6262
- }
6263
- current = current.parentElement;
6260
+ if (data.root.props) {
6261
+ dispatch({
6262
+ type: "replaceRoot",
6263
+ root: (yield resolveComponentData(
6264
+ __spreadProps(__spreadValues({}, data.root), { props: newProps }),
6265
+ "replace"
6266
+ )).node,
6267
+ ui: __spreadValues(__spreadValues({}, ui), updatedUi),
6268
+ recordHistory: true
6269
+ });
6270
+ return;
6264
6271
  }
6265
- return null;
6266
- };
6267
- var Layer = forwardRef2(function Layer2({
6268
- childIsSelected,
6269
- dataIndex,
6270
- depth,
6271
- isSelected,
6272
- node,
6273
- selectedId,
6274
- selectedPathIds
6275
- }, ref) {
6276
- const dispatch = useAppStore((s) => s.dispatch);
6277
- const zoneStore = useContext11(ZoneStoreContext);
6278
- const isHovering = useContextStore(
6279
- ZoneStoreContext,
6280
- (s) => s.hoveringComponent === node.itemId
6272
+ dispatch({
6273
+ type: "setData",
6274
+ data: { root: newProps }
6275
+ });
6276
+ });
6277
+ var FieldsChildInner = ({ fieldName }) => {
6278
+ const field = useAppStore((s) => s.fields.fields[fieldName]);
6279
+ const isReadOnly = useAppStore(
6280
+ (s) => ((s.selectedItem ? s.selectedItem.readOnly : s.state.data.root.readOnly) || {})[fieldName]
6281
6281
  );
6282
- const isGlobal = useAppStore(
6283
- (s) => {
6284
- var _a;
6285
- return ((_a = s.config.components[node.componentType]) == null ? void 0 : _a.global) === true;
6286
- }
6282
+ const id = useAppStore((s) => {
6283
+ if (!field) return null;
6284
+ return s.selectedItem ? `${s.selectedItem.props.id}_${field.type}_${fieldName}` : `root_${field.type}_${fieldName}`;
6285
+ });
6286
+ const permissions = useAppStore(
6287
+ useShallow7((s) => {
6288
+ const { selectedItem, permissions: permissions2 } = s;
6289
+ return selectedItem ? permissions2.getPermissions({ item: selectedItem }) : permissions2.getPermissions({ root: true });
6290
+ })
6287
6291
  );
6288
- const isUnlinked = useAppStore(
6292
+ const appStore = useAppStoreApi();
6293
+ const onChange = useCallback15(createOnChange(fieldName, appStore), [
6294
+ fieldName
6295
+ ]);
6296
+ const { visible = true } = field != null ? field : {};
6297
+ const fieldStore = useContext11(fieldContextStore.ctx);
6298
+ useEffect19(() => {
6299
+ return appStore.subscribe(
6300
+ (s) => {
6301
+ var _a;
6302
+ const data = s.getCurrentData();
6303
+ return (_a = data.props) == null ? void 0 : _a[fieldName];
6304
+ },
6305
+ (value) => {
6306
+ fieldStore.setState({ [fieldName]: value });
6307
+ }
6308
+ );
6309
+ }, [appStore, fieldStore]);
6310
+ if (!field || !id || !visible) return null;
6311
+ if (field.type === "slot") return null;
6312
+ return /* @__PURE__ */ jsx39("div", { className: getClassName23("field"), children: /* @__PURE__ */ jsx39(
6313
+ AutoFieldPrivate,
6314
+ {
6315
+ field,
6316
+ name: fieldName,
6317
+ id,
6318
+ readOnly: !permissions.edit || isReadOnly,
6319
+ onChange
6320
+ }
6321
+ ) }, id);
6322
+ };
6323
+ var FieldsChild = ({ fieldName }) => {
6324
+ const appStore = useAppStoreApi();
6325
+ const initialValue = useMemo16(() => {
6326
+ var _a;
6327
+ const value = (_a = appStore.getState().getCurrentData().props) == null ? void 0 : _a[fieldName];
6328
+ return { [fieldName]: value };
6329
+ }, []);
6330
+ return /* @__PURE__ */ jsx39(fieldContextStore.Provider, { value: initialValue, children: /* @__PURE__ */ jsx39(FieldsChildInner, { fieldName }) });
6331
+ };
6332
+ var FieldsChildMemo = memo8(FieldsChild);
6333
+ var GlobalSyncButton = () => {
6334
+ const appStore = useAppStoreApi();
6335
+ const selectedItem = useAppStore((s) => s.selectedItem);
6336
+ const isGlobalType = useAppStore(
6289
6337
  (s) => {
6290
- var _a, _b;
6291
- return ((_b = (_a = s.state.indexes.nodes[node.itemId]) == null ? void 0 : _a.data) == null ? void 0 : _b.synced) === false;
6338
+ var _a;
6339
+ return selectedItem ? ((_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.global) === true : false;
6292
6340
  }
6293
6341
  );
6294
- const containsZone = node.childZones.length > 0;
6295
- const setItemSelector = useCallback15(
6296
- (itemSelector) => {
6297
- dispatch({ type: "setUi", ui: { itemSelector } });
6298
- },
6299
- [dispatch]
6342
+ if (!selectedItem || !isGlobalType) return null;
6343
+ const isUnlinked = selectedItem.synced === false;
6344
+ const onClick = () => __async(null, null, function* () {
6345
+ const { dispatch, state, resolveComponentData } = appStore.getState();
6346
+ const latestSelector = getSelectorForId(state, selectedItem.props.id);
6347
+ if (!latestSelector) return;
6348
+ const resolved = yield resolveComponentData(
6349
+ __spreadProps(__spreadValues({}, selectedItem), { synced: isUnlinked ? true : false }),
6350
+ "replace"
6351
+ );
6352
+ dispatch({
6353
+ type: "replace",
6354
+ destinationIndex: latestSelector.index,
6355
+ destinationZone: latestSelector.zone || rootDroppableId,
6356
+ data: resolved.node
6357
+ });
6358
+ });
6359
+ const syncButtonClass = [
6360
+ getClassName23("syncButton"),
6361
+ isUnlinked ? styles_module_default18["EditorFields-syncButton--unlinked"] : null
6362
+ ].filter(Boolean).join(" ");
6363
+ return /* @__PURE__ */ jsxs15("button", { type: "button", className: syncButtonClass, onClick, children: [
6364
+ /* @__PURE__ */ jsx39(Link, { size: 14 }),
6365
+ /* @__PURE__ */ jsx39("span", { children: isUnlinked ? "Link to shared" : "Linked to shared" })
6366
+ ] });
6367
+ };
6368
+ var FieldsInternal = ({ wrapFields = true }) => {
6369
+ const overrides = useAppStore((s) => s.overrides);
6370
+ const componentResolving = useAppStore((s) => {
6371
+ var _a, _b;
6372
+ const loadingCount = s.selectedItem ? (_a = s.componentState[s.selectedItem.props.id]) == null ? void 0 : _a.loadingCount : (_b = s.componentState["root"]) == null ? void 0 : _b.loadingCount;
6373
+ return (loadingCount != null ? loadingCount : 0) > 0;
6374
+ });
6375
+ const itemSelector = useAppStore(useShallow7((s) => s.state.ui.itemSelector));
6376
+ const id = useAppStore((s) => {
6377
+ var _a;
6378
+ return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
6379
+ });
6380
+ const appStore = useAppStoreApi();
6381
+ useRegisterFieldsSlice(appStore, id);
6382
+ const fieldsLoading = useAppStore((s) => s.fields.loading);
6383
+ const fieldNames = useAppStore(
6384
+ useShallow7((s) => {
6385
+ if (s.fields.id === id) {
6386
+ return Object.keys(s.fields.fields);
6387
+ }
6388
+ return [];
6389
+ })
6300
6390
  );
6301
- const shouldRenderChildren = isSelected || childIsSelected;
6302
- return /* @__PURE__ */ jsxs14(
6303
- "li",
6391
+ const isLoading = fieldsLoading || componentResolving;
6392
+ const Wrapper = useMemo16(() => overrides.fields || DefaultFields, [overrides]);
6393
+ return /* @__PURE__ */ jsxs15(
6394
+ "form",
6304
6395
  {
6305
- ref,
6306
- className: getClassNameLayer({
6307
- childIsSelected,
6308
- containsZone,
6309
- isHovering,
6310
- isSelected,
6311
- isGlobal: isGlobal && !isUnlinked,
6312
- isUnlinked: isGlobal && isUnlinked
6313
- }),
6314
- "data-index": dataIndex,
6315
- "data-editor-layer-tree-id": node.itemId,
6396
+ className: getClassName23({ wrapFields }),
6397
+ onSubmit: (e) => {
6398
+ e.preventDefault();
6399
+ },
6316
6400
  children: [
6317
- /* @__PURE__ */ jsx38("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs14(
6318
- "button",
6319
- {
6320
- type: "button",
6321
- className: getClassNameLayer("clickable"),
6322
- onClick: () => {
6323
- if (isSelected) {
6324
- setItemSelector(null);
6325
- return;
6326
- }
6327
- setItemSelector({
6328
- index: node.index,
6329
- zone: node.zoneCompound
6330
- });
6331
- zoneStore.getState().scrollToComponent(node.itemId);
6332
- },
6333
- onMouseEnter: (e) => {
6334
- e.stopPropagation();
6335
- zoneStore.setState({ hoveringComponent: node.itemId });
6336
- },
6337
- onMouseLeave: (e) => {
6338
- e.stopPropagation();
6339
- zoneStore.setState({ hoveringComponent: null });
6340
- },
6341
- children: [
6342
- /* @__PURE__ */ jsx38(
6343
- "div",
6344
- {
6345
- className: getClassNameLayer("chevron"),
6346
- title: containsZone ? isSelected ? "Collapse" : "Expand" : void 0,
6347
- children: containsZone && /* @__PURE__ */ jsx38(ChevronRight, { size: "12" })
6348
- }
6349
- ),
6350
- /* @__PURE__ */ jsxs14("div", { className: getClassNameLayer("title"), children: [
6351
- /* @__PURE__ */ jsx38("div", { className: getClassNameLayer("icon"), children: /* @__PURE__ */ jsx38(Component, { size: "16" }) }),
6352
- /* @__PURE__ */ jsx38("div", { className: getClassNameLayer("name"), children: node.label }),
6353
- isGlobal && isUnlinked && /* @__PURE__ */ jsx38(
6354
- "div",
6355
- {
6356
- className: getClassNameLayer("unlinkedGlyph"),
6357
- title: "Unlinked from shared",
6358
- children: /* @__PURE__ */ jsx38(Unlink2, { size: "12" })
6359
- }
6360
- )
6361
- ] })
6362
- ]
6363
- }
6364
- ) }),
6365
- containsZone && shouldRenderChildren && node.childZones.map((childZone) => /* @__PURE__ */ jsx38(
6366
- "div",
6367
- {
6368
- className: getClassNameLayer("zones"),
6369
- children: /* @__PURE__ */ jsx38(
6370
- LayerTreeZone,
6371
- {
6372
- depth: depth + 1,
6373
- selectedId,
6374
- selectedPathIds,
6375
- tree: childZone
6376
- }
6377
- )
6378
- },
6379
- childZone.zoneCompound
6380
- ))
6401
+ /* @__PURE__ */ jsxs15(Wrapper, { isLoading, itemSelector, children: [
6402
+ /* @__PURE__ */ jsx39(GlobalSyncButton, {}),
6403
+ fieldNames.map((fieldName) => /* @__PURE__ */ jsx39(FieldsChildMemo, { fieldName }, fieldName))
6404
+ ] }),
6405
+ isLoading && /* @__PURE__ */ jsx39("div", { className: getClassName23("loadingOverlay"), children: /* @__PURE__ */ jsx39("div", { className: getClassName23("loadingOverlayInner"), children: /* @__PURE__ */ jsx39(Loader, { size: 16 }) }) })
6381
6406
  ]
6382
6407
  }
6383
6408
  );
6409
+ };
6410
+ var Fields = memo8(FieldsInternal);
6411
+
6412
+ // css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css#css-module
6413
+ init_react_import();
6414
+ var styles_module_default19 = { "FieldsPlugin": "_FieldsPlugin_262zt_1", "FieldsPlugin-header": "_FieldsPlugin-header_262zt_7" };
6415
+
6416
+ // plugins/fields/index.tsx
6417
+ import { jsx as jsx40, jsxs as jsxs16 } from "react/jsx-runtime";
6418
+ var getClassName24 = get_class_name_factory_default("FieldsPlugin", styles_module_default19);
6419
+ var CurrentTitle = () => {
6420
+ const label = useAppStore((s) => {
6421
+ var _a, _b;
6422
+ const selectedItem = s.selectedItem;
6423
+ return selectedItem ? (_b = (_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.label) != null ? _b : selectedItem.type : "Page";
6424
+ });
6425
+ return label;
6426
+ };
6427
+ var fieldsPlugin = ({ desktopSideBar = "right" } = {}) => ({
6428
+ name: "fields",
6429
+ label: "Fields",
6430
+ render: () => /* @__PURE__ */ jsxs16("div", { className: getClassName24(), children: [
6431
+ /* @__PURE__ */ jsx40("div", { className: getClassName24("header"), children: /* @__PURE__ */ jsx40(Breadcrumbs, { numParents: 2, children: /* @__PURE__ */ jsx40(CurrentTitle, {}) }) }),
6432
+ /* @__PURE__ */ jsx40(Fields, {})
6433
+ ] }),
6434
+ icon: /* @__PURE__ */ jsx40(RectangleEllipsis, {}),
6435
+ mobileOnly: desktopSideBar === "right"
6384
6436
  });
6385
- var LayerTreeZone = ({
6386
- depth,
6387
- selectedId,
6388
- selectedPathIds,
6389
- tree
6390
- }) => {
6391
- const shouldVirtualize = depth === 0 && tree.items.length >= MIN_VIRTUALIZED_LAYER_COUNT;
6392
- return /* @__PURE__ */ jsxs14(Fragment8, { children: [
6393
- tree.label && /* @__PURE__ */ jsx38("div", { className: getClassName22("zoneTitle"), children: tree.label }),
6394
- shouldVirtualize ? /* @__PURE__ */ jsx38(
6395
- VirtualizedLayerTreeItems,
6396
- {
6397
- depth,
6398
- selectedId,
6399
- selectedPathIds,
6400
- tree
6401
- }
6402
- ) : /* @__PURE__ */ jsx38(
6403
- StaticLayerTreeItems,
6404
- {
6405
- depth,
6406
- selectedId,
6407
- selectedPathIds,
6408
- tree
6437
+
6438
+ // components/Editor/index.tsx
6439
+ init_react_import();
6440
+ import {
6441
+ createContext as createContext8,
6442
+ useCallback as useCallback25,
6443
+ useContext as useContext15,
6444
+ useEffect as useEffect26,
6445
+ useMemo as useMemo24,
6446
+ useRef as useRef19,
6447
+ useState as useState24
6448
+ } from "react";
6449
+
6450
+ // components/Editor/components/Preview/index.tsx
6451
+ init_react_import();
6452
+ import { useCallback as useCallback16, useEffect as useEffect21, useRef as useRef11, useMemo as useMemo17 } from "react";
6453
+
6454
+ // components/AutoFrame/index.tsx
6455
+ init_react_import();
6456
+ import {
6457
+ createContext as createContext6,
6458
+ useContext as useContext12,
6459
+ useEffect as useEffect20,
6460
+ useState as useState18
6461
+ } from "react";
6462
+ import hash from "object-hash";
6463
+ import { createPortal as createPortal3 } from "react-dom";
6464
+ import { Fragment as Fragment9, jsx as jsx41 } from "react/jsx-runtime";
6465
+ var styleSelector = 'style, link[rel="stylesheet"]';
6466
+ var collectStyles = (doc) => {
6467
+ const collected = [];
6468
+ doc.querySelectorAll(styleSelector).forEach((style) => {
6469
+ if (style.tagName === "STYLE") {
6470
+ const hasContent = !!style.innerHTML.trim();
6471
+ if (hasContent) {
6472
+ collected.push(style);
6409
6473
  }
6410
- )
6411
- ] });
6474
+ } else {
6475
+ collected.push(style);
6476
+ }
6477
+ });
6478
+ return collected;
6412
6479
  };
6413
- var StaticLayerTreeItems = ({
6414
- depth,
6415
- selectedId,
6416
- selectedPathIds,
6417
- tree
6418
- }) => {
6419
- return /* @__PURE__ */ jsxs14("ul", { className: getClassName22(), children: [
6420
- tree.items.length === 0 && /* @__PURE__ */ jsx38("div", { className: getClassName22("helper"), children: "empty" }),
6421
- tree.items.map((node) => /* @__PURE__ */ jsx38(
6422
- Layer,
6423
- {
6424
- childIsSelected: selectedPathIds.has(node.itemId),
6425
- depth,
6426
- isSelected: selectedId === node.itemId,
6427
- node,
6428
- selectedId,
6429
- selectedPathIds
6430
- },
6431
- node.itemId
6432
- ))
6433
- ] });
6434
- };
6435
- var VirtualizedLayerTreeItems = ({
6436
- depth,
6437
- selectedId,
6438
- selectedPathIds,
6439
- tree
6440
- }) => {
6441
- const listRef = useRef11(null);
6442
- const virtualizer = useVirtualizer2({
6443
- count: tree.items.length,
6444
- estimateSize: (index) => getEstimatedRowHeight(tree.items[index].itemId),
6445
- getItemKey: (index) => tree.items[index].itemId,
6446
- getScrollElement: () => getScrollParent(listRef.current),
6447
- overscan: LAYER_TREE_VIRTUALIZATION_OVERSCAN,
6448
- measureElement: (element) => {
6449
- const height = Math.ceil(element.getBoundingClientRect().height);
6450
- const itemId = element.dataset.editorLayerTreeId;
6451
- if (itemId) {
6452
- cacheMeasuredRowHeight(itemId, height);
6453
- }
6454
- return height || DEFAULT_LAYER_ROW_HEIGHT;
6455
- }
6480
+ var getStyleSheet = (el) => {
6481
+ return Array.from(document.styleSheets).find((ss) => {
6482
+ const ownerNode = ss.ownerNode;
6483
+ return ownerNode.href === el.href;
6456
6484
  });
6457
- const virtualItems = virtualizer.getVirtualItems();
6458
- const totalSize = virtualizer.getTotalSize();
6459
- const renderedItems = [];
6460
- let previousEnd = 0;
6461
- let previousIndex = -1;
6462
- virtualItems.forEach((virtualItem) => {
6463
- const node = tree.items[virtualItem.index];
6464
- const gapSize = Math.max(virtualItem.start - previousEnd, 0);
6465
- if (gapSize > 0) {
6466
- renderedItems.push(
6467
- /* @__PURE__ */ jsx38(
6468
- "li",
6469
- {
6470
- "aria-hidden": "true",
6471
- style: { height: `${gapSize}px` }
6472
- },
6473
- `gap:${tree.zoneCompound}:${previousIndex}:${virtualItem.index}`
6474
- )
6485
+ };
6486
+ var getStyles = (styleSheet) => {
6487
+ if (styleSheet) {
6488
+ try {
6489
+ return Array.from(styleSheet.cssRules).map((rule) => rule.cssText).join("");
6490
+ } catch (e) {
6491
+ console.warn(
6492
+ "Access to stylesheet %s is denied. Ignoring\u2026",
6493
+ styleSheet.href
6475
6494
  );
6476
6495
  }
6477
- renderedItems.push(
6478
- /* @__PURE__ */ jsx38(
6479
- Layer,
6480
- {
6481
- childIsSelected: selectedPathIds.has(node.itemId),
6482
- dataIndex: virtualItem.index,
6483
- depth,
6484
- isSelected: selectedId === node.itemId,
6485
- node,
6486
- ref: virtualizer.measureElement,
6487
- selectedId,
6488
- selectedPathIds
6489
- },
6490
- node.itemId
6491
- )
6492
- );
6493
- previousEnd = virtualItem.end;
6494
- previousIndex = virtualItem.index;
6495
- });
6496
- const trailingGap = Math.max(totalSize - previousEnd, 0);
6497
- if (trailingGap > 0) {
6498
- renderedItems.push(
6499
- /* @__PURE__ */ jsx38(
6500
- "li",
6501
- {
6502
- "aria-hidden": "true",
6503
- style: { height: `${trailingGap}px` }
6504
- },
6505
- `gap:${tree.zoneCompound}:${previousIndex}:end`
6506
- )
6507
- );
6508
6496
  }
6509
- return /* @__PURE__ */ jsxs14("ul", { className: getClassName22(), ref: listRef, children: [
6510
- tree.items.length === 0 && /* @__PURE__ */ jsx38("div", { className: getClassName22("helper"), children: "empty" }),
6511
- renderedItems
6512
- ] });
6513
- };
6514
- var LayerTree = ({
6515
- selectedId,
6516
- selectedPathIds,
6517
- trees
6518
- }) => {
6519
- return /* @__PURE__ */ jsx38(Fragment8, { children: trees.map((tree) => /* @__PURE__ */ jsx38(
6520
- LayerTreeZone,
6521
- {
6522
- depth: 0,
6523
- selectedId,
6524
- selectedPathIds,
6525
- tree
6526
- },
6527
- tree.zoneCompound
6528
- )) });
6529
- };
6530
-
6531
- // components/Editor/components/Outline/index.tsx
6532
- import { useMemo as useMemo15 } from "react";
6533
-
6534
- // lib/data/find-zones-for-area.ts
6535
- init_react_import();
6536
- var findZonesForArea = (state, area) => {
6537
- return Object.keys(state.indexes.zones).filter(
6538
- (zone) => zone.split(":")[0] === area
6539
- );
6540
- };
6541
-
6542
- // components/Editor/components/Outline/index.tsx
6543
- import { useShallow as useShallow7 } from "zustand/react/shallow";
6544
- import { jsx as jsx39 } from "react/jsx-runtime";
6545
- var Outline = () => {
6546
- const outlineOverride = useAppStore((s) => s.overrides.outline);
6547
- const config = useAppStore((s) => s.config);
6548
- const nodes = useAppStore((s) => s.state.indexes.nodes);
6549
- const zones = useAppStore((s) => s.state.indexes.zones);
6550
- const selectedId = useAppStore((s) => {
6551
- var _a;
6552
- return ((_a = s.selectedItem) == null ? void 0 : _a.props.id) || null;
6553
- });
6554
- const rootZones = useAppStore(
6555
- useShallow7((s) => findZonesForArea(s.state, "root"))
6556
- );
6557
- const selectedPathIds = useMemo15(() => {
6558
- var _a;
6559
- const selectedPath = selectedId ? (_a = nodes[selectedId]) == null ? void 0 : _a.path : null;
6560
- return new Set(
6561
- (selectedPath == null ? void 0 : selectedPath.map((candidate) => candidate.split(":")[0]).filter(Boolean)) || []
6562
- );
6563
- }, [nodes, selectedId]);
6564
- const trees = useMemo15(
6565
- () => rootZones.map(
6566
- (zoneCompound) => buildLayerTree({
6567
- config,
6568
- label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
6569
- nodes,
6570
- zoneCompound,
6571
- zones
6572
- })
6573
- ),
6574
- [config, nodes, rootZones, zones]
6575
- );
6576
- const Wrapper = useMemo15(() => outlineOverride || "div", [outlineOverride]);
6577
- return /* @__PURE__ */ jsx39(Wrapper, { children: /* @__PURE__ */ jsx39(
6578
- LayerTree,
6579
- {
6580
- selectedId,
6581
- selectedPathIds,
6582
- trees
6583
- }
6584
- ) });
6497
+ return "";
6585
6498
  };
6586
-
6587
- // css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/outline/styles.module.css#css-module
6588
- init_react_import();
6589
- var styles_module_default18 = { "OutlinePlugin": "_OutlinePlugin_q92j6_1" };
6590
-
6591
- // plugins/outline/index.tsx
6592
- import { jsx as jsx40 } from "react/jsx-runtime";
6593
- var getClassName23 = get_class_name_factory_default("OutlinePlugin", styles_module_default18);
6594
- var outlinePlugin = () => ({
6595
- name: "outline",
6596
- label: "Outline",
6597
- render: () => /* @__PURE__ */ jsx40("div", { className: getClassName23(), children: /* @__PURE__ */ jsx40(Outline, {}) }),
6598
- icon: /* @__PURE__ */ jsx40(Layers, {})
6599
- });
6600
-
6601
- // plugins/fields/index.tsx
6602
- init_react_import();
6603
-
6604
- // components/Breadcrumbs/index.tsx
6605
- init_react_import();
6606
-
6607
- // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Breadcrumbs/styles.module.css#css-module
6608
- init_react_import();
6609
- var styles_module_default19 = { "Breadcrumbs": "_Breadcrumbs_1cjxk_1", "Breadcrumbs-breadcrumb": "_Breadcrumbs-breadcrumb_1cjxk_10", "Breadcrumbs-breadcrumbLabel": "_Breadcrumbs-breadcrumbLabel_1cjxk_17" };
6610
-
6611
- // lib/use-breadcrumbs.ts
6612
- init_react_import();
6613
- import { useMemo as useMemo16 } from "react";
6614
- var useBreadcrumbs = (renderCount) => {
6615
- const selectedId = useAppStore((s) => {
6616
- var _a;
6617
- return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
6618
- });
6619
- const config = useAppStore((s) => s.config);
6620
- const path = useAppStore((s) => {
6621
- var _a;
6622
- return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
6623
- });
6624
- const appStore = useAppStoreApi();
6625
- return useMemo16(() => {
6626
- const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
6627
- var _a, _b, _c, _d;
6628
- const [componentId] = zoneCompound.split(":");
6629
- if (componentId === "root") {
6630
- return {
6631
- label: ((_a = config == null ? void 0 : config.root) == null ? void 0 : _a.label) || "Page",
6632
- selector: null
6633
- };
6634
- }
6635
- const node = appStore.getState().state.indexes.nodes[componentId];
6636
- const parentId = node.path[node.path.length - 1];
6637
- const contentIds = ((_b = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _b.contentIds) || [];
6638
- const index = contentIds.indexOf(componentId);
6639
- const label = node ? (_d = (_c = config.components[node.data.type]) == null ? void 0 : _c.label) != null ? _d : node.data.type : "Component";
6640
- return {
6641
- label,
6642
- selector: node ? {
6643
- index,
6644
- zone: node.path[node.path.length - 1]
6645
- } : null
6646
- };
6647
- })) || [];
6648
- if (renderCount) {
6649
- return breadcrumbs.slice(breadcrumbs.length - renderCount);
6650
- }
6651
- return breadcrumbs;
6652
- }, [path, renderCount]);
6499
+ var syncAttributes = (sourceElement, targetElement) => {
6500
+ const attributes = sourceElement.attributes;
6501
+ if ((attributes == null ? void 0 : attributes.length) > 0) {
6502
+ Array.from(attributes).forEach((attribute) => {
6503
+ targetElement.setAttribute(attribute.name, attribute.value);
6504
+ });
6505
+ }
6653
6506
  };
6654
-
6655
- // components/Breadcrumbs/index.tsx
6656
- import { jsx as jsx41, jsxs as jsxs15 } from "react/jsx-runtime";
6657
- var getClassName24 = get_class_name_factory_default("Breadcrumbs", styles_module_default19);
6658
- var Breadcrumbs = ({
6507
+ var defer = (fn) => setTimeout(fn, 0);
6508
+ var CopyHostStyles = ({
6659
6509
  children,
6660
- numParents = 1
6661
- }) => {
6662
- const setUi = useAppStore((s) => s.setUi);
6663
- const breadcrumbs = useBreadcrumbs(numParents);
6664
- return /* @__PURE__ */ jsxs15("div", { className: getClassName24(), children: [
6665
- breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs15("div", { className: getClassName24("breadcrumb"), children: [
6666
- /* @__PURE__ */ jsx41(
6667
- "button",
6668
- {
6669
- type: "button",
6670
- className: getClassName24("breadcrumbLabel"),
6671
- onClick: () => setUi({ itemSelector: breadcrumb.selector }),
6672
- children: breadcrumb.label
6673
- }
6674
- ),
6675
- /* @__PURE__ */ jsx41(ChevronRight, { size: 14 })
6676
- ] }, i)),
6677
- children
6678
- ] });
6679
- };
6680
-
6681
- // components/Editor/components/Fields/index.tsx
6682
- init_react_import();
6683
-
6684
- // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Fields/styles.module.css#css-module
6685
- init_react_import();
6686
- 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" };
6687
-
6688
- // components/Editor/components/Fields/index.tsx
6689
- import {
6690
- memo as memo8,
6691
- useCallback as useCallback16,
6692
- useContext as useContext12,
6693
- useEffect as useEffect19,
6694
- useMemo as useMemo17
6695
- } from "react";
6696
- import { useShallow as useShallow8 } from "zustand/react/shallow";
6697
- import { Fragment as Fragment9, jsx as jsx42, jsxs as jsxs16 } from "react/jsx-runtime";
6698
- var getClassName25 = get_class_name_factory_default("EditorFields", styles_module_default20);
6699
- var DefaultFields = ({
6700
- children
6701
- }) => {
6702
- return /* @__PURE__ */ jsx42(Fragment9, { children });
6703
- };
6704
- var createOnChange = (fieldName, appStore) => (value, updatedUi) => __async(null, null, function* () {
6705
- const { dispatch, state, selectedItem, resolveComponentData } = appStore.getState();
6706
- const { data, ui } = state;
6707
- const { itemSelector } = ui;
6708
- const rootProps = data.root.props || data.root;
6709
- const currentProps = selectedItem ? selectedItem.props : rootProps;
6710
- const newProps = __spreadProps(__spreadValues({}, currentProps), { [fieldName]: value });
6711
- if (selectedItem && itemSelector) {
6712
- const resolved = yield resolveComponentData(
6713
- __spreadProps(__spreadValues({}, selectedItem), { props: newProps }),
6714
- "replace"
6715
- );
6716
- const latestSelector = getSelectorForId(
6717
- appStore.getState().state,
6718
- selectedItem.props.id
6719
- );
6720
- if (!latestSelector) return;
6721
- dispatch({
6722
- type: "replace",
6723
- destinationIndex: latestSelector.index,
6724
- destinationZone: latestSelector.zone || rootDroppableId,
6725
- data: resolved.node,
6726
- ui: updatedUi
6727
- });
6728
- return;
6729
- }
6730
- if (data.root.props) {
6731
- dispatch({
6732
- type: "replaceRoot",
6733
- root: (yield resolveComponentData(
6734
- __spreadProps(__spreadValues({}, data.root), { props: newProps }),
6735
- "replace"
6736
- )).node,
6737
- ui: __spreadValues(__spreadValues({}, ui), updatedUi),
6738
- recordHistory: true
6739
- });
6740
- return;
6741
- }
6742
- dispatch({
6743
- type: "setData",
6744
- data: { root: newProps }
6745
- });
6746
- });
6747
- var FieldsChildInner = ({ fieldName }) => {
6748
- const field = useAppStore((s) => s.fields.fields[fieldName]);
6749
- const isReadOnly = useAppStore(
6750
- (s) => ((s.selectedItem ? s.selectedItem.readOnly : s.state.data.root.readOnly) || {})[fieldName]
6751
- );
6752
- const id = useAppStore((s) => {
6753
- if (!field) return null;
6754
- return s.selectedItem ? `${s.selectedItem.props.id}_${field.type}_${fieldName}` : `root_${field.type}_${fieldName}`;
6755
- });
6756
- const permissions = useAppStore(
6757
- useShallow8((s) => {
6758
- const { selectedItem, permissions: permissions2 } = s;
6759
- return selectedItem ? permissions2.getPermissions({ item: selectedItem }) : permissions2.getPermissions({ root: true });
6760
- })
6761
- );
6762
- const appStore = useAppStoreApi();
6763
- const onChange = useCallback16(createOnChange(fieldName, appStore), [
6764
- fieldName
6765
- ]);
6766
- const { visible = true } = field != null ? field : {};
6767
- const fieldStore = useContext12(fieldContextStore.ctx);
6768
- useEffect19(() => {
6769
- return appStore.subscribe(
6770
- (s) => {
6771
- var _a;
6772
- const data = s.getCurrentData();
6773
- return (_a = data.props) == null ? void 0 : _a[fieldName];
6774
- },
6775
- (value) => {
6776
- fieldStore.setState({ [fieldName]: value });
6777
- }
6778
- );
6779
- }, [appStore, fieldStore]);
6780
- if (!field || !id || !visible) return null;
6781
- if (field.type === "slot") return null;
6782
- return /* @__PURE__ */ jsx42("div", { className: getClassName25("field"), children: /* @__PURE__ */ jsx42(
6783
- AutoFieldPrivate,
6784
- {
6785
- field,
6786
- name: fieldName,
6787
- id,
6788
- readOnly: !permissions.edit || isReadOnly,
6789
- onChange
6790
- }
6791
- ) }, id);
6792
- };
6793
- var FieldsChild = ({ fieldName }) => {
6794
- const appStore = useAppStoreApi();
6795
- const initialValue = useMemo17(() => {
6796
- var _a;
6797
- const value = (_a = appStore.getState().getCurrentData().props) == null ? void 0 : _a[fieldName];
6798
- return { [fieldName]: value };
6799
- }, []);
6800
- return /* @__PURE__ */ jsx42(fieldContextStore.Provider, { value: initialValue, children: /* @__PURE__ */ jsx42(FieldsChildInner, { fieldName }) });
6801
- };
6802
- var FieldsChildMemo = memo8(FieldsChild);
6803
- var GlobalSyncButton = () => {
6804
- const appStore = useAppStoreApi();
6805
- const selectedItem = useAppStore((s) => s.selectedItem);
6806
- const isGlobalType = useAppStore(
6807
- (s) => {
6808
- var _a;
6809
- return selectedItem ? ((_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.global) === true : false;
6810
- }
6811
- );
6812
- if (!selectedItem || !isGlobalType) return null;
6813
- const isUnlinked = selectedItem.synced === false;
6814
- const onClick = () => __async(null, null, function* () {
6815
- const { dispatch, state, resolveComponentData } = appStore.getState();
6816
- const latestSelector = getSelectorForId(state, selectedItem.props.id);
6817
- if (!latestSelector) return;
6818
- const resolved = yield resolveComponentData(
6819
- __spreadProps(__spreadValues({}, selectedItem), { synced: isUnlinked ? true : false }),
6820
- "replace"
6821
- );
6822
- dispatch({
6823
- type: "replace",
6824
- destinationIndex: latestSelector.index,
6825
- destinationZone: latestSelector.zone || rootDroppableId,
6826
- data: resolved.node
6827
- });
6828
- });
6829
- const syncButtonClass = [
6830
- getClassName25("syncButton"),
6831
- isUnlinked ? styles_module_default20["EditorFields-syncButton--unlinked"] : null
6832
- ].filter(Boolean).join(" ");
6833
- return /* @__PURE__ */ jsxs16("button", { type: "button", className: syncButtonClass, onClick, children: [
6834
- /* @__PURE__ */ jsx42(Link, { size: 14 }),
6835
- /* @__PURE__ */ jsx42("span", { children: isUnlinked ? "Link to shared" : "Linked to shared" })
6836
- ] });
6837
- };
6838
- var FieldsInternal = ({ wrapFields = true }) => {
6839
- const overrides = useAppStore((s) => s.overrides);
6840
- const componentResolving = useAppStore((s) => {
6841
- var _a, _b;
6842
- const loadingCount = s.selectedItem ? (_a = s.componentState[s.selectedItem.props.id]) == null ? void 0 : _a.loadingCount : (_b = s.componentState["root"]) == null ? void 0 : _b.loadingCount;
6843
- return (loadingCount != null ? loadingCount : 0) > 0;
6844
- });
6845
- const itemSelector = useAppStore(useShallow8((s) => s.state.ui.itemSelector));
6846
- const id = useAppStore((s) => {
6847
- var _a;
6848
- return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
6849
- });
6850
- const appStore = useAppStoreApi();
6851
- useRegisterFieldsSlice(appStore, id);
6852
- const fieldsLoading = useAppStore((s) => s.fields.loading);
6853
- const fieldNames = useAppStore(
6854
- useShallow8((s) => {
6855
- if (s.fields.id === id) {
6856
- return Object.keys(s.fields.fields);
6857
- }
6858
- return [];
6859
- })
6860
- );
6861
- const isLoading = fieldsLoading || componentResolving;
6862
- const Wrapper = useMemo17(() => overrides.fields || DefaultFields, [overrides]);
6863
- return /* @__PURE__ */ jsxs16(
6864
- "form",
6865
- {
6866
- className: getClassName25({ wrapFields }),
6867
- onSubmit: (e) => {
6868
- e.preventDefault();
6869
- },
6870
- children: [
6871
- /* @__PURE__ */ jsxs16(Wrapper, { isLoading, itemSelector, children: [
6872
- /* @__PURE__ */ jsx42(GlobalSyncButton, {}),
6873
- fieldNames.map((fieldName) => /* @__PURE__ */ jsx42(FieldsChildMemo, { fieldName }, fieldName))
6874
- ] }),
6875
- isLoading && /* @__PURE__ */ jsx42("div", { className: getClassName25("loadingOverlay"), children: /* @__PURE__ */ jsx42("div", { className: getClassName25("loadingOverlayInner"), children: /* @__PURE__ */ jsx42(Loader, { size: 16 }) }) })
6876
- ]
6877
- }
6878
- );
6879
- };
6880
- var Fields = memo8(FieldsInternal);
6881
-
6882
- // css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css#css-module
6883
- init_react_import();
6884
- var styles_module_default21 = { "FieldsPlugin": "_FieldsPlugin_262zt_1", "FieldsPlugin-header": "_FieldsPlugin-header_262zt_7" };
6885
-
6886
- // plugins/fields/index.tsx
6887
- import { jsx as jsx43, jsxs as jsxs17 } from "react/jsx-runtime";
6888
- var getClassName26 = get_class_name_factory_default("FieldsPlugin", styles_module_default21);
6889
- var CurrentTitle = () => {
6890
- const label = useAppStore((s) => {
6891
- var _a, _b;
6892
- const selectedItem = s.selectedItem;
6893
- return selectedItem ? (_b = (_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.label) != null ? _b : selectedItem.type : "Page";
6894
- });
6895
- return label;
6896
- };
6897
- var fieldsPlugin = ({ desktopSideBar = "right" } = {}) => ({
6898
- name: "fields",
6899
- label: "Fields",
6900
- render: () => /* @__PURE__ */ jsxs17("div", { className: getClassName26(), children: [
6901
- /* @__PURE__ */ jsx43("div", { className: getClassName26("header"), children: /* @__PURE__ */ jsx43(Breadcrumbs, { numParents: 2, children: /* @__PURE__ */ jsx43(CurrentTitle, {}) }) }),
6902
- /* @__PURE__ */ jsx43(Fields, {})
6903
- ] }),
6904
- icon: /* @__PURE__ */ jsx43(RectangleEllipsis, {}),
6905
- mobileOnly: desktopSideBar === "right"
6906
- });
6907
-
6908
- // components/Editor/index.tsx
6909
- init_react_import();
6910
- import {
6911
- createContext as createContext8,
6912
- useCallback as useCallback25,
6913
- useContext as useContext15,
6914
- useEffect as useEffect26,
6915
- useMemo as useMemo24,
6916
- useRef as useRef19,
6917
- useState as useState24
6918
- } from "react";
6919
-
6920
- // components/Editor/components/Preview/index.tsx
6921
- init_react_import();
6922
- import { useCallback as useCallback17, useEffect as useEffect21, useRef as useRef12, useMemo as useMemo18 } from "react";
6923
-
6924
- // components/AutoFrame/index.tsx
6925
- init_react_import();
6926
- import {
6927
- createContext as createContext6,
6928
- useContext as useContext13,
6929
- useEffect as useEffect20,
6930
- useState as useState18
6931
- } from "react";
6932
- import hash from "object-hash";
6933
- import { createPortal as createPortal3 } from "react-dom";
6934
- import { Fragment as Fragment10, jsx as jsx44 } from "react/jsx-runtime";
6935
- var styleSelector = 'style, link[rel="stylesheet"]';
6936
- var collectStyles = (doc) => {
6937
- const collected = [];
6938
- doc.querySelectorAll(styleSelector).forEach((style) => {
6939
- if (style.tagName === "STYLE") {
6940
- const hasContent = !!style.innerHTML.trim();
6941
- if (hasContent) {
6942
- collected.push(style);
6943
- }
6944
- } else {
6945
- collected.push(style);
6946
- }
6947
- });
6948
- return collected;
6949
- };
6950
- var getStyleSheet = (el) => {
6951
- return Array.from(document.styleSheets).find((ss) => {
6952
- const ownerNode = ss.ownerNode;
6953
- return ownerNode.href === el.href;
6954
- });
6955
- };
6956
- var getStyles = (styleSheet) => {
6957
- if (styleSheet) {
6958
- try {
6959
- return Array.from(styleSheet.cssRules).map((rule) => rule.cssText).join("");
6960
- } catch (e) {
6961
- console.warn(
6962
- "Access to stylesheet %s is denied. Ignoring\u2026",
6963
- styleSheet.href
6964
- );
6965
- }
6966
- }
6967
- return "";
6968
- };
6969
- var syncAttributes = (sourceElement, targetElement) => {
6970
- const attributes = sourceElement.attributes;
6971
- if ((attributes == null ? void 0 : attributes.length) > 0) {
6972
- Array.from(attributes).forEach((attribute) => {
6973
- targetElement.setAttribute(attribute.name, attribute.value);
6974
- });
6975
- }
6976
- };
6977
- var defer = (fn) => setTimeout(fn, 0);
6978
- var CopyHostStyles = ({
6979
- children,
6980
- debug = false,
6981
- onStylesLoaded = () => null
6510
+ debug = false,
6511
+ onStylesLoaded = () => null
6982
6512
  }) => {
6983
6513
  const { document: doc, window: win } = useFrame();
6984
6514
  useEffect20(() => {
@@ -7148,10 +6678,10 @@ var CopyHostStyles = ({
7148
6678
  observer.disconnect();
7149
6679
  };
7150
6680
  }, []);
7151
- return /* @__PURE__ */ jsx44(Fragment10, { children });
6681
+ return /* @__PURE__ */ jsx41(Fragment9, { children });
7152
6682
  };
7153
6683
  var autoFrameContext = createContext6({});
7154
- var useFrame = () => useContext13(autoFrameContext);
6684
+ var useFrame = () => useContext12(autoFrameContext);
7155
6685
  function AutoFrame(_a) {
7156
6686
  var _b = _a, {
7157
6687
  children,
@@ -7194,132 +6724,576 @@ function AutoFrame(_a) {
7194
6724
  onNotReady();
7195
6725
  }
7196
6726
  }
7197
- }, [frameRef, loaded, stylesLoaded]);
7198
- return /* @__PURE__ */ jsx44(
7199
- "iframe",
7200
- __spreadProps(__spreadValues({}, props), {
7201
- className,
7202
- id,
7203
- srcDoc: '<!DOCTYPE html><html><head></head><body><div id="frame-root" data-editor-entry></div></body></html>',
7204
- ref: frameRef,
7205
- onLoad: () => {
7206
- setLoaded(true);
7207
- },
7208
- children: /* @__PURE__ */ jsx44(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx44(
7209
- CopyHostStyles,
6727
+ }, [frameRef, loaded, stylesLoaded]);
6728
+ return /* @__PURE__ */ jsx41(
6729
+ "iframe",
6730
+ __spreadProps(__spreadValues({}, props), {
6731
+ className,
6732
+ id,
6733
+ srcDoc: '<!DOCTYPE html><html><head></head><body><div id="frame-root" data-editor-entry></div></body></html>',
6734
+ ref: frameRef,
6735
+ onLoad: () => {
6736
+ setLoaded(true);
6737
+ },
6738
+ children: /* @__PURE__ */ jsx41(autoFrameContext.Provider, { value: ctx, children: loaded && mountTarget && /* @__PURE__ */ jsx41(
6739
+ CopyHostStyles,
6740
+ {
6741
+ debug,
6742
+ onStylesLoaded: () => setStylesLoaded(true),
6743
+ children: createPortal3(children, mountTarget)
6744
+ }
6745
+ ) })
6746
+ })
6747
+ );
6748
+ }
6749
+ AutoFrame.displayName = "AutoFrame";
6750
+ var AutoFrame_default = AutoFrame;
6751
+
6752
+ // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Preview/styles.module.css#css-module
6753
+ init_react_import();
6754
+ var styles_module_default20 = { "EditorPreview": "_EditorPreview_xou64_1", "EditorPreview-frame": "_EditorPreview-frame_xou64_6" };
6755
+
6756
+ // components/Editor/components/Preview/index.tsx
6757
+ import { Fragment as Fragment10, jsx as jsx42 } from "react/jsx-runtime";
6758
+ var getClassName25 = get_class_name_factory_default("EditorPreview", styles_module_default20);
6759
+ var Preview2 = ({ id = "editor-preview" }) => {
6760
+ const dispatch = useAppStore((s) => s.dispatch);
6761
+ const root = useAppStore((s) => s.state.data.root);
6762
+ const config = useAppStore((s) => s.config);
6763
+ const setStatus = useAppStore((s) => s.setStatus);
6764
+ const iframe = useAppStore((s) => s.iframe);
6765
+ const overrides = useAppStore((s) => s.overrides);
6766
+ const metadata = useAppStore((s) => s.metadata);
6767
+ const renderData = useAppStore(
6768
+ (s) => s.state.ui.previewMode === "edit" ? null : s.state.data
6769
+ );
6770
+ const Page = useCallback16(
6771
+ (pageProps) => {
6772
+ var _a, _b, _c, _d;
6773
+ const propsWithSlots = useSlots(
6774
+ config,
6775
+ { type: "root", props: pageProps },
6776
+ DropZoneEditPure
6777
+ );
6778
+ const richtextProps = useRichtextProps(
6779
+ (_b = (_a = config.root) == null ? void 0 : _a.fields) != null ? _b : {},
6780
+ pageProps
6781
+ );
6782
+ return ((_c = config.root) == null ? void 0 : _c.render) ? (_d = config.root) == null ? void 0 : _d.render(__spreadValues(__spreadValues({
6783
+ id: "editor-root"
6784
+ }, propsWithSlots), richtextProps)) : /* @__PURE__ */ jsx42(Fragment10, { children: propsWithSlots.children });
6785
+ },
6786
+ [config]
6787
+ );
6788
+ const Frame = useMemo17(() => overrides.iframe, [overrides]);
6789
+ const rootProps = root.props || root;
6790
+ const ref = useRef11(null);
6791
+ const inner = !renderData ? /* @__PURE__ */ jsx42(
6792
+ Page,
6793
+ __spreadProps(__spreadValues({}, rootProps), {
6794
+ editor: {
6795
+ renderDropZone: DropZonePure,
6796
+ isEditing: true,
6797
+ dragRef: null,
6798
+ metadata
6799
+ },
6800
+ editMode: true,
6801
+ children: /* @__PURE__ */ jsx42(DropZonePure, { zone: rootDroppableId })
6802
+ })
6803
+ ) : /* @__PURE__ */ jsx42(Render, { data: renderData, config, metadata });
6804
+ useEffect21(() => {
6805
+ if (!iframe.enabled) {
6806
+ setStatus("READY");
6807
+ }
6808
+ }, [iframe.enabled]);
6809
+ return /* @__PURE__ */ jsx42(
6810
+ "div",
6811
+ {
6812
+ className: getClassName25(),
6813
+ id,
6814
+ "data-editor-preview": true,
6815
+ onClick: (e) => {
6816
+ const el = e.target;
6817
+ if (!el.hasAttribute("data-editor-component") && !el.hasAttribute("data-editor-dropzone")) {
6818
+ dispatch({ type: "setUi", ui: { itemSelector: null } });
6819
+ }
6820
+ },
6821
+ children: iframe.enabled ? /* @__PURE__ */ jsx42(
6822
+ AutoFrame_default,
6823
+ {
6824
+ id: "preview-frame",
6825
+ className: getClassName25("frame"),
6826
+ "data-rfd-iframe": true,
6827
+ onReady: () => {
6828
+ setStatus("READY");
6829
+ },
6830
+ onNotReady: () => {
6831
+ setStatus("MOUNTED");
6832
+ },
6833
+ frameRef: ref,
6834
+ children: /* @__PURE__ */ jsx42(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
6835
+ if (Frame) {
6836
+ return /* @__PURE__ */ jsx42(Frame, { document: document2, children: inner });
6837
+ }
6838
+ return inner;
6839
+ } })
6840
+ }
6841
+ ) : /* @__PURE__ */ jsx42(
6842
+ "div",
6843
+ {
6844
+ id: "preview-frame",
6845
+ className: getClassName25("frame"),
6846
+ ref,
6847
+ "data-editor-entry": true,
6848
+ children: inner
6849
+ }
6850
+ )
6851
+ }
6852
+ );
6853
+ };
6854
+
6855
+ // components/Editor/components/Outline/index.tsx
6856
+ init_react_import();
6857
+
6858
+ // components/LayerTree/index.tsx
6859
+ init_react_import();
6860
+
6861
+ // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/LayerTree/styles.module.css#css-module
6862
+ init_react_import();
6863
+ var styles_module_default21 = { "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" };
6864
+
6865
+ // components/LayerTree/index.tsx
6866
+ import {
6867
+ forwardRef as forwardRef2,
6868
+ useCallback as useCallback17,
6869
+ useContext as useContext13,
6870
+ useRef as useRef12
6871
+ } from "react";
6872
+ import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
6873
+ import { Fragment as Fragment11, jsx as jsx43, jsxs as jsxs17 } from "react/jsx-runtime";
6874
+ var getClassName26 = get_class_name_factory_default("LayerTree", styles_module_default21);
6875
+ var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default21);
6876
+ var DEFAULT_LAYER_ROW_HEIGHT = 32;
6877
+ var LAYER_TREE_VIRTUALIZATION_OVERSCAN = 8;
6878
+ var MIN_VIRTUALIZED_LAYER_COUNT = 25;
6879
+ var measuredRowHeights = /* @__PURE__ */ new Map();
6880
+ var getZonesByParent = (zones) => {
6881
+ return Object.keys(zones).reduce((acc, zone) => {
6882
+ const [parentId] = zone.split(":");
6883
+ acc[parentId] = [...acc[parentId] || [], zone];
6884
+ return acc;
6885
+ }, {});
6886
+ };
6887
+ var getZoneLabel = (zoneCompound, nodes, config, label) => {
6888
+ var _a, _b, _c, _d;
6889
+ if (label !== void 0) {
6890
+ return label;
6891
+ }
6892
+ const [componentId, slotId] = zoneCompound.split(":");
6893
+ if (!slotId) {
6894
+ return;
6895
+ }
6896
+ const componentType = (_a = nodes[componentId]) == null ? void 0 : _a.data.type;
6897
+ const configForComponent = componentType && componentType !== rootAreaId ? config.components[componentType] : config.root;
6898
+ return (_d = (_c = (_b = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _b[slotId]) == null ? void 0 : _c.label) != null ? _d : slotId;
6899
+ };
6900
+ var buildLayerNode = ({
6901
+ config,
6902
+ itemId,
6903
+ index,
6904
+ nodes,
6905
+ zoneCompound,
6906
+ zones,
6907
+ zonesByParent
6908
+ }) => {
6909
+ var _a, _b, _c;
6910
+ const nodeData = nodes[itemId];
6911
+ const componentType = ((_a = nodeData == null ? void 0 : nodeData.data.type) == null ? void 0 : _a.toString()) || "Component";
6912
+ const label = (_c = (_b = config.components[componentType]) == null ? void 0 : _b.label) != null ? _c : componentType;
6913
+ const childZoneCompounds = zonesByParent[itemId] || [];
6914
+ return {
6915
+ childZones: childZoneCompounds.map(
6916
+ (childZoneCompound) => buildLayerTree({
6917
+ config,
6918
+ nodes,
6919
+ zoneCompound: childZoneCompound,
6920
+ zones,
6921
+ zonesByParent
6922
+ })
6923
+ ),
6924
+ componentType,
6925
+ index,
6926
+ itemId,
6927
+ label,
6928
+ zoneCompound
6929
+ };
6930
+ };
6931
+ var buildLayerTree = ({
6932
+ config,
6933
+ label,
6934
+ nodes,
6935
+ zoneCompound,
6936
+ zones,
6937
+ zonesByParent = getZonesByParent(zones)
6938
+ }) => {
6939
+ var _a, _b;
6940
+ const contentIds = (_b = (_a = zones[zoneCompound]) == null ? void 0 : _a.contentIds) != null ? _b : [];
6941
+ return {
6942
+ items: contentIds.map(
6943
+ (itemId, index) => buildLayerNode({
6944
+ config,
6945
+ itemId,
6946
+ index,
6947
+ nodes,
6948
+ zoneCompound,
6949
+ zones,
6950
+ zonesByParent
6951
+ })
6952
+ ),
6953
+ label: getZoneLabel(zoneCompound, nodes, config, label),
6954
+ zoneCompound
6955
+ };
6956
+ };
6957
+ var getEstimatedRowHeight = (itemId) => {
6958
+ var _a;
6959
+ return (_a = measuredRowHeights.get(itemId)) != null ? _a : DEFAULT_LAYER_ROW_HEIGHT;
6960
+ };
6961
+ var cacheMeasuredRowHeight = (itemId, height) => {
6962
+ if (height <= 0) {
6963
+ return;
6964
+ }
6965
+ measuredRowHeights.set(itemId, height);
6966
+ };
6967
+ var getScrollParent = (el) => {
6968
+ var _a;
6969
+ let current = (_a = el == null ? void 0 : el.parentElement) != null ? _a : null;
6970
+ while (current) {
6971
+ const { overflow, overflowY } = getComputedStyle(current);
6972
+ if ([overflow, overflowY].some((value) => /auto|scroll/.test(value))) {
6973
+ return current;
6974
+ }
6975
+ current = current.parentElement;
6976
+ }
6977
+ return null;
6978
+ };
6979
+ var Layer = forwardRef2(function Layer2({
6980
+ childIsSelected,
6981
+ dataIndex,
6982
+ depth,
6983
+ isSelected,
6984
+ node,
6985
+ selectedId,
6986
+ selectedPathIds
6987
+ }, ref) {
6988
+ const dispatch = useAppStore((s) => s.dispatch);
6989
+ const zoneStore = useContext13(ZoneStoreContext);
6990
+ const isHovering = useContextStore(
6991
+ ZoneStoreContext,
6992
+ (s) => s.hoveringComponent === node.itemId
6993
+ );
6994
+ const isGlobal = useAppStore(
6995
+ (s) => {
6996
+ var _a;
6997
+ return ((_a = s.config.components[node.componentType]) == null ? void 0 : _a.global) === true;
6998
+ }
6999
+ );
7000
+ const isUnlinked = useAppStore(
7001
+ (s) => {
7002
+ var _a, _b;
7003
+ return ((_b = (_a = s.state.indexes.nodes[node.itemId]) == null ? void 0 : _a.data) == null ? void 0 : _b.synced) === false;
7004
+ }
7005
+ );
7006
+ const containsZone = node.childZones.length > 0;
7007
+ const setItemSelector = useCallback17(
7008
+ (itemSelector) => {
7009
+ dispatch({ type: "setUi", ui: { itemSelector } });
7010
+ },
7011
+ [dispatch]
7012
+ );
7013
+ const shouldRenderChildren = isSelected || childIsSelected;
7014
+ return /* @__PURE__ */ jsxs17(
7015
+ "li",
7016
+ {
7017
+ ref,
7018
+ className: getClassNameLayer({
7019
+ childIsSelected,
7020
+ containsZone,
7021
+ isHovering,
7022
+ isSelected,
7023
+ isGlobal: isGlobal && !isUnlinked,
7024
+ isUnlinked: isGlobal && isUnlinked
7025
+ }),
7026
+ "data-index": dataIndex,
7027
+ "data-editor-layer-tree-id": node.itemId,
7028
+ children: [
7029
+ /* @__PURE__ */ jsx43("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ jsxs17(
7030
+ "button",
7031
+ {
7032
+ type: "button",
7033
+ className: getClassNameLayer("clickable"),
7034
+ onClick: () => {
7035
+ if (isSelected) {
7036
+ setItemSelector(null);
7037
+ return;
7038
+ }
7039
+ setItemSelector({
7040
+ index: node.index,
7041
+ zone: node.zoneCompound
7042
+ });
7043
+ zoneStore.getState().scrollToComponent(node.itemId);
7044
+ },
7045
+ onMouseEnter: (e) => {
7046
+ e.stopPropagation();
7047
+ zoneStore.setState({ hoveringComponent: node.itemId });
7048
+ },
7049
+ onMouseLeave: (e) => {
7050
+ e.stopPropagation();
7051
+ zoneStore.setState({ hoveringComponent: null });
7052
+ },
7053
+ children: [
7054
+ /* @__PURE__ */ jsx43(
7055
+ "div",
7056
+ {
7057
+ className: getClassNameLayer("chevron"),
7058
+ title: containsZone ? isSelected ? "Collapse" : "Expand" : void 0,
7059
+ children: containsZone && /* @__PURE__ */ jsx43(ChevronRight, { size: "12" })
7060
+ }
7061
+ ),
7062
+ /* @__PURE__ */ jsxs17("div", { className: getClassNameLayer("title"), children: [
7063
+ /* @__PURE__ */ jsx43("div", { className: getClassNameLayer("icon"), children: /* @__PURE__ */ jsx43(Component, { size: "16" }) }),
7064
+ /* @__PURE__ */ jsx43("div", { className: getClassNameLayer("name"), children: node.label }),
7065
+ isGlobal && isUnlinked && /* @__PURE__ */ jsx43(
7066
+ "div",
7067
+ {
7068
+ className: getClassNameLayer("unlinkedGlyph"),
7069
+ title: "Unlinked from shared",
7070
+ children: /* @__PURE__ */ jsx43(Unlink2, { size: "12" })
7071
+ }
7072
+ )
7073
+ ] })
7074
+ ]
7075
+ }
7076
+ ) }),
7077
+ containsZone && shouldRenderChildren && node.childZones.map((childZone) => /* @__PURE__ */ jsx43(
7078
+ "div",
7079
+ {
7080
+ className: getClassNameLayer("zones"),
7081
+ children: /* @__PURE__ */ jsx43(
7082
+ LayerTreeZone,
7083
+ {
7084
+ depth: depth + 1,
7085
+ selectedId,
7086
+ selectedPathIds,
7087
+ tree: childZone
7088
+ }
7089
+ )
7090
+ },
7091
+ childZone.zoneCompound
7092
+ ))
7093
+ ]
7094
+ }
7095
+ );
7096
+ });
7097
+ var LayerTreeZone = ({
7098
+ depth,
7099
+ selectedId,
7100
+ selectedPathIds,
7101
+ tree
7102
+ }) => {
7103
+ const shouldVirtualize = depth === 0 && tree.items.length >= MIN_VIRTUALIZED_LAYER_COUNT;
7104
+ return /* @__PURE__ */ jsxs17(Fragment11, { children: [
7105
+ tree.label && /* @__PURE__ */ jsx43("div", { className: getClassName26("zoneTitle"), children: tree.label }),
7106
+ shouldVirtualize ? /* @__PURE__ */ jsx43(
7107
+ VirtualizedLayerTreeItems,
7108
+ {
7109
+ depth,
7110
+ selectedId,
7111
+ selectedPathIds,
7112
+ tree
7113
+ }
7114
+ ) : /* @__PURE__ */ jsx43(
7115
+ StaticLayerTreeItems,
7116
+ {
7117
+ depth,
7118
+ selectedId,
7119
+ selectedPathIds,
7120
+ tree
7121
+ }
7122
+ )
7123
+ ] });
7124
+ };
7125
+ var StaticLayerTreeItems = ({
7126
+ depth,
7127
+ selectedId,
7128
+ selectedPathIds,
7129
+ tree
7130
+ }) => {
7131
+ return /* @__PURE__ */ jsxs17("ul", { className: getClassName26(), children: [
7132
+ tree.items.length === 0 && /* @__PURE__ */ jsx43("div", { className: getClassName26("helper"), children: "empty" }),
7133
+ tree.items.map((node) => /* @__PURE__ */ jsx43(
7134
+ Layer,
7135
+ {
7136
+ childIsSelected: selectedPathIds.has(node.itemId),
7137
+ depth,
7138
+ isSelected: selectedId === node.itemId,
7139
+ node,
7140
+ selectedId,
7141
+ selectedPathIds
7142
+ },
7143
+ node.itemId
7144
+ ))
7145
+ ] });
7146
+ };
7147
+ var VirtualizedLayerTreeItems = ({
7148
+ depth,
7149
+ selectedId,
7150
+ selectedPathIds,
7151
+ tree
7152
+ }) => {
7153
+ const listRef = useRef12(null);
7154
+ const virtualizer = useVirtualizer2({
7155
+ count: tree.items.length,
7156
+ estimateSize: (index) => getEstimatedRowHeight(tree.items[index].itemId),
7157
+ getItemKey: (index) => tree.items[index].itemId,
7158
+ getScrollElement: () => getScrollParent(listRef.current),
7159
+ overscan: LAYER_TREE_VIRTUALIZATION_OVERSCAN,
7160
+ measureElement: (element) => {
7161
+ const height = Math.ceil(element.getBoundingClientRect().height);
7162
+ const itemId = element.dataset.editorLayerTreeId;
7163
+ if (itemId) {
7164
+ cacheMeasuredRowHeight(itemId, height);
7165
+ }
7166
+ return height || DEFAULT_LAYER_ROW_HEIGHT;
7167
+ }
7168
+ });
7169
+ const virtualItems = virtualizer.getVirtualItems();
7170
+ const totalSize = virtualizer.getTotalSize();
7171
+ const renderedItems = [];
7172
+ let previousEnd = 0;
7173
+ let previousIndex = -1;
7174
+ virtualItems.forEach((virtualItem) => {
7175
+ const node = tree.items[virtualItem.index];
7176
+ const gapSize = Math.max(virtualItem.start - previousEnd, 0);
7177
+ if (gapSize > 0) {
7178
+ renderedItems.push(
7179
+ /* @__PURE__ */ jsx43(
7180
+ "li",
7181
+ {
7182
+ "aria-hidden": "true",
7183
+ style: { height: `${gapSize}px` }
7184
+ },
7185
+ `gap:${tree.zoneCompound}:${previousIndex}:${virtualItem.index}`
7186
+ )
7187
+ );
7188
+ }
7189
+ renderedItems.push(
7190
+ /* @__PURE__ */ jsx43(
7191
+ Layer,
7210
7192
  {
7211
- debug,
7212
- onStylesLoaded: () => setStylesLoaded(true),
7213
- children: createPortal3(children, mountTarget)
7214
- }
7215
- ) })
7216
- })
7217
- );
7218
- }
7219
- AutoFrame.displayName = "AutoFrame";
7220
- var AutoFrame_default = AutoFrame;
7193
+ childIsSelected: selectedPathIds.has(node.itemId),
7194
+ dataIndex: virtualItem.index,
7195
+ depth,
7196
+ isSelected: selectedId === node.itemId,
7197
+ node,
7198
+ ref: virtualizer.measureElement,
7199
+ selectedId,
7200
+ selectedPathIds
7201
+ },
7202
+ node.itemId
7203
+ )
7204
+ );
7205
+ previousEnd = virtualItem.end;
7206
+ previousIndex = virtualItem.index;
7207
+ });
7208
+ const trailingGap = Math.max(totalSize - previousEnd, 0);
7209
+ if (trailingGap > 0) {
7210
+ renderedItems.push(
7211
+ /* @__PURE__ */ jsx43(
7212
+ "li",
7213
+ {
7214
+ "aria-hidden": "true",
7215
+ style: { height: `${trailingGap}px` }
7216
+ },
7217
+ `gap:${tree.zoneCompound}:${previousIndex}:end`
7218
+ )
7219
+ );
7220
+ }
7221
+ return /* @__PURE__ */ jsxs17("ul", { className: getClassName26(), ref: listRef, children: [
7222
+ tree.items.length === 0 && /* @__PURE__ */ jsx43("div", { className: getClassName26("helper"), children: "empty" }),
7223
+ renderedItems
7224
+ ] });
7225
+ };
7226
+ var LayerTree = ({
7227
+ selectedId,
7228
+ selectedPathIds,
7229
+ trees
7230
+ }) => {
7231
+ return /* @__PURE__ */ jsx43(Fragment11, { children: trees.map((tree) => /* @__PURE__ */ jsx43(
7232
+ LayerTreeZone,
7233
+ {
7234
+ depth: 0,
7235
+ selectedId,
7236
+ selectedPathIds,
7237
+ tree
7238
+ },
7239
+ tree.zoneCompound
7240
+ )) });
7241
+ };
7221
7242
 
7222
- // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Preview/styles.module.css#css-module
7243
+ // components/Editor/components/Outline/index.tsx
7244
+ import { useMemo as useMemo18 } from "react";
7245
+
7246
+ // lib/data/find-zones-for-area.ts
7223
7247
  init_react_import();
7224
- var styles_module_default22 = { "EditorPreview": "_EditorPreview_xou64_1", "EditorPreview-frame": "_EditorPreview-frame_xou64_6" };
7248
+ var findZonesForArea = (state, area) => {
7249
+ return Object.keys(state.indexes.zones).filter(
7250
+ (zone) => zone.split(":")[0] === area
7251
+ );
7252
+ };
7225
7253
 
7226
- // components/Editor/components/Preview/index.tsx
7227
- import { Fragment as Fragment11, jsx as jsx45 } from "react/jsx-runtime";
7228
- var getClassName27 = get_class_name_factory_default("EditorPreview", styles_module_default22);
7229
- var Preview2 = ({ id = "editor-preview" }) => {
7230
- const dispatch = useAppStore((s) => s.dispatch);
7231
- const root = useAppStore((s) => s.state.data.root);
7254
+ // components/Editor/components/Outline/index.tsx
7255
+ import { useShallow as useShallow8 } from "zustand/react/shallow";
7256
+ import { jsx as jsx44 } from "react/jsx-runtime";
7257
+ var Outline = () => {
7258
+ const outlineOverride = useAppStore((s) => s.overrides.outline);
7232
7259
  const config = useAppStore((s) => s.config);
7233
- const setStatus = useAppStore((s) => s.setStatus);
7234
- const iframe = useAppStore((s) => s.iframe);
7235
- const overrides = useAppStore((s) => s.overrides);
7236
- const metadata = useAppStore((s) => s.metadata);
7237
- const renderData = useAppStore(
7238
- (s) => s.state.ui.previewMode === "edit" ? null : s.state.data
7260
+ const nodes = useAppStore((s) => s.state.indexes.nodes);
7261
+ const zones = useAppStore((s) => s.state.indexes.zones);
7262
+ const selectedId = useAppStore((s) => {
7263
+ var _a;
7264
+ return ((_a = s.selectedItem) == null ? void 0 : _a.props.id) || null;
7265
+ });
7266
+ const rootZones = useAppStore(
7267
+ useShallow8((s) => findZonesForArea(s.state, "root"))
7239
7268
  );
7240
- const Page = useCallback17(
7241
- (pageProps) => {
7242
- var _a, _b, _c, _d;
7243
- const propsWithSlots = useSlots(
7269
+ const selectedPathIds = useMemo18(() => {
7270
+ var _a;
7271
+ const selectedPath = selectedId ? (_a = nodes[selectedId]) == null ? void 0 : _a.path : null;
7272
+ return new Set(
7273
+ (selectedPath == null ? void 0 : selectedPath.map((candidate) => candidate.split(":")[0]).filter(Boolean)) || []
7274
+ );
7275
+ }, [nodes, selectedId]);
7276
+ const trees = useMemo18(
7277
+ () => rootZones.map(
7278
+ (zoneCompound) => buildLayerTree({
7244
7279
  config,
7245
- { type: "root", props: pageProps },
7246
- DropZoneEditPure
7247
- );
7248
- const richtextProps = useRichtextProps(
7249
- (_b = (_a = config.root) == null ? void 0 : _a.fields) != null ? _b : {},
7250
- pageProps
7251
- );
7252
- return ((_c = config.root) == null ? void 0 : _c.render) ? (_d = config.root) == null ? void 0 : _d.render(__spreadValues(__spreadValues({
7253
- id: "editor-root"
7254
- }, propsWithSlots), richtextProps)) : /* @__PURE__ */ jsx45(Fragment11, { children: propsWithSlots.children });
7255
- },
7256
- [config]
7280
+ label: rootZones.length === 1 ? "" : zoneCompound.split(":")[1],
7281
+ nodes,
7282
+ zoneCompound,
7283
+ zones
7284
+ })
7285
+ ),
7286
+ [config, nodes, rootZones, zones]
7257
7287
  );
7258
- const Frame = useMemo18(() => overrides.iframe, [overrides]);
7259
- const rootProps = root.props || root;
7260
- const ref = useRef12(null);
7261
- const inner = !renderData ? /* @__PURE__ */ jsx45(
7262
- Page,
7263
- __spreadProps(__spreadValues({}, rootProps), {
7264
- editor: {
7265
- renderDropZone: DropZonePure,
7266
- isEditing: true,
7267
- dragRef: null,
7268
- metadata
7269
- },
7270
- editMode: true,
7271
- children: /* @__PURE__ */ jsx45(DropZonePure, { zone: rootDroppableId })
7272
- })
7273
- ) : /* @__PURE__ */ jsx45(Render, { data: renderData, config, metadata });
7274
- useEffect21(() => {
7275
- if (!iframe.enabled) {
7276
- setStatus("READY");
7277
- }
7278
- }, [iframe.enabled]);
7279
- return /* @__PURE__ */ jsx45(
7280
- "div",
7288
+ const Wrapper = useMemo18(() => outlineOverride || "div", [outlineOverride]);
7289
+ return /* @__PURE__ */ jsx44(Wrapper, { children: /* @__PURE__ */ jsx44(
7290
+ LayerTree,
7281
7291
  {
7282
- className: getClassName27(),
7283
- id,
7284
- "data-editor-preview": true,
7285
- onClick: (e) => {
7286
- const el = e.target;
7287
- if (!el.hasAttribute("data-editor-component") && !el.hasAttribute("data-editor-dropzone")) {
7288
- dispatch({ type: "setUi", ui: { itemSelector: null } });
7289
- }
7290
- },
7291
- children: iframe.enabled ? /* @__PURE__ */ jsx45(
7292
- AutoFrame_default,
7293
- {
7294
- id: "preview-frame",
7295
- className: getClassName27("frame"),
7296
- "data-rfd-iframe": true,
7297
- onReady: () => {
7298
- setStatus("READY");
7299
- },
7300
- onNotReady: () => {
7301
- setStatus("MOUNTED");
7302
- },
7303
- frameRef: ref,
7304
- children: /* @__PURE__ */ jsx45(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
7305
- if (Frame) {
7306
- return /* @__PURE__ */ jsx45(Frame, { document: document2, children: inner });
7307
- }
7308
- return inner;
7309
- } })
7310
- }
7311
- ) : /* @__PURE__ */ jsx45(
7312
- "div",
7313
- {
7314
- id: "preview-frame",
7315
- className: getClassName27("frame"),
7316
- ref,
7317
- "data-editor-entry": true,
7318
- children: inner
7319
- }
7320
- )
7292
+ selectedId,
7293
+ selectedPathIds,
7294
+ trees
7321
7295
  }
7322
- );
7296
+ ) });
7323
7297
  };
7324
7298
 
7325
7299
  // lib/use-loaded-overrides.ts
@@ -7429,7 +7403,7 @@ import {
7429
7403
 
7430
7404
  // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Layout/styles.module.css#css-module
7431
7405
  init_react_import();
7432
- 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" };
7406
+ var styles_module_default22 = { "Editor": "_Editor_frglt_19", "Editor-portal": "_Editor-portal_frglt_32", "EditorLayout": "_EditorLayout_frglt_37", "EditorLayout-inner": "_EditorLayout-inner_frglt_41", "Editor--hidePlugins": "_Editor--hidePlugins_frglt_73", "EditorLayout--navBarVisible": "_EditorLayout--navBarVisible_frglt_74", "EditorLayout--mounted": "_EditorLayout--mounted_frglt_83", "EditorLayout--mobilePanelHeightToggle": "_EditorLayout--mobilePanelHeightToggle_frglt_87", "EditorLayout--leftSideBarVisible": "_EditorLayout--leftSideBarVisible_frglt_87", "EditorLayout--mobilePanelCustomHeight": "_EditorLayout--mobilePanelCustomHeight_frglt_92", "EditorLayout--mobilePanelHeightMinContent": "_EditorLayout--mobilePanelHeightMinContent_frglt_110", "EditorLayout--rightSideBarVisible": "_EditorLayout--rightSideBarVisible_frglt_132", "EditorLayout-mounted": "_EditorLayout-mounted_frglt_151", "EditorLayout-nav": "_EditorLayout-nav_frglt_192", "Editor-fieldSideBarToolbar": "_Editor-fieldSideBarToolbar_frglt_208", "Editor-fieldSideBarHistory": "_Editor-fieldSideBarHistory_frglt_218", "Editor-fieldSideBarActions": "_Editor-fieldSideBarActions_frglt_224", "EditorLayout-mobilePanel": "_EditorLayout-mobilePanel_frglt_230", "EditorLayout-mobilePanelContent": "_EditorLayout-mobilePanelContent_frglt_250", "EditorLayout-mobileDragHandle": "_EditorLayout-mobileDragHandle_frglt_257", "EditorLayout-mobileDragHandlePill": "_EditorLayout-mobileDragHandlePill_frglt_271", "EditorPluginTab": "_EditorPluginTab_frglt_278", "EditorPluginTab--visible": "_EditorPluginTab--visible_frglt_284", "EditorPluginTab-body": "_EditorPluginTab-body_frglt_289" };
7433
7407
 
7434
7408
  // lib/use-inject-css.ts
7435
7409
  init_react_import();
@@ -7460,8 +7434,8 @@ var useInjectGlobalCss = (iframeEnabled) => {
7460
7434
 
7461
7435
  // components/DefaultOverride/index.tsx
7462
7436
  init_react_import();
7463
- import { Fragment as Fragment12, jsx as jsx46 } from "react/jsx-runtime";
7464
- var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx46(Fragment12, { children });
7437
+ import { Fragment as Fragment12, jsx as jsx45 } from "react/jsx-runtime";
7438
+ var DefaultOverride = ({ children }) => /* @__PURE__ */ jsx45(Fragment12, { children });
7465
7439
 
7466
7440
  // lib/use-preview-mode-hotkeys.ts
7467
7441
  init_react_import();
@@ -7486,11 +7460,11 @@ init_react_import();
7486
7460
 
7487
7461
  // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/SidebarSection/styles.module.css#css-module
7488
7462
  init_react_import();
7489
- 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" };
7463
+ var styles_module_default23 = { "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" };
7490
7464
 
7491
7465
  // components/SidebarSection/index.tsx
7492
- import { jsx as jsx47, jsxs as jsxs18 } from "react/jsx-runtime";
7493
- var getClassName28 = get_class_name_factory_default("SidebarSection", styles_module_default24);
7466
+ import { jsx as jsx46, jsxs as jsxs18 } from "react/jsx-runtime";
7467
+ var getClassName27 = get_class_name_factory_default("SidebarSection", styles_module_default23);
7494
7468
  var SidebarSection = ({
7495
7469
  children,
7496
7470
  title,
@@ -7499,13 +7473,13 @@ var SidebarSection = ({
7499
7473
  noBorderTop,
7500
7474
  isLoading
7501
7475
  }) => {
7502
- return /* @__PURE__ */ jsxs18("div", { className: getClassName28({ noBorderTop }), style: { background }, children: [
7503
- /* @__PURE__ */ jsx47("div", { className: getClassName28("title"), children: /* @__PURE__ */ jsxs18("div", { className: getClassName28("breadcrumbs"), children: [
7504
- showBreadcrumbs && /* @__PURE__ */ jsx47(Breadcrumbs, {}),
7505
- /* @__PURE__ */ jsx47("div", { className: getClassName28("heading"), children: /* @__PURE__ */ jsx47(Heading, { rank: "2", size: "xs", children: title }) })
7476
+ return /* @__PURE__ */ jsxs18("div", { className: getClassName27({ noBorderTop }), style: { background }, children: [
7477
+ /* @__PURE__ */ jsx46("div", { className: getClassName27("title"), children: /* @__PURE__ */ jsxs18("div", { className: getClassName27("breadcrumbs"), children: [
7478
+ showBreadcrumbs && /* @__PURE__ */ jsx46(Breadcrumbs, {}),
7479
+ /* @__PURE__ */ jsx46("div", { className: getClassName27("heading"), children: /* @__PURE__ */ jsx46(Heading, { rank: "2", size: "xs", children: title }) })
7506
7480
  ] }) }),
7507
- /* @__PURE__ */ jsx47("div", { className: getClassName28("content"), children }),
7508
- isLoading && /* @__PURE__ */ jsx47("div", { className: getClassName28("loadingOverlay"), children: /* @__PURE__ */ jsx47(Loader, { size: 32 }) })
7481
+ /* @__PURE__ */ jsx46("div", { className: getClassName27("content"), children }),
7482
+ isLoading && /* @__PURE__ */ jsx46("div", { className: getClassName27("loadingOverlay"), children: /* @__PURE__ */ jsx46(Loader, { size: 32 }) })
7509
7483
  ] });
7510
7484
  };
7511
7485
 
@@ -7529,11 +7503,11 @@ import { Combobox as ComboboxPrimitive } from "@base-ui/react";
7529
7503
 
7530
7504
  // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ui/Combobox/styles.module.css#css-module
7531
7505
  init_react_import();
7532
- 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" };
7506
+ var styles_module_default24 = { "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" };
7533
7507
 
7534
7508
  // components/ui/Combobox/index.tsx
7535
- import { jsx as jsx48, jsxs as jsxs19 } from "react/jsx-runtime";
7536
- var getClassName29 = get_class_name_factory_default("EditorCombobox", styles_module_default25);
7509
+ import { jsx as jsx47, jsxs as jsxs19 } from "react/jsx-runtime";
7510
+ var getClassName28 = get_class_name_factory_default("EditorCombobox", styles_module_default24);
7537
7511
  var join = (...values) => values.filter(Boolean).join(" ");
7538
7512
  var mergeClassName = (base, override) => {
7539
7513
  if (!override) return base;
@@ -7549,11 +7523,11 @@ function ComboboxInput(_a) {
7549
7523
  } = _b, props = __objRest(_b, [
7550
7524
  "className"
7551
7525
  ]);
7552
- return /* @__PURE__ */ jsx48(
7526
+ return /* @__PURE__ */ jsx47(
7553
7527
  ComboboxPrimitive.Input,
7554
7528
  __spreadValues({
7555
7529
  "data-slot": "combobox-input",
7556
- className: mergeClassName(getClassName29("input"), className)
7530
+ className: mergeClassName(getClassName28("input"), className)
7557
7531
  }, props)
7558
7532
  );
7559
7533
  }
@@ -7573,19 +7547,19 @@ function ComboboxContent(_a) {
7573
7547
  "alignOffset",
7574
7548
  "children"
7575
7549
  ]);
7576
- return /* @__PURE__ */ jsx48(ComboboxPrimitive.Portal, { children: /* @__PURE__ */ jsx48(
7550
+ return /* @__PURE__ */ jsx47(ComboboxPrimitive.Portal, { children: /* @__PURE__ */ jsx47(
7577
7551
  ComboboxPrimitive.Positioner,
7578
7552
  {
7579
7553
  side,
7580
7554
  sideOffset,
7581
7555
  align,
7582
7556
  alignOffset,
7583
- className: getClassName29("positioner"),
7584
- children: /* @__PURE__ */ jsx48(
7557
+ className: getClassName28("positioner"),
7558
+ children: /* @__PURE__ */ jsx47(
7585
7559
  ComboboxPrimitive.Popup,
7586
7560
  __spreadProps(__spreadValues({
7587
7561
  "data-slot": "combobox-content",
7588
- className: mergeClassName(getClassName29("content"), className)
7562
+ className: mergeClassName(getClassName28("content"), className)
7589
7563
  }, props), {
7590
7564
  children
7591
7565
  })
@@ -7599,11 +7573,11 @@ function ComboboxList(_a) {
7599
7573
  } = _b, props = __objRest(_b, [
7600
7574
  "className"
7601
7575
  ]);
7602
- return /* @__PURE__ */ jsx48(
7576
+ return /* @__PURE__ */ jsx47(
7603
7577
  ComboboxPrimitive.List,
7604
7578
  __spreadValues({
7605
7579
  "data-slot": "combobox-list",
7606
- className: mergeClassName(getClassName29("list"), className)
7580
+ className: mergeClassName(getClassName28("list"), className)
7607
7581
  }, props)
7608
7582
  );
7609
7583
  }
@@ -7619,10 +7593,10 @@ function ComboboxItem(_a) {
7619
7593
  ComboboxPrimitive.Item,
7620
7594
  __spreadProps(__spreadValues({
7621
7595
  "data-slot": "combobox-item",
7622
- className: mergeClassName(getClassName29("item"), className)
7596
+ className: mergeClassName(getClassName28("item"), className)
7623
7597
  }, props), {
7624
7598
  children: [
7625
- /* @__PURE__ */ jsx48("span", { className: getClassName29("itemIndicator"), children: /* @__PURE__ */ jsx48(ComboboxPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx48(Check, { size: 14 }) }) }),
7599
+ /* @__PURE__ */ jsx47("span", { className: getClassName28("itemIndicator"), children: /* @__PURE__ */ jsx47(ComboboxPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx47(Check, { size: 14 }) }) }),
7626
7600
  children
7627
7601
  ]
7628
7602
  })
@@ -7634,27 +7608,27 @@ function ComboboxEmpty(_a) {
7634
7608
  } = _b, props = __objRest(_b, [
7635
7609
  "className"
7636
7610
  ]);
7637
- return /* @__PURE__ */ jsx48(
7611
+ return /* @__PURE__ */ jsx47(
7638
7612
  ComboboxPrimitive.Empty,
7639
7613
  __spreadValues({
7640
7614
  "data-slot": "combobox-empty",
7641
- className: mergeClassName(getClassName29("empty"), className)
7615
+ className: mergeClassName(getClassName28("empty"), className)
7642
7616
  }, props)
7643
7617
  );
7644
7618
  }
7645
7619
 
7646
7620
  // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/BrowserBar/styles.module.css#css-module
7647
7621
  init_react_import();
7648
- 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" };
7622
+ var styles_module_default25 = { "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" };
7649
7623
 
7650
7624
  // components/BrowserBar/index.tsx
7651
- import { jsx as jsx49, jsxs as jsxs20 } from "react/jsx-runtime";
7625
+ import { jsx as jsx48, jsxs as jsxs20 } from "react/jsx-runtime";
7652
7626
  var normalizeRoute = (raw) => {
7653
7627
  const trimmed = raw.trim();
7654
7628
  if (!trimmed) return trimmed;
7655
7629
  return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
7656
7630
  };
7657
- var getClassName30 = get_class_name_factory_default("BrowserBar", styles_module_default26);
7631
+ var getClassName29 = get_class_name_factory_default("BrowserBar", styles_module_default25);
7658
7632
  var DEVICE_VIEWPORTS = {
7659
7633
  desktop: { width: "100%", height: "auto", icon: "Monitor", label: "Desktop" },
7660
7634
  mobile: { width: 360, height: "auto", icon: "Smartphone", label: "Mobile" }
@@ -7700,7 +7674,7 @@ var BrowserBar = ({
7700
7674
  if (!next || next === currentRoute) return;
7701
7675
  void (onRouteChange == null ? void 0 : onRouteChange(next));
7702
7676
  };
7703
- return /* @__PURE__ */ jsxs20("div", { className: getClassName30(), children: [
7677
+ return /* @__PURE__ */ jsxs20("div", { className: getClassName29(), children: [
7704
7678
  showRoutePicker ? /* @__PURE__ */ jsxs20(
7705
7679
  Combobox,
7706
7680
  {
@@ -7716,17 +7690,17 @@ var BrowserBar = ({
7716
7690
  /* @__PURE__ */ jsxs20(
7717
7691
  "form",
7718
7692
  {
7719
- className: getClassName30("urlTrigger"),
7693
+ className: getClassName29("urlTrigger"),
7720
7694
  onSubmit: (event) => {
7721
7695
  event.preventDefault();
7722
7696
  submit(inputValue);
7723
7697
  },
7724
7698
  children: [
7725
- /* @__PURE__ */ jsx49(Globe, { className: getClassName30("urlIcon"), size: 14 }),
7726
- /* @__PURE__ */ jsx49(
7699
+ /* @__PURE__ */ jsx48(Globe, { className: getClassName29("urlIcon"), size: 14 }),
7700
+ /* @__PURE__ */ jsx48(
7727
7701
  ComboboxInput,
7728
7702
  {
7729
- className: getClassName30("urlInput"),
7703
+ className: getClassName29("urlInput"),
7730
7704
  placeholder: "/",
7731
7705
  spellCheck: false,
7732
7706
  autoCorrect: "off",
@@ -7737,32 +7711,32 @@ var BrowserBar = ({
7737
7711
  }
7738
7712
  ),
7739
7713
  /* @__PURE__ */ jsxs20(ComboboxContent, { children: [
7740
- /* @__PURE__ */ jsx49(ComboboxEmpty, { children: "Press Enter to go to this path" }),
7741
- /* @__PURE__ */ jsx49(ComboboxList, { children: (path) => /* @__PURE__ */ jsx49(ComboboxItem, { value: path, children: /* @__PURE__ */ jsx49("span", { className: getClassName30("itemPath"), children: path }) }, path) })
7714
+ /* @__PURE__ */ jsx48(ComboboxEmpty, { children: "Press Enter to go to this path" }),
7715
+ /* @__PURE__ */ jsx48(ComboboxList, { children: (path) => /* @__PURE__ */ jsx48(ComboboxItem, { value: path, children: /* @__PURE__ */ jsx48("span", { className: getClassName29("itemPath"), children: path }) }, path) })
7742
7716
  ] })
7743
7717
  ]
7744
7718
  }
7745
- ) : /* @__PURE__ */ jsxs20("div", { className: getClassName30("urlTrigger"), children: [
7746
- /* @__PURE__ */ jsx49(Globe, { className: getClassName30("urlIcon"), size: 14 }),
7747
- /* @__PURE__ */ jsx49("span", { className: getClassName30("urlText"), children: "/" })
7719
+ ) : /* @__PURE__ */ jsxs20("div", { className: getClassName29("urlTrigger"), children: [
7720
+ /* @__PURE__ */ jsx48(Globe, { className: getClassName29("urlIcon"), size: 14 }),
7721
+ /* @__PURE__ */ jsx48("span", { className: getClassName29("urlText"), children: "/" })
7748
7722
  ] }),
7749
- /* @__PURE__ */ jsxs20("div", { className: getClassName30("actions"), children: [
7750
- /* @__PURE__ */ jsx49(
7723
+ /* @__PURE__ */ jsxs20("div", { className: getClassName29("actions"), children: [
7724
+ /* @__PURE__ */ jsx48(
7751
7725
  IconButton,
7752
7726
  {
7753
7727
  type: "button",
7754
7728
  title: activeDevice === "desktop" ? "Switch to mobile viewport" : "Switch to desktop viewport",
7755
7729
  onClick: () => setDevice(activeDevice === "desktop" ? "mobile" : "desktop"),
7756
- children: /* @__PURE__ */ jsx49("span", { className: getClassName30("deviceIcon"), children: activeDevice === "desktop" ? /* @__PURE__ */ jsx49(Monitor, { size: 16 }) : /* @__PURE__ */ jsx49(Smartphone, { size: 16 }) })
7730
+ children: /* @__PURE__ */ jsx48("span", { className: getClassName29("deviceIcon"), children: activeDevice === "desktop" ? /* @__PURE__ */ jsx48(Monitor, { size: 16 }) : /* @__PURE__ */ jsx48(Smartphone, { size: 16 }) })
7757
7731
  }
7758
7732
  ),
7759
- /* @__PURE__ */ jsx49(
7733
+ /* @__PURE__ */ jsx48(
7760
7734
  IconButton,
7761
7735
  {
7762
7736
  type: "button",
7763
7737
  title: isFullScreen ? "Exit full screen" : "Enter full screen",
7764
7738
  onClick: toggleFullScreen,
7765
- children: /* @__PURE__ */ jsx49("span", { className: getClassName30("deviceIcon"), children: isFullScreen ? /* @__PURE__ */ jsx49(Minimize, { size: 16 }) : /* @__PURE__ */ jsx49(Maximize, { size: 16 }) })
7739
+ children: /* @__PURE__ */ jsx48("span", { className: getClassName29("deviceIcon"), children: isFullScreen ? /* @__PURE__ */ jsx48(Minimize, { size: 16 }) : /* @__PURE__ */ jsx48(Maximize, { size: 16 }) })
7766
7740
  }
7767
7741
  )
7768
7742
  ] })
@@ -7771,7 +7745,7 @@ var BrowserBar = ({
7771
7745
 
7772
7746
  // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Canvas/styles.module.css#css-module
7773
7747
  init_react_import();
7774
- 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" };
7748
+ var styles_module_default26 = { "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" };
7775
7749
 
7776
7750
  // components/Editor/components/Canvas/index.tsx
7777
7751
  import { useShallow as useShallow9 } from "zustand/react/shallow";
@@ -7784,7 +7758,7 @@ import {
7784
7758
  useRef as useRef14,
7785
7759
  useMemo as useMemo21
7786
7760
  } from "react";
7787
- import { jsx as jsx50 } from "react/jsx-runtime";
7761
+ import { jsx as jsx49 } from "react/jsx-runtime";
7788
7762
  var FrameContext = createContext7(null);
7789
7763
  var FrameProvider = ({
7790
7764
  children
@@ -7796,7 +7770,7 @@ var FrameProvider = ({
7796
7770
  }),
7797
7771
  []
7798
7772
  );
7799
- return /* @__PURE__ */ jsx50(FrameContext.Provider, { value, children });
7773
+ return /* @__PURE__ */ jsx49(FrameContext.Provider, { value, children });
7800
7774
  };
7801
7775
  var useCanvasFrame = () => {
7802
7776
  const context = useContext14(FrameContext);
@@ -7807,8 +7781,8 @@ var useCanvasFrame = () => {
7807
7781
  };
7808
7782
 
7809
7783
  // components/Editor/components/Canvas/index.tsx
7810
- import { Fragment as Fragment13, jsx as jsx51, jsxs as jsxs21 } from "react/jsx-runtime";
7811
- var getClassName31 = get_class_name_factory_default("EditorCanvas", styles_module_default27);
7784
+ import { Fragment as Fragment13, jsx as jsx50, jsxs as jsxs21 } from "react/jsx-runtime";
7785
+ var getClassName30 = get_class_name_factory_default("EditorCanvas", styles_module_default26);
7812
7786
  var ZOOM_STEP = 0.15;
7813
7787
  var MIN_ZOOM = 0.25;
7814
7788
  var MAX_ZOOM = 3;
@@ -7850,7 +7824,7 @@ var Canvas = () => {
7850
7824
  const [showTransition, setShowTransition] = useState21(false);
7851
7825
  const isResizingRef = useRef15(false);
7852
7826
  const defaultRender = useMemo22(() => {
7853
- const EditorDefault = ({ children }) => /* @__PURE__ */ jsx51(Fragment13, { children });
7827
+ const EditorDefault = ({ children }) => /* @__PURE__ */ jsx50(Fragment13, { children });
7854
7828
  return EditorDefault;
7855
7829
  }, []);
7856
7830
  const CustomPreview = useMemo22(
@@ -7972,10 +7946,10 @@ var Canvas = () => {
7972
7946
  appStoreApi,
7973
7947
  setUi
7974
7948
  ]);
7975
- return /* @__PURE__ */ jsx51(
7949
+ return /* @__PURE__ */ jsx50(
7976
7950
  "div",
7977
7951
  {
7978
- className: getClassName31({
7952
+ className: getClassName30({
7979
7953
  ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
7980
7954
  showLoader,
7981
7955
  fullScreen: fullScreenCanvas
@@ -7990,16 +7964,16 @@ var Canvas = () => {
7990
7964
  });
7991
7965
  }
7992
7966
  },
7993
- children: /* @__PURE__ */ jsxs21("div", { className: getClassName31("inner"), ref: frameRef, children: [
7994
- !disableZoomControls && /* @__PURE__ */ jsxs21("div", { className: getClassName31("zoomControls"), children: [
7995
- /* @__PURE__ */ jsx51(IconButton, { type: "button", title: "Zoom out", onClick: zoomOut, children: /* @__PURE__ */ jsx51(Minus, { size: 14 }) }),
7996
- /* @__PURE__ */ jsx51(IconButton, { type: "button", title: "Reset zoom", onClick: resetZoom, children: /* @__PURE__ */ jsx51(RotateCcw, { size: 14 }) }),
7997
- /* @__PURE__ */ jsx51(IconButton, { type: "button", title: "Zoom in", onClick: zoomIn, children: /* @__PURE__ */ jsx51(Plus, { size: 14 }) })
7967
+ children: /* @__PURE__ */ jsxs21("div", { className: getClassName30("inner"), ref: frameRef, children: [
7968
+ !disableZoomControls && /* @__PURE__ */ jsxs21("div", { className: getClassName30("zoomControls"), children: [
7969
+ /* @__PURE__ */ jsx50(IconButton, { type: "button", title: "Zoom out", onClick: zoomOut, children: /* @__PURE__ */ jsx50(Minus, { size: 14 }) }),
7970
+ /* @__PURE__ */ jsx50(IconButton, { type: "button", title: "Reset zoom", onClick: resetZoom, children: /* @__PURE__ */ jsx50(RotateCcw, { size: 14 }) }),
7971
+ /* @__PURE__ */ jsx50(IconButton, { type: "button", title: "Zoom in", onClick: zoomIn, children: /* @__PURE__ */ jsx50(Plus, { size: 14 }) })
7998
7972
  ] }),
7999
7973
  /* @__PURE__ */ jsxs21(
8000
7974
  "div",
8001
7975
  {
8002
- className: getClassName31("rootColumn"),
7976
+ className: getClassName30("rootColumn"),
8003
7977
  style: {
8004
7978
  width: iframe.enabled ? viewports.current.width : "100%",
8005
7979
  transform: disableZoomControls ? void 0 : `scale(${canvasZoom})`,
@@ -8007,7 +7981,7 @@ var Canvas = () => {
8007
7981
  transition: showTransition ? `width ${TRANSITION_DURATION}ms ease-out, transform ${TRANSITION_DURATION}ms ease-out` : disableZoomControls ? void 0 : "transform 150ms ease-out"
8008
7982
  },
8009
7983
  children: [
8010
- iframe.enabled && /* @__PURE__ */ jsx51("div", { className: getClassName31("browserBar"), children: /* @__PURE__ */ jsx51(
7984
+ iframe.enabled && /* @__PURE__ */ jsx50("div", { className: getClassName30("browserBar"), children: /* @__PURE__ */ jsx50(
8011
7985
  BrowserBar,
8012
7986
  {
8013
7987
  onViewportChange: (viewport) => {
@@ -8024,23 +7998,23 @@ var Canvas = () => {
8024
7998
  }
8025
7999
  }
8026
8000
  ) }),
8027
- /* @__PURE__ */ jsx51(
8001
+ /* @__PURE__ */ jsx50(
8028
8002
  "div",
8029
8003
  {
8030
- className: getClassName31("root"),
8004
+ className: getClassName30("root"),
8031
8005
  suppressHydrationWarning: true,
8032
8006
  id: "editor-canvas-root",
8033
8007
  onTransitionEnd: () => {
8034
8008
  setShowTransition(false);
8035
8009
  isResizingRef.current = false;
8036
8010
  },
8037
- children: /* @__PURE__ */ jsx51(CustomPreview, { children: /* @__PURE__ */ jsx51(Preview2, {}) })
8011
+ children: /* @__PURE__ */ jsx50(CustomPreview, { children: /* @__PURE__ */ jsx50(Preview2, {}) })
8038
8012
  }
8039
8013
  )
8040
8014
  ]
8041
8015
  }
8042
8016
  ),
8043
- /* @__PURE__ */ jsx51("div", { className: getClassName31("loader"), children: /* @__PURE__ */ jsx51(Loader, { size: 24 }) })
8017
+ /* @__PURE__ */ jsx50("div", { className: getClassName30("loader"), children: /* @__PURE__ */ jsx50(Loader, { size: 24 }) })
8044
8018
  ] })
8045
8019
  }
8046
8020
  );
@@ -8136,11 +8110,11 @@ import { useCallback as useCallback21, useRef as useRef17 } from "react";
8136
8110
 
8137
8111
  // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/ResizeHandle/styles.module.css#css-module
8138
8112
  init_react_import();
8139
- var styles_module_default28 = { "ResizeHandle": "_ResizeHandle_1u3rv_2", "ResizeHandle--left": "_ResizeHandle--left_1u3rv_16", "ResizeHandle--right": "_ResizeHandle--right_1u3rv_20" };
8113
+ var styles_module_default27 = { "ResizeHandle": "_ResizeHandle_1u3rv_2", "ResizeHandle--left": "_ResizeHandle--left_1u3rv_16", "ResizeHandle--right": "_ResizeHandle--right_1u3rv_20" };
8140
8114
 
8141
8115
  // components/Editor/components/ResizeHandle/index.tsx
8142
- import { jsx as jsx52 } from "react/jsx-runtime";
8143
- var getClassName32 = get_class_name_factory_default("ResizeHandle", styles_module_default28);
8116
+ import { jsx as jsx51 } from "react/jsx-runtime";
8117
+ var getClassName31 = get_class_name_factory_default("ResizeHandle", styles_module_default27);
8144
8118
  var ResizeHandle = ({
8145
8119
  position,
8146
8120
  sidebarRef,
@@ -8195,11 +8169,11 @@ var ResizeHandle = ({
8195
8169
  },
8196
8170
  [position, handleMouseMove, handleMouseUp]
8197
8171
  );
8198
- return /* @__PURE__ */ jsx52(
8172
+ return /* @__PURE__ */ jsx51(
8199
8173
  "div",
8200
8174
  {
8201
8175
  ref: handleRef,
8202
- className: getClassName32({ [position]: true }),
8176
+ className: getClassName31({ [position]: true }),
8203
8177
  onMouseDown: handleMouseDown
8204
8178
  }
8205
8179
  );
@@ -8207,11 +8181,11 @@ var ResizeHandle = ({
8207
8181
 
8208
8182
  // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Sidebar/styles.module.css#css-module
8209
8183
  init_react_import();
8210
- 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" };
8184
+ var styles_module_default28 = { "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" };
8211
8185
 
8212
8186
  // components/Editor/components/Sidebar/index.tsx
8213
- import { Fragment as Fragment14, jsx as jsx53, jsxs as jsxs22 } from "react/jsx-runtime";
8214
- var getClassName33 = get_class_name_factory_default("Sidebar", styles_module_default29);
8187
+ import { Fragment as Fragment14, jsx as jsx52, jsxs as jsxs22 } from "react/jsx-runtime";
8188
+ var getClassName32 = get_class_name_factory_default("Sidebar", styles_module_default28);
8215
8189
  var Sidebar = ({
8216
8190
  position,
8217
8191
  sidebarRef,
@@ -8221,15 +8195,15 @@ var Sidebar = ({
8221
8195
  children
8222
8196
  }) => {
8223
8197
  return /* @__PURE__ */ jsxs22(Fragment14, { children: [
8224
- /* @__PURE__ */ jsx53(
8198
+ /* @__PURE__ */ jsx52(
8225
8199
  "div",
8226
8200
  {
8227
8201
  ref: sidebarRef,
8228
- className: getClassName33({ [position]: true, isVisible }),
8202
+ className: getClassName32({ [position]: true, isVisible }),
8229
8203
  children
8230
8204
  }
8231
8205
  ),
8232
- /* @__PURE__ */ jsx53("div", { className: `${getClassName33("resizeHandle")}`, children: /* @__PURE__ */ jsx53(
8206
+ /* @__PURE__ */ jsx52("div", { className: `${getClassName32("resizeHandle")}`, children: /* @__PURE__ */ jsx52(
8233
8207
  ResizeHandle,
8234
8208
  {
8235
8209
  position,
@@ -8404,12 +8378,12 @@ init_react_import();
8404
8378
 
8405
8379
  // css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Nav/styles.module.css#css-module
8406
8380
  init_react_import();
8407
- 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" };
8381
+ var styles_module_default29 = { "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" };
8408
8382
 
8409
8383
  // components/Editor/components/Nav/index.tsx
8410
- import { jsx as jsx54, jsxs as jsxs23 } from "react/jsx-runtime";
8411
- var getClassName34 = get_class_name_factory_default("Nav", styles_module_default30);
8412
- var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default30);
8384
+ import { jsx as jsx53, jsxs as jsxs23 } from "react/jsx-runtime";
8385
+ var getClassName33 = get_class_name_factory_default("Nav", styles_module_default29);
8386
+ var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default29);
8413
8387
  var MenuItem = ({
8414
8388
  label,
8415
8389
  icon,
@@ -8418,7 +8392,7 @@ var MenuItem = ({
8418
8392
  mobileOnly,
8419
8393
  desktopOnly
8420
8394
  }) => {
8421
- return /* @__PURE__ */ jsx54(
8395
+ return /* @__PURE__ */ jsx53(
8422
8396
  "li",
8423
8397
  {
8424
8398
  className: getClassNameItem3({
@@ -8427,8 +8401,8 @@ var MenuItem = ({
8427
8401
  desktopOnly
8428
8402
  }),
8429
8403
  children: onClick && /* @__PURE__ */ jsxs23("div", { className: getClassNameItem3("link"), onClick, children: [
8430
- icon && /* @__PURE__ */ jsx54("span", { className: getClassNameItem3("linkIcon"), children: icon }),
8431
- /* @__PURE__ */ jsx54("span", { className: getClassNameItem3("linkLabel"), children: label })
8404
+ icon && /* @__PURE__ */ jsx53("span", { className: getClassNameItem3("linkIcon"), children: icon }),
8405
+ /* @__PURE__ */ jsx53("span", { className: getClassNameItem3("linkLabel"), children: label })
8432
8406
  ] })
8433
8407
  }
8434
8408
  );
@@ -8437,17 +8411,17 @@ var Nav = ({
8437
8411
  items,
8438
8412
  footer
8439
8413
  }) => {
8440
- return /* @__PURE__ */ jsxs23("nav", { className: getClassName34(), children: [
8441
- /* @__PURE__ */ jsx54("ul", { className: getClassName34("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx54(MenuItem, __spreadValues({}, item), key)) }),
8442
- footer && /* @__PURE__ */ jsx54("div", { className: getClassName34("footer"), children: footer })
8414
+ return /* @__PURE__ */ jsxs23("nav", { className: getClassName33(), children: [
8415
+ /* @__PURE__ */ jsx53("ul", { className: getClassName33("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ jsx53(MenuItem, __spreadValues({}, item), key)) }),
8416
+ footer && /* @__PURE__ */ jsx53("div", { className: getClassName33("footer"), children: footer })
8443
8417
  ] });
8444
8418
  };
8445
8419
 
8446
8420
  // components/Editor/components/Layout/index.tsx
8447
- import { Fragment as Fragment15, jsx as jsx55, jsxs as jsxs24 } from "react/jsx-runtime";
8448
- var getClassName35 = get_class_name_factory_default("Editor", styles_module_default23);
8449
- var getLayoutClassName = get_class_name_factory_default("EditorLayout", styles_module_default23);
8450
- var getPluginTabClassName = get_class_name_factory_default("EditorPluginTab", styles_module_default23);
8421
+ import { Fragment as Fragment15, jsx as jsx54, jsxs as jsxs24 } from "react/jsx-runtime";
8422
+ var getClassName34 = get_class_name_factory_default("Editor", styles_module_default22);
8423
+ var getLayoutClassName = get_class_name_factory_default("EditorLayout", styles_module_default22);
8424
+ var getPluginTabClassName = get_class_name_factory_default("EditorPluginTab", styles_module_default22);
8451
8425
  var FieldSideBarToolbar = () => {
8452
8426
  const appStore = useAppStoreApi();
8453
8427
  const { onPublish, currentRoute } = usePropsContext();
@@ -8458,30 +8432,30 @@ var FieldSideBarToolbar = () => {
8458
8432
  const CustomHeaderActions = useAppStore(
8459
8433
  (s) => s.overrides.headerActions || DefaultOverride
8460
8434
  );
8461
- return /* @__PURE__ */ jsxs24("div", { className: getClassName35("fieldSideBarToolbar"), children: [
8462
- /* @__PURE__ */ jsxs24("div", { className: getClassName35("fieldSideBarHistory"), children: [
8463
- /* @__PURE__ */ jsx55(
8435
+ return /* @__PURE__ */ jsxs24("div", { className: getClassName34("fieldSideBarToolbar"), children: [
8436
+ /* @__PURE__ */ jsxs24("div", { className: getClassName34("fieldSideBarHistory"), children: [
8437
+ /* @__PURE__ */ jsx54(
8464
8438
  IconButton,
8465
8439
  {
8466
8440
  type: "button",
8467
8441
  title: "undo",
8468
8442
  disabled: !hasPast,
8469
8443
  onClick: back,
8470
- children: /* @__PURE__ */ jsx55(Undo2, { size: 18 })
8444
+ children: /* @__PURE__ */ jsx54(Undo2, { size: 18 })
8471
8445
  }
8472
8446
  ),
8473
- /* @__PURE__ */ jsx55(
8447
+ /* @__PURE__ */ jsx54(
8474
8448
  IconButton,
8475
8449
  {
8476
8450
  type: "button",
8477
8451
  title: "redo",
8478
8452
  disabled: !hasFuture,
8479
8453
  onClick: forward,
8480
- children: /* @__PURE__ */ jsx55(Redo2, { size: 18 })
8454
+ children: /* @__PURE__ */ jsx54(Redo2, { size: 18 })
8481
8455
  }
8482
8456
  )
8483
8457
  ] }),
8484
- /* @__PURE__ */ jsx55("div", { className: getClassName35("fieldSideBarActions"), children: /* @__PURE__ */ jsx55(CustomHeaderActions, { children: /* @__PURE__ */ jsx55(
8458
+ /* @__PURE__ */ jsx54("div", { className: getClassName34("fieldSideBarActions"), children: /* @__PURE__ */ jsx54(CustomHeaderActions, { children: /* @__PURE__ */ jsx54(
8485
8459
  Button,
8486
8460
  {
8487
8461
  onClick: () => {
@@ -8501,8 +8475,8 @@ var FieldSideBar = () => {
8501
8475
  }
8502
8476
  );
8503
8477
  return /* @__PURE__ */ jsxs24(Fragment15, { children: [
8504
- /* @__PURE__ */ jsx55(FieldSideBarToolbar, {}),
8505
- /* @__PURE__ */ jsx55(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx55(Fields, {}) })
8478
+ /* @__PURE__ */ jsx54(FieldSideBarToolbar, {}),
8479
+ /* @__PURE__ */ jsx54(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ jsx54(Fields, {}) })
8506
8480
  ] });
8507
8481
  };
8508
8482
  var PluginTab = ({
@@ -8510,7 +8484,7 @@ var PluginTab = ({
8510
8484
  visible,
8511
8485
  mobileOnly
8512
8486
  }) => {
8513
- return /* @__PURE__ */ jsx55("div", { className: getPluginTabClassName({ visible, mobileOnly }), children: /* @__PURE__ */ jsx55("div", { className: getPluginTabClassName("body"), children }) });
8487
+ return /* @__PURE__ */ jsx54("div", { className: getPluginTabClassName({ visible, mobileOnly }), children: /* @__PURE__ */ jsx54("div", { className: getPluginTabClassName("body"), children }) });
8514
8488
  };
8515
8489
  var Layout = ({ children }) => {
8516
8490
  const {
@@ -8533,6 +8507,7 @@ var Layout = ({ children }) => {
8533
8507
  const rightSideBarVisible = useAppStore(
8534
8508
  (s) => s.state.ui.rightSideBarVisible
8535
8509
  );
8510
+ const navBarVisible = useAppStore((s) => s.state.ui.navBarVisible);
8536
8511
  const instanceId = useAppStore((s) => s.instanceId);
8537
8512
  const {
8538
8513
  width: leftWidth,
@@ -8677,7 +8652,7 @@ var Layout = ({ children }) => {
8677
8652
  const toggleTheme = () => {
8678
8653
  setTheme((t) => t === "dark" ? "light" : "dark");
8679
8654
  };
8680
- const themeIcon = theme === "dark" ? /* @__PURE__ */ jsx55(Sun, { size: 18 }) : /* @__PURE__ */ jsx55(Moon, { size: 18 });
8655
+ const themeIcon = theme === "dark" ? /* @__PURE__ */ jsx54(Sun, { size: 18 }) : /* @__PURE__ */ jsx54(Moon, { size: 18 });
8681
8656
  const themeLabel = theme === "dark" ? "Switch to light mode" : "Switch to dark mode";
8682
8657
  const hasLegacySideBarPlugin = useMemo23(
8683
8658
  () => !!(plugins == null ? void 0 : plugins.find((p) => p.name === "legacy-side-bar")),
@@ -8685,7 +8660,7 @@ var Layout = ({ children }) => {
8685
8660
  );
8686
8661
  const pluginItems = useMemo23(() => {
8687
8662
  const details = {};
8688
- const defaultPlugins = [blocksPlugin(), outlinePlugin()];
8663
+ const defaultPlugins = [blocksPlugin()];
8689
8664
  const isLegacy = (plugin) => plugin.name === "legacy-side-bar" ? -1 : 0;
8690
8665
  const combinedPlugins = [
8691
8666
  ...defaultPlugins,
@@ -8702,7 +8677,7 @@ var Layout = ({ children }) => {
8702
8677
  }
8703
8678
  details[plugin.name] = {
8704
8679
  label: (_a = plugin.label) != null ? _a : plugin.name,
8705
- icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ jsx55(ToyBrick, {}),
8680
+ icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ jsx54(ToyBrick, {}),
8706
8681
  onClick: () => {
8707
8682
  var _a2;
8708
8683
  setMobilePanelHeightMode((_a2 = plugin.mobilePanelHeight) != null ? _a2 : "toggle");
@@ -8744,20 +8719,21 @@ var Layout = ({ children }) => {
8744
8719
  return /* @__PURE__ */ jsxs24(
8745
8720
  "div",
8746
8721
  {
8747
- className: `Editor ${getClassName35({
8722
+ className: `Editor ${getClassName34({
8748
8723
  hidePlugins: hasLegacySideBarPlugin
8749
8724
  })}`,
8750
8725
  id: instanceId,
8751
8726
  "data-theme": theme,
8752
8727
  style: { height },
8753
8728
  children: [
8754
- /* @__PURE__ */ jsx55(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx55(CustomEditor, { children: children || /* @__PURE__ */ jsx55(FrameProvider, { children: /* @__PURE__ */ jsx55(
8729
+ /* @__PURE__ */ jsx54(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ jsx54(CustomEditor, { children: children || /* @__PURE__ */ jsx54(FrameProvider, { children: /* @__PURE__ */ jsx54(
8755
8730
  "div",
8756
8731
  {
8757
8732
  className: getLayoutClassName({
8758
8733
  leftSideBarVisible,
8759
8734
  mounted,
8760
8735
  rightSideBarVisible: !hasDesktopFieldsPlugin && rightSideBarVisible,
8736
+ navBarVisible,
8761
8737
  mobilePanelHeightToggle: mobilePanelHeightMode === "toggle",
8762
8738
  mobilePanelHeightMinContent: mobilePanelHeightMode === "min-content",
8763
8739
  mobilePanelCustomHeight: mobilePanelHeight !== null && leftSideBarVisible
@@ -8769,11 +8745,11 @@ var Layout = ({ children }) => {
8769
8745
  className: getLayoutClassName("inner"),
8770
8746
  style: __spreadValues(__spreadValues({}, layoutOptions), mobilePanelStyle),
8771
8747
  children: [
8772
- /* @__PURE__ */ jsx55("div", { className: getLayoutClassName("nav"), children: /* @__PURE__ */ jsx55(
8748
+ navBarVisible && /* @__PURE__ */ jsx54("div", { className: getLayoutClassName("nav"), children: /* @__PURE__ */ jsx54(
8773
8749
  Nav,
8774
8750
  {
8775
8751
  items: pluginItems,
8776
- footer: /* @__PURE__ */ jsx55(
8752
+ footer: /* @__PURE__ */ jsx54(
8777
8753
  IconButton,
8778
8754
  {
8779
8755
  type: "button",
@@ -8790,13 +8766,13 @@ var Layout = ({ children }) => {
8790
8766
  ref: mobilePanelRef,
8791
8767
  className: getLayoutClassName("mobilePanel"),
8792
8768
  children: [
8793
- /* @__PURE__ */ jsx55(
8769
+ /* @__PURE__ */ jsx54(
8794
8770
  "div",
8795
8771
  {
8796
8772
  className: getLayoutClassName("mobileDragHandle"),
8797
8773
  onTouchStart: (e) => handleMobileDragStart(e.touches[0].clientY),
8798
8774
  onMouseDown: (e) => handleMobileDragStart(e.clientY),
8799
- children: /* @__PURE__ */ jsx55(
8775
+ children: /* @__PURE__ */ jsx54(
8800
8776
  "div",
8801
8777
  {
8802
8778
  className: getLayoutClassName("mobileDragHandlePill")
@@ -8804,17 +8780,17 @@ var Layout = ({ children }) => {
8804
8780
  )
8805
8781
  }
8806
8782
  ),
8807
- /* @__PURE__ */ jsx55(
8783
+ /* @__PURE__ */ jsx54(
8808
8784
  "div",
8809
8785
  {
8810
8786
  className: getLayoutClassName("mobilePanelContent"),
8811
8787
  children: Object.entries(pluginItems).map(
8812
- ([id, { mobileOnly, render: Render2 }]) => /* @__PURE__ */ jsx55(
8788
+ ([id, { mobileOnly, render: Render2 }]) => /* @__PURE__ */ jsx54(
8813
8789
  PluginTab,
8814
8790
  {
8815
8791
  visible: currentPlugin === id,
8816
8792
  mobileOnly,
8817
- children: /* @__PURE__ */ jsx55(Render2, {})
8793
+ children: /* @__PURE__ */ jsx54(Render2, {})
8818
8794
  },
8819
8795
  id
8820
8796
  )
@@ -8824,7 +8800,7 @@ var Layout = ({ children }) => {
8824
8800
  ]
8825
8801
  }
8826
8802
  ),
8827
- /* @__PURE__ */ jsx55(
8803
+ /* @__PURE__ */ jsx54(
8828
8804
  Sidebar,
8829
8805
  {
8830
8806
  position: "left",
@@ -8833,20 +8809,20 @@ var Layout = ({ children }) => {
8833
8809
  onResize: setLeftWidth,
8834
8810
  onResizeEnd: handleLeftSidebarResizeEnd,
8835
8811
  children: Object.entries(pluginItems).map(
8836
- ([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */ jsx55(
8812
+ ([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */ jsx54(
8837
8813
  PluginTab,
8838
8814
  {
8839
8815
  visible: currentPlugin === id,
8840
8816
  mobileOnly,
8841
- children: /* @__PURE__ */ jsx55(Render2, {})
8817
+ children: /* @__PURE__ */ jsx54(Render2, {})
8842
8818
  },
8843
8819
  id
8844
8820
  )
8845
8821
  )
8846
8822
  }
8847
8823
  ),
8848
- /* @__PURE__ */ jsx55(Canvas, {}),
8849
- !hasDesktopFieldsPlugin && /* @__PURE__ */ jsx55(
8824
+ /* @__PURE__ */ jsx54(Canvas, {}),
8825
+ !hasDesktopFieldsPlugin && /* @__PURE__ */ jsx54(
8850
8826
  Sidebar,
8851
8827
  {
8852
8828
  position: "right",
@@ -8854,7 +8830,7 @@ var Layout = ({ children }) => {
8854
8830
  isVisible: rightSideBarVisible,
8855
8831
  onResize: setRightWidth,
8856
8832
  onResizeEnd: handleRightSidebarResizeEnd,
8857
- children: /* @__PURE__ */ jsx55(FieldSideBar, {})
8833
+ children: /* @__PURE__ */ jsx54(FieldSideBar, {})
8858
8834
  }
8859
8835
  )
8860
8836
  ]
@@ -8862,17 +8838,17 @@ var Layout = ({ children }) => {
8862
8838
  )
8863
8839
  }
8864
8840
  ) }) }) }),
8865
- /* @__PURE__ */ jsx55("div", { id: "editor-portal-root", className: getClassName35("portal") })
8841
+ /* @__PURE__ */ jsx54("div", { id: "editor-portal-root", className: getClassName34("portal") })
8866
8842
  ]
8867
8843
  }
8868
8844
  );
8869
8845
  };
8870
8846
 
8871
8847
  // components/Editor/index.tsx
8872
- import { jsx as jsx56 } from "react/jsx-runtime";
8848
+ import { jsx as jsx55 } from "react/jsx-runtime";
8873
8849
  var propsContext = createContext8({});
8874
8850
  function PropsProvider(props) {
8875
- return /* @__PURE__ */ jsx56(propsContext.Provider, { value: props, children: props.children });
8851
+ return /* @__PURE__ */ jsx55(propsContext.Provider, { value: props, children: props.children });
8876
8852
  }
8877
8853
  var usePropsContext = () => useContext15(propsContext);
8878
8854
  function EditorProvider({ children }) {
@@ -9056,10 +9032,10 @@ function EditorProvider({ children }) {
9056
9032
  resolveAndCommitData();
9057
9033
  }, 0);
9058
9034
  }, []);
9059
- return /* @__PURE__ */ jsx56(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx56(UseEditorStoreContext.Provider, { value: uEditorStore, children }) });
9035
+ return /* @__PURE__ */ jsx55(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ jsx55(UseEditorStoreContext.Provider, { value: uEditorStore, children }) });
9060
9036
  }
9061
9037
  function Editor3(props) {
9062
- return /* @__PURE__ */ jsx56(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx56(EditorProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx56(Layout, { children: props.children }) })) }));
9038
+ return /* @__PURE__ */ jsx55(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx55(EditorProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx55(Layout, { children: props.children }) })) }));
9063
9039
  }
9064
9040
  Editor3.Components = Components;
9065
9041
  Editor3.Fields = Fields;
@@ -9144,7 +9120,7 @@ import {
9144
9120
  MemoryRouter,
9145
9121
  StaticRouter
9146
9122
  } from "react-router";
9147
- import { jsx as jsx57 } from "react/jsx-runtime";
9123
+ import { jsx as jsx56 } from "react/jsx-runtime";
9148
9124
  var EDITOR_PATH = "/editor";
9149
9125
  var isServer = typeof window === "undefined";
9150
9126
  function AppProvider({
@@ -9165,28 +9141,28 @@ function AppProvider({
9165
9141
  }),
9166
9142
  [config, stablePages, resolvedEditorPath]
9167
9143
  );
9168
- const inner = /* @__PURE__ */ jsx57(appConfigContext.Provider, { value: ctxValue, children });
9144
+ const inner = /* @__PURE__ */ jsx56(appConfigContext.Provider, { value: ctxValue, children });
9169
9145
  if (isServer) {
9170
- return /* @__PURE__ */ jsx57(StaticRouter, { location: currentPath != null ? currentPath : "/", children: inner });
9146
+ return /* @__PURE__ */ jsx56(StaticRouter, { location: currentPath != null ? currentPath : "/", children: inner });
9171
9147
  }
9172
9148
  if (router === "hash") {
9173
- return /* @__PURE__ */ jsx57(HashRouter, { children: inner });
9149
+ return /* @__PURE__ */ jsx56(HashRouter, { children: inner });
9174
9150
  }
9175
9151
  if (router === "memory") {
9176
- return /* @__PURE__ */ jsx57(MemoryRouter, { initialEntries: [currentPath != null ? currentPath : "/"], children: inner });
9152
+ return /* @__PURE__ */ jsx56(MemoryRouter, { initialEntries: [currentPath != null ? currentPath : "/"], children: inner });
9177
9153
  }
9178
- return /* @__PURE__ */ jsx57(BrowserRouter, { children: inner });
9154
+ return /* @__PURE__ */ jsx56(BrowserRouter, { children: inner });
9179
9155
  }
9180
9156
 
9181
9157
  // components/App/App.tsx
9182
9158
  init_react_import();
9183
9159
  import { Route, Routes } from "react-router";
9184
- import { Fragment as Fragment16, jsx as jsx58, jsxs as jsxs25 } from "react/jsx-runtime";
9160
+ import { Fragment as Fragment16, jsx as jsx57, jsxs as jsxs25 } from "react/jsx-runtime";
9185
9161
  var joinEditorPath = (editorPath, route) => {
9186
9162
  if (route === "/") return editorPath;
9187
9163
  return `${editorPath}${route}`;
9188
9164
  };
9189
- var DefaultNotFound = () => /* @__PURE__ */ jsx58(
9165
+ var DefaultNotFound = () => /* @__PURE__ */ jsx57(
9190
9166
  "div",
9191
9167
  {
9192
9168
  style: {
@@ -9197,19 +9173,19 @@ var DefaultNotFound = () => /* @__PURE__ */ jsx58(
9197
9173
  alignItems: "center"
9198
9174
  },
9199
9175
  children: /* @__PURE__ */ jsxs25("div", { children: [
9200
- /* @__PURE__ */ jsx58("h1", { children: "404" }),
9201
- /* @__PURE__ */ jsx58("p", { children: "No page matches this route." })
9176
+ /* @__PURE__ */ jsx57("h1", { children: "404" }),
9177
+ /* @__PURE__ */ jsx57("p", { children: "No page matches this route." })
9202
9178
  ] })
9203
9179
  }
9204
9180
  );
9205
- function RenderRoute({
9181
+ function RenderForKey({
9206
9182
  routeKey,
9207
9183
  metadata
9208
9184
  }) {
9209
9185
  const { config, pages } = useApp();
9210
9186
  const data = pages[routeKey];
9211
9187
  if (!data) return null;
9212
- return /* @__PURE__ */ jsx58(
9188
+ return /* @__PURE__ */ jsx57(
9213
9189
  Render,
9214
9190
  {
9215
9191
  config,
@@ -9219,91 +9195,118 @@ function RenderRoute({
9219
9195
  routeKey
9220
9196
  );
9221
9197
  }
9222
- function EditorRouteRender({
9198
+ function EditorForKey({
9223
9199
  routeKey,
9224
- layoutProps
9200
+ editorProps,
9201
+ children
9225
9202
  }) {
9226
- const {
9227
- onPublish,
9228
- onChange,
9229
- plugins,
9230
- overrides,
9231
- fieldTransforms,
9232
- metadata,
9233
- iframe,
9234
- viewports,
9235
- permissions
9236
- } = layoutProps;
9237
9203
  const { config, pages, routes, navigate } = useApp();
9238
9204
  const data = pages[routeKey];
9239
9205
  if (!data) return null;
9240
- return /* @__PURE__ */ jsx58(
9206
+ return /* @__PURE__ */ jsx57(
9241
9207
  Editor3,
9242
9208
  {
9243
9209
  config,
9244
9210
  data,
9245
- plugins,
9246
- overrides,
9247
- fieldTransforms,
9248
- metadata,
9249
- iframe,
9250
- viewports,
9251
- permissions,
9252
- onChange,
9253
- onPublish,
9211
+ ui: editorProps.ui,
9212
+ plugins: editorProps.plugins,
9213
+ overrides: editorProps.overrides,
9214
+ fieldTransforms: editorProps.fieldTransforms,
9215
+ metadata: editorProps.metadata,
9216
+ iframe: editorProps.iframe,
9217
+ viewports: editorProps.viewports,
9218
+ permissions: editorProps.permissions,
9219
+ onChange: editorProps.onChange,
9220
+ onPublish: editorProps.onPublish,
9221
+ onAction: editorProps.onAction,
9222
+ renderHeader: editorProps.renderHeader,
9223
+ renderHeaderActions: editorProps.renderHeaderActions,
9224
+ title: editorProps.title,
9225
+ dnd: editorProps.dnd,
9226
+ initialHistory: editorProps.initialHistory,
9227
+ height: editorProps.height,
9228
+ fullScreenCanvas: editorProps.fullScreenCanvas,
9229
+ disableZoomControls: editorProps.disableZoomControls,
9230
+ _experimentalVirtualization: editorProps._experimentalVirtualization,
9254
9231
  routes,
9255
9232
  currentRoute: routeKey,
9256
- onRouteChange: (next) => navigate(next)
9233
+ onRouteChange: (next) => navigate(next),
9234
+ children
9257
9235
  },
9258
9236
  routeKey
9259
9237
  );
9260
9238
  }
9261
- function NotFoundRoute({
9262
- renderNotFound
9263
- }) {
9264
- return renderNotFound ? /* @__PURE__ */ jsx58(Fragment16, { children: renderNotFound() }) : /* @__PURE__ */ jsx58(DefaultNotFound, {});
9265
- }
9266
- function AppLayout(layoutProps) {
9267
- const { pages, editorPath } = useApp();
9268
- const renderRoutes = Object.keys(pages);
9239
+ function AppRender({ metadata, renderNotFound }) {
9240
+ const { pages, isEditing } = useApp();
9241
+ if (isEditing) return null;
9242
+ const routeKeys = Object.keys(pages);
9269
9243
  return /* @__PURE__ */ jsxs25(Routes, { children: [
9270
- renderRoutes.map((routeKey) => /* @__PURE__ */ jsx58(
9244
+ routeKeys.map((routeKey) => /* @__PURE__ */ jsx57(
9271
9245
  Route,
9272
9246
  {
9273
9247
  path: routeKey,
9274
- element: /* @__PURE__ */ jsx58(
9275
- RenderRoute,
9248
+ element: /* @__PURE__ */ jsx57(
9249
+ RenderForKey,
9276
9250
  {
9277
9251
  routeKey,
9278
- metadata: layoutProps.metadata
9252
+ metadata
9279
9253
  }
9280
9254
  )
9281
9255
  },
9282
9256
  `render:${routeKey}`
9283
9257
  )),
9284
- editorPath !== null && renderRoutes.map((routeKey) => /* @__PURE__ */ jsx58(
9258
+ /* @__PURE__ */ jsx57(
9259
+ Route,
9260
+ {
9261
+ path: "*",
9262
+ element: renderNotFound ? /* @__PURE__ */ jsx57(Fragment16, { children: renderNotFound() }) : /* @__PURE__ */ jsx57(DefaultNotFound, {})
9263
+ }
9264
+ )
9265
+ ] });
9266
+ }
9267
+ function AppEditor(props) {
9268
+ const _a = props, { children, renderNotFound } = _a, editorProps = __objRest(_a, ["children", "renderNotFound"]);
9269
+ const { pages, isEditing, editorPath } = useApp();
9270
+ if (!isEditing || editorPath === null) return null;
9271
+ const routeKeys = Object.keys(pages);
9272
+ return /* @__PURE__ */ jsxs25(Routes, { children: [
9273
+ routeKeys.map((routeKey) => /* @__PURE__ */ jsx57(
9285
9274
  Route,
9286
9275
  {
9287
9276
  path: joinEditorPath(editorPath, routeKey),
9288
- element: /* @__PURE__ */ jsx58(
9289
- EditorRouteRender,
9277
+ element: /* @__PURE__ */ jsx57(
9278
+ EditorForKey,
9290
9279
  {
9291
9280
  routeKey,
9292
- layoutProps
9281
+ editorProps,
9282
+ children
9293
9283
  }
9294
9284
  )
9295
9285
  },
9296
9286
  `edit:${routeKey}`
9297
9287
  )),
9298
- /* @__PURE__ */ jsx58(
9288
+ /* @__PURE__ */ jsx57(
9299
9289
  Route,
9300
9290
  {
9301
9291
  path: "*",
9302
- element: /* @__PURE__ */ jsx58(NotFoundRoute, { renderNotFound: layoutProps.renderNotFound })
9292
+ element: renderNotFound ? /* @__PURE__ */ jsx57(Fragment16, { children: renderNotFound() }) : /* @__PURE__ */ jsx57(DefaultNotFound, {})
9303
9293
  }
9304
9294
  )
9305
9295
  ] });
9306
9296
  }
9297
+ function DefaultAppLayout(props) {
9298
+ const _a = props, { renderNotFound } = _a, editorProps = __objRest(_a, ["renderNotFound"]);
9299
+ return /* @__PURE__ */ jsxs25(Fragment16, { children: [
9300
+ /* @__PURE__ */ jsx57(
9301
+ AppRender,
9302
+ {
9303
+ metadata: editorProps.metadata,
9304
+ renderNotFound
9305
+ }
9306
+ ),
9307
+ /* @__PURE__ */ jsx57(AppEditor, __spreadProps(__spreadValues({}, editorProps), { renderNotFound }))
9308
+ ] });
9309
+ }
9307
9310
  function App(props) {
9308
9311
  const _a = props, {
9309
9312
  config,
@@ -9320,7 +9323,7 @@ function App(props) {
9320
9323
  "router",
9321
9324
  "children"
9322
9325
  ]);
9323
- return /* @__PURE__ */ jsx58(
9326
+ return /* @__PURE__ */ jsx57(
9324
9327
  AppProvider,
9325
9328
  {
9326
9329
  config,
@@ -9328,10 +9331,12 @@ function App(props) {
9328
9331
  currentPath,
9329
9332
  editorPath,
9330
9333
  router,
9331
- children: children != null ? children : /* @__PURE__ */ jsx58(AppLayout, __spreadValues({}, layoutProps))
9334
+ children: children != null ? children : /* @__PURE__ */ jsx57(DefaultAppLayout, __spreadValues({}, layoutProps))
9332
9335
  }
9333
9336
  );
9334
9337
  }
9338
+ App.Render = AppRender;
9339
+ App.Editor = AppEditor;
9335
9340
 
9336
9341
  // components/App/use-route-params.ts
9337
9342
  init_react_import();
@@ -9364,6 +9369,23 @@ function pageMetadata(data) {
9364
9369
  return out;
9365
9370
  }
9366
9371
 
9372
+ // plugins/outline/index.tsx
9373
+ init_react_import();
9374
+
9375
+ // css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/outline/styles.module.css#css-module
9376
+ init_react_import();
9377
+ var styles_module_default30 = { "OutlinePlugin": "_OutlinePlugin_q92j6_1" };
9378
+
9379
+ // plugins/outline/index.tsx
9380
+ import { jsx as jsx58 } from "react/jsx-runtime";
9381
+ var getClassName35 = get_class_name_factory_default("OutlinePlugin", styles_module_default30);
9382
+ var outlinePlugin = () => ({
9383
+ name: "outline",
9384
+ label: "Outline",
9385
+ render: () => /* @__PURE__ */ jsx58("div", { className: getClassName35(), children: /* @__PURE__ */ jsx58(Outline, {}) }),
9386
+ icon: /* @__PURE__ */ jsx58(Layers, {})
9387
+ });
9388
+
9367
9389
  // plugins/legacy-side-bar/index.tsx
9368
9390
  init_react_import();
9369
9391
  import { jsx as jsx59, jsxs as jsxs26 } from "react/jsx-runtime";
@@ -9432,7 +9454,6 @@ export {
9432
9454
  useEditor,
9433
9455
  useGetEditor,
9434
9456
  blocksPlugin,
9435
- outlinePlugin,
9436
9457
  fieldsPlugin,
9437
9458
  usePropsContext,
9438
9459
  Editor3 as Editor,
@@ -9443,5 +9464,6 @@ export {
9443
9464
  App,
9444
9465
  useRouteParams,
9445
9466
  pageMetadata,
9467
+ outlinePlugin,
9446
9468
  legacySideBarPlugin
9447
9469
  };