@developer_tribe/react-builder 0.1.22 → 0.1.24
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/Button/getDefaults.d.ts +3 -0
- package/dist/build-components/Carousel/getDefaults.d.ts +3 -0
- package/dist/build-components/CarouselButtons/getDefaults.d.ts +3 -0
- package/dist/build-components/CarouselDots/getDefaults.d.ts +3 -0
- package/dist/build-components/CarouselItem/getDefaults.d.ts +3 -0
- package/dist/build-components/CarouselProvider/getDefaults.d.ts +3 -0
- package/dist/build-components/Image/getDefaults.d.ts +3 -0
- package/dist/build-components/Onboard/getDefaults.d.ts +3 -0
- package/dist/build-components/OnboardButton/getDefaults.d.ts +3 -0
- package/dist/build-components/OnboardButtons/getDefaults.d.ts +3 -0
- package/dist/build-components/OnboardDot/getDefaults.d.ts +3 -0
- package/dist/build-components/OnboardFooter/getDefaults.d.ts +3 -0
- package/dist/build-components/OnboardImage/getDefaults.d.ts +3 -0
- package/dist/build-components/OnboardItem/getDefaults.d.ts +3 -0
- package/dist/build-components/OnboardProvider/getDefaults.d.ts +3 -0
- package/dist/build-components/OnboardSubtitle/getDefaults.d.ts +3 -0
- package/dist/build-components/OnboardTitle/getDefaults.d.ts +3 -0
- package/dist/build-components/Text/getDefaults.d.ts +3 -0
- package/dist/build-components/View/getDefaults.d.ts +3 -0
- package/dist/build-components/getDefaults.d.ts +25 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/utils/isOnboard.d.ts +1 -1
- package/package.json +1 -1
- package/scripts/prebuild/build-components.js +4 -0
- package/scripts/prebuild/utils/createBuildComponentsRootGetDefaults.js +56 -0
- package/scripts/prebuild/utils/createGetDefaultsPerComponent.js +28 -0
- package/scripts/prebuild/utils/createRootGetDefaults.js +52 -0
- package/scripts/prebuild/utils/index.js +3 -0
- package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +2 -1
- package/src/build-components/Button/getDefaults.ts +11 -0
- package/src/build-components/Carousel/getDefaults.ts +11 -0
- package/src/build-components/CarouselButtons/getDefaults.ts +13 -0
- package/src/build-components/CarouselDots/getDefaults.ts +13 -0
- package/src/build-components/CarouselItem/getDefaults.ts +13 -0
- package/src/build-components/CarouselProvider/getDefaults.ts +13 -0
- package/src/build-components/Image/getDefaults.ts +11 -0
- package/src/build-components/Onboard/getDefaults.ts +11 -0
- package/src/build-components/OnboardButton/getDefaults.ts +13 -0
- package/src/build-components/OnboardButtons/getDefaults.ts +13 -0
- package/src/build-components/OnboardDot/getDefaults.ts +13 -0
- package/src/build-components/OnboardFooter/OnboardFooter.tsx +157 -14
- package/src/build-components/OnboardFooter/getDefaults.ts +13 -0
- package/src/build-components/OnboardImage/getDefaults.ts +13 -0
- package/src/build-components/OnboardItem/getDefaults.ts +13 -0
- package/src/build-components/OnboardProvider/getDefaults.ts +13 -0
- package/src/build-components/OnboardSubtitle/getDefaults.ts +13 -0
- package/src/build-components/OnboardSubtitle/pattern.json +4 -0
- package/src/build-components/OnboardTitle/getDefaults.ts +13 -0
- package/src/build-components/OnboardTitle/pattern.json +4 -0
- package/src/build-components/Text/getDefaults.ts +11 -0
- package/src/build-components/View/getDefaults.ts +11 -0
- package/src/build-components/getDefaults.ts +115 -0
- package/src/utils/isOnboard.ts +3 -3
- package/src/utils/novaToJson.ts +1 -1
- package/src/utils/patterns.ts +2 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* AUTO-GENERATED FILE - DO NOT EDIT */
|
|
2
|
+
|
|
3
|
+
import pattern from './pattern.json';
|
|
4
|
+
import type { ViewPropsGenerated } from './ViewProps.generated';
|
|
5
|
+
|
|
6
|
+
export type ViewDefaults = Partial<ViewPropsGenerated['attributes']>;
|
|
7
|
+
|
|
8
|
+
export function getDefaults(): ViewDefaults {
|
|
9
|
+
return ((pattern as unknown as { default?: unknown })?.default ??
|
|
10
|
+
{}) as ViewDefaults;
|
|
11
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/* AUTO-GENERATED FILE - DO NOT EDIT */
|
|
2
|
+
|
|
3
|
+
import { getDefaults as getButtonDefaults } from './Button/getDefaults';
|
|
4
|
+
import { getDefaults as getCarouselDefaults } from './Carousel/getDefaults';
|
|
5
|
+
import { getDefaults as getCarouselButtonsDefaults } from './CarouselButtons/getDefaults';
|
|
6
|
+
import { getDefaults as getCarouselDotsDefaults } from './CarouselDots/getDefaults';
|
|
7
|
+
import { getDefaults as getCarouselItemDefaults } from './CarouselItem/getDefaults';
|
|
8
|
+
import { getDefaults as getCarouselProviderDefaults } from './CarouselProvider/getDefaults';
|
|
9
|
+
import { getDefaults as getImageDefaults } from './Image/getDefaults';
|
|
10
|
+
import { getDefaults as getOnboardDefaults } from './Onboard/getDefaults';
|
|
11
|
+
import { getDefaults as getOnboardButtonDefaults } from './OnboardButton/getDefaults';
|
|
12
|
+
import { getDefaults as getOnboardButtonsDefaults } from './OnboardButtons/getDefaults';
|
|
13
|
+
import { getDefaults as getOnboardDotDefaults } from './OnboardDot/getDefaults';
|
|
14
|
+
import { getDefaults as getOnboardFooterDefaults } from './OnboardFooter/getDefaults';
|
|
15
|
+
import { getDefaults as getOnboardImageDefaults } from './OnboardImage/getDefaults';
|
|
16
|
+
import { getDefaults as getOnboardItemDefaults } from './OnboardItem/getDefaults';
|
|
17
|
+
import { getDefaults as getOnboardProviderDefaults } from './OnboardProvider/getDefaults';
|
|
18
|
+
import { getDefaults as getOnboardSubtitleDefaults } from './OnboardSubtitle/getDefaults';
|
|
19
|
+
import { getDefaults as getOnboardTitleDefaults } from './OnboardTitle/getDefaults';
|
|
20
|
+
import { getDefaults as getTextDefaults } from './Text/getDefaults';
|
|
21
|
+
import { getDefaults as getViewDefaults } from './View/getDefaults';
|
|
22
|
+
import type {
|
|
23
|
+
ButtonPropsGenerated,
|
|
24
|
+
CarouselPropsGenerated,
|
|
25
|
+
CarouselButtonsPropsGenerated,
|
|
26
|
+
CarouselDotsPropsGenerated,
|
|
27
|
+
CarouselItemPropsGenerated,
|
|
28
|
+
CarouselProviderPropsGenerated,
|
|
29
|
+
ImagePropsGenerated,
|
|
30
|
+
OnboardPropsGenerated,
|
|
31
|
+
OnboardButtonPropsGenerated,
|
|
32
|
+
OnboardButtonsPropsGenerated,
|
|
33
|
+
OnboardDotPropsGenerated,
|
|
34
|
+
OnboardFooterPropsGenerated,
|
|
35
|
+
OnboardImagePropsGenerated,
|
|
36
|
+
OnboardItemPropsGenerated,
|
|
37
|
+
OnboardProviderPropsGenerated,
|
|
38
|
+
OnboardSubtitlePropsGenerated,
|
|
39
|
+
OnboardTitlePropsGenerated,
|
|
40
|
+
TextPropsGenerated,
|
|
41
|
+
ViewPropsGenerated,
|
|
42
|
+
} from './index';
|
|
43
|
+
import type { NodeData } from '../types/Node';
|
|
44
|
+
|
|
45
|
+
export type Types = {
|
|
46
|
+
button: ButtonPropsGenerated['attributes'];
|
|
47
|
+
carousel: CarouselPropsGenerated['attributes'];
|
|
48
|
+
carouselButtons: CarouselButtonsPropsGenerated['attributes'];
|
|
49
|
+
carouselDots: CarouselDotsPropsGenerated['attributes'];
|
|
50
|
+
carouselItem: CarouselItemPropsGenerated['attributes'];
|
|
51
|
+
carouselProvider: CarouselProviderPropsGenerated['attributes'];
|
|
52
|
+
image: ImagePropsGenerated['attributes'];
|
|
53
|
+
Onboard: OnboardPropsGenerated['attributes'];
|
|
54
|
+
OnboardButton: OnboardButtonPropsGenerated['attributes'];
|
|
55
|
+
OnboardButtons: OnboardButtonsPropsGenerated['attributes'];
|
|
56
|
+
OnboardDot: OnboardDotPropsGenerated['attributes'];
|
|
57
|
+
OnboardFooter: OnboardFooterPropsGenerated['attributes'];
|
|
58
|
+
OnboardImage: OnboardImagePropsGenerated['attributes'];
|
|
59
|
+
OnboardItem: OnboardItemPropsGenerated['attributes'];
|
|
60
|
+
OnboardProvider: OnboardProviderPropsGenerated['attributes'];
|
|
61
|
+
OnboardSubtitle: OnboardSubtitlePropsGenerated['attributes'];
|
|
62
|
+
OnboardTitle: OnboardTitlePropsGenerated['attributes'];
|
|
63
|
+
text: TextPropsGenerated['attributes'];
|
|
64
|
+
view: ViewPropsGenerated['attributes'];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type List<T> = T extends keyof Types ? Types[T] : never;
|
|
68
|
+
|
|
69
|
+
export function getDefaults<T extends keyof Types>(
|
|
70
|
+
type: T,
|
|
71
|
+
_node: NodeData<List<T>>,
|
|
72
|
+
): Partial<Types[T]> {
|
|
73
|
+
switch (type as unknown as string) {
|
|
74
|
+
case 'button':
|
|
75
|
+
return getButtonDefaults() as Partial<Types[T]>;
|
|
76
|
+
case 'carousel':
|
|
77
|
+
return getCarouselDefaults() as Partial<Types[T]>;
|
|
78
|
+
case 'carouselButtons':
|
|
79
|
+
return getCarouselButtonsDefaults() as Partial<Types[T]>;
|
|
80
|
+
case 'carouselDots':
|
|
81
|
+
return getCarouselDotsDefaults() as Partial<Types[T]>;
|
|
82
|
+
case 'carouselItem':
|
|
83
|
+
return getCarouselItemDefaults() as Partial<Types[T]>;
|
|
84
|
+
case 'carouselProvider':
|
|
85
|
+
return getCarouselProviderDefaults() as Partial<Types[T]>;
|
|
86
|
+
case 'image':
|
|
87
|
+
return getImageDefaults() as Partial<Types[T]>;
|
|
88
|
+
case 'Onboard':
|
|
89
|
+
return getOnboardDefaults() as Partial<Types[T]>;
|
|
90
|
+
case 'OnboardButton':
|
|
91
|
+
return getOnboardButtonDefaults() as Partial<Types[T]>;
|
|
92
|
+
case 'OnboardButtons':
|
|
93
|
+
return getOnboardButtonsDefaults() as Partial<Types[T]>;
|
|
94
|
+
case 'OnboardDot':
|
|
95
|
+
return getOnboardDotDefaults() as Partial<Types[T]>;
|
|
96
|
+
case 'OnboardFooter':
|
|
97
|
+
return getOnboardFooterDefaults() as Partial<Types[T]>;
|
|
98
|
+
case 'OnboardImage':
|
|
99
|
+
return getOnboardImageDefaults() as Partial<Types[T]>;
|
|
100
|
+
case 'OnboardItem':
|
|
101
|
+
return getOnboardItemDefaults() as Partial<Types[T]>;
|
|
102
|
+
case 'OnboardProvider':
|
|
103
|
+
return getOnboardProviderDefaults() as Partial<Types[T]>;
|
|
104
|
+
case 'OnboardSubtitle':
|
|
105
|
+
return getOnboardSubtitleDefaults() as Partial<Types[T]>;
|
|
106
|
+
case 'OnboardTitle':
|
|
107
|
+
return getOnboardTitleDefaults() as Partial<Types[T]>;
|
|
108
|
+
case 'text':
|
|
109
|
+
return getTextDefaults() as Partial<Types[T]>;
|
|
110
|
+
case 'view':
|
|
111
|
+
return getViewDefaults() as Partial<Types[T]>;
|
|
112
|
+
default:
|
|
113
|
+
return {};
|
|
114
|
+
}
|
|
115
|
+
}
|
package/src/utils/isOnboard.ts
CHANGED
|
@@ -20,9 +20,9 @@ export const isOnboardExpandingDot = (node: Node): node is NodeData => {
|
|
|
20
20
|
return 'type' in node && (node as NodeData).type === 'OnboardExpandingDot';
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
export const
|
|
23
|
+
export const isOnboardTitle = (node: Node): node is NodeData => {
|
|
24
24
|
if (!node || typeof node !== 'object' || Array.isArray(node)) return false;
|
|
25
|
-
return 'type' in node && (node as NodeData).type === '
|
|
25
|
+
return 'type' in node && (node as NodeData).type === 'OnboardTitle';
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export const isOnboardSubtitle = (node: Node): node is NodeData => {
|
|
@@ -36,7 +36,7 @@ export const isOnboardComponent = (node: Node): boolean => {
|
|
|
36
36
|
isOnboard(node) ||
|
|
37
37
|
isOnboardItem(node) ||
|
|
38
38
|
isOnboardExpandingDot(node) ||
|
|
39
|
-
|
|
39
|
+
isOnboardTitle(node) ||
|
|
40
40
|
isOnboardSubtitle(node) ||
|
|
41
41
|
(function isOnboardButtons(n: Node): n is NodeData {
|
|
42
42
|
if (!n || typeof n !== 'object' || Array.isArray(n)) return false;
|
package/src/utils/novaToJson.ts
CHANGED
|
@@ -89,7 +89,7 @@ function buildCarouselItem(
|
|
|
89
89
|
const title = comp?.attributes?.title_localization_key || '';
|
|
90
90
|
const color = comp?.attributes?.title_color || undefined;
|
|
91
91
|
children.push({
|
|
92
|
-
type: '
|
|
92
|
+
type: 'OnboardTitle',
|
|
93
93
|
attributes: color ? { color } : undefined,
|
|
94
94
|
children: title,
|
|
95
95
|
});
|
package/src/utils/patterns.ts
CHANGED
|
@@ -13,7 +13,7 @@ import onboardItemPattern from '../build-components/OnboardItem/pattern.json';
|
|
|
13
13
|
import onboardImagePattern from '../build-components/OnboardImage/pattern.json';
|
|
14
14
|
import onboardButtonsPattern from '../build-components/OnboardButtons/pattern.json';
|
|
15
15
|
import onboardButtonPattern from '../build-components/OnboardButton/pattern.json';
|
|
16
|
-
import
|
|
16
|
+
import OnboardTitlePattern from '../build-components/OnboardTitle/pattern.json';
|
|
17
17
|
import onboardSubtitlePattern from '../build-components/OnboardSubtitle/pattern.json';
|
|
18
18
|
import onboardFooterPattern from '../build-components/OnboardFooter/pattern.json';
|
|
19
19
|
import onboardExpandingDotPattern from '../build-components/OnboardDot/pattern.json';
|
|
@@ -48,7 +48,7 @@ const patterns: Pattern[] = [
|
|
|
48
48
|
onboardImagePattern as Pattern,
|
|
49
49
|
onboardButtonsPattern as Pattern,
|
|
50
50
|
onboardButtonPattern as Pattern,
|
|
51
|
-
|
|
51
|
+
OnboardTitlePattern as Pattern,
|
|
52
52
|
onboardSubtitlePattern as Pattern,
|
|
53
53
|
onboardFooterPattern as Pattern,
|
|
54
54
|
onboardExpandingDotPattern as Pattern,
|