@developer_tribe/react-builder 1.2.19 → 1.2.21

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 (162) hide show
  1. package/dist/attribute-analyser/style/web/useExtractTextStyle.d.ts +1 -1
  2. package/dist/build-components/BIcon/BIconProps.generated.d.ts +2 -0
  3. package/dist/build-components/BackgroundImage/BackgroundImageProps.generated.d.ts +2 -0
  4. package/dist/build-components/Button/ButtonProps.generated.d.ts +2 -0
  5. package/dist/build-components/Carousel/CarouselProps.generated.d.ts +2 -0
  6. package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +2 -0
  7. package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +2 -0
  8. package/dist/build-components/CarouselItem/CarouselItemProps.generated.d.ts +2 -0
  9. package/dist/build-components/CarouselProvider/CarouselProviderProps.generated.d.ts +2 -0
  10. package/dist/build-components/CountDown/CountDownProps.generated.d.ts +2 -0
  11. package/dist/build-components/Counter/CounterProps.generated.d.ts +2 -0
  12. package/dist/build-components/Image/ImageProps.generated.d.ts +2 -0
  13. package/dist/build-components/Main/MainProps.generated.d.ts +2 -0
  14. package/dist/build-components/Onboard/OnboardProps.generated.d.ts +2 -0
  15. package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +2 -0
  16. package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +2 -0
  17. package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +4 -1
  18. package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +2 -0
  19. package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +2 -0
  20. package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +2 -0
  21. package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +2 -0
  22. package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +2 -0
  23. package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +2 -0
  24. package/dist/build-components/PaywallBackground/PaywallBackgroundProps.generated.d.ts +2 -0
  25. package/dist/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.d.ts +2 -0
  26. package/dist/build-components/PaywallCounter/PaywallCounterProps.generated.d.ts +2 -0
  27. package/dist/build-components/PaywallOptions/PaywallOptionsProps.generated.d.ts +2 -0
  28. package/dist/build-components/PaywallProvider/PaywallProviderProps.generated.d.ts +2 -0
  29. package/dist/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.d.ts +2 -0
  30. package/dist/build-components/RadioButton/RadioButtonProps.generated.d.ts +2 -0
  31. package/dist/build-components/Text/TextProps.generated.d.ts +2 -0
  32. package/dist/build-components/View/View.d.ts +1 -1
  33. package/dist/build-components/View/ViewProps.generated.d.ts +2 -0
  34. package/dist/build-components/patterns.generated.d.ts +310 -10
  35. package/dist/components/BuilderButton.d.ts +3 -1
  36. package/dist/index.cjs.js +4 -4
  37. package/dist/index.cjs.js.map +1 -1
  38. package/dist/index.esm.js +4 -4
  39. package/dist/index.esm.js.map +1 -1
  40. package/dist/index.web.cjs.js +6 -6
  41. package/dist/index.web.cjs.js.map +1 -1
  42. package/dist/index.web.esm.js +4 -4
  43. package/dist/index.web.esm.js.map +1 -1
  44. package/dist/store.d.ts +2 -0
  45. package/dist/styles.css +1 -1
  46. package/dist/utils/extractTextStyle/extractTextStyle.d.ts +1 -0
  47. package/package.json +1 -1
  48. package/scripts/migrate-patterns-to-v2.mjs +13 -8
  49. package/scripts/prebuild/icon-generator.js +34 -37
  50. package/src/assets/loading_animation.json +2587 -1
  51. package/src/assets/meta.json +1 -1
  52. package/src/assets/samples/carousel-sample.json +281 -199
  53. package/src/assets/samples/getSamples.ts +16 -1
  54. package/src/assets/samples/paywall-1.json +93 -77
  55. package/src/assets/samples/paywall-2.json +77 -77
  56. package/src/assets/samples/paywall-app-delete-offer.json +353 -0
  57. package/src/assets/samples/paywall-app-open-offer.json +353 -0
  58. package/src/assets/samples/paywall-back-offer.json +353 -0
  59. package/src/assets/samples/paywall-notification-offer.json +353 -0
  60. package/src/assets/samples/simple-1.json +13 -13
  61. package/src/assets/samples/simple-2.json +97 -97
  62. package/src/assets/samples/unmigrated-builder-1.1.1.json +25 -25
  63. package/src/assets/samples/unmigrated-builder1.json +1 -1
  64. package/src/assets/samples/unvalidated-builder1.json +15 -15
  65. package/src/assets/samples/unvalidated-crash1.json +4 -4
  66. package/src/assets/samples/vpn-onboard-1.json +122 -89
  67. package/src/assets/samples/vpn-onboard-2.json +119 -86
  68. package/src/assets/samples/vpn-onboard-3.json +125 -90
  69. package/src/assets/samples/vpn-onboard-4.json +125 -90
  70. package/src/assets/samples/vpn-onboard-5.json +161 -119
  71. package/src/assets/samples/vpn-onboard-6.json +122 -92
  72. package/src/attribute-analyser/style/web/useExtractTextStyle.ts +9 -2
  73. package/src/build-components/BIcon/BIconProps.generated.ts +2 -0
  74. package/src/build-components/BackgroundImage/BackgroundImageProps.generated.ts +2 -0
  75. package/src/build-components/Button/ButtonProps.generated.ts +2 -0
  76. package/src/build-components/Carousel/CarouselProps.generated.ts +2 -0
  77. package/src/build-components/Carousel/pattern.json +2 -8
  78. package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +2 -0
  79. package/src/build-components/CarouselButtons/pattern.json +2 -9
  80. package/src/build-components/CarouselDots/CarouselDots.tsx +112 -12
  81. package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +2 -0
  82. package/src/build-components/CarouselDots/pattern.json +1 -3
  83. package/src/build-components/CarouselItem/CarouselItemProps.generated.ts +2 -0
  84. package/src/build-components/CarouselItem/pattern.json +1 -3
  85. package/src/build-components/CarouselProvider/CarouselProvider.tsx +5 -44
  86. package/src/build-components/CarouselProvider/CarouselProviderProps.generated.ts +2 -0
  87. package/src/build-components/CarouselProvider/pattern.json +6 -0
  88. package/src/build-components/CountDown/CountDownProps.generated.ts +2 -0
  89. package/src/build-components/CountDown/pattern.json +0 -1
  90. package/src/build-components/Counter/CounterProps.generated.ts +2 -0
  91. package/src/build-components/Counter/pattern.json +0 -1
  92. package/src/build-components/Image/Image.tsx +1 -1
  93. package/src/build-components/Image/ImageProps.generated.ts +2 -0
  94. package/src/build-components/Main/MainProps.generated.ts +2 -0
  95. package/src/build-components/Main/pattern.json +1 -3
  96. package/src/build-components/Onboard/OnboardProps.generated.ts +2 -0
  97. package/src/build-components/Onboard/pattern.json +2 -6
  98. package/src/build-components/OnboardButton/OnboardButton.tsx +0 -4
  99. package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +2 -0
  100. package/src/build-components/OnboardButton/pattern.json +9 -14
  101. package/src/build-components/OnboardButtons/OnboardButtons.tsx +17 -20
  102. package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +2 -0
  103. package/src/build-components/OnboardButtons/pattern.json +15 -15
  104. package/src/build-components/OnboardDot/OnboardDot.tsx +73 -42
  105. package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +4 -1
  106. package/src/build-components/OnboardDot/pattern.json +28 -10
  107. package/src/build-components/OnboardFooter/OnboardFooter.tsx +63 -51
  108. package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +2 -0
  109. package/src/build-components/OnboardFooter/pattern.json +6 -3
  110. package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +2 -0
  111. package/src/build-components/OnboardImage/pattern.json +1 -5
  112. package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +2 -0
  113. package/src/build-components/OnboardItem/pattern.json +3 -11
  114. package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +2 -0
  115. package/src/build-components/OnboardProvider/pattern.json +2 -8
  116. package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +2 -0
  117. package/src/build-components/OnboardSubtitle/pattern.json +1 -4
  118. package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +2 -0
  119. package/src/build-components/OnboardTitle/pattern.json +1 -4
  120. package/src/build-components/PaywallBackground/PaywallBackgroundProps.generated.ts +2 -0
  121. package/src/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.ts +2 -0
  122. package/src/build-components/PaywallCloseButton/pattern.json +1 -3
  123. package/src/build-components/PaywallCounter/PaywallCounterProps.generated.ts +2 -0
  124. package/src/build-components/PaywallCounter/pattern.json +0 -1
  125. package/src/build-components/PaywallOptions/PaywallOptions.tsx +1 -1
  126. package/src/build-components/PaywallOptions/PaywallOptionsProps.generated.ts +2 -0
  127. package/src/build-components/PaywallOptions/pattern.json +1 -3
  128. package/src/build-components/PaywallProvider/PaywallProviderProps.generated.ts +2 -0
  129. package/src/build-components/PaywallProvider/pattern.json +1 -3
  130. package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.ts +2 -0
  131. package/src/build-components/PaywallSubscribeButton/pattern.json +1 -3
  132. package/src/build-components/RadioButton/RadioButtonProps.generated.ts +2 -0
  133. package/src/build-components/RadioButton/pattern.json +1 -3
  134. package/src/build-components/RenderNode.generated.tsx +1 -1
  135. package/src/build-components/Text/TextProps.generated.ts +2 -0
  136. package/src/build-components/View/View.tsx +11 -7
  137. package/src/build-components/View/ViewProps.generated.ts +2 -0
  138. package/src/build-components/View/pattern.json +8 -0
  139. package/src/build-components/patterns.generated.ts +300 -10
  140. package/src/build-components/useNode.ts +20 -4
  141. package/src/components/Builder.tsx +98 -8
  142. package/src/components/BuilderButton.tsx +39 -7
  143. package/src/components/DeviceButton.tsx +5 -1
  144. package/src/pages/DebugJsonPage.tsx +109 -1
  145. package/src/pages/ProjectDebug.tsx +0 -1
  146. package/src/pages/ProjectPage.tsx +2 -2
  147. package/src/store.ts +8 -0
  148. package/src/styles/base/_global.scss +0 -5
  149. package/src/styles/components/_editor-shell.scss +18 -3
  150. package/src/styles/components/_onboard.scss +0 -17
  151. package/src/styles/foundation/_colors.scss +1 -4
  152. package/src/styles/foundation/_typography.scss +0 -1
  153. package/src/styles/layout/_builder.scss +20 -0
  154. package/src/styles/modals/_product-presets-modal.scss +0 -2
  155. package/src/styles/utilities/_carousel.scss +0 -32
  156. package/src/utils/analyseNodeByPatterns.ts +16 -6
  157. package/src/utils/extractTextStyle/extractTextStyle.ts +47 -13
  158. package/src/utils/extractViewStyle/extractViewStyle.ts +118 -39
  159. package/src/utils/logRenderStore.ts +7 -9
  160. package/src/utils/logger.ts +1 -5
  161. package/src/utils/novaToJson.ts +7 -3
  162. package/src/utils/repairNodeKeys.ts +1 -4
@@ -387,14 +387,24 @@ function validateAttributesByPattern(
387
387
  {}) as AttributeSchema;
388
388
  const styleSchema = getStyleSubSchema(schema);
389
389
 
390
- // Validate nested `attributes.style` as an object; validate any style keys that also exist in schema.
391
390
  const maybeStyle = (attrs as Record<string, unknown>).style;
391
+ const maybeStyles = (attrs as Record<string, unknown>).styles;
392
+
393
+ // schemaVersion=2 requires `attributes.styles` (plural), not `attributes.style` (singular)
392
394
  if (maybeStyle != null) {
393
- if (!isPlainObject(maybeStyle)) {
394
- return fail(`style must be an object`, joinPath(path, 'style'));
395
+ return fail(
396
+ `Legacy attribute "style" detected. Use "styles" instead (schemaVersion=2). Found at ${joinPath(path, 'style')}`,
397
+ joinPath(path, 'style'),
398
+ );
399
+ }
400
+
401
+ // Validate nested `attributes.styles` (canonical store for AttributesEditor).
402
+ if (maybeStyles != null) {
403
+ if (!isPlainObject(maybeStyles)) {
404
+ return fail(`styles must be an object`, joinPath(path, 'styles'));
395
405
  }
396
406
  for (const [styleKey, styleValue] of Object.entries(
397
- maybeStyle as Record<string, unknown>,
407
+ maybeStyles as Record<string, unknown>,
398
408
  )) {
399
409
  const spec = (styleSchema?.[styleKey] ?? schema?.[styleKey]) as
400
410
  | AttributeTypeSpec
@@ -404,14 +414,14 @@ function validateAttributesByPattern(
404
414
  pattern.pattern.type,
405
415
  styleValue,
406
416
  spec,
407
- joinPath(joinPath(path, 'style'), styleKey),
417
+ joinPath(joinPath(path, 'styles'), styleKey),
408
418
  );
409
419
  if (!res.valid) return res;
410
420
  }
411
421
  }
412
422
 
413
423
  for (const [attrName, attrValue] of Object.entries(attrs)) {
414
- if (attrName === 'style') continue;
424
+ if (attrName === 'style' || attrName === 'styles') continue;
415
425
  const attrSpec = schema?.[attrName] as AttributeTypeSpec | undefined;
416
426
  if (!attrSpec) {
417
427
  if (attrName === 'title' || attrName === 'description') {
@@ -1,5 +1,8 @@
1
1
  import type { NodeData } from '../../types/Node';
2
- import type { TextPropsGenerated } from '../../build-components/Text/TextProps.generated';
2
+ import type {
3
+ TextPropsGenerated,
4
+ TextStyleGenerated,
5
+ } from '../../build-components/Text/TextProps.generated';
3
6
  import type { AppConfig } from '../../types/PreviewConfig';
4
7
  import { defaultAppConfig } from '../../types/PreviewConfig';
5
8
  import type { ProjectColors } from '../../types/Project';
@@ -86,6 +89,7 @@ export type ExtractTextStyleOptions = {
86
89
  fonts?: Fonts;
87
90
  onFontLoaded?: (fontFamily: string) => void;
88
91
  onError?: (error: string) => void;
92
+ directlyTextStyle?: boolean;
89
93
  };
90
94
 
91
95
  export function extractTextStyle<T extends TextPropsGenerated['attributes']>(
@@ -93,13 +97,13 @@ export function extractTextStyle<T extends TextPropsGenerated['attributes']>(
93
97
  options: ExtractTextStyleOptions = {},
94
98
  ) {
95
99
  const attributes = node.attributes;
96
- const styleBag = (attributes as any)?.style as
97
- | Record<string, unknown>
100
+ const styleBag = (attributes as Record<string, unknown>)?.style as
101
+ | TextStyleGenerated
98
102
  | undefined;
99
103
  const get = (key: string): unknown => {
100
- const direct = (attributes as any)?.[key];
104
+ const direct = (attributes as Record<string, unknown>)?.[key];
101
105
  if (direct !== undefined && direct !== null) return direct;
102
- return styleBag?.[key];
106
+ return styleBag?.[key as keyof TextStyleGenerated];
103
107
  };
104
108
  const resolvedAppConfig = options.appConfig ?? defaultAppConfig;
105
109
  const { screenStyle, theme } = resolvedAppConfig;
@@ -115,15 +119,15 @@ export function extractTextStyle<T extends TextPropsGenerated['attributes']>(
115
119
  }
116
120
 
117
121
  // Typography
118
- const fontSize = get('fontSize') as any;
122
+ const fontSize = get('fontSize') as string | number | undefined;
119
123
  if (fontSize !== undefined) {
120
124
  const parsed = parseSize(fontSize);
121
125
  style.fontSize = parsed as React.CSSProperties['fontSize'];
122
126
  } else {
123
127
  style.fontSize = fs(14);
124
128
  }
125
- const fontFamily = get('fontFamily') as any;
126
- const fontWeight = get('fontWeight') as any;
129
+ const fontFamily = get('fontFamily') as string | undefined;
130
+ const fontWeight = get('fontWeight') as string | number | undefined;
127
131
  const requestedWeight = weightToNumericKey(fontWeight);
128
132
  const normalizedFontFamily =
129
133
  typeof fontFamily === 'string' && fontFamily.trim().length > 0
@@ -163,18 +167,48 @@ export function extractTextStyle<T extends TextPropsGenerated['attributes']>(
163
167
  // If no fontFamily is set, keep previous behavior.
164
168
  if (!normalizedFontFamily && normalizedFontWeight)
165
169
  style.fontWeight = normalizedFontWeight;
166
- const resolvedTextColor = parseColor(get('color') as any, {
170
+ const resolvedTextColor = parseColor(get('color') as string | undefined, {
167
171
  projectColors: options.projectColors,
168
172
  theme,
169
173
  });
170
174
  style.color = resolvedTextColor ?? fallbackColor;
171
- const textAlign = get('textAlign');
172
- if (textAlign)
173
- style.textAlign = textAlign as React.CSSProperties['textAlign'];
175
+ const textAlign = get('textAlign') as
176
+ | React.CSSProperties['textAlign']
177
+ | undefined;
178
+ if (textAlign) {
179
+ style.textAlign = textAlign;
180
+ }
174
181
 
175
182
  const viewStyle = extractViewStyle(node, {
176
183
  projectColors: options.projectColors,
177
184
  theme,
178
185
  });
179
- return { ...viewStyle, ...style };
186
+ const fullStyle = { ...viewStyle, ...style };
187
+
188
+ // If directlyTextStyle is true, return only text-related styles
189
+ if (options.directlyTextStyle) {
190
+ const textStyleProperties = new Set<keyof React.CSSProperties>([
191
+ 'fontSize',
192
+ 'fontFamily',
193
+ 'fontWeight',
194
+ 'color',
195
+ 'textAlign',
196
+ 'lineHeight',
197
+ 'letterSpacing',
198
+ 'textDecoration',
199
+ 'textTransform',
200
+ ]);
201
+
202
+ const textStyle: React.CSSProperties = {};
203
+ for (const key in fullStyle) {
204
+ const typedKey = key as keyof React.CSSProperties;
205
+ if (textStyleProperties.has(typedKey)) {
206
+ (textStyle as Record<string, unknown>)[key] = fullStyle[typedKey];
207
+ }
208
+ }
209
+
210
+ return textStyle;
211
+ }
212
+
213
+ return fullStyle;
180
214
  }
@@ -1,4 +1,7 @@
1
- import { ViewPropsGenerated } from '../../build-components/View/ViewProps.generated';
1
+ import {
2
+ ViewPropsGenerated,
3
+ type ViewStyleGenerated,
4
+ } from '../../build-components/View/ViewProps.generated';
2
5
  import type { NodeData } from '../../types/Node';
3
6
  import type { ProjectColors } from '../../types/Project';
4
7
  import { parseSize } from '../../size-matters';
@@ -14,16 +17,16 @@ export function extractViewStyle<T extends ViewPropsGenerated['attributes']>(
14
17
  options: ExtractViewStyleOptions = {},
15
18
  ) {
16
19
  const attributes = node.attributes;
17
- const styleBag = (attributes as any)?.style as
18
- | Record<string, unknown>
20
+ const styleBag = (attributes as Record<string, unknown>)?.style as
21
+ | ViewStyleGenerated
19
22
  | undefined;
20
23
  const get = (key: string): unknown => {
21
- const direct = (attributes as any)?.[key];
24
+ const direct = (attributes as Record<string, unknown>)?.[key];
22
25
  if (direct !== undefined && direct !== null) return direct;
23
- return styleBag?.[key];
26
+ return styleBag?.[key as keyof ViewStyleGenerated];
24
27
  };
25
28
 
26
- const scrollable = (get('scrollable') as any) ?? false;
29
+ const scrollable = (get('scrollable') as boolean | undefined) ?? false;
27
30
  const style: React.CSSProperties = {
28
31
  display: 'flex',
29
32
  flexDirection: 'column',
@@ -50,7 +53,13 @@ export function extractViewStyle<T extends ViewPropsGenerated['attributes']>(
50
53
  }
51
54
  }
52
55
  const flexDirection = get('flexDirection');
53
- if (flexDirection) style.flexDirection = flexDirection as any;
56
+ if (flexDirection) {
57
+ style.flexDirection = flexDirection as React.CSSProperties['flexDirection'];
58
+ }
59
+ const flexWrap = get('flexWrap');
60
+ if (flexWrap) {
61
+ style.flexWrap = flexWrap as React.CSSProperties['flexWrap'];
62
+ }
54
63
  const alignItems = get('alignItems');
55
64
  if (alignItems)
56
65
  style.alignItems = alignItems as React.CSSProperties['alignItems'];
@@ -67,17 +76,20 @@ export function extractViewStyle<T extends ViewPropsGenerated['attributes']>(
67
76
  style[property] = parsed as React.CSSProperties[K];
68
77
  };
69
78
 
70
- setParsedSize('gap', get('gap') as any);
71
- setParsedSize('padding', get('padding') as any);
72
- setParsedSize('margin', get('margin') as any);
79
+ setParsedSize('gap', get('gap') as string | number | undefined);
80
+ setParsedSize('padding', get('padding') as string | number | undefined);
81
+ setParsedSize('margin', get('margin') as string | number | undefined);
73
82
 
74
- const paddingHorizontal = get('paddingHorizontal') as any;
83
+ const paddingHorizontal = get('paddingHorizontal') as
84
+ | string
85
+ | number
86
+ | undefined;
75
87
  if (!isEmptySizeValue(paddingHorizontal)) {
76
88
  const parsed = parseSize(paddingHorizontal);
77
89
  style.paddingLeft = parsed as React.CSSProperties['paddingLeft'];
78
90
  style.paddingRight = parsed as React.CSSProperties['paddingRight'];
79
91
  }
80
- const paddingVertical = get('paddingVertical') as any;
92
+ const paddingVertical = get('paddingVertical') as string | number | undefined;
81
93
  if (!isEmptySizeValue(paddingVertical)) {
82
94
  const parsed = parseSize(paddingVertical);
83
95
  style.paddingTop = parsed as React.CSSProperties['paddingTop'];
@@ -85,34 +97,50 @@ export function extractViewStyle<T extends ViewPropsGenerated['attributes']>(
85
97
  }
86
98
 
87
99
  // Explicit per-side paddings should override paddingHorizontal/paddingVertical.
88
- setParsedSize('paddingTop', get('paddingTop') as any);
89
- setParsedSize('paddingBottom', get('paddingBottom') as any);
90
- setParsedSize('paddingLeft', get('paddingLeft') as any);
91
- setParsedSize('paddingRight', get('paddingRight') as any);
100
+ setParsedSize('paddingTop', get('paddingTop') as string | number | undefined);
101
+ setParsedSize(
102
+ 'paddingBottom',
103
+ get('paddingBottom') as string | number | undefined,
104
+ );
105
+ setParsedSize(
106
+ 'paddingLeft',
107
+ get('paddingLeft') as string | number | undefined,
108
+ );
109
+ setParsedSize(
110
+ 'paddingRight',
111
+ get('paddingRight') as string | number | undefined,
112
+ );
92
113
 
93
114
  const marginHorizontalRaw =
94
115
  ((attributes as Record<string, unknown>).marginHorizontal as
95
116
  | string
96
117
  | number
97
- | undefined) ?? (styleBag?.marginHorizontal as any);
118
+ | undefined) ??
119
+ (styleBag?.marginHorizontal as string | number | undefined);
98
120
  if (!isEmptySizeValue(marginHorizontalRaw)) {
99
121
  const parsed = parseSize(marginHorizontalRaw);
100
122
  style.marginLeft = parsed as React.CSSProperties['marginLeft'];
101
123
  style.marginRight = parsed as React.CSSProperties['marginRight'];
102
124
  }
103
125
 
104
- const marginVertical = get('marginVertical') as any;
126
+ const marginVertical = get('marginVertical') as string | number | undefined;
105
127
  if (!isEmptySizeValue(marginVertical)) {
106
128
  const parsed = parseSize(marginVertical);
107
129
  style.marginTop = parsed as React.CSSProperties['marginTop'];
108
130
  style.marginBottom = parsed as React.CSSProperties['marginBottom'];
109
131
  }
110
132
 
111
- setParsedSize('marginTop', get('marginTop') as any);
112
- setParsedSize('marginBottom', get('marginBottom') as any);
113
- setParsedSize('marginLeft', get('marginLeft') as any);
114
- setParsedSize('marginRight', get('marginRight') as any);
115
- const backgroundColor = get('backgroundColor') as any;
133
+ setParsedSize('marginTop', get('marginTop') as string | number | undefined);
134
+ setParsedSize(
135
+ 'marginBottom',
136
+ get('marginBottom') as string | number | undefined,
137
+ );
138
+ setParsedSize('marginLeft', get('marginLeft') as string | number | undefined);
139
+ setParsedSize(
140
+ 'marginRight',
141
+ get('marginRight') as string | number | undefined,
142
+ );
143
+ const backgroundColor = get('backgroundColor') as string | undefined;
116
144
  if (backgroundColor) {
117
145
  style.backgroundColor =
118
146
  parseColor(backgroundColor, {
@@ -120,23 +148,74 @@ export function extractViewStyle<T extends ViewPropsGenerated['attributes']>(
120
148
  theme: options.theme,
121
149
  }) ?? backgroundColor;
122
150
  }
123
- setParsedSize('borderRadius', get('borderRadius') as any);
124
- setParsedSize('width', get('width') as any);
125
- setParsedSize('minWidth', get('minWidth') as any);
126
- setParsedSize('maxWidth', get('maxWidth') as any);
127
- setParsedSize('height', get('height') as any);
128
- setParsedSize('minHeight', get('minHeight') as any);
129
- setParsedSize('maxHeight', get('maxHeight') as any);
130
- const flex = get('flex') as any;
151
+ setParsedSize(
152
+ 'borderRadius',
153
+ get('borderRadius') as string | number | undefined,
154
+ );
155
+ setParsedSize('width', get('width') as string | number | undefined);
156
+ setParsedSize('minWidth', get('minWidth') as string | number | undefined);
157
+ setParsedSize('maxWidth', get('maxWidth') as string | number | undefined);
158
+ setParsedSize('height', get('height') as string | number | undefined);
159
+ setParsedSize('minHeight', get('minHeight') as string | number | undefined);
160
+ setParsedSize('maxHeight', get('maxHeight') as string | number | undefined);
161
+ const flex = get('flex') as number | undefined;
131
162
  if (flex !== undefined) style.flex = flex as React.CSSProperties['flex'];
132
- const position = get('position') as any;
133
- if (position) style.position = position as React.CSSProperties['position'];
134
- setParsedSize('top', get('top') as any);
135
- setParsedSize('bottom', get('bottom') as any);
136
- setParsedSize('left', get('left') as any);
137
- setParsedSize('right', get('right') as any);
138
- const zIndex = get('zIndex') as any;
163
+ const position = get('position') as
164
+ | React.CSSProperties['position']
165
+ | undefined;
166
+ if (position) style.position = position;
167
+ setParsedSize('top', get('top') as string | number | undefined);
168
+ setParsedSize('bottom', get('bottom') as string | number | undefined);
169
+ setParsedSize('left', get('left') as string | number | undefined);
170
+ setParsedSize('right', get('right') as string | number | undefined);
171
+ const zIndex = get('zIndex') as number | undefined;
139
172
  if (zIndex !== undefined)
140
173
  style.zIndex = zIndex as React.CSSProperties['zIndex'];
141
- return style;
174
+
175
+ // Filter out any text style properties that might have been included
176
+ const viewStyleProperties = new Set<keyof React.CSSProperties>([
177
+ 'display',
178
+ 'flexDirection',
179
+ 'flexWrap',
180
+ 'alignItems',
181
+ 'justifyContent',
182
+ 'gap',
183
+ 'padding',
184
+ 'paddingTop',
185
+ 'paddingBottom',
186
+ 'paddingLeft',
187
+ 'paddingRight',
188
+ 'margin',
189
+ 'marginTop',
190
+ 'marginBottom',
191
+ 'marginLeft',
192
+ 'marginRight',
193
+ 'backgroundColor',
194
+ 'borderRadius',
195
+ 'width',
196
+ 'minWidth',
197
+ 'maxWidth',
198
+ 'height',
199
+ 'minHeight',
200
+ 'maxHeight',
201
+ 'flex',
202
+ 'position',
203
+ 'top',
204
+ 'bottom',
205
+ 'left',
206
+ 'right',
207
+ 'zIndex',
208
+ 'overflowX',
209
+ 'overflowY',
210
+ ]);
211
+
212
+ const filteredStyle: React.CSSProperties = {};
213
+ for (const key in style) {
214
+ const typedKey = key as keyof React.CSSProperties;
215
+ if (viewStyleProperties.has(typedKey)) {
216
+ (filteredStyle as Record<string, unknown>)[key] = style[typedKey];
217
+ }
218
+ }
219
+
220
+ return filteredStyle;
142
221
  }
@@ -1,3 +1,5 @@
1
+ /* eslint-disable no-console */
2
+ // This file is a debug utility specifically designed to log to console for debugging purposes.
1
3
  import { useRenderStore } from '../store';
2
4
 
3
5
  export type LogRenderStoreOptions = {
@@ -17,7 +19,7 @@ function safeStringify(value: unknown): string {
17
19
  value,
18
20
  (_key, v) => {
19
21
  if (typeof v === 'function') {
20
- const name = (v as Function).name;
22
+ const name = (v as (...args: unknown[]) => unknown).name;
21
23
  return `[Function${name ? `: ${name}` : ''}]`;
22
24
  }
23
25
  if (typeof v === 'bigint') return v.toString();
@@ -82,7 +84,6 @@ export function logRenderStore(options: LogRenderStoreOptions = {}): void {
82
84
 
83
85
  if (isFn(groupCollapsed)) groupCollapsed(title);
84
86
  else {
85
- // eslint-disable-next-line no-console
86
87
  console.log(title);
87
88
  }
88
89
 
@@ -103,24 +104,21 @@ export function logRenderStore(options: LogRenderStoreOptions = {}): void {
103
104
 
104
105
  // NOTE: Logging objects in devtools can be confusing because they are "live" references.
105
106
  // This JSON string is a stable snapshot of this click, and is copy/paste-friendly.
106
- // eslint-disable-next-line no-console
107
+
107
108
  console.log('json', json);
108
109
 
109
- // eslint-disable-next-line no-console
110
110
  console.log('state', snapshot);
111
- // eslint-disable-next-line no-console
111
+
112
112
  console.log('actions', actions);
113
- // eslint-disable-next-line no-console
113
+
114
114
  console.log('rawState (includes functions)', state);
115
115
 
116
116
  if (includeLocalStorage) {
117
- // eslint-disable-next-line no-console
118
117
  console.log('localStorage.render-store (raw)', persistedRaw);
119
- // eslint-disable-next-line no-console
118
+
120
119
  console.log('localStorage.render-store (parsed)', persistedParsed);
121
120
  }
122
121
  if (extra) {
123
- // eslint-disable-next-line no-console
124
122
  console.log('extra', extra);
125
123
  }
126
124
 
@@ -24,19 +24,15 @@ function consoleLog(
24
24
  const prefix = `[${source}] ${message}`;
25
25
  switch (level) {
26
26
  case 'ERROR':
27
- // eslint-disable-next-line no-console
28
27
  console.error(prefix, payload);
29
28
  break;
30
29
  case 'WARN':
31
- // eslint-disable-next-line no-console
32
30
  console.warn(prefix, payload);
33
31
  break;
34
32
  case 'INFO':
35
- // eslint-disable-next-line no-console
36
33
  console.info(prefix, payload);
37
34
  break;
38
35
  case 'VERBOSE':
39
- // eslint-disable-next-line no-console
40
36
  console.debug(prefix, payload);
41
37
  break;
42
38
  default:
@@ -47,7 +43,7 @@ function consoleLog(
47
43
  export const logger = {
48
44
  setLevel(level: LogLevel) {
49
45
  useRenderStore.getState().setLogLevel(level);
50
- // eslint-disable-next-line no-console
46
+
51
47
  console.info(`[Logger] level set to ${level}`);
52
48
  },
53
49
  log(level: LogLevel, source: LogSource, message: string, payload?: unknown) {
@@ -474,7 +474,7 @@ function mapDotsFromGeneralComponents(generalComponents: any[]): Node | null {
474
474
  };
475
475
 
476
476
  const inactiveDotOpacity = parseNumber(dotAttrs?.inactive_dot_opacity);
477
- const expandingDotWidth = parseNumber(dotAttrs?.expanding_dot_width);
477
+ const dotThickness = parseNumber(dotAttrs?.dot_thickness);
478
478
  const dot_style =
479
479
  typeof dotAttrs?.dot_style === 'string'
480
480
  ? (dotAttrs.dot_style as string)
@@ -487,16 +487,20 @@ function mapDotsFromGeneralComponents(generalComponents: any[]): Node | null {
487
487
  typeof dotAttrs?.active_dot_color === 'string'
488
488
  ? (dotAttrs.active_dot_color as string)
489
489
  : undefined;
490
+ const inactive_dot_color =
491
+ typeof dotAttrs?.inactive_dot_color === 'string'
492
+ ? (dotAttrs.inactive_dot_color as string)
493
+ : undefined;
490
494
 
491
495
  const attributes: Record<string, unknown> = {};
492
496
  if (dotType) attributes.dotType = dotType;
493
497
  if (inactiveDotOpacity !== undefined)
494
498
  attributes.inactive_dot_opacity = inactiveDotOpacity;
495
- if (expandingDotWidth !== undefined)
496
- attributes.expanding_dot_width = expandingDotWidth;
499
+ if (dotThickness !== undefined) attributes.dot_thickness = dotThickness;
497
500
  if (dot_style) attributes.dot_style = dot_style;
498
501
  if (container_style) attributes.container_style = container_style;
499
502
  if (active_dot_color) attributes.active_dot_color = active_dot_color;
503
+ if (inactive_dot_color) attributes.inactive_dot_color = inactive_dot_color;
500
504
  return {
501
505
  type: 'OnboardDot',
502
506
  attributes: Object.keys(attributes).length ? attributes : undefined,
@@ -53,10 +53,7 @@ function generateUniqueKey(type: string, usedKeys: Set<string>): string {
53
53
  *
54
54
  * `usedKeys` is mutated by design (to track uniqueness across recursion).
55
55
  */
56
- export function repairNodeKeys(
57
- root: Node,
58
- usedKeys: Set<string> = new Set(),
59
- ): Node {
56
+ export function repairNodeKeys(root: Node, usedKeys = new Set<string>()): Node {
60
57
  if (root === null || root === undefined) return root;
61
58
  if (typeof root === 'string') return root;
62
59