@revenuecat/purchases-ui-js 0.0.15 → 0.0.17

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 (51) hide show
  1. package/dist/components/button/Button.svelte.d.ts +4 -2
  2. package/dist/components/button/ButtonNode.stories.svelte +2 -4
  3. package/dist/components/button/ButtonNode.svelte.d.ts +1 -0
  4. package/dist/components/footer/Footer.stories.svelte +46 -156
  5. package/dist/components/footer/Footer.stories.svelte.d.ts +1 -2
  6. package/dist/components/footer/Footer.svelte +9 -0
  7. package/dist/components/footer/Footer.svelte.d.ts +1 -0
  8. package/dist/components/image/Image.stories.svelte +9 -7
  9. package/dist/components/image/Image.svelte +18 -3
  10. package/dist/components/image/Image.svelte.d.ts +1 -0
  11. package/dist/components/image/image-utils.js +5 -4
  12. package/dist/components/package/Package.stories.svelte +0 -2
  13. package/dist/components/package/Package.svelte.d.ts +1 -0
  14. package/dist/components/paywall/Node.svelte +8 -1
  15. package/dist/components/paywall/Node.svelte.d.ts +4 -2
  16. package/dist/components/paywall/Paywall.stories.svelte +79 -15
  17. package/dist/components/paywall/Paywall.svelte +41 -22
  18. package/dist/components/paywall/Paywall.svelte.d.ts +4 -0
  19. package/dist/components/purchase-button/PurchaseButton.stories.svelte +0 -2
  20. package/dist/components/purchase-button/PurchaseButton.svelte.d.ts +1 -0
  21. package/dist/components/stack/Stack.stories.svelte +0 -2
  22. package/dist/components/stack/Stack.svelte +3 -0
  23. package/dist/components/stack/Stack.svelte.d.ts +1 -0
  24. package/dist/components/stack/stack-utils.js +3 -3
  25. package/dist/components/text/Text.svelte.d.ts +4 -2
  26. package/dist/components/text/TextNode.stories.svelte +1 -2
  27. package/dist/components/text/TextNode.svelte +5 -12
  28. package/dist/components/text/TextNode.svelte.d.ts +1 -0
  29. package/dist/components/text/text-utils.d.ts +5 -2
  30. package/dist/components/text/text-utils.js +9 -9
  31. package/dist/components/timeline/Timeline.stories.svelte +640 -0
  32. package/dist/components/timeline/Timeline.stories.svelte.d.ts +19 -0
  33. package/dist/components/timeline/Timeline.svelte +40 -0
  34. package/dist/components/timeline/Timeline.svelte.d.ts +4 -0
  35. package/dist/components/timeline/TimelineItem.svelte +100 -0
  36. package/dist/components/timeline/TimelineItem.svelte.d.ts +4 -0
  37. package/dist/components/timeline/timeline-utils.d.ts +25 -0
  38. package/dist/components/timeline/timeline-utils.js +93 -0
  39. package/dist/data/entities.d.ts +62 -21
  40. package/dist/data/state.d.ts +2 -0
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.js +1 -0
  43. package/dist/stories/fixtures.d.ts +5 -0
  44. package/dist/stories/fixtures.js +4716 -33
  45. package/dist/stories/meta-templates.d.ts +0 -1
  46. package/dist/stories/meta-templates.js +0 -5
  47. package/dist/types.d.ts +12 -4
  48. package/dist/types.js +7 -0
  49. package/dist/utils/style-utils.d.ts +36 -4
  50. package/dist/utils/style-utils.js +82 -13
  51. package/package.json +27 -25
@@ -0,0 +1,640 @@
1
+ <script module lang="ts">
2
+ import { defineMeta } from "@storybook/addon-svelte-csf";
3
+ import { Timeline } from "../..";
4
+ import type { PurchaseState } from "../../data/state";
5
+ import { defaultColor } from "../text/text-utils";
6
+ import { type TimelineProps } from "../../data/entities";
7
+
8
+ const { Story } = defineMeta({
9
+ title: "Components/Timeline",
10
+ component: Timeline,
11
+ tags: ["autodocs"],
12
+ argTypes: {},
13
+ });
14
+
15
+ const purchaseState: PurchaseState = {
16
+ locale: "en_US",
17
+ defaultLocale: "en_US",
18
+ colorMode: "light",
19
+ };
20
+
21
+ const labels = {
22
+ en_US: {
23
+ asd123: "Item 1",
24
+ asd123d: "description 1",
25
+ qwe123: "Item 2",
26
+ qwe123d: "description 2",
27
+ zxc123: "Item 3",
28
+ zxc123d: "description 3",
29
+ rty123: "Item 4",
30
+ rty123d: "description 4",
31
+ fgh123: "Item 5",
32
+ fgh123d: "description 5",
33
+ case1: "Case 1",
34
+ case1d: "No spacing between connector and item",
35
+ case2: "Case 2",
36
+ case2d: "Spacing between connector and item",
37
+ case3: "Case 3",
38
+ case3d: "Spacing at bottom of connector",
39
+ case4: "Case 4",
40
+ case4d: "Spacing at top of connector",
41
+ case5: "Case 5",
42
+ case5d: "No Connector",
43
+ },
44
+ };
45
+ </script>
46
+
47
+ <!-- Timeline -->
48
+ <Story
49
+ name="Round icon"
50
+ args={{
51
+ type: "timeline",
52
+ labels,
53
+ purchaseState,
54
+ item_spacing: 32,
55
+ text_spacing: 16,
56
+ size: { width: { type: "fill" }, height: { type: "fit" } },
57
+ margin: { top: 8, trailing: 8, bottom: 8, leading: 8 },
58
+ padding: { top: 0, trailing: 0, bottom: 0, leading: 0 },
59
+ id: "timeline-1",
60
+ name: "default timeline",
61
+ items: [
62
+ {
63
+ title: {
64
+ text_lid: "asd123",
65
+ color: defaultColor,
66
+ horizontal_alignment: "center",
67
+ },
68
+ description: {
69
+ text_lid: "asd123d",
70
+ color: defaultColor,
71
+ horizontal_alignment: "center",
72
+ },
73
+ icon: {
74
+ name: "check",
75
+ color: {
76
+ light: {
77
+ type: "hex",
78
+ value: "#FAFAFA",
79
+ },
80
+ },
81
+ width_and_height: 32,
82
+ padding: 16,
83
+ },
84
+ icon_background: {
85
+ shape: { type: "circle" },
86
+ color: {
87
+ light: {
88
+ type: "hex",
89
+ value: "#3f3f3f",
90
+ },
91
+ },
92
+ },
93
+ },
94
+ {
95
+ title: {
96
+ text_lid: "qwe123",
97
+ color: defaultColor,
98
+ horizontal_alignment: "center",
99
+ },
100
+ description: {
101
+ text_lid: "qwe123d",
102
+ color: defaultColor,
103
+ horizontal_alignment: "center",
104
+ },
105
+ icon: {
106
+ name: "check",
107
+ color: {
108
+ light: {
109
+ type: "hex",
110
+ value: "#FAFAFA",
111
+ },
112
+ },
113
+ width_and_height: 32,
114
+ padding: 16,
115
+ },
116
+ icon_background: {
117
+ shape: { type: "circle" },
118
+ color: {
119
+ light: {
120
+ type: "hex",
121
+ value: "#3f3f3f",
122
+ },
123
+ },
124
+ },
125
+ },
126
+ {
127
+ title: {
128
+ text_lid: "zxc123",
129
+ color: defaultColor,
130
+ horizontal_alignment: "center",
131
+ },
132
+ description: {
133
+ text_lid: "zxc123d",
134
+ color: defaultColor,
135
+ horizontal_alignment: "center",
136
+ },
137
+ icon: {
138
+ name: "check",
139
+ color: {
140
+ light: {
141
+ type: "hex",
142
+ value: "#FAFAFA",
143
+ },
144
+ },
145
+ width_and_height: 32,
146
+ padding: 16,
147
+ },
148
+ icon_background: {
149
+ shape: { type: "circle" },
150
+ color: {
151
+ light: {
152
+ type: "hex",
153
+ value: "#3f3f3f",
154
+ },
155
+ },
156
+ },
157
+ },
158
+ ],
159
+ } satisfies TimelineProps}
160
+ />
161
+
162
+ <Story
163
+ name="Square icon"
164
+ args={{
165
+ type: "timeline",
166
+ labels,
167
+ purchaseState,
168
+ item_spacing: 32,
169
+ text_spacing: 16,
170
+ size: { width: { type: "fill" }, height: { type: "fit" } },
171
+ margin: { top: 8, trailing: 8, bottom: 8, leading: 8 },
172
+ padding: { top: 0, trailing: 0, bottom: 0, leading: 0 },
173
+ id: "timeline-1",
174
+ name: "default timeline",
175
+ items: [
176
+ {
177
+ title: {
178
+ text_lid: "asd123",
179
+ color: defaultColor,
180
+ horizontal_alignment: "center",
181
+ },
182
+ description: {
183
+ text_lid: "asd123d",
184
+ color: defaultColor,
185
+ horizontal_alignment: "center",
186
+ },
187
+ icon: {
188
+ name: "check",
189
+ color: {
190
+ light: {
191
+ type: "hex",
192
+ value: "#FAFAFA",
193
+ },
194
+ },
195
+ width_and_height: 32,
196
+ padding: 16,
197
+ },
198
+ icon_background: {
199
+ shape: {
200
+ type: "rectangle",
201
+ corners: {
202
+ top_leading: 0,
203
+ top_trailing: 0,
204
+ bottom_leading: 0,
205
+ bottom_trailing: 0,
206
+ },
207
+ },
208
+ color: {
209
+ light: {
210
+ type: "hex",
211
+ value: "#3f3f3f",
212
+ },
213
+ },
214
+ },
215
+ },
216
+ {
217
+ title: {
218
+ text_lid: "qwe123",
219
+ color: defaultColor,
220
+ horizontal_alignment: "center",
221
+ },
222
+ description: {
223
+ text_lid: "qwe123d",
224
+ color: defaultColor,
225
+ horizontal_alignment: "center",
226
+ },
227
+ icon: {
228
+ name: "check",
229
+ color: {
230
+ light: {
231
+ type: "hex",
232
+ value: "#FAFAFA",
233
+ },
234
+ },
235
+ width_and_height: 32,
236
+ padding: 16,
237
+ },
238
+ icon_background: {
239
+ shape: {
240
+ type: "rectangle",
241
+ corners: {
242
+ top_leading: 8,
243
+ top_trailing: 8,
244
+ bottom_leading: 8,
245
+ bottom_trailing: 8,
246
+ },
247
+ },
248
+ color: {
249
+ light: {
250
+ type: "hex",
251
+ value: "#3f3f3f",
252
+ },
253
+ },
254
+ },
255
+ },
256
+ {
257
+ title: {
258
+ text_lid: "zxc123",
259
+ color: defaultColor,
260
+ horizontal_alignment: "center",
261
+ },
262
+ description: {
263
+ text_lid: "zxc123d",
264
+ color: defaultColor,
265
+ horizontal_alignment: "center",
266
+ },
267
+ icon: {
268
+ name: "check",
269
+ color: {
270
+ light: {
271
+ type: "hex",
272
+ value: "#FAFAFA",
273
+ },
274
+ },
275
+ width_and_height: 32,
276
+ padding: 16,
277
+ },
278
+ icon_background: {
279
+ shape: {
280
+ type: "rectangle",
281
+ corners: {
282
+ top_leading: 16,
283
+ top_trailing: 16,
284
+ bottom_leading: 16,
285
+ bottom_trailing: 16,
286
+ },
287
+ },
288
+ color: {
289
+ light: {
290
+ type: "hex",
291
+ value: "#3f3f3f",
292
+ },
293
+ },
294
+ },
295
+ },
296
+ ],
297
+ } satisfies TimelineProps}
298
+ />
299
+ <Story
300
+ name="With connector"
301
+ args={{
302
+ type: "timeline",
303
+ labels,
304
+ purchaseState,
305
+ item_spacing: 32,
306
+ text_spacing: 16,
307
+ size: { width: { type: "fill" }, height: { type: "fit" } },
308
+ margin: { top: 8, trailing: 8, bottom: 8, leading: 8 },
309
+ padding: { top: 0, trailing: 0, bottom: 0, leading: 0 },
310
+ id: "timeline-1",
311
+ name: "default timeline",
312
+ items: [
313
+ {
314
+ title: {
315
+ text_lid: "asd123",
316
+ color: defaultColor,
317
+ horizontal_alignment: "center",
318
+ },
319
+ description: {
320
+ text_lid: "asd123d",
321
+ color: defaultColor,
322
+ horizontal_alignment: "center",
323
+ },
324
+ icon: {
325
+ name: "check",
326
+ color: {
327
+ light: {
328
+ type: "hex",
329
+ value: "#FAFAFA",
330
+ },
331
+ },
332
+ width_and_height: 32,
333
+ padding: 16,
334
+ },
335
+ icon_background: {
336
+ shape: { type: "circle" },
337
+ color: {
338
+ light: {
339
+ type: "hex",
340
+ value: "#3f3f3f",
341
+ },
342
+ },
343
+ },
344
+ connector: {
345
+ width: 8,
346
+ margin: { top: 0, bottom: 0 },
347
+ color: { light: { type: "hex", value: "#d3d3d3" } },
348
+ },
349
+ },
350
+ {
351
+ title: {
352
+ text_lid: "qwe123",
353
+ color: defaultColor,
354
+ horizontal_alignment: "center",
355
+ },
356
+ description: {
357
+ text_lid: "qwe123d",
358
+ color: defaultColor,
359
+ horizontal_alignment: "center",
360
+ },
361
+ icon: {
362
+ name: "check",
363
+ color: {
364
+ light: {
365
+ type: "hex",
366
+ value: "#FAFAFA",
367
+ },
368
+ },
369
+ width_and_height: 32,
370
+ padding: 16,
371
+ },
372
+ icon_background: {
373
+ shape: { type: "circle" },
374
+ color: {
375
+ light: {
376
+ type: "hex",
377
+ value: "#3f3f3f",
378
+ },
379
+ },
380
+ },
381
+ connector: {
382
+ width: 8,
383
+ margin: { top: 0, bottom: 0 },
384
+ color: { light: { type: "hex", value: "#d3d3d3" } },
385
+ },
386
+ },
387
+ {
388
+ title: {
389
+ text_lid: "zxc123",
390
+ color: defaultColor,
391
+ horizontal_alignment: "center",
392
+ },
393
+ description: {
394
+ text_lid: "zxc123d",
395
+ color: defaultColor,
396
+ horizontal_alignment: "center",
397
+ },
398
+ icon: {
399
+ name: "check",
400
+ color: {
401
+ light: {
402
+ type: "hex",
403
+ value: "#FAFAFA",
404
+ },
405
+ },
406
+ width_and_height: 32,
407
+ padding: 16,
408
+ },
409
+ icon_background: {
410
+ shape: { type: "circle" },
411
+ color: {
412
+ light: {
413
+ type: "hex",
414
+ value: "#3f3f3f",
415
+ },
416
+ },
417
+ },
418
+ connector: {
419
+ width: 8,
420
+ margin: { top: 0, bottom: 0 },
421
+ color: {
422
+ light: {
423
+ degrees: 180,
424
+ points: [
425
+ {
426
+ color: "#d3d3d3",
427
+ percent: 0,
428
+ },
429
+
430
+ {
431
+ color: "#d3d3d300",
432
+ percent: 100,
433
+ },
434
+ ],
435
+ type: "linear",
436
+ },
437
+ },
438
+ },
439
+ },
440
+ ],
441
+ } satisfies TimelineProps}
442
+ />
443
+
444
+ <Story
445
+ name="Connector possibilities"
446
+ args={{
447
+ type: "timeline",
448
+ labels,
449
+ purchaseState,
450
+ item_spacing: 64,
451
+ text_spacing: 8,
452
+ size: { width: { type: "fill" }, height: { type: "fit" } },
453
+ margin: { top: 8, trailing: 8, bottom: 8, leading: 8 },
454
+ padding: { top: 0, trailing: 0, bottom: 0, leading: 0 },
455
+ id: "timeline-1",
456
+ name: "default timeline",
457
+ items: [
458
+ {
459
+ title: {
460
+ text_lid: "case1",
461
+ color: defaultColor,
462
+ horizontal_alignment: "center",
463
+ },
464
+ description: {
465
+ text_lid: "case1d",
466
+ color: defaultColor,
467
+ horizontal_alignment: "center",
468
+ },
469
+ icon: {
470
+ name: "check",
471
+ color: {
472
+ light: {
473
+ type: "hex",
474
+ value: "#FAFAFA",
475
+ },
476
+ },
477
+ width_and_height: 32,
478
+ padding: 12,
479
+ },
480
+ icon_background: {
481
+ shape: { type: "circle" },
482
+ color: {
483
+ light: {
484
+ type: "hex",
485
+ value: "#3f3f3f",
486
+ },
487
+ },
488
+ },
489
+ connector: {
490
+ width: 8,
491
+ margin: { top: 0, bottom: 0 },
492
+ color: { light: { type: "hex", value: "#d3d3d3" } },
493
+ },
494
+ },
495
+ {
496
+ title: {
497
+ text_lid: "case2",
498
+ color: defaultColor,
499
+ horizontal_alignment: "center",
500
+ },
501
+ description: {
502
+ text_lid: "case2d",
503
+ color: defaultColor,
504
+ horizontal_alignment: "center",
505
+ },
506
+ icon: {
507
+ name: "check",
508
+ color: {
509
+ light: {
510
+ type: "hex",
511
+ value: "#FAFAFA",
512
+ },
513
+ },
514
+ width_and_height: 32,
515
+ padding: 12,
516
+ },
517
+ icon_background: {
518
+ shape: { type: "circle" },
519
+ color: {
520
+ light: {
521
+ type: "hex",
522
+ value: "#3f3f3f",
523
+ },
524
+ },
525
+ },
526
+ connector: {
527
+ width: 8,
528
+ margin: { top: 12, bottom: 12 },
529
+ color: { light: { type: "hex", value: "#d3d3d3" } },
530
+ },
531
+ },
532
+ {
533
+ title: {
534
+ text_lid: "case3",
535
+ color: defaultColor,
536
+ horizontal_alignment: "center",
537
+ },
538
+ description: {
539
+ text_lid: "case3d",
540
+ color: defaultColor,
541
+ horizontal_alignment: "center",
542
+ },
543
+ icon: {
544
+ name: "check",
545
+ color: {
546
+ light: {
547
+ type: "hex",
548
+ value: "#FAFAFA",
549
+ },
550
+ },
551
+ width_and_height: 32,
552
+ padding: 12,
553
+ },
554
+ icon_background: {
555
+ shape: { type: "circle" },
556
+ color: {
557
+ light: {
558
+ type: "hex",
559
+ value: "#3f3f3f",
560
+ },
561
+ },
562
+ },
563
+ connector: {
564
+ width: 8,
565
+ margin: { top: 0, bottom: 12 },
566
+ color: { light: { type: "hex", value: "#d3d3d3" } },
567
+ },
568
+ },
569
+ {
570
+ title: {
571
+ text_lid: "case4",
572
+ color: defaultColor,
573
+ horizontal_alignment: "center",
574
+ },
575
+ description: {
576
+ text_lid: "case4d",
577
+ color: defaultColor,
578
+ horizontal_alignment: "center",
579
+ },
580
+ icon: {
581
+ name: "check",
582
+ color: {
583
+ light: {
584
+ type: "hex",
585
+ value: "#FAFAFA",
586
+ },
587
+ },
588
+ width_and_height: 32,
589
+ padding: 12,
590
+ },
591
+ icon_background: {
592
+ shape: { type: "circle" },
593
+ color: {
594
+ light: {
595
+ type: "hex",
596
+ value: "#3f3f3f",
597
+ },
598
+ },
599
+ },
600
+ connector: {
601
+ width: 8,
602
+ margin: { top: 12, bottom: 0 },
603
+ color: { light: { type: "hex", value: "#d3d3d3" } },
604
+ },
605
+ },
606
+ {
607
+ title: {
608
+ text_lid: "case5",
609
+ color: defaultColor,
610
+ horizontal_alignment: "center",
611
+ },
612
+ description: {
613
+ text_lid: "case5d",
614
+ color: defaultColor,
615
+ horizontal_alignment: "center",
616
+ },
617
+ icon: {
618
+ name: "check",
619
+ color: {
620
+ light: {
621
+ type: "hex",
622
+ value: "#FAFAFA",
623
+ },
624
+ },
625
+ width_and_height: 32,
626
+ padding: 12,
627
+ },
628
+ icon_background: {
629
+ shape: { type: "circle" },
630
+ color: {
631
+ light: {
632
+ type: "hex",
633
+ value: "#3f3f3f",
634
+ },
635
+ },
636
+ },
637
+ },
638
+ ],
639
+ } satisfies TimelineProps}
640
+ />
@@ -0,0 +1,19 @@
1
+ import { Timeline } from "../..";
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 Timeline: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
16
+ [evt: string]: CustomEvent<any>;
17
+ }, {}, {}, string>;
18
+ type Timeline = InstanceType<typeof Timeline>;
19
+ export default Timeline;
@@ -0,0 +1,40 @@
1
+ <script lang="ts">
2
+ import { getTimelineStyles } from "./timeline-utils";
3
+ import TimelineItem from "./TimelineItem.svelte";
4
+ import type { TimelineProps } from "../../data/entities";
5
+ import { stringifyStyles } from "../../utils/style-utils";
6
+
7
+ const { items, ...restProps }: TimelineProps = $props();
8
+
9
+ const timelineStyles = $derived(
10
+ stringifyStyles(getTimelineStyles({ items, ...restProps })),
11
+ );
12
+ </script>
13
+
14
+ {#if items.length}
15
+ <div class="timeline-container" style={timelineStyles}>
16
+ {#each items as item, index}
17
+ <TimelineItem
18
+ {...item}
19
+ labels={restProps.labels}
20
+ id={`${restProps.id}-${index}`}
21
+ name={`${restProps.name}-${index}`}
22
+ type="timeline"
23
+ purchaseState={restProps.purchaseState}
24
+ text_spacing={restProps.text_spacing}
25
+ item_spacing={restProps.item_spacing}
26
+ />
27
+ {/each}
28
+ </div>
29
+ {/if}
30
+
31
+ <style>
32
+ .timeline-container {
33
+ display: flex;
34
+ flex: var(--flex, 0 1 auto);
35
+ flex-direction: column;
36
+ gap: var(--item-spacing, 0);
37
+ width: var(--width, unset);
38
+ height: var(--height, unset);
39
+ }
40
+ </style>
@@ -0,0 +1,4 @@
1
+ import type { TimelineProps } from "../../data/entities";
2
+ declare const Timeline: import("svelte").Component<TimelineProps, {}, "">;
3
+ type Timeline = ReturnType<typeof Timeline>;
4
+ export default Timeline;