@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,6 +1,9 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import Footer from "./Footer.svelte";
|
|
3
|
+
import { componentDecorator } from "../../stories/component-decorator";
|
|
3
4
|
import { localizationDecorator } from "../../stories/localization-decorator";
|
|
5
|
+
import { viewportDecorator } from "../../stories/viewport-decorator";
|
|
6
|
+
import type { FooterProps } from "../../types/components/footer";
|
|
4
7
|
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
5
8
|
|
|
6
9
|
const defaultLocale = "en_US";
|
|
@@ -8,8 +11,8 @@
|
|
|
8
11
|
const { Story } = defineMeta({
|
|
9
12
|
title: "Components/Footer",
|
|
10
13
|
component: Footer,
|
|
11
|
-
tags: ["autodocs"],
|
|
12
14
|
decorators: [
|
|
15
|
+
componentDecorator(),
|
|
13
16
|
localizationDecorator({
|
|
14
17
|
defaultLocale,
|
|
15
18
|
localizations: {
|
|
@@ -19,123 +22,130 @@
|
|
|
19
22
|
},
|
|
20
23
|
}),
|
|
21
24
|
],
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
args={{
|
|
29
|
-
id: "kHhCWlo9au",
|
|
30
|
-
name: "",
|
|
31
|
-
stack: {
|
|
32
|
-
background_color: {
|
|
33
|
-
light: {
|
|
34
|
-
type: "hex",
|
|
35
|
-
value: "#6c6c6cFF",
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
background: {
|
|
39
|
-
type: "color",
|
|
40
|
-
value: {
|
|
25
|
+
args: {
|
|
26
|
+
type: "footer",
|
|
27
|
+
id: "footer",
|
|
28
|
+
name: "Footer",
|
|
29
|
+
stack: {
|
|
30
|
+
background_color: {
|
|
41
31
|
light: {
|
|
42
32
|
type: "hex",
|
|
43
33
|
value: "#6c6c6cFF",
|
|
44
34
|
},
|
|
45
35
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
background_color: null,
|
|
51
|
-
color: {
|
|
36
|
+
background: {
|
|
37
|
+
type: "color",
|
|
38
|
+
value: {
|
|
52
39
|
light: {
|
|
53
40
|
type: "hex",
|
|
54
|
-
value: "#
|
|
41
|
+
value: "#6c6c6cFF",
|
|
55
42
|
},
|
|
56
43
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
value: null,
|
|
44
|
+
},
|
|
45
|
+
border: null,
|
|
46
|
+
components: [
|
|
47
|
+
{
|
|
48
|
+
background_color: null,
|
|
49
|
+
color: {
|
|
50
|
+
light: {
|
|
51
|
+
type: "hex",
|
|
52
|
+
value: "#ffffffFF",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
font_name: null,
|
|
56
|
+
font_size: "body_m",
|
|
57
|
+
font_weight: "extra_bold",
|
|
58
|
+
horizontal_alignment: "center",
|
|
59
|
+
id: "pFC3qrx4-c",
|
|
60
|
+
margin: {
|
|
61
|
+
bottom: 0,
|
|
62
|
+
leading: 0,
|
|
63
|
+
top: 0,
|
|
64
|
+
trailing: 0,
|
|
79
65
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
66
|
+
name: "",
|
|
67
|
+
padding: {
|
|
68
|
+
bottom: 10,
|
|
69
|
+
leading: 10,
|
|
70
|
+
top: 10,
|
|
71
|
+
trailing: 10,
|
|
83
72
|
},
|
|
73
|
+
size: {
|
|
74
|
+
height: {
|
|
75
|
+
type: "fit",
|
|
76
|
+
value: null,
|
|
77
|
+
},
|
|
78
|
+
width: {
|
|
79
|
+
type: "fit",
|
|
80
|
+
value: null,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
text_lid: "GM2Sytqd5p",
|
|
84
|
+
type: "text",
|
|
84
85
|
},
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
],
|
|
87
|
+
dimension: {
|
|
88
|
+
type: "vertical",
|
|
89
|
+
alignment: "center",
|
|
90
|
+
distribution: "center",
|
|
87
91
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
id: "yI_0xF4hlJ",
|
|
95
|
-
margin: {
|
|
96
|
-
bottom: 0,
|
|
97
|
-
leading: 0,
|
|
98
|
-
top: 0,
|
|
99
|
-
trailing: 0,
|
|
100
|
-
},
|
|
101
|
-
name: "Footer",
|
|
102
|
-
padding: {
|
|
103
|
-
bottom: 0,
|
|
104
|
-
leading: 0,
|
|
105
|
-
top: 0,
|
|
106
|
-
trailing: 0,
|
|
107
|
-
},
|
|
108
|
-
shadow: {
|
|
109
|
-
color: {
|
|
110
|
-
light: {
|
|
111
|
-
type: "hex",
|
|
112
|
-
value: "#00000033",
|
|
113
|
-
},
|
|
92
|
+
id: "yI_0xF4hlJ",
|
|
93
|
+
margin: {
|
|
94
|
+
bottom: 0,
|
|
95
|
+
leading: 0,
|
|
96
|
+
top: 0,
|
|
97
|
+
trailing: 0,
|
|
114
98
|
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
bottom_leading: 0,
|
|
122
|
-
bottom_trailing: 0,
|
|
123
|
-
top_leading: 8,
|
|
124
|
-
top_trailing: 8,
|
|
99
|
+
name: "Footer",
|
|
100
|
+
padding: {
|
|
101
|
+
bottom: 0,
|
|
102
|
+
leading: 0,
|
|
103
|
+
top: 0,
|
|
104
|
+
trailing: 0,
|
|
125
105
|
},
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
106
|
+
shadow: {
|
|
107
|
+
color: {
|
|
108
|
+
light: {
|
|
109
|
+
type: "hex",
|
|
110
|
+
value: "#00FF007F",
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
radius: 16,
|
|
114
|
+
x: 0,
|
|
115
|
+
y: -8,
|
|
116
|
+
},
|
|
117
|
+
shape: {
|
|
118
|
+
corners: {
|
|
119
|
+
bottom_leading: 0,
|
|
120
|
+
bottom_trailing: 0,
|
|
121
|
+
top_leading: 8,
|
|
122
|
+
top_trailing: 8,
|
|
123
|
+
},
|
|
124
|
+
type: "rectangle",
|
|
131
125
|
},
|
|
132
|
-
|
|
133
|
-
|
|
126
|
+
size: {
|
|
127
|
+
height: {
|
|
128
|
+
type: "fit",
|
|
129
|
+
},
|
|
130
|
+
width: {
|
|
131
|
+
type: "fill",
|
|
132
|
+
},
|
|
134
133
|
},
|
|
134
|
+
spacing: 0,
|
|
135
|
+
type: "stack",
|
|
135
136
|
},
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
} satisfies FooterProps,
|
|
138
|
+
});
|
|
139
|
+
</script>
|
|
140
|
+
|
|
141
|
+
<Story name="Footer component" />
|
|
142
|
+
|
|
143
|
+
<Story
|
|
144
|
+
name="Footer - no overflow"
|
|
145
|
+
decorators={[viewportDecorator(300, 600, 3)]}
|
|
146
|
+
/>
|
|
147
|
+
|
|
148
|
+
<Story
|
|
149
|
+
name="Footer - overflow"
|
|
150
|
+
decorators={[viewportDecorator(300, 600, 50)]}
|
|
141
151
|
/>
|
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
import Stack from "../stack/Stack.svelte";
|
|
3
3
|
import type { FooterProps } from "../../types/components/footer";
|
|
4
4
|
|
|
5
|
-
const { stack
|
|
5
|
+
const { stack }: FooterProps = $props();
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
|
-
<div
|
|
8
|
+
<div>
|
|
9
9
|
<Stack {...stack} />
|
|
10
10
|
</div>
|
|
11
11
|
|
|
12
12
|
<style>
|
|
13
|
-
|
|
13
|
+
div {
|
|
14
14
|
position: sticky;
|
|
15
15
|
bottom: 0;
|
|
16
|
-
transform: translateY(50%);
|
|
17
16
|
width: 100%;
|
|
17
|
+
z-index: 1000;
|
|
18
|
+
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
justify-content: center;
|
|
18
22
|
}
|
|
19
23
|
</style>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { componentDecorator } from "../../stories/component-decorator";
|
|
3
|
+
import type { IconBackground, IconProps } from "../../types/components/icon";
|
|
4
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
5
|
+
import Icon from "./Icon.svelte";
|
|
6
|
+
|
|
7
|
+
const icon_background = {
|
|
8
|
+
color: {
|
|
9
|
+
light: { type: "hex", value: "#345e0aFF" },
|
|
10
|
+
},
|
|
11
|
+
shape: {
|
|
12
|
+
type: "rectangle",
|
|
13
|
+
corners: {
|
|
14
|
+
top_leading: 0,
|
|
15
|
+
top_trailing: 8,
|
|
16
|
+
bottom_trailing: 16,
|
|
17
|
+
bottom_leading: 32,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
border: {
|
|
21
|
+
width: 4,
|
|
22
|
+
color: {
|
|
23
|
+
light: { type: "hex", value: "#8fb43fff" },
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
shadow: {
|
|
27
|
+
x: 4,
|
|
28
|
+
y: 4,
|
|
29
|
+
radius: 8,
|
|
30
|
+
color: {
|
|
31
|
+
light: { type: "hex", value: "#00000040" },
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
} satisfies IconBackground;
|
|
35
|
+
|
|
36
|
+
const { Story } = defineMeta({
|
|
37
|
+
title: "Components/Icon",
|
|
38
|
+
component: Icon,
|
|
39
|
+
decorators: [componentDecorator()],
|
|
40
|
+
args: {
|
|
41
|
+
type: "icon",
|
|
42
|
+
id: "icon",
|
|
43
|
+
name: "Icon",
|
|
44
|
+
icon_name: "filled-star",
|
|
45
|
+
base_url: "https://icons.pawwalls.com/icons",
|
|
46
|
+
formats: {
|
|
47
|
+
heic: "filled-star.heic",
|
|
48
|
+
png: "filled-star.png",
|
|
49
|
+
svg: "filled-star.svg",
|
|
50
|
+
webp: "filled-star.webp",
|
|
51
|
+
},
|
|
52
|
+
size: {
|
|
53
|
+
width: { type: "fixed", value: 64 },
|
|
54
|
+
height: { type: "fixed", value: 64 },
|
|
55
|
+
},
|
|
56
|
+
margin: { top: 16, trailing: 16, bottom: 16, leading: 16 },
|
|
57
|
+
padding: { top: 8, trailing: 8, bottom: 8, leading: 8 },
|
|
58
|
+
color: {
|
|
59
|
+
light: { type: "hex", value: "#92c91bFF" },
|
|
60
|
+
},
|
|
61
|
+
icon_background,
|
|
62
|
+
} satisfies IconProps,
|
|
63
|
+
});
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<Story name="Square" />
|
|
67
|
+
|
|
68
|
+
<Story
|
|
69
|
+
name="Rectangle"
|
|
70
|
+
args={{
|
|
71
|
+
size: {
|
|
72
|
+
width: { type: "fixed", value: 128 },
|
|
73
|
+
height: { type: "fixed", value: 64 },
|
|
74
|
+
},
|
|
75
|
+
}}
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
<Story
|
|
79
|
+
name="Circle"
|
|
80
|
+
args={{
|
|
81
|
+
icon_background: {
|
|
82
|
+
...icon_background,
|
|
83
|
+
shape: { type: "circle" },
|
|
84
|
+
},
|
|
85
|
+
}}
|
|
86
|
+
/>
|
|
87
|
+
|
|
88
|
+
<Story
|
|
89
|
+
name="Pill"
|
|
90
|
+
args={{
|
|
91
|
+
size: {
|
|
92
|
+
width: { type: "fixed", value: 128 },
|
|
93
|
+
height: { type: "fixed", value: 64 },
|
|
94
|
+
},
|
|
95
|
+
icon_background: {
|
|
96
|
+
...icon_background,
|
|
97
|
+
shape: { type: "circle" },
|
|
98
|
+
},
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Icon from "./Icon.svelte";
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Icon: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Icon = InstanceType<typeof Icon>;
|
|
19
|
+
export default Icon;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getColorModeContext } from "../../stores/color-mode";
|
|
3
|
+
import { getSelectedStateContext } from "../../stores/selected";
|
|
4
|
+
import type { IconProps } from "../../types/components/icon";
|
|
5
|
+
import {
|
|
6
|
+
css,
|
|
7
|
+
mapBorder,
|
|
8
|
+
mapBorderRadius,
|
|
9
|
+
mapColor,
|
|
10
|
+
mapShadow,
|
|
11
|
+
mapSize,
|
|
12
|
+
mapSpacing,
|
|
13
|
+
} from "../../utils/base-utils";
|
|
14
|
+
import { getActiveStateProps } from "../../utils/style-utils";
|
|
15
|
+
|
|
16
|
+
const props: IconProps = $props();
|
|
17
|
+
const selectedState = getSelectedStateContext();
|
|
18
|
+
const {
|
|
19
|
+
base_url,
|
|
20
|
+
formats,
|
|
21
|
+
size,
|
|
22
|
+
margin,
|
|
23
|
+
padding,
|
|
24
|
+
color,
|
|
25
|
+
icon_background: background,
|
|
26
|
+
} = $derived.by(() => {
|
|
27
|
+
return {
|
|
28
|
+
...props,
|
|
29
|
+
...getActiveStateProps($selectedState, props.overrides),
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const getColorMode = getColorModeContext();
|
|
34
|
+
const colorMode = $derived(getColorMode());
|
|
35
|
+
|
|
36
|
+
const container = $derived(
|
|
37
|
+
css({
|
|
38
|
+
width: mapSize(size.width),
|
|
39
|
+
height: mapSize(size.height),
|
|
40
|
+
margin: mapSpacing(margin),
|
|
41
|
+
padding: mapSpacing(padding),
|
|
42
|
+
"background-color": mapColor(colorMode, background?.color),
|
|
43
|
+
border: mapBorder(colorMode, background?.border),
|
|
44
|
+
"border-radius": mapBorderRadius(background?.shape),
|
|
45
|
+
"box-shadow": mapShadow(colorMode, background?.shadow),
|
|
46
|
+
flex: "0 0 auto",
|
|
47
|
+
}),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const webpUrl = $derived(`${base_url}/${formats.webp}`);
|
|
51
|
+
const icon = $derived(
|
|
52
|
+
css({
|
|
53
|
+
width: "100%",
|
|
54
|
+
height: "100%",
|
|
55
|
+
position: "relative",
|
|
56
|
+
"z-index": 1,
|
|
57
|
+
overflow: "hidden",
|
|
58
|
+
"background-color": mapColor(colorMode, color),
|
|
59
|
+
"mask-image": `url(${webpUrl})`,
|
|
60
|
+
"webkit-mask-image": `url(${webpUrl})`,
|
|
61
|
+
"mask-size": "contain",
|
|
62
|
+
"webkit-mask-size": "contain",
|
|
63
|
+
"mask-position": "center",
|
|
64
|
+
"webkit-mask-position": "center",
|
|
65
|
+
"mask-repeat": "no-repeat",
|
|
66
|
+
"webkit-mask-repeat": "no-repeat",
|
|
67
|
+
}),
|
|
68
|
+
);
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<div style={container}>
|
|
72
|
+
<div style={icon}></div>
|
|
73
|
+
</div>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ImageProps } from "../../types/components/image";
|
|
3
|
+
|
|
4
|
+
interface ClipPathProps {
|
|
5
|
+
shape: ImageProps["mask_shape"];
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { shape, width, height }: ClipPathProps = $props();
|
|
11
|
+
|
|
12
|
+
const [topLeft, topRight, bottomRight, bottomLeft] = $derived.by(() => {
|
|
13
|
+
if (shape?.type !== "rectangle") {
|
|
14
|
+
return [0, 0, 0, 0];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { corners } = shape;
|
|
18
|
+
return [
|
|
19
|
+
corners?.top_leading ?? 0,
|
|
20
|
+
corners?.top_trailing ?? 0,
|
|
21
|
+
corners?.bottom_trailing ?? 0,
|
|
22
|
+
corners?.bottom_leading ?? 0,
|
|
23
|
+
];
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
{#if shape?.type === "circle"}
|
|
28
|
+
<circle cx={width / 2} cy={height / 2} r={Math.min(width, height) / 2} />
|
|
29
|
+
{/if}
|
|
30
|
+
|
|
31
|
+
{#if shape?.type === "concave"}
|
|
32
|
+
<path
|
|
33
|
+
d={`M 0 0 L ${width} 0 L ${width} ${height} Q ${width / 2} ${height - 54} 0 ${height} Z`}
|
|
34
|
+
/>
|
|
35
|
+
{/if}
|
|
36
|
+
{#if shape?.type === "convex"}
|
|
37
|
+
<path
|
|
38
|
+
d={`M 0 0 L ${width} 0 L ${width} ${height - 27} Q ${width / 2} ${height + 27} 0 ${height - 27} Z`}
|
|
39
|
+
/>
|
|
40
|
+
{/if}
|
|
41
|
+
|
|
42
|
+
{#if shape?.type === "rectangle" || shape?.type === undefined}
|
|
43
|
+
<path
|
|
44
|
+
d={`M ${topLeft} 0 H ${width - topRight} A ${topRight} ${topRight} 0 0 1 ${width} ${topRight}
|
|
45
|
+
V ${height - bottomRight} A ${bottomRight} ${bottomRight} 0 0 1 ${width - bottomRight} ${height}
|
|
46
|
+
H ${bottomLeft} A ${bottomLeft} ${bottomLeft} 0 0 1 0 ${height - bottomLeft}
|
|
47
|
+
V ${topLeft} A ${topLeft} ${topLeft} 0 0 1 ${topLeft} 0 Z`}
|
|
48
|
+
/>
|
|
49
|
+
{/if}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ImageProps } from "../../types/components/image";
|
|
2
|
+
interface ClipPathProps {
|
|
3
|
+
shape: ImageProps["mask_shape"];
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
declare const ClipPath: import("svelte").Component<ClipPathProps, {}, "">;
|
|
8
|
+
type ClipPath = ReturnType<typeof ClipPath>;
|
|
9
|
+
export default ClipPath;
|