@developer_tribe/react-builder 1.2.7 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/build-components/BIcon/BIconProps.generated.d.ts +47 -44
  2. package/dist/build-components/BackgroundImage/BackgroundImageProps.generated.d.ts +38 -35
  3. package/dist/build-components/Button/ButtonProps.generated.d.ts +40 -37
  4. package/dist/build-components/Carousel/CarouselProps.generated.d.ts +37 -34
  5. package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +39 -36
  6. package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +38 -35
  7. package/dist/build-components/CarouselItem/CarouselItemProps.generated.d.ts +37 -34
  8. package/dist/build-components/CarouselProvider/CarouselProviderProps.generated.d.ts +37 -34
  9. package/dist/build-components/Image/ImageProps.generated.d.ts +38 -35
  10. package/dist/build-components/Main/MainProps.generated.d.ts +38 -35
  11. package/dist/build-components/Onboard/OnboardProps.generated.d.ts +37 -34
  12. package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +43 -40
  13. package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +44 -41
  14. package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +41 -38
  15. package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +51 -48
  16. package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +40 -37
  17. package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +38 -35
  18. package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +38 -35
  19. package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +44 -41
  20. package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +44 -41
  21. package/dist/build-components/PaywallBackground/PaywallBackgroundProps.generated.d.ts +37 -34
  22. package/dist/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.d.ts +47 -44
  23. package/dist/build-components/PaywallOptions/PaywallOptionsProps.generated.d.ts +37 -34
  24. package/dist/build-components/PaywallProvider/PaywallProviderProps.generated.d.ts +37 -34
  25. package/dist/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.d.ts +40 -37
  26. package/dist/build-components/RadioButton/RadioButtonProps.generated.d.ts +40 -37
  27. package/dist/build-components/Text/TextProps.generated.d.ts +44 -41
  28. package/dist/build-components/View/ViewProps.generated.d.ts +37 -34
  29. package/dist/build-components/patterns.generated.d.ts +21 -21
  30. package/dist/components/BuilderProvider.d.ts +6 -0
  31. package/dist/hooks/useExtractImageStyle.d.ts +3 -1
  32. package/dist/hooks/useExtractTextStyle.d.ts +1 -1
  33. package/dist/hooks/useExtractViewStyle.d.ts +1 -1
  34. package/dist/index.cjs.js +2 -2
  35. package/dist/index.cjs.js.map +1 -1
  36. package/dist/index.d.ts +1 -26
  37. package/dist/index.esm.js +2 -2
  38. package/dist/index.esm.js.map +1 -1
  39. package/dist/index.native.cjs.js +2 -2
  40. package/dist/index.native.cjs.js.map +1 -1
  41. package/dist/index.native.d.ts +4 -0
  42. package/dist/index.native.esm.js +2 -2
  43. package/dist/index.native.esm.js.map +1 -1
  44. package/dist/utils/extractImageStyle.d.ts +3 -0
  45. package/dist/utils/extractTextStyle/extractTextStyleNative.d.ts +17 -0
  46. package/dist/utils/extractTextStyle.d.ts +2 -0
  47. package/dist/utils/extractViewStyle/extractViewStyleNative.d.ts +12 -0
  48. package/dist/utils/extractViewStyle.d.ts +2 -0
  49. package/dist/utils/patterns.d.ts +2 -1
  50. package/package.json +1 -1
  51. package/scripts/prebuild/utils/createGeneratedProps.js +45 -3
  52. package/src/attributes-editor/LayoutPreviewPicker.tsx +4 -3
  53. package/src/build-components/BIcon/BIcon.tsx +3 -2
  54. package/src/build-components/BIcon/BIconProps.generated.ts +48 -44
  55. package/src/build-components/BackgroundImage/BackgroundImage.tsx +5 -3
  56. package/src/build-components/BackgroundImage/BackgroundImageProps.generated.ts +39 -35
  57. package/src/build-components/BackgroundImage/pattern.json +9 -17
  58. package/src/build-components/Button/Button.tsx +5 -4
  59. package/src/build-components/Button/ButtonProps.generated.ts +41 -37
  60. package/src/build-components/Carousel/CarouselProps.generated.ts +38 -34
  61. package/src/build-components/CarouselButtons/CarouselButtons.tsx +3 -2
  62. package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +40 -36
  63. package/src/build-components/CarouselDots/CarouselDots.tsx +1 -1
  64. package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +39 -35
  65. package/src/build-components/CarouselItem/CarouselItemProps.generated.ts +38 -34
  66. package/src/build-components/CarouselProvider/CarouselProviderProps.generated.ts +38 -34
  67. package/src/build-components/Image/Image.tsx +3 -2
  68. package/src/build-components/Image/ImageProps.generated.ts +39 -35
  69. package/src/build-components/Image/pattern.json +9 -16
  70. package/src/build-components/Main/Main.tsx +1 -1
  71. package/src/build-components/Main/MainProps.generated.ts +39 -35
  72. package/src/build-components/Onboard/OnboardProps.generated.ts +38 -34
  73. package/src/build-components/OnboardButton/OnboardButton.tsx +6 -5
  74. package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +44 -40
  75. package/src/build-components/OnboardButtons/OnboardButtons.tsx +4 -4
  76. package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +45 -41
  77. package/src/build-components/OnboardDot/OnboardDot.tsx +5 -4
  78. package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +42 -38
  79. package/src/build-components/OnboardFooter/OnboardFooter.tsx +16 -21
  80. package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +52 -48
  81. package/src/build-components/OnboardImage/OnboardImage.tsx +7 -6
  82. package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +41 -37
  83. package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +39 -35
  84. package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +39 -35
  85. package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +45 -41
  86. package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +45 -41
  87. package/src/build-components/PaywallBackground/PaywallBackgroundProps.generated.ts +38 -34
  88. package/src/build-components/PaywallCloseButton/PaywallCloseButton.tsx +4 -4
  89. package/src/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.ts +48 -44
  90. package/src/build-components/PaywallOptions/PaywallOptionsProps.generated.ts +38 -34
  91. package/src/build-components/PaywallProvider/PaywallProviderProps.generated.ts +38 -34
  92. package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.ts +41 -37
  93. package/src/build-components/RadioButton/RadioButton.tsx +4 -3
  94. package/src/build-components/RadioButton/RadioButtonProps.generated.ts +41 -37
  95. package/src/build-components/Text/Text.tsx +3 -5
  96. package/src/build-components/Text/TextProps.generated.ts +45 -41
  97. package/src/build-components/View/ViewProps.generated.ts +38 -34
  98. package/src/build-components/patterns.generated.ts +21 -21
  99. package/src/components/BuilderProvider.tsx +15 -1
  100. package/src/hooks/useExtractImageStyle.ts +15 -4
  101. package/src/hooks/useExtractTextStyle.ts +11 -3
  102. package/src/hooks/useExtractViewStyle.ts +15 -4
  103. package/src/index.native.ts +6 -0
  104. package/src/index.ts +2 -77
  105. package/src/utils/extractImageStyle.ts +34 -5
  106. package/src/utils/extractTextStyle/extractTextStyle.ts +3 -5
  107. package/src/utils/extractTextStyle/extractTextStyleNative.ts +106 -0
  108. package/src/utils/extractTextStyle.ts +2 -0
  109. package/src/utils/extractViewStyle/extractViewStyle.ts +2 -4
  110. package/src/utils/extractViewStyle/extractViewStyleNative.ts +111 -0
  111. package/src/utils/extractViewStyle.ts +2 -0
  112. package/src/utils/patterns.ts +55 -1
@@ -2,3 +2,6 @@ import { ImagePropsGenerated } from '../build-components/Image/ImageProps.genera
2
2
  import type { NodeData } from '../types/Node';
3
3
  import { ExtractViewStyleOptions } from './extractViewStyle';
4
4
  export declare function extractImageStyle<T extends ImagePropsGenerated['attributes']>(node: NodeData<T>, options?: ExtractViewStyleOptions): import("react").CSSProperties;
5
+ export declare function extractImageStyleNative<T extends ImagePropsGenerated['attributes']>(node: NodeData<T>, options?: ExtractViewStyleOptions): {
6
+ [x: string]: unknown;
7
+ };
@@ -0,0 +1,17 @@
1
+ import type { NodeData } from '../../types/Node';
2
+ import type { TextPropsGenerated } from '../../build-components/Text/TextProps.generated';
3
+ import type { AppConfig } from '../../types/PreviewConfig';
4
+ import type { ProjectColors } from '../../types/Project';
5
+ import type { Fonts } from '../../types/Fonts';
6
+ export type ExtractTextStyleNativeOptions = {
7
+ appConfig?: AppConfig;
8
+ projectColors?: ProjectColors;
9
+ fonts?: Fonts;
10
+ };
11
+ /**
12
+ * React Native-friendly text style extraction.
13
+ * - Avoids web-only quoting of fontFamily.
14
+ * - Returns numeric fontSize (dp) when possible.
15
+ * - Merges with extractViewStyleNative so padding/margin/etc still work in RN.
16
+ */
17
+ export declare function extractTextStyleNative<T extends TextPropsGenerated['attributes']>(node: NodeData<T>, options?: ExtractTextStyleNativeOptions): Record<string, unknown>;
@@ -1,2 +1,4 @@
1
1
  export type { ExtractTextStyleOptions } from './extractTextStyle/extractTextStyle';
2
2
  export { extractTextStyle } from './extractTextStyle/extractTextStyle';
3
+ export type { ExtractTextStyleNativeOptions } from './extractTextStyle/extractTextStyleNative';
4
+ export { extractTextStyleNative } from './extractTextStyle/extractTextStyleNative';
@@ -0,0 +1,12 @@
1
+ import { ViewPropsGenerated } from '../../build-components/View/ViewProps.generated';
2
+ import type { NodeData } from '../../types/Node';
3
+ import type { ProjectColors } from '../../types/Project';
4
+ export type ExtractViewStyleNativeOptions = {
5
+ projectColors?: ProjectColors;
6
+ theme?: string;
7
+ };
8
+ /**
9
+ * Extracts a React Native-friendly style object from node attributes.
10
+ * Unlike the web/CSS extractor, this avoids DOM-only props like overflowX/overflowY and maxWidth/maxHeight "100%" fallbacks.
11
+ */
12
+ export declare function extractViewStyleNative<T extends ViewPropsGenerated['attributes']>(node: NodeData<T>, options?: ExtractViewStyleNativeOptions): Record<string, unknown>;
@@ -1,2 +1,4 @@
1
1
  export type { ExtractViewStyleOptions } from './extractViewStyle/extractViewStyle';
2
2
  export { extractViewStyle } from './extractViewStyle/extractViewStyle';
3
+ export type { ExtractViewStyleNativeOptions } from './extractViewStyle/extractViewStyleNative';
4
+ export { extractViewStyleNative } from './extractViewStyle/extractViewStyleNative';
@@ -45,11 +45,12 @@ type Pattern = {
45
45
  types?: Record<string, Record<string, string | string[]>>;
46
46
  meta?: PatternMeta;
47
47
  };
48
+ export type BuilderPlatform = 'web' | 'native';
48
49
  /** Normalize legacy/variant component type strings to the canonical pattern.type (PascalCase). */
49
50
  export declare function normalizeComponentType(type?: string | null): string | undefined;
50
51
  export declare function getPatternByType(type?: string | null): Pattern | undefined;
51
52
  export declare function getAttributeSchema(type?: string | null): Record<string, string | string[]> | undefined;
52
- export declare function getAttributeMeta(type?: string | null): Record<string, AttributeMeta> | undefined;
53
+ export declare function getAttributeMeta(type?: string | null, platform?: BuilderPlatform): Record<string, AttributeMeta> | undefined;
53
54
  /** Returns defaults block (if any) for a given component type */
54
55
  export declare function getDefaultsForType(type?: string | null): NodeDefaultAttribute | undefined;
55
56
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@developer_tribe/react-builder",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "restricted": true,
@@ -89,6 +89,8 @@ export async function createGeneratedProps(
89
89
  const { pattern } = patternJson;
90
90
  const attributes = pattern.attributes || {};
91
91
  const allTypes = patternJson.types || {};
92
+ const metaStyles =
93
+ (patternJson?.meta?.styles || patternJson?.meta?.attributes || {}) ?? {};
92
94
 
93
95
  // Collect option type aliases for any enum arrays encountered across attributes and custom types
94
96
  const optionAliases = new Map(); // name -> union (string like `'a' | 'b'`)
@@ -134,8 +136,45 @@ export async function createGeneratedProps(
134
136
  return ` ${key}?: ${tsType};`;
135
137
  });
136
138
 
137
- // In schema v2 we always allow a nested `style` object (for CSSProperties-like overrides/defaults).
138
- const styleLine = ` style?: Record<string, unknown>;`;
139
+ const styleKeys = Object.keys(metaStyles);
140
+ const styleInterfaceName = `${componentName}StyleGenerated`;
141
+ const styleInterfaceBlock =
142
+ styleKeys.length > 0
143
+ ? `export interface ${styleInterfaceName} {\n` +
144
+ styleKeys
145
+ .map(k => {
146
+ const attrType = Object.prototype.hasOwnProperty.call(attributes, k)
147
+ ? attributes[k]
148
+ : 'string';
149
+ const tsType = tsTypeFromAttributeType(
150
+ attrType,
151
+ allTypes,
152
+ k,
153
+ registerEnumAlias
154
+ );
155
+ return ` ${k}?: ${tsType};`;
156
+ })
157
+ .join('\n') +
158
+ `\n}\n`
159
+ : '';
160
+
161
+ // In schema v2 we always allow a nested `style` object.
162
+ // If pattern.json declares meta.styles keys, we expose them for autocomplete while keeping flexibility via an index signature.
163
+ const styleLine =
164
+ styleKeys.length > 0
165
+ ? ` style?: ${styleInterfaceName};`
166
+ : ` style?: Record<string, unknown>;`;
167
+
168
+ // If a key is present in meta.styles, treat it as part of attributes.style (avoid duplication at the top-level).
169
+ const styleKeySet = new Set(styleKeys);
170
+ const attributeLinesWithoutStyleKeys =
171
+ styleKeys.length > 0
172
+ ? attributeLines.filter(line => {
173
+ const match = line.trim().match(/^([a-zA-Z0-9_]+)\?:/);
174
+ const key = match?.[1];
175
+ return !key || !styleKeySet.has(key);
176
+ })
177
+ : attributeLines;
139
178
 
140
179
  const childTsType =
141
180
  typeof pattern.children === 'string' ? pattern.children : 'string';
@@ -158,12 +197,15 @@ export async function createGeneratedProps(
158
197
  .join('\n') + '\n\n'
159
198
  : '') +
160
199
  (customTypeBlocks.length ? customTypeBlocks.join('\n') + '\n' : '') +
200
+ (styleInterfaceBlock ? styleInterfaceBlock + '\n' : '') +
161
201
  `\n` +
162
202
  `export interface ${componentName}PropsGenerated {\n` +
163
203
  ` child: ${normalizedChildTsType};\n` +
164
204
  ` attributes: {\n` +
165
205
  `${styleLine}\n` +
166
- (attributeLines.length ? attributeLines.join('\n') + '\n' : '') +
206
+ (attributeLinesWithoutStyleKeys.length
207
+ ? attributeLinesWithoutStyleKeys.join('\n') + '\n'
208
+ : '') +
167
209
  ` };\n` +
168
210
  `}\n` +
169
211
  `\n` +
@@ -94,12 +94,13 @@ function LayoutPreview({
94
94
  const resolved = resolvePreviewContext(mode, option, layoutContext);
95
95
  const isColumn = resolved.flexDirection?.startsWith('column');
96
96
  const resolvedBackground =
97
- viewAttributes?.backgroundColor ??
97
+ (viewAttributes as any)?.style?.backgroundColor ??
98
98
  (isActive
99
99
  ? 'hsl(var(--muted, var(--rb-muted, 220 14.3% 95.9%)) / 0.55)'
100
100
  : 'hsl(var(--muted, var(--rb-muted, 220 14.3% 95.9%)))');
101
- const resolvedGap = parseNumeric(viewAttributes?.gap) ?? 3;
102
- const resolvedBorderRadius = parseNumeric(viewAttributes?.borderRadius) ?? 4;
101
+ const resolvedGap = parseNumeric((viewAttributes as any)?.style?.gap) ?? 3;
102
+ const resolvedBorderRadius =
103
+ parseNumeric((viewAttributes as any)?.style?.borderRadius) ?? 4;
103
104
 
104
105
  const stretchOverrides =
105
106
  resolved.alignItems === 'stretch'
@@ -28,8 +28,9 @@ function BIcon({ node }: BIconComponentProps) {
28
28
  baseStyle,
29
29
  isSelected ? SELECTED_OUTLINE_STYLE : undefined,
30
30
  );
31
- const iconType = node.attributes?.iconType ?? 'activity';
32
- const strokeWidth = node.attributes?.strokeWidth;
31
+ const styleBag = node.attributes?.style;
32
+ const iconType = styleBag?.iconType ?? 'activity';
33
+ const strokeWidth = styleBag?.strokeWidth;
33
34
 
34
35
  return (
35
36
  <Icon
@@ -19,53 +19,57 @@ export type JustifyContentOptionType =
19
19
  | 'space-evenly';
20
20
  export type PositionOptionType = 'relative' | 'absolute';
21
21
 
22
+ export interface BIconStyleGenerated {
23
+ color?: string;
24
+ fontSize?: string;
25
+ fontFamily?: string;
26
+ fontWeight?: string;
27
+ textAlign?: TextAlignOptionType;
28
+ adjustsFontSizeToFit?: boolean;
29
+ showEllipsis?: boolean;
30
+ scrollable?: boolean;
31
+ flexDirection?: FlexDirectionOptionType;
32
+ alignItems?: AlignItemsOptionType;
33
+ justifyContent?: JustifyContentOptionType;
34
+ gap?: string;
35
+ padding?: string;
36
+ paddingHorizontal?: string;
37
+ paddingVertical?: string;
38
+ paddingTop?: string;
39
+ paddingBottom?: string;
40
+ paddingLeft?: string;
41
+ paddingRight?: string;
42
+ margin?: string;
43
+ marginHorizontal?: string;
44
+ marginVertical?: string;
45
+ marginTop?: string;
46
+ marginBottom?: string;
47
+ marginLeft?: string;
48
+ marginRight?: string;
49
+ backgroundColor?: string;
50
+ borderRadius?: string;
51
+ width?: string;
52
+ minWidth?: string;
53
+ maxWidth?: string;
54
+ height?: string;
55
+ minHeight?: string;
56
+ maxHeight?: string;
57
+ flex?: number;
58
+ position?: PositionOptionType;
59
+ top?: string;
60
+ bottom?: string;
61
+ left?: string;
62
+ right?: string;
63
+ zIndex?: number;
64
+ iconType?: string;
65
+ size?: number;
66
+ strokeWidth?: number;
67
+ }
68
+
22
69
  export interface BIconPropsGenerated {
23
70
  child: string;
24
71
  attributes: {
25
- style?: Record<string, unknown>;
26
- color?: string;
27
- fontSize?: string;
28
- fontFamily?: string;
29
- fontWeight?: string;
30
- textAlign?: TextAlignOptionType;
31
- adjustsFontSizeToFit?: boolean;
32
- showEllipsis?: boolean;
33
- scrollable?: boolean;
34
- flexDirection?: FlexDirectionOptionType;
35
- alignItems?: AlignItemsOptionType;
36
- justifyContent?: JustifyContentOptionType;
37
- gap?: string;
38
- padding?: string;
39
- paddingHorizontal?: string;
40
- paddingVertical?: string;
41
- paddingTop?: string;
42
- paddingBottom?: string;
43
- paddingLeft?: string;
44
- paddingRight?: string;
45
- margin?: string;
46
- marginVertical?: string;
47
- marginTop?: string;
48
- marginBottom?: string;
49
- marginLeft?: string;
50
- marginRight?: string;
51
- backgroundColor?: string;
52
- borderRadius?: string;
53
- width?: string;
54
- minWidth?: string;
55
- maxWidth?: string;
56
- height?: string;
57
- minHeight?: string;
58
- maxHeight?: string;
59
- flex?: number;
60
- position?: PositionOptionType;
61
- top?: string;
62
- bottom?: string;
63
- left?: string;
64
- right?: string;
65
- zIndex?: number;
66
- iconType?: string;
67
- size?: number;
68
- strokeWidth?: number;
72
+ style?: BIconStyleGenerated;
69
73
  };
70
74
  }
71
75
 
@@ -20,17 +20,19 @@ function BackgroundImage({ node }: BackgroundImageComponentProps) {
20
20
  const baseStyle = useExtractViewStyle(node);
21
21
  const backgroundStyle = useMemo(() => {
22
22
  const attrs = node.attributes;
23
+ const styleBag = attrs?.style;
23
24
  const style: React.CSSProperties = {
24
25
  backgroundRepeat: 'no-repeat',
25
26
  backgroundPosition: 'center',
26
27
  };
27
28
 
28
- if (attrs?.src) {
29
- const resolved = resolveImageSrc(attrs.src);
29
+ const src = attrs?.src;
30
+ if (src) {
31
+ const resolved = resolveImageSrc(src);
30
32
  if (resolved) style.backgroundImage = `url(${resolved})`;
31
33
  }
32
34
 
33
- switch (attrs?.resizeMode) {
35
+ switch (styleBag?.resizeMode) {
34
36
  case 'cover':
35
37
  style.backgroundSize = 'cover';
36
38
  break;
@@ -19,45 +19,49 @@ export type JustifyContentOptionType =
19
19
  export type PositionOptionType = 'relative' | 'absolute';
20
20
  export type ResizeModeOptionType = 'cover' | 'contain' | 'stretch' | 'center';
21
21
 
22
+ export interface BackgroundImageStyleGenerated {
23
+ scrollable?: boolean;
24
+ flexDirection?: FlexDirectionOptionType;
25
+ alignItems?: AlignItemsOptionType;
26
+ justifyContent?: JustifyContentOptionType;
27
+ gap?: string;
28
+ padding?: string;
29
+ paddingHorizontal?: string;
30
+ paddingVertical?: string;
31
+ paddingTop?: string;
32
+ paddingBottom?: string;
33
+ paddingLeft?: string;
34
+ paddingRight?: string;
35
+ margin?: string;
36
+ marginHorizontal?: string;
37
+ marginVertical?: string;
38
+ marginTop?: string;
39
+ marginBottom?: string;
40
+ marginLeft?: string;
41
+ marginRight?: string;
42
+ backgroundColor?: string;
43
+ borderRadius?: string;
44
+ width?: string;
45
+ minWidth?: string;
46
+ maxWidth?: string;
47
+ height?: string;
48
+ minHeight?: string;
49
+ maxHeight?: string;
50
+ flex?: number;
51
+ position?: PositionOptionType;
52
+ top?: string;
53
+ bottom?: string;
54
+ left?: string;
55
+ right?: string;
56
+ zIndex?: number;
57
+ resizeMode?: ResizeModeOptionType;
58
+ }
59
+
22
60
  export interface BackgroundImagePropsGenerated {
23
61
  child: string;
24
62
  attributes: {
25
- style?: Record<string, unknown>;
26
- scrollable?: boolean;
27
- flexDirection?: FlexDirectionOptionType;
28
- alignItems?: AlignItemsOptionType;
29
- justifyContent?: JustifyContentOptionType;
30
- gap?: string;
31
- padding?: string;
32
- paddingHorizontal?: string;
33
- paddingVertical?: string;
34
- paddingTop?: string;
35
- paddingBottom?: string;
36
- paddingLeft?: string;
37
- paddingRight?: string;
38
- margin?: string;
39
- marginVertical?: string;
40
- marginTop?: string;
41
- marginBottom?: string;
42
- marginLeft?: string;
43
- marginRight?: string;
44
- backgroundColor?: string;
45
- borderRadius?: string;
46
- width?: string;
47
- minWidth?: string;
48
- maxWidth?: string;
49
- height?: string;
50
- minHeight?: string;
51
- maxHeight?: string;
52
- flex?: number;
53
- position?: PositionOptionType;
54
- top?: string;
55
- bottom?: string;
56
- left?: string;
57
- right?: string;
58
- zIndex?: number;
63
+ style?: BackgroundImageStyleGenerated;
59
64
  src?: string;
60
- resizeMode?: ResizeModeOptionType;
61
65
  };
62
66
  }
63
67
 
@@ -6,29 +6,21 @@
6
6
  "extends": "View",
7
7
  "attributes": {
8
8
  "src": "string",
9
- "resizeMode": [
10
- "cover",
11
- "contain",
12
- "stretch",
13
- "center"
14
- ]
9
+ "resizeMode": ["cover", "contain", "stretch", "center"]
15
10
  }
16
11
  },
17
12
  "meta": {
18
- "desiredParent": [
19
- "all",
20
- "background"
21
- ],
13
+ "desiredParent": ["all", "background"],
22
14
  "label": "Background Image",
23
15
  "description": "Background image.",
16
+ "src": {
17
+ "label": "Src",
18
+ "description": "Image source URL.",
19
+ "category": "other",
20
+ "specialCategory": null,
21
+ "sort": 1
22
+ },
24
23
  "styles": {
25
- "src": {
26
- "label": "Src",
27
- "description": "Image source URL.",
28
- "category": "other",
29
- "specialCategory": null,
30
- "sort": 1
31
- },
32
24
  "resizeMode": {
33
25
  "label": "Resize Mode",
34
26
  "description": "How the image fits its container.",
@@ -33,10 +33,11 @@ function Button({ node }: ButtonComponentProps) {
33
33
  combinedTextStyle.textAlign,
34
34
  ]);
35
35
  const buttonDefaults = useMemo(() => {
36
+ const styleBag = node?.attributes?.style;
36
37
  const hasExplicitBackground =
37
- node?.attributes?.backgroundColor !== undefined &&
38
- node?.attributes?.backgroundColor !== null &&
39
- String(node?.attributes?.backgroundColor).trim() !== '';
38
+ styleBag?.backgroundColor !== undefined &&
39
+ styleBag?.backgroundColor !== null &&
40
+ String(styleBag?.backgroundColor).trim() !== '';
40
41
  return {
41
42
  cursor: 'pointer',
42
43
  textDecoration: 'none',
@@ -44,7 +45,7 @@ function Button({ node }: ButtonComponentProps) {
44
45
  ? undefined
45
46
  : { backgroundColor: 'transparent' }),
46
47
  } as React.CSSProperties;
47
- }, [node?.attributes?.backgroundColor]);
48
+ }, [node?.attributes?.style]);
48
49
  const isSelected = isNodeSelected({
49
50
  previewMode: !!previewMode,
50
51
  current: selectedKey ? { key: selectedKey } : undefined,
@@ -30,46 +30,50 @@ export type FontWeightOptionType =
30
30
  | '800'
31
31
  | '900';
32
32
 
33
+ export interface ButtonStyleGenerated {
34
+ scrollable?: boolean;
35
+ flexDirection?: FlexDirectionOptionType;
36
+ alignItems?: AlignItemsOptionType;
37
+ justifyContent?: JustifyContentOptionType;
38
+ gap?: string;
39
+ padding?: string;
40
+ paddingHorizontal?: string;
41
+ paddingVertical?: string;
42
+ paddingTop?: string;
43
+ paddingBottom?: string;
44
+ paddingLeft?: string;
45
+ paddingRight?: string;
46
+ margin?: string;
47
+ marginHorizontal?: string;
48
+ marginVertical?: string;
49
+ marginTop?: string;
50
+ marginBottom?: string;
51
+ marginLeft?: string;
52
+ marginRight?: string;
53
+ backgroundColor?: string;
54
+ borderRadius?: string;
55
+ width?: string;
56
+ minWidth?: string;
57
+ maxWidth?: string;
58
+ height?: string;
59
+ minHeight?: string;
60
+ maxHeight?: string;
61
+ flex?: number;
62
+ position?: PositionOptionType;
63
+ top?: string;
64
+ bottom?: string;
65
+ left?: string;
66
+ right?: string;
67
+ zIndex?: number;
68
+ color?: string;
69
+ fontSize?: string;
70
+ fontWeight?: FontWeightOptionType;
71
+ }
72
+
33
73
  export interface ButtonPropsGenerated {
34
74
  child: string;
35
75
  attributes: {
36
- style?: Record<string, unknown>;
37
- scrollable?: boolean;
38
- flexDirection?: FlexDirectionOptionType;
39
- alignItems?: AlignItemsOptionType;
40
- justifyContent?: JustifyContentOptionType;
41
- gap?: string;
42
- padding?: string;
43
- paddingHorizontal?: string;
44
- paddingVertical?: string;
45
- paddingTop?: string;
46
- paddingBottom?: string;
47
- paddingLeft?: string;
48
- paddingRight?: string;
49
- margin?: string;
50
- marginVertical?: string;
51
- marginTop?: string;
52
- marginBottom?: string;
53
- marginLeft?: string;
54
- marginRight?: string;
55
- backgroundColor?: string;
56
- borderRadius?: string;
57
- width?: string;
58
- minWidth?: string;
59
- maxWidth?: string;
60
- height?: string;
61
- minHeight?: string;
62
- maxHeight?: string;
63
- flex?: number;
64
- position?: PositionOptionType;
65
- top?: string;
66
- bottom?: string;
67
- left?: string;
68
- right?: string;
69
- zIndex?: number;
70
- color?: string;
71
- fontSize?: string;
72
- fontWeight?: FontWeightOptionType;
76
+ style?: ButtonStyleGenerated;
73
77
  };
74
78
  }
75
79
 
@@ -19,43 +19,47 @@ export type JustifyContentOptionType =
19
19
  export type PositionOptionType = 'relative' | 'absolute';
20
20
  export type AlignOptionType = 'start' | 'center' | 'end';
21
21
 
22
+ export interface CarouselStyleGenerated {
23
+ scrollable?: boolean;
24
+ flexDirection?: FlexDirectionOptionType;
25
+ alignItems?: AlignItemsOptionType;
26
+ justifyContent?: JustifyContentOptionType;
27
+ gap?: string;
28
+ padding?: string;
29
+ paddingHorizontal?: string;
30
+ paddingVertical?: string;
31
+ paddingTop?: string;
32
+ paddingBottom?: string;
33
+ paddingLeft?: string;
34
+ paddingRight?: string;
35
+ margin?: string;
36
+ marginHorizontal?: string;
37
+ marginVertical?: string;
38
+ marginTop?: string;
39
+ marginBottom?: string;
40
+ marginLeft?: string;
41
+ marginRight?: string;
42
+ backgroundColor?: string;
43
+ borderRadius?: string;
44
+ width?: string;
45
+ minWidth?: string;
46
+ maxWidth?: string;
47
+ height?: string;
48
+ minHeight?: string;
49
+ maxHeight?: string;
50
+ flex?: number;
51
+ position?: PositionOptionType;
52
+ top?: string;
53
+ bottom?: string;
54
+ left?: string;
55
+ right?: string;
56
+ zIndex?: number;
57
+ }
58
+
22
59
  export interface CarouselPropsGenerated {
23
60
  child: string;
24
61
  attributes: {
25
- style?: Record<string, unknown>;
26
- scrollable?: boolean;
27
- flexDirection?: FlexDirectionOptionType;
28
- alignItems?: AlignItemsOptionType;
29
- justifyContent?: JustifyContentOptionType;
30
- gap?: string;
31
- padding?: string;
32
- paddingHorizontal?: string;
33
- paddingVertical?: string;
34
- paddingTop?: string;
35
- paddingBottom?: string;
36
- paddingLeft?: string;
37
- paddingRight?: string;
38
- margin?: string;
39
- marginVertical?: string;
40
- marginTop?: string;
41
- marginBottom?: string;
42
- marginLeft?: string;
43
- marginRight?: string;
44
- backgroundColor?: string;
45
- borderRadius?: string;
46
- width?: string;
47
- minWidth?: string;
48
- maxWidth?: string;
49
- height?: string;
50
- minHeight?: string;
51
- maxHeight?: string;
52
- flex?: number;
53
- position?: PositionOptionType;
54
- top?: string;
55
- bottom?: string;
56
- left?: string;
57
- right?: string;
58
- zIndex?: number;
62
+ style?: CarouselStyleGenerated;
59
63
  loop?: boolean;
60
64
  dragFree?: boolean;
61
65
  align?: AlignOptionType;
@@ -13,7 +13,8 @@ function CarouselButtons({ node }: CarouselButtonsComponentProps) {
13
13
  const attributeKey = node.key ?? generatedId;
14
14
  const style = useExtractViewStyle(node);
15
15
  const emblaApi = useContext(carouselContext);
16
- const buttonTypes = node.attributes?.buttonType || [
16
+ const styleBag = node.attributes?.style;
17
+ const buttonTypes = styleBag?.buttonType || [
17
18
  'previous_button',
18
19
  'next_button',
19
20
  ];
@@ -43,7 +44,7 @@ function CarouselButtons({ node }: CarouselButtonsComponentProps) {
43
44
  )}
44
45
  {buttonTypes.includes('skip_button') && (
45
46
  <button
46
- onClick={() => emblaApi?.scrollTo(node.attributes?.skipNumber)}
47
+ onClick={() => emblaApi?.scrollTo(styleBag?.skipNumber)}
47
48
  className="embla__button embla__button--skip"
48
49
  >
49
50
  Skip