@developer_tribe/react-builder 1.2.7 → 1.2.9

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 (204) hide show
  1. package/dist/AttributesEditor.d.ts +2 -11
  2. package/dist/attribute-analyser/style/native/useExtractImageStyle.d.ts +10 -0
  3. package/dist/attribute-analyser/style/native/useExtractTextStyle.d.ts +9 -0
  4. package/dist/attribute-analyser/style/native/useExtractViewStyle.d.ts +8 -0
  5. package/dist/attribute-analyser/style/web/useExtractImageStyle.d.ts +4 -0
  6. package/dist/attribute-analyser/style/web/useExtractTextStyle.d.ts +4 -0
  7. package/dist/attribute-analyser/style/web/useExtractViewStyle.d.ts +4 -0
  8. package/dist/attributes-editor/AttributesEditorFields.d.ts +18 -0
  9. package/dist/attributes-editor/AttributesEditorView.d.ts +4 -0
  10. package/dist/attributes-editor/attributesEditorModelTypes.d.ts +67 -0
  11. package/dist/attributes-editor/attributesEditorUtils.d.ts +19 -0
  12. package/dist/attributes-editor/useAttributesEditorModel.d.ts +2 -0
  13. package/dist/build-components/BIcon/BIconProps.generated.d.ts +41 -38
  14. package/dist/build-components/BackgroundImage/BackgroundImageProps.generated.d.ts +37 -34
  15. package/dist/build-components/Button/ButtonProps.generated.d.ts +39 -36
  16. package/dist/build-components/Carousel/CarouselProps.generated.d.ts +37 -34
  17. package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +37 -34
  18. package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +37 -34
  19. package/dist/build-components/CarouselItem/CarouselItemProps.generated.d.ts +36 -33
  20. package/dist/build-components/CarouselProvider/CarouselProviderProps.generated.d.ts +36 -33
  21. package/dist/build-components/Image/ImageProps.generated.d.ts +38 -33
  22. package/dist/build-components/Main/MainProps.generated.d.ts +36 -33
  23. package/dist/build-components/Onboard/OnboardProps.generated.d.ts +36 -33
  24. package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +38 -34
  25. package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +39 -36
  26. package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +43 -34
  27. package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +41 -38
  28. package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +36 -31
  29. package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +39 -33
  30. package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +38 -34
  31. package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +41 -38
  32. package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +41 -38
  33. package/dist/build-components/PaywallBackground/PaywallBackgroundProps.generated.d.ts +36 -33
  34. package/dist/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.d.ts +41 -38
  35. package/dist/build-components/PaywallOptions/PaywallOptionsProps.generated.d.ts +36 -33
  36. package/dist/build-components/PaywallProvider/PaywallProviderProps.generated.d.ts +36 -33
  37. package/dist/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.d.ts +39 -36
  38. package/dist/build-components/RadioButton/RadioButtonProps.generated.d.ts +36 -33
  39. package/dist/build-components/Text/TextProps.generated.d.ts +41 -38
  40. package/dist/build-components/View/ViewProps.generated.d.ts +36 -33
  41. package/dist/build-components/patterns.generated.d.ts +2673 -5787
  42. package/dist/components/BuilderProvider.d.ts +6 -0
  43. package/dist/index.cjs.js +5 -5
  44. package/dist/index.cjs.js.map +1 -1
  45. package/dist/index.d.ts +5 -26
  46. package/dist/index.esm.js +5 -5
  47. package/dist/index.esm.js.map +1 -1
  48. package/dist/index.native.cjs.js +6 -4
  49. package/dist/index.native.cjs.js.map +1 -1
  50. package/dist/index.native.d.ts +6 -3
  51. package/dist/index.native.esm.js +6 -4
  52. package/dist/index.native.esm.js.map +1 -1
  53. package/dist/migrations/migratePipe.d.ts +1 -1
  54. package/dist/migrations/migrations/1.1.2_extract_component_attributes_from_style.d.ts +2 -0
  55. package/dist/mockOS/components/PermissionModal.d.ts +1 -2
  56. package/dist/styles.css +1 -1
  57. package/dist/types/PreviewConfig.d.ts +1 -5
  58. package/dist/utils/extractImageStyle.d.ts +3 -0
  59. package/dist/utils/extractTextStyle/extractTextStyleNative.d.ts +17 -0
  60. package/dist/utils/extractTextStyle.d.ts +2 -0
  61. package/dist/utils/extractViewStyle/extractViewStyleNative.d.ts +12 -0
  62. package/dist/utils/extractViewStyle.d.ts +2 -0
  63. package/dist/utils/getMeta.d.ts +5 -0
  64. package/dist/utils/patterns.d.ts +14 -1
  65. package/package.json +2 -1
  66. package/scripts/prebuild/prebuild.js +14 -0
  67. package/scripts/prebuild/utils/createGeneratedProps.js +51 -3
  68. package/scripts/prebuild/utils/index.js +1 -0
  69. package/scripts/prebuild/utils/updateMetaJson.js +66 -0
  70. package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +37 -3
  71. package/scripts/prebuild/utils/validatePatternJson.js +27 -2
  72. package/scripts/public/scripts/build/index.js +20 -3
  73. package/scripts/public/scripts/build/info.json +6 -0
  74. package/scripts/public/scripts/build/utils/createComponentsIndex.js +9 -3
  75. package/scripts/public/scripts/build/utils/createRenderNodeGenerated.js +66 -8
  76. package/src/AttributesEditor.tsx +8 -944
  77. package/src/assets/meta.json +4 -0
  78. package/src/assets/samples/carousel-sample.json +1 -1
  79. package/src/assets/samples/getSamples.ts +2 -0
  80. package/src/assets/samples/paywall-1.json +11 -7
  81. package/src/assets/samples/simple-1.json +3 -3
  82. package/src/assets/samples/simple-2.json +3 -3
  83. package/src/assets/samples/unmigrated-builder-1.1.1.json +87 -0
  84. package/src/assets/samples/unmigrated-builder1.json +1 -1
  85. package/src/assets/samples/unvalidated-builder1.json +3 -3
  86. package/src/assets/samples/unvalidated-crash1.json +1 -1
  87. package/src/assets/samples/unvalidated-crashcomponent1.json +1 -1
  88. package/src/assets/samples/vpn-onboard-1.json +1 -1
  89. package/src/assets/samples/vpn-onboard-2.json +1 -1
  90. package/src/assets/samples/vpn-onboard-3.json +1 -1
  91. package/src/assets/samples/vpn-onboard-4.json +1 -1
  92. package/src/assets/samples/vpn-onboard-5.json +1 -1
  93. package/src/assets/samples/vpn-onboard-6.json +1 -1
  94. package/src/attribute-analyser/style/native/useExtractImageStyle.ts +46 -0
  95. package/src/attribute-analyser/style/native/useExtractTextStyle.ts +50 -0
  96. package/src/attribute-analyser/style/native/useExtractViewStyle.ts +32 -0
  97. package/src/attribute-analyser/style/web/useExtractImageStyle.ts +20 -0
  98. package/src/{hooks → attribute-analyser/style/web}/useExtractTextStyle.ts +7 -6
  99. package/src/{hooks → attribute-analyser/style/web}/useExtractViewStyle.ts +7 -6
  100. package/src/attributes-editor/AttributesEditorFields.tsx +248 -0
  101. package/src/attributes-editor/AttributesEditorView.tsx +360 -0
  102. package/src/attributes-editor/LayoutPreviewPicker.tsx +4 -3
  103. package/src/attributes-editor/attributesEditorModelTypes.ts +86 -0
  104. package/src/attributes-editor/attributesEditorUtils.ts +102 -0
  105. package/src/attributes-editor/useAttributesEditorModel.ts +477 -0
  106. package/src/build-components/BIcon/BIcon.tsx +4 -3
  107. package/src/build-components/BIcon/BIconProps.generated.ts +42 -38
  108. package/src/build-components/BIcon/pattern.json +5 -6
  109. package/src/build-components/BackgroundImage/BackgroundImage.tsx +7 -4
  110. package/src/build-components/BackgroundImage/BackgroundImageProps.generated.ts +38 -34
  111. package/src/build-components/BackgroundImage/pattern.json +9 -17
  112. package/src/build-components/Button/Button.tsx +7 -6
  113. package/src/build-components/Button/ButtonProps.generated.ts +40 -36
  114. package/src/build-components/Button/pattern.json +17 -15
  115. package/src/build-components/Carousel/Carousel.tsx +1 -1
  116. package/src/build-components/Carousel/CarouselProps.generated.ts +38 -34
  117. package/src/build-components/CarouselButtons/CarouselButtons.tsx +4 -6
  118. package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +41 -37
  119. package/src/build-components/CarouselButtons/pattern.json +2 -1
  120. package/src/build-components/CarouselDots/CarouselDots.tsx +2 -2
  121. package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +44 -40
  122. package/src/build-components/CarouselItem/CarouselItem.tsx +1 -1
  123. package/src/build-components/CarouselItem/CarouselItemProps.generated.ts +37 -33
  124. package/src/build-components/CarouselProvider/CarouselProvider.tsx +1 -1
  125. package/src/build-components/CarouselProvider/CarouselProviderProps.generated.ts +37 -33
  126. package/src/build-components/Image/Image.tsx +4 -3
  127. package/src/build-components/Image/ImageProps.generated.ts +39 -33
  128. package/src/build-components/Image/pattern.json +5 -11
  129. package/src/build-components/Main/Main.tsx +1 -1
  130. package/src/build-components/Main/MainProps.generated.ts +37 -33
  131. package/src/build-components/Main/pattern.json +2 -1
  132. package/src/build-components/Onboard/OnboardProps.generated.ts +37 -33
  133. package/src/build-components/OnboardButton/OnboardButton.tsx +8 -6
  134. package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +44 -39
  135. package/src/build-components/OnboardButton/pattern.json +9 -7
  136. package/src/build-components/OnboardButtons/OnboardButtons.tsx +31 -31
  137. package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +43 -39
  138. package/src/build-components/OnboardButtons/pattern.json +9 -7
  139. package/src/build-components/OnboardDot/OnboardDot.tsx +7 -5
  140. package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +55 -34
  141. package/src/build-components/OnboardFooter/OnboardFooter.tsx +19 -23
  142. package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +42 -38
  143. package/src/build-components/OnboardFooter/pattern.json +16 -14
  144. package/src/build-components/OnboardImage/OnboardImage.tsx +8 -7
  145. package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +37 -31
  146. package/src/build-components/OnboardImage/pattern.json +2 -1
  147. package/src/build-components/OnboardItem/OnboardItem.tsx +1 -1
  148. package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +40 -33
  149. package/src/build-components/OnboardItem/pattern.json +2 -1
  150. package/src/build-components/OnboardProvider/OnboardProvider.tsx +1 -1
  151. package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +39 -34
  152. package/src/build-components/OnboardProvider/pattern.json +2 -1
  153. package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +42 -38
  154. package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +42 -38
  155. package/src/build-components/PaywallBackground/PaywallBackground.tsx +1 -1
  156. package/src/build-components/PaywallBackground/PaywallBackgroundProps.generated.ts +37 -33
  157. package/src/build-components/PaywallCloseButton/PaywallCloseButton.tsx +6 -5
  158. package/src/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.ts +42 -38
  159. package/src/build-components/PaywallOptions/PaywallOptionButton.tsx +1 -1
  160. package/src/build-components/PaywallOptions/PaywallOptionsProps.generated.ts +37 -33
  161. package/src/build-components/PaywallProvider/PaywallProvider.tsx +1 -1
  162. package/src/build-components/PaywallProvider/PaywallProviderProps.generated.ts +37 -33
  163. package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButton.tsx +1 -1
  164. package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.ts +40 -36
  165. package/src/build-components/RadioButton/RadioButton.tsx +5 -4
  166. package/src/build-components/RadioButton/RadioButtonProps.generated.ts +37 -33
  167. package/src/build-components/RadioButton/pattern.json +9 -7
  168. package/src/build-components/Text/Text.tsx +6 -8
  169. package/src/build-components/Text/TextProps.generated.ts +42 -38
  170. package/src/build-components/Text/pattern.json +15 -11
  171. package/src/build-components/View/View.tsx +1 -1
  172. package/src/build-components/View/ViewProps.generated.ts +37 -33
  173. package/src/build-components/View/pattern.json +71 -66
  174. package/src/build-components/patterns.generated.ts +3022 -5971
  175. package/src/components/AttributesEditorPanel.tsx +2 -2
  176. package/src/components/BuilderProvider.tsx +15 -1
  177. package/src/index.native.ts +7 -4
  178. package/src/index.ts +6 -77
  179. package/src/migrations/migratePipe.ts +7 -3
  180. package/src/migrations/migrations/1.1.2_extract_component_attributes_from_style.ts +211 -0
  181. package/src/mockOS/components/MockOSRouter.tsx +3 -1
  182. package/src/mockOS/components/PermissionModal.tsx +20 -160
  183. package/src/mockOS/components/SubscriptionModal.tsx +41 -278
  184. package/src/pages/ProjectPage.tsx +12 -6
  185. package/src/styles/components/_attributes-editor.scss +122 -0
  186. package/src/styles/components/_mockos-router.scss +388 -0
  187. package/src/styles/components/_onboard.scss +23 -0
  188. package/src/styles/index.scss +1 -0
  189. package/src/types/PreviewConfig.ts +1 -5
  190. package/src/utils/analyseNodeByPatterns.ts +39 -4
  191. package/src/utils/extractImageStyle.ts +34 -5
  192. package/src/utils/extractTextStyle/extractTextStyle.ts +7 -6
  193. package/src/utils/extractTextStyle/extractTextStyleNative.ts +106 -0
  194. package/src/utils/extractTextStyle.ts +2 -0
  195. package/src/utils/extractViewStyle/extractViewStyle.ts +2 -4
  196. package/src/utils/extractViewStyle/extractViewStyleNative.ts +111 -0
  197. package/src/utils/extractViewStyle.ts +2 -0
  198. package/src/utils/getMeta.ts +15 -0
  199. package/src/utils/patterns.ts +100 -3
  200. package/dist/hooks/useExtractImageStyle.d.ts +0 -3
  201. package/dist/hooks/useExtractTextStyle.d.ts +0 -3
  202. package/dist/hooks/useExtractViewStyle.d.ts +0 -3
  203. package/src/hooks/useExtractImageStyle.ts +0 -19
  204. package/src/migrations/migrations/1.1.0_normalize_style_attributes.ts +0 -80
@@ -2,7 +2,7 @@ import React, { useId, useMemo } from 'react';
2
2
  import type { PaywallBackgroundComponentProps } from './PaywallBackgroundProps.generated';
3
3
  import useNode from '../useNode';
4
4
  import { useBuilderParams } from '../../components/BuilderProvider';
5
- import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
5
+ import { useExtractViewStyle } from '../../attribute-analyser/style/web/useExtractViewStyle';
6
6
  import { useLogRender } from '../../utils/useLogRender';
7
7
  import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
8
8
  import { useMergedStyle } from '../../utils/useMergedStyle';
@@ -18,43 +18,47 @@ export type JustifyContentOptionType =
18
18
  | 'space-evenly';
19
19
  export type PositionOptionType = 'relative' | 'absolute';
20
20
 
21
+ export interface PaywallBackgroundStyleGenerated {
22
+ flexDirection?: FlexDirectionOptionType;
23
+ alignItems?: AlignItemsOptionType;
24
+ justifyContent?: JustifyContentOptionType;
25
+ gap?: string;
26
+ padding?: string;
27
+ paddingHorizontal?: string;
28
+ paddingVertical?: string;
29
+ paddingTop?: string;
30
+ paddingBottom?: string;
31
+ paddingLeft?: string;
32
+ paddingRight?: string;
33
+ margin?: string;
34
+ marginHorizontal?: string;
35
+ marginVertical?: string;
36
+ marginTop?: string;
37
+ marginBottom?: string;
38
+ marginLeft?: string;
39
+ marginRight?: string;
40
+ backgroundColor?: string;
41
+ borderRadius?: string;
42
+ width?: string;
43
+ minWidth?: string;
44
+ maxWidth?: string;
45
+ height?: string;
46
+ minHeight?: string;
47
+ maxHeight?: string;
48
+ flex?: number;
49
+ position?: PositionOptionType;
50
+ top?: string;
51
+ bottom?: string;
52
+ left?: string;
53
+ right?: string;
54
+ zIndex?: number;
55
+ }
56
+
21
57
  export interface PaywallBackgroundPropsGenerated {
22
58
  child: string;
23
59
  attributes: {
24
- style?: Record<string, unknown>;
60
+ style?: PaywallBackgroundStyleGenerated;
25
61
  scrollable?: boolean;
26
- flexDirection?: FlexDirectionOptionType;
27
- alignItems?: AlignItemsOptionType;
28
- justifyContent?: JustifyContentOptionType;
29
- gap?: string;
30
- padding?: string;
31
- paddingHorizontal?: string;
32
- paddingVertical?: string;
33
- paddingTop?: string;
34
- paddingBottom?: string;
35
- paddingLeft?: string;
36
- paddingRight?: string;
37
- margin?: string;
38
- marginVertical?: string;
39
- marginTop?: string;
40
- marginBottom?: string;
41
- marginLeft?: string;
42
- marginRight?: string;
43
- backgroundColor?: string;
44
- borderRadius?: string;
45
- width?: string;
46
- minWidth?: string;
47
- maxWidth?: string;
48
- height?: string;
49
- minHeight?: string;
50
- maxHeight?: string;
51
- flex?: number;
52
- position?: PositionOptionType;
53
- top?: string;
54
- bottom?: string;
55
- left?: string;
56
- right?: string;
57
- zIndex?: number;
58
62
  };
59
63
  }
60
64
 
@@ -2,7 +2,7 @@ import React, { useId, useMemo } from 'react';
2
2
  import type { PaywallCloseButtonComponentProps } from './PaywallCloseButtonProps.generated';
3
3
  import useNode from '../useNode';
4
4
  import { useBuilderParams } from '../../components/BuilderProvider';
5
- import { useExtractTextStyle } from '../../hooks/useExtractTextStyle';
5
+ import { useExtractTextStyle } from '../../attribute-analyser/style/web/useExtractTextStyle';
6
6
  import { useLogRender } from '../../utils/useLogRender';
7
7
  import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
8
8
  import { useMergedStyle } from '../../utils/useMergedStyle';
@@ -33,12 +33,13 @@ function PaywallCloseButton({ node }: PaywallCloseButtonComponentProps) {
33
33
  isSelected ? SELECTED_OUTLINE_STYLE : undefined,
34
34
  );
35
35
 
36
- const iconType = node.attributes?.iconType ?? 'close';
37
- const size =
38
- node.attributes?.size ?? (style.fontSize as number | undefined) ?? 24;
36
+ const attrs = node.attributes;
37
+ const styleBag = attrs?.style;
38
+ const iconType = attrs?.iconType ?? 'close';
39
+ const size = attrs?.size ?? (style.fontSize as number | undefined) ?? 24;
39
40
  const color =
40
41
  (style.color as string | undefined) ??
41
- (node.attributes?.color as string | undefined);
42
+ (styleBag?.color as string | undefined);
42
43
 
43
44
  return (
44
45
  <a
@@ -19,53 +19,57 @@ export type JustifyContentOptionType =
19
19
  | 'space-evenly';
20
20
  export type PositionOptionType = 'relative' | 'absolute';
21
21
 
22
+ export interface PaywallCloseButtonStyleGenerated {
23
+ color?: string;
24
+ fontSize?: string;
25
+ fontFamily?: string;
26
+ fontWeight?: string;
27
+ textAlign?: TextAlignOptionType;
28
+ flexDirection?: FlexDirectionOptionType;
29
+ alignItems?: AlignItemsOptionType;
30
+ justifyContent?: JustifyContentOptionType;
31
+ gap?: string;
32
+ padding?: string;
33
+ paddingHorizontal?: string;
34
+ paddingVertical?: string;
35
+ paddingTop?: string;
36
+ paddingBottom?: string;
37
+ paddingLeft?: string;
38
+ paddingRight?: string;
39
+ margin?: string;
40
+ marginHorizontal?: string;
41
+ marginVertical?: string;
42
+ marginTop?: string;
43
+ marginBottom?: string;
44
+ marginLeft?: string;
45
+ marginRight?: string;
46
+ backgroundColor?: string;
47
+ borderRadius?: string;
48
+ width?: string;
49
+ minWidth?: string;
50
+ maxWidth?: string;
51
+ height?: string;
52
+ minHeight?: string;
53
+ maxHeight?: string;
54
+ flex?: number;
55
+ position?: PositionOptionType;
56
+ top?: string;
57
+ bottom?: string;
58
+ left?: string;
59
+ right?: string;
60
+ zIndex?: number;
61
+ }
62
+
22
63
  export interface PaywallCloseButtonPropsGenerated {
23
64
  child: string;
24
65
  attributes: {
25
- style?: Record<string, unknown>;
66
+ style?: PaywallCloseButtonStyleGenerated;
26
67
  iconType?: string;
27
68
  size?: number;
28
69
  strokeWidth?: number;
29
- color?: string;
30
- fontSize?: string;
31
- fontFamily?: string;
32
- fontWeight?: string;
33
- textAlign?: TextAlignOptionType;
34
70
  adjustsFontSizeToFit?: boolean;
35
71
  showEllipsis?: boolean;
36
72
  scrollable?: boolean;
37
- flexDirection?: FlexDirectionOptionType;
38
- alignItems?: AlignItemsOptionType;
39
- justifyContent?: JustifyContentOptionType;
40
- gap?: string;
41
- padding?: string;
42
- paddingHorizontal?: string;
43
- paddingVertical?: string;
44
- paddingTop?: string;
45
- paddingBottom?: string;
46
- paddingLeft?: string;
47
- paddingRight?: string;
48
- margin?: string;
49
- marginVertical?: string;
50
- marginTop?: string;
51
- marginBottom?: string;
52
- marginLeft?: string;
53
- marginRight?: string;
54
- backgroundColor?: string;
55
- borderRadius?: string;
56
- width?: string;
57
- minWidth?: string;
58
- maxWidth?: string;
59
- height?: string;
60
- minHeight?: string;
61
- maxHeight?: string;
62
- flex?: number;
63
- position?: PositionOptionType;
64
- top?: string;
65
- bottom?: string;
66
- left?: string;
67
- right?: string;
68
- zIndex?: number;
69
73
  };
70
74
  }
71
75
 
@@ -1,6 +1,6 @@
1
1
  import { useId, useMemo } from 'react';
2
2
  import type { Product } from '../../paywall/types/paywall-types';
3
- import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
3
+ import { useExtractViewStyle } from '../../attribute-analyser/style/web/useExtractViewStyle';
4
4
  import type { NodeData } from '../../types/Node';
5
5
  import { useBuilderParams } from '../../components/BuilderProvider';
6
6
  import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
@@ -18,43 +18,47 @@ export type JustifyContentOptionType =
18
18
  | 'space-evenly';
19
19
  export type PositionOptionType = 'relative' | 'absolute';
20
20
 
21
+ export interface PaywallOptionsStyleGenerated {
22
+ flexDirection?: FlexDirectionOptionType;
23
+ alignItems?: AlignItemsOptionType;
24
+ justifyContent?: JustifyContentOptionType;
25
+ gap?: string;
26
+ padding?: string;
27
+ paddingHorizontal?: string;
28
+ paddingVertical?: string;
29
+ paddingTop?: string;
30
+ paddingBottom?: string;
31
+ paddingLeft?: string;
32
+ paddingRight?: string;
33
+ margin?: string;
34
+ marginHorizontal?: string;
35
+ marginVertical?: string;
36
+ marginTop?: string;
37
+ marginBottom?: string;
38
+ marginLeft?: string;
39
+ marginRight?: string;
40
+ backgroundColor?: string;
41
+ borderRadius?: string;
42
+ width?: string;
43
+ minWidth?: string;
44
+ maxWidth?: string;
45
+ height?: string;
46
+ minHeight?: string;
47
+ maxHeight?: string;
48
+ flex?: number;
49
+ position?: PositionOptionType;
50
+ top?: string;
51
+ bottom?: string;
52
+ left?: string;
53
+ right?: string;
54
+ zIndex?: number;
55
+ }
56
+
21
57
  export interface PaywallOptionsPropsGenerated {
22
58
  child: string;
23
59
  attributes: {
24
- style?: Record<string, unknown>;
60
+ style?: PaywallOptionsStyleGenerated;
25
61
  scrollable?: boolean;
26
- flexDirection?: FlexDirectionOptionType;
27
- alignItems?: AlignItemsOptionType;
28
- justifyContent?: JustifyContentOptionType;
29
- gap?: string;
30
- padding?: string;
31
- paddingHorizontal?: string;
32
- paddingVertical?: string;
33
- paddingTop?: string;
34
- paddingBottom?: string;
35
- paddingLeft?: string;
36
- paddingRight?: string;
37
- margin?: string;
38
- marginVertical?: string;
39
- marginTop?: string;
40
- marginBottom?: string;
41
- marginLeft?: string;
42
- marginRight?: string;
43
- backgroundColor?: string;
44
- borderRadius?: string;
45
- width?: string;
46
- minWidth?: string;
47
- maxWidth?: string;
48
- height?: string;
49
- minHeight?: string;
50
- maxHeight?: string;
51
- flex?: number;
52
- position?: PositionOptionType;
53
- top?: string;
54
- bottom?: string;
55
- left?: string;
56
- right?: string;
57
- zIndex?: number;
58
62
  };
59
63
  }
60
64
 
@@ -3,7 +3,7 @@ import type { PaywallProviderComponentProps } from './PaywallProviderProps.gener
3
3
  import RenderNode from '../RenderNode.generated';
4
4
  import type { Node } from '../../types/Node';
5
5
  import useNode from '../useNode';
6
- import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
6
+ import { useExtractViewStyle } from '../../attribute-analyser/style/web/useExtractViewStyle';
7
7
  import { useLogRender } from '../../utils/useLogRender';
8
8
  import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
9
9
  import { useMergedStyle } from '../../utils/useMergedStyle';
@@ -18,43 +18,47 @@ export type JustifyContentOptionType =
18
18
  | 'space-evenly';
19
19
  export type PositionOptionType = 'relative' | 'absolute';
20
20
 
21
+ export interface PaywallProviderStyleGenerated {
22
+ flexDirection?: FlexDirectionOptionType;
23
+ alignItems?: AlignItemsOptionType;
24
+ justifyContent?: JustifyContentOptionType;
25
+ gap?: string;
26
+ padding?: string;
27
+ paddingHorizontal?: string;
28
+ paddingVertical?: string;
29
+ paddingTop?: string;
30
+ paddingBottom?: string;
31
+ paddingLeft?: string;
32
+ paddingRight?: string;
33
+ margin?: string;
34
+ marginHorizontal?: string;
35
+ marginVertical?: string;
36
+ marginTop?: string;
37
+ marginBottom?: string;
38
+ marginLeft?: string;
39
+ marginRight?: string;
40
+ backgroundColor?: string;
41
+ borderRadius?: string;
42
+ width?: string;
43
+ minWidth?: string;
44
+ maxWidth?: string;
45
+ height?: string;
46
+ minHeight?: string;
47
+ maxHeight?: string;
48
+ flex?: number;
49
+ position?: PositionOptionType;
50
+ top?: string;
51
+ bottom?: string;
52
+ left?: string;
53
+ right?: string;
54
+ zIndex?: number;
55
+ }
56
+
21
57
  export interface PaywallProviderPropsGenerated {
22
58
  child: string;
23
59
  attributes: {
24
- style?: Record<string, unknown>;
60
+ style?: PaywallProviderStyleGenerated;
25
61
  scrollable?: boolean;
26
- flexDirection?: FlexDirectionOptionType;
27
- alignItems?: AlignItemsOptionType;
28
- justifyContent?: JustifyContentOptionType;
29
- gap?: string;
30
- padding?: string;
31
- paddingHorizontal?: string;
32
- paddingVertical?: string;
33
- paddingTop?: string;
34
- paddingBottom?: string;
35
- paddingLeft?: string;
36
- paddingRight?: string;
37
- margin?: string;
38
- marginVertical?: string;
39
- marginTop?: string;
40
- marginBottom?: string;
41
- marginLeft?: string;
42
- marginRight?: string;
43
- backgroundColor?: string;
44
- borderRadius?: string;
45
- width?: string;
46
- minWidth?: string;
47
- maxWidth?: string;
48
- height?: string;
49
- minHeight?: string;
50
- maxHeight?: string;
51
- flex?: number;
52
- position?: PositionOptionType;
53
- top?: string;
54
- bottom?: string;
55
- left?: string;
56
- right?: string;
57
- zIndex?: number;
58
62
  };
59
63
  }
60
64
 
@@ -3,7 +3,7 @@ import type { PaywallSubscribeButtonComponentProps } from './PaywallSubscribeBut
3
3
  import useNode from '../useNode';
4
4
  import { useBuilderParams } from '../../components/BuilderProvider';
5
5
  import { useLogRender } from '../../utils/useLogRender';
6
- import { useExtractTextStyle } from '../../hooks/useExtractTextStyle';
6
+ import { useExtractTextStyle } from '../../attribute-analyser/style/web/useExtractTextStyle';
7
7
  import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
8
8
  import { useMergedStyle } from '../../utils/useMergedStyle';
9
9
  import { useLocalize } from '../../hooks/useLocalize';
@@ -30,46 +30,50 @@ export type JustifyContentOptionType =
30
30
  | 'space-evenly';
31
31
  export type PositionOptionType = 'relative' | 'absolute';
32
32
 
33
+ export interface PaywallSubscribeButtonStyleGenerated {
34
+ color?: string;
35
+ fontSize?: string;
36
+ fontWeight?: FontWeightOptionType;
37
+ flexDirection?: FlexDirectionOptionType;
38
+ alignItems?: AlignItemsOptionType;
39
+ justifyContent?: JustifyContentOptionType;
40
+ gap?: string;
41
+ padding?: string;
42
+ paddingHorizontal?: string;
43
+ paddingVertical?: string;
44
+ paddingTop?: string;
45
+ paddingBottom?: string;
46
+ paddingLeft?: string;
47
+ paddingRight?: string;
48
+ margin?: string;
49
+ marginHorizontal?: 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
+ }
71
+
33
72
  export interface PaywallSubscribeButtonPropsGenerated {
34
73
  child: string;
35
74
  attributes: {
36
- style?: Record<string, unknown>;
37
- color?: string;
38
- fontSize?: string;
39
- fontWeight?: FontWeightOptionType;
75
+ style?: PaywallSubscribeButtonStyleGenerated;
40
76
  scrollable?: boolean;
41
- flexDirection?: FlexDirectionOptionType;
42
- alignItems?: AlignItemsOptionType;
43
- justifyContent?: JustifyContentOptionType;
44
- gap?: string;
45
- padding?: string;
46
- paddingHorizontal?: string;
47
- paddingVertical?: string;
48
- paddingTop?: string;
49
- paddingBottom?: string;
50
- paddingLeft?: string;
51
- paddingRight?: string;
52
- margin?: string;
53
- marginVertical?: string;
54
- marginTop?: string;
55
- marginBottom?: string;
56
- marginLeft?: string;
57
- marginRight?: string;
58
- backgroundColor?: string;
59
- borderRadius?: string;
60
- width?: string;
61
- minWidth?: string;
62
- maxWidth?: string;
63
- height?: string;
64
- minHeight?: string;
65
- maxHeight?: string;
66
- flex?: number;
67
- position?: PositionOptionType;
68
- top?: string;
69
- bottom?: string;
70
- left?: string;
71
- right?: string;
72
- zIndex?: number;
73
77
  };
74
78
  }
75
79
 
@@ -2,7 +2,7 @@ import React, { useContext, useId, useMemo } from 'react';
2
2
  import type { RadioButtonComponentProps } from './RadioButtonProps.generated';
3
3
  import useNode from '../useNode';
4
4
  import { useBuilderParams } from '../../components/BuilderProvider';
5
- import { useExtractViewStyle } from '../../hooks/useExtractViewStyle';
5
+ import { useExtractViewStyle } from '../../attribute-analyser/style/web/useExtractViewStyle';
6
6
  import { useLogRender } from '../../utils/useLogRender';
7
7
  import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
8
8
  import { useMergedStyle } from '../../utils/useMergedStyle';
@@ -96,9 +96,10 @@ function RadioButton({ node }: RadioButtonComponentProps) {
96
96
  isSelected ? SELECTED_OUTLINE_STYLE : undefined,
97
97
  );
98
98
 
99
- const selected = Boolean(node.attributes?.selected);
100
- const color = node.attributes?.color;
101
- const size = parseNumberLike(node.attributes?.size);
99
+ const attrs = node.attributes;
100
+ const selected = Boolean(attrs?.selected);
101
+ const color = attrs?.color;
102
+ const size = parseNumberLike(attrs?.size);
102
103
 
103
104
  return (
104
105
  <div
@@ -18,43 +18,47 @@ export type JustifyContentOptionType =
18
18
  | 'space-evenly';
19
19
  export type PositionOptionType = 'relative' | 'absolute';
20
20
 
21
+ export interface RadioButtonStyleGenerated {
22
+ flexDirection?: FlexDirectionOptionType;
23
+ alignItems?: AlignItemsOptionType;
24
+ justifyContent?: JustifyContentOptionType;
25
+ gap?: string;
26
+ padding?: string;
27
+ paddingHorizontal?: string;
28
+ paddingVertical?: string;
29
+ paddingTop?: string;
30
+ paddingBottom?: string;
31
+ paddingLeft?: string;
32
+ paddingRight?: string;
33
+ margin?: string;
34
+ marginHorizontal?: string;
35
+ marginVertical?: string;
36
+ marginTop?: string;
37
+ marginBottom?: string;
38
+ marginLeft?: string;
39
+ marginRight?: string;
40
+ backgroundColor?: string;
41
+ borderRadius?: string;
42
+ width?: string;
43
+ minWidth?: string;
44
+ maxWidth?: string;
45
+ height?: string;
46
+ minHeight?: string;
47
+ maxHeight?: string;
48
+ flex?: number;
49
+ position?: PositionOptionType;
50
+ top?: string;
51
+ bottom?: string;
52
+ left?: string;
53
+ right?: string;
54
+ zIndex?: number;
55
+ }
56
+
21
57
  export interface RadioButtonPropsGenerated {
22
58
  child: string;
23
59
  attributes: {
24
- style?: Record<string, unknown>;
60
+ style?: RadioButtonStyleGenerated;
25
61
  scrollable?: boolean;
26
- flexDirection?: FlexDirectionOptionType;
27
- alignItems?: AlignItemsOptionType;
28
- justifyContent?: JustifyContentOptionType;
29
- gap?: string;
30
- padding?: string;
31
- paddingHorizontal?: string;
32
- paddingVertical?: string;
33
- paddingTop?: string;
34
- paddingBottom?: string;
35
- paddingLeft?: string;
36
- paddingRight?: string;
37
- margin?: string;
38
- marginVertical?: string;
39
- marginTop?: string;
40
- marginBottom?: string;
41
- marginLeft?: string;
42
- marginRight?: string;
43
- backgroundColor?: string;
44
- borderRadius?: string;
45
- width?: string;
46
- minWidth?: string;
47
- maxWidth?: string;
48
- height?: string;
49
- minHeight?: string;
50
- maxHeight?: string;
51
- flex?: number;
52
- position?: PositionOptionType;
53
- top?: string;
54
- bottom?: string;
55
- left?: string;
56
- right?: string;
57
- zIndex?: number;
58
62
  selected?: boolean;
59
63
  color?: string;
60
64
  size?: number;
@@ -17,13 +17,6 @@
17
17
  "label": "Radio Button",
18
18
  "description": "Generic radio button icon.",
19
19
  "styles": {
20
- "selected": {
21
- "label": "Selected",
22
- "description": "Whether the radio is selected.",
23
- "category": "other",
24
- "specialCategory": null,
25
- "sort": 0
26
- },
27
20
  "color": {
28
21
  "label": "Color",
29
22
  "description": "Radio color.",
@@ -38,6 +31,15 @@
38
31
  "specialCategory": null,
39
32
  "sort": 2
40
33
  }
34
+ },
35
+ "attributes": {
36
+ "selected": {
37
+ "label": "Selected",
38
+ "description": "Whether the radio is selected.",
39
+ "category": "other",
40
+ "specialCategory": null,
41
+ "sort": 0
42
+ }
41
43
  }
42
44
  }
43
45
  }
@@ -8,7 +8,7 @@ import React, {
8
8
  import type { TextComponentProps } from './TextProps.generated';
9
9
  import useNode from '../useNode';
10
10
  import { useBuilderParams } from '../../components/BuilderProvider';
11
- import { useExtractTextStyle } from '../../hooks/useExtractTextStyle';
11
+ import { useExtractTextStyle } from '../../attribute-analyser/style/web/useExtractTextStyle';
12
12
  import { useLogRender } from '../../utils/useLogRender';
13
13
  import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
14
14
  import { useMergedStyle } from '../../utils/useMergedStyle';
@@ -37,13 +37,11 @@ function Text({ node }: TextComponentProps) {
37
37
  [localize, keyOrText],
38
38
  );
39
39
 
40
- const attrs = node.attributes;
41
- const styleBag = attrs?.style;
42
- const adjustsFontSizeToFit = attrs?.adjustsFontSizeToFit ?? false;
43
- const showEllipsis =
44
- attrs?.showEllipsis ??
45
- (styleBag?.showEllipsis as boolean | undefined) ??
46
- false;
40
+ const styleBag = node.attributes?.style as unknown as
41
+ | { adjustsFontSizeToFit?: boolean; showEllipsis?: boolean }
42
+ | undefined;
43
+ const adjustsFontSizeToFit = styleBag?.adjustsFontSizeToFit ?? false;
44
+ const showEllipsis = styleBag?.showEllipsis ?? false;
47
45
 
48
46
  useLayoutEffect(() => {
49
47
  if (!adjustsFontSizeToFit) {