@developer_tribe/react-builder 1.2.23 → 1.2.25
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/attribute-analyser/style/native/useExtractImageStyle.d.ts +5 -5
- package/dist/attribute-analyser/style/native/useExtractTextStyle.d.ts +6 -4
- package/dist/attribute-analyser/style/native/useExtractViewStyle.d.ts +5 -3
- package/dist/attributes-editor/SpecialCategorySection.d.ts +2 -1
- package/dist/attributes-editor/attributesEditorModelTypes.d.ts +2 -0
- package/dist/build-components/BIcon/BIconProps.generated.d.ts +0 -2
- package/dist/build-components/BackgroundImage/BackgroundImageProps.generated.d.ts +0 -2
- package/dist/build-components/Button/ButtonProps.generated.d.ts +0 -2
- package/dist/build-components/Carousel/CarouselProps.generated.d.ts +0 -2
- package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +0 -2
- package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +0 -2
- package/dist/build-components/CarouselItem/CarouselItemProps.generated.d.ts +0 -2
- package/dist/build-components/CarouselProvider/CarouselProviderProps.generated.d.ts +0 -2
- package/dist/build-components/CountDown/CountDownProps.generated.d.ts +0 -2
- package/dist/build-components/Counter/CounterProps.generated.d.ts +0 -2
- package/dist/build-components/Image/ImageProps.generated.d.ts +0 -2
- package/dist/build-components/Main/MainProps.generated.d.ts +0 -2
- package/dist/build-components/NavigationBarColor/NavigationBarColorProps.generated.d.ts +0 -2
- package/dist/build-components/Onboard/OnboardProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +0 -2
- package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +0 -2
- package/dist/build-components/PaywallBackground/PaywallBackgroundProps.generated.d.ts +0 -2
- package/dist/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.d.ts +0 -2
- package/dist/build-components/PaywallCounter/PaywallCounterProps.generated.d.ts +0 -2
- package/dist/build-components/PaywallOptions/PaywallOptionsProps.generated.d.ts +0 -2
- package/dist/build-components/PaywallProvider/PaywallProviderProps.generated.d.ts +0 -2
- package/dist/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.d.ts +0 -2
- package/dist/build-components/RadioButton/RadioButtonProps.generated.d.ts +0 -2
- package/dist/build-components/Separator/SeparatorProps.generated.d.ts +0 -2
- package/dist/build-components/StatusBarColor/StatusBarColorProps.generated.d.ts +0 -2
- package/dist/build-components/Text/TextProps.generated.d.ts +0 -2
- package/dist/build-components/patterns.generated.d.ts +80 -66
- package/dist/index.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.web.cjs.js +3 -3
- package/dist/index.web.cjs.js.map +1 -1
- package/dist/index.web.esm.js +3 -3
- package/dist/index.web.esm.js.map +1 -1
- package/dist/pages/ProjectPage.d.ts +2 -2
- package/dist/pages/projectPageUtils.d.ts +7 -1
- package/dist/types/Project.d.ts +6 -0
- package/dist/utils/attributeStyle.d.ts +12 -0
- package/dist/utils/patterns.d.ts +2 -0
- package/package.json +6 -1
- package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +11 -2
- package/src/AttributesEditor.tsx +15 -4
- package/src/assets/meta.json +1 -1
- package/src/assets/samples/paywall-1.json +5 -5
- package/src/assets/samples/paywall-2.json +5 -5
- package/src/assets/samples/paywall-app-delete-offer.json +0 -1
- package/src/assets/samples/paywall-app-open-offer.json +0 -1
- package/src/assets/samples/paywall-back-offer.json +0 -1
- package/src/assets/samples/paywall-notification-offer.json +0 -1
- package/src/assets/samples/simple-2.json +0 -1
- package/src/attribute-analyser/style/native/useExtractImageStyle.ts +19 -15
- package/src/attribute-analyser/style/native/useExtractTextStyle.ts +25 -15
- package/src/attribute-analyser/style/native/useExtractViewStyle.ts +19 -21
- package/src/attributes-editor/AttributesEditorView.tsx +43 -36
- package/src/attributes-editor/SpecialCategorySection.tsx +5 -3
- package/src/attributes-editor/attributesEditorModelTypes.ts +2 -0
- package/src/attributes-editor/useAttributesEditorModel.ts +6 -0
- package/src/build-components/BIcon/BIconProps.generated.ts +0 -2
- package/src/build-components/BIcon/pattern.json +5 -3
- package/src/build-components/BackgroundImage/BackgroundImageProps.generated.ts +0 -2
- package/src/build-components/BackgroundImage/pattern.json +12 -4
- package/src/build-components/Button/ButtonProps.generated.ts +0 -2
- package/src/build-components/Button/pattern.json +5 -3
- package/src/build-components/Carousel/CarouselProps.generated.ts +0 -2
- package/src/build-components/Carousel/pattern.json +11 -5
- package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +0 -2
- package/src/build-components/CarouselButtons/pattern.json +11 -4
- package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +0 -2
- package/src/build-components/CarouselDots/pattern.json +5 -3
- package/src/build-components/CarouselItem/CarouselItemProps.generated.ts +0 -2
- package/src/build-components/CarouselItem/pattern.json +6 -6
- package/src/build-components/CarouselProvider/CarouselProviderProps.generated.ts +0 -2
- package/src/build-components/CarouselProvider/pattern.json +6 -5
- package/src/build-components/CountDown/CountDownProps.generated.ts +0 -2
- package/src/build-components/CountDown/pattern.json +6 -3
- package/src/build-components/Counter/CounterProps.generated.ts +0 -2
- package/src/build-components/Counter/pattern.json +5 -1
- package/src/build-components/Image/ImageProps.generated.ts +0 -2
- package/src/build-components/Image/pattern.json +7 -2
- package/src/build-components/Main/MainProps.generated.ts +0 -2
- package/src/build-components/Main/pattern.json +5 -3
- package/src/build-components/NavigationBarColor/NavigationBarColorProps.generated.ts +0 -2
- package/src/build-components/NavigationBarColor/pattern.json +5 -3
- package/src/build-components/Onboard/OnboardProps.generated.ts +0 -2
- package/src/build-components/Onboard/pattern.json +9 -7
- package/src/build-components/OnboardButton/OnboardButton.tsx +19 -5
- package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +0 -2
- package/src/build-components/OnboardButton/pattern.json +16 -5
- package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +0 -2
- package/src/build-components/OnboardButtons/pattern.json +17 -6
- package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +0 -2
- package/src/build-components/OnboardDot/pattern.json +5 -3
- package/src/build-components/OnboardFooter/OnboardFooter.tsx +15 -4
- package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +0 -2
- package/src/build-components/OnboardFooter/pattern.json +5 -3
- package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +0 -2
- package/src/build-components/OnboardImage/pattern.json +7 -3
- package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +0 -2
- package/src/build-components/OnboardItem/pattern.json +13 -5
- package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +0 -2
- package/src/build-components/OnboardProvider/pattern.json +10 -4
- package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +0 -2
- package/src/build-components/OnboardSubtitle/pattern.json +7 -6
- package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +0 -2
- package/src/build-components/OnboardTitle/pattern.json +7 -6
- package/src/build-components/PaywallBackground/PaywallBackgroundProps.generated.ts +0 -2
- package/src/build-components/PaywallBackground/pattern.json +5 -5
- package/src/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.ts +0 -2
- package/src/build-components/PaywallCloseButton/pattern.json +6 -6
- package/src/build-components/PaywallCounter/PaywallCounterProps.generated.ts +0 -2
- package/src/build-components/PaywallCounter/pattern.json +6 -3
- package/src/build-components/PaywallOptions/PaywallOptionsProps.generated.ts +0 -2
- package/src/build-components/PaywallOptions/pattern.json +6 -6
- package/src/build-components/PaywallProvider/PaywallProviderProps.generated.ts +0 -2
- package/src/build-components/PaywallProvider/pattern.json +5 -3
- package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.ts +0 -2
- package/src/build-components/PaywallSubscribeButton/pattern.json +6 -6
- package/src/build-components/RadioButton/RadioButtonProps.generated.ts +0 -2
- package/src/build-components/RadioButton/pattern.json +5 -3
- package/src/build-components/Separator/SeparatorProps.generated.ts +0 -2
- package/src/build-components/Separator/pattern.json +5 -3
- package/src/build-components/StatusBarColor/StatusBarColorProps.generated.ts +0 -2
- package/src/build-components/StatusBarColor/pattern.json +5 -3
- package/src/build-components/Text/TextProps.generated.ts +0 -2
- package/src/build-components/Text/pattern.json +11 -5
- package/src/build-components/View/pattern.json +18 -4
- package/src/build-components/patterns.generated.ts +72 -66
- package/src/components/AttributesEditorPanel.tsx +48 -32
- package/src/components/Builder.tsx +4 -1
- package/src/components/BuilderProvider.tsx +6 -6
- package/src/index.ts +4 -1
- package/src/pages/ProjectPage.tsx +45 -22
- package/src/pages/projectPageUtils.ts +15 -1
- package/src/types/Project.ts +7 -0
- package/src/utils/attributeStyle.ts +78 -0
- package/src/utils/patterns.ts +2 -0
|
@@ -217,6 +217,10 @@ export function useAttributesEditorModel({
|
|
|
217
217
|
const componentTitle = componentMeta?.label ?? data?.type ?? 'Component';
|
|
218
218
|
const componentDescription = componentMeta?.description;
|
|
219
219
|
|
|
220
|
+
const hasTitleField = patternForType?.pattern?.title === 'title';
|
|
221
|
+
const hasDescriptionField =
|
|
222
|
+
patternForType?.pattern?.description === 'description';
|
|
223
|
+
|
|
220
224
|
const entries = useMemo(() => {
|
|
221
225
|
return buildAttributesEditorEntries(schema, attributeMeta).filter(
|
|
222
226
|
({ type }) => (typeof type === 'string' ? type !== 'never' : true),
|
|
@@ -477,6 +481,8 @@ export function useAttributesEditorModel({
|
|
|
477
481
|
mockableFeatureKeys,
|
|
478
482
|
activeMockableFeature,
|
|
479
483
|
setActiveMockableFeature,
|
|
484
|
+
hasTitleField,
|
|
485
|
+
hasDescriptionField,
|
|
480
486
|
hasStringChildren,
|
|
481
487
|
childrenValue,
|
|
482
488
|
};
|
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "BIcon",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "never",
|
|
6
8
|
"extends": "Text",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description",
|
|
10
10
|
"iconType": "iconType",
|
|
11
11
|
"size": "number",
|
|
12
12
|
"strokeWidth": "number"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"meta": {
|
|
16
|
-
"desiredParent": [
|
|
16
|
+
"desiredParent": [
|
|
17
|
+
"all"
|
|
18
|
+
],
|
|
17
19
|
"label": "BIcon",
|
|
18
20
|
"description": "Renders an icon from the icon set.",
|
|
19
21
|
"styles": {},
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "BackgroundImage",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "never",
|
|
6
8
|
"extends": "View",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description",
|
|
10
10
|
"src": "string",
|
|
11
|
-
"resizeMode": [
|
|
11
|
+
"resizeMode": [
|
|
12
|
+
"cover",
|
|
13
|
+
"contain",
|
|
14
|
+
"stretch",
|
|
15
|
+
"center"
|
|
16
|
+
]
|
|
12
17
|
},
|
|
13
18
|
"defaults": {
|
|
14
19
|
"resizeMode": "cover",
|
|
@@ -24,7 +29,10 @@
|
|
|
24
29
|
}
|
|
25
30
|
},
|
|
26
31
|
"meta": {
|
|
27
|
-
"desiredParent": [
|
|
32
|
+
"desiredParent": [
|
|
33
|
+
"all",
|
|
34
|
+
"background"
|
|
35
|
+
],
|
|
28
36
|
"label": "Background Image",
|
|
29
37
|
"description": "Background image.",
|
|
30
38
|
"styles": {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "Button",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "string",
|
|
6
8
|
"extends": "View",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description",
|
|
10
10
|
"style": {
|
|
11
11
|
"color": "color",
|
|
12
12
|
"fontSize": "size",
|
|
@@ -27,7 +27,9 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"meta": {
|
|
30
|
-
"desiredParent": [
|
|
30
|
+
"desiredParent": [
|
|
31
|
+
"all"
|
|
32
|
+
],
|
|
31
33
|
"label": "Button",
|
|
32
34
|
"description": "Simple action button.",
|
|
33
35
|
"styles": {
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
|
-
"extends": "View",
|
|
5
4
|
"type": "Carousel",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
7
|
+
"extends": "View",
|
|
6
8
|
"children": "node",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description",
|
|
10
10
|
"loop": "boolean",
|
|
11
11
|
"dragFree": "boolean",
|
|
12
|
-
"align": [
|
|
12
|
+
"align": [
|
|
13
|
+
"start",
|
|
14
|
+
"center",
|
|
15
|
+
"end"
|
|
16
|
+
]
|
|
13
17
|
}
|
|
14
18
|
},
|
|
15
19
|
"meta": {
|
|
16
|
-
"desiredParent": [
|
|
20
|
+
"desiredParent": [
|
|
21
|
+
"=CarouselProvider"
|
|
22
|
+
],
|
|
17
23
|
"label": "Carousel",
|
|
18
24
|
"description": "Container for carousel items.",
|
|
19
25
|
"styles": {}
|
|
@@ -2,17 +2,24 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "CarouselButtons",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "never",
|
|
6
8
|
"extends": "View",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
"buttonType": [
|
|
11
|
+
"previous_button",
|
|
12
|
+
"next_button",
|
|
13
|
+
"skip_button"
|
|
14
|
+
],
|
|
11
15
|
"skipNumber": "number"
|
|
12
16
|
}
|
|
13
17
|
},
|
|
14
18
|
"meta": {
|
|
15
|
-
"desiredParent": [
|
|
19
|
+
"desiredParent": [
|
|
20
|
+
">OnboardProvider",
|
|
21
|
+
">CarouselProvider"
|
|
22
|
+
],
|
|
16
23
|
"label": "Carousel Buttons",
|
|
17
24
|
"description": "Renders built-in carousel buttons.",
|
|
18
25
|
"styles": {},
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "CarouselDots",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "never",
|
|
6
8
|
"extends": "View",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description",
|
|
10
10
|
"dotType": [
|
|
11
11
|
"expanding_dot",
|
|
12
12
|
"normal_dot",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"meta": {
|
|
21
|
-
"desiredParent": [
|
|
21
|
+
"desiredParent": [
|
|
22
|
+
">CarouselProvider"
|
|
23
|
+
],
|
|
22
24
|
"label": "Carousel Dots",
|
|
23
25
|
"description": "Renders page indicator dots.",
|
|
24
26
|
"styles": {
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "CarouselItem",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "node",
|
|
6
|
-
"extends": "View"
|
|
7
|
-
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description"
|
|
10
|
-
}
|
|
8
|
+
"extends": "View"
|
|
11
9
|
},
|
|
12
10
|
"meta": {
|
|
13
|
-
"desiredParent": [
|
|
11
|
+
"desiredParent": [
|
|
12
|
+
"=Carousel"
|
|
13
|
+
],
|
|
14
14
|
"label": "Carousel Item",
|
|
15
15
|
"description": "Single slide inside a carousel.",
|
|
16
16
|
"styles": {}
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
"allowUnknownAttributes": false,
|
|
4
4
|
"pattern": {
|
|
5
5
|
"type": "CarouselProvider",
|
|
6
|
+
"title": "title",
|
|
7
|
+
"description": "description",
|
|
6
8
|
"children": "node",
|
|
7
9
|
"extends": "View",
|
|
8
|
-
"attributes": {
|
|
9
|
-
"title": "title",
|
|
10
|
-
"description": "description"
|
|
11
|
-
},
|
|
12
10
|
"defaults": {
|
|
13
11
|
"style": {
|
|
14
12
|
"width": "100%",
|
|
@@ -17,7 +15,10 @@
|
|
|
17
15
|
}
|
|
18
16
|
},
|
|
19
17
|
"meta": {
|
|
20
|
-
"desiredParent": [
|
|
18
|
+
"desiredParent": [
|
|
19
|
+
"root",
|
|
20
|
+
">View"
|
|
21
|
+
],
|
|
21
22
|
"label": "Carousel Provider",
|
|
22
23
|
"description": "Provides carousel context to its children.",
|
|
23
24
|
"attributes": {}
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "CountDown",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "never",
|
|
6
|
-
"extends": "Counter"
|
|
7
|
-
"attributes": {}
|
|
8
|
+
"extends": "Counter"
|
|
8
9
|
},
|
|
9
10
|
"meta": {
|
|
10
|
-
"desiredParent": [
|
|
11
|
+
"desiredParent": [
|
|
12
|
+
"all"
|
|
13
|
+
],
|
|
11
14
|
"label": "Count Down",
|
|
12
15
|
"description": "Displays a countdown timer.",
|
|
13
16
|
"attributes": {
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "Counter",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "never",
|
|
6
8
|
"extends": "Text",
|
|
7
9
|
"attributes": {
|
|
@@ -9,7 +11,9 @@
|
|
|
9
11
|
}
|
|
10
12
|
},
|
|
11
13
|
"meta": {
|
|
12
|
-
"desiredParent": [
|
|
14
|
+
"desiredParent": [
|
|
15
|
+
"all"
|
|
16
|
+
],
|
|
13
17
|
"label": "Counter",
|
|
14
18
|
"description": "Displays a numeric counter.",
|
|
15
19
|
"attributes": {
|
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "Image",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "never",
|
|
6
8
|
"extends": "View",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description",
|
|
10
10
|
"src": "string",
|
|
11
11
|
"style": {
|
|
12
12
|
"resizeMode": ["cover", "contain", "stretch", "center"]
|
|
13
13
|
}
|
|
14
|
+
},
|
|
15
|
+
"defaults": {
|
|
16
|
+
"style": {
|
|
17
|
+
"resizeMode": "contain"
|
|
18
|
+
}
|
|
14
19
|
}
|
|
15
20
|
},
|
|
16
21
|
"meta": {
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "Main",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "node",
|
|
6
8
|
"extends": "View",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description",
|
|
10
10
|
"useSafeAreaView": "boolean"
|
|
11
11
|
}
|
|
12
12
|
},
|
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"meta": {
|
|
23
|
-
"desiredParent": [
|
|
23
|
+
"desiredParent": [
|
|
24
|
+
"root"
|
|
25
|
+
],
|
|
24
26
|
"label": "Main",
|
|
25
27
|
"description": "Top-level screen wrapper (safe area, base layout).",
|
|
26
28
|
"hideAllAttributes": true,
|
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "NavigationBarColor",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "never",
|
|
6
8
|
"extends": "View",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description",
|
|
10
10
|
"style": {
|
|
11
11
|
"backgroundColor": "color"
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"meta": {
|
|
16
|
-
"desiredParent": [
|
|
16
|
+
"desiredParent": [
|
|
17
|
+
"all"
|
|
18
|
+
],
|
|
17
19
|
"label": "Navigation Bar Color",
|
|
18
20
|
"description": "Sets the OS navigation bar background color.",
|
|
19
21
|
"styles": {
|
|
@@ -2,16 +2,18 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "Onboard",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "node",
|
|
6
|
-
"extends": "View"
|
|
7
|
-
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description"
|
|
10
|
-
}
|
|
8
|
+
"extends": "View"
|
|
11
9
|
},
|
|
12
10
|
"meta": {
|
|
13
|
-
"desiredParent": [
|
|
14
|
-
|
|
11
|
+
"desiredParent": [
|
|
12
|
+
"=OnboardProvider"
|
|
13
|
+
],
|
|
14
|
+
"desiredChildren": [
|
|
15
|
+
"=OnboardItem"
|
|
16
|
+
],
|
|
15
17
|
"label": "Onboard",
|
|
16
18
|
"description": "Wraps the onboarding flow.",
|
|
17
19
|
"styles": {}
|
|
@@ -10,13 +10,16 @@ import { useLogRender } from '../../utils/useLogRender';
|
|
|
10
10
|
import { useExtractViewStyle } from '../../attribute-analyser/style/web/useExtractViewStyle';
|
|
11
11
|
import { useMockOSContext, useMockPermission } from '../../mockOS';
|
|
12
12
|
import { useLocalize } from '../../hooks/useLocalize';
|
|
13
|
+
import { parseColor } from '../../utils/parseColor';
|
|
14
|
+
import { getStyleBag, toAttributeRecord } from '../../utils/attributeStyle';
|
|
13
15
|
|
|
14
16
|
function OnboardButton({ node }: OnboardButtonComponentProps) {
|
|
15
17
|
useLogRender('OnboardButton');
|
|
16
18
|
node = useNode(node);
|
|
17
19
|
const attributeName = node.sourceType ?? node.type ?? 'OnboardButton';
|
|
18
20
|
const { emblaApi } = useContext(onboardContext) ?? {};
|
|
19
|
-
const { appConfig } = useBuilderParams();
|
|
21
|
+
const { appConfig, projectColors } = useBuilderParams();
|
|
22
|
+
const theme = appConfig?.theme;
|
|
20
23
|
|
|
21
24
|
const context = useMockOSContext();
|
|
22
25
|
const mockPermissionManager = useMockPermission(context);
|
|
@@ -25,14 +28,25 @@ function OnboardButton({ node }: OnboardButtonComponentProps) {
|
|
|
25
28
|
const attributeKey = node.key ?? generatedId;
|
|
26
29
|
|
|
27
30
|
const attrs = node.attributes;
|
|
28
|
-
const
|
|
31
|
+
const attrRecord = toAttributeRecord(attrs);
|
|
32
|
+
const styleBag = getStyleBag(attrs);
|
|
29
33
|
const labelRaw = attrs?.labelKey ?? '';
|
|
30
34
|
const localize = useLocalize({ appConfig });
|
|
31
35
|
const label = localize(labelRaw);
|
|
32
36
|
|
|
33
|
-
const flex = styleBag?.flex ?? 1;
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
const flex = (attrRecord.flex ?? styleBag?.flex ?? 1) as number;
|
|
38
|
+
|
|
39
|
+
// The editor saves color attrs inside `styles` (meta category === 'style'),
|
|
40
|
+
// but legacy JSON may have them at the top level.
|
|
41
|
+
const rawTextColor = (attrRecord.button_text_color ??
|
|
42
|
+
styleBag?.button_text_color) as string | undefined;
|
|
43
|
+
const rawBgColor = (attrRecord.button_background_color ??
|
|
44
|
+
styleBag?.button_background_color) as string | undefined;
|
|
45
|
+
|
|
46
|
+
const textColor =
|
|
47
|
+
parseColor(rawTextColor, { projectColors, theme }) ?? '#FFFFFF';
|
|
48
|
+
const backgroundColor =
|
|
49
|
+
parseColor(rawBgColor, { projectColors, theme }) ?? '#0066FF';
|
|
36
50
|
const viewStyle = useExtractViewStyle(node);
|
|
37
51
|
|
|
38
52
|
const handleClick = () => {
|
|
@@ -76,8 +76,6 @@ export interface OnboardButtonPropsGenerated {
|
|
|
76
76
|
attributes: {
|
|
77
77
|
style?: OnboardButtonStyleGenerated;
|
|
78
78
|
scrollable?: boolean;
|
|
79
|
-
title?: string;
|
|
80
|
-
description?: string;
|
|
81
79
|
labelKey?: string;
|
|
82
80
|
button_text_color?: string;
|
|
83
81
|
animation?: AnimationOptionType;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"pattern": {
|
|
4
4
|
"type": "OnboardButton",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
5
7
|
"children": "never",
|
|
6
8
|
"extends": "View",
|
|
7
9
|
"attributes": {
|
|
8
|
-
"title": "title",
|
|
9
|
-
"description": "description",
|
|
10
10
|
"labelKey": "string",
|
|
11
11
|
"button_text_color": "color",
|
|
12
12
|
"animation": [
|
|
@@ -30,14 +30,25 @@
|
|
|
30
30
|
},
|
|
31
31
|
"types": {
|
|
32
32
|
"EventObject": {
|
|
33
|
-
"type": [
|
|
34
|
-
|
|
33
|
+
"type": [
|
|
34
|
+
"Permission",
|
|
35
|
+
"Navigate"
|
|
36
|
+
],
|
|
37
|
+
"permission": [
|
|
38
|
+
"att",
|
|
39
|
+
"notification",
|
|
40
|
+
"rating",
|
|
41
|
+
"GDPR",
|
|
42
|
+
"null"
|
|
43
|
+
],
|
|
35
44
|
"navigate_to": "string",
|
|
36
45
|
"targetIndex": "number"
|
|
37
46
|
}
|
|
38
47
|
},
|
|
39
48
|
"meta": {
|
|
40
|
-
"desiredParent": [
|
|
49
|
+
"desiredParent": [
|
|
50
|
+
"=OnboardButtons"
|
|
51
|
+
],
|
|
41
52
|
"label": "Onboard Button",
|
|
42
53
|
"description": "Single action button for onboarding.",
|
|
43
54
|
"styles": {
|
|
@@ -67,8 +67,6 @@ export interface OnboardButtonsPropsGenerated {
|
|
|
67
67
|
attributes: {
|
|
68
68
|
style?: OnboardButtonsStyleGenerated;
|
|
69
69
|
scrollable?: boolean;
|
|
70
|
-
title?: string;
|
|
71
|
-
description?: string;
|
|
72
70
|
buttonType?: ButtonTypeOptionType;
|
|
73
71
|
skipNumber?: number;
|
|
74
72
|
buttons_direction?: ButtonsDirectionOptionType;
|