@revenuecat/purchases-ui-js 3.12.0 → 4.0.0
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/components/button/ButtonNodeTestWrapper.svelte +4 -0
- package/dist/components/countdown/Countdown.svelte +5 -1
- package/dist/components/express-purchase-button/ExpressPurchaseButton.svelte +14 -5
- package/dist/components/icon/Icon.svelte +27 -4
- package/dist/components/image/Image.svelte +80 -57
- package/dist/components/input-text/InputText.svelte +34 -17
- package/dist/components/layout/Main/Main.stories.svelte +263 -0
- package/dist/components/layout/Main/Main.stories.svelte.d.ts +19 -0
- package/dist/components/layout/Main/Main.svelte +117 -0
- package/dist/components/layout/Main/Main.svelte.d.ts +11 -0
- package/dist/components/layout/Main/ViewportBackdrop.svelte +65 -0
- package/dist/components/layout/Main/ViewportBackdrop.svelte.d.ts +7 -0
- package/dist/components/options/InputOptionTestWrapper.svelte +5 -0
- package/dist/components/paywall/Paywall.stories.svelte +30 -4
- package/dist/components/paywall/Paywall.svelte +15 -23
- package/dist/components/stack/Stack.svelte +52 -31
- package/dist/components/tabs/Tabs.svelte +28 -6
- package/dist/components/text/TextNode.svelte +4 -4
- package/dist/components/timeline/Timeline.svelte +24 -3
- package/dist/components/video/Video.svelte +94 -71
- package/dist/components/wallet-button/WalletButton.svelte +39 -31
- package/dist/components/wallet-button/WalletButton.svelte.d.ts +1 -5
- package/dist/components/workflows/Screen.stories.svelte +42 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/stores/packageInfo.d.ts +1 -0
- package/dist/stores/packageInfo.js +5 -1
- package/dist/stores/variables.d.ts +1 -0
- package/dist/stores/variables.js +5 -1
- package/dist/types/components/wallet-button.d.ts +6 -0
- package/dist/types/wallet.d.ts +8 -0
- package/dist/utils/background-utils.d.ts +15 -0
- package/dist/utils/background-utils.js +21 -0
- package/dist/utils/style-utils.d.ts +8 -8
- package/dist/utils/style-utils.js +46 -49
- package/package.json +3 -2
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { setLocalizationContext } from "../../stores/localization";
|
|
3
|
+
import { setPackageInfoContext } from "../../stores/packageInfo";
|
|
3
4
|
import { setPaywallContext } from "../../stores/paywall";
|
|
5
|
+
import { setVariablesContext } from "../../stores/variables";
|
|
4
6
|
import { writable, readable } from "svelte/store";
|
|
5
7
|
import ButtonNode from "./ButtonNode.svelte";
|
|
6
8
|
import type { ButtonProps } from "../../types/components/button";
|
|
@@ -30,6 +32,8 @@
|
|
|
30
32
|
uiConfig: {} as never,
|
|
31
33
|
hideBackButtons,
|
|
32
34
|
});
|
|
35
|
+
setPackageInfoContext(readable(undefined));
|
|
36
|
+
setVariablesContext(readable({}));
|
|
33
37
|
</script>
|
|
34
38
|
|
|
35
39
|
<ButtonNode {...buttonProps} />
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
const shouldShowAvailableStack = $derived(
|
|
32
32
|
Boolean(
|
|
33
33
|
wallet_available_stack &&
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
walletButtonAvailable &&
|
|
35
|
+
!shouldShowWalletSkeleton,
|
|
36
36
|
),
|
|
37
37
|
);
|
|
38
38
|
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
</script>
|
|
53
53
|
|
|
54
54
|
<Stack {...wrapperStackProps}>
|
|
55
|
-
<
|
|
56
|
-
{...
|
|
57
|
-
|
|
55
|
+
<div class={shouldShowAvailableStack ? "wallet-slot" : "wallet-slot-hidden"}>
|
|
56
|
+
<Stack {...wallet_available_stack} />
|
|
57
|
+
</div>
|
|
58
58
|
|
|
59
59
|
{#if shouldShowWalletSkeleton}
|
|
60
60
|
<Stack {...wallet_unknown_stack} />
|
|
@@ -62,3 +62,12 @@
|
|
|
62
62
|
<Stack {...wallet_unavailable_stack} />
|
|
63
63
|
{/if}
|
|
64
64
|
</Stack>
|
|
65
|
+
|
|
66
|
+
<style>
|
|
67
|
+
.wallet-slot {
|
|
68
|
+
display: contents;
|
|
69
|
+
}
|
|
70
|
+
.wallet-slot-hidden {
|
|
71
|
+
display: none;
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getColorModeContext } from "../../stores/color-mode";
|
|
3
|
+
import { getOptionalPackageInfoContext } from "../../stores/packageInfo";
|
|
4
|
+
import { getPaywallContext } from "../../stores/paywall";
|
|
3
5
|
import { getSelectedStateContext } from "../../stores/selected";
|
|
6
|
+
import { getOptionalVariablesContext } from "../../stores/variables";
|
|
4
7
|
import type { IconProps } from "../../types/components/icon";
|
|
5
8
|
import {
|
|
6
9
|
css,
|
|
@@ -11,10 +14,16 @@
|
|
|
11
14
|
mapSize,
|
|
12
15
|
mapSpacing,
|
|
13
16
|
} from "../../utils/base-utils";
|
|
14
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
evaluateVisibilityConditions,
|
|
19
|
+
getActiveStateProps,
|
|
20
|
+
} from "../../utils/style-utils";
|
|
15
21
|
|
|
16
22
|
const props: IconProps = $props();
|
|
17
23
|
const selectedState = getSelectedStateContext();
|
|
24
|
+
const packageInfo = getOptionalPackageInfoContext();
|
|
25
|
+
const { selectedPackageId } = getPaywallContext();
|
|
26
|
+
const variables = getOptionalVariablesContext();
|
|
18
27
|
const {
|
|
19
28
|
base_url,
|
|
20
29
|
formats,
|
|
@@ -66,8 +75,22 @@
|
|
|
66
75
|
"-webkit-mask-repeat": "no-repeat",
|
|
67
76
|
}),
|
|
68
77
|
);
|
|
78
|
+
|
|
79
|
+
const isVisible = $derived(
|
|
80
|
+
evaluateVisibilityConditions(
|
|
81
|
+
{
|
|
82
|
+
selectedPackageId: $selectedPackageId,
|
|
83
|
+
packageInfo: $packageInfo,
|
|
84
|
+
variables: $variables ?? {},
|
|
85
|
+
},
|
|
86
|
+
props.overrides,
|
|
87
|
+
props.visible,
|
|
88
|
+
),
|
|
89
|
+
);
|
|
69
90
|
</script>
|
|
70
91
|
|
|
71
|
-
|
|
72
|
-
<div style={
|
|
73
|
-
|
|
92
|
+
{#if isVisible}
|
|
93
|
+
<div class="rc-gradient-border" style={container}>
|
|
94
|
+
<div style={icon}></div>
|
|
95
|
+
</div>
|
|
96
|
+
{/if}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getColorModeContext } from "../../stores/color-mode";
|
|
3
|
+
import { getOptionalPackageInfoContext } from "../../stores/packageInfo";
|
|
4
|
+
import { getPaywallContext } from "../../stores/paywall";
|
|
3
5
|
import { getSelectedStateContext } from "../../stores/selected";
|
|
6
|
+
import { getOptionalVariablesContext } from "../../stores/variables";
|
|
4
7
|
import type { ImageProps } from "../../types/components/image";
|
|
5
8
|
import {
|
|
6
9
|
css,
|
|
@@ -10,13 +13,19 @@
|
|
|
10
13
|
mapSize,
|
|
11
14
|
mapSpacing,
|
|
12
15
|
} from "../../utils/base-utils";
|
|
13
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
evaluateVisibilityConditions,
|
|
18
|
+
getActiveStateProps,
|
|
19
|
+
} from "../../utils/style-utils";
|
|
14
20
|
import ClipPath from "./ClipPath.svelte";
|
|
15
21
|
import Overlay from "./Overlay.svelte";
|
|
16
22
|
|
|
17
23
|
const props: ImageProps = $props();
|
|
18
24
|
|
|
19
25
|
const selectedState = getSelectedStateContext();
|
|
26
|
+
const packageInfo = getOptionalPackageInfoContext();
|
|
27
|
+
const { selectedPackageId } = getPaywallContext();
|
|
28
|
+
const variables = getOptionalVariablesContext();
|
|
20
29
|
const {
|
|
21
30
|
id,
|
|
22
31
|
source,
|
|
@@ -112,68 +121,82 @@
|
|
|
112
121
|
const overlay = $derived(
|
|
113
122
|
color_overlay && mapColorMode(colorMode, color_overlay),
|
|
114
123
|
);
|
|
124
|
+
|
|
125
|
+
const isVisible = $derived(
|
|
126
|
+
evaluateVisibilityConditions(
|
|
127
|
+
{
|
|
128
|
+
selectedPackageId: $selectedPackageId,
|
|
129
|
+
packageInfo: $packageInfo,
|
|
130
|
+
variables: $variables ?? {},
|
|
131
|
+
},
|
|
132
|
+
props.overrides,
|
|
133
|
+
props.visible,
|
|
134
|
+
),
|
|
135
|
+
);
|
|
115
136
|
</script>
|
|
116
137
|
|
|
117
|
-
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
<
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
<
|
|
132
|
-
|
|
138
|
+
{#if isVisible}
|
|
139
|
+
<div {style} bind:clientWidth={wrapperWidth}>
|
|
140
|
+
<svg
|
|
141
|
+
bind:contentRect={svgRect}
|
|
142
|
+
width="100%"
|
|
143
|
+
height="100%"
|
|
144
|
+
{viewBox}
|
|
145
|
+
style={svgStyle}
|
|
146
|
+
>
|
|
147
|
+
<defs>
|
|
148
|
+
<clipPath id={`${id}-path`}>
|
|
149
|
+
<ClipPath shape={mask_shape} width={svgWidth} height={svgHeight} />
|
|
150
|
+
</clipPath>
|
|
151
|
+
|
|
152
|
+
<g id={`${id}-border`}>
|
|
153
|
+
<ClipPath shape={mask_shape} width={svgWidth} height={svgHeight} />
|
|
154
|
+
</g>
|
|
155
|
+
|
|
156
|
+
<Overlay id={`${id}-overlay`} {overlay} />
|
|
157
|
+
{#if border && border.width > 0}
|
|
158
|
+
<Overlay
|
|
159
|
+
id={`${id}-border-color`}
|
|
160
|
+
overlay={mapColorMode(colorMode, border.color)}
|
|
161
|
+
/>
|
|
162
|
+
{/if}
|
|
163
|
+
</defs>
|
|
133
164
|
|
|
134
|
-
<Overlay id={`${id}-overlay`} {overlay} />
|
|
135
165
|
{#if border && border.width > 0}
|
|
136
|
-
<
|
|
137
|
-
id={`${id}-border-color`}
|
|
138
|
-
overlay={mapColorMode(colorMode, border.color)}
|
|
139
|
-
/>
|
|
140
|
-
{/if}
|
|
141
|
-
</defs>
|
|
142
|
-
|
|
143
|
-
{#if border && border.width > 0}
|
|
144
|
-
<use href={`#${id}-border`} fill="transparent" />
|
|
145
|
-
{/if}
|
|
146
|
-
|
|
147
|
-
<g clip-path={`url(#${id}-path)`}>
|
|
148
|
-
<foreignObject x="0" y="0" width="100%" height="100%">
|
|
149
|
-
<img
|
|
150
|
-
src={image.original}
|
|
151
|
-
style="object-fit:{mapFitMode(fit_mode)}"
|
|
152
|
-
alt=""
|
|
153
|
-
/>
|
|
154
|
-
</foreignObject>
|
|
155
|
-
|
|
156
|
-
{#if overlay}
|
|
157
|
-
<rect
|
|
158
|
-
x="0"
|
|
159
|
-
y="0"
|
|
160
|
-
height="100%"
|
|
161
|
-
width="100%"
|
|
162
|
-
fill={`url(#${id}-overlay)`}
|
|
163
|
-
/>
|
|
166
|
+
<use href={`#${id}-border`} fill="transparent" />
|
|
164
167
|
{/if}
|
|
165
168
|
|
|
166
|
-
{
|
|
167
|
-
<
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
169
|
+
<g clip-path={`url(#${id}-path)`}>
|
|
170
|
+
<foreignObject x="0" y="0" width="100%" height="100%">
|
|
171
|
+
<img
|
|
172
|
+
src={image.original}
|
|
173
|
+
style="object-fit:{mapFitMode(fit_mode)}"
|
|
174
|
+
alt=""
|
|
175
|
+
/>
|
|
176
|
+
</foreignObject>
|
|
177
|
+
|
|
178
|
+
{#if overlay}
|
|
179
|
+
<rect
|
|
180
|
+
x="0"
|
|
181
|
+
y="0"
|
|
182
|
+
height="100%"
|
|
183
|
+
width="100%"
|
|
184
|
+
fill={`url(#${id}-overlay)`}
|
|
185
|
+
/>
|
|
186
|
+
{/if}
|
|
187
|
+
|
|
188
|
+
{#if border && border.width > 0}
|
|
189
|
+
<use
|
|
190
|
+
href={`#${id}-border`}
|
|
191
|
+
fill="none"
|
|
192
|
+
stroke={`url(#${id}-border-color)`}
|
|
193
|
+
stroke-width={border.width * 2}
|
|
194
|
+
/>
|
|
195
|
+
{/if}
|
|
196
|
+
</g>
|
|
197
|
+
</svg>
|
|
198
|
+
</div>
|
|
199
|
+
{/if}
|
|
177
200
|
|
|
178
201
|
<style>
|
|
179
202
|
img {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getColorModeContext } from "../../stores/color-mode";
|
|
3
3
|
import { getLocalizationContext } from "../../stores/localization";
|
|
4
|
+
import { getOptionalPackageInfoContext } from "../../stores/packageInfo";
|
|
4
5
|
import { getPaywallContext } from "../../stores/paywall";
|
|
5
|
-
import {
|
|
6
|
+
import { getOptionalVariablesContext } from "../../stores/variables";
|
|
6
7
|
import { FontWeights, TextAlignments } from "../../types";
|
|
7
8
|
import type {
|
|
8
9
|
InputTextKeyboardType,
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
isFontRCFMManaged,
|
|
23
24
|
} from "../../utils/font-utils";
|
|
24
25
|
import {
|
|
26
|
+
evaluateVisibilityConditions,
|
|
25
27
|
getErrorStateProps,
|
|
26
28
|
getFocusStateProps,
|
|
27
29
|
} from "../../utils/style-utils";
|
|
@@ -88,11 +90,12 @@
|
|
|
88
90
|
|
|
89
91
|
const getColorMode = getColorModeContext();
|
|
90
92
|
const colorMode = $derived(getColorMode());
|
|
91
|
-
const { uiConfig, onInputChanged } = getPaywallContext();
|
|
93
|
+
const { uiConfig, onInputChanged, selectedPackageId } = getPaywallContext();
|
|
94
|
+
const packageInfo = getOptionalPackageInfoContext();
|
|
92
95
|
|
|
93
96
|
const wrapperStyle = $derived(
|
|
94
97
|
css({
|
|
95
|
-
display:
|
|
98
|
+
display: "flex",
|
|
96
99
|
width: mapSize(size.width),
|
|
97
100
|
height: mapSize(size.height),
|
|
98
101
|
margin: mapSpacing(margin),
|
|
@@ -140,7 +143,7 @@
|
|
|
140
143
|
});
|
|
141
144
|
});
|
|
142
145
|
|
|
143
|
-
const variables =
|
|
146
|
+
const variables = getOptionalVariablesContext();
|
|
144
147
|
const { getLocalizedString } = getLocalizationContext();
|
|
145
148
|
const placeholder = $derived(
|
|
146
149
|
replaceVariables(getLocalizedString(placeholder_lid), $variables),
|
|
@@ -161,21 +164,35 @@
|
|
|
161
164
|
return "url";
|
|
162
165
|
}
|
|
163
166
|
});
|
|
167
|
+
|
|
168
|
+
const isVisible = $derived(
|
|
169
|
+
evaluateVisibilityConditions(
|
|
170
|
+
{
|
|
171
|
+
selectedPackageId: $selectedPackageId,
|
|
172
|
+
packageInfo: $packageInfo,
|
|
173
|
+
variables: $variables ?? {},
|
|
174
|
+
},
|
|
175
|
+
props.overrides,
|
|
176
|
+
props.visible,
|
|
177
|
+
),
|
|
178
|
+
);
|
|
164
179
|
</script>
|
|
165
180
|
|
|
166
|
-
|
|
167
|
-
<
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
181
|
+
{#if isVisible}
|
|
182
|
+
<div class="rc-gradient-border" style={wrapperStyle}>
|
|
183
|
+
<input
|
|
184
|
+
{type}
|
|
185
|
+
{placeholder}
|
|
186
|
+
{required}
|
|
187
|
+
inputmode={keyboard_type}
|
|
188
|
+
autocapitalize={capitalize}
|
|
189
|
+
style={inputStyle}
|
|
190
|
+
{oninput}
|
|
191
|
+
onfocus={() => (focused = true)}
|
|
192
|
+
{onblur}
|
|
193
|
+
/>
|
|
194
|
+
</div>
|
|
195
|
+
{/if}
|
|
179
196
|
|
|
180
197
|
<style>
|
|
181
198
|
input {
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import type { ComponentProps } from "svelte";
|
|
4
|
+
import Main from "./Main.svelte";
|
|
5
|
+
import Screen from "../../workflows/Screen.svelte";
|
|
6
|
+
import type { Background } from "../../../types/background";
|
|
7
|
+
import type { Component } from "../../../types/component";
|
|
8
|
+
import type { HeaderProps } from "../../../types/components/header";
|
|
9
|
+
import type { FooterProps } from "../../../types/components/footer";
|
|
10
|
+
import type { TextNodeProps } from "../../../types/components/text";
|
|
11
|
+
import type { WorkflowScreen } from "../../../types/workflow";
|
|
12
|
+
import { uiConfigData } from "../../../stories/fixtures";
|
|
13
|
+
|
|
14
|
+
function textComponent(id: string, textLid: string): TextNodeProps {
|
|
15
|
+
return {
|
|
16
|
+
type: "text",
|
|
17
|
+
id,
|
|
18
|
+
name: "",
|
|
19
|
+
text_lid: textLid,
|
|
20
|
+
font_name: null,
|
|
21
|
+
font_size: "body_m",
|
|
22
|
+
font_weight: "bold",
|
|
23
|
+
horizontal_alignment: "center",
|
|
24
|
+
color: { light: { type: "hex", value: "#ffffffff" } },
|
|
25
|
+
background_color: null,
|
|
26
|
+
padding: { top: 0, bottom: 0, leading: 0, trailing: 0 },
|
|
27
|
+
margin: { top: 0, bottom: 0, leading: 0, trailing: 0 },
|
|
28
|
+
size: { width: { type: "fit" }, height: { type: "fit" } },
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function visibleStack(components: Component[] = []) {
|
|
33
|
+
return {
|
|
34
|
+
type: "stack" as const,
|
|
35
|
+
id: "s",
|
|
36
|
+
name: "",
|
|
37
|
+
components,
|
|
38
|
+
size: {
|
|
39
|
+
width: { type: "fill" as const },
|
|
40
|
+
height: { type: "fit" as const },
|
|
41
|
+
},
|
|
42
|
+
dimension: {
|
|
43
|
+
type: "vertical" as const,
|
|
44
|
+
alignment: "center" as const,
|
|
45
|
+
distribution: "center" as const,
|
|
46
|
+
},
|
|
47
|
+
spacing: 0,
|
|
48
|
+
margin: { top: 0, bottom: 0, leading: 0, trailing: 0 },
|
|
49
|
+
padding: { top: 16, bottom: 16, leading: 0, trailing: 0 },
|
|
50
|
+
background_color: { light: { type: "hex" as const, value: "#00000033" } },
|
|
51
|
+
background: null,
|
|
52
|
+
border: null,
|
|
53
|
+
shape: null,
|
|
54
|
+
shadow: null,
|
|
55
|
+
badge: null,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const minimalHeader: HeaderProps = {
|
|
60
|
+
id: "header",
|
|
61
|
+
name: "Header",
|
|
62
|
+
type: "header",
|
|
63
|
+
stack: visibleStack([textComponent("header-label", "header_label")]),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const minimalFooter: FooterProps = {
|
|
67
|
+
id: "footer",
|
|
68
|
+
name: "Footer",
|
|
69
|
+
type: "footer",
|
|
70
|
+
stack: visibleStack([textComponent("footer-label", "footer_label")]),
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
function shellData(
|
|
74
|
+
background: Background,
|
|
75
|
+
hasHeader: boolean,
|
|
76
|
+
hasFooter: boolean,
|
|
77
|
+
): WorkflowScreen {
|
|
78
|
+
return {
|
|
79
|
+
id: "main-story",
|
|
80
|
+
default_locale: "en_US",
|
|
81
|
+
components_localizations: {
|
|
82
|
+
en_US: { header_label: "Header", footer_label: "Footer" },
|
|
83
|
+
},
|
|
84
|
+
asset_base_url: "https://assets.pawwalls.com",
|
|
85
|
+
config: {},
|
|
86
|
+
localized_strings: {},
|
|
87
|
+
localized_strings_by_tier: {},
|
|
88
|
+
name: "Main story",
|
|
89
|
+
offering_id: null,
|
|
90
|
+
revision: 1,
|
|
91
|
+
template_name: "stack",
|
|
92
|
+
components_config: {
|
|
93
|
+
base: {
|
|
94
|
+
background,
|
|
95
|
+
header: hasHeader ? minimalHeader : null,
|
|
96
|
+
sticky_footer: hasFooter ? minimalFooter : null,
|
|
97
|
+
stack: {
|
|
98
|
+
type: "stack" as const,
|
|
99
|
+
id: "content",
|
|
100
|
+
name: "",
|
|
101
|
+
components: [],
|
|
102
|
+
size: {
|
|
103
|
+
width: { type: "fill" as const },
|
|
104
|
+
height: { type: "fill" as const },
|
|
105
|
+
},
|
|
106
|
+
dimension: {
|
|
107
|
+
type: "vertical" as const,
|
|
108
|
+
alignment: "center" as const,
|
|
109
|
+
distribution: "start" as const,
|
|
110
|
+
},
|
|
111
|
+
spacing: 0,
|
|
112
|
+
margin: { top: 0, bottom: 0, leading: 0, trailing: 0 },
|
|
113
|
+
padding: { top: 0, bottom: 0, leading: 0, trailing: 0 },
|
|
114
|
+
background_color: null,
|
|
115
|
+
background: null,
|
|
116
|
+
border: null,
|
|
117
|
+
shape: null,
|
|
118
|
+
shadow: null,
|
|
119
|
+
badge: null,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const solidColour: Background = {
|
|
127
|
+
type: "color",
|
|
128
|
+
value: { light: { type: "hex", value: "#6B4FBBFF" } },
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const gradient: Background = {
|
|
132
|
+
type: "color",
|
|
133
|
+
value: {
|
|
134
|
+
light: {
|
|
135
|
+
type: "linear",
|
|
136
|
+
degrees: 180,
|
|
137
|
+
points: [
|
|
138
|
+
{ percent: 0, color: "#3B82F6FF" },
|
|
139
|
+
{ percent: 100, color: "#9333EAFF" },
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const image: Background = {
|
|
146
|
+
type: "image",
|
|
147
|
+
fit_mode: "fill",
|
|
148
|
+
color_overlay: null,
|
|
149
|
+
value: {
|
|
150
|
+
light: {
|
|
151
|
+
width: 1170,
|
|
152
|
+
height: 2532,
|
|
153
|
+
original: "https://placehold.co/1170x2532",
|
|
154
|
+
heic: "https://placehold.co/1170x2532",
|
|
155
|
+
heic_low_res: "https://placehold.co/1170x2532",
|
|
156
|
+
webp: "https://placehold.co/1170x2532",
|
|
157
|
+
webp_low_res: "https://placehold.co/1170x2532",
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const { Story } = defineMeta({
|
|
163
|
+
title: "Components/Layout/Main",
|
|
164
|
+
component: Main,
|
|
165
|
+
render: template,
|
|
166
|
+
args: { paywallData: shellData(solidColour, false, false) },
|
|
167
|
+
});
|
|
168
|
+
</script>
|
|
169
|
+
|
|
170
|
+
{#snippet template({
|
|
171
|
+
paywallData,
|
|
172
|
+
preferredColorMode,
|
|
173
|
+
}: ComponentProps<typeof Main>)}
|
|
174
|
+
<div class="viewport-frame">
|
|
175
|
+
<Main {paywallData} {preferredColorMode}>
|
|
176
|
+
<div class="content-wrapper">
|
|
177
|
+
<Screen paywallComponents={paywallData} uiConfig={uiConfigData} />
|
|
178
|
+
</div>
|
|
179
|
+
</Main>
|
|
180
|
+
</div>
|
|
181
|
+
{/snippet}
|
|
182
|
+
|
|
183
|
+
<Story
|
|
184
|
+
name="Solid colour"
|
|
185
|
+
args={{ paywallData: shellData(solidColour, false, false) }}
|
|
186
|
+
/>
|
|
187
|
+
<Story
|
|
188
|
+
name="Solid colour — header"
|
|
189
|
+
args={{ paywallData: shellData(solidColour, true, false) }}
|
|
190
|
+
/>
|
|
191
|
+
<Story
|
|
192
|
+
name="Solid colour — footer"
|
|
193
|
+
args={{ paywallData: shellData(solidColour, false, true) }}
|
|
194
|
+
/>
|
|
195
|
+
<Story
|
|
196
|
+
name="Solid colour — header and footer"
|
|
197
|
+
args={{ paywallData: shellData(solidColour, true, true) }}
|
|
198
|
+
/>
|
|
199
|
+
|
|
200
|
+
<Story
|
|
201
|
+
name="Gradient"
|
|
202
|
+
args={{ paywallData: shellData(gradient, false, false) }}
|
|
203
|
+
/>
|
|
204
|
+
<Story
|
|
205
|
+
name="Gradient — header"
|
|
206
|
+
args={{ paywallData: shellData(gradient, true, false) }}
|
|
207
|
+
/>
|
|
208
|
+
<Story
|
|
209
|
+
name="Gradient — footer"
|
|
210
|
+
args={{ paywallData: shellData(gradient, false, true) }}
|
|
211
|
+
/>
|
|
212
|
+
<Story
|
|
213
|
+
name="Gradient — header and footer"
|
|
214
|
+
args={{ paywallData: shellData(gradient, true, true) }}
|
|
215
|
+
/>
|
|
216
|
+
|
|
217
|
+
<Story name="Image" args={{ paywallData: shellData(image, false, false) }} />
|
|
218
|
+
<Story
|
|
219
|
+
name="Image — header"
|
|
220
|
+
args={{ paywallData: shellData(image, true, false) }}
|
|
221
|
+
/>
|
|
222
|
+
<Story
|
|
223
|
+
name="Image — footer"
|
|
224
|
+
args={{ paywallData: shellData(image, false, true) }}
|
|
225
|
+
/>
|
|
226
|
+
<Story
|
|
227
|
+
name="Image — header and footer"
|
|
228
|
+
args={{ paywallData: shellData(image, true, true) }}
|
|
229
|
+
/>
|
|
230
|
+
|
|
231
|
+
<style>
|
|
232
|
+
/* A fixed-position frame that emulates rc-workflows' <body> (see app.css).
|
|
233
|
+
Using position:fixed escapes Storybook's DOM chain (.sb-show-main, #storybook-root, PaywallWrapper) */
|
|
234
|
+
.viewport-frame {
|
|
235
|
+
position: fixed;
|
|
236
|
+
inset: 0;
|
|
237
|
+
display: flex;
|
|
238
|
+
flex-direction: column;
|
|
239
|
+
padding: env(safe-area-inset-top) env(safe-area-inset-right)
|
|
240
|
+
env(safe-area-inset-bottom) env(safe-area-inset-left);
|
|
241
|
+
background-color: var(--rc-purchases-ui-bg-color, Canvas);
|
|
242
|
+
color-scheme: light dark;
|
|
243
|
+
overflow: hidden;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.content-wrapper {
|
|
247
|
+
width: 100%;
|
|
248
|
+
display: flex;
|
|
249
|
+
flex: 1 1 auto;
|
|
250
|
+
flex-direction: column;
|
|
251
|
+
min-height: 0;
|
|
252
|
+
overflow: hidden;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/* Screen's containerId is "screen-container" by default */
|
|
256
|
+
:global(#screen-container) {
|
|
257
|
+
display: flex;
|
|
258
|
+
flex-direction: column;
|
|
259
|
+
flex: 1 1 auto;
|
|
260
|
+
min-height: 0;
|
|
261
|
+
overflow: hidden;
|
|
262
|
+
}
|
|
263
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Main from "./Main.svelte";
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Main: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Main = InstanceType<typeof Main>;
|
|
19
|
+
export default Main;
|