@reacteditor/core 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Editor-4LPVLYSU.css +415 -0
- package/dist/{Editor-POJT3RA2.mjs → Editor-OSAG52QF.mjs} +10 -10
- package/dist/{Render-JNABKPAF.mjs → Render-STFB5CNO.mjs} +1 -1
- package/dist/Render-ZTUTUUAH.css +103 -0
- package/dist/{actions-CQmL3wwa.d.mts → actions-BDMhAtxP.d.mts} +2 -1
- package/dist/{actions-CQmL3wwa.d.ts → actions-BDMhAtxP.d.ts} +2 -1
- package/dist/{chunk-KC727YFW.mjs → chunk-6QJ2HF4O.mjs} +1 -1
- package/dist/{chunk-IUOWXGYR.mjs → chunk-AAK2555H.mjs} +4 -4
- package/dist/{chunk-DCL4UC2H.mjs → chunk-EEQGJ6FH.mjs} +1 -1
- package/dist/{chunk-VOLQMQPK.mjs → chunk-IIRJMJFU.mjs} +1 -1
- package/dist/{chunk-43G2QHSV.mjs → chunk-JUC25FB7.mjs} +10 -10
- package/dist/{chunk-UB2DES2O.mjs → chunk-M4JDRFYB.mjs} +8 -6
- package/dist/{chunk-X7IRHSQN.mjs → chunk-RNRHREWH.mjs} +4 -4
- package/dist/{chunk-YFRH22NT.mjs → chunk-TI3KC54Y.mjs} +20 -20
- package/dist/{chunk-QB3US7UE.mjs → chunk-W5I2Z7QS.mjs} +580 -195
- package/dist/{chunk-5N6RK26Z.mjs → chunk-XI7YTBCP.mjs} +1 -1
- package/dist/{chunk-JEDWXGVP.mjs → chunk-ZLSPSBV3.mjs} +1 -1
- package/dist/full-7ABPY2WA.css +311 -0
- package/dist/{full-HZMEMWCN.mjs → full-IHV5BO2L.mjs} +8 -8
- package/dist/{index-BOP2qNVA.d.mts → index-BwLKseT7.d.mts} +1 -1
- package/dist/{index-_G46lHpL.d.ts → index-DkYXZRPz.d.ts} +1 -1
- package/dist/index.css +1268 -1165
- package/dist/index.d.mts +35 -8
- package/dist/index.d.ts +35 -8
- package/dist/index.js +640 -246
- package/dist/index.mjs +15 -15
- package/dist/internal.d.mts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +7 -5
- package/dist/internal.mjs +2 -2
- package/dist/{loaded-35JQLXSA.mjs → loaded-3NPQWYKN.mjs} +5 -5
- package/dist/{loaded-QJMKRN35.mjs → loaded-FTSXIONQ.mjs} +5 -5
- package/dist/loaded-N4KWL7FV.css +90 -0
- package/dist/{loaded-U6ZILQXM.mjs → loaded-YTQOQIUU.mjs} +5 -5
- package/dist/no-external.css +1268 -1165
- package/dist/no-external.d.mts +4 -4
- package/dist/no-external.d.ts +4 -4
- package/dist/no-external.js +640 -246
- package/dist/no-external.mjs +15 -15
- package/dist/rsc.css +40 -40
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +1 -1
- package/dist/rsc.mjs +4 -4
- package/dist/{walk-tree-DxSkPLnl.d.ts → walk-tree-BweEZ37Y.d.ts} +1 -1
- package/dist/{walk-tree-Dwv3c_9M.d.mts → walk-tree-LcQXXDqe.d.mts} +1 -1
- package/package.json +2 -1
- package/dist/Editor-WYZZDKT3.css +0 -415
- package/dist/Render-WBTAN6PO.css +0 -103
- package/dist/full-5442HPZH.css +0 -311
- package/dist/loaded-KZZU4RNL.css +0 -90
- package/dist/{chunk-GAUBBDIR.mjs → chunk-JIXMPJZA.mjs} +37 -37
package/dist/no-external.js
CHANGED
|
@@ -199,7 +199,7 @@ var init_styles_module = __esm({
|
|
|
199
199
|
"use strict";
|
|
200
200
|
init_react_import();
|
|
201
201
|
init_css_module_data();
|
|
202
|
-
styles_module_default = { "ActionBar": "
|
|
202
|
+
styles_module_default = { "ActionBar": "_ActionBar_15hub_1", "ActionBar-label": "_ActionBar-label_15hub_19", "ActionBarAction": "_ActionBarAction_15hub_32", "ActionBar-group": "_ActionBar-group_15hub_40", "ActionBarAction--disabled": "_ActionBarAction--disabled_15hub_75", "ActionBarAction--active": "_ActionBarAction--active_15hub_98", "ActionBar-separator": "_ActionBar-separator_15hub_108" };
|
|
203
203
|
}
|
|
204
204
|
});
|
|
205
205
|
|
|
@@ -1227,7 +1227,7 @@ var init_IconButton_module = __esm({
|
|
|
1227
1227
|
"use strict";
|
|
1228
1228
|
init_react_import();
|
|
1229
1229
|
init_css_module_data2();
|
|
1230
|
-
IconButton_module_default = { "IconButton": "
|
|
1230
|
+
IconButton_module_default = { "IconButton": "_IconButton_3u943_1", "IconButton--active": "_IconButton--active_3u943_15", "IconButton--disabled": "_IconButton--disabled_3u943_26", "IconButton-title": "_IconButton-title_3u943_39" };
|
|
1231
1231
|
}
|
|
1232
1232
|
});
|
|
1233
1233
|
|
|
@@ -1846,12 +1846,14 @@ function insertAction(state, action, appStore) {
|
|
|
1846
1846
|
const componentConfig = appStore.config.components[action.componentType];
|
|
1847
1847
|
const isGlobalType = (componentConfig == null ? void 0 : componentConfig.global) === true;
|
|
1848
1848
|
const defaultProps = (componentConfig == null ? void 0 : componentConfig.defaultProps) || {};
|
|
1849
|
+
const sourceData = action.data ? __spreadProps(__spreadValues({}, action.data), { props: __spreadProps(__spreadValues({}, action.data.props), { id }) }) : __spreadValues({
|
|
1850
|
+
type: action.componentType,
|
|
1851
|
+
props: __spreadProps(__spreadValues({}, defaultProps), { id })
|
|
1852
|
+
}, isGlobalType ? { synced: true } : {});
|
|
1849
1853
|
const emptyComponentData = populateIds(
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
}, isGlobalType ? { synced: true } : {}),
|
|
1854
|
-
appStore.config
|
|
1854
|
+
sourceData,
|
|
1855
|
+
appStore.config,
|
|
1856
|
+
!!action.data
|
|
1855
1857
|
);
|
|
1856
1858
|
const [parentId] = action.destinationZone.split(":");
|
|
1857
1859
|
const idsInPath = getIdsForParent(action.destinationZone, state);
|
|
@@ -3710,7 +3712,7 @@ var init_styles_module3 = __esm({
|
|
|
3710
3712
|
"use strict";
|
|
3711
3713
|
init_react_import();
|
|
3712
3714
|
init_css_module_data4();
|
|
3713
|
-
styles_module_default10 = { "RichTextMenu": "
|
|
3715
|
+
styles_module_default10 = { "RichTextMenu": "_RichTextMenu_1l3cr_1", "RichTextMenu--form": "_RichTextMenu--form_1l3cr_7", "RichTextMenu-group": "_RichTextMenu-group_1l3cr_17", "RichTextMenu--inline": "_RichTextMenu--inline_1l3cr_35" };
|
|
3714
3716
|
}
|
|
3715
3717
|
});
|
|
3716
3718
|
|
|
@@ -3921,7 +3923,7 @@ var init_styles_module5 = __esm({
|
|
|
3921
3923
|
"use strict";
|
|
3922
3924
|
init_react_import();
|
|
3923
3925
|
init_css_module_data6();
|
|
3924
|
-
styles_module_default12 = { "Select": "
|
|
3926
|
+
styles_module_default12 = { "Select": "_Select_1hzg4_1", "Select-button": "_Select-button_1hzg4_6", "Select--hasOptions": "_Select--hasOptions_1hzg4_21", "Select--disabled": "_Select--disabled_1hzg4_25", "Select-buttonIcon": "_Select-buttonIcon_1hzg4_29", "Select--standalone": "_Select--standalone_1hzg4_35", "Select--actionBar": "_Select--actionBar_1hzg4_40", "Select--hasValue": "_Select--hasValue_1hzg4_46", "Select-items": "_Select-items_1hzg4_63", "SelectItem": "_SelectItem_1hzg4_75", "SelectItem--isSelected": "_SelectItem--isSelected_1hzg4_92", "SelectItem-icon": "_SelectItem-icon_1hzg4_98" };
|
|
3925
3927
|
}
|
|
3926
3928
|
});
|
|
3927
3929
|
|
|
@@ -4895,7 +4897,7 @@ var init_styles_module6 = __esm({
|
|
|
4895
4897
|
"use strict";
|
|
4896
4898
|
init_react_import();
|
|
4897
4899
|
init_css_module_data7();
|
|
4898
|
-
styles_module_default13 = { "RichTextEditor": "
|
|
4900
|
+
styles_module_default13 = { "RichTextEditor": "_RichTextEditor_150ed_1", "RichTextEditor--editor": "_RichTextEditor--editor_150ed_50", "RichTextEditor--disabled": "_RichTextEditor--disabled_150ed_109", "RichTextEditor--isActive": "_RichTextEditor--isActive_150ed_113", "RichTextEditor-menu": "_RichTextEditor-menu_150ed_119" };
|
|
4899
4901
|
}
|
|
4900
4902
|
});
|
|
4901
4903
|
|
|
@@ -5449,7 +5451,6 @@ __export(no_external_exports, {
|
|
|
5449
5451
|
Button: () => Button,
|
|
5450
5452
|
ComponentList: () => ComponentList,
|
|
5451
5453
|
Drawer: () => Drawer,
|
|
5452
|
-
DropZone: () => DropZone,
|
|
5453
5454
|
Editor: () => Editor4,
|
|
5454
5455
|
FieldLabel: () => FieldLabel,
|
|
5455
5456
|
Group: () => Group,
|
|
@@ -5473,6 +5474,7 @@ __export(no_external_exports, {
|
|
|
5473
5474
|
transformProps: () => transformProps,
|
|
5474
5475
|
useEditor: () => useEditor2,
|
|
5475
5476
|
useGetEditor: () => useGetEditor,
|
|
5477
|
+
usePropsContext: () => usePropsContext,
|
|
5476
5478
|
walkTree: () => walkTree
|
|
5477
5479
|
});
|
|
5478
5480
|
module.exports = __toCommonJS(no_external_exports);
|
|
@@ -5544,7 +5546,7 @@ init_get_class_name_factory();
|
|
|
5544
5546
|
|
|
5545
5547
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/AutoField/styles.module.css#css-module
|
|
5546
5548
|
init_react_import();
|
|
5547
|
-
var styles_module_default2 = { "InputWrapper": "
|
|
5549
|
+
var styles_module_default2 = { "InputWrapper": "_InputWrapper_1hd99_1", "Input-label": "_Input-label_1hd99_5", "Input-labelIcon": "_Input-labelIcon_1hd99_15", "Input-disabledIcon": "_Input-disabledIcon_1hd99_22", "Input-input": "_Input-input_1hd99_27", "Input": "_Input_1hd99_1", "Input--readOnly": "_Input--readOnly_1hd99_87", "Input-radioGroupItems": "_Input-radioGroupItems_1hd99_98", "Input-radio": "_Input-radio_1hd99_98", "Input-radioInner": "_Input-radioInner_1hd99_115", "Input-radioInput": "_Input-radioInput_1hd99_147" };
|
|
5548
5550
|
|
|
5549
5551
|
// components/AutoField/index.tsx
|
|
5550
5552
|
var import_react48 = require("react");
|
|
@@ -5558,7 +5560,7 @@ init_get_class_name_factory();
|
|
|
5558
5560
|
|
|
5559
5561
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/AutoField/fields/ArrayField/styles.module.css#css-module
|
|
5560
5562
|
init_react_import();
|
|
5561
|
-
var styles_module_default3 = { "ArrayField": "
|
|
5563
|
+
var styles_module_default3 = { "ArrayField": "_ArrayField_1tth0_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1tth0_14", "ArrayField-addButton": "_ArrayField-addButton_1tth0_19", "ArrayField--hasItems": "_ArrayField--hasItems_1tth0_35", "ArrayField-inner": "_ArrayField-inner_1tth0_61", "ArrayFieldItem": "_ArrayFieldItem_1tth0_69", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1tth0_78", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1tth0_82", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1tth0_97", "ArrayFieldItem--noFields": "_ArrayFieldItem--noFields_1tth0_118", "ArrayFieldItem-body": "_ArrayFieldItem-body_1tth0_147", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1tth0_156", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1tth0_164", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1tth0_170" };
|
|
5562
5564
|
|
|
5563
5565
|
// components/AutoField/fields/ArrayField/index.tsx
|
|
5564
5566
|
init_lucide_react();
|
|
@@ -5625,7 +5627,7 @@ init_lib();
|
|
|
5625
5627
|
|
|
5626
5628
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/DragIcon/styles.module.css#css-module
|
|
5627
5629
|
init_react_import();
|
|
5628
|
-
var styles_module_default5 = { "DragIcon": "
|
|
5630
|
+
var styles_module_default5 = { "DragIcon": "_DragIcon_eapcz_1", "DragIcon--disabled": "_DragIcon--disabled_eapcz_8" };
|
|
5629
5631
|
|
|
5630
5632
|
// components/DragIcon/index.tsx
|
|
5631
5633
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
@@ -6672,7 +6674,7 @@ var import_react21 = require("react");
|
|
|
6672
6674
|
|
|
6673
6675
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ExternalInput/styles.module.css#css-module
|
|
6674
6676
|
init_react_import();
|
|
6675
|
-
var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-
|
|
6677
|
+
var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_142hz_1", "ExternalInput-button": "_ExternalInput-button_142hz_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_142hz_25", "ExternalInput--readOnly": "_ExternalInput--readOnly_142hz_32", "ExternalInput-detachButton": "_ExternalInput-detachButton_142hz_36", "ExternalInput": "_ExternalInput_142hz_1", "ExternalInputModal": "_ExternalInputModal_142hz_82", "ExternalInputModal-grid": "_ExternalInputModal-grid_142hz_92", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_142hz_103", "ExternalInputModal-filters": "_ExternalInputModal-filters_142hz_108", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_142hz_127", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_142hz_136", "ExternalInputModal-table": "_ExternalInputModal-table_142hz_136", "ExternalInputModal-thead": "_ExternalInputModal-thead_142hz_152", "ExternalInputModal-th": "_ExternalInputModal-th_142hz_152", "ExternalInputModal-td": "_ExternalInputModal-td_142hz_167", "ExternalInputModal-tr": "_ExternalInputModal-tr_142hz_172", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_142hz_179", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_142hz_205", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_142hz_209", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_142hz_226", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_142hz_230", "ExternalInputModal-search": "_ExternalInputModal-search_142hz_230", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_142hz_267", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_142hz_292", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_142hz_302", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_142hz_316", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_142hz_329", "ExternalInputModal-footerContainer": "_ExternalInputModal-footerContainer_142hz_333", "ExternalInputModal-footer": "_ExternalInputModal-footer_142hz_333", "ExternalInputModal-field": "_ExternalInputModal-field_142hz_346" };
|
|
6676
6678
|
|
|
6677
6679
|
// components/ExternalInput/index.tsx
|
|
6678
6680
|
init_get_class_name_factory();
|
|
@@ -6685,7 +6687,7 @@ init_get_class_name_factory();
|
|
|
6685
6687
|
|
|
6686
6688
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Modal/styles.module.css#css-module
|
|
6687
6689
|
init_react_import();
|
|
6688
|
-
var styles_module_default7 = { "Modal": "
|
|
6690
|
+
var styles_module_default7 = { "Modal": "_Modal_vim19_1", "Modal--isOpen": "_Modal--isOpen_vim19_15", "Modal-inner": "_Modal-inner_vim19_19" };
|
|
6689
6691
|
|
|
6690
6692
|
// components/Modal/index.tsx
|
|
6691
6693
|
var import_react_dom = require("react-dom");
|
|
@@ -6721,7 +6723,7 @@ init_react_import();
|
|
|
6721
6723
|
|
|
6722
6724
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Heading/styles.module.css#css-module
|
|
6723
6725
|
init_react_import();
|
|
6724
|
-
var styles_module_default8 = { "Heading": "
|
|
6726
|
+
var styles_module_default8 = { "Heading": "_Heading_1537i_1", "Heading--xxxxl": "_Heading--xxxxl_1537i_13", "Heading--xxxl": "_Heading--xxxl_1537i_19", "Heading--xxl": "_Heading--xxl_1537i_23", "Heading--xl": "_Heading--xl_1537i_27", "Heading--l": "_Heading--l_1537i_31", "Heading--m": "_Heading--m_1537i_35", "Heading--s": "_Heading--s_1537i_39", "Heading--xs": "_Heading--xs_1537i_43" };
|
|
6725
6727
|
|
|
6726
6728
|
// components/Heading/index.tsx
|
|
6727
6729
|
init_get_class_name_factory();
|
|
@@ -6752,7 +6754,7 @@ var import_react20 = require("react");
|
|
|
6752
6754
|
|
|
6753
6755
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Button/Button.module.css#css-module
|
|
6754
6756
|
init_react_import();
|
|
6755
|
-
var Button_module_default = { "Button": "
|
|
6757
|
+
var Button_module_default = { "Button": "_Button_rj9nn_1", "Button--medium": "_Button--medium_rj9nn_31", "Button--large": "_Button--large_rj9nn_39", "Button-icon": "_Button-icon_rj9nn_46", "Button--primary": "_Button--primary_rj9nn_50", "Button--secondary": "_Button--secondary_rj9nn_71", "Button--flush": "_Button--flush_rj9nn_88", "Button--disabled": "_Button--disabled_rj9nn_92", "Button--fullWidth": "_Button--fullWidth_rj9nn_100", "Button-spinner": "_Button-spinner_rj9nn_105" };
|
|
6756
6758
|
|
|
6757
6759
|
// components/Button/Button.tsx
|
|
6758
6760
|
init_get_class_name_factory();
|
|
@@ -7190,11 +7192,11 @@ init_lib();
|
|
|
7190
7192
|
|
|
7191
7193
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ui/Select/styles.module.css#css-module
|
|
7192
7194
|
init_react_import();
|
|
7193
|
-
var styles_module_default9 = { "
|
|
7195
|
+
var styles_module_default9 = { "EditorSelect-trigger": "_EditorSelect-trigger_13s1k_3", "EditorSelect-triggerIcon": "_EditorSelect-triggerIcon_13s1k_54", "EditorSelect-content": "_EditorSelect-content_13s1k_61", "EditorSelect-viewport": "_EditorSelect-viewport_13s1k_84", "EditorSelect-item": "_EditorSelect-item_13s1k_93", "EditorSelect-itemIndicator": "_EditorSelect-itemIndicator_13s1k_119", "EditorSelect-group": "_EditorSelect-group_13s1k_131", "EditorSelect-label": "_EditorSelect-label_13s1k_135", "EditorSelect-separator": "_EditorSelect-separator_13s1k_144", "EditorSelect-scrollButton": "_EditorSelect-scrollButton_13s1k_152" };
|
|
7194
7196
|
|
|
7195
7197
|
// components/ui/Select/index.tsx
|
|
7196
7198
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
7197
|
-
var getClassName12 = get_class_name_factory_default("
|
|
7199
|
+
var getClassName12 = get_class_name_factory_default("EditorSelect", styles_module_default9);
|
|
7198
7200
|
var joinClassNames = (...values) => values.filter(Boolean).join(" ");
|
|
7199
7201
|
function Select(_a) {
|
|
7200
7202
|
var props = __objRest(_a, []);
|
|
@@ -7482,7 +7484,7 @@ init_get_class_name_factory();
|
|
|
7482
7484
|
|
|
7483
7485
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/AutoField/fields/ObjectField/styles.module.css#css-module
|
|
7484
7486
|
init_react_import();
|
|
7485
|
-
var styles_module_default14 = { "ObjectField": "
|
|
7487
|
+
var styles_module_default14 = { "ObjectField": "_ObjectField_1byjv_5", "ObjectField-fieldset": "_ObjectField-fieldset_1byjv_13" };
|
|
7486
7488
|
|
|
7487
7489
|
// components/AutoField/fields/ObjectField/index.tsx
|
|
7488
7490
|
init_store();
|
|
@@ -7801,7 +7803,7 @@ init_react_import();
|
|
|
7801
7803
|
|
|
7802
7804
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ComponentList/styles.module.css#css-module
|
|
7803
7805
|
init_react_import();
|
|
7804
|
-
var styles_module_default15 = { "ComponentList": "
|
|
7806
|
+
var styles_module_default15 = { "ComponentList": "_ComponentList_1mlcu_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_1mlcu_5", "ComponentList-content": "_ComponentList-content_1mlcu_9", "ComponentList-title": "_ComponentList-title_1mlcu_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_1mlcu_54" };
|
|
7805
7807
|
|
|
7806
7808
|
// components/ComponentList/index.tsx
|
|
7807
7809
|
init_get_class_name_factory();
|
|
@@ -7814,7 +7816,7 @@ init_react_import();
|
|
|
7814
7816
|
|
|
7815
7817
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Drawer/styles.module.css#css-module
|
|
7816
7818
|
init_react_import();
|
|
7817
|
-
var styles_module_default16 = { "Drawer": "
|
|
7819
|
+
var styles_module_default16 = { "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" };
|
|
7818
7820
|
|
|
7819
7821
|
// components/Drawer/index.tsx
|
|
7820
7822
|
init_get_class_name_factory();
|
|
@@ -7838,7 +7840,7 @@ var import_react51 = require("react");
|
|
|
7838
7840
|
|
|
7839
7841
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/DraggableComponent/styles.module.css#css-module
|
|
7840
7842
|
init_react_import();
|
|
7841
|
-
var styles_module_default17 = { "DraggableComponent": "
|
|
7843
|
+
var styles_module_default17 = { "DraggableComponent": "_DraggableComponent_ie0on_1", "DraggableComponent-overlayWrapper": "_DraggableComponent-overlayWrapper_ie0on_12", "DraggableComponent-overlay": "_DraggableComponent-overlay_ie0on_12", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_ie0on_36", "DraggableComponent--hover": "_DraggableComponent--hover_ie0on_53", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_ie0on_60", "DraggableComponent--isGlobal": "_DraggableComponent--isGlobal_ie0on_69", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_ie0on_105", "DraggableComponent-actions": "_DraggableComponent-actions_ie0on_105" };
|
|
7842
7844
|
|
|
7843
7845
|
// components/DraggableComponent/index.tsx
|
|
7844
7846
|
init_get_class_name_factory();
|
|
@@ -8587,7 +8589,7 @@ init_lib();
|
|
|
8587
8589
|
|
|
8588
8590
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/DropZone/styles.module.css#css-module
|
|
8589
8591
|
init_react_import();
|
|
8590
|
-
var styles_module_default18 = { "DropZone": "
|
|
8592
|
+
var styles_module_default18 = { "DropZone": "_DropZone_1h108_1", "DropZone--hasChildren": "_DropZone--hasChildren_1h108_11", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_1h108_24", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_1h108_25", "DropZone--isRootZone": "_DropZone--isRootZone_1h108_25", "DropZone--isDestination": "_DropZone--isDestination_1h108_39", "DropZone-item": "_DropZone-item_1h108_48", "DropZone-hitbox": "_DropZone-hitbox_1h108_52", "DropZone--isEnabled": "_DropZone--isEnabled_1h108_60", "DropZone--isAnimating": "_DropZone--isAnimating_1h108_70" };
|
|
8591
8593
|
|
|
8592
8594
|
// components/DropZone/index.tsx
|
|
8593
8595
|
init_store();
|
|
@@ -11274,7 +11276,7 @@ init_IconButton2();
|
|
|
11274
11276
|
|
|
11275
11277
|
// components/Editor/index.tsx
|
|
11276
11278
|
init_react_import();
|
|
11277
|
-
var
|
|
11279
|
+
var import_react94 = require("react");
|
|
11278
11280
|
init_store();
|
|
11279
11281
|
|
|
11280
11282
|
// components/Editor/components/Fields/index.tsx
|
|
@@ -11285,7 +11287,7 @@ init_store();
|
|
|
11285
11287
|
|
|
11286
11288
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Fields/styles.module.css#css-module
|
|
11287
11289
|
init_react_import();
|
|
11288
|
-
var styles_module_default20 = { "EditorFields": "
|
|
11290
|
+
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" };
|
|
11289
11291
|
|
|
11290
11292
|
// components/Editor/components/Fields/index.tsx
|
|
11291
11293
|
init_lib();
|
|
@@ -11486,7 +11488,7 @@ init_lucide_react();
|
|
|
11486
11488
|
|
|
11487
11489
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Components/styles.module.css#css-module
|
|
11488
11490
|
init_react_import();
|
|
11489
|
-
var styles_module_default21 = { "Components-search": "_Components-
|
|
11491
|
+
var styles_module_default21 = { "Components-search": "_Components-search_recer_1", "Components-searchIcon": "_Components-searchIcon_recer_8", "Components-searchInput": "_Components-searchInput_recer_16", "Components-empty": "_Components-empty_recer_39" };
|
|
11490
11492
|
|
|
11491
11493
|
// components/Editor/components/Components/index.tsx
|
|
11492
11494
|
init_get_class_name_factory();
|
|
@@ -11990,7 +11992,7 @@ init_react_import();
|
|
|
11990
11992
|
|
|
11991
11993
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/LayerTree/styles.module.css#css-module
|
|
11992
11994
|
init_react_import();
|
|
11993
|
-
var styles_module_default23 = { "LayerTree": "
|
|
11995
|
+
var styles_module_default23 = { "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" };
|
|
11994
11996
|
|
|
11995
11997
|
// components/LayerTree/index.tsx
|
|
11996
11998
|
init_get_class_name_factory();
|
|
@@ -12555,8 +12557,134 @@ function resolveDataBySelector(selector, getState, trigger) {
|
|
|
12555
12557
|
});
|
|
12556
12558
|
}
|
|
12557
12559
|
|
|
12560
|
+
// lib/editor-commands.ts
|
|
12561
|
+
init_react_import();
|
|
12562
|
+
init_get_item();
|
|
12563
|
+
init_generate_id();
|
|
12564
|
+
init_root_droppable_id();
|
|
12565
|
+
var parentToZone = (parent) => parent ? `${parent.id}:${parent.slot}` : rootDroppableId;
|
|
12566
|
+
var createEditorCommands = (appStore) => {
|
|
12567
|
+
const { getState } = appStore;
|
|
12568
|
+
const getZoneLength = (zone) => {
|
|
12569
|
+
var _a, _b;
|
|
12570
|
+
return (_b = (_a = getState().state.indexes.zones[zone]) == null ? void 0 : _a.contentIds.length) != null ? _b : 0;
|
|
12571
|
+
};
|
|
12572
|
+
const insertComponent2 = ({
|
|
12573
|
+
type,
|
|
12574
|
+
parent,
|
|
12575
|
+
index,
|
|
12576
|
+
data,
|
|
12577
|
+
select = true
|
|
12578
|
+
}) => {
|
|
12579
|
+
var _a;
|
|
12580
|
+
const id = (_a = data == null ? void 0 : data.props.id) != null ? _a : generateId(type);
|
|
12581
|
+
const zone = parentToZone(parent);
|
|
12582
|
+
const destIndex = index != null ? index : getZoneLength(zone);
|
|
12583
|
+
const dispatch = getState().dispatch;
|
|
12584
|
+
dispatch(__spreadValues({
|
|
12585
|
+
type: "insert",
|
|
12586
|
+
componentType: type,
|
|
12587
|
+
destinationIndex: destIndex,
|
|
12588
|
+
destinationZone: zone,
|
|
12589
|
+
id
|
|
12590
|
+
}, data ? { data: __spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { id }) }) } : {}));
|
|
12591
|
+
if (select) {
|
|
12592
|
+
dispatch({
|
|
12593
|
+
type: "setUi",
|
|
12594
|
+
ui: { itemSelector: { index: destIndex, zone } }
|
|
12595
|
+
});
|
|
12596
|
+
}
|
|
12597
|
+
return { id };
|
|
12598
|
+
};
|
|
12599
|
+
const removeComponent = (id) => {
|
|
12600
|
+
const sel = getSelectorForId(getState().state, id);
|
|
12601
|
+
if (!(sel == null ? void 0 : sel.zone)) return;
|
|
12602
|
+
getState().dispatch({ type: "remove", index: sel.index, zone: sel.zone });
|
|
12603
|
+
};
|
|
12604
|
+
const duplicateComponent = (id) => {
|
|
12605
|
+
const sel = getSelectorForId(getState().state, id);
|
|
12606
|
+
if (!(sel == null ? void 0 : sel.zone)) return;
|
|
12607
|
+
getState().dispatch({
|
|
12608
|
+
type: "duplicate",
|
|
12609
|
+
sourceIndex: sel.index,
|
|
12610
|
+
sourceZone: sel.zone
|
|
12611
|
+
});
|
|
12612
|
+
};
|
|
12613
|
+
const moveComponent2 = (id, to) => {
|
|
12614
|
+
const sel = getSelectorForId(getState().state, id);
|
|
12615
|
+
if (!(sel == null ? void 0 : sel.zone)) return;
|
|
12616
|
+
getState().dispatch({
|
|
12617
|
+
type: "move",
|
|
12618
|
+
sourceIndex: sel.index,
|
|
12619
|
+
sourceZone: sel.zone,
|
|
12620
|
+
destinationIndex: to.index,
|
|
12621
|
+
destinationZone: parentToZone(to.parent)
|
|
12622
|
+
});
|
|
12623
|
+
};
|
|
12624
|
+
const replaceComponent = (id, data) => {
|
|
12625
|
+
const sel = getSelectorForId(getState().state, id);
|
|
12626
|
+
if (!(sel == null ? void 0 : sel.zone)) return;
|
|
12627
|
+
const existing = getItem(sel, getState().state);
|
|
12628
|
+
if (!existing) return;
|
|
12629
|
+
getState().dispatch({
|
|
12630
|
+
type: "replace",
|
|
12631
|
+
destinationIndex: sel.index,
|
|
12632
|
+
destinationZone: sel.zone,
|
|
12633
|
+
data: __spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { id: existing.props.id }) })
|
|
12634
|
+
});
|
|
12635
|
+
};
|
|
12636
|
+
const updateProps = (id, updater) => {
|
|
12637
|
+
const sel = getSelectorForId(getState().state, id);
|
|
12638
|
+
if (!sel) return;
|
|
12639
|
+
const existing = getItem(sel, getState().state);
|
|
12640
|
+
if (!existing) return;
|
|
12641
|
+
const patch = typeof updater === "function" ? updater(existing.props) : updater;
|
|
12642
|
+
getState().dispatch({
|
|
12643
|
+
type: "replace",
|
|
12644
|
+
destinationIndex: sel.index,
|
|
12645
|
+
destinationZone: sel.zone,
|
|
12646
|
+
data: __spreadProps(__spreadValues({}, existing), {
|
|
12647
|
+
props: __spreadProps(__spreadValues(__spreadValues({}, existing.props), patch), { id: existing.props.id })
|
|
12648
|
+
})
|
|
12649
|
+
});
|
|
12650
|
+
};
|
|
12651
|
+
const updateRoot = (updater) => {
|
|
12652
|
+
var _a, _b;
|
|
12653
|
+
const root = (_a = getState().state.data.root) != null ? _a : { props: {} };
|
|
12654
|
+
const prevProps = (_b = root.props) != null ? _b : {};
|
|
12655
|
+
const patch = typeof updater === "function" ? updater(prevProps) : updater;
|
|
12656
|
+
getState().dispatch({
|
|
12657
|
+
type: "replaceRoot",
|
|
12658
|
+
root: __spreadProps(__spreadValues({}, root), { props: __spreadValues(__spreadValues({}, prevProps), patch) })
|
|
12659
|
+
});
|
|
12660
|
+
};
|
|
12661
|
+
const selectComponent = (id) => {
|
|
12662
|
+
const dispatch = getState().dispatch;
|
|
12663
|
+
if (id === null) {
|
|
12664
|
+
dispatch({ type: "setUi", ui: { itemSelector: null } });
|
|
12665
|
+
return;
|
|
12666
|
+
}
|
|
12667
|
+
const sel = getSelectorForId(getState().state, id);
|
|
12668
|
+
if (!(sel == null ? void 0 : sel.zone)) return;
|
|
12669
|
+
dispatch({
|
|
12670
|
+
type: "setUi",
|
|
12671
|
+
ui: { itemSelector: { index: sel.index, zone: sel.zone } }
|
|
12672
|
+
});
|
|
12673
|
+
};
|
|
12674
|
+
return {
|
|
12675
|
+
insertComponent: insertComponent2,
|
|
12676
|
+
removeComponent,
|
|
12677
|
+
duplicateComponent,
|
|
12678
|
+
moveComponent: moveComponent2,
|
|
12679
|
+
replaceComponent,
|
|
12680
|
+
updateProps,
|
|
12681
|
+
updateRoot,
|
|
12682
|
+
selectComponent
|
|
12683
|
+
};
|
|
12684
|
+
};
|
|
12685
|
+
|
|
12558
12686
|
// lib/use-editor.ts
|
|
12559
|
-
var generateUseEditor = (store, getState) => {
|
|
12687
|
+
var generateUseEditor = (store, getState, commands) => {
|
|
12560
12688
|
const history = {
|
|
12561
12689
|
back: store.history.back,
|
|
12562
12690
|
forward: store.history.forward,
|
|
@@ -12567,7 +12695,7 @@ var generateUseEditor = (store, getState) => {
|
|
|
12567
12695
|
histories: store.history.histories,
|
|
12568
12696
|
index: store.history.index
|
|
12569
12697
|
};
|
|
12570
|
-
const storeData = {
|
|
12698
|
+
const storeData = __spreadProps(__spreadValues({}, commands), {
|
|
12571
12699
|
appState: makeStatePublic(store.state),
|
|
12572
12700
|
config: store.config,
|
|
12573
12701
|
dispatch: store.dispatch,
|
|
@@ -12588,7 +12716,7 @@ var generateUseEditor = (store, getState) => {
|
|
|
12588
12716
|
if (!parentNode) return;
|
|
12589
12717
|
return parentNode.data;
|
|
12590
12718
|
}
|
|
12591
|
-
};
|
|
12719
|
+
});
|
|
12592
12720
|
storeData.__private = {
|
|
12593
12721
|
appState: store.state
|
|
12594
12722
|
};
|
|
@@ -12608,11 +12736,13 @@ var convertToPickedStore = (store) => {
|
|
|
12608
12736
|
};
|
|
12609
12737
|
};
|
|
12610
12738
|
var useRegisterUseEditorStore = (appStore) => {
|
|
12739
|
+
const [commands] = (0, import_react81.useState)(() => createEditorCommands(appStore));
|
|
12611
12740
|
const [useEditorStore] = (0, import_react81.useState)(
|
|
12612
12741
|
() => (0, import_zustand7.createStore)(
|
|
12613
12742
|
() => generateUseEditor(
|
|
12614
12743
|
convertToPickedStore(appStore.getState()),
|
|
12615
|
-
appStore.getState
|
|
12744
|
+
appStore.getState,
|
|
12745
|
+
commands
|
|
12616
12746
|
)
|
|
12617
12747
|
)
|
|
12618
12748
|
);
|
|
@@ -12620,10 +12750,12 @@ var useRegisterUseEditorStore = (appStore) => {
|
|
|
12620
12750
|
return appStore.subscribe(
|
|
12621
12751
|
(store) => convertToPickedStore(store),
|
|
12622
12752
|
(pickedStore) => {
|
|
12623
|
-
useEditorStore.setState(
|
|
12753
|
+
useEditorStore.setState(
|
|
12754
|
+
generateUseEditor(pickedStore, appStore.getState, commands)
|
|
12755
|
+
);
|
|
12624
12756
|
}
|
|
12625
12757
|
);
|
|
12626
|
-
}, []);
|
|
12758
|
+
}, [commands]);
|
|
12627
12759
|
return useEditorStore;
|
|
12628
12760
|
};
|
|
12629
12761
|
function createUseEditor() {
|
|
@@ -12708,12 +12840,12 @@ init_to_component();
|
|
|
12708
12840
|
|
|
12709
12841
|
// components/Editor/components/Layout/index.tsx
|
|
12710
12842
|
init_react_import();
|
|
12711
|
-
var
|
|
12843
|
+
var import_react93 = require("react");
|
|
12712
12844
|
init_lib();
|
|
12713
12845
|
|
|
12714
12846
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Layout/styles.module.css#css-module
|
|
12715
12847
|
init_react_import();
|
|
12716
|
-
var styles_module_default24 = { "Editor": "
|
|
12848
|
+
var styles_module_default24 = { "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" };
|
|
12717
12849
|
|
|
12718
12850
|
// lib/use-inject-css.ts
|
|
12719
12851
|
init_react_import();
|
|
@@ -12778,7 +12910,7 @@ init_react_import();
|
|
|
12778
12910
|
|
|
12779
12911
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/SidebarSection/styles.module.css#css-module
|
|
12780
12912
|
init_react_import();
|
|
12781
|
-
var styles_module_default25 = { "SidebarSection": "
|
|
12913
|
+
var styles_module_default25 = { "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" };
|
|
12782
12914
|
|
|
12783
12915
|
// components/SidebarSection/index.tsx
|
|
12784
12916
|
init_get_class_name_factory();
|
|
@@ -12789,7 +12921,7 @@ init_react_import();
|
|
|
12789
12921
|
|
|
12790
12922
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Breadcrumbs/styles.module.css#css-module
|
|
12791
12923
|
init_react_import();
|
|
12792
|
-
var styles_module_default26 = { "Breadcrumbs": "
|
|
12924
|
+
var styles_module_default26 = { "Breadcrumbs": "_Breadcrumbs_1cjxk_1", "Breadcrumbs-breadcrumb": "_Breadcrumbs-breadcrumb_1cjxk_10", "Breadcrumbs-breadcrumbLabel": "_Breadcrumbs-breadcrumbLabel_1cjxk_17" };
|
|
12793
12925
|
|
|
12794
12926
|
// components/Breadcrumbs/index.tsx
|
|
12795
12927
|
init_get_class_name_factory();
|
|
@@ -12891,25 +13023,152 @@ var SidebarSection = ({
|
|
|
12891
13023
|
// components/Editor/components/Canvas/index.tsx
|
|
12892
13024
|
init_react_import();
|
|
12893
13025
|
init_css_box_model_esm();
|
|
12894
|
-
var
|
|
13026
|
+
var import_react88 = require("react");
|
|
12895
13027
|
init_lucide_react();
|
|
12896
13028
|
init_store();
|
|
12897
13029
|
|
|
12898
13030
|
// components/BrowserBar/index.tsx
|
|
12899
13031
|
init_react_import();
|
|
12900
13032
|
init_lucide_react();
|
|
12901
|
-
var
|
|
13033
|
+
var import_react86 = require("react");
|
|
12902
13034
|
init_store();
|
|
12903
13035
|
init_lib();
|
|
12904
13036
|
init_IconButton2();
|
|
12905
13037
|
|
|
13038
|
+
// components/ui/Combobox/index.tsx
|
|
13039
|
+
init_react_import();
|
|
13040
|
+
var import_react85 = require("@base-ui/react");
|
|
13041
|
+
init_lucide_react();
|
|
13042
|
+
init_lib();
|
|
13043
|
+
|
|
13044
|
+
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ui/Combobox/styles.module.css#css-module
|
|
13045
|
+
init_react_import();
|
|
13046
|
+
var styles_module_default27 = { "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" };
|
|
13047
|
+
|
|
13048
|
+
// components/ui/Combobox/index.tsx
|
|
13049
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
13050
|
+
var getClassName34 = get_class_name_factory_default("EditorCombobox", styles_module_default27);
|
|
13051
|
+
var join = (...values) => values.filter(Boolean).join(" ");
|
|
13052
|
+
var mergeClassName = (base, override) => {
|
|
13053
|
+
if (!override) return base;
|
|
13054
|
+
if (typeof override === "function") {
|
|
13055
|
+
return (state) => join(base, override(state));
|
|
13056
|
+
}
|
|
13057
|
+
return join(base, override);
|
|
13058
|
+
};
|
|
13059
|
+
var Combobox = import_react85.Combobox.Root;
|
|
13060
|
+
function ComboboxInput(_a) {
|
|
13061
|
+
var _b = _a, {
|
|
13062
|
+
className
|
|
13063
|
+
} = _b, props = __objRest(_b, [
|
|
13064
|
+
"className"
|
|
13065
|
+
]);
|
|
13066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
13067
|
+
import_react85.Combobox.Input,
|
|
13068
|
+
__spreadValues({
|
|
13069
|
+
"data-slot": "combobox-input",
|
|
13070
|
+
className: mergeClassName(getClassName34("input"), className)
|
|
13071
|
+
}, props)
|
|
13072
|
+
);
|
|
13073
|
+
}
|
|
13074
|
+
function ComboboxContent(_a) {
|
|
13075
|
+
var _b = _a, {
|
|
13076
|
+
className,
|
|
13077
|
+
side = "bottom",
|
|
13078
|
+
sideOffset = 4,
|
|
13079
|
+
align = "start",
|
|
13080
|
+
alignOffset = 0,
|
|
13081
|
+
children
|
|
13082
|
+
} = _b, props = __objRest(_b, [
|
|
13083
|
+
"className",
|
|
13084
|
+
"side",
|
|
13085
|
+
"sideOffset",
|
|
13086
|
+
"align",
|
|
13087
|
+
"alignOffset",
|
|
13088
|
+
"children"
|
|
13089
|
+
]);
|
|
13090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react85.Combobox.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
13091
|
+
import_react85.Combobox.Positioner,
|
|
13092
|
+
{
|
|
13093
|
+
side,
|
|
13094
|
+
sideOffset,
|
|
13095
|
+
align,
|
|
13096
|
+
alignOffset,
|
|
13097
|
+
className: getClassName34("positioner"),
|
|
13098
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
13099
|
+
import_react85.Combobox.Popup,
|
|
13100
|
+
__spreadProps(__spreadValues({
|
|
13101
|
+
"data-slot": "combobox-content",
|
|
13102
|
+
className: mergeClassName(getClassName34("content"), className)
|
|
13103
|
+
}, props), {
|
|
13104
|
+
children
|
|
13105
|
+
})
|
|
13106
|
+
)
|
|
13107
|
+
}
|
|
13108
|
+
) });
|
|
13109
|
+
}
|
|
13110
|
+
function ComboboxList(_a) {
|
|
13111
|
+
var _b = _a, {
|
|
13112
|
+
className
|
|
13113
|
+
} = _b, props = __objRest(_b, [
|
|
13114
|
+
"className"
|
|
13115
|
+
]);
|
|
13116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
13117
|
+
import_react85.Combobox.List,
|
|
13118
|
+
__spreadValues({
|
|
13119
|
+
"data-slot": "combobox-list",
|
|
13120
|
+
className: mergeClassName(getClassName34("list"), className)
|
|
13121
|
+
}, props)
|
|
13122
|
+
);
|
|
13123
|
+
}
|
|
13124
|
+
function ComboboxItem(_a) {
|
|
13125
|
+
var _b = _a, {
|
|
13126
|
+
className,
|
|
13127
|
+
children
|
|
13128
|
+
} = _b, props = __objRest(_b, [
|
|
13129
|
+
"className",
|
|
13130
|
+
"children"
|
|
13131
|
+
]);
|
|
13132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
13133
|
+
import_react85.Combobox.Item,
|
|
13134
|
+
__spreadProps(__spreadValues({
|
|
13135
|
+
"data-slot": "combobox-item",
|
|
13136
|
+
className: mergeClassName(getClassName34("item"), className)
|
|
13137
|
+
}, props), {
|
|
13138
|
+
children: [
|
|
13139
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: getClassName34("itemIndicator"), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react85.Combobox.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Check, { size: 14 }) }) }),
|
|
13140
|
+
children
|
|
13141
|
+
]
|
|
13142
|
+
})
|
|
13143
|
+
);
|
|
13144
|
+
}
|
|
13145
|
+
function ComboboxEmpty(_a) {
|
|
13146
|
+
var _b = _a, {
|
|
13147
|
+
className
|
|
13148
|
+
} = _b, props = __objRest(_b, [
|
|
13149
|
+
"className"
|
|
13150
|
+
]);
|
|
13151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
13152
|
+
import_react85.Combobox.Empty,
|
|
13153
|
+
__spreadValues({
|
|
13154
|
+
"data-slot": "combobox-empty",
|
|
13155
|
+
className: mergeClassName(getClassName34("empty"), className)
|
|
13156
|
+
}, props)
|
|
13157
|
+
);
|
|
13158
|
+
}
|
|
13159
|
+
|
|
12906
13160
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/BrowserBar/styles.module.css#css-module
|
|
12907
13161
|
init_react_import();
|
|
12908
|
-
var
|
|
13162
|
+
var styles_module_default28 = { "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" };
|
|
12909
13163
|
|
|
12910
13164
|
// components/BrowserBar/index.tsx
|
|
12911
|
-
var
|
|
12912
|
-
var
|
|
13165
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
13166
|
+
var normalizeRoute = (raw) => {
|
|
13167
|
+
const trimmed = raw.trim();
|
|
13168
|
+
if (!trimmed) return trimmed;
|
|
13169
|
+
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
13170
|
+
};
|
|
13171
|
+
var getClassName35 = get_class_name_factory_default("BrowserBar", styles_module_default28);
|
|
12913
13172
|
var DEVICE_VIEWPORTS = {
|
|
12914
13173
|
desktop: { width: "100%", height: "auto", icon: "Monitor", label: "Desktop" },
|
|
12915
13174
|
mobile: { width: 360, height: "auto", icon: "Smartphone", label: "Mobile" }
|
|
@@ -12917,7 +13176,6 @@ var DEVICE_VIEWPORTS = {
|
|
|
12917
13176
|
var BrowserBar = ({
|
|
12918
13177
|
onViewportChange
|
|
12919
13178
|
}) => {
|
|
12920
|
-
var _a;
|
|
12921
13179
|
const { routes, currentPath, onRouteChange } = usePropsContext();
|
|
12922
13180
|
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
12923
13181
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
@@ -12936,7 +13194,7 @@ var BrowserBar = ({
|
|
|
12936
13194
|
}
|
|
12937
13195
|
});
|
|
12938
13196
|
};
|
|
12939
|
-
const activeDevice = (0,
|
|
13197
|
+
const activeDevice = (0, import_react86.useMemo)(() => {
|
|
12940
13198
|
const w = viewports.current.width;
|
|
12941
13199
|
if (typeof w === "number" && w <= 640) return "mobile";
|
|
12942
13200
|
return "desktop";
|
|
@@ -12945,50 +13203,86 @@ var BrowserBar = ({
|
|
|
12945
13203
|
onViewportChange == null ? void 0 : onViewportChange(DEVICE_VIEWPORTS[device]);
|
|
12946
13204
|
};
|
|
12947
13205
|
const showRoutePicker = !!routes && currentPath !== void 0 && !!onRouteChange;
|
|
12948
|
-
const
|
|
12949
|
-
|
|
12950
|
-
|
|
12951
|
-
|
|
13206
|
+
const [inputValue, setInputValue] = (0, import_react86.useState)(currentPath != null ? currentPath : "");
|
|
13207
|
+
const lastSyncedPath = (0, import_react86.useRef)(currentPath);
|
|
13208
|
+
if (lastSyncedPath.current !== currentPath) {
|
|
13209
|
+
lastSyncedPath.current = currentPath;
|
|
13210
|
+
setInputValue(currentPath != null ? currentPath : "");
|
|
13211
|
+
}
|
|
13212
|
+
const submit = (raw) => {
|
|
13213
|
+
const next = normalizeRoute(raw);
|
|
13214
|
+
if (!next || next === currentPath) return;
|
|
13215
|
+
void (onRouteChange == null ? void 0 : onRouteChange(next));
|
|
13216
|
+
};
|
|
13217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: getClassName35(), children: [
|
|
13218
|
+
showRoutePicker ? /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
13219
|
+
Combobox,
|
|
12952
13220
|
{
|
|
13221
|
+
items: routes.map((r) => r.path),
|
|
12953
13222
|
value: currentPath,
|
|
12954
13223
|
onValueChange: (next) => {
|
|
12955
|
-
|
|
13224
|
+
if (typeof next === "string") submit(next);
|
|
12956
13225
|
},
|
|
13226
|
+
inputValue,
|
|
13227
|
+
onInputValueChange: (next) => setInputValue(next),
|
|
13228
|
+
autoHighlight: false,
|
|
12957
13229
|
children: [
|
|
12958
|
-
/* @__PURE__ */ (0,
|
|
12959
|
-
|
|
12960
|
-
|
|
12961
|
-
|
|
12962
|
-
|
|
12963
|
-
|
|
12964
|
-
|
|
12965
|
-
|
|
12966
|
-
|
|
12967
|
-
|
|
13230
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
13231
|
+
"form",
|
|
13232
|
+
{
|
|
13233
|
+
className: getClassName35("urlTrigger"),
|
|
13234
|
+
onSubmit: (event) => {
|
|
13235
|
+
event.preventDefault();
|
|
13236
|
+
submit(inputValue);
|
|
13237
|
+
},
|
|
13238
|
+
children: [
|
|
13239
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Globe, { className: getClassName35("urlIcon"), size: 14 }),
|
|
13240
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
13241
|
+
ComboboxInput,
|
|
13242
|
+
{
|
|
13243
|
+
className: getClassName35("urlInput"),
|
|
13244
|
+
placeholder: "/",
|
|
13245
|
+
spellCheck: false,
|
|
13246
|
+
autoCorrect: "off",
|
|
13247
|
+
autoCapitalize: "off"
|
|
13248
|
+
}
|
|
13249
|
+
)
|
|
13250
|
+
]
|
|
13251
|
+
}
|
|
13252
|
+
),
|
|
13253
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(ComboboxContent, { children: [
|
|
13254
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ComboboxEmpty, { children: "Press Enter to go to this path" }),
|
|
13255
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ComboboxList, { children: (path) => {
|
|
13256
|
+
const route = routes.find((r) => r.path === path);
|
|
13257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(ComboboxItem, { value: path, children: [
|
|
13258
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: getClassName35("itemPath"), children: path }),
|
|
13259
|
+
(route == null ? void 0 : route.title) ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: getClassName35("itemTitle"), children: route.title }) : null
|
|
13260
|
+
] }, path);
|
|
13261
|
+
} })
|
|
12968
13262
|
] })
|
|
12969
13263
|
]
|
|
12970
13264
|
}
|
|
12971
|
-
) : /* @__PURE__ */ (0,
|
|
12972
|
-
/* @__PURE__ */ (0,
|
|
12973
|
-
/* @__PURE__ */ (0,
|
|
13265
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: getClassName35("urlTrigger"), children: [
|
|
13266
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Globe, { className: getClassName35("urlIcon"), size: 14 }),
|
|
13267
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: getClassName35("urlText"), children: "/" })
|
|
12974
13268
|
] }),
|
|
12975
|
-
/* @__PURE__ */ (0,
|
|
12976
|
-
/* @__PURE__ */ (0,
|
|
13269
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: getClassName35("actions"), children: [
|
|
13270
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
12977
13271
|
IconButton,
|
|
12978
13272
|
{
|
|
12979
13273
|
type: "button",
|
|
12980
13274
|
title: activeDevice === "desktop" ? "Switch to mobile viewport" : "Switch to desktop viewport",
|
|
12981
13275
|
onClick: () => setDevice(activeDevice === "desktop" ? "mobile" : "desktop"),
|
|
12982
|
-
children: /* @__PURE__ */ (0,
|
|
13276
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: getClassName35("deviceIcon"), children: activeDevice === "desktop" ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Monitor, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Smartphone, { size: 16 }) })
|
|
12983
13277
|
}
|
|
12984
13278
|
),
|
|
12985
|
-
/* @__PURE__ */ (0,
|
|
13279
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
12986
13280
|
IconButton,
|
|
12987
13281
|
{
|
|
12988
13282
|
type: "button",
|
|
12989
13283
|
title: isFullScreen ? "Exit full screen" : "Enter full screen",
|
|
12990
13284
|
onClick: toggleFullScreen,
|
|
12991
|
-
children: /* @__PURE__ */ (0,
|
|
13285
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: getClassName35("deviceIcon"), children: isFullScreen ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Minimize, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(Maximize, { size: 16 }) })
|
|
12992
13286
|
}
|
|
12993
13287
|
)
|
|
12994
13288
|
] })
|
|
@@ -12997,7 +13291,7 @@ var BrowserBar = ({
|
|
|
12997
13291
|
|
|
12998
13292
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Canvas/styles.module.css#css-module
|
|
12999
13293
|
init_react_import();
|
|
13000
|
-
var
|
|
13294
|
+
var styles_module_default29 = { "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" };
|
|
13001
13295
|
|
|
13002
13296
|
// components/Editor/components/Canvas/index.tsx
|
|
13003
13297
|
init_lib();
|
|
@@ -13007,23 +13301,23 @@ var import_shallow9 = require("zustand/react/shallow");
|
|
|
13007
13301
|
|
|
13008
13302
|
// lib/frame-context.tsx
|
|
13009
13303
|
init_react_import();
|
|
13010
|
-
var
|
|
13011
|
-
var
|
|
13012
|
-
var FrameContext = (0,
|
|
13304
|
+
var import_react87 = require("react");
|
|
13305
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
13306
|
+
var FrameContext = (0, import_react87.createContext)(null);
|
|
13013
13307
|
var FrameProvider = ({
|
|
13014
13308
|
children
|
|
13015
13309
|
}) => {
|
|
13016
|
-
const frameRef = (0,
|
|
13017
|
-
const value = (0,
|
|
13310
|
+
const frameRef = (0, import_react87.useRef)(null);
|
|
13311
|
+
const value = (0, import_react87.useMemo)(
|
|
13018
13312
|
() => ({
|
|
13019
13313
|
frameRef
|
|
13020
13314
|
}),
|
|
13021
13315
|
[]
|
|
13022
13316
|
);
|
|
13023
|
-
return /* @__PURE__ */ (0,
|
|
13317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(FrameContext.Provider, { value, children });
|
|
13024
13318
|
};
|
|
13025
13319
|
var useCanvasFrame = () => {
|
|
13026
|
-
const context = (0,
|
|
13320
|
+
const context = (0, import_react87.useContext)(FrameContext);
|
|
13027
13321
|
if (context === null) {
|
|
13028
13322
|
throw new Error("useCanvasFrame must be used within a FrameProvider");
|
|
13029
13323
|
}
|
|
@@ -13032,8 +13326,8 @@ var useCanvasFrame = () => {
|
|
|
13032
13326
|
|
|
13033
13327
|
// components/Editor/components/Canvas/index.tsx
|
|
13034
13328
|
init_default_viewports();
|
|
13035
|
-
var
|
|
13036
|
-
var
|
|
13329
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
13330
|
+
var getClassName36 = get_class_name_factory_default("EditorCanvas", styles_module_default29);
|
|
13037
13331
|
var ZOOM_STEP = 0.15;
|
|
13038
13332
|
var MIN_ZOOM = 0.25;
|
|
13039
13333
|
var MAX_ZOOM = 3;
|
|
@@ -13068,21 +13362,21 @@ var Canvas = () => {
|
|
|
13068
13362
|
}))
|
|
13069
13363
|
);
|
|
13070
13364
|
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
13071
|
-
const [canvasZoom, setCanvasZoom] = (0,
|
|
13365
|
+
const [canvasZoom, setCanvasZoom] = (0, import_react88.useState)(1);
|
|
13072
13366
|
const zoomIn = () => setCanvasZoom((z) => Math.min(z + ZOOM_STEP, MAX_ZOOM));
|
|
13073
13367
|
const zoomOut = () => setCanvasZoom((z) => Math.max(z - ZOOM_STEP, MIN_ZOOM));
|
|
13074
13368
|
const resetZoom = () => setCanvasZoom(1);
|
|
13075
|
-
const [showTransition, setShowTransition] = (0,
|
|
13076
|
-
const isResizingRef = (0,
|
|
13077
|
-
const defaultRender = (0,
|
|
13078
|
-
const EditorDefault = ({ children }) => /* @__PURE__ */ (0,
|
|
13369
|
+
const [showTransition, setShowTransition] = (0, import_react88.useState)(false);
|
|
13370
|
+
const isResizingRef = (0, import_react88.useRef)(false);
|
|
13371
|
+
const defaultRender = (0, import_react88.useMemo)(() => {
|
|
13372
|
+
const EditorDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_jsx_runtime85.Fragment, { children });
|
|
13079
13373
|
return EditorDefault;
|
|
13080
13374
|
}, []);
|
|
13081
|
-
const CustomPreview = (0,
|
|
13375
|
+
const CustomPreview = (0, import_react88.useMemo)(
|
|
13082
13376
|
() => overrides.preview || defaultRender,
|
|
13083
13377
|
[overrides]
|
|
13084
13378
|
);
|
|
13085
|
-
const getFrameDimensions = (0,
|
|
13379
|
+
const getFrameDimensions = (0, import_react88.useCallback)(() => {
|
|
13086
13380
|
if (frameRef.current) {
|
|
13087
13381
|
const frame = frameRef.current;
|
|
13088
13382
|
const box = getBox(frame);
|
|
@@ -13090,21 +13384,21 @@ var Canvas = () => {
|
|
|
13090
13384
|
}
|
|
13091
13385
|
return { width: 0, height: 0 };
|
|
13092
13386
|
}, [frameRef]);
|
|
13093
|
-
(0,
|
|
13387
|
+
(0, import_react88.useEffect)(() => {
|
|
13094
13388
|
const { height: frameHeight } = getFrameDimensions();
|
|
13095
13389
|
if (viewports.current.height === "auto") {
|
|
13096
13390
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), { zoom: 1, rootHeight: frameHeight }));
|
|
13097
13391
|
}
|
|
13098
13392
|
}, [getFrameDimensions, setZoomConfig, viewports.current.height]);
|
|
13099
|
-
const [showLoader, setShowLoader] = (0,
|
|
13100
|
-
(0,
|
|
13393
|
+
const [showLoader, setShowLoader] = (0, import_react88.useState)(false);
|
|
13394
|
+
(0, import_react88.useEffect)(() => {
|
|
13101
13395
|
setTimeout(() => {
|
|
13102
13396
|
setShowLoader(true);
|
|
13103
13397
|
}, 500);
|
|
13104
13398
|
}, []);
|
|
13105
13399
|
const appStoreApi = useAppStoreApi();
|
|
13106
|
-
const autoSelectingRef = (0,
|
|
13107
|
-
const pickClosestViewport = (0,
|
|
13400
|
+
const autoSelectingRef = (0, import_react88.useRef)(true);
|
|
13401
|
+
const pickClosestViewport = (0, import_react88.useCallback)(() => {
|
|
13108
13402
|
var _a2, _b2;
|
|
13109
13403
|
if (typeof window === "undefined") return null;
|
|
13110
13404
|
const viewportWidth = window.innerWidth;
|
|
@@ -13129,7 +13423,7 @@ var Canvas = () => {
|
|
|
13129
13423
|
}
|
|
13130
13424
|
return closestViewport;
|
|
13131
13425
|
}, [viewportOptions, frameRef]);
|
|
13132
|
-
(0,
|
|
13426
|
+
(0, import_react88.useEffect)(() => {
|
|
13133
13427
|
var _a2;
|
|
13134
13428
|
if (typeof window === "undefined") return;
|
|
13135
13429
|
if ((_a2 = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _a2.current) return;
|
|
@@ -13162,7 +13456,7 @@ var Canvas = () => {
|
|
|
13162
13456
|
appStoreApi,
|
|
13163
13457
|
(_a = uiProp == null ? void 0 : uiProp.viewports) == null ? void 0 : _a.current
|
|
13164
13458
|
]);
|
|
13165
|
-
(0,
|
|
13459
|
+
(0, import_react88.useEffect)(() => {
|
|
13166
13460
|
var _a2;
|
|
13167
13461
|
if (typeof window === "undefined") return;
|
|
13168
13462
|
if (!iframe.enabled) return;
|
|
@@ -13197,10 +13491,10 @@ var Canvas = () => {
|
|
|
13197
13491
|
appStoreApi,
|
|
13198
13492
|
setUi
|
|
13199
13493
|
]);
|
|
13200
|
-
return /* @__PURE__ */ (0,
|
|
13494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
13201
13495
|
"div",
|
|
13202
13496
|
{
|
|
13203
|
-
className:
|
|
13497
|
+
className: getClassName36({
|
|
13204
13498
|
ready: status === "READY" || !iframe.enabled || !iframe.waitForStyles,
|
|
13205
13499
|
showLoader,
|
|
13206
13500
|
fullScreen: fullScreenCanvas
|
|
@@ -13215,16 +13509,16 @@ var Canvas = () => {
|
|
|
13215
13509
|
});
|
|
13216
13510
|
}
|
|
13217
13511
|
},
|
|
13218
|
-
children: /* @__PURE__ */ (0,
|
|
13219
|
-
!disableZoomControls && /* @__PURE__ */ (0,
|
|
13220
|
-
/* @__PURE__ */ (0,
|
|
13221
|
-
/* @__PURE__ */ (0,
|
|
13222
|
-
/* @__PURE__ */ (0,
|
|
13512
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: getClassName36("inner"), ref: frameRef, children: [
|
|
13513
|
+
!disableZoomControls && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: getClassName36("zoomControls"), children: [
|
|
13514
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(IconButton, { type: "button", title: "Zoom out", onClick: zoomOut, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Minus, { size: 14 }) }),
|
|
13515
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(IconButton, { type: "button", title: "Reset zoom", onClick: resetZoom, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(RotateCcw, { size: 14 }) }),
|
|
13516
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(IconButton, { type: "button", title: "Zoom in", onClick: zoomIn, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Plus, { size: 14 }) })
|
|
13223
13517
|
] }),
|
|
13224
|
-
/* @__PURE__ */ (0,
|
|
13518
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
13225
13519
|
"div",
|
|
13226
13520
|
{
|
|
13227
|
-
className:
|
|
13521
|
+
className: getClassName36("rootColumn"),
|
|
13228
13522
|
style: {
|
|
13229
13523
|
width: iframe.enabled ? viewports.current.width : "100%",
|
|
13230
13524
|
transform: disableZoomControls ? void 0 : `scale(${canvasZoom})`,
|
|
@@ -13232,7 +13526,7 @@ var Canvas = () => {
|
|
|
13232
13526
|
transition: showTransition ? `width ${TRANSITION_DURATION}ms ease-out, transform ${TRANSITION_DURATION}ms ease-out` : disableZoomControls ? void 0 : "transform 150ms ease-out"
|
|
13233
13527
|
},
|
|
13234
13528
|
children: [
|
|
13235
|
-
iframe.enabled && /* @__PURE__ */ (0,
|
|
13529
|
+
iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: getClassName36("browserBar"), children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
13236
13530
|
BrowserBar,
|
|
13237
13531
|
{
|
|
13238
13532
|
onViewportChange: (viewport) => {
|
|
@@ -13249,23 +13543,23 @@ var Canvas = () => {
|
|
|
13249
13543
|
}
|
|
13250
13544
|
}
|
|
13251
13545
|
) }),
|
|
13252
|
-
/* @__PURE__ */ (0,
|
|
13546
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
13253
13547
|
"div",
|
|
13254
13548
|
{
|
|
13255
|
-
className:
|
|
13549
|
+
className: getClassName36("root"),
|
|
13256
13550
|
suppressHydrationWarning: true,
|
|
13257
13551
|
id: "editor-canvas-root",
|
|
13258
13552
|
onTransitionEnd: () => {
|
|
13259
13553
|
setShowTransition(false);
|
|
13260
13554
|
isResizingRef.current = false;
|
|
13261
13555
|
},
|
|
13262
|
-
children: /* @__PURE__ */ (0,
|
|
13556
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Preview2, {}) })
|
|
13263
13557
|
}
|
|
13264
13558
|
)
|
|
13265
13559
|
]
|
|
13266
13560
|
}
|
|
13267
13561
|
),
|
|
13268
|
-
/* @__PURE__ */ (0,
|
|
13562
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: getClassName36("loader"), children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Loader, { size: 24 }) })
|
|
13269
13563
|
] })
|
|
13270
13564
|
}
|
|
13271
13565
|
);
|
|
@@ -13273,15 +13567,15 @@ var Canvas = () => {
|
|
|
13273
13567
|
|
|
13274
13568
|
// lib/use-sidebar-resize.ts
|
|
13275
13569
|
init_react_import();
|
|
13276
|
-
var
|
|
13570
|
+
var import_react89 = require("react");
|
|
13277
13571
|
init_store();
|
|
13278
13572
|
function useSidebarResize(position, dispatch) {
|
|
13279
|
-
const [width, setWidth] = (0,
|
|
13280
|
-
const sidebarRef = (0,
|
|
13573
|
+
const [width, setWidth] = (0, import_react89.useState)(null);
|
|
13574
|
+
const sidebarRef = (0, import_react89.useRef)(null);
|
|
13281
13575
|
const storeWidth = useAppStore(
|
|
13282
13576
|
(s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
|
|
13283
13577
|
);
|
|
13284
|
-
(0,
|
|
13578
|
+
(0, import_react89.useEffect)(() => {
|
|
13285
13579
|
if (typeof window !== "undefined" && !storeWidth) {
|
|
13286
13580
|
try {
|
|
13287
13581
|
const savedWidths = localStorage.getItem("editor-sidebar-widths");
|
|
@@ -13306,12 +13600,12 @@ function useSidebarResize(position, dispatch) {
|
|
|
13306
13600
|
}
|
|
13307
13601
|
}
|
|
13308
13602
|
}, [dispatch, position, storeWidth]);
|
|
13309
|
-
(0,
|
|
13603
|
+
(0, import_react89.useEffect)(() => {
|
|
13310
13604
|
if (storeWidth !== void 0) {
|
|
13311
13605
|
setWidth(storeWidth);
|
|
13312
13606
|
}
|
|
13313
13607
|
}, [storeWidth]);
|
|
13314
|
-
const handleResizeEnd = (0,
|
|
13608
|
+
const handleResizeEnd = (0, import_react89.useCallback)(
|
|
13315
13609
|
(width2) => {
|
|
13316
13610
|
dispatch({
|
|
13317
13611
|
type: "setUi",
|
|
@@ -13358,27 +13652,27 @@ init_react_import();
|
|
|
13358
13652
|
|
|
13359
13653
|
// components/Editor/components/ResizeHandle/index.tsx
|
|
13360
13654
|
init_react_import();
|
|
13361
|
-
var
|
|
13655
|
+
var import_react90 = require("react");
|
|
13362
13656
|
init_get_class_name_factory();
|
|
13363
13657
|
|
|
13364
13658
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/ResizeHandle/styles.module.css#css-module
|
|
13365
13659
|
init_react_import();
|
|
13366
|
-
var
|
|
13660
|
+
var styles_module_default30 = { "ResizeHandle": "_ResizeHandle_1u3rv_2", "ResizeHandle--left": "_ResizeHandle--left_1u3rv_16", "ResizeHandle--right": "_ResizeHandle--right_1u3rv_20" };
|
|
13367
13661
|
|
|
13368
13662
|
// components/Editor/components/ResizeHandle/index.tsx
|
|
13369
|
-
var
|
|
13370
|
-
var
|
|
13663
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
13664
|
+
var getClassName37 = get_class_name_factory_default("ResizeHandle", styles_module_default30);
|
|
13371
13665
|
var ResizeHandle = ({
|
|
13372
13666
|
position,
|
|
13373
13667
|
sidebarRef,
|
|
13374
13668
|
onResize,
|
|
13375
13669
|
onResizeEnd
|
|
13376
13670
|
}) => {
|
|
13377
|
-
const handleRef = (0,
|
|
13378
|
-
const isDragging = (0,
|
|
13379
|
-
const startX = (0,
|
|
13380
|
-
const startWidth = (0,
|
|
13381
|
-
const handleMouseMove = (0,
|
|
13671
|
+
const handleRef = (0, import_react90.useRef)(null);
|
|
13672
|
+
const isDragging = (0, import_react90.useRef)(false);
|
|
13673
|
+
const startX = (0, import_react90.useRef)(0);
|
|
13674
|
+
const startWidth = (0, import_react90.useRef)(0);
|
|
13675
|
+
const handleMouseMove = (0, import_react90.useCallback)(
|
|
13382
13676
|
(e) => {
|
|
13383
13677
|
if (!isDragging.current) return;
|
|
13384
13678
|
const delta = e.clientX - startX.current;
|
|
@@ -13389,7 +13683,7 @@ var ResizeHandle = ({
|
|
|
13389
13683
|
},
|
|
13390
13684
|
[onResize, position]
|
|
13391
13685
|
);
|
|
13392
|
-
const handleMouseUp = (0,
|
|
13686
|
+
const handleMouseUp = (0, import_react90.useCallback)(() => {
|
|
13393
13687
|
var _a;
|
|
13394
13688
|
if (!isDragging.current) return;
|
|
13395
13689
|
isDragging.current = false;
|
|
@@ -13404,7 +13698,7 @@ var ResizeHandle = ({
|
|
|
13404
13698
|
const finalWidth = ((_a = sidebarRef.current) == null ? void 0 : _a.getBoundingClientRect().width) || 0;
|
|
13405
13699
|
onResizeEnd(finalWidth);
|
|
13406
13700
|
}, [onResizeEnd]);
|
|
13407
|
-
const handleMouseDown = (0,
|
|
13701
|
+
const handleMouseDown = (0, import_react90.useCallback)(
|
|
13408
13702
|
(e) => {
|
|
13409
13703
|
var _a;
|
|
13410
13704
|
isDragging.current = true;
|
|
@@ -13422,11 +13716,11 @@ var ResizeHandle = ({
|
|
|
13422
13716
|
},
|
|
13423
13717
|
[position, handleMouseMove, handleMouseUp]
|
|
13424
13718
|
);
|
|
13425
|
-
return /* @__PURE__ */ (0,
|
|
13719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
13426
13720
|
"div",
|
|
13427
13721
|
{
|
|
13428
13722
|
ref: handleRef,
|
|
13429
|
-
className:
|
|
13723
|
+
className: getClassName37({ [position]: true }),
|
|
13430
13724
|
onMouseDown: handleMouseDown
|
|
13431
13725
|
}
|
|
13432
13726
|
);
|
|
@@ -13437,11 +13731,11 @@ init_get_class_name_factory();
|
|
|
13437
13731
|
|
|
13438
13732
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Sidebar/styles.module.css#css-module
|
|
13439
13733
|
init_react_import();
|
|
13440
|
-
var
|
|
13734
|
+
var styles_module_default31 = { "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" };
|
|
13441
13735
|
|
|
13442
13736
|
// components/Editor/components/Sidebar/index.tsx
|
|
13443
|
-
var
|
|
13444
|
-
var
|
|
13737
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
13738
|
+
var getClassName38 = get_class_name_factory_default("Sidebar", styles_module_default31);
|
|
13445
13739
|
var Sidebar = ({
|
|
13446
13740
|
position,
|
|
13447
13741
|
sidebarRef,
|
|
@@ -13450,16 +13744,16 @@ var Sidebar = ({
|
|
|
13450
13744
|
onResizeEnd,
|
|
13451
13745
|
children
|
|
13452
13746
|
}) => {
|
|
13453
|
-
return /* @__PURE__ */ (0,
|
|
13454
|
-
/* @__PURE__ */ (0,
|
|
13747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [
|
|
13748
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
13455
13749
|
"div",
|
|
13456
13750
|
{
|
|
13457
13751
|
ref: sidebarRef,
|
|
13458
|
-
className:
|
|
13752
|
+
className: getClassName38({ [position]: true, isVisible }),
|
|
13459
13753
|
children
|
|
13460
13754
|
}
|
|
13461
13755
|
),
|
|
13462
|
-
/* @__PURE__ */ (0,
|
|
13756
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: `${getClassName38("resizeHandle")}`, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
13463
13757
|
ResizeHandle,
|
|
13464
13758
|
{
|
|
13465
13759
|
position,
|
|
@@ -13473,9 +13767,12 @@ var Sidebar = ({
|
|
|
13473
13767
|
|
|
13474
13768
|
// lib/use-delete-hotkeys.ts
|
|
13475
13769
|
init_react_import();
|
|
13476
|
-
var
|
|
13770
|
+
var import_react91 = require("react");
|
|
13477
13771
|
init_use_hotkey();
|
|
13478
13772
|
init_store();
|
|
13773
|
+
|
|
13774
|
+
// lib/should-block-editing-hotkey.ts
|
|
13775
|
+
init_react_import();
|
|
13479
13776
|
var isElementVisible = (element) => {
|
|
13480
13777
|
let current = element;
|
|
13481
13778
|
while (current && current !== document.body) {
|
|
@@ -13487,7 +13784,7 @@ var isElementVisible = (element) => {
|
|
|
13487
13784
|
}
|
|
13488
13785
|
return true;
|
|
13489
13786
|
};
|
|
13490
|
-
var
|
|
13787
|
+
var shouldBlockEditingHotkey = (e) => {
|
|
13491
13788
|
var _a;
|
|
13492
13789
|
if (e == null ? void 0 : e.defaultPrevented) return true;
|
|
13493
13790
|
const origin = ((_a = e == null ? void 0 : e.composedPath) == null ? void 0 : _a.call(e)[0]) || (e == null ? void 0 : e.target) || document.activeElement;
|
|
@@ -13508,12 +13805,14 @@ var shouldBlockDeleteHotkey = (e) => {
|
|
|
13508
13805
|
}
|
|
13509
13806
|
return false;
|
|
13510
13807
|
};
|
|
13808
|
+
|
|
13809
|
+
// lib/use-delete-hotkeys.ts
|
|
13511
13810
|
var useDeleteHotkeys = () => {
|
|
13512
13811
|
const appStore = useAppStoreApi();
|
|
13513
|
-
const deleteSelectedComponent = (0,
|
|
13812
|
+
const deleteSelectedComponent = (0, import_react91.useCallback)(
|
|
13514
13813
|
(e) => {
|
|
13515
13814
|
var _a;
|
|
13516
|
-
if (
|
|
13815
|
+
if (shouldBlockEditingHotkey(e)) {
|
|
13517
13816
|
return false;
|
|
13518
13817
|
}
|
|
13519
13818
|
const { state, dispatch, permissions, selectedItem } = appStore.getState();
|
|
@@ -13534,18 +13833,112 @@ var useDeleteHotkeys = () => {
|
|
|
13534
13833
|
useHotkey({ backspace: true }, deleteSelectedComponent);
|
|
13535
13834
|
};
|
|
13536
13835
|
|
|
13836
|
+
// lib/use-clipboard-hotkeys.ts
|
|
13837
|
+
init_react_import();
|
|
13838
|
+
var import_react92 = require("react");
|
|
13839
|
+
init_use_hotkey();
|
|
13840
|
+
init_store();
|
|
13841
|
+
var CLIPBOARD_MARKER = "reacteditor/component";
|
|
13842
|
+
var isComponentData = (value) => {
|
|
13843
|
+
var _a;
|
|
13844
|
+
if (!value || typeof value !== "object") return false;
|
|
13845
|
+
const v = value;
|
|
13846
|
+
return typeof v.type === "string" && typeof ((_a = v.props) == null ? void 0 : _a.id) === "string";
|
|
13847
|
+
};
|
|
13848
|
+
var parsePayload = (text) => {
|
|
13849
|
+
try {
|
|
13850
|
+
const parsed = JSON.parse(text);
|
|
13851
|
+
if (parsed && typeof parsed === "object" && parsed.__reactEditor === CLIPBOARD_MARKER && isComponentData(parsed.data)) {
|
|
13852
|
+
return parsed.data;
|
|
13853
|
+
}
|
|
13854
|
+
} catch (e) {
|
|
13855
|
+
}
|
|
13856
|
+
return null;
|
|
13857
|
+
};
|
|
13858
|
+
var useClipboardHotkeys = () => {
|
|
13859
|
+
const appStore = useAppStoreApi();
|
|
13860
|
+
const writeSelectionToClipboard = (0, import_react92.useCallback)(() => {
|
|
13861
|
+
var _a;
|
|
13862
|
+
const { selectedItem } = appStore.getState();
|
|
13863
|
+
if (!selectedItem) return false;
|
|
13864
|
+
const payload = {
|
|
13865
|
+
__reactEditor: CLIPBOARD_MARKER,
|
|
13866
|
+
data: selectedItem
|
|
13867
|
+
};
|
|
13868
|
+
(_a = navigator.clipboard) == null ? void 0 : _a.writeText(JSON.stringify(payload)).catch(() => {
|
|
13869
|
+
});
|
|
13870
|
+
return true;
|
|
13871
|
+
}, [appStore]);
|
|
13872
|
+
const copySelectedComponent = (0, import_react92.useCallback)(
|
|
13873
|
+
(e) => {
|
|
13874
|
+
if (shouldBlockEditingHotkey(e)) return false;
|
|
13875
|
+
return writeSelectionToClipboard();
|
|
13876
|
+
},
|
|
13877
|
+
[writeSelectionToClipboard]
|
|
13878
|
+
);
|
|
13879
|
+
const cutSelectedComponent = (0, import_react92.useCallback)(
|
|
13880
|
+
(e) => {
|
|
13881
|
+
var _a;
|
|
13882
|
+
if (shouldBlockEditingHotkey(e)) return false;
|
|
13883
|
+
const { state, dispatch, permissions, selectedItem } = appStore.getState();
|
|
13884
|
+
const sel = (_a = state.ui) == null ? void 0 : _a.itemSelector;
|
|
13885
|
+
if (!(sel == null ? void 0 : sel.zone) || !selectedItem) return false;
|
|
13886
|
+
if (!permissions.getPermissions({ item: selectedItem }).delete)
|
|
13887
|
+
return true;
|
|
13888
|
+
if (!writeSelectionToClipboard()) return false;
|
|
13889
|
+
dispatch({
|
|
13890
|
+
type: "remove",
|
|
13891
|
+
index: sel.index,
|
|
13892
|
+
zone: sel.zone
|
|
13893
|
+
});
|
|
13894
|
+
return true;
|
|
13895
|
+
},
|
|
13896
|
+
[appStore, writeSelectionToClipboard]
|
|
13897
|
+
);
|
|
13898
|
+
const pasteComponent = (0, import_react92.useCallback)(
|
|
13899
|
+
(e) => {
|
|
13900
|
+
var _a, _b;
|
|
13901
|
+
if (shouldBlockEditingHotkey(e)) return false;
|
|
13902
|
+
const { state, dispatch, config } = appStore.getState();
|
|
13903
|
+
const sel = (_a = state.ui) == null ? void 0 : _a.itemSelector;
|
|
13904
|
+
if (!(sel == null ? void 0 : sel.zone)) return false;
|
|
13905
|
+
(_b = navigator.clipboard) == null ? void 0 : _b.readText().then((text) => {
|
|
13906
|
+
const data = parsePayload(text);
|
|
13907
|
+
if (!data) return;
|
|
13908
|
+
if (!config.components[data.type]) return;
|
|
13909
|
+
dispatch({
|
|
13910
|
+
type: "insert",
|
|
13911
|
+
componentType: data.type,
|
|
13912
|
+
destinationIndex: sel.index + 1,
|
|
13913
|
+
destinationZone: sel.zone,
|
|
13914
|
+
data
|
|
13915
|
+
});
|
|
13916
|
+
}).catch(() => {
|
|
13917
|
+
});
|
|
13918
|
+
return true;
|
|
13919
|
+
},
|
|
13920
|
+
[appStore]
|
|
13921
|
+
);
|
|
13922
|
+
useHotkey({ meta: true, c: true }, copySelectedComponent);
|
|
13923
|
+
useHotkey({ ctrl: true, c: true }, copySelectedComponent);
|
|
13924
|
+
useHotkey({ meta: true, v: true }, pasteComponent);
|
|
13925
|
+
useHotkey({ ctrl: true, v: true }, pasteComponent);
|
|
13926
|
+
useHotkey({ meta: true, x: true }, cutSelectedComponent);
|
|
13927
|
+
useHotkey({ ctrl: true, x: true }, cutSelectedComponent);
|
|
13928
|
+
};
|
|
13929
|
+
|
|
13537
13930
|
// components/Editor/components/Nav/index.tsx
|
|
13538
13931
|
init_react_import();
|
|
13539
13932
|
|
|
13540
13933
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Editor/components/Nav/styles.module.css#css-module
|
|
13541
13934
|
init_react_import();
|
|
13542
|
-
var
|
|
13935
|
+
var styles_module_default32 = { "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" };
|
|
13543
13936
|
|
|
13544
13937
|
// components/Editor/components/Nav/index.tsx
|
|
13545
13938
|
init_lib();
|
|
13546
|
-
var
|
|
13547
|
-
var
|
|
13548
|
-
var getClassNameItem3 = get_class_name_factory_default("NavItem",
|
|
13939
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
13940
|
+
var getClassName39 = get_class_name_factory_default("Nav", styles_module_default32);
|
|
13941
|
+
var getClassNameItem3 = get_class_name_factory_default("NavItem", styles_module_default32);
|
|
13549
13942
|
var MenuItem = ({
|
|
13550
13943
|
label,
|
|
13551
13944
|
icon,
|
|
@@ -13554,7 +13947,7 @@ var MenuItem = ({
|
|
|
13554
13947
|
mobileOnly,
|
|
13555
13948
|
desktopOnly
|
|
13556
13949
|
}) => {
|
|
13557
|
-
return /* @__PURE__ */ (0,
|
|
13950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13558
13951
|
"li",
|
|
13559
13952
|
{
|
|
13560
13953
|
className: getClassNameItem3({
|
|
@@ -13562,9 +13955,9 @@ var MenuItem = ({
|
|
|
13562
13955
|
mobileOnly,
|
|
13563
13956
|
desktopOnly
|
|
13564
13957
|
}),
|
|
13565
|
-
children: onClick && /* @__PURE__ */ (0,
|
|
13566
|
-
icon && /* @__PURE__ */ (0,
|
|
13567
|
-
/* @__PURE__ */ (0,
|
|
13958
|
+
children: onClick && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: getClassNameItem3("link"), onClick, children: [
|
|
13959
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: getClassNameItem3("linkIcon"), children: icon }),
|
|
13960
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: getClassNameItem3("linkLabel"), children: label })
|
|
13568
13961
|
] })
|
|
13569
13962
|
}
|
|
13570
13963
|
);
|
|
@@ -13573,9 +13966,9 @@ var Nav = ({
|
|
|
13573
13966
|
items,
|
|
13574
13967
|
footer
|
|
13575
13968
|
}) => {
|
|
13576
|
-
return /* @__PURE__ */ (0,
|
|
13577
|
-
/* @__PURE__ */ (0,
|
|
13578
|
-
footer && /* @__PURE__ */ (0,
|
|
13969
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("nav", { className: getClassName39(), children: [
|
|
13970
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("ul", { className: getClassName39("list"), children: Object.entries(items).map(([key, item]) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(MenuItem, __spreadValues({}, item), key)) }),
|
|
13971
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: getClassName39("footer"), children: footer })
|
|
13579
13972
|
] });
|
|
13580
13973
|
};
|
|
13581
13974
|
|
|
@@ -13589,17 +13982,17 @@ init_lucide_react();
|
|
|
13589
13982
|
|
|
13590
13983
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/blocks/styles.module.css#css-module
|
|
13591
13984
|
init_react_import();
|
|
13592
|
-
var
|
|
13985
|
+
var styles_module_default33 = { "BlocksPlugin": "_BlocksPlugin_15ud0_1" };
|
|
13593
13986
|
|
|
13594
13987
|
// plugins/blocks/index.tsx
|
|
13595
13988
|
init_lib();
|
|
13596
|
-
var
|
|
13597
|
-
var
|
|
13989
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
13990
|
+
var getClassName40 = get_class_name_factory_default("BlocksPlugin", styles_module_default33);
|
|
13598
13991
|
var blocksPlugin = () => ({
|
|
13599
13992
|
name: "blocks",
|
|
13600
13993
|
label: "Blocks",
|
|
13601
|
-
render: () => /* @__PURE__ */ (0,
|
|
13602
|
-
icon: /* @__PURE__ */ (0,
|
|
13994
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: getClassName40(), children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Components, {}) }),
|
|
13995
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Plus, {})
|
|
13603
13996
|
});
|
|
13604
13997
|
|
|
13605
13998
|
// plugins/outline/index.tsx
|
|
@@ -13608,17 +14001,17 @@ init_lucide_react();
|
|
|
13608
14001
|
|
|
13609
14002
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/outline/styles.module.css#css-module
|
|
13610
14003
|
init_react_import();
|
|
13611
|
-
var
|
|
14004
|
+
var styles_module_default34 = { "OutlinePlugin": "_OutlinePlugin_q92j6_1" };
|
|
13612
14005
|
|
|
13613
14006
|
// plugins/outline/index.tsx
|
|
13614
14007
|
init_lib();
|
|
13615
|
-
var
|
|
13616
|
-
var
|
|
14008
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
14009
|
+
var getClassName41 = get_class_name_factory_default("OutlinePlugin", styles_module_default34);
|
|
13617
14010
|
var outlinePlugin = () => ({
|
|
13618
14011
|
name: "outline",
|
|
13619
14012
|
label: "Outline",
|
|
13620
|
-
render: () => /* @__PURE__ */ (0,
|
|
13621
|
-
icon: /* @__PURE__ */ (0,
|
|
14013
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: getClassName41(), children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Outline, {}) }),
|
|
14014
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Layers, {})
|
|
13622
14015
|
});
|
|
13623
14016
|
|
|
13624
14017
|
// plugins/fields/index.tsx
|
|
@@ -13628,12 +14021,12 @@ init_store();
|
|
|
13628
14021
|
|
|
13629
14022
|
// css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css#css-module
|
|
13630
14023
|
init_react_import();
|
|
13631
|
-
var
|
|
14024
|
+
var styles_module_default35 = { "FieldsPlugin": "_FieldsPlugin_262zt_1", "FieldsPlugin-header": "_FieldsPlugin-header_262zt_7" };
|
|
13632
14025
|
|
|
13633
14026
|
// plugins/fields/index.tsx
|
|
13634
14027
|
init_lib();
|
|
13635
|
-
var
|
|
13636
|
-
var
|
|
14028
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
14029
|
+
var getClassName42 = get_class_name_factory_default("FieldsPlugin", styles_module_default35);
|
|
13637
14030
|
var CurrentTitle = () => {
|
|
13638
14031
|
const label = useAppStore((s) => {
|
|
13639
14032
|
var _a, _b;
|
|
@@ -13645,17 +14038,17 @@ var CurrentTitle = () => {
|
|
|
13645
14038
|
var fieldsPlugin = ({ desktopSideBar = "right" } = {}) => ({
|
|
13646
14039
|
name: "fields",
|
|
13647
14040
|
label: "Fields",
|
|
13648
|
-
render: () => /* @__PURE__ */ (0,
|
|
13649
|
-
/* @__PURE__ */ (0,
|
|
13650
|
-
/* @__PURE__ */ (0,
|
|
14041
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: getClassName42(), children: [
|
|
14042
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: getClassName42("header"), children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Breadcrumbs, { numParents: 2, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(CurrentTitle, {}) }) }),
|
|
14043
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Fields, {})
|
|
13651
14044
|
] }),
|
|
13652
|
-
icon: /* @__PURE__ */ (0,
|
|
14045
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(RectangleEllipsis, {}),
|
|
13653
14046
|
mobileOnly: desktopSideBar === "right"
|
|
13654
14047
|
});
|
|
13655
14048
|
|
|
13656
14049
|
// components/Editor/components/Layout/index.tsx
|
|
13657
|
-
var
|
|
13658
|
-
var
|
|
14050
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
14051
|
+
var getClassName43 = get_class_name_factory_default("Editor", styles_module_default24);
|
|
13659
14052
|
var getLayoutClassName = get_class_name_factory_default("EditorLayout", styles_module_default24);
|
|
13660
14053
|
var getPluginTabClassName = get_class_name_factory_default("EditorPluginTab", styles_module_default24);
|
|
13661
14054
|
var FieldSideBarToolbar = () => {
|
|
@@ -13668,30 +14061,30 @@ var FieldSideBarToolbar = () => {
|
|
|
13668
14061
|
const CustomHeaderActions = useAppStore(
|
|
13669
14062
|
(s) => s.overrides.headerActions || DefaultOverride
|
|
13670
14063
|
);
|
|
13671
|
-
return /* @__PURE__ */ (0,
|
|
13672
|
-
/* @__PURE__ */ (0,
|
|
13673
|
-
/* @__PURE__ */ (0,
|
|
14064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: getClassName43("fieldSideBarToolbar"), children: [
|
|
14065
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: getClassName43("fieldSideBarHistory"), children: [
|
|
14066
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
13674
14067
|
IconButton,
|
|
13675
14068
|
{
|
|
13676
14069
|
type: "button",
|
|
13677
14070
|
title: "undo",
|
|
13678
14071
|
disabled: !hasPast,
|
|
13679
14072
|
onClick: back,
|
|
13680
|
-
children: /* @__PURE__ */ (0,
|
|
14073
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Undo2, { size: 18 })
|
|
13681
14074
|
}
|
|
13682
14075
|
),
|
|
13683
|
-
/* @__PURE__ */ (0,
|
|
14076
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
13684
14077
|
IconButton,
|
|
13685
14078
|
{
|
|
13686
14079
|
type: "button",
|
|
13687
14080
|
title: "redo",
|
|
13688
14081
|
disabled: !hasFuture,
|
|
13689
14082
|
onClick: forward,
|
|
13690
|
-
children: /* @__PURE__ */ (0,
|
|
14083
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Redo2, { size: 18 })
|
|
13691
14084
|
}
|
|
13692
14085
|
)
|
|
13693
14086
|
] }),
|
|
13694
|
-
/* @__PURE__ */ (0,
|
|
14087
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getClassName43("fieldSideBarActions"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
13695
14088
|
Button,
|
|
13696
14089
|
{
|
|
13697
14090
|
onClick: () => {
|
|
@@ -13710,9 +14103,9 @@ var FieldSideBar = () => {
|
|
|
13710
14103
|
return s.selectedItem ? (_b = (_a = s.config.components[s.selectedItem.type]) == null ? void 0 : _a["label"]) != null ? _b : s.selectedItem.type.toString() : ((_c = s.config.root) == null ? void 0 : _c.label) || "Page";
|
|
13711
14104
|
}
|
|
13712
14105
|
);
|
|
13713
|
-
return /* @__PURE__ */ (0,
|
|
13714
|
-
/* @__PURE__ */ (0,
|
|
13715
|
-
/* @__PURE__ */ (0,
|
|
14106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
|
14107
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(FieldSideBarToolbar, {}),
|
|
14108
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(SidebarSection, { noBorderTop: true, showBreadcrumbs: true, title, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Fields, {}) })
|
|
13716
14109
|
] });
|
|
13717
14110
|
};
|
|
13718
14111
|
var PluginTab = ({
|
|
@@ -13720,7 +14113,7 @@ var PluginTab = ({
|
|
|
13720
14113
|
visible,
|
|
13721
14114
|
mobileOnly
|
|
13722
14115
|
}) => {
|
|
13723
|
-
return /* @__PURE__ */ (0,
|
|
14116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getPluginTabClassName({ visible, mobileOnly }), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getPluginTabClassName("body"), children }) });
|
|
13724
14117
|
};
|
|
13725
14118
|
var Layout = ({ children }) => {
|
|
13726
14119
|
const {
|
|
@@ -13730,7 +14123,7 @@ var Layout = ({ children }) => {
|
|
|
13730
14123
|
plugins,
|
|
13731
14124
|
height
|
|
13732
14125
|
} = usePropsContext();
|
|
13733
|
-
const iframe = (0,
|
|
14126
|
+
const iframe = (0, import_react93.useMemo)(
|
|
13734
14127
|
() => __spreadValues({
|
|
13735
14128
|
enabled: true,
|
|
13736
14129
|
waitForStyles: true
|
|
@@ -13756,7 +14149,7 @@ var Layout = ({ children }) => {
|
|
|
13756
14149
|
sidebarRef: rightSidebarRef,
|
|
13757
14150
|
handleResizeEnd: handleRightSidebarResizeEnd
|
|
13758
14151
|
} = useSidebarResize("right", dispatch);
|
|
13759
|
-
(0,
|
|
14152
|
+
(0, import_react93.useEffect)(() => {
|
|
13760
14153
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
|
13761
14154
|
dispatch({
|
|
13762
14155
|
type: "setUi",
|
|
@@ -13780,17 +14173,17 @@ var Layout = ({ children }) => {
|
|
|
13780
14173
|
};
|
|
13781
14174
|
}, []);
|
|
13782
14175
|
const overrides = useAppStore((s) => s.overrides);
|
|
13783
|
-
const CustomEditor = (0,
|
|
14176
|
+
const CustomEditor = (0, import_react93.useMemo)(
|
|
13784
14177
|
() => overrides.editor || DefaultOverride,
|
|
13785
14178
|
[overrides]
|
|
13786
14179
|
);
|
|
13787
|
-
const [mounted, setMounted] = (0,
|
|
13788
|
-
(0,
|
|
14180
|
+
const [mounted, setMounted] = (0, import_react93.useState)(false);
|
|
14181
|
+
(0, import_react93.useEffect)(() => {
|
|
13789
14182
|
setMounted(true);
|
|
13790
14183
|
}, []);
|
|
13791
14184
|
const ready = useAppStore((s) => s.status === "READY");
|
|
13792
14185
|
useMonitorHotkeys();
|
|
13793
|
-
(0,
|
|
14186
|
+
(0, import_react93.useEffect)(() => {
|
|
13794
14187
|
if (ready && iframe.enabled) {
|
|
13795
14188
|
const frameDoc = getFrame();
|
|
13796
14189
|
if (frameDoc) {
|
|
@@ -13800,12 +14193,13 @@ var Layout = ({ children }) => {
|
|
|
13800
14193
|
}, [ready, iframe.enabled]);
|
|
13801
14194
|
usePreviewModeHotkeys();
|
|
13802
14195
|
useDeleteHotkeys();
|
|
14196
|
+
useClipboardHotkeys();
|
|
13803
14197
|
const layoutOptions = {};
|
|
13804
14198
|
if (leftWidth) {
|
|
13805
|
-
layoutOptions["--
|
|
14199
|
+
layoutOptions["--editor-user-left-side-bar-width"] = `${leftWidth}px`;
|
|
13806
14200
|
}
|
|
13807
14201
|
if (rightWidth) {
|
|
13808
|
-
layoutOptions["--
|
|
14202
|
+
layoutOptions["--editor-user-right-side-bar-width"] = `${rightWidth}px`;
|
|
13809
14203
|
}
|
|
13810
14204
|
const setUi = useAppStore((s) => s.setUi);
|
|
13811
14205
|
const currentPlugin = useAppStore((s) => {
|
|
@@ -13813,15 +14207,15 @@ var Layout = ({ children }) => {
|
|
|
13813
14207
|
return (_a = s.state.ui.plugin) == null ? void 0 : _a.current;
|
|
13814
14208
|
});
|
|
13815
14209
|
const appStoreApi = useAppStoreApi();
|
|
13816
|
-
const [mobilePanelHeightMode, setMobilePanelHeightMode] = (0,
|
|
13817
|
-
const [mobilePanelHeight, setMobilePanelHeight] = (0,
|
|
14210
|
+
const [mobilePanelHeightMode, setMobilePanelHeightMode] = (0, import_react93.useState)("toggle");
|
|
14211
|
+
const [mobilePanelHeight, setMobilePanelHeight] = (0, import_react93.useState)(
|
|
13818
14212
|
null
|
|
13819
14213
|
);
|
|
13820
|
-
const mobilePanelRef = (0,
|
|
13821
|
-
const isDraggingMobile = (0,
|
|
13822
|
-
const dragStartY = (0,
|
|
13823
|
-
const dragStartHeight = (0,
|
|
13824
|
-
const handleMobileDragStart = (0,
|
|
14214
|
+
const mobilePanelRef = (0, import_react93.useRef)(null);
|
|
14215
|
+
const isDraggingMobile = (0, import_react93.useRef)(false);
|
|
14216
|
+
const dragStartY = (0, import_react93.useRef)(0);
|
|
14217
|
+
const dragStartHeight = (0, import_react93.useRef)(0);
|
|
14218
|
+
const handleMobileDragStart = (0, import_react93.useCallback)(
|
|
13825
14219
|
(clientY) => {
|
|
13826
14220
|
isDraggingMobile.current = true;
|
|
13827
14221
|
dragStartY.current = clientY;
|
|
@@ -13832,7 +14226,7 @@ var Layout = ({ children }) => {
|
|
|
13832
14226
|
},
|
|
13833
14227
|
[]
|
|
13834
14228
|
);
|
|
13835
|
-
const handleMobileDragMove = (0,
|
|
14229
|
+
const handleMobileDragMove = (0, import_react93.useCallback)((clientY) => {
|
|
13836
14230
|
if (!isDraggingMobile.current) return;
|
|
13837
14231
|
const delta = dragStartY.current - clientY;
|
|
13838
14232
|
const viewportHeight = window.innerHeight;
|
|
@@ -13841,13 +14235,13 @@ var Layout = ({ children }) => {
|
|
|
13841
14235
|
const newH = Math.min(maxH, Math.max(minH, dragStartHeight.current + delta));
|
|
13842
14236
|
setMobilePanelHeight(newH);
|
|
13843
14237
|
}, []);
|
|
13844
|
-
const handleMobileDragEnd = (0,
|
|
14238
|
+
const handleMobileDragEnd = (0, import_react93.useCallback)(() => {
|
|
13845
14239
|
if (!isDraggingMobile.current) return;
|
|
13846
14240
|
isDraggingMobile.current = false;
|
|
13847
14241
|
document.body.style.userSelect = "";
|
|
13848
14242
|
document.body.style.touchAction = "";
|
|
13849
14243
|
}, []);
|
|
13850
|
-
(0,
|
|
14244
|
+
(0, import_react93.useEffect)(() => {
|
|
13851
14245
|
const onTouchMove = (e) => {
|
|
13852
14246
|
if (isDraggingMobile.current) {
|
|
13853
14247
|
e.preventDefault();
|
|
@@ -13873,26 +14267,26 @@ var Layout = ({ children }) => {
|
|
|
13873
14267
|
document.removeEventListener("mouseup", onMouseUp);
|
|
13874
14268
|
};
|
|
13875
14269
|
}, [handleMobileDragMove, handleMobileDragEnd]);
|
|
13876
|
-
const [theme, setTheme] = (0,
|
|
14270
|
+
const [theme, setTheme] = (0, import_react93.useState)(() => {
|
|
13877
14271
|
if (typeof window === "undefined") return "light";
|
|
13878
14272
|
const stored = window.localStorage.getItem("editor-theme");
|
|
13879
14273
|
if (stored === "light" || stored === "dark") return stored;
|
|
13880
14274
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
13881
14275
|
});
|
|
13882
|
-
(0,
|
|
14276
|
+
(0, import_react93.useEffect)(() => {
|
|
13883
14277
|
if (typeof window === "undefined") return;
|
|
13884
14278
|
window.localStorage.setItem("editor-theme", theme);
|
|
13885
14279
|
}, [theme]);
|
|
13886
14280
|
const toggleTheme = () => {
|
|
13887
14281
|
setTheme((t) => t === "dark" ? "light" : "dark");
|
|
13888
14282
|
};
|
|
13889
|
-
const themeIcon = theme === "dark" ? /* @__PURE__ */ (0,
|
|
14283
|
+
const themeIcon = theme === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Sun, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Moon, { size: 18 });
|
|
13890
14284
|
const themeLabel = theme === "dark" ? "Switch to light mode" : "Switch to dark mode";
|
|
13891
|
-
const hasLegacySideBarPlugin = (0,
|
|
14285
|
+
const hasLegacySideBarPlugin = (0, import_react93.useMemo)(
|
|
13892
14286
|
() => !!(plugins == null ? void 0 : plugins.find((p) => p.name === "legacy-side-bar")),
|
|
13893
14287
|
[plugins]
|
|
13894
14288
|
);
|
|
13895
|
-
const pluginItems = (0,
|
|
14289
|
+
const pluginItems = (0, import_react93.useMemo)(() => {
|
|
13896
14290
|
const details = {};
|
|
13897
14291
|
const defaultPlugins = [blocksPlugin(), outlinePlugin()];
|
|
13898
14292
|
const isLegacy = (plugin) => plugin.name === "legacy-side-bar" ? -1 : 0;
|
|
@@ -13911,7 +14305,7 @@ var Layout = ({ children }) => {
|
|
|
13911
14305
|
}
|
|
13912
14306
|
details[plugin.name] = {
|
|
13913
14307
|
label: (_a = plugin.label) != null ? _a : plugin.name,
|
|
13914
|
-
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ (0,
|
|
14308
|
+
icon: (_b = plugin.icon) != null ? _b : /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ToyBrick, {}),
|
|
13915
14309
|
onClick: () => {
|
|
13916
14310
|
var _a2;
|
|
13917
14311
|
setMobilePanelHeightMode((_a2 = plugin.mobilePanelHeight) != null ? _a2 : "toggle");
|
|
@@ -13939,7 +14333,7 @@ var Layout = ({ children }) => {
|
|
|
13939
14333
|
});
|
|
13940
14334
|
return details;
|
|
13941
14335
|
}, [plugins, currentPlugin, appStoreApi, leftSideBarVisible]);
|
|
13942
|
-
(0,
|
|
14336
|
+
(0, import_react93.useEffect)(() => {
|
|
13943
14337
|
if (!currentPlugin) {
|
|
13944
14338
|
const names = Object.keys(pluginItems);
|
|
13945
14339
|
setUi({ plugin: { current: names[0] } });
|
|
@@ -13948,19 +14342,19 @@ var Layout = ({ children }) => {
|
|
|
13948
14342
|
const hasDesktopFieldsPlugin = pluginItems["fields"] && pluginItems["fields"].mobileOnly === false;
|
|
13949
14343
|
const mobilePanelStyle = {};
|
|
13950
14344
|
if (mobilePanelHeight && leftSideBarVisible) {
|
|
13951
|
-
mobilePanelStyle["--
|
|
14345
|
+
mobilePanelStyle["--editor-mobile-panel-height"] = `${mobilePanelHeight}px`;
|
|
13952
14346
|
}
|
|
13953
|
-
return /* @__PURE__ */ (0,
|
|
14347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
13954
14348
|
"div",
|
|
13955
14349
|
{
|
|
13956
|
-
className: `Editor ${
|
|
14350
|
+
className: `Editor ${getClassName43({
|
|
13957
14351
|
hidePlugins: hasLegacySideBarPlugin
|
|
13958
14352
|
})}`,
|
|
13959
14353
|
id: instanceId,
|
|
13960
14354
|
"data-theme": theme,
|
|
13961
14355
|
style: { height },
|
|
13962
14356
|
children: [
|
|
13963
|
-
/* @__PURE__ */ (0,
|
|
14357
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DragDropContext, { disableAutoScroll: dnd == null ? void 0 : dnd.disableAutoScroll, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(CustomEditor, { children: children || /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(FrameProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
13964
14358
|
"div",
|
|
13965
14359
|
{
|
|
13966
14360
|
className: getLayoutClassName({
|
|
@@ -13972,17 +14366,17 @@ var Layout = ({ children }) => {
|
|
|
13972
14366
|
mobilePanelCustomHeight: mobilePanelHeight !== null && leftSideBarVisible
|
|
13973
14367
|
}),
|
|
13974
14368
|
style: { height },
|
|
13975
|
-
children: /* @__PURE__ */ (0,
|
|
14369
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
13976
14370
|
"div",
|
|
13977
14371
|
{
|
|
13978
14372
|
className: getLayoutClassName("inner"),
|
|
13979
14373
|
style: __spreadValues(__spreadValues({}, layoutOptions), mobilePanelStyle),
|
|
13980
14374
|
children: [
|
|
13981
|
-
/* @__PURE__ */ (0,
|
|
14375
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getLayoutClassName("nav"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
13982
14376
|
Nav,
|
|
13983
14377
|
{
|
|
13984
14378
|
items: pluginItems,
|
|
13985
|
-
footer: /* @__PURE__ */ (0,
|
|
14379
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
13986
14380
|
IconButton,
|
|
13987
14381
|
{
|
|
13988
14382
|
type: "button",
|
|
@@ -13993,19 +14387,19 @@ var Layout = ({ children }) => {
|
|
|
13993
14387
|
)
|
|
13994
14388
|
}
|
|
13995
14389
|
) }),
|
|
13996
|
-
/* @__PURE__ */ (0,
|
|
14390
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
13997
14391
|
"div",
|
|
13998
14392
|
{
|
|
13999
14393
|
ref: mobilePanelRef,
|
|
14000
14394
|
className: getLayoutClassName("mobilePanel"),
|
|
14001
14395
|
children: [
|
|
14002
|
-
/* @__PURE__ */ (0,
|
|
14396
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14003
14397
|
"div",
|
|
14004
14398
|
{
|
|
14005
14399
|
className: getLayoutClassName("mobileDragHandle"),
|
|
14006
14400
|
onTouchStart: (e) => handleMobileDragStart(e.touches[0].clientY),
|
|
14007
14401
|
onMouseDown: (e) => handleMobileDragStart(e.clientY),
|
|
14008
|
-
children: /* @__PURE__ */ (0,
|
|
14402
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14009
14403
|
"div",
|
|
14010
14404
|
{
|
|
14011
14405
|
className: getLayoutClassName("mobileDragHandlePill")
|
|
@@ -14013,17 +14407,17 @@ var Layout = ({ children }) => {
|
|
|
14013
14407
|
)
|
|
14014
14408
|
}
|
|
14015
14409
|
),
|
|
14016
|
-
/* @__PURE__ */ (0,
|
|
14410
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14017
14411
|
"div",
|
|
14018
14412
|
{
|
|
14019
14413
|
className: getLayoutClassName("mobilePanelContent"),
|
|
14020
14414
|
children: Object.entries(pluginItems).map(
|
|
14021
|
-
([id, { mobileOnly, render: Render2 }]) => /* @__PURE__ */ (0,
|
|
14415
|
+
([id, { mobileOnly, render: Render2 }]) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14022
14416
|
PluginTab,
|
|
14023
14417
|
{
|
|
14024
14418
|
visible: currentPlugin === id,
|
|
14025
14419
|
mobileOnly,
|
|
14026
|
-
children: /* @__PURE__ */ (0,
|
|
14420
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Render2, {})
|
|
14027
14421
|
},
|
|
14028
14422
|
id
|
|
14029
14423
|
)
|
|
@@ -14033,7 +14427,7 @@ var Layout = ({ children }) => {
|
|
|
14033
14427
|
]
|
|
14034
14428
|
}
|
|
14035
14429
|
),
|
|
14036
|
-
/* @__PURE__ */ (0,
|
|
14430
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14037
14431
|
Sidebar,
|
|
14038
14432
|
{
|
|
14039
14433
|
position: "left",
|
|
@@ -14042,20 +14436,20 @@ var Layout = ({ children }) => {
|
|
|
14042
14436
|
onResize: setLeftWidth,
|
|
14043
14437
|
onResizeEnd: handleLeftSidebarResizeEnd,
|
|
14044
14438
|
children: Object.entries(pluginItems).map(
|
|
14045
|
-
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */ (0,
|
|
14439
|
+
([id, { mobileOnly, render: Render2, label }]) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14046
14440
|
PluginTab,
|
|
14047
14441
|
{
|
|
14048
14442
|
visible: currentPlugin === id,
|
|
14049
14443
|
mobileOnly,
|
|
14050
|
-
children: /* @__PURE__ */ (0,
|
|
14444
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Render2, {})
|
|
14051
14445
|
},
|
|
14052
14446
|
id
|
|
14053
14447
|
)
|
|
14054
14448
|
)
|
|
14055
14449
|
}
|
|
14056
14450
|
),
|
|
14057
|
-
/* @__PURE__ */ (0,
|
|
14058
|
-
!hasDesktopFieldsPlugin && /* @__PURE__ */ (0,
|
|
14451
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Canvas, {}),
|
|
14452
|
+
!hasDesktopFieldsPlugin && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
14059
14453
|
Sidebar,
|
|
14060
14454
|
{
|
|
14061
14455
|
position: "right",
|
|
@@ -14063,7 +14457,7 @@ var Layout = ({ children }) => {
|
|
|
14063
14457
|
isVisible: rightSideBarVisible,
|
|
14064
14458
|
onResize: setRightWidth,
|
|
14065
14459
|
onResizeEnd: handleRightSidebarResizeEnd,
|
|
14066
|
-
children: /* @__PURE__ */ (0,
|
|
14460
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(FieldSideBar, {})
|
|
14067
14461
|
}
|
|
14068
14462
|
)
|
|
14069
14463
|
]
|
|
@@ -14071,19 +14465,19 @@ var Layout = ({ children }) => {
|
|
|
14071
14465
|
)
|
|
14072
14466
|
}
|
|
14073
14467
|
) }) }) }),
|
|
14074
|
-
/* @__PURE__ */ (0,
|
|
14468
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { id: "editor-portal-root", className: getClassName43("portal") })
|
|
14075
14469
|
]
|
|
14076
14470
|
}
|
|
14077
14471
|
);
|
|
14078
14472
|
};
|
|
14079
14473
|
|
|
14080
14474
|
// components/Editor/index.tsx
|
|
14081
|
-
var
|
|
14082
|
-
var propsContext = (0,
|
|
14475
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
14476
|
+
var propsContext = (0, import_react94.createContext)({});
|
|
14083
14477
|
function PropsProvider(props) {
|
|
14084
|
-
return /* @__PURE__ */ (0,
|
|
14478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(propsContext.Provider, { value: props, children: props.children });
|
|
14085
14479
|
}
|
|
14086
|
-
var usePropsContext = () => (0,
|
|
14480
|
+
var usePropsContext = () => (0, import_react94.useContext)(propsContext);
|
|
14087
14481
|
function EditorProvider({ children }) {
|
|
14088
14482
|
const {
|
|
14089
14483
|
config,
|
|
@@ -14102,14 +14496,14 @@ function EditorProvider({ children }) {
|
|
|
14102
14496
|
fullScreenCanvas,
|
|
14103
14497
|
_experimentalVirtualization
|
|
14104
14498
|
} = usePropsContext();
|
|
14105
|
-
const iframe = (0,
|
|
14499
|
+
const iframe = (0, import_react94.useMemo)(
|
|
14106
14500
|
() => __spreadValues({
|
|
14107
14501
|
enabled: true,
|
|
14108
14502
|
waitForStyles: true
|
|
14109
14503
|
}, _iframe),
|
|
14110
14504
|
[_iframe]
|
|
14111
14505
|
);
|
|
14112
|
-
const [generatedAppState] = (0,
|
|
14506
|
+
const [generatedAppState] = (0, import_react94.useState)(() => {
|
|
14113
14507
|
var _a, _b, _c, _d, _e, _f;
|
|
14114
14508
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
|
14115
14509
|
let clientUiState = {};
|
|
@@ -14161,7 +14555,7 @@ function EditorProvider({ children }) {
|
|
|
14161
14555
|
return walkAppState(newAppState, config);
|
|
14162
14556
|
});
|
|
14163
14557
|
const { appendData = true } = _initialHistory || {};
|
|
14164
|
-
const [blendedHistories] = (0,
|
|
14558
|
+
const [blendedHistories] = (0, import_react94.useState)(
|
|
14165
14559
|
[
|
|
14166
14560
|
...(_initialHistory == null ? void 0 : _initialHistory.histories) || [],
|
|
14167
14561
|
...appendData ? [{ state: generatedAppState }] : []
|
|
@@ -14175,7 +14569,7 @@ function EditorProvider({ children }) {
|
|
|
14175
14569
|
});
|
|
14176
14570
|
})
|
|
14177
14571
|
);
|
|
14178
|
-
const initialHistoryIndex = (0,
|
|
14572
|
+
const initialHistoryIndex = (0, import_react94.useMemo)(() => {
|
|
14179
14573
|
if ((_initialHistory == null ? void 0 : _initialHistory.index) !== void 0 && (_initialHistory == null ? void 0 : _initialHistory.index) >= 0 && (_initialHistory == null ? void 0 : _initialHistory.index) < blendedHistories.length) {
|
|
14180
14574
|
return _initialHistory == null ? void 0 : _initialHistory.index;
|
|
14181
14575
|
}
|
|
@@ -14186,7 +14580,7 @@ function EditorProvider({ children }) {
|
|
|
14186
14580
|
overrides,
|
|
14187
14581
|
plugins
|
|
14188
14582
|
});
|
|
14189
|
-
const loadedFieldTransforms = (0,
|
|
14583
|
+
const loadedFieldTransforms = (0, import_react94.useMemo)(() => {
|
|
14190
14584
|
const _plugins = plugins || [];
|
|
14191
14585
|
const pluginFieldTransforms = _plugins.reduce(
|
|
14192
14586
|
(acc, plugin) => __spreadValues(__spreadValues({}, acc), plugin.fieldTransforms),
|
|
@@ -14195,7 +14589,7 @@ function EditorProvider({ children }) {
|
|
|
14195
14589
|
return __spreadValues(__spreadValues({}, pluginFieldTransforms), fieldTransforms);
|
|
14196
14590
|
}, [fieldTransforms, plugins]);
|
|
14197
14591
|
const instanceId = useSafeId();
|
|
14198
|
-
const generateAppStore = (0,
|
|
14592
|
+
const generateAppStore = (0, import_react94.useCallback)(
|
|
14199
14593
|
(state) => {
|
|
14200
14594
|
return {
|
|
14201
14595
|
instanceId,
|
|
@@ -14227,15 +14621,15 @@ function EditorProvider({ children }) {
|
|
|
14227
14621
|
loadedFieldTransforms
|
|
14228
14622
|
]
|
|
14229
14623
|
);
|
|
14230
|
-
const [appStore] = (0,
|
|
14624
|
+
const [appStore] = (0, import_react94.useState)(
|
|
14231
14625
|
() => createAppStore(generateAppStore(initialAppState))
|
|
14232
14626
|
);
|
|
14233
|
-
(0,
|
|
14627
|
+
(0, import_react94.useEffect)(() => {
|
|
14234
14628
|
if (process.env.NODE_ENV !== "production") {
|
|
14235
14629
|
window.__PUCK_INTERNAL_DO_NOT_USE = { appStore };
|
|
14236
14630
|
}
|
|
14237
14631
|
}, [appStore]);
|
|
14238
|
-
(0,
|
|
14632
|
+
(0, import_react94.useEffect)(() => {
|
|
14239
14633
|
const state = appStore.getState().state;
|
|
14240
14634
|
appStore.setState(__spreadValues({}, generateAppStore(state)));
|
|
14241
14635
|
}, [generateAppStore]);
|
|
@@ -14244,8 +14638,8 @@ function EditorProvider({ children }) {
|
|
|
14244
14638
|
index: initialHistoryIndex,
|
|
14245
14639
|
initialAppState
|
|
14246
14640
|
});
|
|
14247
|
-
const previousData = (0,
|
|
14248
|
-
(0,
|
|
14641
|
+
const previousData = (0, import_react94.useRef)(null);
|
|
14642
|
+
(0, import_react94.useEffect)(() => {
|
|
14249
14643
|
return appStore.subscribe(
|
|
14250
14644
|
(s) => s.state.data,
|
|
14251
14645
|
(data) => {
|
|
@@ -14259,16 +14653,16 @@ function EditorProvider({ children }) {
|
|
|
14259
14653
|
}, [onChange, config]);
|
|
14260
14654
|
useRegisterPermissionsSlice(appStore, permissions);
|
|
14261
14655
|
const uEditorStore = useRegisterUseEditorStore(appStore);
|
|
14262
|
-
(0,
|
|
14656
|
+
(0, import_react94.useEffect)(() => {
|
|
14263
14657
|
const { resolveAndCommitData } = appStore.getState();
|
|
14264
14658
|
setTimeout(() => {
|
|
14265
14659
|
resolveAndCommitData();
|
|
14266
14660
|
}, 0);
|
|
14267
14661
|
}, []);
|
|
14268
|
-
return /* @__PURE__ */ (0,
|
|
14662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(appStoreContext.Provider, { value: appStore, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(UseEditorStoreContext.Provider, { value: uEditorStore, children }) });
|
|
14269
14663
|
}
|
|
14270
14664
|
function Editor4(props) {
|
|
14271
|
-
return /* @__PURE__ */ (0,
|
|
14665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(PropsProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(EditorProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(Layout, { children: props.children }) })) }));
|
|
14272
14666
|
}
|
|
14273
14667
|
Editor4.Components = Components;
|
|
14274
14668
|
Editor4.Fields = Fields;
|
|
@@ -14554,12 +14948,12 @@ init_walk_tree();
|
|
|
14554
14948
|
|
|
14555
14949
|
// plugins/legacy-side-bar/index.tsx
|
|
14556
14950
|
init_react_import();
|
|
14557
|
-
var
|
|
14951
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
14558
14952
|
var legacySideBarPlugin = () => ({
|
|
14559
14953
|
name: "legacy-side-bar",
|
|
14560
|
-
render: () => /* @__PURE__ */ (0,
|
|
14561
|
-
/* @__PURE__ */ (0,
|
|
14562
|
-
/* @__PURE__ */ (0,
|
|
14954
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { style: { overflowY: "auto" }, children: [
|
|
14955
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Components, {}) }),
|
|
14956
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Outline, {}) })
|
|
14563
14957
|
] })
|
|
14564
14958
|
});
|
|
14565
14959
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -14570,7 +14964,6 @@ var legacySideBarPlugin = () => ({
|
|
|
14570
14964
|
Button,
|
|
14571
14965
|
ComponentList,
|
|
14572
14966
|
Drawer,
|
|
14573
|
-
DropZone,
|
|
14574
14967
|
Editor,
|
|
14575
14968
|
FieldLabel,
|
|
14576
14969
|
Group,
|
|
@@ -14594,6 +14987,7 @@ var legacySideBarPlugin = () => ({
|
|
|
14594
14987
|
transformProps,
|
|
14595
14988
|
useEditor,
|
|
14596
14989
|
useGetEditor,
|
|
14990
|
+
usePropsContext,
|
|
14597
14991
|
walkTree
|
|
14598
14992
|
});
|
|
14599
14993
|
/*! Bundled license information:
|