@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,38 +1,52 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { getTimelineInlineStyles } from "./timeline-utils";
|
|
3
3
|
import TimelineItem from "./TimelineItem.svelte";
|
|
4
|
-
import type { TimelineProps } from "../../
|
|
4
|
+
import type { TimelineProps } from "../../types/components/timeline";
|
|
5
|
+
import { css } from "../../utils/base-utils";
|
|
6
|
+
import { getActiveStateProps } from "../../utils/style-utils";
|
|
7
|
+
import { getSelectedStateContext } from "../../stores/selected";
|
|
5
8
|
|
|
6
|
-
const
|
|
9
|
+
const props: TimelineProps = $props();
|
|
10
|
+
const selectedState = getSelectedStateContext();
|
|
7
11
|
|
|
8
|
-
const
|
|
12
|
+
const {
|
|
13
|
+
items,
|
|
14
|
+
text_spacing,
|
|
15
|
+
item_spacing,
|
|
16
|
+
column_gutter,
|
|
17
|
+
icon_alignment,
|
|
18
|
+
size,
|
|
19
|
+
padding,
|
|
20
|
+
margin,
|
|
21
|
+
...restProps
|
|
22
|
+
} = $derived.by(() => {
|
|
23
|
+
return {
|
|
24
|
+
...props,
|
|
25
|
+
...getActiveStateProps($selectedState, props.overrides),
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const timelineStyles = $derived(
|
|
30
|
+
css(
|
|
31
|
+
getTimelineInlineStyles({
|
|
32
|
+
items,
|
|
33
|
+
text_spacing,
|
|
34
|
+
item_spacing,
|
|
35
|
+
column_gutter,
|
|
36
|
+
icon_alignment,
|
|
37
|
+
size,
|
|
38
|
+
padding,
|
|
39
|
+
margin,
|
|
40
|
+
...restProps,
|
|
41
|
+
}),
|
|
42
|
+
),
|
|
43
|
+
);
|
|
9
44
|
</script>
|
|
10
45
|
|
|
11
46
|
{#if items.length}
|
|
12
|
-
<div
|
|
13
|
-
{#each items as item
|
|
14
|
-
<TimelineItem
|
|
15
|
-
{...item}
|
|
16
|
-
id={`${restProps.id}-${index}`}
|
|
17
|
-
name={`${restProps.name}-${index}`}
|
|
18
|
-
type="timeline"
|
|
19
|
-
text_spacing={restProps.text_spacing}
|
|
20
|
-
item_spacing={restProps.item_spacing}
|
|
21
|
-
/>
|
|
47
|
+
<div style={timelineStyles}>
|
|
48
|
+
{#each items as item (item.id)}
|
|
49
|
+
<TimelineItem {...item} {text_spacing} {item_spacing} />
|
|
22
50
|
{/each}
|
|
23
51
|
</div>
|
|
24
52
|
{/if}
|
|
25
|
-
|
|
26
|
-
<style>
|
|
27
|
-
.rc-pw-timeline-container {
|
|
28
|
-
display: flex;
|
|
29
|
-
flex: var(--timeline-flex, 0 1 auto);
|
|
30
|
-
flex-direction: column;
|
|
31
|
-
gap: var(--timeline-item-spacing, 0);
|
|
32
|
-
width: var(--timeline-width, initial);
|
|
33
|
-
height: var(--timeline-height, initial);
|
|
34
|
-
position: var(--timeline-position, relative);
|
|
35
|
-
inset: var(--timeline-inset, 0);
|
|
36
|
-
transform: var(--timeline-transform, initial);
|
|
37
|
-
}
|
|
38
|
-
</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TimelineProps } from "../../
|
|
1
|
+
import type { TimelineProps } from "../../types/components/timeline";
|
|
2
2
|
declare const Timeline: import("svelte").Component<TimelineProps, {}, "">;
|
|
3
3
|
type Timeline = ReturnType<typeof Timeline>;
|
|
4
4
|
export default Timeline;
|
|
@@ -1,129 +1,97 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
getTimelineItemTextStyles,
|
|
5
|
-
} from "./timeline-utils";
|
|
6
|
-
import type { TimelineItemProps } from "../../data/entities";
|
|
2
|
+
import { getTimelineItemContentInlineStyles } from "./timeline-utils";
|
|
3
|
+
import type { TimelineItemProps } from "../../types/components/timeline";
|
|
7
4
|
import { getColorModeContext } from "../../stores/color-mode";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
5
|
+
import { getColor, getActiveStateProps } from "../../utils/style-utils";
|
|
6
|
+
import { getSelectedStateContext } from "../../stores/selected";
|
|
7
|
+
import Icon from "../icon/Icon.svelte";
|
|
8
|
+
import { css } from "../../utils/base-utils";
|
|
9
|
+
import TextNode from "../text/TextNode.svelte";
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
interface Props extends TimelineItemProps {
|
|
12
|
+
text_spacing: number;
|
|
13
|
+
item_spacing: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const props: Props = $props();
|
|
17
|
+
const selectedState = getSelectedStateContext();
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
icon,
|
|
21
|
+
title,
|
|
22
|
+
description,
|
|
23
|
+
connector,
|
|
24
|
+
text_spacing,
|
|
25
|
+
item_spacing,
|
|
26
|
+
...restProps
|
|
27
|
+
} = $derived.by(() => {
|
|
28
|
+
return {
|
|
29
|
+
...props,
|
|
30
|
+
...getActiveStateProps($selectedState, props.overrides as any),
|
|
31
|
+
};
|
|
32
|
+
});
|
|
13
33
|
|
|
14
34
|
const getColorMode = getColorModeContext();
|
|
15
35
|
const colorMode = $derived(getColorMode());
|
|
16
36
|
|
|
17
|
-
const
|
|
37
|
+
const iconContainerStyles = css({ position: "relative" });
|
|
38
|
+
const iconStyles = css({ position: "relative", "z-index": "2" });
|
|
39
|
+
const contentStyles = $derived(
|
|
40
|
+
css(
|
|
41
|
+
getTimelineItemContentInlineStyles(colorMode, {
|
|
42
|
+
text_spacing,
|
|
43
|
+
item_spacing,
|
|
44
|
+
}),
|
|
45
|
+
),
|
|
46
|
+
);
|
|
18
47
|
|
|
19
|
-
const
|
|
48
|
+
const connectorStyles = $derived.by(() => {
|
|
49
|
+
if (!connector) return "";
|
|
20
50
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
51
|
+
return css({
|
|
52
|
+
position: "absolute",
|
|
53
|
+
left: "50%",
|
|
54
|
+
top: `${(icon?.size.width.value ?? 24) / 2}px`,
|
|
55
|
+
transform: "translateX(-50%)",
|
|
56
|
+
"z-index": "1",
|
|
57
|
+
width: `${connector.width}px`,
|
|
58
|
+
height: `100%`, // Extend beyond icon
|
|
59
|
+
"padding-top": `${connector.margin.top}px`,
|
|
60
|
+
"padding-bottom": `${connector.margin.bottom}px`,
|
|
61
|
+
});
|
|
62
|
+
});
|
|
25
63
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
getLocalizedString(props.description?.text_lid),
|
|
29
|
-
$variables,
|
|
30
|
-
),
|
|
31
|
-
);
|
|
64
|
+
const connectorBarStyles = $derived.by(() => {
|
|
65
|
+
if (!connector) return "";
|
|
32
66
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
67
|
+
const background = getColor({
|
|
68
|
+
colorMap: connector.color,
|
|
69
|
+
colorMode,
|
|
70
|
+
fallback: "#000000",
|
|
71
|
+
});
|
|
36
72
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
73
|
+
return css({
|
|
74
|
+
width: "100%",
|
|
75
|
+
height: "100%",
|
|
76
|
+
background,
|
|
77
|
+
});
|
|
78
|
+
});
|
|
40
79
|
</script>
|
|
41
80
|
|
|
42
|
-
<div
|
|
43
|
-
|
|
44
|
-
<div
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
style={titleStyles}>{titleLabel}</svelte:element
|
|
51
|
-
>
|
|
52
|
-
{#if descriptionLabel}
|
|
53
|
-
<svelte:element
|
|
54
|
-
this={descriptionTagToRender}
|
|
55
|
-
class="rc-pw-timeline-item-content-description"
|
|
56
|
-
style={descriptionStyles}>{descriptionLabel}</svelte:element
|
|
57
|
-
>
|
|
58
|
-
{/if}
|
|
81
|
+
<div style={iconContainerStyles}>
|
|
82
|
+
{#if connector}
|
|
83
|
+
<div style={connectorStyles}>
|
|
84
|
+
<div style={connectorBarStyles}></div>
|
|
85
|
+
</div>
|
|
86
|
+
{/if}
|
|
87
|
+
<div style={iconStyles}>
|
|
88
|
+
<Icon {...icon} />
|
|
59
89
|
</div>
|
|
60
90
|
</div>
|
|
61
91
|
|
|
62
|
-
<style>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
.rc-pw-timeline-item-icon-container {
|
|
70
|
-
position: relative;
|
|
71
|
-
border-end-start-radius: var(--timeline-item-border-end-start-radius, 0px);
|
|
72
|
-
border-end-end-radius: var(--timeline-item-border-end-end-radius, 0px);
|
|
73
|
-
border-start-start-radius: var(
|
|
74
|
-
--timeline-item-border-start-start-radius,
|
|
75
|
-
0px
|
|
76
|
-
);
|
|
77
|
-
border-start-end-radius: var(--timeline-item-border-start-end-radius, 0px);
|
|
78
|
-
width: var(--timeline-item-icon-size, 16px);
|
|
79
|
-
height: var(--timeline-item-icon-size, 16px);
|
|
80
|
-
flex-shrink: 0;
|
|
81
|
-
background-color: var(--timeline-item-icon-background-color, #ffffff);
|
|
82
|
-
border: var(--timeline-item-icon-border, initial);
|
|
83
|
-
display: flex;
|
|
84
|
-
align-items: center;
|
|
85
|
-
justify-content: center;
|
|
86
|
-
padding: var(--timeline-item-icon-padding, 0px);
|
|
87
|
-
box-sizing: content-box;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.rc-pw-timeline-item-icon-container::before {
|
|
91
|
-
position: absolute;
|
|
92
|
-
content: "";
|
|
93
|
-
z-index: -1;
|
|
94
|
-
top: var(--timeline-item-connector-top, 0px);
|
|
95
|
-
height: var(--timeline-item-connector-height, 0px);
|
|
96
|
-
width: var(--timeline-item-connector-width, 0px);
|
|
97
|
-
background: var(--timeline-item-connector-color, transparent);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.rc-pw-timeline-item-icon {
|
|
101
|
-
width: var(--timeline-item-icon-size, 10px);
|
|
102
|
-
height: var(--timeline-item-icon-size, 10px);
|
|
103
|
-
color: var(--timeline-item-icon-color, #ffffff);
|
|
104
|
-
display: flex;
|
|
105
|
-
align-items: center;
|
|
106
|
-
justify-content: center;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.rc-pw-timeline-item-content {
|
|
110
|
-
display: flex;
|
|
111
|
-
flex-direction: column;
|
|
112
|
-
justify-content: flex-start;
|
|
113
|
-
align-items: flex-start;
|
|
114
|
-
gap: var(--timeline-item-text-spacing, 0px);
|
|
115
|
-
height: fit-content;
|
|
116
|
-
}
|
|
117
|
-
.rc-pw-timeline-item-content-title,
|
|
118
|
-
.rc-pw-timeline-item-content-description {
|
|
119
|
-
margin-block-start: var(--timeline-item-text-margin-block-start, 0px);
|
|
120
|
-
margin-inline-end: var(--timeline-item-text-margin-inline-end, 0px);
|
|
121
|
-
margin-block-end: var(--timeline-item-text-margin-block-end, 0px);
|
|
122
|
-
margin-inline-start: var(--timeline-item-text-margin-inline-start, 0px);
|
|
123
|
-
padding-block-start: var(--timeline-item-text-padding-block-start, 0);
|
|
124
|
-
padding-inline-end: var(--timeline-item-text-padding-inline-end, 0);
|
|
125
|
-
padding-block-end: var(--timeline-item-text-padding-block-end, 0);
|
|
126
|
-
padding-inline-start: var(--timeline-item-text-padding-inline-start, 0);
|
|
127
|
-
font-family: var(--timeline-item-text-font-family, sans-serif);
|
|
128
|
-
}
|
|
129
|
-
</style>
|
|
92
|
+
<div style={contentStyles}>
|
|
93
|
+
<TextNode {...title} />
|
|
94
|
+
{#if description}
|
|
95
|
+
<TextNode {...description} />
|
|
96
|
+
{/if}
|
|
97
|
+
</div>
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type { TimelineItemProps } from "../../
|
|
2
|
-
|
|
1
|
+
import type { TimelineItemProps } from "../../types/components/timeline";
|
|
2
|
+
interface Props extends TimelineItemProps {
|
|
3
|
+
text_spacing: number;
|
|
4
|
+
item_spacing: number;
|
|
5
|
+
}
|
|
6
|
+
declare const TimelineItem: import("svelte").Component<Props, {}, "">;
|
|
3
7
|
type TimelineItem = ReturnType<typeof TimelineItem>;
|
|
4
8
|
export default TimelineItem;
|
|
@@ -1,8 +1,26 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TimelineProps } from "../../types/components/timeline";
|
|
2
2
|
import type { ColorMode } from "../../types";
|
|
3
|
-
export declare function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export declare function getTimelineInlineStyles(props: TimelineProps): {
|
|
4
|
+
display: string;
|
|
5
|
+
"grid-template-columns": string;
|
|
6
|
+
"column-gap": string;
|
|
7
|
+
"align-items": string;
|
|
8
|
+
position: string;
|
|
9
|
+
flex: string;
|
|
10
|
+
width: string;
|
|
11
|
+
height: string;
|
|
12
|
+
padding: string;
|
|
13
|
+
margin: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function getTimelineItemContentInlineStyles(_colorMode: ColorMode, timelineSpacing: {
|
|
16
|
+
text_spacing: number;
|
|
17
|
+
item_spacing: number;
|
|
18
|
+
}): {
|
|
19
|
+
display: string;
|
|
20
|
+
"flex-direction": string;
|
|
21
|
+
"justify-content": string;
|
|
22
|
+
"align-items": string;
|
|
23
|
+
gap: string;
|
|
24
|
+
height: string;
|
|
25
|
+
"margin-bottom": string;
|
|
8
26
|
};
|
|
@@ -1,118 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Object.assign(styles, props.zStackChildStyles);
|
|
15
|
-
const prefixedStyles = prefixObject(styles, "timeline");
|
|
16
|
-
return stringifyStyles(prefixedStyles);
|
|
17
|
-
}
|
|
18
|
-
export function getTimelineItemStyles(colorMode, props) {
|
|
19
|
-
const styles = {
|
|
20
|
-
"--icon-size": `${props.icon.width_and_height}px`,
|
|
21
|
-
"--icon-padding": `${props.icon.padding}px`,
|
|
22
|
-
"--icon-color": getColor({
|
|
23
|
-
colorMap: props.icon.color,
|
|
24
|
-
colorMode,
|
|
25
|
-
}),
|
|
26
|
-
"--icon-background-color": getColor({
|
|
27
|
-
colorMap: props.icon_background?.color,
|
|
28
|
-
colorMode,
|
|
29
|
-
}),
|
|
30
|
-
"--icon-border": getBorderStyle(props.icon_background?.border, colorMode),
|
|
31
|
-
"--text-spacing": `${props.text_spacing}px`,
|
|
32
|
-
"--border-start-start-radius": `0px`,
|
|
33
|
-
"--border-start-end-radius": `0px`,
|
|
34
|
-
"--border-end-start-radius": `0px`,
|
|
35
|
-
"--border-end-end-radius": `0px`,
|
|
36
|
-
"--connector-color": getColor({
|
|
37
|
-
colorMap: props.connector?.color,
|
|
38
|
-
colorMode,
|
|
39
|
-
}),
|
|
40
|
-
"--connector-width": `${props.connector?.width || 0}px`,
|
|
41
|
-
"--connector-top": "0px",
|
|
42
|
-
"--connector-height": `${props.item_spacing}px`,
|
|
1
|
+
import { mapSize, mapSpacing } from "../../utils/base-utils";
|
|
2
|
+
export function getTimelineInlineStyles(props) {
|
|
3
|
+
return {
|
|
4
|
+
display: "grid",
|
|
5
|
+
"grid-template-columns": "auto 1fr",
|
|
6
|
+
"column-gap": `${props.column_gutter}px`,
|
|
7
|
+
"align-items": "stretch",
|
|
8
|
+
position: "relative",
|
|
9
|
+
flex: "0 1 auto",
|
|
10
|
+
width: mapSize(props.size.width),
|
|
11
|
+
height: mapSize(props.size.height),
|
|
12
|
+
padding: mapSpacing(props.padding),
|
|
13
|
+
margin: mapSpacing(props.margin),
|
|
43
14
|
};
|
|
44
|
-
Object.assign(styles, props.icon_background?.shape?.type === "rectangle"
|
|
45
|
-
? getCornerRadiusStyle(props.icon_background?.shape?.corners)
|
|
46
|
-
: {
|
|
47
|
-
"--border-start-start-radius": "50%",
|
|
48
|
-
"--border-start-end-radius": "50%",
|
|
49
|
-
"--border-end-start-radius": "50%",
|
|
50
|
-
"--border-end-end-radius": "50%",
|
|
51
|
-
});
|
|
52
|
-
if (props.connector) {
|
|
53
|
-
const hasMarginTop = props.connector.margin.top !== 0;
|
|
54
|
-
const hasMarginBottom = props.connector.margin.bottom !== 0;
|
|
55
|
-
const itemBackgroundSize = props.icon.padding + props.icon.width_and_height / 2;
|
|
56
|
-
if (!hasMarginTop && !hasMarginBottom) {
|
|
57
|
-
styles["--connector-height"] =
|
|
58
|
-
`${props.item_spacing + itemBackgroundSize * 2}px`;
|
|
59
|
-
styles["--connector-top"] = `50%`;
|
|
60
|
-
}
|
|
61
|
-
if (hasMarginTop && hasMarginBottom) {
|
|
62
|
-
styles["--connector-height"] =
|
|
63
|
-
`${props.item_spacing - props.connector.margin.top - props.connector.margin.bottom}px`;
|
|
64
|
-
styles["--connector-top"] =
|
|
65
|
-
`calc(100% + ${props.connector.margin.top}px)`;
|
|
66
|
-
}
|
|
67
|
-
if (!hasMarginTop && hasMarginBottom) {
|
|
68
|
-
styles["--connector-height"] =
|
|
69
|
-
`${props.item_spacing - props.connector.margin.bottom + itemBackgroundSize}px`;
|
|
70
|
-
styles["--connector-top"] = `50%`;
|
|
71
|
-
}
|
|
72
|
-
if (hasMarginTop && !hasMarginBottom) {
|
|
73
|
-
styles["--connector-height"] =
|
|
74
|
-
`${props.item_spacing + itemBackgroundSize}px`;
|
|
75
|
-
styles["--connector-top"] =
|
|
76
|
-
`calc(100% + ${props.connector.margin.top}px)`;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const prefixedStyles = prefixObject(styles, "timeline-item");
|
|
80
|
-
return stringifyStyles(prefixedStyles);
|
|
81
15
|
}
|
|
82
|
-
export function
|
|
83
|
-
const styles = {
|
|
84
|
-
"--text-color": "inherit",
|
|
85
|
-
"--text-font-size": "initial",
|
|
86
|
-
"--text-font-weight": "initial",
|
|
87
|
-
"--text-horizontal-alignment": "initial",
|
|
88
|
-
"--text-margin-block-start": "0px",
|
|
89
|
-
"--text-margin-inline-end": "0px",
|
|
90
|
-
"--text-margin-block-end": "0px",
|
|
91
|
-
"--text-margin-inline-start": "0px",
|
|
92
|
-
"--text-padding-block-start": "0px",
|
|
93
|
-
"--text-padding-inline-end": "0px",
|
|
94
|
-
"--text-padding-block-end": "0px",
|
|
95
|
-
"--text-padding-inline-start": "0px",
|
|
96
|
-
};
|
|
97
|
-
const textProps = {
|
|
98
|
-
color: props[kind]?.color || defaultColor,
|
|
99
|
-
font_size: props[kind]?.font_size || "body_m",
|
|
100
|
-
font_weight: props[kind]?.font_weight || "regular",
|
|
101
|
-
horizontal_alignment: props[kind]?.horizontal_alignment || "leading",
|
|
102
|
-
};
|
|
103
|
-
const { tagToRender, textStyles } = getTextComponentStyles(colorMode, {
|
|
104
|
-
...props,
|
|
105
|
-
...textProps,
|
|
106
|
-
size: { width: { type: "fit" }, height: { type: "fit" } },
|
|
107
|
-
type: "text",
|
|
108
|
-
margin: { top: 0, bottom: 0, leading: 0, trailing: 0 },
|
|
109
|
-
padding: { top: 0, bottom: 0, leading: 0, trailing: 0 },
|
|
110
|
-
text_lid: "",
|
|
111
|
-
});
|
|
112
|
-
Object.assign(styles, textStyles);
|
|
113
|
-
const stringifiedStyles = stringifyStyles(prefixObject(styles, "timeline-item"));
|
|
16
|
+
export function getTimelineItemContentInlineStyles(_colorMode, timelineSpacing) {
|
|
114
17
|
return {
|
|
115
|
-
|
|
116
|
-
|
|
18
|
+
display: "flex",
|
|
19
|
+
"flex-direction": "column",
|
|
20
|
+
"justify-content": "flex-start",
|
|
21
|
+
"align-items": "flex-start",
|
|
22
|
+
gap: `${timelineSpacing.text_spacing}px`,
|
|
23
|
+
height: "fit-content",
|
|
24
|
+
"margin-bottom": `${timelineSpacing.item_spacing}px`,
|
|
117
25
|
};
|
|
118
26
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,9 @@ export { default as PurchaseButton } from "./components/purchase-button/Purchase
|
|
|
7
7
|
export { default as Stack } from "./components/stack/Stack.svelte";
|
|
8
8
|
export { default as Text } from "./components/text/Text.svelte";
|
|
9
9
|
export { default as Timeline } from "./components/timeline/Timeline.svelte";
|
|
10
|
-
export { type PaywallData as PaywallData } from "./data/entities";
|
|
11
10
|
export * from "./types";
|
|
11
|
+
export { type PaywallData } from "./types/paywall";
|
|
12
|
+
export { type UIConfig } from "./types/ui-config";
|
|
13
|
+
export { type VariableDictionary } from "./types/variables";
|
|
12
14
|
export * from "./ui/globals";
|
|
13
15
|
export { default as Button } from "./ui/molecules/button.svelte";
|
|
14
|
-
export { type VariableDictionary } from "./utils/variable-utils";
|
package/dist/index.js
CHANGED
|
@@ -8,8 +8,9 @@ export { default as PurchaseButton } from "./components/purchase-button/Purchase
|
|
|
8
8
|
export { default as Stack } from "./components/stack/Stack.svelte";
|
|
9
9
|
export { default as Text } from "./components/text/Text.svelte";
|
|
10
10
|
export { default as Timeline } from "./components/timeline/Timeline.svelte";
|
|
11
|
-
export {} from "./data/entities";
|
|
12
11
|
export * from "./types";
|
|
12
|
+
export {} from "./types/paywall";
|
|
13
|
+
export {} from "./types/ui-config";
|
|
14
|
+
export {} from "./types/variables";
|
|
13
15
|
export * from "./ui/globals";
|
|
14
16
|
export { default as Button } from "./ui/molecules/button.svelte";
|
|
15
|
-
export {} from "./utils/variable-utils";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ColorMode } from "../types";
|
|
2
|
-
|
|
2
|
+
type ColorModeOverride = () => ColorMode | undefined;
|
|
3
3
|
type GetColorMode = () => ColorMode;
|
|
4
4
|
export declare function setColorModeContext(colorModeOverride?: ColorModeOverride): GetColorMode;
|
|
5
5
|
export declare function getColorModeContext(): GetColorMode;
|
package/dist/stores/paywall.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { Action } from "../types/components/button";
|
|
2
|
-
import type {
|
|
2
|
+
import type { UIConfig } from "../types/ui-config";
|
|
3
|
+
import type { VariableDictionary } from "../types/variables";
|
|
3
4
|
import { type Readable, type Writable } from "svelte/store";
|
|
4
|
-
|
|
5
|
+
type PaywallContext = Readonly<{
|
|
5
6
|
selectedPackageId: Writable<string | undefined>;
|
|
6
7
|
variablesPerPackage: Readable<Record<string, VariableDictionary> | undefined>;
|
|
7
8
|
onPurchase: () => void;
|
|
8
9
|
onButtonAction: (action: Action) => void;
|
|
10
|
+
uiConfig: UIConfig;
|
|
9
11
|
}>;
|
|
10
12
|
export declare function setPaywallContext(context: PaywallContext): void;
|
|
11
13
|
export declare function getPaywallContext(): PaywallContext;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getContext, setContext } from "svelte";
|
|
2
|
+
import { derived, readable } from "svelte/store";
|
|
3
|
+
import { getPaywallContext } from "./paywall";
|
|
4
|
+
const key = Symbol("selected");
|
|
5
|
+
export function setSelectedStateContext(packageId) {
|
|
6
|
+
const { selectedPackageId } = getPaywallContext();
|
|
7
|
+
setContext(key, derived(selectedPackageId, (value) => value === packageId));
|
|
8
|
+
}
|
|
9
|
+
export function getSelectedStateContext() {
|
|
10
|
+
const context = getContext(key);
|
|
11
|
+
return context ?? readable(false);
|
|
12
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { VariableDictionary } from "../types/variables";
|
|
2
2
|
import { type Readable } from "svelte/store";
|
|
3
3
|
export type VariablesStore = Readable<VariableDictionary | undefined>;
|
|
4
4
|
export declare function setVariablesContext(variables: VariablesStore): void;
|
package/dist/stores/variables.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { PaywallData } from "../
|
|
1
|
+
import type { PaywallData } from "../types/paywall";
|
|
2
|
+
import type { UIConfig } from "../types/ui-config";
|
|
2
3
|
import type { BrandingAppearance } from "../ui/utils/branding";
|
|
4
|
+
export declare const uiConfigData: UIConfig;
|
|
3
5
|
export declare const paywallData: PaywallData;
|
|
4
6
|
export declare const alignmentPaywallData: PaywallData;
|
|
5
7
|
export declare const fontsPaywallData: PaywallData;
|
|
8
|
+
export declare const customFontsPaywallData: PaywallData;
|
|
6
9
|
export declare const pastaPaywallData: PaywallData;
|
|
7
|
-
export declare const variablesPastaPaywallData: PaywallData;
|
|
8
10
|
export declare const gradientPaywallData: PaywallData;
|
|
9
11
|
export declare const calmPaywallData: PaywallData;
|
|
10
12
|
export declare const stateTemplate: PaywallData;
|
|
@@ -22,5 +24,6 @@ export declare const colorModeOverrideTemplate: PaywallData;
|
|
|
22
24
|
export declare const paywallWithFooter: PaywallData;
|
|
23
25
|
export declare const errorPaywallData: PaywallData;
|
|
24
26
|
export declare const fallbackPaywallData: PaywallData;
|
|
25
|
-
export declare const e2eTestTemplate: PaywallData;
|
|
26
27
|
export declare const brandingAppearances: Record<string, BrandingAppearance | null>;
|
|
28
|
+
export declare const timelineTemplate: PaywallData;
|
|
29
|
+
export declare const listTemplate: PaywallData;
|