@marianmeres/stuic 3.167.0 → 3.168.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.
Files changed (103) hide show
  1. package/AGENTS.md +6 -6
  2. package/dist/attachments/index.d.ts +1 -0
  3. package/dist/attachments/index.js +1 -0
  4. package/dist/attachments/long-press.d.ts +43 -0
  5. package/dist/attachments/long-press.js +107 -0
  6. package/dist/components/Breadcrumbs/Breadcrumbs.svelte +198 -0
  7. package/dist/components/Breadcrumbs/Breadcrumbs.svelte.d.ts +60 -0
  8. package/dist/components/Breadcrumbs/README.md +174 -0
  9. package/dist/components/Breadcrumbs/i18n-sk.d.ts +17 -0
  10. package/dist/components/Breadcrumbs/i18n-sk.js +19 -0
  11. package/dist/components/Breadcrumbs/i18n.d.ts +31 -0
  12. package/dist/components/Breadcrumbs/i18n.js +40 -0
  13. package/dist/components/Breadcrumbs/index.css +84 -0
  14. package/dist/components/Breadcrumbs/index.d.ts +4 -0
  15. package/dist/components/Breadcrumbs/index.js +4 -0
  16. package/dist/components/Breadcrumbs/json-ld.d.ts +58 -0
  17. package/dist/components/Breadcrumbs/json-ld.js +56 -0
  18. package/dist/components/Collapsible/Collapsible.svelte +84 -15
  19. package/dist/components/Collapsible/Collapsible.svelte.d.ts +29 -2
  20. package/dist/components/Collapsible/README.md +82 -23
  21. package/dist/components/Collapsible/index.css +38 -0
  22. package/dist/components/Collapsible/index.d.ts +1 -1
  23. package/dist/components/ContextMenu/ContextMenu.svelte +302 -0
  24. package/dist/components/ContextMenu/ContextMenu.svelte.d.ts +94 -0
  25. package/dist/components/ContextMenu/README.md +159 -0
  26. package/dist/components/ContextMenu/i18n-sk.d.ts +17 -0
  27. package/dist/components/ContextMenu/i18n-sk.js +18 -0
  28. package/dist/components/ContextMenu/i18n.d.ts +30 -0
  29. package/dist/components/ContextMenu/i18n.js +38 -0
  30. package/dist/components/ContextMenu/index.css +26 -0
  31. package/dist/components/ContextMenu/index.d.ts +3 -0
  32. package/dist/components/ContextMenu/index.js +3 -0
  33. package/dist/components/CopyButton/CopyButton.svelte +278 -0
  34. package/dist/components/CopyButton/CopyButton.svelte.d.ts +76 -0
  35. package/dist/components/CopyButton/README.md +241 -0
  36. package/dist/components/CopyButton/i18n-sk.d.ts +17 -0
  37. package/dist/components/CopyButton/i18n-sk.js +20 -0
  38. package/dist/components/CopyButton/i18n.d.ts +35 -0
  39. package/dist/components/CopyButton/i18n.js +43 -0
  40. package/dist/components/CopyButton/index.css +67 -0
  41. package/dist/components/CopyButton/index.d.ts +3 -0
  42. package/dist/components/CopyButton/index.js +3 -0
  43. package/dist/components/DataTable/DataTable.svelte +41 -34
  44. package/dist/components/DataTable/README.md +45 -0
  45. package/dist/components/DataTable/i18n-sk.js +1 -0
  46. package/dist/components/DataTable/i18n.d.ts +1 -0
  47. package/dist/components/DataTable/i18n.js +3 -0
  48. package/dist/components/DataTable/index.css +41 -3
  49. package/dist/components/EmptyState/EmptyState.svelte +121 -0
  50. package/dist/components/EmptyState/EmptyState.svelte.d.ts +40 -0
  51. package/dist/components/EmptyState/README.md +188 -0
  52. package/dist/components/EmptyState/index.css +154 -0
  53. package/dist/components/EmptyState/index.d.ts +1 -0
  54. package/dist/components/EmptyState/index.js +1 -0
  55. package/dist/components/Pagination/Pagination.svelte +250 -0
  56. package/dist/components/Pagination/Pagination.svelte.d.ts +69 -0
  57. package/dist/components/Pagination/README.md +152 -0
  58. package/dist/components/Pagination/i18n-sk.d.ts +17 -0
  59. package/dist/components/Pagination/i18n-sk.js +24 -0
  60. package/dist/components/Pagination/i18n.d.ts +41 -0
  61. package/dist/components/Pagination/i18n.js +49 -0
  62. package/dist/components/Pagination/index.css +50 -0
  63. package/dist/components/Pagination/index.d.ts +4 -0
  64. package/dist/components/Pagination/index.js +4 -0
  65. package/dist/components/Pagination/pagination-range.d.ts +21 -0
  66. package/dist/components/Pagination/pagination-range.js +41 -0
  67. package/dist/components/Stat/README.md +157 -0
  68. package/dist/components/Stat/Stat.svelte +226 -0
  69. package/dist/components/Stat/Stat.svelte.d.ts +54 -0
  70. package/dist/components/Stat/index.css +217 -0
  71. package/dist/components/Stat/index.d.ts +1 -0
  72. package/dist/components/Stat/index.js +1 -0
  73. package/dist/components/Stepper/README.md +181 -0
  74. package/dist/components/Stepper/Stepper.svelte +240 -0
  75. package/dist/components/Stepper/Stepper.svelte.d.ts +86 -0
  76. package/dist/components/Stepper/i18n-sk.d.ts +17 -0
  77. package/dist/components/Stepper/i18n-sk.js +21 -0
  78. package/dist/components/Stepper/i18n.d.ts +35 -0
  79. package/dist/components/Stepper/i18n.js +43 -0
  80. package/dist/components/Stepper/index.css +302 -0
  81. package/dist/components/Stepper/index.d.ts +3 -0
  82. package/dist/components/Stepper/index.js +3 -0
  83. package/dist/components/TrendChart/README.md +123 -0
  84. package/dist/components/TrendChart/TrendChart.svelte +114 -0
  85. package/dist/components/TrendChart/TrendChart.svelte.d.ts +36 -0
  86. package/dist/components/TrendChart/index.css +51 -0
  87. package/dist/components/TrendChart/index.d.ts +1 -0
  88. package/dist/components/TrendChart/index.js +1 -0
  89. package/dist/icons/index.d.ts +4 -0
  90. package/dist/icons/index.js +4 -0
  91. package/dist/index.css +7 -0
  92. package/dist/index.d.ts +7 -0
  93. package/dist/index.js +12 -0
  94. package/dist/utils/copy-to-clipboard.d.ts +43 -0
  95. package/dist/utils/copy-to-clipboard.js +102 -0
  96. package/dist/utils/index.d.ts +1 -0
  97. package/dist/utils/index.js +1 -0
  98. package/docs/architecture.md +1 -1
  99. package/docs/domains/attachments.md +41 -4
  100. package/docs/domains/components.md +280 -13
  101. package/docs/domains/utils.md +8 -6
  102. package/docs/maybe-todo.md +111 -0
  103. package/package.json +11 -1
@@ -0,0 +1,240 @@
1
+ <script lang="ts" module>
2
+ import type { HTMLAttributes } from "svelte/elements";
3
+ import type { Snippet } from "svelte";
4
+ import type { THC } from "../Thc/Thc.svelte";
5
+ import type { TranslateFn } from "../../types.js";
6
+
7
+ export type StepperOrientation = "horizontal" | "vertical";
8
+
9
+ export type StepperLabelPosition = "end" | "below";
10
+
11
+ export type StepperStepState = "completed" | "current" | "upcoming";
12
+
13
+ export type StepperClickable = "none" | "completed" | "all";
14
+
15
+ export interface StepperStep {
16
+ /** Step label */
17
+ label: THC;
18
+ /** Optional secondary line under the label */
19
+ description?: THC;
20
+ /**
21
+ * Raw svg/html string rendered inside the indicator instead of the step number
22
+ * (e.g. an `@marianmeres/icons-fns` render result). Completed/error markers
23
+ * still take precedence.
24
+ */
25
+ icon?: string;
26
+ /** Marks the step as failed — destructive coloring + "×" indicator */
27
+ error?: boolean;
28
+ /** Never clickable, regardless of the `clickable` policy */
29
+ disabled?: boolean;
30
+ }
31
+
32
+ export interface Props extends Omit<HTMLAttributes<HTMLElement>, "children"> {
33
+ /** The steps to render. Plain strings are shorthand for `{ label }`. */
34
+ steps: (StepperStep | string)[];
35
+ /**
36
+ * Zero-based index of the current step (default 0) — aligns with
37
+ * `@marianmeres/wizard`'s `step.index`. Steps before it render as completed,
38
+ * steps after it as upcoming. Pass `steps.length` to mark every step
39
+ * completed (wizard done). Out-of-range values are clamped.
40
+ */
41
+ current?: number;
42
+ /**
43
+ * Navigation callback. When provided (and `clickable` is not "none"), steps
44
+ * render as buttons and eligible ones fire this on click. The current step
45
+ * never fires.
46
+ */
47
+ onSelect?: (index: number, step: StepperStep) => void;
48
+ /**
49
+ * Which steps may be clicked when `onSelect` is present. `"completed"`
50
+ * (default): only completed steps — the "go back and revisit" wizard rule.
51
+ * `"all"`: any non-disabled step. `"none"`: display-only.
52
+ */
53
+ clickable?: StepperClickable;
54
+ /** Layout direction (default "horizontal") */
55
+ orientation?: StepperOrientation;
56
+ /**
57
+ * Horizontal orientation only: labels to the right of the indicator
58
+ * (`"end"`, default) or centered below it (`"below"` — the classic
59
+ * checkout header).
60
+ */
61
+ labelPosition?: StepperLabelPosition;
62
+ /** Disable all interaction (e.g. while a step is submitting) */
63
+ disabled?: boolean;
64
+ /** i18n translate function (see `createStepperT`) */
65
+ t?: TranslateFn;
66
+ /** Override the indicator bubble content */
67
+ renderIndicator?: Snippet<
68
+ [{ index: number; step: StepperStep; state: StepperStepState }]
69
+ >;
70
+ /** Skip all default styling */
71
+ unstyled?: boolean;
72
+ /** Additional CSS classes */
73
+ class?: string;
74
+ /** Class for every step item (`li`) */
75
+ classStep?: string;
76
+ /** Class for the indicator bubble */
77
+ classIndicator?: string;
78
+ /** Class for the label */
79
+ classLabel?: string;
80
+ /** Class for the description */
81
+ classDescription?: string;
82
+ /** Class for the connector line between steps */
83
+ classConnector?: string;
84
+ /** Bindable element reference */
85
+ el?: HTMLElement;
86
+ }
87
+ </script>
88
+
89
+ <script lang="ts">
90
+ import { twMerge } from "../../utils/tw-merge.js";
91
+ import Thc from "../Thc/Thc.svelte";
92
+ import { iconCheck, iconX } from "../../icons/index.js";
93
+ import { t_default } from "./i18n.js";
94
+
95
+ let {
96
+ steps,
97
+ current = 0,
98
+ onSelect,
99
+ clickable = "completed",
100
+ orientation = "horizontal",
101
+ labelPosition = "end",
102
+ disabled = false,
103
+ t = t_default,
104
+ renderIndicator,
105
+ unstyled = false,
106
+ class: classProp,
107
+ classStep: classStepProp,
108
+ classIndicator: classIndicatorProp,
109
+ classLabel: classLabelProp,
110
+ classDescription: classDescriptionProp,
111
+ classConnector: classConnectorProp,
112
+ el = $bindable(),
113
+ ...rest
114
+ }: Props = $props();
115
+
116
+ let _steps: StepperStep[] = $derived(
117
+ steps.map((s) => (typeof s === "string" ? { label: s } : s))
118
+ );
119
+
120
+ // clamped to [0, steps.length] — the extra slot means "all completed"
121
+ let _current = $derived(Math.min(Math.max(0, Math.floor(current)), _steps.length));
122
+
123
+ let _interactive = $derived(!!onSelect && clickable !== "none");
124
+
125
+ let _class = $derived(unstyled ? classProp : twMerge("stuic-stepper", classProp));
126
+ let _classStep = $derived(
127
+ unstyled ? classStepProp : twMerge("stuic-stepper-item", classStepProp)
128
+ );
129
+ let _classIndicator = $derived(
130
+ unstyled ? classIndicatorProp : twMerge("stuic-stepper-indicator", classIndicatorProp)
131
+ );
132
+ let _classLabel = $derived(
133
+ unstyled ? classLabelProp : twMerge("stuic-stepper-label", classLabelProp)
134
+ );
135
+ let _classDescription = $derived(
136
+ unstyled
137
+ ? classDescriptionProp
138
+ : twMerge("stuic-stepper-description", classDescriptionProp)
139
+ );
140
+ let _classConnector = $derived(
141
+ unstyled ? classConnectorProp : twMerge("stuic-stepper-connector", classConnectorProp)
142
+ );
143
+
144
+ function stateOf(i: number): StepperStepState {
145
+ if (i < _current) return "completed";
146
+ if (i === _current) return "current";
147
+ return "upcoming";
148
+ }
149
+
150
+ function isEligible(step: StepperStep, state: StepperStepState): boolean {
151
+ if (disabled || step.disabled || state === "current") return false;
152
+ return clickable === "all" || state === "completed";
153
+ }
154
+
155
+ function select(i: number) {
156
+ const step = _steps[i];
157
+ if (!_interactive || !isEligible(step, stateOf(i))) return;
158
+ onSelect?.(i, step);
159
+ }
160
+
161
+ // icon-only state info for screen readers ("Step 2 of 4, Completed")
162
+ function srText(i: number, step: StepperStep, state: StepperStepState): string {
163
+ const parts = [t("step_x_of_y", { step: i + 1, stepCount: _steps.length })];
164
+ if (step.error) parts.push(t("failed"));
165
+ else if (state === "completed") parts.push(t("completed"));
166
+ return parts.join(", ");
167
+ }
168
+ </script>
169
+
170
+ {#snippet stepInner(i: number, step: StepperStep, state: StepperStepState)}
171
+ <span class={_classIndicator} aria-hidden="true">
172
+ {#if renderIndicator}
173
+ {@render renderIndicator({ index: i, step, state })}
174
+ {:else if step.error}
175
+ {@html iconX()}
176
+ {:else if state === "completed"}
177
+ {@html iconCheck()}
178
+ {:else if step.icon}
179
+ {@html step.icon}
180
+ {:else}
181
+ {i + 1}
182
+ {/if}
183
+ </span>
184
+ <span class="sr-only">{srText(i, step, state)}</span>
185
+ <span class={unstyled ? undefined : "stuic-stepper-text"}>
186
+ <span class={_classLabel}><Thc thc={step.label} /></span>
187
+ {#if step.description}
188
+ <span class={_classDescription}><Thc thc={step.description} /></span>
189
+ {/if}
190
+ </span>
191
+ {/snippet}
192
+
193
+ {#if _steps.length}
194
+ <nav
195
+ bind:this={el}
196
+ class={_class}
197
+ data-orientation={!unstyled ? orientation : undefined}
198
+ data-label-position={!unstyled && orientation === "horizontal"
199
+ ? labelPosition
200
+ : undefined}
201
+ data-disabled={!unstyled && disabled ? "" : undefined}
202
+ aria-label={t("stepper", null, "Progress")}
203
+ {...rest}
204
+ >
205
+ <ol class={unstyled ? undefined : "stuic-stepper-list"}>
206
+ {#each _steps as step, i (i)}
207
+ {@const state = stateOf(i)}
208
+ <li
209
+ class={_classStep}
210
+ data-state={!unstyled ? state : undefined}
211
+ data-error={!unstyled && step.error ? "" : undefined}
212
+ data-disabled={!unstyled && step.disabled ? "" : undefined}
213
+ aria-current={state === "current" ? "step" : undefined}
214
+ >
215
+ {#if _interactive}
216
+ <button
217
+ type="button"
218
+ class={unstyled ? undefined : "stuic-stepper-trigger"}
219
+ disabled={!isEligible(step, state)}
220
+ onclick={() => select(i)}
221
+ >
222
+ {@render stepInner(i, step, state)}
223
+ </button>
224
+ {:else}
225
+ <div class={unstyled ? undefined : "stuic-stepper-trigger"}>
226
+ {@render stepInner(i, step, state)}
227
+ </div>
228
+ {/if}
229
+ {#if i < _steps.length - 1}
230
+ <span
231
+ class={_classConnector}
232
+ data-state={!unstyled && state === "completed" ? "completed" : undefined}
233
+ aria-hidden="true"
234
+ ></span>
235
+ {/if}
236
+ </li>
237
+ {/each}
238
+ </ol>
239
+ </nav>
240
+ {/if}
@@ -0,0 +1,86 @@
1
+ import type { HTMLAttributes } from "svelte/elements";
2
+ import type { Snippet } from "svelte";
3
+ import type { THC } from "../Thc/Thc.svelte";
4
+ import type { TranslateFn } from "../../types.js";
5
+ export type StepperOrientation = "horizontal" | "vertical";
6
+ export type StepperLabelPosition = "end" | "below";
7
+ export type StepperStepState = "completed" | "current" | "upcoming";
8
+ export type StepperClickable = "none" | "completed" | "all";
9
+ export interface StepperStep {
10
+ /** Step label */
11
+ label: THC;
12
+ /** Optional secondary line under the label */
13
+ description?: THC;
14
+ /**
15
+ * Raw svg/html string rendered inside the indicator instead of the step number
16
+ * (e.g. an `@marianmeres/icons-fns` render result). Completed/error markers
17
+ * still take precedence.
18
+ */
19
+ icon?: string;
20
+ /** Marks the step as failed — destructive coloring + "×" indicator */
21
+ error?: boolean;
22
+ /** Never clickable, regardless of the `clickable` policy */
23
+ disabled?: boolean;
24
+ }
25
+ export interface Props extends Omit<HTMLAttributes<HTMLElement>, "children"> {
26
+ /** The steps to render. Plain strings are shorthand for `{ label }`. */
27
+ steps: (StepperStep | string)[];
28
+ /**
29
+ * Zero-based index of the current step (default 0) — aligns with
30
+ * `@marianmeres/wizard`'s `step.index`. Steps before it render as completed,
31
+ * steps after it as upcoming. Pass `steps.length` to mark every step
32
+ * completed (wizard done). Out-of-range values are clamped.
33
+ */
34
+ current?: number;
35
+ /**
36
+ * Navigation callback. When provided (and `clickable` is not "none"), steps
37
+ * render as buttons and eligible ones fire this on click. The current step
38
+ * never fires.
39
+ */
40
+ onSelect?: (index: number, step: StepperStep) => void;
41
+ /**
42
+ * Which steps may be clicked when `onSelect` is present. `"completed"`
43
+ * (default): only completed steps — the "go back and revisit" wizard rule.
44
+ * `"all"`: any non-disabled step. `"none"`: display-only.
45
+ */
46
+ clickable?: StepperClickable;
47
+ /** Layout direction (default "horizontal") */
48
+ orientation?: StepperOrientation;
49
+ /**
50
+ * Horizontal orientation only: labels to the right of the indicator
51
+ * (`"end"`, default) or centered below it (`"below"` — the classic
52
+ * checkout header).
53
+ */
54
+ labelPosition?: StepperLabelPosition;
55
+ /** Disable all interaction (e.g. while a step is submitting) */
56
+ disabled?: boolean;
57
+ /** i18n translate function (see `createStepperT`) */
58
+ t?: TranslateFn;
59
+ /** Override the indicator bubble content */
60
+ renderIndicator?: Snippet<[
61
+ {
62
+ index: number;
63
+ step: StepperStep;
64
+ state: StepperStepState;
65
+ }
66
+ ]>;
67
+ /** Skip all default styling */
68
+ unstyled?: boolean;
69
+ /** Additional CSS classes */
70
+ class?: string;
71
+ /** Class for every step item (`li`) */
72
+ classStep?: string;
73
+ /** Class for the indicator bubble */
74
+ classIndicator?: string;
75
+ /** Class for the label */
76
+ classLabel?: string;
77
+ /** Class for the description */
78
+ classDescription?: string;
79
+ /** Class for the connector line between steps */
80
+ classConnector?: string;
81
+ /** Bindable element reference */
82
+ el?: HTMLElement;
83
+ }
84
+ declare const Stepper: import("svelte").Component<Props, {}, "el">;
85
+ type Stepper = ReturnType<typeof Stepper>;
86
+ export default Stepper;
@@ -0,0 +1,17 @@
1
+ import type { StepperMessages } from "./i18n.js";
2
+ /**
3
+ * Slovak message catalog for `Stepper`. Opt-in — English stays the built-in default,
4
+ * and this module is only pulled into a bundle when it is actually imported (the
5
+ * component itself never references it).
6
+ *
7
+ * @example
8
+ * ```svelte
9
+ * <script>
10
+ * import { Stepper, createStepperT, STEPPER_MESSAGES_SK } from "@marianmeres/stuic";
11
+ * const t = createStepperT(STEPPER_MESSAGES_SK);
12
+ * </script>
13
+ *
14
+ * <Stepper {steps} {current} {t} />
15
+ * ```
16
+ */
17
+ export declare const STEPPER_MESSAGES_SK: StepperMessages;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Slovak message catalog for `Stepper`. Opt-in — English stays the built-in default,
3
+ * and this module is only pulled into a bundle when it is actually imported (the
4
+ * component itself never references it).
5
+ *
6
+ * @example
7
+ * ```svelte
8
+ * <script>
9
+ * import { Stepper, createStepperT, STEPPER_MESSAGES_SK } from "@marianmeres/stuic";
10
+ * const t = createStepperT(STEPPER_MESSAGES_SK);
11
+ * </script>
12
+ *
13
+ * <Stepper {steps} {current} {t} />
14
+ * ```
15
+ */
16
+ export const STEPPER_MESSAGES_SK = {
17
+ stepper: "Priebeh",
18
+ step_x_of_y: "Krok {step} z {stepCount}",
19
+ completed: "Dokončený",
20
+ failed: "Zlyhal",
21
+ };
@@ -0,0 +1,35 @@
1
+ import type { TranslateFn } from "../../types.js";
2
+ /**
3
+ * The built-in (English) message catalog of `Stepper`. Also the fallback of every
4
+ * other bundled locale, so a locale missing a key still renders text.
5
+ *
6
+ * Placeholders are single-brace (`{step}`, `{stepCount}`).
7
+ */
8
+ export declare const STEPPER_MESSAGES_EN: {
9
+ stepper: string;
10
+ step_x_of_y: string;
11
+ completed: string;
12
+ failed: string;
13
+ };
14
+ /** Every message key `Stepper` may look up. */
15
+ export type StepperMessageKey = keyof typeof STEPPER_MESSAGES_EN;
16
+ /** A (possibly partial) catalog for one locale. */
17
+ export type StepperMessages = Record<StepperMessageKey, string>;
18
+ /**
19
+ * Builds the `t` prop of `Stepper` from a message catalog. Unknown or untranslated
20
+ * keys fall back to `fallbackMessages` (English by default), so a catalog may safely be
21
+ * partial and never renders a raw key.
22
+ *
23
+ * @example
24
+ * ```svelte
25
+ * <script>
26
+ * import { Stepper, createStepperT, STEPPER_MESSAGES_SK } from "@marianmeres/stuic";
27
+ * const t = createStepperT(STEPPER_MESSAGES_SK);
28
+ * </script>
29
+ *
30
+ * <Stepper {steps} {current} {t} />
31
+ * ```
32
+ */
33
+ export declare function createStepperT(messages: Partial<StepperMessages> | Record<string, string>, fallbackMessages?: Partial<StepperMessages> | Record<string, string>): TranslateFn;
34
+ /** The component's built-in English `t`. */
35
+ export declare const t_default: TranslateFn;
@@ -0,0 +1,43 @@
1
+ import { isPlainObject } from "../../utils/is-plain-object.js";
2
+ import { replaceMap } from "../../utils/replace-map.js";
3
+ /**
4
+ * The built-in (English) message catalog of `Stepper`. Also the fallback of every
5
+ * other bundled locale, so a locale missing a key still renders text.
6
+ *
7
+ * Placeholders are single-brace (`{step}`, `{stepCount}`).
8
+ */
9
+ export const STEPPER_MESSAGES_EN = {
10
+ stepper: "Progress",
11
+ step_x_of_y: "Step {step} of {stepCount}",
12
+ completed: "Completed",
13
+ failed: "Failed",
14
+ };
15
+ /**
16
+ * Builds the `t` prop of `Stepper` from a message catalog. Unknown or untranslated
17
+ * keys fall back to `fallbackMessages` (English by default), so a catalog may safely be
18
+ * partial and never renders a raw key.
19
+ *
20
+ * @example
21
+ * ```svelte
22
+ * <script>
23
+ * import { Stepper, createStepperT, STEPPER_MESSAGES_SK } from "@marianmeres/stuic";
24
+ * const t = createStepperT(STEPPER_MESSAGES_SK);
25
+ * </script>
26
+ *
27
+ * <Stepper {steps} {current} {t} />
28
+ * ```
29
+ */
30
+ export function createStepperT(messages, fallbackMessages = STEPPER_MESSAGES_EN) {
31
+ return (k, values = null, fallback = "") => {
32
+ const out = messages[k] ??
33
+ fallbackMessages[k] ??
34
+ (typeof fallback === "string" ? fallback : k);
35
+ return isPlainObject(values)
36
+ ? replaceMap(out, values, {
37
+ preSearchKeyTransform: (k) => `{${k}}`,
38
+ })
39
+ : out;
40
+ };
41
+ }
42
+ /** The component's built-in English `t`. */
43
+ export const t_default = createStepperT(STEPPER_MESSAGES_EN);