@revenuecat/purchases-ui-js 2.0.2 → 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.
Files changed (127) hide show
  1. package/dist/components/button/ButtonNode.stories.svelte +66 -102
  2. package/dist/components/button/ButtonNode.svelte +2 -27
  3. package/dist/components/footer/Footer.stories.svelte +112 -102
  4. package/dist/components/footer/Footer.svelte +8 -4
  5. package/dist/components/icon/Icon.stories.svelte +100 -0
  6. package/dist/components/icon/Icon.stories.svelte.d.ts +19 -0
  7. package/dist/components/icon/Icon.svelte +73 -0
  8. package/dist/components/icon/Icon.svelte.d.ts +4 -0
  9. package/dist/components/image/ClipPath.svelte +49 -0
  10. package/dist/components/image/ClipPath.svelte.d.ts +9 -0
  11. package/dist/components/image/Image.stories.svelte +83 -188
  12. package/dist/components/image/Image.svelte +152 -136
  13. package/dist/components/image/Image.svelte.d.ts +1 -1
  14. package/dist/components/image/Overlay.svelte +36 -0
  15. package/dist/components/image/Overlay.svelte.d.ts +8 -0
  16. package/dist/components/package/Package.stories.svelte +10 -21
  17. package/dist/components/package/Package.svelte +8 -35
  18. package/dist/components/paywall/Node.svelte +27 -28
  19. package/dist/components/paywall/Node.svelte.d.ts +3 -6
  20. package/dist/components/paywall/Paywall.stories.svelte +36 -140
  21. package/dist/components/paywall/Paywall.svelte +22 -6
  22. package/dist/components/paywall/Paywall.svelte.d.ts +3 -2
  23. package/dist/components/paywall/fixtures/override-paywall.d.ts +2 -0
  24. package/dist/components/paywall/fixtures/override-paywall.js +1310 -0
  25. package/dist/components/paywall/fixtures/stack-paywall.d.ts +2 -0
  26. package/dist/components/paywall/fixtures/stack-paywall.js +5223 -0
  27. package/dist/components/paywall/fixtures/variables.d.ts +261 -0
  28. package/dist/components/paywall/fixtures/variables.js +262 -0
  29. package/dist/components/purchase-button/PurchaseButton.stories.svelte +10 -21
  30. package/dist/components/purchase-button/PurchaseButton.svelte +2 -27
  31. package/dist/components/stack/Stack.stories.svelte +2354 -978
  32. package/dist/components/stack/Stack.svelte +111 -134
  33. package/dist/components/stack/Stack.svelte.d.ts +6 -2
  34. package/dist/components/stack/stack-utils.d.ts +10 -30
  35. package/dist/components/stack/stack-utils.js +77 -255
  36. package/dist/components/text/Text.svelte +3 -37
  37. package/dist/components/text/Text.svelte.d.ts +1 -2
  38. package/dist/components/text/TextNode.stories.svelte +10 -36
  39. package/dist/components/text/TextNode.svelte +25 -28
  40. package/dist/components/text/TextNode.svelte.d.ts +1 -1
  41. package/dist/components/text/text-utils.d.ts +4 -9
  42. package/dist/components/text/text-utils.js +32 -117
  43. package/dist/components/timeline/Timeline.stories.svelte +640 -251
  44. package/dist/components/timeline/Timeline.svelte +42 -28
  45. package/dist/components/timeline/Timeline.svelte.d.ts +1 -1
  46. package/dist/components/timeline/TimelineItem.svelte +80 -112
  47. package/dist/components/timeline/TimelineItem.svelte.d.ts +6 -2
  48. package/dist/components/timeline/timeline-utils.d.ts +24 -6
  49. package/dist/components/timeline/timeline-utils.js +21 -113
  50. package/dist/data/entities.d.ts +19 -135
  51. package/dist/index.d.ts +2 -1
  52. package/dist/index.js +2 -1
  53. package/dist/stores/color-mode.d.ts +1 -1
  54. package/dist/stores/paywall.d.ts +5 -2
  55. package/dist/stores/selected.d.ts +5 -0
  56. package/dist/stores/selected.js +12 -0
  57. package/dist/stores/variables.d.ts +1 -1
  58. package/dist/stores/variables.js +0 -1
  59. package/dist/stories/component-decorator.d.ts +2 -0
  60. package/dist/stories/component-decorator.js +12 -0
  61. package/dist/stories/fixtures.d.ts +5 -3
  62. package/dist/stories/fixtures.js +5214 -4422
  63. package/dist/stories/paywall-decorator.js +6 -0
  64. package/dist/stories/variables-decorator.d.ts +1 -1
  65. package/dist/stories/viewport-decorator.d.ts +2 -0
  66. package/dist/stories/viewport-decorator.js +8 -0
  67. package/dist/stories/viewport-wrapper.svelte +53 -0
  68. package/dist/stories/viewport-wrapper.svelte.d.ts +10 -0
  69. package/dist/stories/with-layout.d.ts +2 -10
  70. package/dist/stories/with-layout.js +3 -5
  71. package/dist/types/alignment.d.ts +5 -3
  72. package/dist/types/background.d.ts +6 -5
  73. package/dist/types/base.d.ts +7 -0
  74. package/dist/types/base.js +1 -0
  75. package/dist/types/colors.d.ts +4 -4
  76. package/dist/types/component.d.ts +6 -2
  77. package/dist/types/components/button.d.ts +4 -1
  78. package/dist/types/components/footer.d.ts +2 -1
  79. package/dist/types/components/icon.d.ts +28 -0
  80. package/dist/types/components/icon.js +1 -0
  81. package/dist/types/components/image.d.ts +20 -0
  82. package/dist/types/components/image.js +1 -0
  83. package/dist/types/components/package.d.ts +2 -1
  84. package/dist/types/components/purchase-button.d.ts +2 -1
  85. package/dist/types/components/stack.d.ts +32 -0
  86. package/dist/types/components/stack.js +1 -0
  87. package/dist/types/components/text.d.ts +20 -0
  88. package/dist/types/components/text.js +1 -0
  89. package/dist/types/components/timeline.d.ts +35 -0
  90. package/dist/types/components/timeline.js +1 -0
  91. package/dist/types/localization.d.ts +2 -1
  92. package/dist/types/media.d.ts +4 -3
  93. package/dist/types/overrides.d.ts +48 -0
  94. package/dist/types/overrides.js +1 -0
  95. package/dist/types/variables.d.ts +13 -0
  96. package/dist/types/variables.js +10 -0
  97. package/dist/types.d.ts +17 -9
  98. package/dist/ui/atoms/typography.stories.svelte +1 -27
  99. package/dist/ui/molecules/button.stories.svelte +3 -8
  100. package/dist/ui/theme/colors.d.ts +0 -6
  101. package/dist/ui/theme/colors.js +1 -1
  102. package/dist/ui/theme/text.d.ts +3 -4
  103. package/dist/ui/theme/utils.d.ts +0 -10
  104. package/dist/ui/theme/utils.js +5 -5
  105. package/dist/utils/background-utils.d.ts +4 -0
  106. package/dist/utils/background-utils.js +39 -0
  107. package/dist/utils/base-utils.d.ts +18 -0
  108. package/dist/utils/base-utils.js +124 -0
  109. package/dist/utils/constants.d.ts +2 -2
  110. package/dist/utils/constants.js +6 -1
  111. package/dist/utils/font-utils.d.ts +4 -0
  112. package/dist/utils/font-utils.js +47 -0
  113. package/dist/utils/style-utils.d.ts +7 -120
  114. package/dist/utils/style-utils.js +22 -302
  115. package/dist/utils/variable-utils.d.ts +1 -22
  116. package/dist/utils/variable-utils.js +28 -24
  117. package/dist/web-components/index.css +1 -1
  118. package/dist/web-components/index.js +1323 -895
  119. package/package.json +34 -24
  120. package/dist/components/button/button-utils.d.ts +0 -2
  121. package/dist/components/button/button-utils.js +0 -19
  122. package/dist/components/image/image-utils.d.ts +0 -19
  123. package/dist/components/image/image-utils.js +0 -33
  124. package/dist/components/purchase-button/purchase-button-utils.d.ts +0 -2
  125. package/dist/components/purchase-button/purchase-button-utils.js +0 -20
  126. package/dist/stories/meta-templates.d.ts +0 -12
  127. package/dist/stories/meta-templates.js +0 -155
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@revenuecat/purchases-ui-js",
3
3
  "description": "Web components for Paywalls. Powered by RevenueCat",
4
4
  "private": false,
5
- "version": "2.0.2",
5
+ "version": "2.0.3",
6
6
  "author": {
7
7
  "name": "RevenueCat, Inc."
8
8
  },
@@ -24,6 +24,7 @@
24
24
  ],
25
25
  "scripts": {
26
26
  "dev": "vite dev",
27
+ "sync": "svelte-kit sync",
27
28
  "build": "npm run build:kit && npm run build:components && publint",
28
29
  "build:components": "vite build --config vite.components.config.ts",
29
30
  "build:kit": "vite build && npm run package",
@@ -39,7 +40,10 @@
39
40
  "format": "prettier --write .",
40
41
  "typecheck": "tsc --noEmit",
41
42
  "test": "vitest --config vitest.config.ts",
42
- "lint": "eslint --config eslint.config.js src/**/*"
43
+ "integration-test:install-deps": "playwright install --with-deps",
44
+ "integration-test:run": "playwright test",
45
+ "lint": "eslint --config eslint.config.js src/**/*",
46
+ "knip": "knip"
43
47
  },
44
48
  "files": [
45
49
  "dist",
@@ -68,33 +72,36 @@
68
72
  },
69
73
  "devDependencies": {
70
74
  "@chromatic-com/storybook": "4.1.1",
71
- "@eslint/js": "9.34.0",
72
- "@storybook/addon-docs": "9.1.3",
73
- "@storybook/addon-links": "9.1.3",
75
+ "@eslint/js": "9.36.0",
76
+ "@playwright/test": "1.55.1",
77
+ "@storybook/addon-docs": "9.1.8",
78
+ "@storybook/addon-links": "9.1.8",
74
79
  "@storybook/addon-svelte-csf": "5.0.8",
75
- "@storybook/sveltekit": "9.1.3",
76
- "@sveltejs/adapter-node": "5.3.1",
77
- "@sveltejs/kit": "2.37.0",
78
- "@sveltejs/package": "2.5.0",
79
- "@sveltejs/vite-plugin-svelte": "5.1.1",
80
- "@typescript-eslint/parser": "8.41.0",
81
- "chromatic": "13.1.3",
82
- "eslint": "9.34.0",
83
- "eslint-plugin-storybook": "9.1.3",
84
- "eslint-plugin-svelte": "3.11.0",
85
- "globals": "16.3.0",
80
+ "@storybook/sveltekit": "9.1.8",
81
+ "@sveltejs/adapter-node": "5.3.2",
82
+ "@sveltejs/kit": "2.43.5",
83
+ "@sveltejs/package": "2.5.4",
84
+ "@sveltejs/vite-plugin-svelte": "6.2.1",
85
+ "@types/node": "24.5.2",
86
+ "@typescript-eslint/parser": "8.45.0",
87
+ "chromatic": "13.3.0",
88
+ "eslint": "9.36.0",
89
+ "eslint-plugin-storybook": "9.1.8",
90
+ "eslint-plugin-svelte": "3.12.4",
91
+ "globals": "16.4.0",
86
92
  "husky": "9.1.7",
87
- "jsdom": "26.1.0",
88
- "lint-staged": "16.1.5",
93
+ "jsdom": "27.0.0",
94
+ "knip": "5.64.1",
95
+ "lint-staged": "16.2.3",
89
96
  "prettier": "3.6.2",
90
97
  "prettier-plugin-svelte": "3.4.0",
91
- "publint": "0.3.12",
92
- "storybook": "9.1.3",
93
- "svelte": "5.14.3",
94
- "svelte-check": "4.3.1",
98
+ "publint": "0.3.13",
99
+ "storybook": "9.1.8",
100
+ "svelte": "5.39.6",
101
+ "svelte-check": "4.3.2",
95
102
  "typescript": "5.9.2",
96
- "typescript-eslint": "8.41.0",
97
- "vite": "6.3.5",
103
+ "typescript-eslint": "8.45.0",
104
+ "vite": "7.1.7",
98
105
  "vite-plugin-dts": "4.5.4",
99
106
  "vitest": "3.2.4"
100
107
  },
@@ -104,5 +111,8 @@
104
111
  "eslint --fix"
105
112
  ]
106
113
  },
114
+ "engines": {
115
+ "node": "^22.18"
116
+ },
107
117
  "packageManager": "npm@11.5.2+sha512.aac1241cfc3f41dc38780d64295c6c6b917a41e24288b33519a7b11adfc5a54a5f881c642d7557215b6c70e01e55655ed7ba666300fd0238bc75fb17478afaf3"
108
118
  }
@@ -1,2 +0,0 @@
1
- import type { ButtonProps } from "../../types/components/button";
2
- export declare function getButtonStyles({ stack, zStackChildStyles }: ButtonProps): string;
@@ -1,19 +0,0 @@
1
- import { prefixObject, stringifyStyles } from "../../utils/style-utils";
2
- export function getButtonStyles({ stack, zStackChildStyles }) {
3
- // Get the width of the inner stack to adjust to the outer button wrapper
4
- const width = stack?.size?.width?.type === "fill" ? "100%" : "fit-content";
5
- // Define set of variables to be assigned to the button
6
- // Define width as an inline style
7
- const prefixedObject = prefixObject(zStackChildStyles || {}, "button");
8
- const assignedVariables = {
9
- position: "var(--button-position, relative)",
10
- inset: "var(--button-inset, 0)",
11
- transform: "var(--button-transform, initial)",
12
- width,
13
- };
14
- const buttonInlineStyles = stringifyStyles({
15
- ...prefixedObject,
16
- ...assignedVariables,
17
- });
18
- return buttonInlineStyles;
19
- }
@@ -1,19 +0,0 @@
1
- import type { ImageProps } from "../../data/entities";
2
- import type { ColorMode } from "../../types";
3
- /**
4
- * Generates comprehensive styles for image components by combining gradient and size styles
5
- * @param props - Image component properties including gradient, mask and size
6
- * @returns Object containing image style variables and gradient style variables
7
- */
8
- export declare const getImageComponentStyles: (colorMode: ColorMode, props: ImageProps & {
9
- imageAspectRatio: number;
10
- }) => {
11
- imageStyles: string;
12
- maskPath: string;
13
- linearGradientAngle: {
14
- x1: string;
15
- y1: string;
16
- x2: string;
17
- y2: string;
18
- };
19
- };
@@ -1,33 +0,0 @@
1
- import { getActiveStateProps, getLinearGradientAngle, getMaskPath, getMaskStyle, getSizeStyle, prefixObject, stringifyStyles, } from "../../utils/style-utils";
2
- /**
3
- * Generates comprehensive styles for image components by combining gradient and size styles
4
- * @param props - Image component properties including gradient, mask and size
5
- * @returns Object containing image style variables and gradient style variables
6
- */
7
- export const getImageComponentStyles = (colorMode, props) => {
8
- const { size, overrides, componentState, zStackChildStyles } = props;
9
- const imageStyles = {
10
- "--height": "unset",
11
- "--width": "unset",
12
- "--clip-path": "none",
13
- "--border-end-start-radius": "unset",
14
- "--border-end-end-radius": "unset",
15
- "--border-start-start-radius": "unset",
16
- "--border-start-end-radius": "unset",
17
- "--position": "relative",
18
- "--inset": "0",
19
- "--transform": "initial",
20
- };
21
- const activeStateProps = getActiveStateProps(overrides, componentState);
22
- Object.assign(imageStyles, zStackChildStyles);
23
- Object.assign(imageStyles, getSizeStyle({ ...size, ...activeStateProps }));
24
- Object.assign(imageStyles, getMaskStyle(props.mask_shape));
25
- const prefixedImageStyles = prefixObject(imageStyles, "image");
26
- const maskPath = getMaskPath(props);
27
- const linearGradientAngle = getLinearGradientAngle(colorMode, props);
28
- return {
29
- imageStyles: stringifyStyles(prefixedImageStyles),
30
- maskPath,
31
- linearGradientAngle,
32
- };
33
- };
@@ -1,2 +0,0 @@
1
- import type { PurchaseButtonProps } from "../../types/components/purchase-button";
2
- export declare function getPurchaseButtonStyles({ stack, zStackChildStyles, }: PurchaseButtonProps): string;
@@ -1,20 +0,0 @@
1
- import { prefixObject, stringifyStyles } from "../../utils/style-utils";
2
- export function getPurchaseButtonStyles({ stack, zStackChildStyles, }) {
3
- // Get the width of the inner stack to adjust to the outer button wrapper
4
- const width = stack.size.width.type === "fill" ? "100%" : "fit-content";
5
- // Prefix zStack child styles with purchase-button to prevent class overlap conflicts
6
- const prefixedObject = prefixObject(zStackChildStyles || {}, "purchase-button");
7
- // Define set of variables to be assigned to the purchase button
8
- // Define width as an inline style
9
- const assignedVariables = {
10
- position: "var(--purchase-button-position, relative)",
11
- inset: "var(--purchase-button-inset, 0)",
12
- transform: "var(--purchase-button-transform, initial)",
13
- width,
14
- };
15
- const purchaseButtonInlineStyles = stringifyStyles({
16
- ...prefixedObject,
17
- ...assignedVariables,
18
- });
19
- return purchaseButtonInlineStyles;
20
- }
@@ -1,12 +0,0 @@
1
- import type { InputType } from "storybook/internal/types";
2
- export declare const getSpacingStoryMeta: (description: string) => InputType;
3
- export declare const getColorStoryMeta: (description: string) => InputType;
4
- export declare const stackDimensionStoryMeta: InputType;
5
- export declare const getTextControlStoryMeta: (description: string) => InputType;
6
- export declare const fontWeightStoryMeta: InputType;
7
- export declare const fontSizeStoryMeta: InputType;
8
- export declare const textStyleStoryMeta: InputType;
9
- export declare const horizontalAlignmentStoryMeta: InputType;
10
- export declare const shadowStoryMeta: InputType;
11
- export declare const borderStoryMeta: InputType;
12
- export declare const sizeStoryMeta: InputType;
@@ -1,155 +0,0 @@
1
- import { DEFAULT_BACKGROUND_COLOR, DEFAULT_TEXT_COLOR, } from "../utils/constants";
2
- export const getSpacingStoryMeta = (description) => ({
3
- description,
4
- control: { type: "object" },
5
- defaultValue: { top: 0, trailing: 0, bottom: 0, leading: 0 },
6
- table: {
7
- type: {
8
- summary: "object",
9
- detail: "{ top: number, trailing: number, bottom: number, leading: number }",
10
- },
11
- },
12
- });
13
- export const getColorStoryMeta = (description) => ({
14
- description,
15
- control: {
16
- type: "object",
17
- fields: {
18
- light: { type: "color" },
19
- dark: { type: "color" },
20
- },
21
- },
22
- defaultValue: {
23
- dark: DEFAULT_BACKGROUND_COLOR,
24
- light: DEFAULT_BACKGROUND_COLOR,
25
- },
26
- table: {
27
- type: {
28
- summary: "object",
29
- detail: "{ dark: string, light: string }",
30
- },
31
- },
32
- });
33
- export const stackDimensionStoryMeta = {
34
- control: { type: "object" },
35
- description: "Stack dimension configuration",
36
- table: {
37
- type: {
38
- summary: "object",
39
- detail: `{
40
- type: "vertical" | "horizontal" | "zlayer",
41
- alignment: "start" | "center" | "end" | "top" | "bottom",
42
- distribution: "start" | "center" | "end" | "space_between" | "space_around" | "space_evenly"
43
- }`,
44
- },
45
- },
46
- };
47
- export const getTextControlStoryMeta = (description) => ({
48
- control: { type: "text" },
49
- description,
50
- });
51
- export const fontWeightStoryMeta = {
52
- control: { type: "select" },
53
- options: [
54
- "black",
55
- "extra-bold",
56
- "bold",
57
- "semi-bold",
58
- "medium",
59
- "regular",
60
- "light",
61
- "extra-light",
62
- "thin",
63
- ],
64
- description: "Font weight to be used",
65
- };
66
- export const fontSizeStoryMeta = {
67
- control: { type: "select" },
68
- options: [
69
- "body_s",
70
- "body_m",
71
- "body_l",
72
- "body_xl",
73
- "heading_xs",
74
- "heading_s",
75
- "heading_m",
76
- "heading_l",
77
- "heading_xl",
78
- "heading_xxl",
79
- ],
80
- description: "Font size to be used",
81
- };
82
- export const textStyleStoryMeta = {
83
- control: { type: "select" },
84
- options: ["normal", "bold", "italic", "strikethrough", "link", "monospace"],
85
- description: "Text style to be used",
86
- };
87
- export const horizontalAlignmentStoryMeta = {
88
- control: { type: "select" },
89
- options: ["center", "start", "end"],
90
- description: "Text horizontal alignment",
91
- };
92
- export const shadowStoryMeta = {
93
- control: {
94
- type: "object",
95
- fields: {
96
- x: { type: "number" },
97
- y: { type: "number" },
98
- radius: { type: "number" },
99
- color: { type: "color" },
100
- },
101
- },
102
- defaultValue: {
103
- x: 0,
104
- y: 0,
105
- radius: 0,
106
- color: { dark: DEFAULT_TEXT_COLOR, light: DEFAULT_TEXT_COLOR },
107
- },
108
- table: {
109
- type: {
110
- summary: "object",
111
- detail: "{ x: number, y: number, radius: number, color: { dark: string, light: string } }",
112
- },
113
- },
114
- description: "Shadow properties including x, y, radius, and color",
115
- };
116
- export const borderStoryMeta = {
117
- control: {
118
- type: "object",
119
- fields: {
120
- width: { type: "number" },
121
- color: { type: "color" },
122
- },
123
- },
124
- defaultValue: {
125
- width: 0,
126
- color: { dark: DEFAULT_TEXT_COLOR, light: DEFAULT_TEXT_COLOR },
127
- },
128
- description: "Border properties including width, color, style, and radius",
129
- };
130
- export const sizeStoryMeta = {
131
- control: {
132
- type: "object",
133
- fields: {
134
- width: {
135
- type: "object",
136
- fields: {
137
- type: { type: "select", options: ["fit", "fill", "fixed"] },
138
- value: { type: "number" },
139
- },
140
- },
141
- height: {
142
- type: "object",
143
- fields: {
144
- type: { type: "select", options: ["fit", "fill", "fixed"] },
145
- value: { type: "number" },
146
- },
147
- },
148
- },
149
- },
150
- defaultValue: {
151
- width: { type: "fill" },
152
- height: { type: "fill" },
153
- },
154
- description: "Size properties including width and height",
155
- };