@revenuecat/purchases-ui-js 2.0.0 → 2.0.1
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/Button.svelte +1 -5
- package/dist/components/button/ButtonNode.stories.svelte +62 -70
- package/dist/components/button/ButtonNode.stories.svelte.d.ts +0 -8
- package/dist/components/button/ButtonNode.svelte +11 -19
- package/dist/components/button/ButtonNode.svelte.d.ts +2 -2
- package/dist/components/button/button-utils.d.ts +2 -2
- package/dist/components/footer/Footer.stories.svelte +30 -22
- package/dist/components/footer/Footer.stories.svelte.d.ts +0 -5
- package/dist/components/footer/Footer.svelte +3 -10
- package/dist/components/footer/Footer.svelte.d.ts +1 -1
- package/dist/components/image/Image.stories.svelte +26 -7
- package/dist/components/image/Image.svelte +17 -15
- package/dist/components/image/image-utils.d.ts +2 -1
- package/dist/components/image/image-utils.js +2 -2
- package/dist/components/package/Package.stories.svelte +31 -27
- package/dist/components/package/Package.stories.svelte.d.ts +0 -6
- package/dist/components/package/Package.svelte +18 -22
- package/dist/components/package/Package.svelte.d.ts +1 -1
- package/dist/components/paywall/Node.svelte +12 -39
- package/dist/components/paywall/Node.svelte.d.ts +4 -8
- package/dist/components/paywall/Paywall.stories.svelte +21 -78
- package/dist/components/paywall/Paywall.svelte +71 -98
- package/dist/components/paywall/Paywall.svelte.d.ts +4 -4
- package/dist/components/paywall/paywall-utils.d.ts +3 -2
- package/dist/components/paywall/paywall-utils.js +5 -5
- package/dist/components/purchase-button/PurchaseButton.stories.svelte +32 -26
- package/dist/components/purchase-button/PurchaseButton.stories.svelte.d.ts +0 -5
- package/dist/components/purchase-button/PurchaseButton.svelte +7 -11
- package/dist/components/purchase-button/PurchaseButton.svelte.d.ts +1 -1
- package/dist/components/purchase-button/purchase-button-utils.d.ts +1 -1
- package/dist/components/stack/Stack.stories.svelte +34 -79
- package/dist/components/stack/Stack.svelte +15 -25
- package/dist/components/stack/stack-utils.d.ts +4 -3
- package/dist/components/stack/stack-utils.js +7 -8
- package/dist/components/text/TextNode.stories.svelte +46 -141
- package/dist/components/text/TextNode.svelte +13 -12
- package/dist/components/text/text-utils.d.ts +7 -6
- package/dist/components/text/text-utils.js +7 -7
- package/dist/components/timeline/Timeline.stories.svelte +41 -47
- package/dist/components/timeline/TimelineItem.svelte +28 -11
- package/dist/components/timeline/timeline-utils.d.ts +3 -3
- package/dist/components/timeline/timeline-utils.js +7 -16
- package/dist/data/entities.d.ts +59 -120
- package/dist/data/state.d.ts +0 -5
- package/dist/stores/color-mode.d.ts +6 -0
- package/dist/stores/color-mode.js +15 -0
- package/dist/stores/localization.d.ts +13 -0
- package/dist/stores/localization.js +25 -0
- package/dist/stores/paywall.d.ts +10 -0
- package/dist/stores/paywall.js +13 -0
- package/dist/stores/variables.d.ts +6 -0
- package/dist/stores/variables.js +14 -0
- package/dist/stories/fixtures.js +7 -76
- package/dist/stories/localization-decorator.d.ts +3 -0
- package/dist/stories/localization-decorator.js +7 -0
- package/dist/stories/paywall-decorator.d.ts +2 -0
- package/dist/stories/paywall-decorator.js +18 -0
- package/dist/stories/variables-decorator.d.ts +3 -0
- package/dist/stories/variables-decorator.js +9 -0
- package/dist/stories/with-layout.svelte +1 -1
- package/dist/types/alignment.d.ts +19 -0
- package/dist/types/alignment.js +1 -0
- package/dist/types/background.d.ts +18 -0
- package/dist/types/background.js +1 -0
- package/dist/types/colors.d.ts +34 -0
- package/dist/types/colors.js +1 -0
- package/dist/types/components/button.d.ts +36 -0
- package/dist/types/components/button.js +1 -0
- package/dist/types/components/footer.d.ts +5 -0
- package/dist/types/components/footer.js +1 -0
- package/dist/types/components/package.d.ts +8 -0
- package/dist/types/components/package.js +1 -0
- package/dist/types/components/purchase-button.d.ts +5 -0
- package/dist/types/components/purchase-button.js +1 -0
- package/dist/types/localization.d.ts +4 -0
- package/dist/types/localization.js +1 -0
- package/dist/types/media.d.ts +18 -0
- package/dist/types/media.js +1 -0
- package/dist/types.d.ts +5 -35
- package/dist/ui/atoms/typography.stories.svelte +8 -14
- package/dist/ui/atoms/typography.svelte +1 -1
- package/dist/ui/molecules/button.stories.svelte +8 -15
- package/dist/ui/molecules/button.svelte +2 -1
- package/dist/ui/molecules/button.svelte.d.ts +2 -26
- package/dist/ui/molecules/types.d.ts +2 -1
- package/dist/utils/style-utils.d.ts +13 -11
- package/dist/utils/style-utils.js +8 -15
- package/dist/utils/variable-utils.d.ts +1 -38
- package/dist/utils/variable-utils.js +6 -48
- package/dist/web-components/index.js +519 -566
- package/package.json +33 -36
- package/dist/stores/theme.d.ts +0 -1
- package/dist/stores/theme.js +0 -17
|
@@ -9,19 +9,30 @@
|
|
|
9
9
|
sizeStoryMeta,
|
|
10
10
|
stackDimensionStoryMeta,
|
|
11
11
|
} from "../../stories/meta-templates";
|
|
12
|
-
import { labelsData
|
|
12
|
+
import { labelsData } from "../../stories/fixtures";
|
|
13
13
|
import type { PurchaseState } from "../../data/state";
|
|
14
14
|
import type { PaywallComponent } from "../../data/entities";
|
|
15
15
|
import {
|
|
16
16
|
DEFAULT_BACKGROUND_COLOR,
|
|
17
|
-
DEFAULT_COLOR_MODE,
|
|
18
17
|
DEFAULT_TEXT_COLOR,
|
|
19
18
|
} from "../../utils/constants";
|
|
19
|
+
import { localizationDecorator } from "../../stories/localization-decorator";
|
|
20
|
+
|
|
21
|
+
const defaultLocale = Object.keys(labelsData)[0];
|
|
22
|
+
|
|
23
|
+
const purchaseState: PurchaseState = {};
|
|
20
24
|
|
|
21
25
|
const { Story } = defineMeta({
|
|
22
26
|
title: "Components/Stack",
|
|
23
27
|
component: Stack,
|
|
24
28
|
tags: ["autodocs"],
|
|
29
|
+
decorators: [
|
|
30
|
+
localizationDecorator({
|
|
31
|
+
defaultLocale,
|
|
32
|
+
localizations: labelsData,
|
|
33
|
+
}),
|
|
34
|
+
],
|
|
35
|
+
args: { purchaseState },
|
|
25
36
|
argTypes: {
|
|
26
37
|
dimension: stackDimensionStoryMeta,
|
|
27
38
|
spacing: {
|
|
@@ -37,12 +48,6 @@
|
|
|
37
48
|
},
|
|
38
49
|
});
|
|
39
50
|
|
|
40
|
-
const purchaseState: PurchaseState = {
|
|
41
|
-
locale: "en_US",
|
|
42
|
-
defaultLocale: "en_US",
|
|
43
|
-
colorMode: DEFAULT_COLOR_MODE,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
51
|
const components: PaywallComponent[] = [
|
|
47
52
|
{
|
|
48
53
|
type: "text",
|
|
@@ -59,7 +64,6 @@
|
|
|
59
64
|
dark: { type: "alias", value: "transparent" },
|
|
60
65
|
light: { type: "alias", value: "transparent" },
|
|
61
66
|
},
|
|
62
|
-
purchaseState,
|
|
63
67
|
},
|
|
64
68
|
{
|
|
65
69
|
type: "text",
|
|
@@ -76,7 +80,6 @@
|
|
|
76
80
|
dark: { type: "alias", value: "transparent" },
|
|
77
81
|
light: { type: "alias", value: "transparent" },
|
|
78
82
|
},
|
|
79
|
-
purchaseState,
|
|
80
83
|
},
|
|
81
84
|
{
|
|
82
85
|
type: "text",
|
|
@@ -93,7 +96,6 @@
|
|
|
93
96
|
dark: { type: "alias", value: "transparent" },
|
|
94
97
|
light: { type: "alias", value: "transparent" },
|
|
95
98
|
},
|
|
96
|
-
purchaseState,
|
|
97
99
|
},
|
|
98
100
|
];
|
|
99
101
|
</script>
|
|
@@ -103,9 +105,7 @@
|
|
|
103
105
|
name="Vertical Stack"
|
|
104
106
|
args={{
|
|
105
107
|
type: "stack",
|
|
106
|
-
purchaseState,
|
|
107
108
|
size: { width: { type: "fill" }, height: { type: "fill" } },
|
|
108
|
-
labels,
|
|
109
109
|
dimension: {
|
|
110
110
|
type: "vertical",
|
|
111
111
|
alignment: "center",
|
|
@@ -125,13 +125,11 @@
|
|
|
125
125
|
name="Horizontal Stack"
|
|
126
126
|
args={{
|
|
127
127
|
type: "stack",
|
|
128
|
-
purchaseState,
|
|
129
128
|
dimension: {
|
|
130
129
|
type: "horizontal",
|
|
131
130
|
alignment: "center",
|
|
132
131
|
distribution: "space_between",
|
|
133
132
|
},
|
|
134
|
-
labels,
|
|
135
133
|
components,
|
|
136
134
|
spacing: 16,
|
|
137
135
|
padding: { top: 16, trailing: 16, bottom: 16, leading: 16 },
|
|
@@ -147,13 +145,11 @@
|
|
|
147
145
|
name="Space Around"
|
|
148
146
|
args={{
|
|
149
147
|
type: "stack",
|
|
150
|
-
purchaseState,
|
|
151
148
|
dimension: {
|
|
152
149
|
type: "horizontal",
|
|
153
150
|
alignment: "center",
|
|
154
151
|
distribution: "space_around",
|
|
155
152
|
},
|
|
156
|
-
labels,
|
|
157
153
|
components,
|
|
158
154
|
spacing: 16,
|
|
159
155
|
padding: { top: 16, trailing: 16, bottom: 16, leading: 16 },
|
|
@@ -169,14 +165,12 @@
|
|
|
169
165
|
name="Background Colors"
|
|
170
166
|
args={{
|
|
171
167
|
type: "stack",
|
|
172
|
-
purchaseState,
|
|
173
168
|
dimension: {
|
|
174
169
|
type: "vertical",
|
|
175
170
|
alignment: "center",
|
|
176
171
|
distribution: "start",
|
|
177
172
|
},
|
|
178
173
|
components,
|
|
179
|
-
labels,
|
|
180
174
|
background_color: {
|
|
181
175
|
light: { type: "hex", value: "#C8E6FF" },
|
|
182
176
|
dark: { type: "hex", value: "#C8E6FF" },
|
|
@@ -192,14 +186,12 @@
|
|
|
192
186
|
name="Border Styles"
|
|
193
187
|
args={{
|
|
194
188
|
type: "stack",
|
|
195
|
-
purchaseState,
|
|
196
189
|
dimension: {
|
|
197
190
|
type: "vertical",
|
|
198
191
|
alignment: "center",
|
|
199
192
|
distribution: "start",
|
|
200
193
|
},
|
|
201
194
|
components,
|
|
202
|
-
labels,
|
|
203
195
|
border: {
|
|
204
196
|
width: 2,
|
|
205
197
|
color: {
|
|
@@ -227,14 +219,12 @@
|
|
|
227
219
|
name="Rounded Corners"
|
|
228
220
|
args={{
|
|
229
221
|
type: "stack",
|
|
230
|
-
purchaseState,
|
|
231
222
|
dimension: {
|
|
232
223
|
type: "vertical",
|
|
233
224
|
alignment: "center",
|
|
234
225
|
distribution: "start",
|
|
235
226
|
},
|
|
236
227
|
components,
|
|
237
|
-
labels,
|
|
238
228
|
shape: {
|
|
239
229
|
type: "rectangle",
|
|
240
230
|
corners: {
|
|
@@ -259,14 +249,12 @@
|
|
|
259
249
|
name="Fixed Size"
|
|
260
250
|
args={{
|
|
261
251
|
type: "stack",
|
|
262
|
-
purchaseState,
|
|
263
252
|
dimension: {
|
|
264
253
|
type: "vertical",
|
|
265
254
|
alignment: "center",
|
|
266
255
|
distribution: "start",
|
|
267
256
|
},
|
|
268
257
|
components,
|
|
269
|
-
labels,
|
|
270
258
|
size: {
|
|
271
259
|
width: { type: "fixed", value: 300 },
|
|
272
260
|
height: { type: "fixed", value: 200 },
|
|
@@ -300,8 +288,6 @@
|
|
|
300
288
|
distribution: "start",
|
|
301
289
|
},
|
|
302
290
|
components,
|
|
303
|
-
purchaseState,
|
|
304
|
-
labels,
|
|
305
291
|
border: {
|
|
306
292
|
width: 2,
|
|
307
293
|
color: {
|
|
@@ -328,7 +314,6 @@
|
|
|
328
314
|
name="Badge - Nested"
|
|
329
315
|
args={{
|
|
330
316
|
type: "stack",
|
|
331
|
-
purchaseState,
|
|
332
317
|
dimension: {
|
|
333
318
|
type: "zlayer",
|
|
334
319
|
alignment: "center",
|
|
@@ -336,8 +321,7 @@
|
|
|
336
321
|
components: [
|
|
337
322
|
{
|
|
338
323
|
type: "stack",
|
|
339
|
-
|
|
340
|
-
purchaseState,
|
|
324
|
+
|
|
341
325
|
dimension: {
|
|
342
326
|
type: "zlayer",
|
|
343
327
|
alignment: "center",
|
|
@@ -352,8 +336,7 @@
|
|
|
352
336
|
},
|
|
353
337
|
{
|
|
354
338
|
type: "stack",
|
|
355
|
-
|
|
356
|
-
purchaseState,
|
|
339
|
+
|
|
357
340
|
dimension: {
|
|
358
341
|
type: "zlayer",
|
|
359
342
|
alignment: "center",
|
|
@@ -395,8 +378,7 @@
|
|
|
395
378
|
},
|
|
396
379
|
{
|
|
397
380
|
type: "stack",
|
|
398
|
-
|
|
399
|
-
purchaseState,
|
|
381
|
+
|
|
400
382
|
dimension: {
|
|
401
383
|
type: "zlayer",
|
|
402
384
|
alignment: "center",
|
|
@@ -438,8 +420,7 @@
|
|
|
438
420
|
},
|
|
439
421
|
{
|
|
440
422
|
type: "stack",
|
|
441
|
-
|
|
442
|
-
purchaseState,
|
|
423
|
+
|
|
443
424
|
dimension: {
|
|
444
425
|
type: "zlayer",
|
|
445
426
|
alignment: "center",
|
|
@@ -481,8 +462,7 @@
|
|
|
481
462
|
},
|
|
482
463
|
{
|
|
483
464
|
type: "stack",
|
|
484
|
-
|
|
485
|
-
purchaseState,
|
|
465
|
+
|
|
486
466
|
dimension: {
|
|
487
467
|
type: "zlayer",
|
|
488
468
|
alignment: "center",
|
|
@@ -524,8 +504,7 @@
|
|
|
524
504
|
},
|
|
525
505
|
{
|
|
526
506
|
type: "stack",
|
|
527
|
-
|
|
528
|
-
purchaseState,
|
|
507
|
+
|
|
529
508
|
dimension: {
|
|
530
509
|
type: "zlayer",
|
|
531
510
|
alignment: "center",
|
|
@@ -567,8 +546,7 @@
|
|
|
567
546
|
},
|
|
568
547
|
{
|
|
569
548
|
type: "stack",
|
|
570
|
-
|
|
571
|
-
purchaseState,
|
|
549
|
+
|
|
572
550
|
dimension: {
|
|
573
551
|
type: "zlayer",
|
|
574
552
|
alignment: "center",
|
|
@@ -610,8 +588,7 @@
|
|
|
610
588
|
},
|
|
611
589
|
{
|
|
612
590
|
type: "stack",
|
|
613
|
-
|
|
614
|
-
purchaseState,
|
|
591
|
+
|
|
615
592
|
dimension: {
|
|
616
593
|
type: "zlayer",
|
|
617
594
|
alignment: "center",
|
|
@@ -653,8 +630,7 @@
|
|
|
653
630
|
},
|
|
654
631
|
{
|
|
655
632
|
type: "stack",
|
|
656
|
-
|
|
657
|
-
purchaseState,
|
|
633
|
+
|
|
658
634
|
dimension: {
|
|
659
635
|
type: "zlayer",
|
|
660
636
|
alignment: "center",
|
|
@@ -695,7 +671,6 @@
|
|
|
695
671
|
},
|
|
696
672
|
},
|
|
697
673
|
],
|
|
698
|
-
labels,
|
|
699
674
|
border: {
|
|
700
675
|
width: 2,
|
|
701
676
|
color: {
|
|
@@ -724,7 +699,6 @@
|
|
|
724
699
|
name="Badge - Overlaid"
|
|
725
700
|
args={{
|
|
726
701
|
type: "stack",
|
|
727
|
-
purchaseState,
|
|
728
702
|
dimension: {
|
|
729
703
|
type: "zlayer",
|
|
730
704
|
alignment: "center",
|
|
@@ -732,8 +706,7 @@
|
|
|
732
706
|
components: [
|
|
733
707
|
{
|
|
734
708
|
type: "stack",
|
|
735
|
-
|
|
736
|
-
purchaseState,
|
|
709
|
+
|
|
737
710
|
dimension: {
|
|
738
711
|
type: "zlayer",
|
|
739
712
|
alignment: "center",
|
|
@@ -748,8 +721,7 @@
|
|
|
748
721
|
},
|
|
749
722
|
{
|
|
750
723
|
type: "stack",
|
|
751
|
-
|
|
752
|
-
purchaseState,
|
|
724
|
+
|
|
753
725
|
dimension: {
|
|
754
726
|
type: "zlayer",
|
|
755
727
|
alignment: "center",
|
|
@@ -791,8 +763,7 @@
|
|
|
791
763
|
},
|
|
792
764
|
{
|
|
793
765
|
type: "stack",
|
|
794
|
-
|
|
795
|
-
purchaseState,
|
|
766
|
+
|
|
796
767
|
dimension: {
|
|
797
768
|
type: "zlayer",
|
|
798
769
|
alignment: "center",
|
|
@@ -834,8 +805,7 @@
|
|
|
834
805
|
},
|
|
835
806
|
{
|
|
836
807
|
type: "stack",
|
|
837
|
-
|
|
838
|
-
purchaseState,
|
|
808
|
+
|
|
839
809
|
dimension: {
|
|
840
810
|
type: "zlayer",
|
|
841
811
|
alignment: "center",
|
|
@@ -877,8 +847,7 @@
|
|
|
877
847
|
},
|
|
878
848
|
{
|
|
879
849
|
type: "stack",
|
|
880
|
-
|
|
881
|
-
purchaseState,
|
|
850
|
+
|
|
882
851
|
dimension: {
|
|
883
852
|
type: "zlayer",
|
|
884
853
|
alignment: "center",
|
|
@@ -920,8 +889,7 @@
|
|
|
920
889
|
},
|
|
921
890
|
{
|
|
922
891
|
type: "stack",
|
|
923
|
-
|
|
924
|
-
purchaseState,
|
|
892
|
+
|
|
925
893
|
dimension: {
|
|
926
894
|
type: "zlayer",
|
|
927
895
|
alignment: "center",
|
|
@@ -963,8 +931,7 @@
|
|
|
963
931
|
},
|
|
964
932
|
{
|
|
965
933
|
type: "stack",
|
|
966
|
-
|
|
967
|
-
purchaseState,
|
|
934
|
+
|
|
968
935
|
dimension: {
|
|
969
936
|
type: "zlayer",
|
|
970
937
|
alignment: "center",
|
|
@@ -1005,7 +972,6 @@
|
|
|
1005
972
|
},
|
|
1006
973
|
},
|
|
1007
974
|
],
|
|
1008
|
-
labels,
|
|
1009
975
|
border: {
|
|
1010
976
|
width: 2,
|
|
1011
977
|
color: {
|
|
@@ -1034,7 +1000,6 @@
|
|
|
1034
1000
|
name="Badge - edge-to-edge top centered"
|
|
1035
1001
|
args={{
|
|
1036
1002
|
type: "stack",
|
|
1037
|
-
purchaseState,
|
|
1038
1003
|
dimension: {
|
|
1039
1004
|
type: "vertical",
|
|
1040
1005
|
alignment: "center",
|
|
@@ -1045,7 +1010,6 @@
|
|
|
1045
1010
|
dark: { type: "hex", value: DEFAULT_BACKGROUND_COLOR },
|
|
1046
1011
|
},
|
|
1047
1012
|
components,
|
|
1048
|
-
labels,
|
|
1049
1013
|
border: {
|
|
1050
1014
|
width: 2,
|
|
1051
1015
|
color: {
|
|
@@ -1102,7 +1066,6 @@
|
|
|
1102
1066
|
name="Badge - edge-to-edge bottom centered"
|
|
1103
1067
|
args={{
|
|
1104
1068
|
type: "stack",
|
|
1105
|
-
purchaseState,
|
|
1106
1069
|
dimension: {
|
|
1107
1070
|
type: "vertical",
|
|
1108
1071
|
alignment: "center",
|
|
@@ -1113,7 +1076,6 @@
|
|
|
1113
1076
|
dark: { type: "hex", value: DEFAULT_BACKGROUND_COLOR },
|
|
1114
1077
|
},
|
|
1115
1078
|
components,
|
|
1116
|
-
labels,
|
|
1117
1079
|
border: {
|
|
1118
1080
|
width: 2,
|
|
1119
1081
|
color: {
|
|
@@ -1170,7 +1132,6 @@
|
|
|
1170
1132
|
name="Badge - edge-to-edge side centered"
|
|
1171
1133
|
args={{
|
|
1172
1134
|
type: "stack",
|
|
1173
|
-
purchaseState,
|
|
1174
1135
|
dimension: {
|
|
1175
1136
|
type: "zlayer",
|
|
1176
1137
|
alignment: "center",
|
|
@@ -1181,8 +1142,7 @@
|
|
|
1181
1142
|
components: [
|
|
1182
1143
|
{
|
|
1183
1144
|
type: "stack",
|
|
1184
|
-
|
|
1185
|
-
purchaseState,
|
|
1145
|
+
|
|
1186
1146
|
dimension: {
|
|
1187
1147
|
type: "zlayer",
|
|
1188
1148
|
alignment: "center",
|
|
@@ -1197,8 +1157,7 @@
|
|
|
1197
1157
|
},
|
|
1198
1158
|
{
|
|
1199
1159
|
type: "stack",
|
|
1200
|
-
|
|
1201
|
-
purchaseState,
|
|
1160
|
+
|
|
1202
1161
|
dimension: {
|
|
1203
1162
|
type: "zlayer",
|
|
1204
1163
|
alignment: "center",
|
|
@@ -1256,8 +1215,7 @@
|
|
|
1256
1215
|
},
|
|
1257
1216
|
{
|
|
1258
1217
|
type: "stack",
|
|
1259
|
-
|
|
1260
|
-
purchaseState,
|
|
1218
|
+
|
|
1261
1219
|
dimension: {
|
|
1262
1220
|
type: "zlayer",
|
|
1263
1221
|
alignment: "center",
|
|
@@ -1315,8 +1273,7 @@
|
|
|
1315
1273
|
},
|
|
1316
1274
|
{
|
|
1317
1275
|
type: "stack",
|
|
1318
|
-
|
|
1319
|
-
purchaseState,
|
|
1276
|
+
|
|
1320
1277
|
dimension: {
|
|
1321
1278
|
type: "zlayer",
|
|
1322
1279
|
alignment: "center",
|
|
@@ -1374,8 +1331,7 @@
|
|
|
1374
1331
|
},
|
|
1375
1332
|
{
|
|
1376
1333
|
type: "stack",
|
|
1377
|
-
|
|
1378
|
-
purchaseState,
|
|
1334
|
+
|
|
1379
1335
|
dimension: {
|
|
1380
1336
|
type: "zlayer",
|
|
1381
1337
|
alignment: "center",
|
|
@@ -1432,7 +1388,6 @@
|
|
|
1432
1388
|
},
|
|
1433
1389
|
},
|
|
1434
1390
|
],
|
|
1435
|
-
labels,
|
|
1436
1391
|
border: {
|
|
1437
1392
|
width: 2,
|
|
1438
1393
|
color: {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { StackProps } from "../../data/entities";
|
|
3
2
|
import Node from "../paywall/Node.svelte";
|
|
4
3
|
import {
|
|
5
4
|
getBadgeStyles,
|
|
@@ -8,37 +7,40 @@
|
|
|
8
7
|
getZStackChildStyles,
|
|
9
8
|
} from "./stack-utils";
|
|
10
9
|
import Text from "../text/Text.svelte";
|
|
11
|
-
import {
|
|
10
|
+
import type { StackProps } from "../../data/entities";
|
|
11
|
+
import { getColorModeContext } from "../../stores/color-mode";
|
|
12
|
+
import { getLocalizationContext } from "../../stores/localization";
|
|
13
|
+
import { getVariablesContext } from "../../stores/variables";
|
|
14
|
+
import { replaceVariables } from "../../utils/variable-utils";
|
|
12
15
|
|
|
13
16
|
const {
|
|
14
17
|
id,
|
|
15
18
|
components,
|
|
16
19
|
labels,
|
|
17
|
-
onAction,
|
|
18
20
|
purchaseState,
|
|
19
|
-
variableDictionary,
|
|
20
21
|
badge,
|
|
21
22
|
zStackChildStyles,
|
|
22
23
|
...restProps
|
|
23
24
|
}: StackProps = $props();
|
|
24
25
|
|
|
26
|
+
const getColorMode = getColorModeContext();
|
|
27
|
+
const colorMode = $derived(getColorMode());
|
|
28
|
+
|
|
25
29
|
const stackStyles = $derived(
|
|
26
|
-
getStackComponentStyles({
|
|
30
|
+
getStackComponentStyles(colorMode, {
|
|
27
31
|
id,
|
|
28
32
|
components,
|
|
29
33
|
labels,
|
|
30
|
-
onAction,
|
|
31
34
|
purchaseState,
|
|
32
35
|
zStackChildStyles,
|
|
33
36
|
...restProps,
|
|
34
37
|
}),
|
|
35
38
|
);
|
|
36
39
|
const badgeStyles = $derived(
|
|
37
|
-
getBadgeStyles({
|
|
40
|
+
getBadgeStyles(colorMode, {
|
|
38
41
|
id,
|
|
39
42
|
components,
|
|
40
43
|
labels,
|
|
41
|
-
onAction,
|
|
42
44
|
purchaseState,
|
|
43
45
|
badge,
|
|
44
46
|
...restProps,
|
|
@@ -50,29 +52,23 @@
|
|
|
50
52
|
id,
|
|
51
53
|
components,
|
|
52
54
|
labels,
|
|
53
|
-
onAction,
|
|
54
55
|
purchaseState,
|
|
55
56
|
...restProps,
|
|
56
57
|
}),
|
|
57
58
|
);
|
|
59
|
+
|
|
60
|
+
const variables = getVariablesContext();
|
|
61
|
+
const { getLocalizedString } = getLocalizationContext();
|
|
58
62
|
const label = $derived(
|
|
59
|
-
|
|
60
|
-
defaultLocale: purchaseState.defaultLocale,
|
|
61
|
-
locale: purchaseState.locale,
|
|
62
|
-
labels,
|
|
63
|
-
variableDictionary,
|
|
64
|
-
text_lid: badge?.text_lid,
|
|
65
|
-
}),
|
|
63
|
+
replaceVariables(getLocalizedString(badge?.text_lid), $variables),
|
|
66
64
|
);
|
|
67
65
|
|
|
68
66
|
const { tagToRender, textStyles } = $derived(
|
|
69
|
-
getStackBadgeTextStyles({
|
|
67
|
+
getStackBadgeTextStyles(colorMode, {
|
|
70
68
|
id,
|
|
71
69
|
components,
|
|
72
70
|
labels,
|
|
73
|
-
onAction,
|
|
74
71
|
purchaseState,
|
|
75
|
-
variableDictionary,
|
|
76
72
|
badge,
|
|
77
73
|
...restProps,
|
|
78
74
|
}),
|
|
@@ -92,20 +88,14 @@
|
|
|
92
88
|
{#if zStackChildrenStyles}
|
|
93
89
|
<Node
|
|
94
90
|
nodeData={component}
|
|
95
|
-
{labels}
|
|
96
|
-
{onAction}
|
|
97
91
|
{purchaseState}
|
|
98
|
-
{variableDictionary}
|
|
99
92
|
componentState={restProps.componentState}
|
|
100
93
|
zStackChildStyles={index > 0 ? zStackChildrenStyles : undefined}
|
|
101
94
|
/>
|
|
102
95
|
{:else}
|
|
103
96
|
<Node
|
|
104
97
|
nodeData={component}
|
|
105
|
-
{labels}
|
|
106
|
-
{onAction}
|
|
107
98
|
{purchaseState}
|
|
108
|
-
{variableDictionary}
|
|
109
99
|
componentState={restProps.componentState}
|
|
110
100
|
/>
|
|
111
101
|
{/if}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { StackProps } from "../../data/entities";
|
|
2
|
+
import type { ColorMode } from "../../types";
|
|
2
3
|
/**
|
|
3
4
|
* Generates comprehensive styles for stack components by combining component, dimension and size styles
|
|
4
5
|
* @param props - Stack component properties including background, spacing, size, border etc.
|
|
5
6
|
* @returns CSS style variables object with all stack-specific styles
|
|
6
7
|
*/
|
|
7
|
-
export declare const getStackComponentStyles: (props: StackProps) => string;
|
|
8
|
+
export declare const getStackComponentStyles: (colorMode: ColorMode, props: StackProps) => string;
|
|
8
9
|
/**
|
|
9
10
|
* Generates styles for badge component within a stack
|
|
10
11
|
* @param props - Stack component properties containing badge configuration
|
|
11
12
|
* @returns CSS style object with badge-specific styles including positioning, dimensions and appearance
|
|
12
13
|
*/
|
|
13
|
-
export declare function getBadgeStyles(props: StackProps): string;
|
|
14
|
+
export declare function getBadgeStyles(colorMode: ColorMode, props: StackProps): string;
|
|
14
15
|
/**
|
|
15
16
|
* Generates text styles and HTML tag for a stack's badge component
|
|
16
17
|
* @param props - Stack component properties containing badge configuration
|
|
@@ -18,7 +19,7 @@ export declare function getBadgeStyles(props: StackProps): string;
|
|
|
18
19
|
* - tagToRender: HTML tag to use for the badge text
|
|
19
20
|
* - textStyles: CSS styles string for the badge text
|
|
20
21
|
*/
|
|
21
|
-
export declare function getStackBadgeTextStyles(props: StackProps): {
|
|
22
|
+
export declare function getStackBadgeTextStyles(colorMode: ColorMode, props: StackProps): {
|
|
22
23
|
tagToRender: string;
|
|
23
24
|
textStyles: string;
|
|
24
25
|
};
|
|
@@ -5,8 +5,8 @@ import { getActiveStateProps, getComponentStyles, getDimensionStyle, getInsetSty
|
|
|
5
5
|
* @param props - Stack component properties including background, spacing, size, border etc.
|
|
6
6
|
* @returns CSS style variables object with all stack-specific styles
|
|
7
7
|
*/
|
|
8
|
-
export const getStackComponentStyles = (props) => {
|
|
9
|
-
const { background_color, margin, padding, spacing, size, border, shape, shadow, dimension, componentState, overrides,
|
|
8
|
+
export const getStackComponentStyles = (colorMode, props) => {
|
|
9
|
+
const { background_color, margin, padding, spacing, size, border, shape, shadow, dimension, componentState, overrides, zStackChildStyles, } = props;
|
|
10
10
|
const stackStyles = {
|
|
11
11
|
"--flex": "0 1 auto",
|
|
12
12
|
"--height": "initial",
|
|
@@ -41,7 +41,7 @@ export const getStackComponentStyles = (props) => {
|
|
|
41
41
|
margin,
|
|
42
42
|
padding,
|
|
43
43
|
border,
|
|
44
|
-
colorMode
|
|
44
|
+
colorMode,
|
|
45
45
|
shape,
|
|
46
46
|
shadow,
|
|
47
47
|
...activeStateProps,
|
|
@@ -58,7 +58,7 @@ export const getStackComponentStyles = (props) => {
|
|
|
58
58
|
* @param props - Stack component properties containing badge configuration
|
|
59
59
|
* @returns CSS style object with badge-specific styles including positioning, dimensions and appearance
|
|
60
60
|
*/
|
|
61
|
-
export function getBadgeStyles(props) {
|
|
61
|
+
export function getBadgeStyles(colorMode, props) {
|
|
62
62
|
const { badge } = props;
|
|
63
63
|
if (!badge)
|
|
64
64
|
return "";
|
|
@@ -93,7 +93,7 @@ export function getBadgeStyles(props) {
|
|
|
93
93
|
...badge,
|
|
94
94
|
background_color: badge.background_color,
|
|
95
95
|
color: badge.color,
|
|
96
|
-
colorMode
|
|
96
|
+
colorMode,
|
|
97
97
|
}));
|
|
98
98
|
if (badge.style === "overlay") {
|
|
99
99
|
// Disable vertical margin for nested & center aligned badges
|
|
@@ -211,13 +211,12 @@ function getBadgeTransformStyles(badge, verticalOffset = 0, horizontalOffset = 0
|
|
|
211
211
|
* - tagToRender: HTML tag to use for the badge text
|
|
212
212
|
* - textStyles: CSS styles string for the badge text
|
|
213
213
|
*/
|
|
214
|
-
export function getStackBadgeTextStyles(props) {
|
|
214
|
+
export function getStackBadgeTextStyles(colorMode, props) {
|
|
215
215
|
const { badge } = props;
|
|
216
216
|
if (!badge)
|
|
217
217
|
return { tagToRender: "", textStyles: "" };
|
|
218
|
-
const { tagToRender, textStyles } = getTextComponentStyles({
|
|
218
|
+
const { tagToRender, textStyles } = getTextComponentStyles(colorMode, {
|
|
219
219
|
id: props.id,
|
|
220
|
-
labels: props.labels,
|
|
221
220
|
purchaseState: props.purchaseState,
|
|
222
221
|
...badge,
|
|
223
222
|
components: [],
|