@developer_tribe/react-builder 1.2.25 → 1.2.27

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 (119) hide show
  1. package/dist/attributes-editor/AttributesEditorFields.d.ts +1 -1
  2. package/dist/attributes-editor/SpecialCategorySection.d.ts +1 -1
  3. package/dist/build-components/CountDown/CountDownProps.generated.d.ts +3 -4
  4. package/dist/build-components/PaywallOptions/PaywallOptionButton.d.ts +1 -1
  5. package/dist/build-components/PaywallProvider/PaywallContext.d.ts +1 -2
  6. package/dist/build-components/index.d.ts +1 -3
  7. package/dist/build-components/patterns.generated.d.ts +759 -1637
  8. package/dist/index.cjs.js +4 -4
  9. package/dist/index.cjs.js.map +1 -1
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.esm.js +4 -4
  12. package/dist/index.esm.js.map +1 -1
  13. package/dist/index.web.cjs.js +3 -3
  14. package/dist/index.web.cjs.js.map +1 -1
  15. package/dist/index.web.esm.js +3 -3
  16. package/dist/index.web.esm.js.map +1 -1
  17. package/dist/paywall/hooks/index.d.ts +0 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/utils/index.d.ts +1 -0
  20. package/dist/utils/projectColors.d.ts +7 -0
  21. package/package.json +3 -3
  22. package/src/DeviceMockFrame.tsx +0 -2
  23. package/src/RenderPage.tsx +0 -9
  24. package/src/assets/.DS_Store +0 -0
  25. package/src/assets/meta.json +1 -1
  26. package/src/assets/samples/paywall-1.json +0 -1
  27. package/src/assets/samples/paywall-2.json +2 -3
  28. package/src/assets/samples/paywall-app-delete-offer.json +2 -3
  29. package/src/assets/samples/paywall-app-open-offer.json +2 -3
  30. package/src/assets/samples/paywall-back-offer.json +2 -3
  31. package/src/assets/samples/paywall-notification-offer.json +2 -3
  32. package/src/assets/samples/vpn-onboard-1.json +15 -15
  33. package/src/assets/samples/vpn-onboard-2.json +15 -15
  34. package/src/assets/samples/vpn-onboard-3.json +15 -15
  35. package/src/assets/samples/vpn-onboard-4.json +15 -15
  36. package/src/assets/samples/vpn-onboard-5.json +21 -21
  37. package/src/assets/samples/vpn-onboard-6.json +15 -15
  38. package/src/attributes-editor/AttributesEditorFields.tsx +0 -1
  39. package/src/attributes-editor/AttributesEditorView.tsx +0 -2
  40. package/src/attributes-editor/Field.tsx +1 -1
  41. package/src/attributes-editor/SpecialCategorySection.tsx +0 -1
  42. package/src/attributes-editor/useAttributesEditorModel.ts +18 -8
  43. package/src/build-components/BIcon/BIcon.tsx +1 -1
  44. package/src/build-components/BIcon/pattern.json +1 -3
  45. package/src/build-components/BackgroundImage/pattern.json +2 -10
  46. package/src/build-components/Button/pattern.json +1 -3
  47. package/src/build-components/Carousel/Carousel.tsx +1 -1
  48. package/src/build-components/Carousel/pattern.json +2 -8
  49. package/src/build-components/CarouselButtons/pattern.json +2 -9
  50. package/src/build-components/CarouselDots/pattern.json +1 -3
  51. package/src/build-components/CarouselItem/pattern.json +1 -3
  52. package/src/build-components/CarouselProvider/CarouselProvider.tsx +1 -1
  53. package/src/build-components/CarouselProvider/pattern.json +1 -4
  54. package/src/build-components/CountDown/CountDown.tsx +25 -1
  55. package/src/build-components/CountDown/CountDownProps.generated.ts +3 -4
  56. package/src/build-components/CountDown/pattern.json +9 -4
  57. package/src/build-components/Main/pattern.json +1 -3
  58. package/src/build-components/NavigationBarColor/pattern.json +1 -3
  59. package/src/build-components/Onboard/pattern.json +2 -6
  60. package/src/build-components/OnboardButton/OnboardButton.tsx +1 -4
  61. package/src/build-components/OnboardButton/pattern.json +3 -14
  62. package/src/build-components/OnboardButtons/OnboardButtons.tsx +1 -9
  63. package/src/build-components/OnboardButtons/pattern.json +4 -15
  64. package/src/build-components/OnboardDot/OnboardDot.tsx +2 -1
  65. package/src/build-components/OnboardDot/pattern.json +1 -3
  66. package/src/build-components/OnboardFooter/pattern.json +1 -3
  67. package/src/build-components/OnboardImage/pattern.json +1 -5
  68. package/src/build-components/OnboardItem/OnboardItem.tsx +1 -1
  69. package/src/build-components/OnboardItem/pattern.json +3 -11
  70. package/src/build-components/OnboardProvider/OnboardProvider.tsx +0 -1
  71. package/src/build-components/OnboardProvider/pattern.json +2 -8
  72. package/src/build-components/OnboardSubtitle/pattern.json +1 -4
  73. package/src/build-components/OnboardTitle/pattern.json +1 -4
  74. package/src/build-components/PaywallBackground/pattern.json +1 -3
  75. package/src/build-components/PaywallCloseButton/pattern.json +1 -3
  76. package/src/build-components/PaywallOptions/PaywallOptionButton.tsx +1 -2
  77. package/src/build-components/PaywallOptions/pattern.json +1 -3
  78. package/src/build-components/PaywallProvider/PaywallContext.ts +1 -1
  79. package/src/build-components/PaywallProvider/PaywallProvider.tsx +0 -10
  80. package/src/build-components/PaywallProvider/pattern.json +1 -3
  81. package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButton.tsx +1 -1
  82. package/src/build-components/PaywallSubscribeButton/pattern.json +1 -3
  83. package/src/build-components/RadioButton/RadioButton.tsx +1 -1
  84. package/src/build-components/RadioButton/pattern.json +1 -3
  85. package/src/build-components/RenderNode.generated.tsx +0 -10
  86. package/src/build-components/Separator/pattern.json +1 -3
  87. package/src/build-components/StatusBarColor/pattern.json +1 -3
  88. package/src/build-components/Text/pattern.json +2 -9
  89. package/src/build-components/View/pattern.json +4 -16
  90. package/src/build-components/index.ts +0 -10
  91. package/src/build-components/patterns.generated.ts +789 -1700
  92. package/src/components/Builder.tsx +5 -0
  93. package/src/components/BuilderProvider.tsx +2 -37
  94. package/src/hooks/useSafeAreaViewStyle.ts +1 -3
  95. package/src/index.ts +4 -0
  96. package/src/mockOS/managers/navigationManager.ts +1 -1
  97. package/src/pages/ProjectPage.tsx +2 -0
  98. package/src/pages/tabs/SideTool.tsx +1 -22
  99. package/src/paywall/hooks/index.ts +0 -1
  100. package/src/store.ts +1 -6
  101. package/src/styles/base/_global.scss +2 -0
  102. package/src/utils/analyseNodeByPatterns.ts +4 -0
  103. package/src/utils/index.ts +1 -0
  104. package/src/utils/logRenderStore.ts +0 -1
  105. package/src/utils/novaToJson.ts +1 -5
  106. package/src/utils/parseColor.ts +1 -0
  107. package/src/utils/projectColors.ts +71 -0
  108. package/dist/build-components/Counter/Counter.d.ts +0 -2
  109. package/dist/build-components/Counter/CounterProps.generated.d.ts +0 -61
  110. package/dist/build-components/PaywallCounter/PaywallCounter.d.ts +0 -2
  111. package/dist/build-components/PaywallCounter/PaywallCounterProps.generated.d.ts +0 -61
  112. package/dist/paywall/hooks/useHandleGoBack.d.ts +0 -1
  113. package/src/build-components/Counter/Counter.tsx +0 -44
  114. package/src/build-components/Counter/CounterProps.generated.ts +0 -78
  115. package/src/build-components/Counter/pattern.json +0 -29
  116. package/src/build-components/PaywallCounter/PaywallCounter.tsx +0 -46
  117. package/src/build-components/PaywallCounter/PaywallCounterProps.generated.ts +0 -78
  118. package/src/build-components/PaywallCounter/pattern.json +0 -26
  119. package/src/paywall/hooks/useHandleGoBack.ts +0 -60
@@ -330,11 +330,13 @@ export function Builder({
330
330
  setData(updatedRoot);
331
331
  setCurrent(updatedParent);
332
332
  },
333
+ // eslint-disable-next-line react-hooks/exhaustive-deps
333
334
  [current, data, setData, setCurrent, usedKeys],
334
335
  );
335
336
 
336
337
  const allowedChildTypes = useMemo(
337
338
  () => getAllowedChildTypes(current),
339
+ // eslint-disable-next-line react-hooks/exhaustive-deps
338
340
  [current],
339
341
  );
340
342
  const parentType = useMemo(() => {
@@ -378,6 +380,7 @@ export function Builder({
378
380
  setCurrent(next);
379
381
  }
380
382
  },
383
+ // eslint-disable-next-line react-hooks/exhaustive-deps
381
384
  [current, data, setCurrent, setData],
382
385
  );
383
386
 
@@ -407,6 +410,7 @@ export function Builder({
407
410
  setCurrent(updatedParent);
408
411
  }
409
412
  },
413
+ // eslint-disable-next-line react-hooks/exhaustive-deps
410
414
  [current, data, setCurrent, setData],
411
415
  );
412
416
 
@@ -436,6 +440,7 @@ export function Builder({
436
440
  setCurrent(updatedParent);
437
441
  }
438
442
  },
443
+ // eslint-disable-next-line react-hooks/exhaustive-deps
439
444
  [current, data, setCurrent, setData],
440
445
  );
441
446
 
@@ -4,6 +4,7 @@ import type { PaywallBenefits } from '../paywall/types/benefits';
4
4
  import type { AppConfig } from '../types/PreviewConfig';
5
5
  import type { Fonts } from '../types/Fonts';
6
6
  import type { ProjectColors } from '../types/Project';
7
+ import { defaultProjectColors, mergeProjectColors } from '../utils';
7
8
 
8
9
  // NOTE: We keep this context intentionally tiny.
9
10
  // IMPORTANT: This provider may be mounted once but consumed by multiple `build-components`
@@ -65,7 +66,7 @@ export function BuilderProvider({ params, children }: BuilderProviderProps) {
65
66
  : undefined,
66
67
  projectColors:
67
68
  params?.projectColors && typeof params.projectColors === 'object'
68
- ? (params.projectColors as ProjectColors)
69
+ ? mergeProjectColors(defaultProjectColors, params.projectColors)
69
70
  : defaultProjectColors,
70
71
  fonts: Array.isArray(params?.fonts) ? (params.fonts as Fonts) : undefined,
71
72
  appFont: params?.appFont,
@@ -95,42 +96,6 @@ export function BuilderProvider({ params, children }: BuilderProviderProps) {
95
96
  );
96
97
  }
97
98
 
98
- const defaultProjectColors: Readonly<ProjectColors> = {
99
- STATIC_COLORS: {
100
- BLACK: '#000',
101
- WHITE: '#FFFFFF',
102
- TRANSPARENT: '#ffffff00',
103
- ONBOARD_DOT_INACTIVE: '#E4E5E7',
104
- ONBOARD_DOT_ACTIVE: '#007AFF',
105
- BUTTON_PRIMARY_BACKGROUND: '#0066FF',
106
- BUTTON_PRIMARY_TEXT: '#FFFFFF',
107
- LINK_COLOR: '#1778F2',
108
- SEPARATOR_COLOR: '#44454D',
109
- },
110
- THEME_COLORS: {
111
- light: {
112
- TEXT: '#161827',
113
- BACKGROUND: '#F4F5FF',
114
- ICON: '#0450E2',
115
- LINE: '#E9EBF9',
116
- ONBOARD_TITLE: '#161827',
117
- ONBOARD_SUBTITLE: '#44454D',
118
- BUTTON_SECONDARY_TEXT: '#81838F',
119
- FOOTER_TEXT: '#81838F',
120
- },
121
- dark: {
122
- TEXT: '#E9EBF9',
123
- BACKGROUND: '#080A17',
124
- ICON: '#0450E2',
125
- LINE: '#161827',
126
- ONBOARD_TITLE: '#FDFDFD',
127
- ONBOARD_SUBTITLE: '#C7C7C7',
128
- BUTTON_SECONDARY_TEXT: '#A9AAAC',
129
- FOOTER_TEXT: '#A2A4B1',
130
- },
131
- },
132
- } as const;
133
-
134
99
  export function useBuilderParams(): Readonly<BuilderProviderParams> {
135
100
  return (
136
101
  useContext(builderContext) ?? {
@@ -33,9 +33,7 @@ export function useSafeAreaViewStyle(
33
33
  return useMemo(() => {
34
34
  if (!enabled) return baseStyle;
35
35
 
36
- const [insetTop, insetRight, insetBottom, insetLeft] = device?.insets ?? [
37
- 0, 0, 0, 0,
38
- ];
36
+ const [insetTop, insetRight, , insetLeft] = device?.insets ?? [0, 0, 0, 0];
39
37
 
40
38
  // Match DeviceMockFrame fallbacks: status bar overlays content, so we treat it as top safe area.
41
39
  const top =
package/src/index.ts CHANGED
@@ -94,3 +94,7 @@ export type { EventObjectGenerated } from './build-components/OnboardButton/Onbo
94
94
 
95
95
  export { parseColor } from './utils/parseColor';
96
96
  export type { ParseColorOptions } from './utils/parseColor';
97
+ export {
98
+ defaultProjectColors,
99
+ mergeProjectColors,
100
+ } from './utils/projectColors';
@@ -70,7 +70,7 @@ export class MockNavigationManager {
70
70
  }
71
71
 
72
72
  if (this.stack.length > 0) {
73
- const popped = this.stack.pop();
73
+ this.stack.pop();
74
74
  return true;
75
75
  }
76
76
 
@@ -162,6 +162,7 @@ export function ProjectPage({
162
162
  setCurrent(updated);
163
163
  }
164
164
  },
165
+ // eslint-disable-next-line react-hooks/exhaustive-deps
165
166
  [editorData, current],
166
167
  );
167
168
 
@@ -225,6 +226,7 @@ export function ProjectPage({
225
226
  setMinLoadingDelayDone(false);
226
227
  const timer = setTimeout(() => setMinLoadingDelayDone(true), 1000);
227
228
  return () => clearTimeout(timer);
229
+ // eslint-disable-next-line react-hooks/exhaustive-deps
228
230
  }, [activeProject.data]);
229
231
 
230
232
  // Ref for the full project (used inside effect for migration check etc.)
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { Modal } from '../../modals';
3
3
  import type { Node } from '../../types/Node';
4
4
  import type { Localication } from '../../types/PreviewConfig';
@@ -52,12 +52,6 @@ export function SideTool({ data, setData }: SideToolProps) {
52
52
  useLogRender('SideTool');
53
53
  const [isDebugModalOpen, setIsDebugModalOpen] = useState(false);
54
54
  const [isLocalicationModalOpen, setIsLocalicationModalOpen] = useState(false);
55
- const [isCompactMode, setIsCompactMode] = useState(() => {
56
- if (typeof window === 'undefined') {
57
- return false;
58
- }
59
- return window.innerWidth < 1000;
60
- });
61
55
  const [isCompactPanelVisible, setIsCompactPanelVisible] = useState(false);
62
56
  const { appConfig, setAppConfig, previewMode, setPreviewMode } =
63
57
  useRenderStore((s) => ({
@@ -67,21 +61,6 @@ export function SideTool({ data, setData }: SideToolProps) {
67
61
  setPreviewMode: s.setPreviewMode,
68
62
  }));
69
63
 
70
- useEffect(() => {
71
- if (typeof window === 'undefined') {
72
- return;
73
- }
74
-
75
- const handleResize = () => {
76
- const compact = window.innerWidth < 1000;
77
- setIsCompactMode(compact);
78
- };
79
-
80
- handleResize();
81
- window.addEventListener('resize', handleResize);
82
- return () => window.removeEventListener('resize', handleResize);
83
- }, []);
84
-
85
64
  const getScreenColorValue = (mode: ScreenMode, key: ScreenColorKey) =>
86
65
  appConfig.screenStyle?.[mode]?.[key] ?? screenStyleDefaults[mode][key];
87
66
 
@@ -1,5 +1,4 @@
1
1
  export { useCalculateLocalizedPrice } from './useCalculateLocalizedPrice';
2
2
  export { useDiscountRate } from './useDiscountRate';
3
3
  export { useChangeDelayByPaywall } from './useChangeDelayByPaywall';
4
- export { useHandleGoBack } from './useHandleGoBack';
5
4
  export { useMockOSBackHandler } from './useMockOSBackHandler';
package/src/store.ts CHANGED
@@ -1,13 +1,8 @@
1
1
  import { createWithEqualityFn } from 'zustand/traditional';
2
2
  import { shallow } from 'zustand/shallow';
3
3
  import type { Device } from './types/Device';
4
- import {
5
- defaultAppConfig,
6
- type AppConfig,
7
- type Localication,
8
- } from './types/PreviewConfig';
4
+ import { defaultAppConfig, type AppConfig } from './types/PreviewConfig';
9
5
  import { getDefaultDevice } from './utils/getDevices';
10
- import { ScreenStyle } from './RenderPage';
11
6
  import { createJSONStorage, persist } from 'zustand/middleware';
12
7
  import { Node } from './types/Node';
13
8
  import type { LogEntry, LogLevel, ProjectColors } from './types/Project';
@@ -61,6 +61,8 @@ body,
61
61
  min-width: 200px;
62
62
  border-right: 1px solid colors.$borderColor;
63
63
  overflow: auto;
64
+ max-height: calc(100vh - 120px);
65
+ padding-bottom: 80px;
64
66
  }
65
67
 
66
68
  .split-right {
@@ -344,6 +344,10 @@ function validateAttributeValue(
344
344
  // null to clear fields (e.g. events[].navigate_to = null).
345
345
  if (value == null) return ok();
346
346
 
347
+ // "never" type means the attribute is marked as not to be validated.
348
+ // Skip validation for attributes with "never" type.
349
+ if (spec === 'never') return ok();
350
+
347
351
  if (Array.isArray(spec)) {
348
352
  return validateEnumValue(value, spec, path);
349
353
  }
@@ -0,0 +1 @@
1
+ export { defaultProjectColors, mergeProjectColors } from './projectColors';
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-console */
2
1
  // This file is a debug utility specifically designed to log to console for debugging purposes.
3
2
  import { useRenderStore } from '../store';
4
3
 
@@ -1,5 +1,5 @@
1
1
  import { Node, NodeData } from '../types/Node';
2
- import { Project, ProjectBase } from '../types/Project';
2
+ import { ProjectBase } from '../types/Project';
3
3
  //TODO: deprecated olmasına rağmen snapshot testi ekle
4
4
  /**
5
5
  * @deprecated Legacy converter for old "nova" onboard JSON formats.
@@ -226,7 +226,6 @@ function buildCarouselItem(
226
226
  const flex = attrs?.flex ? Number(attrs.flex) : undefined;
227
227
 
228
228
  // Normalize events and compute Navigate target indices when resolvable
229
- let targetIndex: number | undefined = undefined;
230
229
  //@eslint-disable-next-line @typescript-eslint/no-explicit-any
231
230
  const actions = (attrs?.actions || []) as any[];
232
231
  const normalizedEvents: {
@@ -263,9 +262,6 @@ function buildCarouselItem(
263
262
  ? { targetIndex: pageKeyToIndex.get(nextKey!)! }
264
263
  : {}),
265
264
  });
266
- if (hasTarget) {
267
- targetIndex = pageKeyToIndex.get(nextKey!)!;
268
- }
269
265
  }
270
266
  }
271
267
  }
@@ -19,6 +19,7 @@ export function parseColor(value?: string, options: ParseColorOptions = {}) {
19
19
  if (trimmed.startsWith(STATIC_PREFIX)) {
20
20
  const token = trimmed.slice(STATIC_PREFIX.length);
21
21
  const resolved = projectColors.STATIC_COLORS?.[token];
22
+ console.log('resolved', value, resolved);
22
23
  return typeof resolved === 'string' && resolved.trim()
23
24
  ? resolved.trim()
24
25
  : trimmed;
@@ -0,0 +1,71 @@
1
+ import type {
2
+ ProjectColors,
3
+ ProjectColorTokenMap,
4
+ ProjectThemeColors,
5
+ } from '../types/Project';
6
+
7
+ export const defaultProjectColors: ProjectColors = {
8
+ STATIC_COLORS: {
9
+ BLACK: '#000',
10
+ WHITE: '#FFFFFF',
11
+ TRANSPARENT: '#ffffff00',
12
+ ONBOARD_DOT_INACTIVE: '#E4E5E7',
13
+ ONBOARD_DOT_ACTIVE: '#007AFF',
14
+ ONBOARD_BUTTON_PRIMARY_BACKGROUND: '#0000FF',
15
+ ONBOARD_BUTTON_PRIMARY_TEXT: '#000',
16
+ ONBOARD_LINK_COLOR: '#1778F2',
17
+ ONBOARD_SEPARATOR_COLOR: '#44454D',
18
+ },
19
+ THEME_COLORS: {
20
+ light: {
21
+ TEXT: '#161827',
22
+ BACKGROUND: '#F4F5FF',
23
+ ICON: '#0450E2',
24
+ LINE: '#E9EBF9',
25
+ ONBOARD_TITLE: '#161827',
26
+ ONBOARD_SUBTITLE: '#44454D',
27
+ ONBOARD_BUTTON_SECONDARY_TEXT: '#81838F',
28
+ ONBOARD_FOOTER_TEXT: '#81838F',
29
+ },
30
+ dark: {
31
+ TEXT: '#E9EBF9',
32
+ BACKGROUND: '#080A17',
33
+ ICON: '#0450E2',
34
+ LINE: '#161827',
35
+ ONBOARD_TITLE: '#FDFDFD',
36
+ ONBOARD_SUBTITLE: '#C7C7C7',
37
+ ONBOARD_BUTTON_SECONDARY_TEXT: '#A9AAAC',
38
+ ONBOARD_FOOTER_TEXT: '#A2A4B1',
39
+ },
40
+ },
41
+ };
42
+
43
+ /**
44
+ * Merges custom project colors with base colors.
45
+ * Custom colors override base colors on a per-token basis.
46
+ */
47
+ export function mergeProjectColors(
48
+ baseColors: ProjectColors,
49
+ customColors: ProjectColors,
50
+ ): ProjectColors {
51
+ const staticColors: ProjectColorTokenMap = {
52
+ ...baseColors.STATIC_COLORS,
53
+ ...(customColors.STATIC_COLORS || {}),
54
+ };
55
+
56
+ const themeColors: ProjectThemeColors = {
57
+ light: {
58
+ ...(baseColors.THEME_COLORS?.light || {}),
59
+ ...(customColors.THEME_COLORS?.light || {}),
60
+ },
61
+ dark: {
62
+ ...(baseColors.THEME_COLORS?.dark || {}),
63
+ ...(customColors.THEME_COLORS?.dark || {}),
64
+ },
65
+ };
66
+
67
+ return {
68
+ STATIC_COLORS: staticColors,
69
+ THEME_COLORS: themeColors,
70
+ };
71
+ }
@@ -1,2 +0,0 @@
1
- import type { CounterComponentProps } from './CounterProps.generated';
2
- export declare function Counter({ node }: CounterComponentProps): import("react/jsx-runtime").JSX.Element;
@@ -1,61 +0,0 @@
1
- import type { NodeData } from '../../types/Node';
2
- export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
3
- export type FlexDirectionOptionType = 'row' | 'column';
4
- export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
5
- export type AlignItemsOptionType = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
6
- export type JustifyContentOptionType = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
7
- export type PositionOptionType = 'relative' | 'absolute';
8
- export interface CounterStyleGenerated {
9
- color?: string;
10
- fontSize?: string;
11
- fontFamily?: string;
12
- fontWeight?: string;
13
- textAlign?: TextAlignOptionType;
14
- flexDirection?: FlexDirectionOptionType;
15
- flexWrap?: FlexWrapOptionType;
16
- alignItems?: AlignItemsOptionType;
17
- justifyContent?: JustifyContentOptionType;
18
- gap?: string;
19
- padding?: string;
20
- paddingHorizontal?: string;
21
- paddingVertical?: string;
22
- paddingTop?: string;
23
- paddingBottom?: string;
24
- paddingLeft?: string;
25
- paddingRight?: string;
26
- margin?: string;
27
- marginHorizontal?: string;
28
- marginVertical?: string;
29
- marginTop?: string;
30
- marginBottom?: string;
31
- marginLeft?: string;
32
- marginRight?: string;
33
- backgroundColor?: string;
34
- borderRadius?: string;
35
- width?: string;
36
- minWidth?: string;
37
- maxWidth?: string;
38
- height?: string;
39
- minHeight?: string;
40
- maxHeight?: string;
41
- flex?: number;
42
- position?: PositionOptionType;
43
- top?: string;
44
- bottom?: string;
45
- left?: string;
46
- right?: string;
47
- zIndex?: number;
48
- }
49
- export interface CounterPropsGenerated {
50
- child: string;
51
- attributes: {
52
- style?: CounterStyleGenerated;
53
- adjustsFontSizeToFit?: boolean;
54
- showEllipsis?: boolean;
55
- scrollable?: boolean;
56
- count?: number;
57
- };
58
- }
59
- export interface CounterComponentProps {
60
- node: NodeData<CounterPropsGenerated['attributes']>;
61
- }
@@ -1,2 +0,0 @@
1
- import type { PaywallCounterComponentProps } from './PaywallCounterProps.generated';
2
- export declare function PaywallCounter({ node }: PaywallCounterComponentProps): import("react/jsx-runtime").JSX.Element;
@@ -1,61 +0,0 @@
1
- import type { NodeData } from '../../types/Node';
2
- export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
3
- export type FlexDirectionOptionType = 'row' | 'column';
4
- export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
5
- export type AlignItemsOptionType = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
6
- export type JustifyContentOptionType = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
7
- export type PositionOptionType = 'relative' | 'absolute';
8
- export interface PaywallCounterStyleGenerated {
9
- color?: string;
10
- fontSize?: string;
11
- fontFamily?: string;
12
- fontWeight?: string;
13
- textAlign?: TextAlignOptionType;
14
- flexDirection?: FlexDirectionOptionType;
15
- flexWrap?: FlexWrapOptionType;
16
- alignItems?: AlignItemsOptionType;
17
- justifyContent?: JustifyContentOptionType;
18
- gap?: string;
19
- padding?: string;
20
- paddingHorizontal?: string;
21
- paddingVertical?: string;
22
- paddingTop?: string;
23
- paddingBottom?: string;
24
- paddingLeft?: string;
25
- paddingRight?: string;
26
- margin?: string;
27
- marginHorizontal?: string;
28
- marginVertical?: string;
29
- marginTop?: string;
30
- marginBottom?: string;
31
- marginLeft?: string;
32
- marginRight?: string;
33
- backgroundColor?: string;
34
- borderRadius?: string;
35
- width?: string;
36
- minWidth?: string;
37
- maxWidth?: string;
38
- height?: string;
39
- minHeight?: string;
40
- maxHeight?: string;
41
- flex?: number;
42
- position?: PositionOptionType;
43
- top?: string;
44
- bottom?: string;
45
- left?: string;
46
- right?: string;
47
- zIndex?: number;
48
- }
49
- export interface PaywallCounterPropsGenerated {
50
- child: string;
51
- attributes: {
52
- style?: PaywallCounterStyleGenerated;
53
- count?: number;
54
- adjustsFontSizeToFit?: boolean;
55
- showEllipsis?: boolean;
56
- scrollable?: boolean;
57
- };
58
- }
59
- export interface PaywallCounterComponentProps {
60
- node: NodeData<PaywallCounterPropsGenerated['attributes']>;
61
- }
@@ -1 +0,0 @@
1
- export declare function useHandleGoBack(handleGoBack: () => boolean | null | undefined): void;
@@ -1,44 +0,0 @@
1
- import React, { useId } from 'react';
2
- import type { CounterComponentProps } from './CounterProps.generated';
3
- import useNode from '../useNode';
4
- import { useBuilderParams } from '../../components/BuilderProvider';
5
- import { useExtractTextStyle } from '../../attribute-analyser/style/web/useExtractTextStyle';
6
- import { useLogRender } from '../../utils/useLogRender';
7
- import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
8
- import { useMergedStyle } from '../../utils/useMergedStyle';
9
-
10
- //Optimzation trade off by readability: skip React.memo to keep named exports.
11
- export function Counter({ node }: CounterComponentProps) {
12
- useLogRender('Counter');
13
- node = useNode(node);
14
-
15
- const generatedId = useId();
16
- const attributeName = node.sourceType ?? node.type ?? 'Counter';
17
- const attributeKey = node.key ?? generatedId;
18
-
19
- const { previewMode, selectedKey } = useBuilderParams();
20
- const baseStyle = useExtractTextStyle(node);
21
- const isSelected = isNodeSelected({
22
- previewMode: !!previewMode,
23
- current: selectedKey ? { key: selectedKey } : undefined,
24
- node,
25
- });
26
- const style = useMergedStyle(
27
- baseStyle,
28
- isSelected ? SELECTED_OUTLINE_STYLE : undefined,
29
- );
30
-
31
- const rawCount = node.attributes?.count;
32
- const count =
33
- typeof rawCount === 'number' && Number.isFinite(rawCount) ? rawCount : 0;
34
-
35
- return (
36
- <p
37
- attribute-name={attributeName}
38
- attribute-key={attributeKey}
39
- style={style}
40
- >
41
- {String(count)}
42
- </p>
43
- );
44
- }
@@ -1,78 +0,0 @@
1
- /* AUTO-GENERATED FILE - DO NOT EDIT */
2
-
3
- import type { NodeData } from '../../types/Node';
4
-
5
- export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
6
- export type FlexDirectionOptionType = 'row' | 'column';
7
- export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
8
- export type AlignItemsOptionType =
9
- | 'flex-start'
10
- | 'center'
11
- | 'flex-end'
12
- | 'stretch'
13
- | 'baseline';
14
- export type JustifyContentOptionType =
15
- | 'flex-start'
16
- | 'center'
17
- | 'flex-end'
18
- | 'space-between'
19
- | 'space-around'
20
- | 'space-evenly';
21
- export type PositionOptionType = 'relative' | 'absolute';
22
-
23
- export interface CounterStyleGenerated {
24
- color?: string;
25
- fontSize?: string;
26
- fontFamily?: string;
27
- fontWeight?: string;
28
- textAlign?: TextAlignOptionType;
29
- flexDirection?: FlexDirectionOptionType;
30
- flexWrap?: FlexWrapOptionType;
31
- alignItems?: AlignItemsOptionType;
32
- justifyContent?: JustifyContentOptionType;
33
- gap?: string;
34
- padding?: string;
35
- paddingHorizontal?: string;
36
- paddingVertical?: string;
37
- paddingTop?: string;
38
- paddingBottom?: string;
39
- paddingLeft?: string;
40
- paddingRight?: string;
41
- margin?: string;
42
- marginHorizontal?: string;
43
- marginVertical?: string;
44
- marginTop?: string;
45
- marginBottom?: string;
46
- marginLeft?: string;
47
- marginRight?: string;
48
- backgroundColor?: string;
49
- borderRadius?: string;
50
- width?: string;
51
- minWidth?: string;
52
- maxWidth?: string;
53
- height?: string;
54
- minHeight?: string;
55
- maxHeight?: string;
56
- flex?: number;
57
- position?: PositionOptionType;
58
- top?: string;
59
- bottom?: string;
60
- left?: string;
61
- right?: string;
62
- zIndex?: number;
63
- }
64
-
65
- export interface CounterPropsGenerated {
66
- child: string;
67
- attributes: {
68
- style?: CounterStyleGenerated;
69
- adjustsFontSizeToFit?: boolean;
70
- showEllipsis?: boolean;
71
- scrollable?: boolean;
72
- count?: number;
73
- };
74
- }
75
-
76
- export interface CounterComponentProps {
77
- node: NodeData<CounterPropsGenerated['attributes']>;
78
- }
@@ -1,29 +0,0 @@
1
- {
2
- "schemaVersion": 2,
3
- "pattern": {
4
- "type": "Counter",
5
- "title": "title",
6
- "description": "description",
7
- "children": "never",
8
- "extends": "Text",
9
- "attributes": {
10
- "count": "number"
11
- }
12
- },
13
- "meta": {
14
- "desiredParent": [
15
- "all"
16
- ],
17
- "label": "Counter",
18
- "description": "Displays a numeric counter.",
19
- "attributes": {
20
- "count": {
21
- "label": "Count",
22
- "description": "Numeric value to display.",
23
- "category": "other",
24
- "specialCategory": null,
25
- "sort": 1
26
- }
27
- }
28
- }
29
- }