@developer_tribe/react-builder 1.2.26 → 1.2.28
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/assets/samples/getSamples.d.ts +0 -3
- package/dist/build-components/BIcon/BIconProps.generated.d.ts +1 -2
- package/dist/build-components/CountDown/CountDownProps.generated.d.ts +2 -1
- package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +1 -2
- package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +1 -2
- package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +1 -2
- package/dist/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.d.ts +1 -2
- package/dist/build-components/PaywallOptions/usePaywallOptionParamsFactory.d.ts +1 -1
- package/dist/build-components/PriceTag/PriceTag.d.ts +5 -0
- package/dist/build-components/PriceTag/PriceTagProps.generated.d.ts +63 -0
- package/dist/build-components/Pricing/Pricing.d.ts +5 -0
- package/dist/build-components/Pricing/PricingProps.generated.d.ts +59 -0
- package/dist/build-components/Promo/Promo.d.ts +5 -0
- package/dist/build-components/Promo/PromoProps.generated.d.ts +59 -0
- package/dist/build-components/Text/TextProps.generated.d.ts +1 -2
- package/dist/build-components/index.d.ts +4 -1
- package/dist/build-components/patterns.generated.d.ts +1405 -202
- package/dist/components/BuilderProvider.d.ts +5 -3
- package/dist/components/ParamsProvider.d.ts +16 -8
- package/dist/hooks/useSyncHtmlThemeClass.d.ts +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +15 -3
- package/dist/index.esm.js +4 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.web.cjs.js +4 -4
- package/dist/index.web.cjs.js.map +1 -1
- package/dist/index.web.esm.js +4 -4
- package/dist/index.web.esm.js.map +1 -1
- package/dist/logger.d.ts +18 -0
- package/dist/modals/InspectModal.d.ts +5 -0
- package/dist/modals/index.d.ts +1 -1
- package/dist/pages/ProjectPage.d.ts +3 -3
- package/dist/paywall/hooks/useCalculateLocalizedPrice.d.ts +4 -2
- package/dist/paywall/hooks/useDiscountRate.d.ts +3 -2
- package/dist/paywall/types/paywall-types.d.ts +7 -32
- package/dist/product-base/buildPaywallLocalizationParams.d.ts +16 -0
- package/dist/product-base/calculations.d.ts +29 -0
- package/dist/product-base/extractAndroidParams.d.ts +24 -0
- package/dist/product-base/extractIOSParams.d.ts +24 -0
- package/dist/product-base/index.d.ts +27 -0
- package/dist/product-base/periodLocalizationKeys.d.ts +44 -0
- package/dist/product-base/types.d.ts +155 -0
- package/dist/product-base/usePaywallLocalizationParams.d.ts +29 -0
- package/dist/store.d.ts +7 -1
- package/dist/styles.css +1 -1
- package/dist/types/PreviewConfig.d.ts +10 -16
- package/dist/utils/extractTextStyle/extractTextStyle.d.ts +2 -2
- package/dist/utils/extractTextStyle/extractTextStyleNative.d.ts +2 -2
- package/dist/utils/replaceLocalizationParams.d.ts +1 -1
- package/package.json +2 -2
- package/scripts/migrate-samples-to-current.ts +3 -3
- package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +28 -12
- package/src/DeviceMockFrame.tsx +15 -10
- package/src/assets/meta.json +1 -1
- package/src/assets/samples/carousel-sample.json +6 -5
- package/src/assets/samples/getSamples.ts +16 -49
- package/src/assets/samples/paywall-1.json +64 -22
- package/src/assets/samples/paywall-2.json +0 -15
- package/src/assets/samples/paywall-app-delete-offer.json +0 -15
- package/src/assets/samples/paywall-app-open-offer.json +0 -15
- package/src/assets/samples/paywall-back-offer.json +0 -15
- package/src/assets/samples/paywall-notification-offer.json +0 -15
- package/src/assets/samples/simple-1.json +1 -16
- package/src/assets/samples/simple-2.json +0 -15
- package/src/assets/samples/unmigrated-builder-1.1.1.json +0 -3
- package/src/assets/samples/unmigrated-builder1.json +0 -3
- package/src/assets/samples/unvalidated-builder1.json +0 -3
- package/src/assets/samples/unvalidated-crash1.json +0 -3
- package/src/assets/samples/unvalidated-crashcomponent1.json +0 -3
- package/src/assets/samples/vpn-onboard-1.json +1 -34
- package/src/assets/samples/vpn-onboard-2.json +1 -34
- package/src/assets/samples/vpn-onboard-3.json +1 -42
- package/src/assets/samples/vpn-onboard-4.json +0 -73
- package/src/assets/samples/vpn-onboard-5.json +0 -73
- package/src/assets/samples/vpn-onboard-6.json +0 -73
- package/src/assets/samples/vpn-onboard-7.json +529 -0
- package/src/attribute-analyser/style/native/useExtractImageStyle.ts +1 -4
- package/src/attribute-analyser/style/native/useExtractTextStyle.ts +3 -12
- package/src/attribute-analyser/style/native/useExtractViewStyle.ts +1 -4
- package/src/attribute-analyser/style/web/useExtractImageStyle.ts +1 -4
- package/src/attribute-analyser/style/web/useExtractTextStyle.ts +3 -12
- package/src/attribute-analyser/style/web/useExtractViewStyle.ts +1 -4
- package/src/attributes-editor/useAttributesEditorModel.ts +5 -52
- package/src/build-components/BIcon/BIconProps.generated.ts +1 -2
- package/src/build-components/CarouselDots/CarouselDots.tsx +6 -13
- package/src/build-components/CountDown/CountDownProps.generated.ts +2 -1
- package/src/build-components/NavigationBarColor/NavigationBarColor.tsx +2 -2
- package/src/build-components/OnboardButton/OnboardButton.tsx +1 -2
- package/src/build-components/OnboardDot/OnboardDot.tsx +6 -18
- package/src/build-components/OnboardFooter/OnboardFooter.tsx +5 -3
- package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +1 -2
- package/src/build-components/OnboardFooter/pattern.json +1 -1
- package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +1 -2
- package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +1 -2
- package/src/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.ts +1 -2
- package/src/build-components/PaywallOptions/PaywallOptions.tsx +3 -3
- package/src/build-components/PaywallOptions/usePaywallOptionParamsFactory.ts +26 -13
- package/src/build-components/PaywallProvider/PaywallProvider.tsx +51 -12
- package/src/build-components/PriceTag/PriceTag.tsx +25 -0
- package/src/build-components/PriceTag/PriceTagProps.generated.ts +83 -0
- package/src/build-components/PriceTag/pattern.json +53 -0
- package/src/build-components/Pricing/Pricing.tsx +13 -0
- package/src/build-components/Pricing/PricingProps.generated.ts +76 -0
- package/src/build-components/Pricing/pattern.json +25 -0
- package/src/build-components/Promo/Promo.tsx +13 -0
- package/src/build-components/Promo/PromoProps.generated.ts +76 -0
- package/src/build-components/Promo/pattern.json +25 -0
- package/src/build-components/RadioButton/RadioButton.tsx +3 -5
- package/src/build-components/RenderNode.generated.tsx +15 -0
- package/src/build-components/StatusBarColor/StatusBarColor.tsx +2 -2
- package/src/build-components/Text/Text.tsx +12 -5
- package/src/build-components/Text/TextProps.generated.ts +1 -2
- package/src/build-components/Text/pattern.json +3 -2
- package/src/build-components/index.ts +15 -0
- package/src/build-components/patterns.generated.ts +1454 -181
- package/src/components/BottomBar.tsx +42 -39
- package/src/components/BuilderProvider.tsx +41 -14
- package/src/components/LocalizationParamsProvider.tsx +1 -1
- package/src/components/ParamsProvider.tsx +36 -11
- package/src/hooks/useLocalize.ts +7 -4
- package/src/hooks/useParams.ts +1 -1
- package/src/hooks/useSyncHtmlThemeClass.ts +2 -2
- package/src/index.ts +56 -8
- package/src/logger.ts +39 -0
- package/src/modals/InspectModal.tsx +331 -0
- package/src/modals/ProductPresetsModal.tsx +6 -13
- package/src/modals/index.ts +1 -1
- package/src/pages/DebugJsonPage.tsx +9 -22
- package/src/pages/ProjectDebug.tsx +1 -1
- package/src/pages/ProjectPage.tsx +29 -11
- package/src/pages/tabs/SideTool.tsx +28 -104
- package/src/paywall/hooks/useCalculateLocalizedPrice.ts +8 -3
- package/src/paywall/hooks/useDiscountRate.ts +11 -3
- package/src/paywall/types/paywall-types.ts +7 -38
- package/src/product-base/buildPaywallLocalizationParams.ts +100 -0
- package/src/product-base/calculations.ts +93 -0
- package/src/product-base/extractAndroidParams.ts +207 -0
- package/src/product-base/extractIOSParams.ts +199 -0
- package/src/product-base/index.ts +28 -0
- package/src/product-base/mockProducts.json +489 -0
- package/src/product-base/periodLocalizationKeys.ts +114 -0
- package/src/product-base/types.ts +183 -0
- package/src/product-base/usePaywallLocalizationParams.ts +61 -0
- package/src/store.ts +18 -1
- package/src/styles/index.scss +1 -0
- package/src/styles/modals/_inspect-modal.scss +155 -0
- package/src/types/PreviewConfig.ts +157 -16
- package/src/utils/extractTextStyle/extractTextStyle.ts +14 -6
- package/src/utils/extractTextStyle/extractTextStyleNative.ts +8 -6
- package/src/utils/logRenderStore.ts +6 -10
- package/src/utils/parseColor.ts +0 -1
- package/src/utils/replaceLocalizationParams.ts +8 -4
- package/dist/modals/ScreenColorsModal.d.ts +0 -8
- package/src/assets/products.json +0 -98
- package/src/modals/ScreenColorsModal.tsx +0 -121
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NodeData } from '../../types/Node';
|
|
2
2
|
import type { TextPropsGenerated } from '../../build-components/Text/TextProps.generated';
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
3
|
+
import type { Theme } from '../../types/PreviewConfig';
|
|
4
|
+
import { defaultTheme } from '../../types/PreviewConfig';
|
|
5
5
|
import type { ProjectColors } from '../../types/Project';
|
|
6
6
|
import type { Fonts } from '../../types/Fonts';
|
|
7
7
|
import { fs, parseSize } from '../../size-matters';
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import { getStyleBag, toAttributeRecord } from '../attributeStyle';
|
|
16
16
|
|
|
17
17
|
export type ExtractTextStyleNativeOptions = {
|
|
18
|
-
|
|
18
|
+
theme?: Theme;
|
|
19
19
|
projectColors?: ProjectColors;
|
|
20
20
|
fonts?: Fonts;
|
|
21
21
|
};
|
|
@@ -46,10 +46,12 @@ export function extractTextStyleNative<
|
|
|
46
46
|
return styleBag?.[key];
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
const
|
|
50
|
-
const { screenStyle, theme } = resolvedAppConfig;
|
|
49
|
+
const theme = options.theme ?? defaultTheme;
|
|
51
50
|
const fallbackColor =
|
|
52
|
-
|
|
51
|
+
parseColor('THEME_COLORS.TEXT', {
|
|
52
|
+
projectColors: options.projectColors,
|
|
53
|
+
theme,
|
|
54
|
+
}) ?? 'THEME_COLORS.TEXT';
|
|
53
55
|
|
|
54
56
|
const style: Record<string, unknown> = {};
|
|
55
57
|
if (!attributes) {
|
|
@@ -84,7 +84,7 @@ export function logRenderStore(options: LogRenderStoreOptions = {}): void {
|
|
|
84
84
|
|
|
85
85
|
if (isFn(groupCollapsed)) groupCollapsed(title);
|
|
86
86
|
else {
|
|
87
|
-
console.
|
|
87
|
+
console.info(title);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
const persistedRaw = includeLocalStorage
|
|
@@ -105,21 +105,17 @@ export function logRenderStore(options: LogRenderStoreOptions = {}): void {
|
|
|
105
105
|
// NOTE: Logging objects in devtools can be confusing because they are "live" references.
|
|
106
106
|
// This JSON string is a stable snapshot of this click, and is copy/paste-friendly.
|
|
107
107
|
|
|
108
|
-
console.
|
|
108
|
+
console.info('json', json);
|
|
109
109
|
|
|
110
|
-
console.
|
|
110
|
+
console.info('state', snapshot);
|
|
111
111
|
|
|
112
|
-
console.
|
|
113
|
-
|
|
114
|
-
console.log('rawState (includes functions)', state);
|
|
112
|
+
console.info('actions', actions);
|
|
115
113
|
|
|
116
114
|
if (includeLocalStorage) {
|
|
117
|
-
console.
|
|
118
|
-
|
|
119
|
-
console.log('localStorage.render-store (parsed)', persistedParsed);
|
|
115
|
+
console.info('localStorage.render-store (raw)', persistedRaw);
|
|
120
116
|
}
|
|
121
117
|
if (extra) {
|
|
122
|
-
console.
|
|
118
|
+
console.info('extra', extra);
|
|
123
119
|
}
|
|
124
120
|
|
|
125
121
|
if (isFn(groupEnd)) groupEnd();
|
package/src/utils/parseColor.ts
CHANGED
|
@@ -19,7 +19,6 @@ 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);
|
|
23
22
|
return typeof resolved === 'string' && resolved.trim()
|
|
24
23
|
? resolved.trim()
|
|
25
24
|
: trimmed;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
export function replaceLocalizationParams(
|
|
2
2
|
text: string,
|
|
3
|
-
params?: Record<string, string> | null
|
|
3
|
+
params?: Record<string, string | undefined> | null
|
|
4
4
|
): string {
|
|
5
5
|
if (!text) return text;
|
|
6
6
|
if (!params) return text;
|
|
7
7
|
|
|
8
|
+
// Sort longest keys first to avoid prefix collisions
|
|
9
|
+
// (e.g. @trialPeriod matching inside @trialPeriodUnit)
|
|
10
|
+
const sorted = Object.entries(params).sort(([a], [b]) => b.length - a.length);
|
|
11
|
+
|
|
8
12
|
return (
|
|
9
|
-
|
|
13
|
+
sorted.reduce((acc, [key, val]) => {
|
|
14
|
+
if (val == null) return acc;
|
|
10
15
|
const needle = `@${key}`;
|
|
11
|
-
|
|
12
|
-
return acc.split(needle).join(String(val));
|
|
16
|
+
return acc.split(needle).join(val);
|
|
13
17
|
}, text) || text
|
|
14
18
|
);
|
|
15
19
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { AppConfig } from '../types/PreviewConfig';
|
|
2
|
-
type ScreenColorsModalProps = {
|
|
3
|
-
appConfig: AppConfig;
|
|
4
|
-
onChange: (next: AppConfig) => void;
|
|
5
|
-
onClose: () => void;
|
|
6
|
-
};
|
|
7
|
-
export declare function ScreenColorsModal({ appConfig, onChange, onClose, }: ScreenColorsModalProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
package/src/assets/products.json
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Embeded Paywall": [
|
|
3
|
-
{
|
|
4
|
-
"productId": "com.app.premium.monthly",
|
|
5
|
-
"title": "Premium Monthly",
|
|
6
|
-
"description": "Unlock all premium features for a month.",
|
|
7
|
-
"localizedPrice": "$4.99",
|
|
8
|
-
"price": "4.99",
|
|
9
|
-
"currency": "USD"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"productId": "com.app.pro.yearly",
|
|
13
|
-
"title": "Pro Yearly",
|
|
14
|
-
"description": "Best value: full access for a year.",
|
|
15
|
-
"localizedPrice": "€39.99",
|
|
16
|
-
"price": "39.99",
|
|
17
|
-
"currency": "EUR"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"productId": "com.app.plus.weekly",
|
|
21
|
-
"title": "Plus Weekly",
|
|
22
|
-
"description": "Try Plus with a flexible weekly plan.",
|
|
23
|
-
"localizedPrice": "£1.99",
|
|
24
|
-
"price": "1.99",
|
|
25
|
-
"currency": "GBP"
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
"type-1": [
|
|
29
|
-
{
|
|
30
|
-
"productId": "com.app.premium.monthly",
|
|
31
|
-
"title": "Premium Monthly",
|
|
32
|
-
"description": "Unlock all premium features for a month.",
|
|
33
|
-
"localizedPrice": "$4.99",
|
|
34
|
-
"price": "4.99",
|
|
35
|
-
"currency": "USD"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"productId": "com.app.pro.yearly",
|
|
39
|
-
"title": "Pro Yearly",
|
|
40
|
-
"description": "Best value: full access for a year.",
|
|
41
|
-
"localizedPrice": "€39.99",
|
|
42
|
-
"price": "39.99",
|
|
43
|
-
"currency": "EUR"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"productId": "com.app.plus.weekly",
|
|
47
|
-
"title": "Plus Weekly",
|
|
48
|
-
"description": "Try Plus with a flexible weekly plan.",
|
|
49
|
-
"localizedPrice": "£1.99",
|
|
50
|
-
"price": "1.99",
|
|
51
|
-
"currency": "GBP"
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
|
-
"type-2": [
|
|
55
|
-
{
|
|
56
|
-
"productId": "com.app.starter.monthly",
|
|
57
|
-
"title": "Starter Monthly",
|
|
58
|
-
"description": "Basic access to get started.",
|
|
59
|
-
"localizedPrice": "$2.99",
|
|
60
|
-
"price": "2.99",
|
|
61
|
-
"currency": "USD"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"productId": "com.app.gold.monthly",
|
|
65
|
-
"title": "Gold Monthly",
|
|
66
|
-
"description": "Gold tier with extra perks.",
|
|
67
|
-
"localizedPrice": "₺149.99",
|
|
68
|
-
"price": "149.99",
|
|
69
|
-
"currency": "TRY"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"productId": "com.app.premium.yearly",
|
|
73
|
-
"title": "Premium Yearly",
|
|
74
|
-
"description": "Unlock premium for a year.",
|
|
75
|
-
"localizedPrice": "$49.99",
|
|
76
|
-
"price": "49.99",
|
|
77
|
-
"currency": "USD"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"productId": "com.app.pro.lifetime",
|
|
81
|
-
"title": "Pro Lifetime",
|
|
82
|
-
"description": "One-time purchase for lifetime access.",
|
|
83
|
-
"localizedPrice": "€99.99",
|
|
84
|
-
"price": "99.99",
|
|
85
|
-
"currency": "EUR"
|
|
86
|
-
}
|
|
87
|
-
],
|
|
88
|
-
"type-3": [
|
|
89
|
-
{
|
|
90
|
-
"productId": "com.app.plus.yearly",
|
|
91
|
-
"title": "Plus Yearly",
|
|
92
|
-
"description": "Yearly plan with a big discount.",
|
|
93
|
-
"localizedPrice": "$24.99",
|
|
94
|
-
"price": "24.99",
|
|
95
|
-
"currency": "USD"
|
|
96
|
-
}
|
|
97
|
-
]
|
|
98
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import type { AppConfig } from '../types/PreviewConfig';
|
|
3
|
-
import { defaultAppConfig } from '../types/PreviewConfig';
|
|
4
|
-
import Modal from './Modal';
|
|
5
|
-
|
|
6
|
-
type ScreenMode = 'light' | 'dark';
|
|
7
|
-
type ScreenColorKey = keyof AppConfig['screenStyle']['light'];
|
|
8
|
-
|
|
9
|
-
type ScreenColorsModalProps = {
|
|
10
|
-
appConfig: AppConfig;
|
|
11
|
-
onChange: (next: AppConfig) => void;
|
|
12
|
-
onClose: () => void;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type ColorField = {
|
|
16
|
-
id: string;
|
|
17
|
-
label: string;
|
|
18
|
-
mode: ScreenMode;
|
|
19
|
-
key: ScreenColorKey;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const colorFields: ColorField[] = [
|
|
23
|
-
{
|
|
24
|
-
id: 'light-bg',
|
|
25
|
-
label: 'Light Background',
|
|
26
|
-
mode: 'light',
|
|
27
|
-
key: 'backgroundColor',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
id: 'light-color',
|
|
31
|
-
label: 'Light Text',
|
|
32
|
-
mode: 'light',
|
|
33
|
-
key: 'color',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
id: 'dark-bg',
|
|
37
|
-
label: 'Dark Background',
|
|
38
|
-
mode: 'dark',
|
|
39
|
-
key: 'backgroundColor',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
id: 'dark-color',
|
|
43
|
-
label: 'Dark Text',
|
|
44
|
-
mode: 'dark',
|
|
45
|
-
key: 'color',
|
|
46
|
-
},
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
export function ScreenColorsModal({
|
|
50
|
-
appConfig,
|
|
51
|
-
onChange,
|
|
52
|
-
onClose,
|
|
53
|
-
}: ScreenColorsModalProps) {
|
|
54
|
-
const defaults = defaultAppConfig.screenStyle;
|
|
55
|
-
|
|
56
|
-
const getValue = (mode: ScreenMode, key: ScreenColorKey) =>
|
|
57
|
-
appConfig.screenStyle?.[mode]?.[key] ?? defaults[mode][key];
|
|
58
|
-
|
|
59
|
-
const handleChange = (mode: ScreenMode, key: ScreenColorKey, value: string) =>
|
|
60
|
-
onChange({
|
|
61
|
-
...appConfig,
|
|
62
|
-
screenStyle: {
|
|
63
|
-
...defaults,
|
|
64
|
-
...appConfig.screenStyle,
|
|
65
|
-
[mode]: {
|
|
66
|
-
...defaults[mode],
|
|
67
|
-
...appConfig.screenStyle?.[mode],
|
|
68
|
-
[key]: value,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
const headerDescription = useMemo(
|
|
74
|
-
() =>
|
|
75
|
-
'Edit light/dark screen background & text colors used in the preview.',
|
|
76
|
-
[],
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<Modal
|
|
81
|
-
onClose={onClose}
|
|
82
|
-
ariaLabelledBy="screen-colors-title"
|
|
83
|
-
contentClassName="localication-modal__content"
|
|
84
|
-
>
|
|
85
|
-
<div className="modal__header localication-modal__header">
|
|
86
|
-
<div className="localication-modal__header-main">
|
|
87
|
-
<h3 id="screen-colors-title" className="modal__title">
|
|
88
|
-
Screen Colors
|
|
89
|
-
</h3>
|
|
90
|
-
<p className="localication-modal__description">{headerDescription}</p>
|
|
91
|
-
</div>
|
|
92
|
-
<button type="button" className="editor-button" onClick={onClose}>
|
|
93
|
-
Close
|
|
94
|
-
</button>
|
|
95
|
-
</div>
|
|
96
|
-
|
|
97
|
-
<div className="localication-modal__body">
|
|
98
|
-
<div
|
|
99
|
-
style={{
|
|
100
|
-
display: 'grid',
|
|
101
|
-
gridTemplateColumns: 'repeat(2, minmax(0, 1fr))',
|
|
102
|
-
gap: 12,
|
|
103
|
-
}}
|
|
104
|
-
>
|
|
105
|
-
{colorFields.map(({ id, label, mode, key }) => (
|
|
106
|
-
<React.Fragment key={id}>
|
|
107
|
-
<div style={{ alignSelf: 'center' }}>{label}</div>
|
|
108
|
-
<input
|
|
109
|
-
id={id}
|
|
110
|
-
type="color"
|
|
111
|
-
className="input input--color"
|
|
112
|
-
value={String(getValue(mode, key))}
|
|
113
|
-
onChange={(e) => handleChange(mode, key, e.target.value)}
|
|
114
|
-
/>
|
|
115
|
-
</React.Fragment>
|
|
116
|
-
))}
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
</Modal>
|
|
120
|
-
);
|
|
121
|
-
}
|