@reacteditor/core 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/{Editor-2TYODRQT.mjs → Editor-POJT3RA2.mjs} +8 -8
  2. package/dist/{Editor-GBV2O5RD.css → Editor-WYZZDKT3.css} +7 -7
  3. package/dist/{Render-VDC7AEQK.mjs → Render-JNABKPAF.mjs} +1 -1
  4. package/dist/{Render-EFT7YD2C.css → Render-WBTAN6PO.css} +1 -1
  5. package/dist/{actions-BCDhqbeL.d.mts → actions-CQmL3wwa.d.mts} +11 -6
  6. package/dist/{actions-BCDhqbeL.d.ts → actions-CQmL3wwa.d.ts} +11 -6
  7. package/dist/{chunk-6Q6A3BQH.mjs → chunk-43G2QHSV.mjs} +12 -12
  8. package/dist/{chunk-HMTHZBH6.mjs → chunk-5N6RK26Z.mjs} +1 -1
  9. package/dist/{chunk-ZHNRSSMW.mjs → chunk-DCL4UC2H.mjs} +1 -1
  10. package/dist/{chunk-2LVYDXZS.mjs → chunk-IUOWXGYR.mjs} +2 -2
  11. package/dist/{chunk-M2RKJTNY.mjs → chunk-JEDWXGVP.mjs} +1 -1
  12. package/dist/{chunk-MFI3RDA4.mjs → chunk-KC727YFW.mjs} +1 -1
  13. package/dist/{chunk-D2RG73WI.mjs → chunk-QB3US7UE.mjs} +148 -121
  14. package/dist/{chunk-VUEM62JF.mjs → chunk-UB2DES2O.mjs} +17 -6
  15. package/dist/{chunk-TCVU3WEN.mjs → chunk-X7IRHSQN.mjs} +4 -4
  16. package/dist/{chunk-VD3EVRUF.mjs → chunk-YFRH22NT.mjs} +2 -2
  17. package/dist/{full-ELX6RALJ.css → full-5442HPZH.css} +6 -6
  18. package/dist/{full-7KJICNR5.mjs → full-HZMEMWCN.mjs} +6 -6
  19. package/dist/{index-DVwiIwYU.d.mts → index-BOP2qNVA.d.mts} +1 -1
  20. package/dist/{index-ComBHfdn.d.ts → index-_G46lHpL.d.ts} +1 -1
  21. package/dist/index.css +93 -92
  22. package/dist/index.d.mts +11 -20
  23. package/dist/index.d.ts +11 -20
  24. package/dist/index.js +185 -147
  25. package/dist/index.mjs +10 -10
  26. package/dist/internal.d.mts +2 -2
  27. package/dist/internal.d.ts +2 -2
  28. package/dist/internal.js +17 -6
  29. package/dist/internal.mjs +1 -1
  30. package/dist/{loaded-IJNA4SY5.mjs → loaded-35JQLXSA.mjs} +3 -3
  31. package/dist/{loaded-TBSVRJPY.css → loaded-KZZU4RNL.css} +1 -1
  32. package/dist/{loaded-CBJRWD4Z.mjs → loaded-QJMKRN35.mjs} +3 -3
  33. package/dist/{loaded-DGSPK47E.mjs → loaded-U6ZILQXM.mjs} +3 -3
  34. package/dist/no-external.css +93 -92
  35. package/dist/no-external.d.mts +4 -4
  36. package/dist/no-external.d.ts +4 -4
  37. package/dist/no-external.js +185 -147
  38. package/dist/no-external.mjs +10 -10
  39. package/dist/rsc.css +1 -1
  40. package/dist/rsc.d.mts +2 -2
  41. package/dist/rsc.d.ts +2 -2
  42. package/dist/rsc.js +4 -4
  43. package/dist/rsc.mjs +2 -2
  44. package/dist/{walk-tree-BPIigVTF.d.mts → walk-tree-Dwv3c_9M.d.mts} +1 -1
  45. package/dist/{walk-tree-BZq1CPCH.d.ts → walk-tree-DxSkPLnl.d.ts} +1 -1
  46. package/package.json +1 -1
@@ -69,20 +69,31 @@ var populateIds = (data, config, override = false) => {
69
69
 
70
70
  // reducer/actions/insert.ts
71
71
  function insertAction(state, action, appStore) {
72
+ var _a, _b;
72
73
  const id = action.id || generateId(action.componentType);
74
+ const componentConfig = appStore.config.components[action.componentType];
75
+ const isGlobalType = (componentConfig == null ? void 0 : componentConfig.global) === true;
76
+ const defaultProps = (componentConfig == null ? void 0 : componentConfig.defaultProps) || {};
73
77
  const emptyComponentData = populateIds(
74
- {
78
+ __spreadValues({
75
79
  type: action.componentType,
76
- props: __spreadProps(__spreadValues({}, appStore.config.components[action.componentType].defaultProps || {}), {
77
- id
78
- })
79
- },
80
+ props: __spreadProps(__spreadValues({}, defaultProps), { id })
81
+ }, isGlobalType ? { synced: true } : {}),
80
82
  appStore.config
81
83
  );
82
84
  const [parentId] = action.destinationZone.split(":");
83
85
  const idsInPath = getIdsForParent(action.destinationZone, state);
86
+ let nextData = state.data;
87
+ if (isGlobalType && !((_a = nextData.globals) != null ? _a : {})[action.componentType]) {
88
+ nextData = __spreadProps(__spreadValues({}, nextData), {
89
+ globals: __spreadProps(__spreadValues({}, (_b = nextData.globals) != null ? _b : {}), {
90
+ [action.componentType]: { props: __spreadValues({}, defaultProps) }
91
+ })
92
+ });
93
+ }
94
+ const seededState = nextData === state.data ? state : __spreadProps(__spreadValues({}, state), { data: nextData });
84
95
  return walkAppState(
85
- state,
96
+ seededState,
86
97
  appStore.config,
87
98
  (content, zoneCompound) => {
88
99
  if (zoneCompound === action.destinationZone) {
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  styles_module_default
3
- } from "./chunk-MFI3RDA4.mjs";
3
+ } from "./chunk-KC727YFW.mjs";
4
4
  import {
5
5
  LoadedRichTextMenuInner
6
- } from "./chunk-6Q6A3BQH.mjs";
6
+ } from "./chunk-43G2QHSV.mjs";
7
7
  import {
8
8
  useAppStore,
9
9
  useAppStoreApi
10
- } from "./chunk-2LVYDXZS.mjs";
10
+ } from "./chunk-IUOWXGYR.mjs";
11
11
  import {
12
12
  get_class_name_factory_default
13
13
  } from "./chunk-Y2EFNT5P.mjs";
@@ -100,7 +100,7 @@ init_react_import();
100
100
  import { lazy, Suspense } from "react";
101
101
  import { jsx as jsx2 } from "react/jsx-runtime";
102
102
  var LoadedRichTextMenuFull = lazy(
103
- () => import("./full-7KJICNR5.mjs").then((m) => ({
103
+ () => import("./full-HZMEMWCN.mjs").then((m) => ({
104
104
  default: m.LoadedRichTextMenuFull
105
105
  }))
106
106
  );
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  styles_module_default
3
- } from "./chunk-MFI3RDA4.mjs";
3
+ } from "./chunk-KC727YFW.mjs";
4
4
  import {
5
5
  defaultAppState,
6
6
  resolveComponentData
@@ -400,7 +400,7 @@ function useRichtextProps(fields, props) {
400
400
  const richtextProps = useMemo2(() => {
401
401
  if (!(richtextKeys == null ? void 0 : richtextKeys.length)) return {};
402
402
  const RichTextRender = lazy(
403
- () => import("./Render-VDC7AEQK.mjs").then((m) => ({
403
+ () => import("./Render-JNABKPAF.mjs").then((m) => ({
404
404
  default: m.RichTextRender
405
405
  }))
406
406
  );
@@ -1,4 +1,4 @@
1
- /* css-module:/Users/rami/Documents/apps/frontend-react-editor/packages/core/components/RichTextMenu/styles.module.css/#css-module-data */
1
+ /* css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/RichTextMenu/styles.module.css/#css-module-data */
2
2
  ._RichTextMenu_7muaf_1 {
3
3
  display: flex;
4
4
  flex-direction: row;
@@ -41,7 +41,7 @@
41
41
  border-left: 0.5px solid rgba(255, 255, 255, 0.2);
42
42
  }
43
43
 
44
- /* css-module:/Users/rami/Documents/apps/frontend-react-editor/packages/core/components/IconButton/IconButton.module.css/#css-module-data */
44
+ /* css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/IconButton/IconButton.module.css/#css-module-data */
45
45
  ._IconButton_19x6h_1 {
46
46
  align-items: center;
47
47
  background: transparent;
@@ -87,7 +87,7 @@
87
87
  color: var(--re-text-tertiary);
88
88
  }
89
89
 
90
- /* css-module:/Users/rami/Documents/apps/frontend-react-editor/packages/core/components/Loader/styles.module.css/#css-module-data */
90
+ /* css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Loader/styles.module.css/#css-module-data */
91
91
  @keyframes _loader-animation_nacdm_1 {
92
92
  0% {
93
93
  transform: rotate(0deg) scale(1);
@@ -109,7 +109,7 @@
109
109
  animation-fill-mode: both;
110
110
  }
111
111
 
112
- /* css-module:/Users/rami/Documents/apps/frontend-react-editor/packages/core/components/ActionBar/styles.module.css/#css-module-data */
112
+ /* css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ActionBar/styles.module.css/#css-module-data */
113
113
  ._ActionBar_5kf61_1 {
114
114
  align-items: center;
115
115
  cursor: default;
@@ -209,7 +209,7 @@
209
209
  height: 100%;
210
210
  }
211
211
 
212
- /* css-module:/Users/rami/Documents/apps/frontend-react-editor/packages/core/components/RichTextMenu/components/Control/styles.module.css/#css-module-data */
212
+ /* css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/RichTextMenu/components/Control/styles.module.css/#css-module-data */
213
213
  ._Control_1aveu_1 .lucide {
214
214
  height: 18px;
215
215
  width: 18px;
@@ -219,7 +219,7 @@
219
219
  width: 16px;
220
220
  }
221
221
 
222
- /* css-module:/Users/rami/Documents/apps/frontend-react-editor/packages/core/components/Select/styles.module.css/#css-module-data */
222
+ /* css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Select/styles.module.css/#css-module-data */
223
223
  ._Select_6nen1_1 {
224
224
  position: relative;
225
225
  z-index: 1;
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  LoadedRichTextMenuInner
3
- } from "./chunk-6Q6A3BQH.mjs";
4
- import "./chunk-HMTHZBH6.mjs";
5
- import "./chunk-ZHNRSSMW.mjs";
6
- import "./chunk-M2RKJTNY.mjs";
7
- import "./chunk-2LVYDXZS.mjs";
8
- import "./chunk-VUEM62JF.mjs";
3
+ } from "./chunk-43G2QHSV.mjs";
4
+ import "./chunk-5N6RK26Z.mjs";
5
+ import "./chunk-DCL4UC2H.mjs";
6
+ import "./chunk-JEDWXGVP.mjs";
7
+ import "./chunk-IUOWXGYR.mjs";
8
+ import "./chunk-UB2DES2O.mjs";
9
9
  import "./chunk-VOLQMQPK.mjs";
10
10
  import "./chunk-Y2EFNT5P.mjs";
11
11
  import "./chunk-GAUBBDIR.mjs";
@@ -1,4 +1,4 @@
1
- import { H as History, f as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, g as RootDataWithProps, h as ResolveDataTrigger, i as Plugin, j as Overrides, V as Viewports, I as IframeConfig, k as UiState, l as ComponentConfig, A as AppState, M as Metadata, m as FieldTransforms, n as RichtextField } from './actions-BCDhqbeL.mjs';
1
+ import { H as History, f as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, g as RootDataWithProps, h as ResolveDataTrigger, i as Plugin, j as Overrides, V as Viewports, I as IframeConfig, k as UiState, l as ComponentConfig, A as AppState, M as Metadata, m as FieldTransforms, n as RichtextField } from './actions-CQmL3wwa.mjs';
2
2
  import { Editor } from '@tiptap/react';
3
3
 
4
4
  type HistorySlice<D = any> = {
@@ -1,4 +1,4 @@
1
- import { H as History, f as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, g as RootDataWithProps, h as ResolveDataTrigger, i as Plugin, j as Overrides, V as Viewports, I as IframeConfig, k as UiState, l as ComponentConfig, A as AppState, M as Metadata, m as FieldTransforms, n as RichtextField } from './actions-BCDhqbeL.js';
1
+ import { H as History, f as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, g as RootDataWithProps, h as ResolveDataTrigger, i as Plugin, j as Overrides, V as Viewports, I as IframeConfig, k as UiState, l as ComponentConfig, A as AppState, M as Metadata, m as FieldTransforms, n as RichtextField } from './actions-CQmL3wwa.js';
2
2
  import { Editor } from '@tiptap/react';
3
3
 
4
4
  type HistorySlice<D = any> = {