@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
@@ -1,38 +1,52 @@
1
1
  <script lang="ts">
2
- import { getTimelineStyles } from "./timeline-utils";
2
+ import { getTimelineInlineStyles } from "./timeline-utils";
3
3
  import TimelineItem from "./TimelineItem.svelte";
4
- import type { TimelineProps } from "../../data/entities";
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 { items, ...restProps }: TimelineProps = $props();
9
+ const props: TimelineProps = $props();
10
+ const selectedState = getSelectedStateContext();
7
11
 
8
- const timelineStyles = $derived(getTimelineStyles({ items, ...restProps }));
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 class="rc-pw-timeline-container" style={timelineStyles}>
13
- {#each items as item, index}
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 "../../data/entities";
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
- getTimelineItemStyles,
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 { getLocalizationContext } from "../../stores/localization";
9
- import { getVariablesContext } from "../../stores/variables";
10
- import { replaceVariables } from "../../utils/variable-utils";
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
- const props: TimelineItemProps = $props();
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 styles = $derived(getTimelineItemStyles(colorMode, props));
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 { getLocalizedString } = getLocalizationContext();
48
+ const connectorStyles = $derived.by(() => {
49
+ if (!connector) return "";
20
50
 
21
- const variables = getVariablesContext();
22
- const titleLabel = $derived(
23
- replaceVariables(getLocalizedString(props.title.text_lid), $variables),
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 descriptionLabel = $derived(
27
- replaceVariables(
28
- getLocalizedString(props.description?.text_lid),
29
- $variables,
30
- ),
31
- );
64
+ const connectorBarStyles = $derived.by(() => {
65
+ if (!connector) return "";
32
66
 
33
- const { tagToRender: titleTagToRender, textStyles: titleStyles } = $derived(
34
- getTimelineItemTextStyles(colorMode, props, "title"),
35
- );
67
+ const background = getColor({
68
+ colorMap: connector.color,
69
+ colorMode,
70
+ fallback: "#000000",
71
+ });
36
72
 
37
- const { tagToRender: descriptionTagToRender, textStyles: descriptionStyles } =
38
- $derived(getTimelineItemTextStyles(colorMode, props, "description"));
39
- // TODO: Object mapping icon name to icon component
73
+ return css({
74
+ width: "100%",
75
+ height: "100%",
76
+ background,
77
+ });
78
+ });
40
79
  </script>
41
80
 
42
- <div class="rc-pw-timeline-item" style={styles}>
43
- <div class="rc-pw-timeline-item-icon-container">
44
- <div class="rc-pw-timeline-item-icon"></div>
45
- </div>
46
- <div class="rc-pw-timeline-item-content">
47
- <svelte:element
48
- this={titleTagToRender}
49
- class="rc-pw-timeline-item-content-title"
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
- .rc-pw-timeline-item {
64
- display: flex;
65
- align-items: center;
66
- gap: var(--timeline-item-spacing, 0px);
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 "../../data/entities";
2
- declare const TimelineItem: import("svelte").Component<TimelineItemProps, {}, "">;
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 { TimelineItemProps, TimelineProps } from "../../data/entities";
1
+ import type { TimelineProps } from "../../types/components/timeline";
2
2
  import type { ColorMode } from "../../types";
3
- export declare function getTimelineStyles(props: TimelineProps): string;
4
- export declare function getTimelineItemStyles(colorMode: ColorMode, props: TimelineItemProps): string;
5
- export declare function getTimelineItemTextStyles(colorMode: ColorMode, props: TimelineItemProps, kind?: "title" | "description"): {
6
- textStyles: string;
7
- tagToRender: import("../../utils/style-utils").TextComponentTags;
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 { defaultColor, getTextComponentStyles, } from "../text/text-utils";
2
- import { getBorderStyle, getColor, getCornerRadiusStyle, getSizeStyle, prefixObject, stringifyStyles, } from "../../utils/style-utils";
3
- export function getTimelineStyles(props) {
4
- const styles = {
5
- "--item-spacing": `${props.item_spacing}px`,
6
- "--width": "initial",
7
- "--height": "initial",
8
- "--flex": "0 1 auto",
9
- "--position": "relative",
10
- "--inset": "0",
11
- "--transform": "initial",
12
- };
13
- Object.assign(styles, getSizeStyle(props.size));
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 getTimelineItemTextStyles(colorMode, props, kind = "title") {
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
- textStyles: stringifiedStyles,
116
- tagToRender,
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
  }
@@ -1,13 +1,8 @@
1
- import type { ZStackChildStyles } from "../components/stack/stack-utils";
2
- import type { AlignmentType, BorderType, CircleShape, CornerRadiusType, FontSizeTags, FontWeights, RectangleShape, ShadowType, ShapeType, SizeType, Spacing, TextAlignments } from "../types";
3
- import type { Dimension } from "../types/alignment";
4
1
  import type { Background } from "../types/background";
5
- import type { ColorGradientScheme, ColorScheme } from "../types/colors";
6
- import type { Component } from "../types/component";
7
2
  import type { FooterProps } from "../types/components/footer";
3
+ import type { StackProps } from "../types/components/stack";
8
4
  import type { Localizations } from "../types/localization";
9
- import type { ImageInfo, ImageObjectFit } from "../types/media";
10
- export interface RootPaywall {
5
+ interface RootPaywall {
11
6
  background?: Background;
12
7
  stack: StackProps;
13
8
  sticky_footer?: FooterProps | null;
@@ -29,134 +24,23 @@ export interface PaywallData {
29
24
  components_config: ComponentConfig;
30
25
  components_localizations: Localizations;
31
26
  }
32
- export type ComponentState = {
33
- [state: string]: boolean;
27
+ type AppFontFamilyConfig = {
28
+ type: "name" | "url";
29
+ value?: string;
30
+ family: string;
31
+ hash: string;
32
+ style: string;
33
+ url: string;
34
+ weight: number;
34
35
  };
35
- export interface BaseComponent {
36
- type: string;
37
- id: string;
38
- name: string;
39
- fallback?: Component;
40
- componentState?: ComponentState;
41
- zStackChildStyles?: ZStackChildStyles;
42
- }
43
- export type OverrideProps<T> = {
44
- states?: {
45
- [state: string]: T;
46
- };
47
- };
48
- export interface StackProps extends BaseComponent {
49
- type: "stack";
50
- visible?: boolean | null;
51
- components: Component[];
52
- size: SizeType;
53
- dimension: Dimension;
54
- spacing: number;
55
- margin: Spacing;
56
- padding: Spacing;
57
- background_color: ColorGradientScheme | null;
58
- background: Background | null;
59
- border: BorderType | null;
60
- shape: ShapeType | null;
61
- shadow: ShadowType | null;
62
- badge?: null | {
63
- stack: {
64
- components: Component[];
65
- type: "stack";
66
- };
67
- style: "overlay" | "edge_to_edge" | "nested";
68
- alignment: Exclude<AlignmentType, "center">;
69
- border?: BorderType | null;
70
- shape: ShapeType | null;
71
- shadow?: ShadowType | null;
72
- padding: Spacing;
73
- margin: Spacing;
74
- text_lid: string;
75
- color: ColorScheme;
76
- font_name?: string;
77
- font_weight: keyof typeof FontWeights;
78
- font_size: keyof typeof FontSizeTags;
79
- horizontal_alignment: keyof typeof TextAlignments;
80
- background_color: ColorGradientScheme;
81
- };
82
- overrides?: OverrideProps<StackProps>;
83
- }
84
- export interface TextNodeProps extends BaseComponent {
85
- background_color?: ColorGradientScheme | null;
86
- color: ColorScheme;
87
- font_name?: string | null;
88
- font_size: keyof typeof FontSizeTags;
89
- font_weight: keyof typeof FontWeights;
90
- horizontal_alignment: keyof typeof TextAlignments;
91
- margin: Spacing;
92
- padding: Spacing;
93
- text_lid: string;
94
- type: "text";
95
- size: SizeType;
96
- overrides?: OverrideProps<TextNodeProps>;
97
- }
98
- export interface ImageMaskShapeType {
99
- type: "circle" | "rectangle" | "concave" | "convex";
100
- corners?: CornerRadiusType;
101
- }
102
- export interface ImageProps extends BaseComponent {
103
- type: "image";
104
- fit_mode: ImageObjectFit;
105
- size: SizeType;
106
- source: ImageInfo;
107
- color_overlay?: ColorGradientScheme | null;
108
- mask_shape?: ImageMaskShapeType;
109
- max_height?: number;
110
- override_source_lid?: string;
111
- overrides?: OverrideProps<ImageProps>;
112
- }
113
- export type ItemProps = {
114
- title: {
115
- text_lid: string;
116
- color: ColorScheme;
117
- font_name?: string;
118
- font_weight?: keyof typeof FontWeights;
119
- font_size?: keyof typeof FontSizeTags;
120
- horizontal_alignment?: keyof typeof TextAlignments;
121
- };
122
- description?: {
123
- text_lid: string;
124
- color: ColorScheme;
125
- font_name?: string;
126
- font_weight?: keyof typeof FontWeights;
127
- font_size?: keyof typeof FontSizeTags;
128
- horizontal_alignment?: keyof typeof TextAlignments;
129
- };
130
- icon: {
131
- name: string;
132
- color: ColorScheme;
133
- width_and_height: number;
134
- padding: number;
135
- };
136
- icon_background?: {
137
- shape: CircleShape | RectangleShape;
138
- color: ColorScheme;
139
- border?: BorderType;
140
- };
141
- connector?: {
142
- width: number;
143
- margin: {
144
- top: number;
145
- bottom: number;
146
- };
147
- color: ColorGradientScheme;
36
+ type AppFontsConfig = Record<string, {
37
+ ios?: AppFontFamilyConfig;
38
+ android?: AppFontFamilyConfig;
39
+ web?: AppFontFamilyConfig;
40
+ }>;
41
+ export type UIConfig = {
42
+ app: {
43
+ fonts: AppFontsConfig;
148
44
  };
149
45
  };
150
- export interface TimelineProps extends BaseComponent {
151
- type: "timeline";
152
- item_spacing: number;
153
- text_spacing: number;
154
- size: SizeType;
155
- padding: Spacing;
156
- margin: Spacing;
157
- items: ItemProps[];
158
- }
159
- export interface TimelineItemProps extends ItemProps, BaseComponent {
160
- text_spacing: number;
161
- item_spacing: number;
162
- }
46
+ export {};
package/dist/index.d.ts CHANGED
@@ -8,7 +8,8 @@ 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
10
  export { type PaywallData as PaywallData } from "./data/entities";
11
+ export { type UIConfig as UIConfig } from "./data/entities";
11
12
  export * from "./types";
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
@@ -9,7 +9,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
11
  export {} from "./data/entities";
12
+ export {} from "./data/entities";
12
13
  export * from "./types";
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";