@reacteditor/core 0.0.4 → 0.0.6

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 (51) hide show
  1. package/dist/Editor-4LPVLYSU.css +415 -0
  2. package/dist/{Editor-2TYODRQT.mjs → Editor-YNFB7B6Z.mjs} +8 -8
  3. package/dist/{Render-VDC7AEQK.mjs → Render-STFB5CNO.mjs} +1 -1
  4. package/dist/Render-ZTUTUUAH.css +103 -0
  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-VD3EVRUF.mjs → chunk-275EJPEB.mjs} +2 -2
  8. package/dist/{chunk-ZHNRSSMW.mjs → chunk-6LG4Q4HO.mjs} +1 -1
  9. package/dist/chunk-6QJ2HF4O.mjs +11 -0
  10. package/dist/{chunk-6Q6A3BQH.mjs → chunk-BRDUM7MJ.mjs} +15 -15
  11. package/dist/{chunk-2LVYDXZS.mjs → chunk-CRF2GWQA.mjs} +3 -3
  12. package/dist/{chunk-TCVU3WEN.mjs → chunk-DB4R5IWG.mjs} +4 -4
  13. package/dist/{chunk-D2RG73WI.mjs → chunk-HCFEY5Y7.mjs} +475 -288
  14. package/dist/{chunk-VUEM62JF.mjs → chunk-UB2DES2O.mjs} +17 -6
  15. package/dist/{chunk-M2RKJTNY.mjs → chunk-WGPCLAZR.mjs} +1 -1
  16. package/dist/{chunk-HMTHZBH6.mjs → chunk-Z6IIVDFY.mjs} +1 -1
  17. package/dist/{full-7KJICNR5.mjs → full-24FOTNTB.mjs} +6 -6
  18. package/dist/full-7ABPY2WA.css +311 -0
  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 +1307 -1203
  22. package/dist/index.d.mts +11 -20
  23. package/dist/index.d.ts +11 -20
  24. package/dist/index.js +572 -372
  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-DGSPK47E.mjs → loaded-6IBSSOXD.mjs} +3 -3
  31. package/dist/{loaded-IJNA4SY5.mjs → loaded-6NPDD7SF.mjs} +3 -3
  32. package/dist/{loaded-CBJRWD4Z.mjs → loaded-BQVZGQG2.mjs} +3 -3
  33. package/dist/loaded-N4KWL7FV.css +90 -0
  34. package/dist/no-external.css +1307 -1203
  35. package/dist/no-external.d.mts +4 -4
  36. package/dist/no-external.d.ts +4 -4
  37. package/dist/no-external.js +572 -372
  38. package/dist/no-external.mjs +10 -10
  39. package/dist/rsc.css +41 -41
  40. package/dist/rsc.d.mts +2 -2
  41. package/dist/rsc.d.ts +2 -2
  42. package/dist/rsc.js +5 -5
  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 +2 -1
  47. package/dist/Editor-GBV2O5RD.css +0 -415
  48. package/dist/Render-EFT7YD2C.css +0 -103
  49. package/dist/chunk-MFI3RDA4.mjs +0 -11
  50. package/dist/full-ELX6RALJ.css +0 -311
  51. package/dist/loaded-TBSVRJPY.css +0 -90
package/dist/index.mjs CHANGED
@@ -19,14 +19,14 @@ import {
19
19
  setDeep,
20
20
  useEditor,
21
21
  useGetEditor
22
- } from "./chunk-D2RG73WI.mjs";
23
- import "./chunk-TCVU3WEN.mjs";
22
+ } from "./chunk-HCFEY5Y7.mjs";
23
+ import "./chunk-DB4R5IWG.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-275EJPEB.mjs";
29
+ import "./chunk-6QJ2HF4O.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-BRDUM7MJ.mjs";
39
+ import "./chunk-Z6IIVDFY.mjs";
40
+ import "./chunk-6LG4Q4HO.mjs";
41
+ import "./chunk-WGPCLAZR.mjs";
42
+ import "./chunk-CRF2GWQA.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
  useListOptions
3
- } from "./chunk-M2RKJTNY.mjs";
3
+ } from "./chunk-WGPCLAZR.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-CRF2GWQA.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
  useHeadingOptions
3
- } from "./chunk-ZHNRSSMW.mjs";
3
+ } from "./chunk-6LG4Q4HO.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-CRF2GWQA.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
  useAlignOptions
3
- } from "./chunk-HMTHZBH6.mjs";
3
+ } from "./chunk-Z6IIVDFY.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-CRF2GWQA.mjs";
9
+ import "./chunk-UB2DES2O.mjs";
10
10
  import "./chunk-VOLQMQPK.mjs";
11
11
  import "./chunk-Y2EFNT5P.mjs";
12
12
  import "./chunk-GAUBBDIR.mjs";
@@ -0,0 +1,90 @@
1
+ /* css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Select/styles.module.css/#css-module-data */
2
+ ._Select_1hzg4_1 {
3
+ position: relative;
4
+ z-index: 1;
5
+ }
6
+ ._Select-button_1hzg4_6 {
7
+ align-items: center;
8
+ background: transparent;
9
+ border: none;
10
+ border-radius: var(--editor-radius-sm);
11
+ display: flex;
12
+ justify-content: center;
13
+ gap: 0px;
14
+ height: 100%;
15
+ padding: 4px;
16
+ padding-right: 2px;
17
+ transition: background-color var(--editor-motion-fast) var(--editor-ease), color var(--editor-motion-fast) var(--editor-ease);
18
+ }
19
+ ._Select--hasOptions_1hzg4_21 ._Select-button_1hzg4_6 {
20
+ color: currentColor;
21
+ }
22
+ ._Select--hasOptions_1hzg4_21:not(._Select--disabled_1hzg4_25) ._Select-button_1hzg4_6 {
23
+ cursor: pointer;
24
+ }
25
+ ._Select-buttonIcon_1hzg4_29 {
26
+ align-items: center;
27
+ display: flex;
28
+ justify-content: center;
29
+ }
30
+ ._Select--standalone_1hzg4_35 ._Select-buttonIcon_1hzg4_29 .lucide {
31
+ height: 18px;
32
+ width: 18px;
33
+ }
34
+ ._Select--actionBar_1hzg4_40 ._Select-buttonIcon_1hzg4_29 .lucide {
35
+ height: 16px;
36
+ width: 16px;
37
+ }
38
+ ._Select--hasOptions_1hzg4_21:not(._Select--disabled_1hzg4_25) ._Select-button_1hzg4_6:hover,
39
+ ._Select--hasValue_1hzg4_46 ._Select-button_1hzg4_6 {
40
+ background: var(--editor-surface-hover);
41
+ color: var(--editor-text-accent);
42
+ }
43
+ ._Select--disabled_1hzg4_25 ._Select-button_1hzg4_6 {
44
+ color: var(--editor-text-tertiary);
45
+ }
46
+ ._Select--actionBar_1hzg4_40 {
47
+ &._Select--hasOptions_1hzg4_21 ._Select-button_1hzg4_6:hover,
48
+ &._Select--hasValue_1hzg4_46 ._Select-button_1hzg4_6 {
49
+ background: rgba(255, 255, 255, 0.12);
50
+ color: var(--editor-text-inverse);
51
+ }
52
+ }
53
+ ._Select-items_1hzg4_63 {
54
+ background: var(--editor-surface-panel);
55
+ border: 1px solid var(--editor-border-subtle);
56
+ border-radius: var(--editor-radius-lg);
57
+ box-shadow: var(--editor-shadow-lg);
58
+ margin: 10px 8px;
59
+ margin-left: 0;
60
+ padding: 4px;
61
+ z-index: 2;
62
+ list-style: none;
63
+ }
64
+ ._SelectItem_1hzg4_75 {
65
+ background: transparent;
66
+ border-radius: var(--editor-radius-sm);
67
+ border: none;
68
+ color: var(--editor-text-secondary);
69
+ cursor: pointer;
70
+ display: flex;
71
+ gap: 8px;
72
+ align-items: center;
73
+ font-size: var(--editor-font-size-xxs);
74
+ margin: 0;
75
+ padding: 8px 12px;
76
+ width: 100%;
77
+ transition: background-color var(--editor-motion-fast) var(--editor-ease), color var(--editor-motion-fast) var(--editor-ease);
78
+ }
79
+ ._SelectItem--isSelected_1hzg4_92 {
80
+ background: var(--editor-accent-soft);
81
+ color: var(--editor-text-accent);
82
+ font-weight: 500;
83
+ }
84
+ ._SelectItem--isSelected_1hzg4_92 ._SelectItem-icon_1hzg4_98 {
85
+ color: var(--editor-text-accent);
86
+ }
87
+ ._SelectItem_1hzg4_75:hover {
88
+ background: var(--editor-surface-hover);
89
+ color: var(--editor-text-accent);
90
+ }