@developer_tribe/react-builder 1.0.6 → 1.0.8

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 (63) hide show
  1. package/dist/build-components/patterns.generated.d.ts +56 -56
  2. package/dist/components/AttributesEditorPanel.d.ts +2 -2
  3. package/dist/components/BottomBar.d.ts +6 -2
  4. package/dist/components/Checkbox.d.ts +1 -1
  5. package/dist/index.cjs.js +3 -3
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.d.ts +2 -1
  8. package/dist/index.esm.js +3 -3
  9. package/dist/index.esm.js.map +1 -1
  10. package/dist/index.native.cjs.js +1 -1
  11. package/dist/index.native.cjs.js.map +1 -1
  12. package/dist/index.native.esm.js +4 -4
  13. package/dist/index.native.esm.js.map +1 -1
  14. package/dist/modals/ScreenColorsModal.d.ts +1 -1
  15. package/dist/pages/ProjectPage.d.ts +3 -2
  16. package/dist/pages/tabs/BuilderPanel.d.ts +2 -2
  17. package/dist/pages/tabs/SideTool.d.ts +8 -0
  18. package/dist/store.d.ts +0 -6
  19. package/dist/styles.css +1 -1
  20. package/package.json +5 -2
  21. package/src/RenderPage.tsx +1 -4
  22. package/src/assets/samples/carousel-sample.json +81 -99
  23. package/src/assets/samples/simple-1.json +2 -8
  24. package/src/assets/samples/simple-2.json +9 -36
  25. package/src/assets/samples/vpn-onboard-1.json +23 -27
  26. package/src/assets/samples/vpn-onboard-2.json +275 -279
  27. package/src/assets/samples/vpn-onboard-3.json +246 -247
  28. package/src/assets/samples/vpn-onboard-4.json +246 -247
  29. package/src/assets/samples/vpn-onboard-5.json +369 -375
  30. package/src/assets/samples/vpn-onboard-6.json +248 -252
  31. package/src/build-components/View/pattern.json +2 -2
  32. package/src/build-components/patterns.generated.ts +56 -56
  33. package/src/components/AttributesEditorPanel.tsx +8 -12
  34. package/src/components/BottomBar.tsx +31 -25
  35. package/src/components/EditorHeader.tsx +4 -11
  36. package/src/index.ts +2 -1
  37. package/src/modals/ScreenColorsModal.tsx +57 -51
  38. package/src/pages/ProjectPage.tsx +147 -48
  39. package/src/pages/tabs/BuilderPanel.tsx +8 -14
  40. package/src/pages/tabs/SideTool.tsx +253 -0
  41. package/src/store.ts +6 -10
  42. package/src/styles/base/_global.scss +29 -32
  43. package/src/styles/components/_attributes-editor.scss +27 -33
  44. package/src/styles/components/_bottom-bar.scss +11 -23
  45. package/src/styles/components/_editor-shell.scss +38 -18
  46. package/src/styles/components/_mockos-router.scss +16 -14
  47. package/src/styles/components/_ui-components.scss +14 -15
  48. package/src/styles/foundation/_colors.scss +28 -8
  49. package/src/styles/foundation/_mixins.scss +1 -1
  50. package/src/styles/foundation/_sizes.scss +4 -2
  51. package/src/styles/layout/_builder.scss +1 -1
  52. package/src/styles/modals/_add-component.scss +2 -2
  53. package/src/styles/modals/_color-modal.scss +2 -2
  54. package/src/styles/modals/_modal-shell.scss +1 -1
  55. package/src/utils/analyseNodeByPatterns.ts +0 -15
  56. package/dist/components/MobilePanelToggleButton.d.ts +0 -8
  57. package/dist/hooks/useMinimumDelay.d.ts +0 -7
  58. package/dist/hooks/useMobileEditorPanels.d.ts +0 -12
  59. package/dist/hooks/useSyncProjectPageStore.d.ts +0 -15
  60. package/src/components/MobilePanelToggleButton.tsx +0 -39
  61. package/src/hooks/useMinimumDelay.ts +0 -20
  62. package/src/hooks/useMobileEditorPanels.ts +0 -56
  63. package/src/hooks/useSyncProjectPageStore.ts +0 -40
@@ -106,8 +106,8 @@ export const patterns = [
106
106
  sort: 4,
107
107
  },
108
108
  scrollable: {
109
- label: 'Scrollable (!!)',
110
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
109
+ label: 'Scrollable',
110
+ description: 'Turns scroll interaction on.',
111
111
  category: 'container',
112
112
  specialCategory: null,
113
113
  sort: -1,
@@ -522,8 +522,8 @@ export const patterns = [
522
522
  },
523
523
  attributes: {
524
524
  scrollable: {
525
- label: 'Scrollable (!!)',
526
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
525
+ label: 'Scrollable',
526
+ description: 'Turns scroll interaction on.',
527
527
  category: 'container',
528
528
  specialCategory: null,
529
529
  sort: -1,
@@ -912,8 +912,8 @@ export const patterns = [
912
912
  },
913
913
  attributes: {
914
914
  scrollable: {
915
- label: 'Scrollable (!!)',
916
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
915
+ label: 'Scrollable',
916
+ description: 'Turns scroll interaction on.',
917
917
  category: 'container',
918
918
  specialCategory: null,
919
919
  sort: -1,
@@ -1288,8 +1288,8 @@ export const patterns = [
1288
1288
  },
1289
1289
  attributes: {
1290
1290
  scrollable: {
1291
- label: 'Scrollable (!!)',
1292
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
1291
+ label: 'Scrollable',
1292
+ description: 'Turns scroll interaction on.',
1293
1293
  category: 'container',
1294
1294
  specialCategory: null,
1295
1295
  sort: -1,
@@ -1640,8 +1640,8 @@ export const patterns = [
1640
1640
  },
1641
1641
  attributes: {
1642
1642
  scrollable: {
1643
- label: 'Scrollable (!!)',
1644
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
1643
+ label: 'Scrollable',
1644
+ description: 'Turns scroll interaction on.',
1645
1645
  category: 'container',
1646
1646
  specialCategory: null,
1647
1647
  sort: -1,
@@ -2012,8 +2012,8 @@ export const patterns = [
2012
2012
  },
2013
2013
  attributes: {
2014
2014
  scrollable: {
2015
- label: 'Scrollable (!!)',
2016
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
2015
+ label: 'Scrollable',
2016
+ description: 'Turns scroll interaction on.',
2017
2017
  category: 'container',
2018
2018
  specialCategory: null,
2019
2019
  sort: -1,
@@ -2369,8 +2369,8 @@ export const patterns = [
2369
2369
  },
2370
2370
  attributes: {
2371
2371
  scrollable: {
2372
- label: 'Scrollable (!!)',
2373
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
2372
+ label: 'Scrollable',
2373
+ description: 'Turns scroll interaction on.',
2374
2374
  category: 'container',
2375
2375
  specialCategory: null,
2376
2376
  sort: -1,
@@ -2719,8 +2719,8 @@ export const patterns = [
2719
2719
  },
2720
2720
  attributes: {
2721
2721
  scrollable: {
2722
- label: 'Scrollable (!!)',
2723
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
2722
+ label: 'Scrollable',
2723
+ description: 'Turns scroll interaction on.',
2724
2724
  category: 'container',
2725
2725
  specialCategory: null,
2726
2726
  sort: -1,
@@ -3071,8 +3071,8 @@ export const patterns = [
3071
3071
  },
3072
3072
  attributes: {
3073
3073
  scrollable: {
3074
- label: 'Scrollable (!!)',
3075
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
3074
+ label: 'Scrollable',
3075
+ description: 'Turns scroll interaction on.',
3076
3076
  category: 'container',
3077
3077
  specialCategory: null,
3078
3078
  sort: -1,
@@ -3434,8 +3434,8 @@ export const patterns = [
3434
3434
  },
3435
3435
  attributes: {
3436
3436
  scrollable: {
3437
- label: 'Scrollable (!!)',
3438
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
3437
+ label: 'Scrollable',
3438
+ description: 'Turns scroll interaction on.',
3439
3439
  category: 'container',
3440
3440
  specialCategory: null,
3441
3441
  sort: -1,
@@ -3802,8 +3802,8 @@ export const patterns = [
3802
3802
  },
3803
3803
  attributes: {
3804
3804
  scrollable: {
3805
- label: 'Scrollable (!!)',
3806
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
3805
+ label: 'Scrollable',
3806
+ description: 'Turns scroll interaction on.',
3807
3807
  category: 'container',
3808
3808
  specialCategory: null,
3809
3809
  sort: -1,
@@ -4165,8 +4165,8 @@ export const patterns = [
4165
4165
  },
4166
4166
  attributes: {
4167
4167
  scrollable: {
4168
- label: 'Scrollable (!!)',
4169
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
4168
+ label: 'Scrollable',
4169
+ description: 'Turns scroll interaction on.',
4170
4170
  category: 'container',
4171
4171
  specialCategory: null,
4172
4172
  sort: -1,
@@ -4571,8 +4571,8 @@ export const patterns = [
4571
4571
  },
4572
4572
  attributes: {
4573
4573
  scrollable: {
4574
- label: 'Scrollable (!!)',
4575
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
4574
+ label: 'Scrollable',
4575
+ description: 'Turns scroll interaction on.',
4576
4576
  category: 'container',
4577
4577
  specialCategory: null,
4578
4578
  sort: -1,
@@ -4974,8 +4974,8 @@ export const patterns = [
4974
4974
  },
4975
4975
  attributes: {
4976
4976
  scrollable: {
4977
- label: 'Scrollable (!!)',
4978
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
4977
+ label: 'Scrollable',
4978
+ description: 'Turns scroll interaction on.',
4979
4979
  category: 'container',
4980
4980
  specialCategory: null,
4981
4981
  sort: -1,
@@ -5378,8 +5378,8 @@ export const patterns = [
5378
5378
  sort: 4,
5379
5379
  },
5380
5380
  scrollable: {
5381
- label: 'Scrollable (!!)',
5382
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
5381
+ label: 'Scrollable',
5382
+ description: 'Turns scroll interaction on.',
5383
5383
  category: 'container',
5384
5384
  specialCategory: null,
5385
5385
  sort: -1,
@@ -5816,8 +5816,8 @@ export const patterns = [
5816
5816
  sort: 4,
5817
5817
  },
5818
5818
  scrollable: {
5819
- label: 'Scrollable (!!)',
5820
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
5819
+ label: 'Scrollable',
5820
+ description: 'Turns scroll interaction on.',
5821
5821
  category: 'container',
5822
5822
  specialCategory: null,
5823
5823
  sort: -1,
@@ -6191,8 +6191,8 @@ export const patterns = [
6191
6191
  },
6192
6192
  attributes: {
6193
6193
  scrollable: {
6194
- label: 'Scrollable (!!)',
6195
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
6194
+ label: 'Scrollable',
6195
+ description: 'Turns scroll interaction on.',
6196
6196
  category: 'container',
6197
6197
  specialCategory: null,
6198
6198
  sort: -1,
@@ -6553,8 +6553,8 @@ export const patterns = [
6553
6553
  },
6554
6554
  attributes: {
6555
6555
  scrollable: {
6556
- label: 'Scrollable (!!)',
6557
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
6556
+ label: 'Scrollable',
6557
+ description: 'Turns scroll interaction on.',
6558
6558
  category: 'container',
6559
6559
  specialCategory: null,
6560
6560
  sort: -1,
@@ -6924,8 +6924,8 @@ export const patterns = [
6924
6924
  sort: 4,
6925
6925
  },
6926
6926
  scrollable: {
6927
- label: 'Scrollable (!!)',
6928
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
6927
+ label: 'Scrollable',
6928
+ description: 'Turns scroll interaction on.',
6929
6929
  category: 'container',
6930
6930
  specialCategory: null,
6931
6931
  sort: -1,
@@ -7325,8 +7325,8 @@ export const patterns = [
7325
7325
  sort: 4,
7326
7326
  },
7327
7327
  scrollable: {
7328
- label: 'Scrollable (!!)',
7329
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
7328
+ label: 'Scrollable',
7329
+ description: 'Turns scroll interaction on.',
7330
7330
  category: 'container',
7331
7331
  specialCategory: null,
7332
7332
  sort: -1,
@@ -7708,8 +7708,8 @@ export const patterns = [
7708
7708
  },
7709
7709
  attributes: {
7710
7710
  scrollable: {
7711
- label: 'Scrollable (!!)',
7712
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
7711
+ label: 'Scrollable',
7712
+ description: 'Turns scroll interaction on.',
7713
7713
  category: 'container',
7714
7714
  specialCategory: null,
7715
7715
  sort: -1,
@@ -8107,8 +8107,8 @@ export const patterns = [
8107
8107
  sort: 4,
8108
8108
  },
8109
8109
  scrollable: {
8110
- label: 'Scrollable (!!)',
8111
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
8110
+ label: 'Scrollable',
8111
+ description: 'Turns scroll interaction on.',
8112
8112
  category: 'container',
8113
8113
  specialCategory: null,
8114
8114
  sort: -1,
@@ -8498,8 +8498,8 @@ export const patterns = [
8498
8498
  },
8499
8499
  attributes: {
8500
8500
  scrollable: {
8501
- label: 'Scrollable (!!)',
8502
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
8501
+ label: 'Scrollable',
8502
+ description: 'Turns scroll interaction on.',
8503
8503
  category: 'container',
8504
8504
  specialCategory: null,
8505
8505
  sort: -1,
@@ -8855,8 +8855,8 @@ export const patterns = [
8855
8855
  },
8856
8856
  attributes: {
8857
8857
  scrollable: {
8858
- label: 'Scrollable (!!)',
8859
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
8858
+ label: 'Scrollable',
8859
+ description: 'Turns scroll interaction on.',
8860
8860
  category: 'container',
8861
8861
  specialCategory: null,
8862
8862
  sort: -1,
@@ -9222,8 +9222,8 @@ export const patterns = [
9222
9222
  sort: 3,
9223
9223
  },
9224
9224
  scrollable: {
9225
- label: 'Scrollable (!!)',
9226
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
9225
+ label: 'Scrollable',
9226
+ description: 'Turns scroll interaction on.',
9227
9227
  category: 'container',
9228
9228
  specialCategory: null,
9229
9229
  sort: -1,
@@ -9614,8 +9614,8 @@ export const patterns = [
9614
9614
  },
9615
9615
  attributes: {
9616
9616
  scrollable: {
9617
- label: 'Scrollable (!!)',
9618
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
9617
+ label: 'Scrollable',
9618
+ description: 'Turns scroll interaction on.',
9619
9619
  category: 'container',
9620
9620
  specialCategory: null,
9621
9621
  sort: -1,
@@ -10001,8 +10001,8 @@ export const patterns = [
10001
10001
  },
10002
10002
  attributes: {
10003
10003
  scrollable: {
10004
- label: 'Scrollable (!!)',
10005
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
10004
+ label: 'Scrollable',
10005
+ description: 'Turns scroll interaction on.',
10006
10006
  category: 'container',
10007
10007
  specialCategory: null,
10008
10008
  sort: -1,
@@ -10380,8 +10380,8 @@ export const patterns = [
10380
10380
  },
10381
10381
  attributes: {
10382
10382
  scrollable: {
10383
- label: 'Scrollable (!!)',
10384
- description: 'THIS FEATURE MIGHT NOT WORK IN MOBILE!',
10383
+ label: 'Scrollable',
10384
+ description: 'Turns scroll interaction on.',
10385
10385
  category: 'container',
10386
10386
  specialCategory: null,
10387
10387
  sort: -1,
@@ -5,8 +5,8 @@ import { useLogRender } from '../utils/useLogRender';
5
5
  import { useRenderStore } from '../store';
6
6
 
7
7
  interface AttributesEditorPanelProps {
8
- attributes?: any;
9
- onChange?: (data: Node) => void;
8
+ attributes: any;
9
+ onChange: (data: Node) => void;
10
10
  projectColors?: ProjectColors;
11
11
  }
12
12
 
@@ -16,14 +16,10 @@ export function AttributesEditorPanel({
16
16
  projectColors,
17
17
  }: AttributesEditorPanelProps) {
18
18
  useLogRender('AttributesEditorPanel');
19
- const { current, setCurrent, editorData, setEditorData } = useRenderStore(
20
- (s) => ({
21
- current: s.current,
22
- setCurrent: s.setCurrent,
23
- editorData: s.editorData,
24
- setEditorData: s.setEditorData,
25
- }),
26
- );
19
+ const { current, setCurrent } = useRenderStore((s) => ({
20
+ current: s.current,
21
+ setCurrent: s.setCurrent,
22
+ }));
27
23
  if (!current) return null;
28
24
 
29
25
  function replaceNode(root: Node, target: Node, next: Node): Node {
@@ -53,9 +49,9 @@ export function AttributesEditorPanel({
53
49
  return root;
54
50
  }
55
51
  const handleAttributesChange = (next: Node) => {
56
- const root = (attributes ?? editorData) as Node;
52
+ const root = attributes as Node;
57
53
  const updated = replaceNode(root, current, next);
58
- (onChange ?? setEditorData)(updated);
54
+ onChange(updated);
59
55
  setCurrent(next);
60
56
  };
61
57
 
@@ -11,33 +11,27 @@ import { analyseAndProccess } from '../utils/analyseNode';
11
11
 
12
12
  type BottomBarProps = {
13
13
  className?: string;
14
+ data: Node;
15
+ setData: React.Dispatch<React.SetStateAction<Node>>;
14
16
  };
15
17
 
16
18
  /**
17
- * Empty placeholder bottom bar (Figma-like). We'll complete later.
19
+ * Bottom tool bar (Figma-like).
18
20
  */
19
- export function BottomBar({ className }: BottomBarProps) {
21
+ export function BottomBar({ className, data, setData }: BottomBarProps) {
20
22
  const rtlIcon: IconsType = 'translate';
21
23
  const magicCursorIcon: IconsType = 'magicpen';
22
24
  const debugIcon: IconsType = 'speedometer-03';
23
25
  const localizationIcon: IconsType = 'globe-01';
24
26
  const colorIcon: IconsType = 'colors';
25
27
 
26
- const {
27
- appConfig,
28
- setAppConfig,
29
- previewMode,
30
- setPreviewMode,
31
- editorData,
32
- setEditorData,
33
- } = useRenderStore((s) => ({
34
- appConfig: s.appConfig,
35
- setAppConfig: s.setAppConfig,
36
- previewMode: s.previewMode,
37
- setPreviewMode: s.setPreviewMode,
38
- editorData: s.editorData,
39
- setEditorData: s.setEditorData,
40
- }));
28
+ const { appConfig, setAppConfig, previewMode, setPreviewMode } =
29
+ useRenderStore((s) => ({
30
+ appConfig: s.appConfig,
31
+ setAppConfig: s.setAppConfig,
32
+ previewMode: s.previewMode,
33
+ setPreviewMode: s.setPreviewMode,
34
+ }));
41
35
 
42
36
  const [isDebugOpen, setIsDebugOpen] = useState(false);
43
37
  const [isLocalizationOpen, setIsLocalizationOpen] = useState(false);
@@ -46,8 +40,8 @@ export function BottomBar({ className }: BottomBarProps) {
46
40
  const languages = useMemo(() => ['en', 'tr', 'ar'], []);
47
41
  const activeLanguage = appConfig.defaultLanguage ?? 'en';
48
42
 
49
- const handleLocalicationChange = (data: Localication) => {
50
- setAppConfig({ ...appConfig, localication: data });
43
+ const handleLocalicationChange = (next: Localication) => {
44
+ setAppConfig({ ...appConfig, localication: next });
51
45
  };
52
46
 
53
47
  const themeIsActive = appConfig.theme === 'dark';
@@ -72,9 +66,12 @@ export function BottomBar({ className }: BottomBarProps) {
72
66
  >
73
67
  <Icon iconType={themeIcon} size={20} color="currentColor" alt="" />
74
68
  </button>
69
+
75
70
  <button
76
71
  type="button"
77
- className={`rb-bottom-bar__button rb-bottom-bar__button--rtl${rtlIsActive ? ' is-active' : ''}`}
72
+ className={`rb-bottom-bar__button rb-bottom-bar__button--rtl${
73
+ rtlIsActive ? ' is-active' : ''
74
+ }`}
78
75
  aria-label="RTL"
79
76
  aria-pressed={rtlIsActive}
80
77
  onClick={() =>
@@ -84,9 +81,12 @@ export function BottomBar({ className }: BottomBarProps) {
84
81
  <Icon iconType={rtlIcon} size={18} color="currentColor" alt="" />
85
82
  <span className="rb-bottom-bar__rtl-text">RTL</span>
86
83
  </button>
84
+
87
85
  <button
88
86
  type="button"
89
- className={`rb-bottom-bar__button rb-bottom-bar__button--preview${previewIsActive ? ' is-active' : ''}`}
87
+ className={`rb-bottom-bar__button rb-bottom-bar__button--preview${
88
+ previewIsActive ? ' is-active' : ''
89
+ }`}
90
90
  aria-label="Magic cursor tool"
91
91
  aria-pressed={previewIsActive}
92
92
  onClick={() => setPreviewMode(!previewMode)}
@@ -108,9 +108,12 @@ export function BottomBar({ className }: BottomBarProps) {
108
108
  >
109
109
  <Icon iconType={debugIcon} size={20} color="currentColor" alt="" />
110
110
  </button>
111
+
111
112
  <button
112
113
  type="button"
113
- className={`rb-bottom-bar__button${isLocalizationOpen ? ' is-active' : ''}`}
114
+ className={`rb-bottom-bar__button${
115
+ isLocalizationOpen ? ' is-active' : ''
116
+ }`}
114
117
  aria-label="Localization"
115
118
  aria-pressed={isLocalizationOpen}
116
119
  onClick={() => setIsLocalizationOpen(true)}
@@ -122,6 +125,7 @@ export function BottomBar({ className }: BottomBarProps) {
122
125
  alt=""
123
126
  />
124
127
  </button>
128
+
125
129
  <button
126
130
  type="button"
127
131
  className={`rb-bottom-bar__button${isColorsOpen ? ' is-active' : ''}`}
@@ -139,7 +143,9 @@ export function BottomBar({ className }: BottomBarProps) {
139
143
  <button
140
144
  key={language}
141
145
  type="button"
142
- className={`rb-bottom-bar__lang${activeLanguage === language ? ' is-active' : ''}`}
146
+ className={`rb-bottom-bar__lang${
147
+ activeLanguage === language ? ' is-active' : ''
148
+ }`}
143
149
  onClick={() =>
144
150
  setAppConfig({ ...appConfig, defaultLanguage: language })
145
151
  }
@@ -221,9 +227,9 @@ export function BottomBar({ className }: BottomBarProps) {
221
227
  >
222
228
  <JsonTextEditor
223
229
  rootName="node"
224
- value={editorData ?? {}}
230
+ value={data ?? {}}
225
231
  onChange={(next) =>
226
- setEditorData(analyseAndProccess(next as Node) as Node)
232
+ setData(analyseAndProccess(next as Node) as Node)
227
233
  }
228
234
  className="localication-modal__json-editor"
229
235
  />
@@ -27,9 +27,6 @@ export function EditorHeader({
27
27
  useLogRender('EditorHeader');
28
28
  const [isDevicesModalOpen, setIsDevicesModalOpen] = useState(false);
29
29
  const copiedNode = useRenderStore((s) => s.copiedNode);
30
- const storeCurrent = useRenderStore((s) => s.current);
31
- const storeEditorData = useRenderStore((s) => s.editorData);
32
- const storeSetEditorData = useRenderStore((s) => s.setEditorData);
33
30
  const {
34
31
  device: selectedDevice,
35
32
  setDevice,
@@ -39,9 +36,6 @@ export function EditorHeader({
39
36
  setDevice: s.setDevice,
40
37
  setCurrent: s.setCurrent,
41
38
  }));
42
- const effectiveCurrent = current ?? storeCurrent;
43
- const effectiveEditorData = editorData ?? storeEditorData;
44
- const effectiveSetEditorData = setEditorData ?? storeSetEditorData;
45
39
 
46
40
  function replaceNode(root: Node, target: Node, next: Node): Node {
47
41
  if (root === target) return next;
@@ -70,18 +64,17 @@ export function EditorHeader({
70
64
  return root;
71
65
  }
72
66
  const handleCopy = () => {
73
- if (effectiveCurrent) copyNode(effectiveCurrent);
67
+ if (current) copyNode(current);
74
68
  };
75
69
  const handlePaste = () => {
76
- if (!effectiveCurrent || !effectiveEditorData || !effectiveSetEditorData)
77
- return;
70
+ if (!current || !editorData || !setEditorData) return;
78
71
  if (!copiedNode) return;
79
72
  const cloned = JSON.parse(JSON.stringify(copiedNode)) as Node;
80
- const updated = replaceNode(effectiveEditorData, effectiveCurrent, cloned);
73
+ const updated = replaceNode(editorData, current, cloned);
81
74
  useRenderStore.setState({
82
75
  copiedNode: null,
83
76
  });
84
- effectiveSetEditorData(updated);
77
+ setEditorData(updated);
85
78
  //TODO: current and editor must be sync!! and tested more
86
79
  // Important: selection is stored by reference. After replacing `current` in the tree,
87
80
  // we must point selection to the new (cloned) node reference to keep "current node"
package/src/index.ts CHANGED
@@ -28,7 +28,8 @@ export { getOnboardSamples } from './assets/samples/getSamples';
28
28
  export { RenderPage } from './RenderPage';
29
29
  export { DeviceMockFrame } from './DeviceMockFrame';
30
30
  export { novaToJson } from './utils/novaToJson';
31
- export type { Localication } from './types/PreviewConfig';
31
+ export type { AppConfig, Localication } from './types/PreviewConfig';
32
+ export { defaultAppConfig } from './types/PreviewConfig';
32
33
  export { getDevices, getDefaultDevice } from './utils/getDevices';
33
34
  export type { Device } from './types/Device';
34
35
  export { AttributesEditor };