@reacteditor/core 0.0.3 → 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-QX2COKIL.mjs → chunk-QB3US7UE.mjs} +235 -266
  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 +269 -296
  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 +269 -296
  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 +8 -3
package/dist/index.mjs CHANGED
@@ -19,14 +19,14 @@ import {
19
19
  setDeep,
20
20
  useEditor,
21
21
  useGetEditor
22
- } from "./chunk-QX2COKIL.mjs";
23
- import "./chunk-TCVU3WEN.mjs";
22
+ } from "./chunk-QB3US7UE.mjs";
23
+ import "./chunk-X7IRHSQN.mjs";
24
24
  import {
25
25
  migrate,
26
26
  resolveAllData,
27
27
  transformProps
28
- } from "./chunk-VD3EVRUF.mjs";
29
- import "./chunk-MFI3RDA4.mjs";
28
+ } from "./chunk-YFRH22NT.mjs";
29
+ import "./chunk-KC727YFW.mjs";
30
30
  import {
31
31
  Action,
32
32
  ActionBar,
@@ -35,12 +35,12 @@ import {
35
35
  Label,
36
36
  RichTextMenu,
37
37
  Separator
38
- } from "./chunk-6Q6A3BQH.mjs";
39
- import "./chunk-HMTHZBH6.mjs";
40
- import "./chunk-ZHNRSSMW.mjs";
41
- import "./chunk-M2RKJTNY.mjs";
42
- import "./chunk-2LVYDXZS.mjs";
43
- import "./chunk-VUEM62JF.mjs";
38
+ } from "./chunk-43G2QHSV.mjs";
39
+ import "./chunk-5N6RK26Z.mjs";
40
+ import "./chunk-DCL4UC2H.mjs";
41
+ import "./chunk-JEDWXGVP.mjs";
42
+ import "./chunk-IUOWXGYR.mjs";
43
+ import "./chunk-UB2DES2O.mjs";
44
44
  import "./chunk-VOLQMQPK.mjs";
45
45
  import "./chunk-Y2EFNT5P.mjs";
46
46
  import {
@@ -1,6 +1,6 @@
1
1
  import { Reducer } from 'react';
2
- import { D as Data, A as AppState, O as OnAction, P as PrivateAppState, E as EditorAction } from './actions-BCDhqbeL.mjs';
3
- import { A as AppStore } from './index-DVwiIwYU.mjs';
2
+ import { D as Data, A as AppState, O as OnAction, P as PrivateAppState, E as EditorAction } from './actions-CQmL3wwa.mjs';
3
+ import { A as AppStore } from './index-BOP2qNVA.mjs';
4
4
  import '@tiptap/react';
5
5
  import '@tiptap/extension-blockquote';
6
6
  import '@tiptap/extension-bold';
@@ -1,6 +1,6 @@
1
1
  import { Reducer } from 'react';
2
- import { D as Data, A as AppState, O as OnAction, P as PrivateAppState, E as EditorAction } from './actions-BCDhqbeL.js';
3
- import { A as AppStore } from './index-ComBHfdn.js';
2
+ import { D as Data, A as AppState, O as OnAction, P as PrivateAppState, E as EditorAction } from './actions-CQmL3wwa.js';
3
+ import { A as AppStore } from './index-_G46lHpL.js';
4
4
  import '@tiptap/react';
5
5
  import '@tiptap/extension-blockquote';
6
6
  import '@tiptap/extension-bold';
package/dist/internal.js CHANGED
@@ -491,20 +491,31 @@ var populateIds = (data, config, override = false) => {
491
491
 
492
492
  // reducer/actions/insert.ts
493
493
  function insertAction(state, action, appStore) {
494
+ var _a, _b;
494
495
  const id = action.id || generateId(action.componentType);
496
+ const componentConfig = appStore.config.components[action.componentType];
497
+ const isGlobalType = (componentConfig == null ? void 0 : componentConfig.global) === true;
498
+ const defaultProps = (componentConfig == null ? void 0 : componentConfig.defaultProps) || {};
495
499
  const emptyComponentData = populateIds(
496
- {
500
+ __spreadValues({
497
501
  type: action.componentType,
498
- props: __spreadProps(__spreadValues({}, appStore.config.components[action.componentType].defaultProps || {}), {
499
- id
500
- })
501
- },
502
+ props: __spreadProps(__spreadValues({}, defaultProps), { id })
503
+ }, isGlobalType ? { synced: true } : {}),
502
504
  appStore.config
503
505
  );
504
506
  const [parentId] = action.destinationZone.split(":");
505
507
  const idsInPath = getIdsForParent(action.destinationZone, state);
508
+ let nextData = state.data;
509
+ if (isGlobalType && !((_a = nextData.globals) != null ? _a : {})[action.componentType]) {
510
+ nextData = __spreadProps(__spreadValues({}, nextData), {
511
+ globals: __spreadProps(__spreadValues({}, (_b = nextData.globals) != null ? _b : {}), {
512
+ [action.componentType]: { props: __spreadValues({}, defaultProps) }
513
+ })
514
+ });
515
+ }
516
+ const seededState = nextData === state.data ? state : __spreadProps(__spreadValues({}, state), { data: nextData });
506
517
  return walkAppState(
507
- state,
518
+ seededState,
508
519
  appStore.config,
509
520
  (content, zoneCompound) => {
510
521
  if (zoneCompound === action.destinationZone) {
package/dist/internal.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createReducer
3
- } from "./chunk-VUEM62JF.mjs";
3
+ } from "./chunk-UB2DES2O.mjs";
4
4
  import "./chunk-GAUBBDIR.mjs";
5
5
  import {
6
6
  init_react_import
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  useHeadingOptions
3
- } from "./chunk-ZHNRSSMW.mjs";
3
+ } from "./chunk-DCL4UC2H.mjs";
4
4
  import {
5
5
  Heading,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-2LVYDXZS.mjs";
9
- import "./chunk-VUEM62JF.mjs";
8
+ } from "./chunk-IUOWXGYR.mjs";
9
+ import "./chunk-UB2DES2O.mjs";
10
10
  import "./chunk-VOLQMQPK.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
12
  import "./chunk-GAUBBDIR.mjs";
@@ -1,4 +1,4 @@
1
- /* css-module:/Users/rami/Documents/apps/frontend-react-editor/packages/core/components/Select/styles.module.css/#css-module-data */
1
+ /* css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Select/styles.module.css/#css-module-data */
2
2
  ._Select_6nen1_1 {
3
3
  position: relative;
4
4
  z-index: 1;
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  useAlignOptions
3
- } from "./chunk-HMTHZBH6.mjs";
3
+ } from "./chunk-5N6RK26Z.mjs";
4
4
  import {
5
5
  AlignLeft,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-2LVYDXZS.mjs";
9
- import "./chunk-VUEM62JF.mjs";
8
+ } from "./chunk-IUOWXGYR.mjs";
9
+ import "./chunk-UB2DES2O.mjs";
10
10
  import "./chunk-VOLQMQPK.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
12
  import "./chunk-GAUBBDIR.mjs";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  useListOptions
3
- } from "./chunk-M2RKJTNY.mjs";
3
+ } from "./chunk-JEDWXGVP.mjs";
4
4
  import {
5
5
  List,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-2LVYDXZS.mjs";
9
- import "./chunk-VUEM62JF.mjs";
8
+ } from "./chunk-IUOWXGYR.mjs";
9
+ import "./chunk-UB2DES2O.mjs";
10
10
  import "./chunk-VOLQMQPK.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
12
  import "./chunk-GAUBBDIR.mjs";