@revenuecat/purchases-ui-js 2.0.2 → 2.0.4
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/ButtonNode.stories.svelte +66 -102
- package/dist/components/button/ButtonNode.svelte +18 -26
- package/dist/components/carousel/Carousel.stories.svelte +1039 -0
- package/dist/components/carousel/Carousel.stories.svelte.d.ts +19 -0
- package/dist/components/carousel/Carousel.svelte +298 -0
- package/dist/components/carousel/Carousel.svelte.d.ts +4 -0
- package/dist/components/carousel/CarouselPage.svelte +39 -0
- package/dist/components/carousel/CarouselPage.svelte.d.ts +11 -0
- package/dist/components/carousel/PageControl.svelte +93 -0
- package/dist/components/carousel/PageControl.svelte.d.ts +4 -0
- package/dist/components/carousel/carousel-utils.d.ts +4 -0
- package/dist/components/carousel/carousel-utils.js +21 -0
- package/dist/components/footer/Footer.stories.svelte +112 -102
- package/dist/components/footer/Footer.svelte +8 -4
- package/dist/components/icon/Icon.stories.svelte +100 -0
- package/dist/components/icon/Icon.stories.svelte.d.ts +19 -0
- package/dist/components/icon/Icon.svelte +73 -0
- package/dist/components/icon/Icon.svelte.d.ts +4 -0
- package/dist/components/image/ClipPath.svelte +49 -0
- package/dist/components/image/ClipPath.svelte.d.ts +9 -0
- package/dist/components/image/Image.stories.svelte +83 -188
- package/dist/components/image/Image.svelte +152 -136
- package/dist/components/image/Image.svelte.d.ts +1 -1
- package/dist/components/image/Overlay.svelte +36 -0
- package/dist/components/image/Overlay.svelte.d.ts +8 -0
- package/dist/components/package/Package.stories.svelte +10 -21
- package/dist/components/package/Package.svelte +8 -35
- package/dist/components/paywall/Node.svelte +25 -32
- package/dist/components/paywall/Node.svelte.d.ts +4 -6
- package/dist/components/paywall/Paywall.stories.svelte +36 -140
- package/dist/components/paywall/Paywall.svelte +23 -7
- package/dist/components/paywall/Paywall.svelte.d.ts +4 -2
- package/dist/components/paywall/fixtures/override-paywall.d.ts +2 -0
- package/dist/components/paywall/fixtures/override-paywall.js +1310 -0
- package/dist/components/paywall/fixtures/stack-paywall.d.ts +2 -0
- package/dist/components/paywall/fixtures/stack-paywall.js +5223 -0
- package/dist/components/paywall/fixtures/variables.d.ts +261 -0
- package/dist/components/paywall/fixtures/variables.js +262 -0
- package/dist/components/paywall/paywall-utils.d.ts +1 -1
- package/dist/components/purchase-button/PurchaseButton.stories.svelte +10 -21
- package/dist/components/purchase-button/PurchaseButton.svelte +2 -27
- package/dist/components/stack/Stack.stories.svelte +2354 -978
- package/dist/components/stack/Stack.svelte +116 -134
- package/dist/components/stack/Stack.svelte.d.ts +8 -2
- package/dist/components/stack/stack-utils.d.ts +10 -30
- package/dist/components/stack/stack-utils.js +77 -255
- package/dist/components/text/Text.svelte +3 -37
- package/dist/components/text/Text.svelte.d.ts +1 -2
- package/dist/components/text/TextNode.stories.svelte +10 -36
- package/dist/components/text/TextNode.svelte +25 -28
- package/dist/components/text/TextNode.svelte.d.ts +1 -1
- package/dist/components/text/text-utils.d.ts +4 -9
- package/dist/components/text/text-utils.js +32 -117
- package/dist/components/timeline/Timeline.stories.svelte +640 -251
- package/dist/components/timeline/Timeline.svelte +42 -28
- package/dist/components/timeline/Timeline.svelte.d.ts +1 -1
- package/dist/components/timeline/TimelineItem.svelte +80 -112
- package/dist/components/timeline/TimelineItem.svelte.d.ts +6 -2
- package/dist/components/timeline/timeline-utils.d.ts +24 -6
- package/dist/components/timeline/timeline-utils.js +21 -113
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/stores/color-mode.d.ts +1 -1
- package/dist/stores/paywall.d.ts +5 -2
- package/dist/stores/selected.d.ts +5 -0
- package/dist/stores/selected.js +12 -0
- package/dist/stores/variables.d.ts +1 -1
- package/dist/stores/variables.js +0 -1
- package/dist/stories/component-decorator.d.ts +2 -0
- package/dist/stories/component-decorator.js +12 -0
- package/dist/stories/fixtures.d.ts +6 -3
- package/dist/stories/fixtures.js +5214 -4422
- package/dist/stories/paywall-decorator.js +6 -0
- package/dist/stories/variables-decorator.d.ts +1 -1
- package/dist/stories/viewport-decorator.d.ts +2 -0
- package/dist/stories/viewport-decorator.js +8 -0
- package/dist/stories/viewport-wrapper.svelte +55 -0
- package/dist/stories/viewport-wrapper.svelte.d.ts +10 -0
- package/dist/stories/with-layout.d.ts +2 -10
- package/dist/stories/with-layout.js +3 -5
- package/dist/types/alignment.d.ts +5 -3
- package/dist/types/background.d.ts +6 -5
- package/dist/types/base.d.ts +7 -0
- package/dist/types/colors.d.ts +4 -4
- package/dist/types/component.d.ts +7 -2
- package/dist/types/components/button.d.ts +6 -1
- package/dist/types/components/carousel.d.ts +51 -0
- package/dist/types/components/carousel.js +1 -0
- package/dist/types/components/footer.d.ts +2 -1
- package/dist/types/components/icon.d.ts +28 -0
- package/dist/types/components/icon.js +1 -0
- package/dist/types/components/image.d.ts +20 -0
- package/dist/types/components/image.js +1 -0
- package/dist/types/components/package.d.ts +2 -1
- package/dist/types/components/purchase-button.d.ts +2 -1
- package/dist/types/components/stack.d.ts +32 -0
- package/dist/types/components/stack.js +1 -0
- package/dist/types/components/text.d.ts +20 -0
- package/dist/types/components/text.js +1 -0
- package/dist/types/components/timeline.d.ts +35 -0
- package/dist/types/components/timeline.js +1 -0
- package/dist/types/localization.d.ts +2 -1
- package/dist/types/media.d.ts +4 -3
- package/dist/types/overrides.d.ts +48 -0
- package/dist/types/overrides.js +1 -0
- package/dist/types/paywall.d.ts +27 -0
- package/dist/types/paywall.js +1 -0
- package/dist/types/ui-config.d.ts +20 -0
- package/dist/types/ui-config.js +1 -0
- package/dist/types/variables.d.ts +13 -0
- package/dist/types/variables.js +10 -0
- package/dist/types.d.ts +17 -9
- package/dist/ui/atoms/typography.stories.svelte +1 -27
- package/dist/ui/molecules/button.stories.svelte +3 -8
- package/dist/ui/theme/colors.d.ts +0 -6
- package/dist/ui/theme/colors.js +1 -1
- package/dist/ui/theme/text.d.ts +3 -4
- package/dist/ui/theme/utils.d.ts +0 -10
- package/dist/ui/theme/utils.js +5 -5
- package/dist/utils/background-utils.d.ts +4 -0
- package/dist/utils/background-utils.js +39 -0
- package/dist/utils/base-utils.d.ts +18 -0
- package/dist/utils/base-utils.js +124 -0
- package/dist/utils/constants.d.ts +2 -2
- package/dist/utils/constants.js +6 -1
- package/dist/utils/font-utils.d.ts +4 -0
- package/dist/utils/font-utils.js +47 -0
- package/dist/utils/style-utils.d.ts +7 -120
- package/dist/utils/style-utils.js +29 -304
- package/dist/utils/variable-utils.d.ts +1 -22
- package/dist/utils/variable-utils.js +28 -24
- package/dist/web-components/index.css +1 -1
- package/dist/web-components/index.js +1435 -980
- package/package.json +36 -26
- package/dist/components/button/button-utils.d.ts +0 -2
- package/dist/components/button/button-utils.js +0 -19
- package/dist/components/image/image-utils.d.ts +0 -19
- package/dist/components/image/image-utils.js +0 -33
- package/dist/components/purchase-button/purchase-button-utils.d.ts +0 -2
- package/dist/components/purchase-button/purchase-button-utils.js +0 -20
- package/dist/data/entities.d.ts +0 -162
- package/dist/stories/meta-templates.d.ts +0 -12
- package/dist/stories/meta-templates.js +0 -155
- /package/dist/{data/entities.js → types/base.js} +0 -0
|
@@ -1,157 +1,139 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Node from "../paywall/Node.svelte";
|
|
3
|
-
import {
|
|
4
|
-
getBadgeStyles,
|
|
5
|
-
getStackBadgeTextStyles,
|
|
6
|
-
getStackComponentStyles,
|
|
7
|
-
getZStackChildStyles,
|
|
8
|
-
} from "./stack-utils";
|
|
9
|
-
import Text from "../text/Text.svelte";
|
|
10
|
-
import type { StackProps } from "../../data/entities";
|
|
11
3
|
import { getColorModeContext } from "../../stores/color-mode";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
4
|
+
import { getSelectedStateContext } from "../../stores/selected";
|
|
5
|
+
import type { StackProps } from "../../types/components/stack";
|
|
6
|
+
import { mapBackground } from "../../utils/background-utils";
|
|
7
|
+
import {
|
|
8
|
+
css,
|
|
9
|
+
mapBorder,
|
|
10
|
+
mapBorderRadius,
|
|
11
|
+
mapShadow,
|
|
12
|
+
mapSize,
|
|
13
|
+
mapSpacing,
|
|
14
|
+
px,
|
|
15
|
+
} from "../../utils/base-utils";
|
|
16
|
+
import { getActiveStateProps } from "../../utils/style-utils";
|
|
17
|
+
import type { Snippet } from "svelte";
|
|
18
|
+
import { mapBadge, mapDimension, mapLayerAlignment } from "./stack-utils";
|
|
19
|
+
|
|
20
|
+
interface MiscProps {
|
|
21
|
+
onclick?: () => void;
|
|
22
|
+
children?: Snippet;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const props: StackProps & MiscProps = $props();
|
|
26
|
+
const { onclick, children } = props;
|
|
15
27
|
|
|
16
|
-
const
|
|
17
|
-
|
|
28
|
+
const selectedState = getSelectedStateContext();
|
|
29
|
+
const {
|
|
30
|
+
components,
|
|
31
|
+
size,
|
|
32
|
+
dimension,
|
|
33
|
+
spacing,
|
|
34
|
+
margin,
|
|
35
|
+
padding,
|
|
36
|
+
background_color,
|
|
37
|
+
background,
|
|
38
|
+
border,
|
|
39
|
+
shape,
|
|
40
|
+
shadow,
|
|
41
|
+
badge,
|
|
42
|
+
} = $derived.by(() => {
|
|
43
|
+
return {
|
|
44
|
+
...props,
|
|
45
|
+
...getActiveStateProps($selectedState, props.overrides),
|
|
46
|
+
};
|
|
47
|
+
});
|
|
18
48
|
|
|
19
49
|
const getColorMode = getColorModeContext();
|
|
20
50
|
const colorMode = $derived(getColorMode());
|
|
21
51
|
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
52
|
+
const style = $derived(
|
|
53
|
+
css({
|
|
54
|
+
display: "flex",
|
|
55
|
+
position: "relative",
|
|
56
|
+
width: mapSize(size.width),
|
|
57
|
+
height: mapSize(size.height),
|
|
58
|
+
...mapDimension(dimension),
|
|
59
|
+
gap: px(spacing),
|
|
60
|
+
margin: mapSpacing(margin),
|
|
61
|
+
padding: mapSpacing(padding),
|
|
62
|
+
...mapBackground(colorMode, background_color, background),
|
|
63
|
+
border: mapBorder(colorMode, border),
|
|
64
|
+
"border-radius": mapBorderRadius(shape),
|
|
65
|
+
"box-shadow": mapShadow(colorMode, shadow),
|
|
36
66
|
}),
|
|
37
67
|
);
|
|
38
68
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
...restProps,
|
|
44
|
-
}),
|
|
45
|
-
);
|
|
69
|
+
const getLayerStyle = (index: number): string => {
|
|
70
|
+
if (index === 0 || dimension.type !== "zlayer") {
|
|
71
|
+
return "";
|
|
72
|
+
}
|
|
46
73
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
74
|
+
const { justifyContent, alignItems } = mapLayerAlignment(
|
|
75
|
+
dimension.alignment,
|
|
76
|
+
);
|
|
77
|
+
return css({
|
|
78
|
+
position: "absolute",
|
|
79
|
+
inset: 0,
|
|
80
|
+
display: "flex",
|
|
81
|
+
"justify-content": justifyContent,
|
|
82
|
+
"align-items": alignItems,
|
|
83
|
+
"z-index": index + 1,
|
|
84
|
+
});
|
|
85
|
+
};
|
|
52
86
|
|
|
53
|
-
const
|
|
54
|
-
getStackBadgeTextStyles(colorMode, {
|
|
55
|
-
id,
|
|
56
|
-
components,
|
|
57
|
-
badge,
|
|
58
|
-
...restProps,
|
|
59
|
-
}),
|
|
60
|
-
);
|
|
87
|
+
const badgeStyle = $derived(css(mapBadge(badge, border?.width)));
|
|
61
88
|
</script>
|
|
62
89
|
|
|
63
|
-
<
|
|
90
|
+
<svelte:element
|
|
91
|
+
this={onclick !== undefined ? "button" : "div"}
|
|
92
|
+
role={onclick !== undefined ? "button" : undefined}
|
|
93
|
+
{onclick}
|
|
94
|
+
{style}
|
|
95
|
+
class="stack"
|
|
96
|
+
>
|
|
64
97
|
{#if badge}
|
|
65
|
-
<
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
</Text>
|
|
69
|
-
</span>
|
|
98
|
+
<div style={badgeStyle}>
|
|
99
|
+
<Node nodeData={badge.stack} />
|
|
100
|
+
</div>
|
|
70
101
|
{/if}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
102
|
+
|
|
103
|
+
{#if dimension.type === "zlayer"}
|
|
104
|
+
<div style="position: relative; width: 100%; height: 100%;">
|
|
105
|
+
{#each components as component, index}
|
|
106
|
+
<div style={getLayerStyle(index)}>
|
|
107
|
+
<Node nodeData={component} />
|
|
108
|
+
</div>
|
|
109
|
+
{/each}
|
|
110
|
+
</div>
|
|
111
|
+
{:else}
|
|
112
|
+
{#each components as component}
|
|
113
|
+
<Node nodeData={component} />
|
|
82
114
|
{/each}
|
|
83
|
-
|
|
84
|
-
|
|
115
|
+
{/if}
|
|
116
|
+
|
|
117
|
+
{@render children?.()}
|
|
118
|
+
</svelte:element>
|
|
85
119
|
|
|
86
120
|
<style>
|
|
87
|
-
.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
width: var(--stack-width, unset);
|
|
91
|
-
height: var(--stack-height, unset);
|
|
92
|
-
box-shadow: var(--stack-shadow, none);
|
|
93
|
-
background: var(--stack-background, unset);
|
|
94
|
-
position: var(--stack-position, relative);
|
|
95
|
-
transform: var(--stack-transform, initial);
|
|
96
|
-
inset: var(--stack-inset, initial);
|
|
97
|
-
margin-block-start: var(--stack-margin-block-start, 0);
|
|
98
|
-
margin-inline-end: var(--stack-margin-inline-end, 0);
|
|
99
|
-
margin-block-end: var(--stack-margin-block-end, 0);
|
|
100
|
-
margin-inline-start: var(--stack-margin-inline-start, 0);
|
|
101
|
-
border: var(--stack-border, none);
|
|
102
|
-
border-end-start-radius: var(--stack-border-end-start-radius, 0px);
|
|
103
|
-
border-end-end-radius: var(--stack-border-end-end-radius, 0px);
|
|
104
|
-
border-start-start-radius: var(--stack-border-start-start-radius, 0px);
|
|
105
|
-
border-start-end-radius: var(--stack-border-start-end-radius, 0px);
|
|
106
|
-
}
|
|
121
|
+
.stack {
|
|
122
|
+
appearance: none;
|
|
123
|
+
position: relative;
|
|
107
124
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
padding-inline-end: var(--stack-padding-inline-end, 0);
|
|
122
|
-
padding-block-end: var(--stack-padding-block-end, 0);
|
|
123
|
-
padding-inline-start: var(--stack-padding-inline-start, 0);
|
|
124
|
-
}
|
|
125
|
-
.rc-pw-badge {
|
|
126
|
-
box-sizing: border-box;
|
|
127
|
-
font-family: var(--stack-badge-font-family, sans-serif);
|
|
128
|
-
position: absolute;
|
|
129
|
-
inset: var(--stack-badge-inset, unset);
|
|
130
|
-
transform: var(--stack-badge-transform, initial);
|
|
131
|
-
margin-block-start: var(--stack-badge-margin-block-start, 0px);
|
|
132
|
-
margin-inline-end: var(--stack-badge-margin-inline-end, 0px);
|
|
133
|
-
margin-block-end: var(--stack-badge-margin-block-end, 0px);
|
|
134
|
-
margin-inline-start: var(--stack-badge-margin-inline-start, 0px);
|
|
135
|
-
padding-block-start: var(--stack-badge-padding-block-start, 0px);
|
|
136
|
-
padding-inline-end: var(--stack-badge-padding-inline-end, 0px);
|
|
137
|
-
padding-block-end: var(--stack-badge-padding-block-end, 0px);
|
|
138
|
-
padding-inline-start: var(--stack-badge-padding-inline-start, 0px);
|
|
139
|
-
background: var(--stack-badge-background, initial);
|
|
140
|
-
color: var(--stack-badge-text-color, inherit);
|
|
141
|
-
border: var(--stack-badge-border, none);
|
|
142
|
-
border-end-start-radius: var(--stack-badge-border-end-start-radius, 0px);
|
|
143
|
-
border-end-end-radius: var(--stack-badge-border-end-end-radius, 0px);
|
|
144
|
-
border-start-start-radius: var(
|
|
145
|
-
--stack-badge-border-start-start-radius,
|
|
146
|
-
0px
|
|
147
|
-
);
|
|
148
|
-
border-start-end-radius: var(--stack-badge-border-start-end-radius, 0px);
|
|
149
|
-
box-shadow: var(--stack-badge-shadow, none);
|
|
150
|
-
display: flex;
|
|
151
|
-
align-items: center;
|
|
152
|
-
justify-content: center;
|
|
153
|
-
width: var(--stack-badge-badge-width, max-content);
|
|
154
|
-
height: var(--stack-badge-badge-height, max-content);
|
|
155
|
-
z-index: var(--stack-badge-z-index, 1);
|
|
125
|
+
&[role="button"] {
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&::before {
|
|
130
|
+
content: "";
|
|
131
|
+
position: absolute;
|
|
132
|
+
top: 0;
|
|
133
|
+
left: 0;
|
|
134
|
+
width: 100%;
|
|
135
|
+
height: 100%;
|
|
136
|
+
background: var(--overlay);
|
|
137
|
+
}
|
|
156
138
|
}
|
|
157
139
|
</style>
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import type { StackProps } from "../../
|
|
2
|
-
|
|
1
|
+
import type { StackProps } from "../../types/components/stack";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
interface MiscProps {
|
|
4
|
+
onclick?: () => void;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
}
|
|
7
|
+
type $$ComponentProps = StackProps & MiscProps;
|
|
8
|
+
declare const Stack: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
3
9
|
type Stack = ReturnType<typeof Stack>;
|
|
4
10
|
export default Stack;
|
|
@@ -1,31 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare const getStackComponentStyles: (colorMode: ColorMode, props: StackProps) => string;
|
|
9
|
-
/**
|
|
10
|
-
* Generates styles for badge component within a stack
|
|
11
|
-
* @param props - Stack component properties containing badge configuration
|
|
12
|
-
* @returns CSS style object with badge-specific styles including positioning, dimensions and appearance
|
|
13
|
-
*/
|
|
14
|
-
export declare function getBadgeStyles(colorMode: ColorMode, props: StackProps): string;
|
|
15
|
-
/**
|
|
16
|
-
* Generates text styles and HTML tag for a stack's badge component
|
|
17
|
-
* @param props - Stack component properties containing badge configuration
|
|
18
|
-
* @returns Object containing:
|
|
19
|
-
* - tagToRender: HTML tag to use for the badge text
|
|
20
|
-
* - textStyles: CSS styles string for the badge text
|
|
21
|
-
*/
|
|
22
|
-
export declare function getStackBadgeTextStyles(colorMode: ColorMode, props: StackProps): {
|
|
23
|
-
tagToRender: string;
|
|
24
|
-
textStyles: string;
|
|
25
|
-
};
|
|
26
|
-
export declare function getZStackChildStyles(props: StackProps): ZStackChildStyles | undefined;
|
|
27
|
-
export type ZStackChildStyles = {
|
|
28
|
-
"--inset": string;
|
|
29
|
-
"--transform": string;
|
|
30
|
-
"--position": string;
|
|
1
|
+
import type { Dimension, ZAlignment } from "../../types/alignment";
|
|
2
|
+
import type { Badge } from "../../types/components/stack";
|
|
3
|
+
import { type CSS } from "../../utils/base-utils";
|
|
4
|
+
export declare function mapDimension(dimension: Dimension): Record<string, string>;
|
|
5
|
+
type JustifyAlign = {
|
|
6
|
+
justifyContent: string;
|
|
7
|
+
alignItems: string;
|
|
31
8
|
};
|
|
9
|
+
export declare function mapLayerAlignment(alignment: ZAlignment): JustifyAlign;
|
|
10
|
+
export declare function mapBadge(badge?: Badge | null, parentBorderWidth?: number): CSS;
|
|
11
|
+
export {};
|