@developer_tribe/react-builder 1.0.6 → 1.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/build-components/patterns.generated.d.ts +56 -56
- package/dist/components/AttributesEditorPanel.d.ts +2 -2
- package/dist/components/BottomBar.d.ts +6 -2
- package/dist/components/Checkbox.d.ts +1 -1
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +3 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.cjs.js +1 -1
- package/dist/index.native.cjs.js.map +1 -1
- package/dist/index.native.esm.js +4 -4
- package/dist/index.native.esm.js.map +1 -1
- package/dist/modals/ScreenColorsModal.d.ts +1 -1
- package/dist/pages/ProjectPage.d.ts +3 -2
- package/dist/pages/tabs/BuilderPanel.d.ts +2 -2
- package/dist/pages/tabs/SideTool.d.ts +8 -0
- package/dist/store.d.ts +0 -6
- package/dist/styles.css +1 -1
- package/package.json +5 -2
- package/src/RenderPage.tsx +1 -4
- package/src/assets/samples/carousel-sample.json +81 -99
- package/src/assets/samples/simple-1.json +2 -8
- package/src/assets/samples/simple-2.json +9 -36
- package/src/assets/samples/vpn-onboard-1.json +23 -27
- package/src/assets/samples/vpn-onboard-2.json +275 -279
- package/src/assets/samples/vpn-onboard-3.json +246 -247
- package/src/assets/samples/vpn-onboard-4.json +246 -247
- package/src/assets/samples/vpn-onboard-5.json +369 -375
- package/src/assets/samples/vpn-onboard-6.json +248 -252
- package/src/build-components/View/pattern.json +2 -2
- package/src/build-components/patterns.generated.ts +56 -56
- package/src/components/AttributesEditorPanel.tsx +8 -12
- package/src/components/BottomBar.tsx +75 -69
- package/src/components/EditorHeader.tsx +4 -11
- package/src/index.ts +2 -1
- package/src/modals/ScreenColorsModal.tsx +57 -51
- package/src/pages/ProjectPage.tsx +168 -69
- package/src/pages/tabs/BuilderPanel.tsx +8 -14
- package/src/pages/tabs/SideTool.tsx +253 -0
- package/src/store.ts +6 -10
- package/src/styles/base/_global.scss +29 -32
- package/src/styles/components/_attributes-editor.scss +27 -33
- package/src/styles/components/_bottom-bar.scss +11 -23
- package/src/styles/components/_editor-shell.scss +38 -18
- package/src/styles/components/_mockos-router.scss +16 -14
- package/src/styles/components/_ui-components.scss +14 -15
- package/src/styles/foundation/_colors.scss +28 -8
- package/src/styles/foundation/_mixins.scss +1 -1
- package/src/styles/foundation/_sizes.scss +4 -2
- package/src/styles/layout/_builder.scss +1 -1
- package/src/styles/modals/_add-component.scss +2 -2
- package/src/styles/modals/_color-modal.scss +2 -2
- package/src/styles/modals/_modal-shell.scss +1 -1
- package/src/utils/analyseNodeByPatterns.ts +0 -15
- package/dist/components/MobilePanelToggleButton.d.ts +0 -8
- package/dist/hooks/useMinimumDelay.d.ts +0 -7
- package/dist/hooks/useMobileEditorPanels.d.ts +0 -12
- package/dist/hooks/useSyncProjectPageStore.d.ts +0 -15
- package/src/components/MobilePanelToggleButton.tsx +0 -39
- package/src/hooks/useMinimumDelay.ts +0 -20
- package/src/hooks/useMobileEditorPanels.ts +0 -56
- 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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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
|
|
9
|
-
onChange
|
|
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
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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 =
|
|
52
|
+
const root = attributes as Node;
|
|
57
53
|
const updated = replaceNode(root, current, next);
|
|
58
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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 = (
|
|
50
|
-
setAppConfig({ ...appConfig, localication:
|
|
43
|
+
const handleLocalicationChange = (next: Localication) => {
|
|
44
|
+
setAppConfig({ ...appConfig, localication: next });
|
|
51
45
|
};
|
|
52
46
|
|
|
53
47
|
const themeIsActive = appConfig.theme === 'dark';
|
|
@@ -59,9 +53,9 @@ export function BottomBar({ className }: BottomBarProps) {
|
|
|
59
53
|
<>
|
|
60
54
|
<div className={['rb-bottom-bar', className].filter(Boolean).join(' ')}>
|
|
61
55
|
<button
|
|
62
|
-
type=
|
|
56
|
+
type='button'
|
|
63
57
|
className={`rb-bottom-bar__button${themeIsActive ? ' is-active' : ''}`}
|
|
64
|
-
aria-label=
|
|
58
|
+
aria-label='Theme'
|
|
65
59
|
aria-pressed={themeIsActive}
|
|
66
60
|
onClick={() =>
|
|
67
61
|
setAppConfig({
|
|
@@ -70,76 +64,88 @@ export function BottomBar({ className }: BottomBarProps) {
|
|
|
70
64
|
})
|
|
71
65
|
}
|
|
72
66
|
>
|
|
73
|
-
<Icon iconType={themeIcon} size={20} color=
|
|
67
|
+
<Icon iconType={themeIcon} size={20} color='currentColor' alt='' />
|
|
74
68
|
</button>
|
|
69
|
+
|
|
75
70
|
<button
|
|
76
|
-
type=
|
|
77
|
-
className={`rb-bottom-bar__button rb-bottom-bar__button--rtl${
|
|
78
|
-
|
|
71
|
+
type='button'
|
|
72
|
+
className={`rb-bottom-bar__button rb-bottom-bar__button--rtl${
|
|
73
|
+
rtlIsActive ? ' is-active' : ''
|
|
74
|
+
}`}
|
|
75
|
+
aria-label='RTL'
|
|
79
76
|
aria-pressed={rtlIsActive}
|
|
80
77
|
onClick={() =>
|
|
81
78
|
setAppConfig({ ...appConfig, isRtl: !(appConfig.isRtl ?? false) })
|
|
82
79
|
}
|
|
83
80
|
>
|
|
84
|
-
<Icon iconType={rtlIcon} size={18} color=
|
|
85
|
-
<span className=
|
|
81
|
+
<Icon iconType={rtlIcon} size={18} color='currentColor' alt='' />
|
|
82
|
+
<span className='rb-bottom-bar__rtl-text'>RTL</span>
|
|
86
83
|
</button>
|
|
84
|
+
|
|
87
85
|
<button
|
|
88
|
-
type=
|
|
89
|
-
className={`rb-bottom-bar__button rb-bottom-bar__button--preview${
|
|
90
|
-
|
|
86
|
+
type='button'
|
|
87
|
+
className={`rb-bottom-bar__button rb-bottom-bar__button--preview${
|
|
88
|
+
previewIsActive ? ' is-active' : ''
|
|
89
|
+
}`}
|
|
90
|
+
aria-label='Magic cursor tool'
|
|
91
91
|
aria-pressed={previewIsActive}
|
|
92
92
|
onClick={() => setPreviewMode(!previewMode)}
|
|
93
93
|
>
|
|
94
94
|
<Icon
|
|
95
95
|
iconType={magicCursorIcon}
|
|
96
96
|
size={20}
|
|
97
|
-
color=
|
|
98
|
-
alt=
|
|
97
|
+
color='currentColor'
|
|
98
|
+
alt=''
|
|
99
99
|
/>
|
|
100
100
|
</button>
|
|
101
101
|
|
|
102
102
|
<button
|
|
103
|
-
type=
|
|
103
|
+
type='button'
|
|
104
104
|
className={`rb-bottom-bar__button${isDebugOpen ? ' is-active' : ''}`}
|
|
105
|
-
aria-label=
|
|
105
|
+
aria-label='Debug'
|
|
106
106
|
aria-pressed={isDebugOpen}
|
|
107
107
|
onClick={() => setIsDebugOpen(true)}
|
|
108
108
|
>
|
|
109
|
-
<Icon iconType={debugIcon} size={20} color=
|
|
109
|
+
<Icon iconType={debugIcon} size={20} color='currentColor' alt='' />
|
|
110
110
|
</button>
|
|
111
|
+
|
|
111
112
|
<button
|
|
112
|
-
type=
|
|
113
|
-
className={`rb-bottom-bar__button${
|
|
114
|
-
|
|
113
|
+
type='button'
|
|
114
|
+
className={`rb-bottom-bar__button${
|
|
115
|
+
isLocalizationOpen ? ' is-active' : ''
|
|
116
|
+
}`}
|
|
117
|
+
aria-label='Localization'
|
|
115
118
|
aria-pressed={isLocalizationOpen}
|
|
116
119
|
onClick={() => setIsLocalizationOpen(true)}
|
|
117
120
|
>
|
|
118
121
|
<Icon
|
|
119
122
|
iconType={localizationIcon}
|
|
120
123
|
size={20}
|
|
121
|
-
color=
|
|
122
|
-
alt=
|
|
124
|
+
color='currentColor'
|
|
125
|
+
alt=''
|
|
123
126
|
/>
|
|
124
127
|
</button>
|
|
128
|
+
|
|
125
129
|
<button
|
|
126
|
-
type=
|
|
130
|
+
type='button'
|
|
127
131
|
className={`rb-bottom-bar__button${isColorsOpen ? ' is-active' : ''}`}
|
|
128
|
-
aria-label=
|
|
132
|
+
aria-label='Color'
|
|
129
133
|
aria-pressed={isColorsOpen}
|
|
130
134
|
onClick={() => setIsColorsOpen(true)}
|
|
131
135
|
>
|
|
132
|
-
<Icon iconType={colorIcon} size={20} color=
|
|
136
|
+
<Icon iconType={colorIcon} size={20} color='currentColor' alt='' />
|
|
133
137
|
</button>
|
|
134
138
|
|
|
135
|
-
<div className=
|
|
139
|
+
<div className='rb-bottom-bar__spacer' />
|
|
136
140
|
|
|
137
|
-
<div className=
|
|
138
|
-
{languages.map(
|
|
141
|
+
<div className='rb-bottom-bar__langs' aria-label='Language'>
|
|
142
|
+
{languages.map(language => (
|
|
139
143
|
<button
|
|
140
144
|
key={language}
|
|
141
|
-
type=
|
|
142
|
-
className={`rb-bottom-bar__lang${
|
|
145
|
+
type='button'
|
|
146
|
+
className={`rb-bottom-bar__lang${
|
|
147
|
+
activeLanguage === language ? ' is-active' : ''
|
|
148
|
+
}`}
|
|
143
149
|
onClick={() =>
|
|
144
150
|
setAppConfig({ ...appConfig, defaultLanguage: language })
|
|
145
151
|
}
|
|
@@ -169,38 +175,38 @@ export function BottomBar({ className }: BottomBarProps) {
|
|
|
169
175
|
{isDebugOpen && (
|
|
170
176
|
<Modal
|
|
171
177
|
onClose={() => setIsDebugOpen(false)}
|
|
172
|
-
ariaLabelledBy=
|
|
173
|
-
className=
|
|
174
|
-
contentClassName=
|
|
178
|
+
ariaLabelledBy='debug-json-editor-title'
|
|
179
|
+
className='modal--large modal--scrollable'
|
|
180
|
+
contentClassName='localication-modal__content'
|
|
175
181
|
>
|
|
176
|
-
<div className=
|
|
177
|
-
<div className=
|
|
178
|
-
<h3 id=
|
|
182
|
+
<div className='modal__header localication-modal__header'>
|
|
183
|
+
<div className='localication-modal__header-main'>
|
|
184
|
+
<h3 id='debug-json-editor-title' className='modal__title'>
|
|
179
185
|
Debug JSON
|
|
180
186
|
</h3>
|
|
181
|
-
<p className=
|
|
187
|
+
<p className='localication-modal__description'>
|
|
182
188
|
Inspect and edit raw node JSON.
|
|
183
189
|
</p>
|
|
184
190
|
</div>
|
|
185
191
|
<button
|
|
186
|
-
type=
|
|
187
|
-
className=
|
|
192
|
+
type='button'
|
|
193
|
+
className='editor-button'
|
|
188
194
|
onClick={() => setIsDebugOpen(false)}
|
|
189
195
|
>
|
|
190
196
|
Close
|
|
191
197
|
</button>
|
|
192
198
|
</div>
|
|
193
|
-
<div className=
|
|
199
|
+
<div className='localication-modal__body'>
|
|
194
200
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
|
195
201
|
<Checkbox
|
|
196
|
-
label=
|
|
202
|
+
label='Preview mode'
|
|
197
203
|
checked={previewMode}
|
|
198
204
|
onChange={setPreviewMode}
|
|
199
205
|
/>
|
|
200
206
|
<Checkbox
|
|
201
|
-
label=
|
|
207
|
+
label='Dark Mode'
|
|
202
208
|
checked={appConfig.theme === 'dark'}
|
|
203
|
-
onChange={
|
|
209
|
+
onChange={checked =>
|
|
204
210
|
setAppConfig({
|
|
205
211
|
...appConfig,
|
|
206
212
|
theme: checked ? 'dark' : 'light',
|
|
@@ -208,24 +214,24 @@ export function BottomBar({ className }: BottomBarProps) {
|
|
|
208
214
|
}
|
|
209
215
|
/>
|
|
210
216
|
<Checkbox
|
|
211
|
-
label=
|
|
217
|
+
label='Is RTL'
|
|
212
218
|
checked={appConfig.isRtl ?? false}
|
|
213
|
-
onChange={
|
|
219
|
+
onChange={checked =>
|
|
214
220
|
setAppConfig({ ...appConfig, isRtl: checked })
|
|
215
221
|
}
|
|
216
222
|
/>
|
|
217
223
|
</div>
|
|
218
224
|
<div
|
|
219
|
-
className=
|
|
225
|
+
className='localication-modal__editor'
|
|
220
226
|
style={{ marginTop: 12 }}
|
|
221
227
|
>
|
|
222
228
|
<JsonTextEditor
|
|
223
|
-
rootName=
|
|
224
|
-
value={
|
|
225
|
-
onChange={
|
|
226
|
-
|
|
229
|
+
rootName='node'
|
|
230
|
+
value={data ?? {}}
|
|
231
|
+
onChange={next =>
|
|
232
|
+
setData(analyseAndProccess(next as Node) as Node)
|
|
227
233
|
}
|
|
228
|
-
className=
|
|
234
|
+
className='localication-modal__json-editor'
|
|
229
235
|
/>
|
|
230
236
|
</div>
|
|
231
237
|
</div>
|
|
@@ -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 (
|
|
67
|
+
if (current) copyNode(current);
|
|
74
68
|
};
|
|
75
69
|
const handlePaste = () => {
|
|
76
|
-
if (!
|
|
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(
|
|
73
|
+
const updated = replaceNode(editorData, current, cloned);
|
|
81
74
|
useRenderStore.setState({
|
|
82
75
|
copiedNode: null,
|
|
83
76
|
});
|
|
84
|
-
|
|
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 };
|