@developer_tribe/react-builder 0.1.32 → 1.0.2
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/DeviceMockFrame.d.ts +2 -17
- package/dist/RenderPage.d.ts +4 -11
- package/dist/attributes-editor/Field.d.ts +16 -0
- package/dist/attributes-editor/FieldInfoTooltip.d.ts +7 -0
- package/dist/attributes-editor/LayoutPreviewPicker.d.ts +12 -0
- package/dist/attributes-editor/SpecialCategorySection.d.ts +19 -0
- package/dist/attributes-editor/types.d.ts +14 -0
- package/dist/background.jpg +0 -0
- package/dist/build-components/Button/Button.d.ts +1 -1
- package/dist/build-components/Button/ButtonProps.generated.d.ts +26 -1
- package/dist/build-components/Carousel/CarouselProps.generated.d.ts +27 -1
- package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +25 -0
- package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +25 -0
- package/dist/build-components/CarouselItem/CarouselItemProps.generated.d.ts +27 -1
- package/dist/build-components/CarouselProvider/CarouselProviderProps.generated.d.ts +27 -1
- package/dist/build-components/Image/ImageProps.generated.d.ts +25 -3
- package/dist/build-components/Onboard/OnboardProps.generated.d.ts +27 -1
- package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +25 -0
- package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +25 -0
- package/dist/build-components/OnboardDot/OnboardDot.d.ts +1 -1
- package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +22 -0
- package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +4 -5
- package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +25 -3
- package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +24 -3
- package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +25 -4
- package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +4 -5
- package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +4 -5
- package/dist/build-components/Text/TextProps.generated.d.ts +4 -5
- package/dist/build-components/View/ViewProps.generated.d.ts +3 -4
- package/dist/build-components/index.d.ts +1 -0
- package/dist/build-components/patterns.generated.d.ts +4855 -132
- package/dist/components/AttributesEditorPanel.d.ts +9 -0
- package/dist/components/Breadcrumb.d.ts +15 -0
- package/dist/components/Builder.d.ts +9 -0
- package/dist/components/Checkbox.d.ts +17 -0
- package/dist/components/DeviceButton.d.ts +8 -0
- package/dist/components/DeviceNavigationBar.d.ts +10 -0
- package/dist/components/DeviceStatusBar.d.ts +9 -0
- package/dist/components/EditorHeader.d.ts +10 -0
- package/dist/index.cjs.js +6 -5
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.esm.js +6 -5
- package/dist/index.esm.js.map +1 -0
- package/dist/mockOS/components/MockLaunchScreenComponent.d.ts +6 -0
- package/dist/mockOS/components/MockOSRouter.d.ts +8 -0
- package/dist/mockOS/components/PermissionModal.d.ts +9 -0
- package/dist/mockOS/context/MockOSContext.d.ts +36 -0
- package/dist/mockOS/hooks/useMockNavigation.d.ts +3 -0
- package/dist/mockOS/hooks/useMockPermission.d.ts +3 -0
- package/dist/mockOS/index.d.ts +9 -0
- package/dist/mockOS/managers/mockPermissionManager.d.ts +10 -0
- package/dist/mockOS/managers/navigationManager.d.ts +17 -0
- package/dist/modals/AddComponentModal.d.ts +8 -0
- package/dist/modals/ColorModal.d.ts +9 -0
- package/dist/modals/DeviceSelectorModal.d.ts +9 -0
- package/dist/modals/LocalicationModal.d.ts +8 -0
- package/dist/modals/Modal.d.ts +12 -0
- package/dist/modals/index.d.ts +5 -0
- package/dist/pages/ProjectPage.d.ts +11 -0
- package/dist/pages/tabs/BuilderTab.d.ts +9 -0
- package/dist/pages/tabs/DebugTab.d.ts +7 -0
- package/dist/pages/tabs/PreviewTab.d.ts +3 -0
- package/dist/store.d.ts +15 -18
- package/dist/styles.css +1 -1
- package/dist/types/PreviewConfig.d.ts +6 -3
- package/dist/types/Project.d.ts +12 -2
- package/dist/utils/copyNode.d.ts +2 -0
- package/dist/utils/logger.d.ts +11 -0
- package/dist/utils/patterns.d.ts +24 -0
- package/dist/utils/useLogRender.d.ts +1 -0
- package/package.json +17 -9
- package/scripts/prebuild/utils/createBuildComponentsIndex.js +15 -1
- package/scripts/prebuild/utils/createGeneratedProps.js +11 -3
- package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +45 -6
- package/scripts/prebuild/utils/validatePatternJson.js +13 -5
- package/src/AttributesEditor.tsx +434 -311
- package/src/DeviceMockFrame.tsx +42 -67
- package/src/RenderPage.tsx +8 -44
- package/src/assets/images/android.svg +43 -0
- package/src/assets/images/apple.svg +16 -0
- package/src/assets/images/background.jpg +0 -0
- package/src/assets/samples/carousel-sample.json +2 -3
- package/src/assets/samples/getSamples.ts +49 -12
- package/src/assets/samples/simple-1.json +1 -2
- package/src/assets/samples/simple-2.json +1 -2
- package/src/assets/samples/vpn-onboard-1.json +1 -2
- package/src/assets/samples/vpn-onboard-2.json +1 -2
- package/src/assets/samples/vpn-onboard-3.json +1 -2
- package/src/assets/samples/vpn-onboard-4.json +1 -2
- package/src/assets/samples/vpn-onboard-5.json +1 -2
- package/src/assets/samples/vpn-onboard-6.json +1 -2
- package/src/attributes-editor/Field.tsx +662 -0
- package/src/attributes-editor/FieldInfoTooltip.tsx +49 -0
- package/src/attributes-editor/LayoutPreviewPicker.tsx +199 -0
- package/src/attributes-editor/SpecialCategorySection.tsx +284 -0
- package/src/attributes-editor/types.ts +30 -0
- package/src/build-components/Button/Button.tsx +12 -2
- package/src/build-components/Button/ButtonProps.generated.ts +37 -1
- package/src/build-components/Button/pattern.json +31 -2
- package/src/build-components/Carousel/Carousel.tsx +17 -2
- package/src/build-components/Carousel/CarouselProps.generated.ts +39 -1
- package/src/build-components/Carousel/pattern.json +10 -0
- package/src/build-components/CarouselButtons/CarouselButtons.tsx +8 -2
- package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +36 -0
- package/src/build-components/CarouselButtons/pattern.json +22 -0
- package/src/build-components/CarouselDots/CarouselDots.tsx +42 -8
- package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +36 -0
- package/src/build-components/CarouselDots/pattern.json +15 -0
- package/src/build-components/CarouselItem/CarouselItem.tsx +7 -2
- package/src/build-components/CarouselItem/CarouselItemProps.generated.ts +39 -1
- package/src/build-components/CarouselItem/pattern.json +7 -0
- package/src/build-components/CarouselProvider/CarouselProvider.tsx +10 -2
- package/src/build-components/CarouselProvider/CarouselProviderProps.generated.ts +39 -1
- package/src/build-components/CarouselProvider/pattern.json +7 -0
- package/src/build-components/Image/Image.tsx +10 -2
- package/src/build-components/Image/ImageProps.generated.ts +36 -3
- package/src/build-components/Image/pattern.json +46 -3
- package/src/build-components/Onboard/Onboard.tsx +8 -1
- package/src/build-components/Onboard/OnboardProps.generated.ts +39 -1
- package/src/build-components/Onboard/pattern.json +11 -0
- package/src/build-components/OnboardButton/OnboardButton.tsx +53 -9
- package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +36 -0
- package/src/build-components/OnboardButton/pattern.json +71 -5
- package/src/build-components/OnboardButtons/OnboardButtons.tsx +27 -17
- package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +36 -0
- package/src/build-components/OnboardButtons/pattern.json +70 -4
- package/src/build-components/OnboardDot/OnboardDot.tsx +106 -4
- package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +22 -0
- package/src/build-components/OnboardDot/pattern.json +54 -1
- package/src/build-components/OnboardFooter/OnboardFooter.tsx +14 -6
- package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +4 -5
- package/src/build-components/OnboardFooter/pattern.json +58 -2
- package/src/build-components/OnboardImage/OnboardImage.tsx +29 -5
- package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +36 -3
- package/src/build-components/OnboardImage/pattern.json +21 -0
- package/src/build-components/OnboardItem/OnboardItem.tsx +8 -1
- package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +35 -3
- package/src/build-components/OnboardItem/pattern.json +38 -2
- package/src/build-components/OnboardProvider/OnboardProvider.tsx +22 -8
- package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +37 -4
- package/src/build-components/OnboardProvider/pattern.json +51 -4
- package/src/build-components/OnboardSubtitle/OnboardSubtitle.tsx +2 -0
- package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +4 -5
- package/src/build-components/OnboardSubtitle/pattern.json +6 -0
- package/src/build-components/OnboardTitle/OnboardTitle.tsx +2 -0
- package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +4 -5
- package/src/build-components/OnboardTitle/pattern.json +6 -0
- package/src/build-components/Text/Text.tsx +12 -6
- package/src/build-components/Text/TextProps.generated.ts +4 -5
- package/src/build-components/Text/pattern.json +38 -2
- package/src/build-components/View/View.tsx +11 -6
- package/src/build-components/View/ViewProps.generated.ts +3 -4
- package/src/build-components/View/pattern.json +227 -19
- package/src/build-components/index.ts +22 -0
- package/src/build-components/patterns.generated.ts +4905 -139
- package/src/components/AttributesEditorPanel.tsx +58 -0
- package/src/components/Breadcrumb.tsx +80 -0
- package/src/components/Builder.tsx +375 -0
- package/src/components/Checkbox.tsx +81 -0
- package/src/components/DeviceButton.tsx +39 -0
- package/src/components/DeviceNavigationBar.tsx +201 -0
- package/src/components/DeviceStatusBar.tsx +85 -0
- package/src/components/EditorHeader.tsx +138 -0
- package/src/index.ts +8 -4
- package/src/mockOS/components/MockLaunchScreenComponent.tsx +43 -0
- package/src/mockOS/components/MockOSRouter.tsx +115 -0
- package/src/mockOS/components/PermissionModal.tsx +270 -0
- package/src/mockOS/context/MockOSContext.tsx +179 -0
- package/src/mockOS/hooks/useMockNavigation.ts +11 -0
- package/src/mockOS/hooks/useMockPermission.ts +11 -0
- package/src/mockOS/index.ts +26 -0
- package/src/mockOS/managers/mockPermissionManager.ts +54 -0
- package/src/mockOS/managers/navigationManager.ts +91 -0
- package/src/modals/AddComponentModal.tsx +313 -0
- package/src/modals/ColorModal.tsx +268 -0
- package/src/modals/DeviceSelectorModal.tsx +57 -0
- package/src/modals/LocalicationModal.tsx +54 -0
- package/src/modals/Modal.tsx +57 -0
- package/src/modals/index.ts +5 -0
- package/src/pages/ProjectPage.tsx +150 -0
- package/src/pages/tabs/BuilderTab.tsx +33 -0
- package/src/pages/tabs/DebugTab.tsx +64 -0
- package/src/pages/tabs/PreviewTab.tsx +206 -0
- package/src/size-matters/index.ts +25 -5
- package/src/store.ts +56 -38
- package/src/styles/base/_global.scss +253 -0
- package/src/styles/components/_attributes-editor.scss +261 -0
- package/src/styles/components/_editor-shell.scss +189 -0
- package/src/styles/components/_mockos-router.scss +140 -0
- package/src/styles/components/_ui-components.scss +183 -0
- package/src/styles/foundation/_colors.scss +8 -0
- package/src/styles/foundation/_mixins.scss +22 -0
- package/src/styles/{_reset.scss → foundation/_reset.scss} +5 -2
- package/src/styles/foundation/_sizes.scss +37 -0
- package/src/styles/foundation/_typography.scss +4 -0
- package/src/styles/foundation/_variables.scss +3 -0
- package/src/styles/index.scss +22 -129
- package/src/styles/layout/_builder.scss +68 -0
- package/src/styles/layout/_pages.scss +3 -0
- package/src/styles/modals/_add-component.scss +122 -0
- package/src/styles/modals/_color-modal.scss +130 -0
- package/src/styles/modals/_device-selector.scss +18 -0
- package/src/styles/modals/_localication-modal.scss +68 -0
- package/src/styles/modals/_modal-shell.scss +46 -0
- package/src/styles/utilities/_carousel.scss +125 -0
- package/src/types/PreviewConfig.ts +14 -5
- package/src/types/Project.ts +15 -2
- package/src/types/images.d.ts +8 -0
- package/src/utils/copyNode.ts +7 -0
- package/src/utils/extractTextStyle.ts +8 -4
- package/src/utils/extractViewStyle.ts +51 -7
- package/src/utils/getDevices.ts +1 -0
- package/src/utils/logger.ts +76 -0
- package/src/utils/patterns.ts +33 -0
- package/src/utils/useLogRender.ts +13 -0
- package/dist/build-components/OnboardDot/OnboardExpandingDotProps.generated.d.ts +0 -10
- package/src/build-components/OnboardDot/OnboardExpandingDotProps.generated.ts +0 -20
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
@use '../foundation/colors' as colors;
|
|
2
|
+
@use '../foundation/sizes' as sizes;
|
|
3
|
+
|
|
4
|
+
.add-component-modal {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
height: 100%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.add-component-modal__body {
|
|
11
|
+
flex: 1;
|
|
12
|
+
overflow-y: auto;
|
|
13
|
+
padding-bottom: sizes.$spaceRoomy;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.add-component-modal__section {
|
|
17
|
+
padding: 0 sizes.$spaceRoomy;
|
|
18
|
+
margin-bottom: sizes.$spaceRoomy;
|
|
19
|
+
|
|
20
|
+
&:first-of-type {
|
|
21
|
+
margin-top: sizes.$spaceRoomy;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.add-component-modal__section-title {
|
|
26
|
+
font-size: 16px;
|
|
27
|
+
font-weight: 600;
|
|
28
|
+
margin-bottom: sizes.$spaceCozy;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.add-component-modal__toggle {
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
gap: sizes.$spaceCozy;
|
|
35
|
+
margin: 0 sizes.$spaceRoomy sizes.$spaceRoomy;
|
|
36
|
+
padding: sizes.$spaceCozy 0;
|
|
37
|
+
font-weight: 500;
|
|
38
|
+
user-select: none;
|
|
39
|
+
|
|
40
|
+
input {
|
|
41
|
+
width: 18px;
|
|
42
|
+
height: 18px;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.add-component-modal__group {
|
|
47
|
+
background: colors.$surfaceColor;
|
|
48
|
+
border: 1px solid colors.$borderColor;
|
|
49
|
+
border-radius: 12px;
|
|
50
|
+
padding: sizes.$spaceComfy;
|
|
51
|
+
margin-bottom: sizes.$spaceCozy;
|
|
52
|
+
box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.add-component-modal__group-title {
|
|
56
|
+
font-size: 14px;
|
|
57
|
+
font-weight: 600;
|
|
58
|
+
color: colors.$mutedTextColor;
|
|
59
|
+
margin-bottom: sizes.$spaceCozy;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.add-component-modal__grid {
|
|
63
|
+
padding: sizes.$spaceComfy;
|
|
64
|
+
display: grid;
|
|
65
|
+
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
|
66
|
+
gap: sizes.$spaceCozy;
|
|
67
|
+
overflow: auto;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.add-component-modal__card {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
gap: sizes.$spaceCozy;
|
|
74
|
+
padding: sizes.$spaceCozy;
|
|
75
|
+
border: 1px solid colors.$borderColor;
|
|
76
|
+
border-radius: 10px;
|
|
77
|
+
background: colors.$canvasColor;
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
text-align: left;
|
|
80
|
+
transition:
|
|
81
|
+
border-color 0.2s ease,
|
|
82
|
+
box-shadow 0.2s ease,
|
|
83
|
+
transform 0.2s ease;
|
|
84
|
+
color: inherit;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.add-component-modal__card:hover {
|
|
88
|
+
border-color: colors.$accentColor;
|
|
89
|
+
box-shadow: 0 10px 25px rgba(37, 99, 235, 0.15);
|
|
90
|
+
transform: translateY(-2px);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.add-component-modal__thumbnail {
|
|
94
|
+
width: 100%;
|
|
95
|
+
aspect-ratio: 4 / 3;
|
|
96
|
+
border-radius: 8px;
|
|
97
|
+
background: colors.$canvasColor;
|
|
98
|
+
border: 1px dashed colors.$borderColor;
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: center;
|
|
102
|
+
color: colors.$accentColor;
|
|
103
|
+
font-weight: 600;
|
|
104
|
+
font-size: 12px;
|
|
105
|
+
text-transform: uppercase;
|
|
106
|
+
letter-spacing: 0.05em;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.add-component-modal__title {
|
|
110
|
+
font-weight: 600;
|
|
111
|
+
color: colors.$textColor;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.add-component-modal__empty {
|
|
115
|
+
margin: sizes.$spaceCozy 0;
|
|
116
|
+
padding: sizes.$spaceComfy;
|
|
117
|
+
border: 1px dashed colors.$borderColor;
|
|
118
|
+
border-radius: 10px;
|
|
119
|
+
color: colors.$mutedTextColor;
|
|
120
|
+
font-size: 14px;
|
|
121
|
+
text-align: center;
|
|
122
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
@use '../foundation/colors' as colors;
|
|
2
|
+
@use '../foundation/sizes' as sizes;
|
|
3
|
+
|
|
4
|
+
.color-modal {
|
|
5
|
+
width: min(520px, calc(100vw - 32px));
|
|
6
|
+
max-height: 90vh;
|
|
7
|
+
padding: sizes.$spaceRoomy;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: sizes.$spaceComfy;
|
|
11
|
+
overflow-y: auto;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.color-modal__selected {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
background: colors.$canvasColor;
|
|
19
|
+
border-radius: 8px;
|
|
20
|
+
padding: sizes.$spaceCozy sizes.$spaceComfy;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.color-modal__selected-info {
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: 12px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.color-modal__selected-preview {
|
|
30
|
+
width: 32px;
|
|
31
|
+
height: 32px;
|
|
32
|
+
border-radius: 6px;
|
|
33
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.color-modal__selected-label {
|
|
37
|
+
margin: 0;
|
|
38
|
+
font-size: 12px;
|
|
39
|
+
color: colors.$mutedTextColor;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.color-modal__selected-value {
|
|
43
|
+
margin: 0;
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.color-modal__link-button {
|
|
48
|
+
border: none;
|
|
49
|
+
background: none;
|
|
50
|
+
color: colors.$accentColor;
|
|
51
|
+
font-weight: 600;
|
|
52
|
+
font-size: 13px;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
padding: 4px 8px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.color-section {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
gap: sizes.$spaceCompact;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.color-section__header {
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: space-between;
|
|
67
|
+
gap: 8px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.color-section__title {
|
|
71
|
+
margin: 0;
|
|
72
|
+
font-weight: 600;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.color-section__swatches {
|
|
76
|
+
display: grid;
|
|
77
|
+
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
|
78
|
+
gap: sizes.$spaceCompact;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.color-section__empty {
|
|
82
|
+
margin: 0;
|
|
83
|
+
font-size: 12px;
|
|
84
|
+
color: colors.$mutedTextColor;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.color-modal__swatch {
|
|
88
|
+
border: 1px solid colors.$borderColor;
|
|
89
|
+
border-radius: 8px;
|
|
90
|
+
padding: 8px;
|
|
91
|
+
background: colors.$surfaceColor;
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
gap: 6px;
|
|
95
|
+
text-align: left;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
transition:
|
|
98
|
+
border-color 0.2s ease,
|
|
99
|
+
box-shadow 0.2s ease;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.color-modal__swatch--active {
|
|
103
|
+
border-color: colors.$textColor;
|
|
104
|
+
box-shadow: 0 0 0 1px colors.$textColor inset;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.color-modal__swatch-preview {
|
|
108
|
+
width: 100%;
|
|
109
|
+
height: 32px;
|
|
110
|
+
border-radius: 6px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.color-modal__swatch-preview--light {
|
|
114
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.color-modal__swatch-label {
|
|
118
|
+
font-size: 12px;
|
|
119
|
+
font-weight: 600;
|
|
120
|
+
color: colors.$textColor;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.color-modal__swatch-value {
|
|
124
|
+
font-size: 11px;
|
|
125
|
+
color: colors.$mutedTextColor;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.color-modal__input {
|
|
129
|
+
display: none;
|
|
130
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@use '../foundation/sizes' as sizes;
|
|
2
|
+
|
|
3
|
+
.device-selector-modal {
|
|
4
|
+
padding-bottom: sizes.$spaceRoomy;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.device-selector-modal__grid {
|
|
8
|
+
padding: sizes.$spaceRoomy;
|
|
9
|
+
display: grid;
|
|
10
|
+
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
|
11
|
+
gap: sizes.$spaceCozy;
|
|
12
|
+
overflow: auto;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.device-selector-modal__grid .editor-device-button {
|
|
16
|
+
height: 80px;
|
|
17
|
+
min-width: unset;
|
|
18
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
@use '../foundation/colors' as colors;
|
|
2
|
+
@use '../foundation/sizes' as sizes;
|
|
3
|
+
|
|
4
|
+
.localication-modal__content {
|
|
5
|
+
width: calc(100vw - 32px);
|
|
6
|
+
height: calc(100vh - 32px);
|
|
7
|
+
max-width: 1600px;
|
|
8
|
+
max-height: calc(100vh - 32px);
|
|
9
|
+
padding: 0;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.localication-modal__header {
|
|
15
|
+
padding: sizes.$spaceComfy sizes.$spaceRoomy;
|
|
16
|
+
border-bottom: 1px solid colors.$borderColor;
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
gap: 16px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.localication-modal__header-main {
|
|
23
|
+
flex: 1;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
gap: 4px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.localication-modal__description {
|
|
30
|
+
margin: 0;
|
|
31
|
+
font-size: 13px;
|
|
32
|
+
color: colors.$mutedTextColor;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.localication-modal__body {
|
|
36
|
+
flex: 1;
|
|
37
|
+
min-height: 0;
|
|
38
|
+
padding: sizes.$spaceRoomy;
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
gap: sizes.$spaceComfy;
|
|
42
|
+
overflow: auto;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.localication-modal__editor {
|
|
46
|
+
flex: 1;
|
|
47
|
+
min-height: 0;
|
|
48
|
+
overflow: auto;
|
|
49
|
+
border: 1px solid colors.$borderColor;
|
|
50
|
+
border-radius: sizes.$radiusRounded;
|
|
51
|
+
background: colors.$canvasColor;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.localication-modal__json-editor {
|
|
55
|
+
height: 100%;
|
|
56
|
+
width: 100%;
|
|
57
|
+
display: block;
|
|
58
|
+
padding: sizes.$spaceCozy;
|
|
59
|
+
overflow: auto;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.modal--scrollable .localication-modal__content {
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.modal--scrollable .localication-modal__body {
|
|
67
|
+
overflow: auto;
|
|
68
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
@use '../foundation/colors' as colors;
|
|
2
|
+
@use '../foundation/sizes' as sizes;
|
|
3
|
+
|
|
4
|
+
.modal {
|
|
5
|
+
position: fixed;
|
|
6
|
+
inset: 0;
|
|
7
|
+
z-index: 10000;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.modal__overlay {
|
|
11
|
+
position: absolute;
|
|
12
|
+
inset: 0;
|
|
13
|
+
background: rgba(0, 0, 0, 0.4);
|
|
14
|
+
z-index: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.modal__content {
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 50%;
|
|
20
|
+
left: 50%;
|
|
21
|
+
transform: translate(-50%, -50%);
|
|
22
|
+
background: colors.$surfaceColor;
|
|
23
|
+
border-radius: sizes.$radiusPill;
|
|
24
|
+
box-shadow: sizes.$cardShadow;
|
|
25
|
+
width: min(960px, calc(100vw - 40px));
|
|
26
|
+
max-height: calc(100vh - 120px);
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
z-index: 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.modal__header {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: space-between;
|
|
37
|
+
padding: sizes.$spaceComfy sizes.$spaceRoomy;
|
|
38
|
+
border-bottom: 1px solid colors.$borderColor;
|
|
39
|
+
gap: 12px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.modal__title {
|
|
43
|
+
margin: 0;
|
|
44
|
+
font-size: 16px;
|
|
45
|
+
font-weight: 700;
|
|
46
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/* Embla carousel utilities stay isolated from builder core styles. */
|
|
2
|
+
.embla {
|
|
3
|
+
max-width: 48rem;
|
|
4
|
+
margin: auto;
|
|
5
|
+
--slide-height: 19rem;
|
|
6
|
+
--slide-spacing: 1rem;
|
|
7
|
+
--slide-size: 70%;
|
|
8
|
+
}
|
|
9
|
+
.embla__viewport {
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
}
|
|
12
|
+
.embla__container {
|
|
13
|
+
display: flex;
|
|
14
|
+
touch-action: pan-y pinch-zoom;
|
|
15
|
+
margin-left: calc(var(--slide-spacing) * -1);
|
|
16
|
+
}
|
|
17
|
+
.embla__slide {
|
|
18
|
+
transform: translate3d(0, 0, 0);
|
|
19
|
+
min-width: 0;
|
|
20
|
+
padding-left: var(--slide-spacing);
|
|
21
|
+
flex: 0 0 100%;
|
|
22
|
+
}
|
|
23
|
+
.embla__slide__number {
|
|
24
|
+
box-shadow: inset 0 0 0 0.2rem var(--detail-medium-contrast);
|
|
25
|
+
border-radius: 1.8rem;
|
|
26
|
+
font-size: 4rem;
|
|
27
|
+
font-weight: 600;
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
height: var(--slide-height);
|
|
32
|
+
user-select: none;
|
|
33
|
+
}
|
|
34
|
+
.embla__controls {
|
|
35
|
+
display: grid;
|
|
36
|
+
grid-template-columns: auto 1fr;
|
|
37
|
+
justify-content: space-between;
|
|
38
|
+
gap: 1.2rem;
|
|
39
|
+
margin-top: 1.8rem;
|
|
40
|
+
}
|
|
41
|
+
.embla__buttons {
|
|
42
|
+
display: grid;
|
|
43
|
+
grid-template-columns: repeat(2, 1fr);
|
|
44
|
+
gap: 0.6rem;
|
|
45
|
+
align-items: center;
|
|
46
|
+
}
|
|
47
|
+
.embla__button {
|
|
48
|
+
-webkit-tap-highlight-color: rgba(var(--text-high-contrast-rgb-value), 0.5);
|
|
49
|
+
-webkit-appearance: none;
|
|
50
|
+
appearance: none;
|
|
51
|
+
background-color: transparent;
|
|
52
|
+
touch-action: manipulation;
|
|
53
|
+
display: inline-flex;
|
|
54
|
+
text-decoration: none;
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
border: 0;
|
|
57
|
+
padding: 0;
|
|
58
|
+
margin: 0;
|
|
59
|
+
box-shadow: inset 0 0 0 0.2rem var(--detail-medium-contrast);
|
|
60
|
+
width: 3.6rem;
|
|
61
|
+
height: 3.6rem;
|
|
62
|
+
z-index: 1;
|
|
63
|
+
border-radius: 50%;
|
|
64
|
+
color: var(--text-body);
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
}
|
|
69
|
+
.embla__button:disabled {
|
|
70
|
+
color: var(--detail-high-contrast);
|
|
71
|
+
}
|
|
72
|
+
.embla__button__svg {
|
|
73
|
+
width: 35%;
|
|
74
|
+
height: 35%;
|
|
75
|
+
}
|
|
76
|
+
.embla__dots {
|
|
77
|
+
flex-wrap: wrap;
|
|
78
|
+
margin-right: 0;
|
|
79
|
+
height: 50px;
|
|
80
|
+
margin: 0 auto;
|
|
81
|
+
}
|
|
82
|
+
.embla__dot {
|
|
83
|
+
-webkit-tap-highlight-color: rgba(var(--text-high-contrast-rgb-value), 0.5);
|
|
84
|
+
-webkit-appearance: none;
|
|
85
|
+
appearance: none;
|
|
86
|
+
background-color: transparent;
|
|
87
|
+
touch-action: manipulation;
|
|
88
|
+
display: inline-flex;
|
|
89
|
+
text-decoration: none;
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
border: 0;
|
|
92
|
+
padding: 0;
|
|
93
|
+
margin: 0;
|
|
94
|
+
width: 2.6rem;
|
|
95
|
+
height: 2.6rem;
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
border-radius: 50%;
|
|
99
|
+
}
|
|
100
|
+
.embla__dot:after {
|
|
101
|
+
box-shadow: inset 0 0 0 0.2rem var(--detail-medium-contrast);
|
|
102
|
+
width: 1.4rem;
|
|
103
|
+
height: 1.4rem;
|
|
104
|
+
border-radius: 50%;
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
content: '';
|
|
108
|
+
}
|
|
109
|
+
.embla__dot--selected:after {
|
|
110
|
+
box-shadow: inset 0 0 0 0.2rem var(--text-body);
|
|
111
|
+
}
|
|
112
|
+
.carousel-provider {
|
|
113
|
+
height: 100%;
|
|
114
|
+
}
|
|
115
|
+
.embla {
|
|
116
|
+
height: 100%;
|
|
117
|
+
}
|
|
118
|
+
.embla__viewport {
|
|
119
|
+
height: 100%;
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-direction: column;
|
|
122
|
+
}
|
|
123
|
+
.embla__container {
|
|
124
|
+
flex: 1;
|
|
125
|
+
}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface PreviewConfig {
|
|
1
|
+
export interface AppConfig {
|
|
4
2
|
theme: 'light' | 'dark';
|
|
5
|
-
|
|
6
|
-
isRtl: boolean;
|
|
3
|
+
isRtl: boolean; //This could be device in future
|
|
7
4
|
screenStyle: {
|
|
8
5
|
light: { backgroundColor: string; color: string; seperatorColor?: string };
|
|
9
6
|
dark: { backgroundColor: string; color: string; seperatorColor?: string };
|
|
10
7
|
};
|
|
11
8
|
localication: Localication;
|
|
12
9
|
defaultLanguage?: string;
|
|
10
|
+
baseSize: { width: number; height: number };
|
|
13
11
|
}
|
|
14
12
|
|
|
13
|
+
export const defaultAppConfig: AppConfig = {
|
|
14
|
+
theme: 'light',
|
|
15
|
+
isRtl: false,
|
|
16
|
+
screenStyle: {
|
|
17
|
+
light: { backgroundColor: '#FDFDFD', color: '#161827' },
|
|
18
|
+
dark: { backgroundColor: '#12131A', color: '#E9EBF9' },
|
|
19
|
+
},
|
|
20
|
+
localication: {},
|
|
21
|
+
baseSize: { width: 375, height: 812 },
|
|
22
|
+
};
|
|
23
|
+
|
|
15
24
|
export type Localication = {
|
|
16
25
|
[key: string]: {
|
|
17
26
|
[key: string]: string;
|
package/src/types/Project.ts
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import { Node } from '../types/Node';
|
|
2
|
-
import {
|
|
2
|
+
import { AppConfig } from './PreviewConfig';
|
|
3
3
|
|
|
4
4
|
export interface ProjectBase<T> {
|
|
5
5
|
name: string;
|
|
6
6
|
version: string;
|
|
7
7
|
data: T;
|
|
8
|
-
|
|
8
|
+
appConfig?: AppConfig;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface Project extends ProjectBase<Node> {}
|
|
12
|
+
|
|
13
|
+
export type LogLevel = 'NONE' | 'ERROR' | 'WARN' | 'INFO' | 'VERBOSE';
|
|
14
|
+
|
|
15
|
+
export type LogSource = string;
|
|
16
|
+
|
|
17
|
+
export interface LogEntry {
|
|
18
|
+
id: string;
|
|
19
|
+
timestamp: number;
|
|
20
|
+
level: LogLevel;
|
|
21
|
+
source: LogSource;
|
|
22
|
+
message: string;
|
|
23
|
+
payload?: unknown;
|
|
24
|
+
}
|
|
@@ -7,8 +7,10 @@ export function extractTextStyle<T extends TextPropsGenerated['attributes']>(
|
|
|
7
7
|
node: NodeData<T>,
|
|
8
8
|
) {
|
|
9
9
|
const attributes = node.attributes;
|
|
10
|
-
|
|
11
|
-
const {
|
|
10
|
+
//TODO: it should be passed as a prop to the function (need a state)
|
|
11
|
+
const {
|
|
12
|
+
appConfig: { screenStyle, theme },
|
|
13
|
+
} = useRenderStore.getState();
|
|
12
14
|
const fallbackColor =
|
|
13
15
|
theme === 'light' ? screenStyle.light.color : screenStyle.dark.color;
|
|
14
16
|
|
|
@@ -48,8 +50,10 @@ export function extractTextStyle<T extends TextPropsGenerated['attributes']>(
|
|
|
48
50
|
style.paddingTop = v as React.CSSProperties['paddingTop'];
|
|
49
51
|
style.paddingBottom = v as React.CSSProperties['paddingBottom'];
|
|
50
52
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
const marginHorizontalRaw = (attributes as Record<string, unknown>)
|
|
54
|
+
.marginHorizontal as string | number | undefined;
|
|
55
|
+
if (marginHorizontalRaw !== undefined) {
|
|
56
|
+
const v = parseSize(marginHorizontalRaw);
|
|
53
57
|
style.marginLeft = v as React.CSSProperties['marginLeft'];
|
|
54
58
|
style.marginRight = v as React.CSSProperties['marginRight'];
|
|
55
59
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ViewPropsGenerated } from '../build-components/View/ViewProps.generated';
|
|
2
2
|
import type { NodeData } from '../types/Node';
|
|
3
|
+
import { parseSize } from '../size-matters';
|
|
3
4
|
|
|
4
5
|
export function extractViewStyle<T extends ViewPropsGenerated['attributes']>(
|
|
5
6
|
node: NodeData<T>,
|
|
@@ -31,14 +32,57 @@ export function extractViewStyle<T extends ViewPropsGenerated['attributes']>(
|
|
|
31
32
|
if (attributes.justifyContent)
|
|
32
33
|
style.justifyContent =
|
|
33
34
|
attributes.justifyContent as React.CSSProperties['justifyContent'];
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
const setParsedSize = <K extends keyof React.CSSProperties>(
|
|
36
|
+
property: K,
|
|
37
|
+
rawValue: string | number | undefined,
|
|
38
|
+
) => {
|
|
39
|
+
if (rawValue === undefined) return;
|
|
40
|
+
const parsed = parseSize(rawValue);
|
|
41
|
+
style[property] = parsed as React.CSSProperties[K];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
setParsedSize('gap', attributes.gap);
|
|
45
|
+
setParsedSize('padding', attributes.padding);
|
|
46
|
+
setParsedSize('margin', attributes.margin);
|
|
47
|
+
|
|
48
|
+
if (attributes.paddingHorizontal !== undefined) {
|
|
49
|
+
const parsed = parseSize(attributes.paddingHorizontal);
|
|
50
|
+
style.paddingLeft = parsed as React.CSSProperties['paddingLeft'];
|
|
51
|
+
style.paddingRight = parsed as React.CSSProperties['paddingRight'];
|
|
52
|
+
}
|
|
53
|
+
if (attributes.paddingVertical !== undefined) {
|
|
54
|
+
const parsed = parseSize(attributes.paddingVertical);
|
|
55
|
+
style.paddingTop = parsed as React.CSSProperties['paddingTop'];
|
|
56
|
+
style.paddingBottom = parsed as React.CSSProperties['paddingBottom'];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const marginHorizontalRaw = (attributes as Record<string, unknown>)
|
|
60
|
+
.marginHorizontal as string | number | undefined;
|
|
61
|
+
if (marginHorizontalRaw !== undefined) {
|
|
62
|
+
const parsed = parseSize(marginHorizontalRaw);
|
|
63
|
+
style.marginLeft = parsed as React.CSSProperties['marginLeft'];
|
|
64
|
+
style.marginRight = parsed as React.CSSProperties['marginRight'];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (attributes.marginVertical !== undefined) {
|
|
68
|
+
const parsed = parseSize(attributes.marginVertical);
|
|
69
|
+
style.marginTop = parsed as React.CSSProperties['marginTop'];
|
|
70
|
+
style.marginBottom = parsed as React.CSSProperties['marginBottom'];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
setParsedSize('paddingTop', attributes.paddingTop);
|
|
74
|
+
setParsedSize('paddingBottom', attributes.paddingBottom);
|
|
75
|
+
setParsedSize('paddingLeft', attributes.paddingLeft);
|
|
76
|
+
setParsedSize('paddingRight', attributes.paddingRight);
|
|
77
|
+
setParsedSize('marginTop', attributes.marginTop);
|
|
78
|
+
setParsedSize('marginBottom', attributes.marginBottom);
|
|
79
|
+
setParsedSize('marginLeft', attributes.marginLeft);
|
|
80
|
+
setParsedSize('marginRight', attributes.marginRight);
|
|
81
|
+
|
|
37
82
|
if (attributes.backgroundColor)
|
|
38
83
|
style.backgroundColor = attributes.backgroundColor;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (attributes.height !== undefined) style.height = attributes.height;
|
|
84
|
+
setParsedSize('borderRadius', attributes.borderRadius);
|
|
85
|
+
setParsedSize('width', attributes.width);
|
|
86
|
+
setParsedSize('height', attributes.height);
|
|
43
87
|
return style;
|
|
44
88
|
}
|