@revenuecat/purchases-ui-js 2.0.1 → 2.0.3
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 -108
- package/dist/components/button/ButtonNode.svelte +3 -31
- package/dist/components/footer/Footer.stories.svelte +112 -106
- package/dist/components/footer/Footer.svelte +10 -6
- 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 -199
- package/dist/components/image/Image.svelte +152 -137
- 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 +12 -27
- package/dist/components/package/Package.svelte +10 -44
- package/dist/components/paywall/Node.svelte +45 -43
- package/dist/components/paywall/Node.svelte.d.ts +10 -12
- package/dist/components/paywall/Paywall.stories.svelte +36 -140
- package/dist/components/paywall/Paywall.svelte +38 -20
- package/dist/components/paywall/Paywall.svelte.d.ts +3 -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/purchase-button/PurchaseButton.stories.svelte +10 -29
- package/dist/components/purchase-button/PurchaseButton.svelte +2 -34
- package/dist/components/stack/Stack.stories.svelte +2364 -1020
- package/dist/components/stack/Stack.svelte +108 -151
- package/dist/components/stack/Stack.svelte.d.ts +6 -2
- package/dist/components/stack/stack-utils.d.ts +10 -30
- package/dist/components/stack/stack-utils.js +77 -257
- 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 -48
- package/dist/components/text/TextNode.svelte +25 -37
- 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 -256
- package/dist/components/timeline/Timeline.svelte +42 -30
- 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 -114
- package/dist/data/entities.d.ts +23 -169
- package/dist/index.d.ts +11 -10
- package/dist/index.js +11 -10
- package/dist/stores/color-mode.d.ts +1 -1
- package/dist/stores/localization.d.ts +1 -1
- package/dist/stores/localization.js +3 -2
- package/dist/stores/paywall.d.ts +7 -3
- package/dist/stores/selected.d.ts +5 -0
- package/dist/stores/selected.js +12 -0
- package/dist/stores/variables.d.ts +2 -3
- 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 -4
- package/dist/stories/fixtures.js +6241 -5485
- package/dist/stories/localization-decorator.js +1 -1
- package/dist/stories/paywall-decorator.js +8 -1
- 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 +53 -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/stories/with-layout.svelte +3 -3
- 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 +10 -0
- package/dist/types/component.js +1 -0
- package/dist/types/components/button.d.ts +5 -2
- package/dist/types/components/footer.d.ts +3 -2
- 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 +3 -2
- package/dist/types/components/purchase-button.d.ts +3 -2
- 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/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 +3 -29
- package/dist/ui/atoms/typography.stories.svelte.d.ts +1 -1
- package/dist/ui/layout/main-block.svelte +2 -2
- package/dist/ui/molecules/button.stories.svelte +5 -10
- package/dist/ui/molecules/button.svelte +1 -1
- 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/theme.d.ts +2 -2
- package/dist/ui/theme/theme.js +2 -2
- package/dist/ui/theme/utils.d.ts +2 -12
- 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 +35 -314
- 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 +1415 -987
- package/package.json +34 -24
- 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/state.d.ts +0 -4
- package/dist/stories/meta-templates.d.ts +0 -12
- package/dist/stories/meta-templates.js +0 -155
- /package/dist/{data/state.js → types/base.js} +0 -0
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import type { TextNodeProps } from "../../data/entities";
|
|
2
1
|
import type { ColorMode, SizeType } from "../../types";
|
|
3
2
|
import type { ColorGradientScheme, ColorScheme } from "../../types/colors";
|
|
3
|
+
import type { TextNodeProps } from "../../types/components/text";
|
|
4
4
|
export declare const defaultColor: ColorScheme;
|
|
5
|
-
export declare const defaultBackgroundColor: ColorGradientScheme;
|
|
6
5
|
/**
|
|
7
6
|
* Generates comprehensive styles for text components by combining text, component and size styles
|
|
8
7
|
* @param props - Text component properties including font, color, background, spacing etc.
|
|
9
|
-
* @returns Object containing text
|
|
8
|
+
* @returns Object containing text inline styles and the appropriate HTML tag to render
|
|
10
9
|
*/
|
|
11
10
|
export declare const getTextComponentStyles: (colorMode: ColorMode, props: TextNodeProps) => {
|
|
12
|
-
textStyles: Record<string, string | number>;
|
|
13
|
-
tagToRender: import("../../utils/style-utils").TextComponentTags;
|
|
14
|
-
};
|
|
15
|
-
export declare function getTextWrapperStyles(restProps: Partial<TextNodeProps>, size: SizeType, background_color?: ColorGradientScheme): string;
|
|
16
|
-
export declare function getTextNodeStyles(colorMode: ColorMode, props: TextNodeProps): {
|
|
17
|
-
tagToRender: import("../../utils/style-utils").TextComponentTags;
|
|
18
11
|
textStyles: string;
|
|
12
|
+
tagToRender: string;
|
|
19
13
|
};
|
|
14
|
+
export declare function getTextWrapperInlineStyles(colorMode: ColorMode, _restProps: Partial<TextNodeProps>, size: SizeType, background_color?: ColorGradientScheme | null): string;
|
|
20
15
|
export declare function getHtmlFromMarkdown(text?: string): string;
|
|
@@ -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)
|