@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.
- package/dist/attributes-editor/AttributesEditorFields.d.ts +1 -1
- package/dist/attributes-editor/SpecialCategorySection.d.ts +1 -1
- package/dist/build-components/CountDown/CountDownProps.generated.d.ts +3 -4
- package/dist/build-components/PaywallOptions/PaywallOptionButton.d.ts +1 -1
- package/dist/build-components/PaywallProvider/PaywallContext.d.ts +1 -2
- package/dist/build-components/index.d.ts +1 -3
- package/dist/build-components/patterns.generated.d.ts +759 -1637
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +4 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.web.cjs.js +3 -3
- package/dist/index.web.cjs.js.map +1 -1
- package/dist/index.web.esm.js +3 -3
- package/dist/index.web.esm.js.map +1 -1
- package/dist/paywall/hooks/index.d.ts +0 -1
- package/dist/styles.css +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/projectColors.d.ts +7 -0
- package/package.json +3 -3
- package/src/DeviceMockFrame.tsx +0 -2
- package/src/RenderPage.tsx +0 -9
- package/src/assets/.DS_Store +0 -0
- package/src/assets/meta.json +1 -1
- package/src/assets/samples/paywall-1.json +0 -1
- package/src/assets/samples/paywall-2.json +2 -3
- package/src/assets/samples/paywall-app-delete-offer.json +2 -3
- package/src/assets/samples/paywall-app-open-offer.json +2 -3
- package/src/assets/samples/paywall-back-offer.json +2 -3
- package/src/assets/samples/paywall-notification-offer.json +2 -3
- package/src/assets/samples/vpn-onboard-1.json +15 -15
- package/src/assets/samples/vpn-onboard-2.json +15 -15
- package/src/assets/samples/vpn-onboard-3.json +15 -15
- package/src/assets/samples/vpn-onboard-4.json +15 -15
- package/src/assets/samples/vpn-onboard-5.json +21 -21
- package/src/assets/samples/vpn-onboard-6.json +15 -15
- package/src/attributes-editor/AttributesEditorFields.tsx +0 -1
- package/src/attributes-editor/AttributesEditorView.tsx +0 -2
- package/src/attributes-editor/Field.tsx +1 -1
- package/src/attributes-editor/SpecialCategorySection.tsx +0 -1
- package/src/attributes-editor/useAttributesEditorModel.ts +18 -8
- package/src/build-components/BIcon/BIcon.tsx +1 -1
- package/src/build-components/BIcon/pattern.json +1 -3
- package/src/build-components/BackgroundImage/pattern.json +2 -10
- package/src/build-components/Button/pattern.json +1 -3
- package/src/build-components/Carousel/Carousel.tsx +1 -1
- package/src/build-components/Carousel/pattern.json +2 -8
- package/src/build-components/CarouselButtons/pattern.json +2 -9
- package/src/build-components/CarouselDots/pattern.json +1 -3
- package/src/build-components/CarouselItem/pattern.json +1 -3
- package/src/build-components/CarouselProvider/CarouselProvider.tsx +1 -1
- package/src/build-components/CarouselProvider/pattern.json +1 -4
- package/src/build-components/CountDown/CountDown.tsx +25 -1
- package/src/build-components/CountDown/CountDownProps.generated.ts +3 -4
- package/src/build-components/CountDown/pattern.json +9 -4
- package/src/build-components/Main/pattern.json +1 -3
- package/src/build-components/NavigationBarColor/pattern.json +1 -3
- package/src/build-components/Onboard/pattern.json +2 -6
- package/src/build-components/OnboardButton/OnboardButton.tsx +1 -4
- package/src/build-components/OnboardButton/pattern.json +3 -14
- package/src/build-components/OnboardButtons/OnboardButtons.tsx +1 -9
- package/src/build-components/OnboardButtons/pattern.json +4 -15
- package/src/build-components/OnboardDot/OnboardDot.tsx +2 -1
- package/src/build-components/OnboardDot/pattern.json +1 -3
- package/src/build-components/OnboardFooter/pattern.json +1 -3
- package/src/build-components/OnboardImage/pattern.json +1 -5
- package/src/build-components/OnboardItem/OnboardItem.tsx +1 -1
- package/src/build-components/OnboardItem/pattern.json +3 -11
- package/src/build-components/OnboardProvider/OnboardProvider.tsx +0 -1
- package/src/build-components/OnboardProvider/pattern.json +2 -8
- package/src/build-components/OnboardSubtitle/pattern.json +1 -4
- package/src/build-components/OnboardTitle/pattern.json +1 -4
- package/src/build-components/PaywallBackground/pattern.json +1 -3
- package/src/build-components/PaywallCloseButton/pattern.json +1 -3
- package/src/build-components/PaywallOptions/PaywallOptionButton.tsx +1 -2
- package/src/build-components/PaywallOptions/pattern.json +1 -3
- package/src/build-components/PaywallProvider/PaywallContext.ts +1 -1
- package/src/build-components/PaywallProvider/PaywallProvider.tsx +0 -10
- package/src/build-components/PaywallProvider/pattern.json +1 -3
- package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButton.tsx +1 -1
- package/src/build-components/PaywallSubscribeButton/pattern.json +1 -3
- package/src/build-components/RadioButton/RadioButton.tsx +1 -1
- package/src/build-components/RadioButton/pattern.json +1 -3
- package/src/build-components/RenderNode.generated.tsx +0 -10
- package/src/build-components/Separator/pattern.json +1 -3
- package/src/build-components/StatusBarColor/pattern.json +1 -3
- package/src/build-components/Text/pattern.json +2 -9
- package/src/build-components/View/pattern.json +4 -16
- package/src/build-components/index.ts +0 -10
- package/src/build-components/patterns.generated.ts +789 -1700
- package/src/components/Builder.tsx +5 -0
- package/src/components/BuilderProvider.tsx +2 -37
- package/src/hooks/useSafeAreaViewStyle.ts +1 -3
- package/src/index.ts +4 -0
- package/src/mockOS/managers/navigationManager.ts +1 -1
- package/src/pages/ProjectPage.tsx +2 -0
- package/src/pages/tabs/SideTool.tsx +1 -22
- package/src/paywall/hooks/index.ts +0 -1
- package/src/store.ts +1 -6
- package/src/styles/base/_global.scss +2 -0
- package/src/utils/analyseNodeByPatterns.ts +4 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/logRenderStore.ts +0 -1
- package/src/utils/novaToJson.ts +1 -5
- package/src/utils/parseColor.ts +1 -0
- package/src/utils/projectColors.ts +71 -0
- package/dist/build-components/Counter/Counter.d.ts +0 -2
- package/dist/build-components/Counter/CounterProps.generated.d.ts +0 -61
- package/dist/build-components/PaywallCounter/PaywallCounter.d.ts +0 -2
- package/dist/build-components/PaywallCounter/PaywallCounterProps.generated.d.ts +0 -61
- package/dist/paywall/hooks/useHandleGoBack.d.ts +0 -1
- package/src/build-components/Counter/Counter.tsx +0 -44
- package/src/build-components/Counter/CounterProps.generated.ts +0 -78
- package/src/build-components/Counter/pattern.json +0 -29
- package/src/build-components/PaywallCounter/PaywallCounter.tsx +0 -46
- package/src/build-components/PaywallCounter/PaywallCounterProps.generated.ts +0 -78
- package/src/build-components/PaywallCounter/pattern.json +0 -26
- package/src/paywall/hooks/useHandleGoBack.ts +0 -60
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React, { useId } from 'react';
|
|
2
|
-
import type { PaywallCounterComponentProps } from './PaywallCounterProps.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 PaywallCounter({ node }: PaywallCounterComponentProps) {
|
|
12
|
-
useLogRender('PaywallCounter');
|
|
13
|
-
node = useNode(node);
|
|
14
|
-
|
|
15
|
-
const generatedId = useId();
|
|
16
|
-
const attributeName = node.sourceType ?? node.type ?? 'PaywallCounter';
|
|
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 fallbackCount = node.attributes?.count;
|
|
32
|
-
const count =
|
|
33
|
-
typeof fallbackCount === 'number' && Number.isFinite(fallbackCount)
|
|
34
|
-
? fallbackCount
|
|
35
|
-
: 0;
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<p
|
|
39
|
-
attribute-name={attributeName}
|
|
40
|
-
attribute-key={attributeKey}
|
|
41
|
-
style={style}
|
|
42
|
-
>
|
|
43
|
-
{String(count)}
|
|
44
|
-
</p>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
@@ -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 PaywallCounterStyleGenerated {
|
|
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 PaywallCounterPropsGenerated {
|
|
66
|
-
child: string;
|
|
67
|
-
attributes: {
|
|
68
|
-
style?: PaywallCounterStyleGenerated;
|
|
69
|
-
count?: number;
|
|
70
|
-
adjustsFontSizeToFit?: boolean;
|
|
71
|
-
showEllipsis?: boolean;
|
|
72
|
-
scrollable?: boolean;
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface PaywallCounterComponentProps {
|
|
77
|
-
node: NodeData<PaywallCounterPropsGenerated['attributes']>;
|
|
78
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"schemaVersion": 2,
|
|
3
|
-
"pattern": {
|
|
4
|
-
"type": "PaywallCounter",
|
|
5
|
-
"title": "title",
|
|
6
|
-
"description": "description",
|
|
7
|
-
"children": "never",
|
|
8
|
-
"extends": "Counter"
|
|
9
|
-
},
|
|
10
|
-
"meta": {
|
|
11
|
-
"desiredParent": [
|
|
12
|
-
"all"
|
|
13
|
-
],
|
|
14
|
-
"label": "Paywall Counter",
|
|
15
|
-
"description": "Displays the paywall counter value.",
|
|
16
|
-
"attributes": {
|
|
17
|
-
"count": {
|
|
18
|
-
"label": "Fallback Count",
|
|
19
|
-
"description": "Used only when the paywall counter hook returns no value.",
|
|
20
|
-
"category": "other",
|
|
21
|
-
"specialCategory": null,
|
|
22
|
-
"sort": 1
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { useMockOSContext } from '../../mockOS/context/MockOSContextBase';
|
|
3
|
-
|
|
4
|
-
export function useHandleGoBack(
|
|
5
|
-
handleGoBack: () => boolean | null | undefined,
|
|
6
|
-
) {
|
|
7
|
-
const mockOS = useMockOSContext();
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (!mockOS?.isEnabled) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const handleBackPress = (event?: KeyboardEvent | PopStateEvent) => {
|
|
15
|
-
const result = handleGoBack();
|
|
16
|
-
|
|
17
|
-
// Only allow navigation if result is explicitly true
|
|
18
|
-
if (result !== true) {
|
|
19
|
-
// Prevent navigation
|
|
20
|
-
if (event instanceof KeyboardEvent) {
|
|
21
|
-
event.preventDefault();
|
|
22
|
-
event.stopPropagation();
|
|
23
|
-
} else if (event instanceof PopStateEvent) {
|
|
24
|
-
// Prevent browser navigation by pushing state back
|
|
25
|
-
window.history.pushState(null, '', window.location.href);
|
|
26
|
-
}
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Allow navigation - execute MockOS goBack
|
|
31
|
-
const canGoBack = mockOS.goBack();
|
|
32
|
-
if (!canGoBack) {
|
|
33
|
-
mockOS.navigation('launchscreen');
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// Handle Escape key
|
|
38
|
-
const handleKeyDown = (e: KeyboardEvent) => {
|
|
39
|
-
if (e.key === 'Escape') {
|
|
40
|
-
handleBackPress(e);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// Handle browser back button
|
|
45
|
-
const handlePopState = (e: PopStateEvent) => {
|
|
46
|
-
handleBackPress(e);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// Push a state to track back navigation
|
|
50
|
-
window.history.pushState(null, '', window.location.href);
|
|
51
|
-
|
|
52
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
53
|
-
window.addEventListener('popstate', handlePopState);
|
|
54
|
-
|
|
55
|
-
return () => {
|
|
56
|
-
window.removeEventListener('keydown', handleKeyDown);
|
|
57
|
-
window.removeEventListener('popstate', handlePopState);
|
|
58
|
-
};
|
|
59
|
-
}, [handleGoBack, mockOS]);
|
|
60
|
-
}
|