@marianmeres/stuic 3.43.3 → 3.44.0

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.
@@ -15,13 +15,30 @@
15
15
  next: () => void;
16
16
  prev: () => void;
17
17
  skip: () => void;
18
+ //
19
+ classControls?: string;
18
20
  }
19
21
  </script>
20
22
 
21
23
  <script lang="ts">
22
24
  import Thc from "../../components/Thc/Thc.svelte";
25
+ import Button from "../../components/Button/Button.svelte";
26
+ import { iconChevronLeft, iconChevronRight, iconCheck } from "../../icons/index.js";
27
+ import { twMerge } from "../../utils/tw-merge.js";
23
28
 
24
- let { step, index, total, isFirst, isLast, labels, shell, next, prev, skip }: Props = $props();
29
+ let {
30
+ step,
31
+ index,
32
+ total,
33
+ isFirst,
34
+ isLast,
35
+ labels,
36
+ shell,
37
+ next,
38
+ prev,
39
+ skip,
40
+ classControls,
41
+ }: Props = $props();
25
42
 
26
43
  const context: TourShellContext = $derived({
27
44
  step,
@@ -33,6 +50,16 @@
33
50
  prev,
34
51
  skip,
35
52
  });
53
+
54
+ const BUTTON_CLS = "p-0";
55
+
56
+ const BUTTON_PROPS = {
57
+ aspect1: true,
58
+ variant: "soft",
59
+ roundedFull: true,
60
+ };
61
+
62
+ const ICON_SIZE = 24;
36
63
  </script>
37
64
 
38
65
  {#if shell}
@@ -56,15 +83,25 @@
56
83
  </button>
57
84
  {/if}
58
85
  {#if !isFirst}
59
- <button class="stuic-onboarding-btn-prev" onclick={prev}>
60
- {step.prevLabel ?? labels.prev}
61
- </button>
86
+ <Button
87
+ onclick={prev}
88
+ class={twMerge(BUTTON_CLS, classControls)}
89
+ {...BUTTON_PROPS}
90
+ >
91
+ {@html iconChevronLeft({ size: ICON_SIZE })}
92
+ </Button>
62
93
  {/if}
63
- <button class="stuic-onboarding-btn-next" onclick={next}>
64
- {isLast
65
- ? (step.finishLabel ?? labels.finish)
66
- : (step.nextLabel ?? labels.next)}
67
- </button>
94
+ <Button
95
+ onclick={next}
96
+ class={twMerge(BUTTON_CLS, classControls)}
97
+ {...BUTTON_PROPS}
98
+ intent="primary"
99
+ variant="solid"
100
+ >
101
+ {@html isLast
102
+ ? iconCheck({ size: ICON_SIZE })
103
+ : iconChevronRight({ size: ICON_SIZE })}
104
+ </Button>
68
105
  </div>
69
106
  </div>
70
107
  </div>
@@ -13,6 +13,7 @@ export interface Props {
13
13
  next: () => void;
14
14
  prev: () => void;
15
15
  skip: () => void;
16
+ classControls?: string;
16
17
  }
17
18
  declare const OnboardingShell: import("svelte").Component<Props, {}, "">;
18
19
  type OnboardingShell = ReturnType<typeof OnboardingShell>;
@@ -1,23 +1,19 @@
1
1
  /* Onboarding shell tokens */
2
2
  :root {
3
+ --stuic-onboarding-shell-bg: var(--stuic-color-background, #fff);
3
4
  --stuic-onboarding-shell-padding: calc(var(--spacing) * 3);
4
5
  --stuic-onboarding-shell-gap: calc(var(--spacing) * 2);
5
6
  --stuic-onboarding-shell-min-width: 200px;
6
7
  --stuic-onboarding-shell-max-width: 320px;
7
8
  --stuic-onboarding-title-size: var(--text-base);
8
9
  --stuic-onboarding-content-size: var(--text-sm);
9
- --stuic-onboarding-footer-gap: calc(var(--spacing) * 1.5);
10
+ --stuic-onboarding-footer-gap: calc(var(--spacing) * 3);
10
11
  --stuic-onboarding-steps-size: var(--text-xs);
11
- --stuic-onboarding-btn-padding-x: calc(var(--spacing) * 2.5);
12
- --stuic-onboarding-btn-padding-y: calc(var(--spacing) * 1);
13
- --stuic-onboarding-btn-radius: calc(var(--spacing) * 1);
14
12
  --stuic-onboarding-btn-font-size: var(--text-xs);
15
- --stuic-onboarding-btn-primary-bg: var(--stuic-color-primary, #737373);
16
- --stuic-onboarding-btn-primary-fg: var(--stuic-color-primary-foreground, #fff);
17
- --stuic-onboarding-btn-secondary-bg: oklch(from currentColor l c h / 0.08);
18
13
  }
19
14
 
20
15
  .stuic-onboarding-shell {
16
+ background: var(--stuic-onboarding-shell-bg);
21
17
  display: flex;
22
18
  flex-direction: column;
23
19
  gap: var(--stuic-onboarding-shell-gap);
@@ -41,9 +37,7 @@
41
37
  align-items: center;
42
38
  justify-content: space-between;
43
39
  gap: calc(var(--spacing) * 2);
44
- padding-top: calc(var(--spacing) * 2);
45
- margin-top: calc(var(--spacing) * 1);
46
- border-top: 1px solid var(--stuic-spotlight-annotation-border, rgba(0, 0, 0, 0.1));
40
+ margin-top: calc(var(--spacing) * 2);
47
41
  }
48
42
 
49
43
  .stuic-onboarding-steps {
@@ -57,37 +51,14 @@
57
51
  gap: var(--stuic-onboarding-footer-gap);
58
52
  }
59
53
 
60
- /* Shared button base */
61
- .stuic-onboarding-btn-skip,
62
- .stuic-onboarding-btn-prev,
63
- .stuic-onboarding-btn-next {
54
+ .stuic-onboarding-btn-skip {
64
55
  font-size: var(--stuic-onboarding-btn-font-size);
65
- padding: var(--stuic-onboarding-btn-padding-y) var(--stuic-onboarding-btn-padding-x);
66
- border-radius: var(--stuic-onboarding-btn-radius);
67
56
  line-height: 1.5;
57
+ opacity: 0.45;
68
58
  transition:
69
59
  opacity 0.15s,
70
60
  filter 0.15s;
71
- }
72
-
73
- .stuic-onboarding-btn-skip {
74
- opacity: 0.45;
75
61
  &:hover {
76
62
  opacity: 0.85;
77
63
  }
78
64
  }
79
-
80
- .stuic-onboarding-btn-prev {
81
- background: var(--stuic-onboarding-btn-secondary-bg);
82
- &:hover {
83
- filter: brightness(0.9);
84
- }
85
- }
86
-
87
- .stuic-onboarding-btn-next {
88
- background: var(--stuic-onboarding-btn-primary-bg);
89
- color: var(--stuic-onboarding-btn-primary-fg);
90
- &:hover {
91
- filter: brightness(0.9);
92
- }
93
- }
@@ -164,6 +164,8 @@ export function createTour(options) {
164
164
  }
165
165
  // -- Public API ---------------------------------------------------------------------
166
166
  function start() {
167
+ if (active)
168
+ return;
167
169
  if (store && store.has(options.storageKey))
168
170
  return;
169
171
  options.onStart?.();
@@ -530,9 +530,9 @@
530
530
  <div
531
531
  class={SLIDE_PANEL_CLASS}
532
532
  style="transition-duration: {slidePhase === 'sliding' ? slideDuration : 0}ms;"
533
- class:translate-x-0={slidePhase === 'setup'}
534
- class:-translate-x-full={slidePhase === 'sliding' && slideDirection === 'next'}
535
- class:translate-x-full={slidePhase === 'sliding' && slideDirection === 'prev'}
533
+ class:translate-x-0={slidePhase === "setup"}
534
+ class:-translate-x-full={slidePhase === "sliding" && slideDirection === "next"}
535
+ class:translate-x-full={slidePhase === "sliding" && slideDirection === "prev"}
536
536
  >
537
537
  {@render staticAssetPanel(outgoingAsset)}
538
538
  </div>
@@ -542,9 +542,9 @@
542
542
  <div
543
543
  class={SLIDE_PANEL_CLASS}
544
544
  style="transition-duration: {slidePhase === 'sliding' ? slideDuration : 0}ms;"
545
- class:translate-x-0={slidePhase === 'idle' || slidePhase === 'sliding'}
546
- class:translate-x-full={slidePhase === 'setup' && slideDirection === 'next'}
547
- class:-translate-x-full={slidePhase === 'setup' && slideDirection === 'prev'}
545
+ class:translate-x-0={slidePhase === "idle" || slidePhase === "sliding"}
546
+ class:translate-x-full={slidePhase === "setup" && slideDirection === "next"}
547
+ class:-translate-x-full={slidePhase === "setup" && slideDirection === "prev"}
548
548
  >
549
549
  {#if previewAsset.isImage}
550
550
  <div
@@ -608,12 +608,17 @@
608
608
  class="absolute inset-0 flex items-center justify-center pointer-events-none"
609
609
  transition:fade={{ duration: 150 }}
610
610
  >
611
- <SpinnerCircleOscillate class="size-10 text-(--stuic-color-muted-foreground)" />
611
+ <SpinnerCircleOscillate
612
+ class="size-10 text-(--stuic-color-muted-foreground)"
613
+ />
612
614
  </div>
613
615
  {/if}
614
616
  </div>
615
617
  {:else}
616
- <div use:swipeable class="w-full h-full flex flex-col items-center justify-center">
618
+ <div
619
+ use:swipeable
620
+ class="w-full h-full flex flex-col items-center justify-center"
621
+ >
617
622
  <div>
618
623
  {@html getAssetIcon(previewAsset.ext)({
619
624
  size: 32,
@@ -629,7 +634,12 @@
629
634
  </div>
630
635
 
631
636
  {#if assets?.length > 1 && !noPrevNext}
632
- <div class={twMerge("absolute inset-0 flex justify-between pointer-events-none", prevNextBottom ? "items-end pb-4" : "items-center")}>
637
+ <div
638
+ class={twMerge(
639
+ "absolute inset-0 flex justify-between pointer-events-none",
640
+ prevNextBottom ? "items-end pb-4" : "items-center"
641
+ )}
642
+ >
633
643
  <Button
634
644
  class={twMerge(BUTTON_CLS, "ml-4", classControls)}
635
645
  onclick={previous}
@@ -705,7 +715,10 @@
705
715
  type="button"
706
716
  onclick={(e) => {
707
717
  e.preventDefault();
708
- forceDownload(resolveUrl(String(previewAsset.url.original), baseUrl), previewAsset?.name || "");
718
+ forceDownload(
719
+ resolveUrl(String(previewAsset.url.original), baseUrl),
720
+ previewAsset?.name || ""
721
+ );
709
722
  }}
710
723
  aria-label={t("download")}
711
724
  tooltip={t("download")}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "3.43.3",
3
+ "version": "3.44.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",