@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,132 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { mapBackground } from "../../utils/background-utils";
|
|
2
|
+
import { css, mapColor, mapSize, mapSpacing } from "../../utils/base-utils";
|
|
3
|
+
import { DEFAULT_TEXT_COLOR } from "../../utils/constants";
|
|
4
|
+
import { getTextStyles } from "../../utils/style-utils";
|
|
3
5
|
export const defaultColor = {
|
|
4
6
|
light: { type: "hex", value: DEFAULT_TEXT_COLOR },
|
|
5
7
|
};
|
|
6
|
-
export const defaultBackgroundColor = {
|
|
7
|
-
light: { type: "hex", value: DEFAULT_BACKGROUND_COLOR },
|
|
8
|
-
};
|
|
9
8
|
/**
|
|
10
9
|
* Generates comprehensive styles for text components by combining text, component and size styles
|
|
11
10
|
* @param props - Text component properties including font, color, background, spacing etc.
|
|
12
|
-
* @returns Object containing text
|
|
11
|
+
* @returns Object containing text inline styles and the appropriate HTML tag to render
|
|
13
12
|
*/
|
|
14
13
|
export const getTextComponentStyles = (colorMode, props) => {
|
|
15
|
-
const {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"--padding-inline-start": "0px",
|
|
33
|
-
"--background": "transparent",
|
|
34
|
-
"--text-color": "inherit",
|
|
35
|
-
"--border": "none",
|
|
36
|
-
"--border-end-start-radius": "0px",
|
|
37
|
-
"--border-end-end-radius": "0px",
|
|
38
|
-
"--border-start-start-radius": "0px",
|
|
39
|
-
"--border-start-end-radius": "0px",
|
|
40
|
-
"--shadow": "none",
|
|
41
|
-
"--flex": "0 1 auto",
|
|
42
|
-
};
|
|
43
|
-
const activeStateProps = getActiveStateProps(props.overrides, props.componentState);
|
|
44
|
-
const tagToRender = getTextComponentTag(font_size);
|
|
45
|
-
const textStyles = getTextStyles({ ...props, ...activeStateProps });
|
|
46
|
-
const componentStyles = getComponentStyles({
|
|
47
|
-
background_color,
|
|
48
|
-
color,
|
|
49
|
-
margin,
|
|
50
|
-
padding,
|
|
51
|
-
colorMode,
|
|
52
|
-
...activeStateProps,
|
|
14
|
+
const { color = defaultColor, background_color, padding, margin, size, } = props;
|
|
15
|
+
const textStyles = getTextStyles(props);
|
|
16
|
+
const style = css({
|
|
17
|
+
display: "block",
|
|
18
|
+
width: mapSize(size.width),
|
|
19
|
+
height: mapSize(size.height),
|
|
20
|
+
margin: mapSpacing(margin),
|
|
21
|
+
padding: mapSpacing(padding),
|
|
22
|
+
...mapBackground(colorMode, background_color, null),
|
|
23
|
+
color: mapColor(colorMode, color),
|
|
24
|
+
"text-align": textStyles["--text-align"] || "initial",
|
|
25
|
+
"font-weight": textStyles["--font-weight"] || "initial",
|
|
26
|
+
"font-size": textStyles["--font-size"] || "initial",
|
|
27
|
+
"font-family": textStyles["--font-family"] || "sans-serif",
|
|
28
|
+
"-webkit-background-clip": textStyles["--background-clip"] || "initial",
|
|
29
|
+
"background-clip": textStyles["--background-clip"] || "initial",
|
|
30
|
+
"-webkit-text-fill-color": textStyles["--text-fill-color"] || "initial",
|
|
53
31
|
});
|
|
54
|
-
const sizeStyles = getSizeStyle({ ...size, ...activeStateProps });
|
|
55
|
-
const stylesObject = {
|
|
56
|
-
...styles,
|
|
57
|
-
...componentStyles,
|
|
58
|
-
...textStyles,
|
|
59
|
-
...sizeStyles,
|
|
60
|
-
};
|
|
61
32
|
return {
|
|
62
|
-
textStyles:
|
|
63
|
-
tagToRender,
|
|
33
|
+
textStyles: style,
|
|
34
|
+
tagToRender: "span",
|
|
64
35
|
};
|
|
65
36
|
};
|
|
66
|
-
export function
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"--margin-inline-start": "0px",
|
|
75
|
-
"--padding-block-start": "0px",
|
|
76
|
-
"--padding-inline-end": "0px",
|
|
77
|
-
"--padding-block-end": "0px",
|
|
78
|
-
"--padding-inline-start": "0px",
|
|
79
|
-
"--background": "transparent",
|
|
80
|
-
"--text-color": "inherit",
|
|
81
|
-
"--border": "none",
|
|
82
|
-
"--border-end-start-radius": "0px",
|
|
83
|
-
"--border-end-end-radius": "0px",
|
|
84
|
-
"--border-start-start-radius": "0px",
|
|
85
|
-
"--border-start-end-radius": "0px",
|
|
86
|
-
"--shadow": "none",
|
|
87
|
-
"--position": "relative",
|
|
88
|
-
"--inset": "0",
|
|
89
|
-
"--transform": "initial",
|
|
90
|
-
};
|
|
91
|
-
Object.assign(styles, getComponentStyles({
|
|
92
|
-
background_color,
|
|
93
|
-
...restProps,
|
|
94
|
-
}), getSizeStyle(size));
|
|
95
|
-
Object.assign(styles, restProps.zStackChildStyles);
|
|
96
|
-
const prefixedStyles = prefixObject(styles, "text");
|
|
97
|
-
return stringifyStyles(prefixedStyles);
|
|
98
|
-
}
|
|
99
|
-
export function getTextNodeStyles(colorMode, props) {
|
|
100
|
-
const styles = {
|
|
101
|
-
"--text-margin-block-start": "0px",
|
|
102
|
-
"--text-margin-inline-end": "0px",
|
|
103
|
-
"--text-margin-block-end": "0px",
|
|
104
|
-
"--text-margin-inline-start": "0px",
|
|
105
|
-
"--text-padding-block-start": "0px",
|
|
106
|
-
"--text-padding-inline-end": "0px",
|
|
107
|
-
"--text-padding-block-end": "0px",
|
|
108
|
-
"--text-padding-inline-start": "0px",
|
|
109
|
-
"--text-background": "transparent",
|
|
110
|
-
"--text-text-color": "inherit",
|
|
111
|
-
"--text-border": "none",
|
|
112
|
-
"--text-border-end-start-radius": "0px",
|
|
113
|
-
"--text-border-end-end-radius": "0px",
|
|
114
|
-
"--text-border-start-start-radius": "0px",
|
|
115
|
-
"--text-border-start-end-radius": "0px",
|
|
116
|
-
"--text-shadow": "none",
|
|
117
|
-
"--text-text-align": "initial",
|
|
118
|
-
"--text-font-weight": "initial",
|
|
119
|
-
"--text-font-size": "initial",
|
|
120
|
-
"--text-font-family": "sans-serif",
|
|
121
|
-
"--text-background-clip": "initial",
|
|
122
|
-
"--text-text-fill-color": "initial",
|
|
123
|
-
"--text-width": "unset",
|
|
124
|
-
"--text-height": "unset",
|
|
125
|
-
"--text-flex": "0 1 auto",
|
|
126
|
-
};
|
|
127
|
-
const { tagToRender, textStyles } = getTextComponentStyles(colorMode, props);
|
|
128
|
-
Object.assign(styles, textStyles);
|
|
129
|
-
return { tagToRender, textStyles: stringifyStyles(styles) };
|
|
37
|
+
export function getTextWrapperInlineStyles(colorMode, _restProps, size, background_color) {
|
|
38
|
+
return css({
|
|
39
|
+
display: "block",
|
|
40
|
+
position: "relative",
|
|
41
|
+
width: mapSize(size.width),
|
|
42
|
+
height: mapSize(size.height),
|
|
43
|
+
...mapBackground(colorMode, background_color, null),
|
|
44
|
+
});
|
|
130
45
|
}
|
|
131
46
|
export function getHtmlFromMarkdown(text) {
|
|
132
47
|
if (!text)
|