@krak-stack/registry 0.1.28 → 0.1.29

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.
@@ -3,11 +3,7 @@ import { Button as ButtonPrimitive } from "@base-ui/react/button";
3
3
  import { cva } from "class-variance-authority";
4
4
 
5
5
  // ../../src/lib/utils.ts
6
- import { clsx } from "clsx";
7
- import { twMerge } from "tailwind-merge";
8
- function cn(...inputs) {
9
- return twMerge(clsx(inputs));
10
- }
6
+ import { cn } from "cn";
11
7
 
12
8
  // ../../src/components/ui/button.tsx
13
9
  import { jsx } from "react/jsx-runtime";
@@ -3,11 +3,7 @@ import { Button as ButtonPrimitive } from "@base-ui/react/button";
3
3
  import { cva } from "class-variance-authority";
4
4
 
5
5
  // ../../src/lib/utils.ts
6
- import { clsx } from "clsx";
7
- import { twMerge } from "tailwind-merge";
8
- function cn(...inputs) {
9
- return twMerge(clsx(inputs));
10
- }
6
+ import { cn } from "cn";
11
7
 
12
8
  // ../../src/components/ui/button.tsx
13
9
  import { jsx } from "react/jsx-runtime";
@@ -40,11 +40,7 @@ import { useRender } from "@base-ui/react/use-render";
40
40
  import { cva } from "class-variance-authority";
41
41
 
42
42
  // ../../src/lib/utils.ts
43
- import { clsx } from "clsx";
44
- import { twMerge } from "tailwind-merge";
45
- function cn(...inputs) {
46
- return twMerge(clsx(inputs));
47
- }
43
+ import { cn } from "cn";
48
44
 
49
45
  // ../../src/components/ui/badge.tsx
50
46
  var badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
@@ -2,11 +2,7 @@
2
2
  import { SquarePen } from "lucide-react";
3
3
 
4
4
  // ../../src/lib/utils.ts
5
- import { clsx } from "clsx";
6
- import { twMerge } from "tailwind-merge";
7
- function cn(...inputs) {
8
- return twMerge(clsx(inputs));
9
- }
5
+ import { cn } from "cn";
10
6
 
11
7
  // ../../src/components/ui/label.tsx
12
8
  import { jsx } from "react/jsx-runtime";
@@ -9,11 +9,7 @@ import { Languages, Loader2, Plus, Trash } from "lucide-react";
9
9
  import { AlertDialog as AlertDialogPrimitive } from "@base-ui/react/alert-dialog";
10
10
 
11
11
  // ../../src/lib/utils.ts
12
- import { clsx } from "clsx";
13
- import { twMerge } from "tailwind-merge";
14
- function cn(...inputs) {
15
- return twMerge(clsx(inputs));
16
- }
12
+ import { cn } from "cn";
17
13
 
18
14
  // ../../src/components/ui/button.tsx
19
15
  import { Button as ButtonPrimitive } from "@base-ui/react/button";
@@ -0,0 +1,30 @@
1
+ import { type ErrorComponentProps as RouterErrorComponentProps } from "@tanstack/react-router";
2
+ export type ErrorComponentMessages = {
3
+ title: string;
4
+ description: string;
5
+ retry: string;
6
+ home: string;
7
+ copy: string;
8
+ copied: string;
9
+ copyFailed: string;
10
+ details: string;
11
+ errorLabel: string;
12
+ messageLabel: string;
13
+ pageLabel: string;
14
+ timeLabel: string;
15
+ languageLabel: string;
16
+ appLabel: string;
17
+ versionLabel: string;
18
+ referenceLabel: string;
19
+ };
20
+ export type ErrorComponentProps = RouterErrorComponentProps & {
21
+ messages?: Partial<ErrorComponentMessages>;
22
+ retryable?: boolean;
23
+ className?: string;
24
+ diagnostics?: {
25
+ app?: string;
26
+ version?: string;
27
+ reference?: string;
28
+ };
29
+ };
30
+ export declare const ErrorComponent: ({ error, messages, retryable, className, diagnostics, }: ErrorComponentProps) => import("react").JSX.Element;
@@ -0,0 +1,811 @@
1
+ // ../../src/components/ui/error-component.tsx
2
+ import {
3
+ Link,
4
+ useRouterState
5
+ } from "@tanstack/react-router";
6
+ import { CircleAlert, RefreshCw } from "lucide-react";
7
+ import { useMemo, useState as useState2 } from "react";
8
+ import { Option, Schema } from "effect";
9
+ import { HttpClientError, HttpTraceContext } from "effect/unstable/http";
10
+
11
+ // ../../src/components/ui/button.tsx
12
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
13
+ import { cva } from "class-variance-authority";
14
+
15
+ // ../../src/lib/utils.ts
16
+ import { cn } from "cn";
17
+
18
+ // ../../src/components/ui/button.tsx
19
+ import { jsx } from "react/jsx-runtime";
20
+ var buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
21
+ variants: {
22
+ variant: {
23
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
24
+ outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
25
+ secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
26
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
27
+ destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
28
+ link: "text-primary underline-offset-4 hover:underline"
29
+ },
30
+ size: {
31
+ default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
32
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
33
+ sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
34
+ lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
35
+ icon: "size-9",
36
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
37
+ "icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
38
+ "icon-lg": "size-10"
39
+ }
40
+ },
41
+ defaultVariants: {
42
+ variant: "default",
43
+ size: "default"
44
+ }
45
+ });
46
+ function Button({
47
+ className,
48
+ variant = "default",
49
+ size = "default",
50
+ ...props
51
+ }) {
52
+ return /* @__PURE__ */ jsx(ButtonPrimitive, {
53
+ "data-slot": "button",
54
+ className: cn(buttonVariants({ variant, size, className })),
55
+ ...props
56
+ });
57
+ }
58
+
59
+ // ../../src/components/ui/copy-button.tsx
60
+ import { Check, Copy, TriangleAlert } from "lucide-react";
61
+ import { useEffect, useRef, useState } from "react";
62
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
63
+ function CopyButton({
64
+ value,
65
+ valueDescription,
66
+ copyVariant = "default",
67
+ messages,
68
+ onCopied,
69
+ onCopyError,
70
+ resetDelay = 1500,
71
+ disabled,
72
+ size,
73
+ "aria-label": ariaLabel,
74
+ ...props
75
+ }) {
76
+ const [copyState, setCopyState] = useState("idle");
77
+ const copyTimeout = useRef(undefined);
78
+ const labels = {
79
+ copy: messages?.copy ?? "Copy",
80
+ copied: messages?.copied ?? "Copied",
81
+ copyFailed: messages?.copyFailed ?? "Copy failed"
82
+ };
83
+ const accessibleLabel = ariaLabel ?? (valueDescription ? `${labels.copy} ${valueDescription}` : labels.copy);
84
+ const isLarge = copyVariant === "large";
85
+ const defaultSize = copyVariant === "sm" ? "icon-xs" : isLarge ? "sm" : "icon-sm";
86
+ useEffect(() => {
87
+ return () => {
88
+ if (copyTimeout.current)
89
+ clearTimeout(copyTimeout.current);
90
+ };
91
+ }, []);
92
+ const resetCopyState = () => {
93
+ if (copyTimeout.current)
94
+ clearTimeout(copyTimeout.current);
95
+ copyTimeout.current = setTimeout(() => setCopyState("idle"), resetDelay);
96
+ };
97
+ const copy = async () => {
98
+ try {
99
+ await navigator.clipboard.writeText(value);
100
+ setCopyState("copied");
101
+ onCopied?.();
102
+ } catch (error) {
103
+ setCopyState("failed");
104
+ onCopyError?.(error instanceof Error ? error : new Error("Copy failed", { cause: error }));
105
+ }
106
+ resetCopyState();
107
+ };
108
+ const status = copyState === "copied" ? valueDescription ? `${labels.copied}: ${valueDescription}` : labels.copied : copyState === "failed" ? valueDescription ? `${labels.copyFailed}: ${valueDescription}` : labels.copyFailed : "";
109
+ return /* @__PURE__ */ jsxs(Button, {
110
+ "aria-label": accessibleLabel,
111
+ disabled,
112
+ onClick: copy,
113
+ size: size ?? defaultSize,
114
+ ...props,
115
+ children: [
116
+ /* @__PURE__ */ jsx2("span", {
117
+ "aria-live": "polite",
118
+ className: "sr-only",
119
+ role: "status",
120
+ children: status
121
+ }),
122
+ copyState === "copied" ? /* @__PURE__ */ jsx2(Check, {
123
+ "aria-hidden": "true"
124
+ }) : null,
125
+ copyState === "failed" ? /* @__PURE__ */ jsx2(TriangleAlert, {
126
+ "aria-hidden": "true"
127
+ }) : null,
128
+ copyState === "idle" ? /* @__PURE__ */ jsx2(Copy, {
129
+ "aria-hidden": "true"
130
+ }) : null,
131
+ isLarge ? /* @__PURE__ */ jsx2("span", {
132
+ children: labels.copy
133
+ }) : null
134
+ ]
135
+ });
136
+ }
137
+
138
+ // ../../src/components/ui/textarea.tsx
139
+ import { jsx as jsx3 } from "react/jsx-runtime";
140
+ function Textarea({ className, ...props }) {
141
+ return /* @__PURE__ */ jsx3("textarea", {
142
+ "data-slot": "textarea",
143
+ className: cn("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
144
+ ...props
145
+ });
146
+ }
147
+
148
+ // ../../src/components/ui/empty.tsx
149
+ import { cva as cva2 } from "class-variance-authority";
150
+ import { jsx as jsx4 } from "react/jsx-runtime";
151
+ function Empty({ className, ...props }) {
152
+ return /* @__PURE__ */ jsx4("div", {
153
+ "data-slot": "empty",
154
+ className: cn("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-lg border-dashed p-12 text-center text-balance", className),
155
+ ...props
156
+ });
157
+ }
158
+ function EmptyHeader({ className, ...props }) {
159
+ return /* @__PURE__ */ jsx4("div", {
160
+ "data-slot": "empty-header",
161
+ className: cn("flex max-w-sm flex-col items-center gap-2", className),
162
+ ...props
163
+ });
164
+ }
165
+ var emptyMediaVariants = cva2("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0", {
166
+ variants: {
167
+ variant: {
168
+ default: "bg-transparent",
169
+ icon: "flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6"
170
+ }
171
+ },
172
+ defaultVariants: {
173
+ variant: "default"
174
+ }
175
+ });
176
+ function EmptyMedia({
177
+ className,
178
+ variant = "default",
179
+ ...props
180
+ }) {
181
+ return /* @__PURE__ */ jsx4("div", {
182
+ "data-slot": "empty-icon",
183
+ "data-variant": variant,
184
+ className: cn(emptyMediaVariants({ variant, className })),
185
+ ...props
186
+ });
187
+ }
188
+ function EmptyTitle({ className, ...props }) {
189
+ return /* @__PURE__ */ jsx4("div", {
190
+ "data-slot": "empty-title",
191
+ className: cn("text-lg font-medium tracking-tight", className),
192
+ ...props
193
+ });
194
+ }
195
+ function EmptyDescription({ className, ...props }) {
196
+ return /* @__PURE__ */ jsx4("div", {
197
+ "data-slot": "empty-description",
198
+ className: cn("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className),
199
+ ...props
200
+ });
201
+ }
202
+ function EmptyContent({ className, ...props }) {
203
+ return /* @__PURE__ */ jsx4("div", {
204
+ "data-slot": "empty-content",
205
+ className: cn("flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance", className),
206
+ ...props
207
+ });
208
+ }
209
+
210
+ // ../../src/paraglide/runtime.js
211
+ import"@inlang/paraglide-js/urlpattern-polyfill";
212
+ var baseLocale = "en";
213
+ var locales = ["en", "fr"];
214
+ var cookieName = "locale";
215
+ var cookieMaxAge = 34560000;
216
+ var cookieDomain = "";
217
+ var localStorageKey = "PARAGLIDE_LOCALE";
218
+ var strategy = [
219
+ "url",
220
+ "cookie",
221
+ "preferredLanguage",
222
+ "baseLocale"
223
+ ];
224
+ var routeStrategies = [
225
+ {
226
+ match: "/api/:path(.*)?",
227
+ exclude: true
228
+ },
229
+ {
230
+ match: "/sitemap.xml",
231
+ exclude: true
232
+ },
233
+ {
234
+ match: "/llms.txt",
235
+ exclude: true
236
+ }
237
+ ];
238
+ var urlPatterns = [
239
+ {
240
+ pattern: "/:path(.*)?",
241
+ localized: [
242
+ [
243
+ "en",
244
+ "/en/:path(.*)?"
245
+ ],
246
+ [
247
+ "fr",
248
+ "/fr/:path(.*)?"
249
+ ]
250
+ ]
251
+ }
252
+ ];
253
+ var cachedRouteStrategyUrl;
254
+ var cachedRouteStrategy;
255
+ function findMatchingRouteStrategy(url) {
256
+ if (routeStrategies.length === 0) {
257
+ return;
258
+ }
259
+ const urlString = typeof url === "string" ? url : url.href;
260
+ if (cachedRouteStrategyUrl === urlString) {
261
+ return cachedRouteStrategy;
262
+ }
263
+ const urlObject = new URL(urlString, "http://dummy.com");
264
+ let match;
265
+ for (const routeStrategy of routeStrategies) {
266
+ const pattern = new URLPattern(routeStrategy.match, urlObject.href);
267
+ if (pattern.exec(urlObject.href)) {
268
+ match = routeStrategy;
269
+ break;
270
+ }
271
+ }
272
+ cachedRouteStrategyUrl = urlString;
273
+ cachedRouteStrategy = match;
274
+ return match;
275
+ }
276
+ function getStrategyForUrl(url) {
277
+ const routeStrategy = findMatchingRouteStrategy(url);
278
+ if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
279
+ return routeStrategy.strategy;
280
+ }
281
+ return strategy;
282
+ }
283
+ var serverAsyncLocalStorage = undefined;
284
+ var isServer = import.meta.env?.SSR ?? typeof window === "undefined";
285
+ var experimentalStaticLocale = undefined;
286
+ var TREE_SHAKE_COOKIE_STRATEGY_USED = true;
287
+ var TREE_SHAKE_URL_STRATEGY_USED = true;
288
+ var TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED = false;
289
+ var TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED = true;
290
+ var TREE_SHAKE_DEFAULT_URL_PATTERN_USED = false;
291
+ var TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED = false;
292
+ globalThis.__paraglide = globalThis.__paraglide ?? {};
293
+ globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
294
+ var _locale;
295
+ var localeInitiallySet = false;
296
+ var getLocale = () => {
297
+ if (experimentalStaticLocale !== undefined) {
298
+ return experimentalStaticLocale;
299
+ }
300
+ if (serverAsyncLocalStorage) {
301
+ const locale = serverAsyncLocalStorage?.getStore()?.locale;
302
+ if (locale) {
303
+ return locale;
304
+ }
305
+ }
306
+ let strategyToUse = strategy;
307
+ if (!isServer && typeof window !== "undefined" && window.location?.href) {
308
+ strategyToUse = getStrategyForUrl(window.location.href);
309
+ }
310
+ const resolved = resolveLocaleWithStrategies(strategyToUse, typeof window !== "undefined" ? window.location?.href : undefined);
311
+ if (resolved) {
312
+ if (!localeInitiallySet) {
313
+ _locale = resolved;
314
+ localeInitiallySet = true;
315
+ setLocale(resolved, { reload: false });
316
+ }
317
+ return resolved;
318
+ }
319
+ throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
320
+ };
321
+ function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
322
+ let locale;
323
+ for (const strat of strategyToUse) {
324
+ if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
325
+ locale = extractLocaleFromCookie();
326
+ } else if (strat === "baseLocale") {
327
+ locale = baseLocale;
328
+ } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && !isServer && typeof urlForUrlStrategy === "string") {
329
+ locale = extractLocaleFromUrl(urlForUrlStrategy);
330
+ } else if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable" && _locale !== undefined) {
331
+ locale = _locale;
332
+ } else if (TREE_SHAKE_PREFERRED_LANGUAGE_STRATEGY_USED && strat === "preferredLanguage" && !isServer) {
333
+ locale = extractLocaleFromNavigator();
334
+ } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && !isServer) {
335
+ locale = localStorage.getItem(localStorageKey) ?? undefined;
336
+ } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
337
+ const handler = customClientStrategies.get(strat);
338
+ if (handler) {
339
+ const result = handler.getLocale();
340
+ if (result instanceof Promise) {
341
+ continue;
342
+ }
343
+ if (result !== undefined) {
344
+ return assertIsLocale(result);
345
+ }
346
+ }
347
+ }
348
+ const matchedLocale = toLocale(locale);
349
+ if (matchedLocale) {
350
+ return matchedLocale;
351
+ }
352
+ }
353
+ return;
354
+ }
355
+ var rtlLanguages = new Set([
356
+ "ar",
357
+ "dv",
358
+ "fa",
359
+ "he",
360
+ "ks",
361
+ "ku",
362
+ "ps",
363
+ "sd",
364
+ "ug",
365
+ "ur",
366
+ "yi"
367
+ ]);
368
+ var navigateOrReload = (newLocation) => {
369
+ if (newLocation) {
370
+ window.location.href = newLocation;
371
+ } else {
372
+ window.location.reload();
373
+ }
374
+ };
375
+ var setLocale = (newLocale, options) => {
376
+ const optionsWithDefaults = {
377
+ reload: true,
378
+ ...options
379
+ };
380
+ let currentLocale;
381
+ try {
382
+ currentLocale = getLocale();
383
+ } catch {}
384
+ const customSetLocalePromises = [];
385
+ let newLocation = undefined;
386
+ let strategyToUse = strategy;
387
+ if (!isServer && typeof window !== "undefined" && window.location?.href) {
388
+ strategyToUse = getStrategyForUrl(window.location.href);
389
+ }
390
+ for (const strat of strategyToUse) {
391
+ if (TREE_SHAKE_GLOBAL_VARIABLE_STRATEGY_USED && strat === "globalVariable") {
392
+ _locale = newLocale;
393
+ } else if (TREE_SHAKE_COOKIE_STRATEGY_USED && strat === "cookie") {
394
+ if (isServer || typeof document === "undefined" || typeof window === "undefined") {
395
+ continue;
396
+ }
397
+ const cookieString = `${cookieName}=${newLocale}; path=/; max-age=${cookieMaxAge}`;
398
+ document.cookie = cookieDomain ? `${cookieString}; domain=${cookieDomain}` : cookieString;
399
+ } else if (strat === "baseLocale") {
400
+ continue;
401
+ } else if (TREE_SHAKE_URL_STRATEGY_USED && strat === "url" && typeof window !== "undefined") {
402
+ newLocation = localizeUrl(window.location.href, {
403
+ locale: newLocale
404
+ }).href;
405
+ } else if (TREE_SHAKE_LOCAL_STORAGE_STRATEGY_USED && strat === "localStorage" && typeof window !== "undefined") {
406
+ localStorage.setItem(localStorageKey, newLocale);
407
+ } else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
408
+ const handler = customClientStrategies.get(strat);
409
+ if (handler) {
410
+ let result = handler.setLocale(newLocale);
411
+ if (result instanceof Promise) {
412
+ result = result.catch((error) => {
413
+ throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
414
+ cause: error
415
+ });
416
+ });
417
+ customSetLocalePromises.push(result);
418
+ }
419
+ }
420
+ }
421
+ }
422
+ const runReload = () => {
423
+ if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
424
+ navigateOrReload(newLocation);
425
+ }
426
+ };
427
+ if (customSetLocalePromises.length) {
428
+ return Promise.all(customSetLocalePromises).then(() => {
429
+ runReload();
430
+ });
431
+ }
432
+ runReload();
433
+ return;
434
+ };
435
+ var getUrlOrigin = () => {
436
+ if (serverAsyncLocalStorage) {
437
+ return serverAsyncLocalStorage.getStore()?.origin ?? "http://fallback.com";
438
+ } else if (typeof window !== "undefined") {
439
+ return window.location.origin;
440
+ }
441
+ return "http://fallback.com";
442
+ };
443
+ function toLocale(value) {
444
+ if (typeof value !== "string") {
445
+ return;
446
+ }
447
+ const lowerValue = value.toLowerCase();
448
+ for (const locale of locales) {
449
+ if (locale.toLowerCase() === lowerValue) {
450
+ return locale;
451
+ }
452
+ }
453
+ return;
454
+ }
455
+ function assertIsLocale(input) {
456
+ const locale = toLocale(input);
457
+ if (locale)
458
+ return locale;
459
+ throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
460
+ }
461
+ function extractLocaleFromCookie() {
462
+ if (typeof document === "undefined" || !document.cookie) {
463
+ return;
464
+ }
465
+ const match = document.cookie.match(new RegExp(`(^| )${cookieName}=([^;]+)`));
466
+ const locale = match?.[2];
467
+ return toLocale(locale);
468
+ }
469
+ function extractLocaleFromNavigator() {
470
+ if (!navigator?.languages?.length) {
471
+ return;
472
+ }
473
+ const languages = navigator.languages.map((lang) => ({
474
+ fullTag: lang,
475
+ baseTag: lang.split("-")[0]
476
+ }));
477
+ for (const lang of languages) {
478
+ const fullLocale = toLocale(lang.fullTag);
479
+ if (fullLocale) {
480
+ return fullLocale;
481
+ }
482
+ const baseLocale2 = toLocale(lang.baseTag);
483
+ if (baseLocale2) {
484
+ return baseLocale2;
485
+ }
486
+ }
487
+ return;
488
+ }
489
+ var cachedUrl;
490
+ var cachedLocale;
491
+ function extractLocaleFromUrl(url) {
492
+ const urlString = typeof url === "string" ? url : url.href;
493
+ if (cachedUrl === urlString) {
494
+ return cachedLocale;
495
+ }
496
+ let result;
497
+ if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
498
+ result = defaultUrlPatternExtractLocale(url);
499
+ } else {
500
+ const urlObj = typeof url === "string" ? new URL(url) : url;
501
+ for (const element of urlPatterns) {
502
+ for (const [locale, localizedPattern] of element.localized) {
503
+ const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
504
+ if (match) {
505
+ result = locale;
506
+ break;
507
+ }
508
+ }
509
+ if (result)
510
+ break;
511
+ }
512
+ }
513
+ cachedUrl = urlString;
514
+ cachedLocale = result;
515
+ return result;
516
+ }
517
+ function defaultUrlPatternExtractLocale(url) {
518
+ const urlObj = new URL(url, "http://dummy.com");
519
+ const pathSegments = urlObj.pathname.split("/").filter(Boolean);
520
+ return toLocale(pathSegments[0]) || baseLocale;
521
+ }
522
+ function localizeUrl(url, options) {
523
+ const targetLocale = options?.locale ? assertIsLocale(options?.locale) : getLocale();
524
+ if (TREE_SHAKE_DEFAULT_URL_PATTERN_USED) {
525
+ return localizeUrlDefaultPattern(url, targetLocale);
526
+ }
527
+ const urlObj = typeof url === "string" ? new URL(url) : url;
528
+ for (const element of urlPatterns) {
529
+ for (const [, localizedPattern] of element.localized) {
530
+ const match = new URLPattern(localizedPattern, urlObj.href).exec(urlObj.href);
531
+ if (!match) {
532
+ continue;
533
+ }
534
+ const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
535
+ if (!targetPattern) {
536
+ continue;
537
+ }
538
+ const localizedUrl = fillPattern(targetPattern, aggregateGroups(match), urlObj.origin);
539
+ return fillMissingUrlParts(localizedUrl, match);
540
+ }
541
+ const unlocalizedMatch = new URLPattern(element.pattern, urlObj.href).exec(urlObj.href);
542
+ if (unlocalizedMatch) {
543
+ const targetPattern = element.localized.find(([locale]) => locale === targetLocale)?.[1];
544
+ if (targetPattern) {
545
+ const localizedUrl = fillPattern(targetPattern, aggregateGroups(unlocalizedMatch), urlObj.origin);
546
+ return fillMissingUrlParts(localizedUrl, unlocalizedMatch);
547
+ }
548
+ }
549
+ }
550
+ return urlObj;
551
+ }
552
+ function localizeUrlDefaultPattern(url, locale) {
553
+ const urlObj = typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url);
554
+ const currentLocale = extractLocaleFromUrl(urlObj);
555
+ if (currentLocale === locale) {
556
+ return urlObj;
557
+ }
558
+ const pathSegments = urlObj.pathname.split("/").filter(Boolean);
559
+ if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
560
+ pathSegments.shift();
561
+ }
562
+ if (locale === baseLocale) {
563
+ urlObj.pathname = "/" + pathSegments.join("/");
564
+ } else {
565
+ urlObj.pathname = "/" + locale + "/" + pathSegments.join("/");
566
+ }
567
+ return urlObj;
568
+ }
569
+ function fillMissingUrlParts(url, match) {
570
+ if (match.protocol.groups["0"]) {
571
+ url.protocol = match.protocol.groups["0"] ?? "";
572
+ }
573
+ if (match.hostname.groups["0"]) {
574
+ url.hostname = match.hostname.groups["0"] ?? "";
575
+ }
576
+ if (match.username.groups["0"]) {
577
+ url.username = match.username.groups["0"] ?? "";
578
+ }
579
+ if (match.password.groups["0"]) {
580
+ url.password = match.password.groups["0"] ?? "";
581
+ }
582
+ if (match.port.groups["0"]) {
583
+ url.port = match.port.groups["0"] ?? "";
584
+ }
585
+ if (match.pathname.groups["0"]) {
586
+ url.pathname = match.pathname.groups["0"] ?? "";
587
+ }
588
+ if (match.search.groups["0"]) {
589
+ url.search = match.search.groups["0"] ?? "";
590
+ }
591
+ if (match.hash.groups["0"]) {
592
+ url.hash = match.hash.groups["0"] ?? "";
593
+ }
594
+ return url;
595
+ }
596
+ function fillPattern(pattern, values, origin) {
597
+ let processedPattern = pattern.replace(/(https?:\/\/[^:/]+):(\d+)(\/|$)/g, (_, protocol, port, slash) => {
598
+ return `${protocol}#PORT-${port}#${slash}`;
599
+ });
600
+ let processedGroupDelimiters = processedPattern.replace(/\{([^{}]*)\}([?+*]?)/g, (_, content, modifier) => {
601
+ if (modifier === "?") {
602
+ return content;
603
+ }
604
+ return content;
605
+ });
606
+ let filled = processedGroupDelimiters.replace(/(\/?):([a-zA-Z0-9_]+)(\([^)]*\))?([?+*]?)/g, (_, slash, name, __, modifier) => {
607
+ const value = values[name];
608
+ if (value === null) {
609
+ return "";
610
+ }
611
+ if (modifier === "?") {
612
+ return value !== undefined ? `${slash}${value}` : "";
613
+ }
614
+ if (modifier === "+" || modifier === "*") {
615
+ if (value === undefined && modifier === "+") {
616
+ throw new Error(`Missing value for "${name}" (one or more required)`);
617
+ }
618
+ return value ? `${slash}${value}` : "";
619
+ }
620
+ if (value === undefined) {
621
+ throw new Error(`Missing value for "${name}"`);
622
+ }
623
+ return `${slash}${value}`;
624
+ });
625
+ filled = filled.replace(/#PORT-(\d+)#/g, ":$1");
626
+ return new URL(filled, origin);
627
+ }
628
+ function aggregateGroups(match) {
629
+ return {
630
+ ...match.hash.groups,
631
+ ...match.hostname.groups,
632
+ ...match.password.groups,
633
+ ...match.pathname.groups,
634
+ ...match.port.groups,
635
+ ...match.protocol.groups,
636
+ ...match.search.groups,
637
+ ...match.username.groups
638
+ };
639
+ }
640
+ var customServerStrategies = new Map;
641
+ var customClientStrategies = new Map;
642
+ function isCustomStrategy(strategy2) {
643
+ return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
644
+ }
645
+
646
+ // ../../src/components/ui/error-component.tsx
647
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
648
+ var TraceId = Schema.String.check(Schema.isPattern(/^(?!0+$)(?:[a-f0-9]{16}|[a-f0-9]{32})$/i)).annotate({ identifier: "ErrorTraceId" });
649
+ var decodeTraceId = Schema.decodeUnknownOption(TraceId);
650
+ var getErrorTraceId = (error) => {
651
+ const visited = new Set;
652
+ let current = error;
653
+ while (current instanceof Error && !visited.has(current)) {
654
+ visited.add(current);
655
+ if (HttpClientError.isHttpClientError(current)) {
656
+ const traceId = HttpTraceContext.fromHeaders(current.request.headers).pipe(Option.flatMap((span) => decodeTraceId(span.traceId)));
657
+ if (Option.isSome(traceId))
658
+ return traceId.value;
659
+ }
660
+ current = current.cause;
661
+ }
662
+ return;
663
+ };
664
+ var defaultMessages = {
665
+ en: {
666
+ title: "Unable to load this page",
667
+ description: "Something went wrong while loading this page. Please try again.",
668
+ retry: "Try again",
669
+ home: "Go to homepage",
670
+ copy: "Copy error details",
671
+ copied: "Error details copied",
672
+ copyFailed: "Copy failed. Select and copy the details below.",
673
+ details: "Error details",
674
+ errorLabel: "Error",
675
+ messageLabel: "Message",
676
+ pageLabel: "Page",
677
+ timeLabel: "Time",
678
+ languageLabel: "Language",
679
+ appLabel: "Application",
680
+ versionLabel: "Version",
681
+ referenceLabel: "Reference"
682
+ },
683
+ fr: {
684
+ title: "Impossible de charger cette page",
685
+ description: "Une erreur est survenue lors du chargement de cette page. Veuillez réessayer.",
686
+ retry: "Réessayer",
687
+ home: "Retour à l'accueil",
688
+ copy: "Copier les détails de l'erreur",
689
+ copied: "Détails de l'erreur copiés",
690
+ copyFailed: "La copie a échoué. Sélectionnez et copiez les détails ci-dessous.",
691
+ details: "Détails de l'erreur",
692
+ errorLabel: "Erreur",
693
+ messageLabel: "Message",
694
+ pageLabel: "Page",
695
+ timeLabel: "Date",
696
+ languageLabel: "Langue",
697
+ appLabel: "Application",
698
+ versionLabel: "Version",
699
+ referenceLabel: "Référence"
700
+ }
701
+ };
702
+ var ErrorComponent = ({
703
+ error,
704
+ messages,
705
+ retryable = true,
706
+ className,
707
+ diagnostics
708
+ }) => {
709
+ const locale = getLocale();
710
+ const pathname = useRouterState({
711
+ select: (state) => state.location.pathname
712
+ });
713
+ const labels = useMemo(() => ({
714
+ ...defaultMessages[locale.startsWith("fr") ? "fr" : "en"],
715
+ ...messages
716
+ }), [locale, messages]);
717
+ const reference = diagnostics?.reference ?? getErrorTraceId(error);
718
+ const report = useMemo(() => [
719
+ `${labels.errorLabel}: ${error.name}`,
720
+ `${labels.messageLabel}: ${error.message.trim() || labels.description}`,
721
+ "",
722
+ `${labels.pageLabel}: ${pathname}`,
723
+ `${labels.timeLabel}: ${new Date().toISOString()}`,
724
+ `${labels.languageLabel}: ${locale}`,
725
+ ...diagnostics?.app ? [`${labels.appLabel}: ${diagnostics.app}`] : [],
726
+ ...diagnostics?.version ? [`${labels.versionLabel}: ${diagnostics.version}`] : [],
727
+ ...reference ? [`${labels.referenceLabel}: ${reference}`] : []
728
+ ].join(`
729
+ `), [
730
+ error,
731
+ pathname,
732
+ locale,
733
+ labels,
734
+ diagnostics?.app,
735
+ diagnostics?.version,
736
+ reference
737
+ ]);
738
+ const [copyResult, setCopyResult] = useState2(null);
739
+ const copyStatus = copyResult?.report === report ? copyResult.status : undefined;
740
+ return /* @__PURE__ */ jsx5("main", {
741
+ className: cn("flex min-h-[60vh] items-center justify-center p-6", className),
742
+ children: /* @__PURE__ */ jsxs2(Empty, {
743
+ children: [
744
+ /* @__PURE__ */ jsxs2(EmptyHeader, {
745
+ children: [
746
+ /* @__PURE__ */ jsx5(EmptyMedia, {
747
+ variant: "icon",
748
+ children: /* @__PURE__ */ jsx5(CircleAlert, {})
749
+ }),
750
+ /* @__PURE__ */ jsx5(EmptyTitle, {
751
+ children: /* @__PURE__ */ jsx5("h1", {
752
+ children: labels.title
753
+ })
754
+ }),
755
+ /* @__PURE__ */ jsx5(EmptyDescription, {
756
+ children: error.message.trim() || labels.description
757
+ })
758
+ ]
759
+ }),
760
+ /* @__PURE__ */ jsxs2(EmptyContent, {
761
+ children: [
762
+ /* @__PURE__ */ jsxs2("div", {
763
+ className: "flex flex-wrap justify-center gap-2",
764
+ children: [
765
+ retryable && /* @__PURE__ */ jsxs2(Button, {
766
+ onClick: () => window.location.reload(),
767
+ children: [
768
+ /* @__PURE__ */ jsx5(RefreshCw, {
769
+ "data-icon": "inline-start"
770
+ }),
771
+ labels.retry
772
+ ]
773
+ }),
774
+ /* @__PURE__ */ jsx5(Link, {
775
+ to: "/",
776
+ className: buttonVariants({ variant: "outline" }),
777
+ children: labels.home
778
+ })
779
+ ]
780
+ }),
781
+ /* @__PURE__ */ jsx5(CopyButton, {
782
+ value: report,
783
+ copyVariant: "large",
784
+ variant: "link",
785
+ messages: {
786
+ copy: labels.copy,
787
+ copied: labels.copied,
788
+ copyFailed: labels.copyFailed
789
+ },
790
+ onCopied: () => setCopyResult({ report, status: "copied" }),
791
+ onCopyError: () => setCopyResult({ report, status: "failed" })
792
+ }),
793
+ copyStatus === "failed" && /* @__PURE__ */ jsx5("p", {
794
+ children: labels.copyFailed
795
+ }),
796
+ copyStatus === "failed" && /* @__PURE__ */ jsx5(Textarea, {
797
+ "aria-label": labels.details,
798
+ readOnly: true,
799
+ value: report,
800
+ rows: 10,
801
+ onFocus: (event) => event.currentTarget.select()
802
+ })
803
+ ]
804
+ })
805
+ ]
806
+ })
807
+ });
808
+ };
809
+ export {
810
+ ErrorComponent
811
+ };
@@ -14,11 +14,7 @@ import { useRender } from "@base-ui/react/use-render";
14
14
  import { cva as cva2 } from "class-variance-authority";
15
15
 
16
16
  // ../../src/lib/utils.ts
17
- import { clsx } from "clsx";
18
- import { twMerge } from "tailwind-merge";
19
- function cn(...inputs) {
20
- return twMerge(clsx(inputs));
21
- }
17
+ import { cn } from "cn";
22
18
 
23
19
  // ../../src/components/ui/button.tsx
24
20
  import { Button as ButtonPrimitive } from "@base-ui/react/button";
@@ -2,11 +2,7 @@
2
2
  import { Select as SelectPrimitive } from "@base-ui/react/select";
3
3
 
4
4
  // ../../src/lib/utils.ts
5
- import { clsx } from "clsx";
6
- import { twMerge } from "tailwind-merge";
7
- function cn(...inputs) {
8
- return twMerge(clsx(inputs));
9
- }
5
+ import { cn } from "cn";
10
6
 
11
7
  // ../../src/components/ui/select.tsx
12
8
  import { ChevronDownIcon, CheckIcon, ChevronUpIcon } from "lucide-react";
@@ -4,11 +4,7 @@ import { useEffect, useEffectEvent, useRef, useState } from "react";
4
4
  import { Schema } from "effect";
5
5
 
6
6
  // ../../src/lib/utils.ts
7
- import { clsx } from "clsx";
8
- import { twMerge } from "tailwind-merge";
9
- function cn(...inputs) {
10
- return twMerge(clsx(inputs));
11
- }
7
+ import { cn } from "cn";
12
8
 
13
9
  // ../../src/paraglide/runtime.js
14
10
  import"@inlang/paraglide-js/urlpattern-polyfill";
@@ -17,11 +17,7 @@ import { Button as ButtonPrimitive } from "@base-ui/react/button";
17
17
  import { cva } from "class-variance-authority";
18
18
 
19
19
  // ../../src/lib/utils.ts
20
- import { clsx } from "clsx";
21
- import { twMerge } from "tailwind-merge";
22
- function cn(...inputs) {
23
- return twMerge(clsx(inputs));
24
- }
20
+ import { cn } from "cn";
25
21
 
26
22
  // ../../src/components/ui/button.tsx
27
23
  import { jsx } from "react/jsx-runtime";
@@ -2,11 +2,7 @@
2
2
  import { Loader2 } from "lucide-react";
3
3
 
4
4
  // ../../src/lib/utils.ts
5
- import { clsx } from "clsx";
6
- import { twMerge } from "tailwind-merge";
7
- function cn(...inputs) {
8
- return twMerge(clsx(inputs));
9
- }
5
+ import { cn } from "cn";
10
6
 
11
7
  // ../../src/paraglide/runtime.js
12
8
  import"@inlang/paraglide-js/urlpattern-polyfill";
@@ -439,11 +439,7 @@ import { Button as ButtonPrimitive } from "@base-ui/react/button";
439
439
  import { cva } from "class-variance-authority";
440
440
 
441
441
  // ../../src/lib/utils.ts
442
- import { clsx } from "clsx";
443
- import { twMerge } from "tailwind-merge";
444
- function cn(...inputs) {
445
- return twMerge(clsx(inputs));
446
- }
442
+ import { cn } from "cn";
447
443
 
448
444
  // ../../src/components/ui/button.tsx
449
445
  import { jsx } from "react/jsx-runtime";
@@ -12,11 +12,7 @@ import { Button as ButtonPrimitive } from "@base-ui/react/button";
12
12
  import { cva } from "class-variance-authority";
13
13
 
14
14
  // ../../src/lib/utils.ts
15
- import { clsx } from "clsx";
16
- import { twMerge } from "tailwind-merge";
17
- function cn(...inputs) {
18
- return twMerge(clsx(inputs));
19
- }
15
+ import { cn } from "cn";
20
16
 
21
17
  // ../../src/components/ui/button.tsx
22
18
  import { jsx } from "react/jsx-runtime";
@@ -7,11 +7,7 @@ import { Button as ButtonPrimitive } from "@base-ui/react/button";
7
7
  import { cva } from "class-variance-authority";
8
8
 
9
9
  // ../../src/lib/utils.ts
10
- import { clsx } from "clsx";
11
- import { twMerge } from "tailwind-merge";
12
- function cn(...inputs) {
13
- return twMerge(clsx(inputs));
14
- }
10
+ import { cn } from "cn";
15
11
 
16
12
  // ../../src/components/ui/button.tsx
17
13
  import { jsx } from "react/jsx-runtime";
@@ -10,11 +10,7 @@ import { useRender } from "@base-ui/react/use-render";
10
10
  import { cva } from "class-variance-authority";
11
11
 
12
12
  // ../../src/lib/utils.ts
13
- import { clsx } from "clsx";
14
- import { twMerge } from "tailwind-merge";
15
- function cn(...inputs) {
16
- return twMerge(clsx(inputs));
17
- }
13
+ import { cn } from "cn";
18
14
 
19
15
  // ../../src/components/ui/badge.tsx
20
16
  var badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
@@ -5,11 +5,7 @@ import {
5
5
  } from "react";
6
6
 
7
7
  // ../../src/lib/utils.ts
8
- import { clsx } from "clsx";
9
- import { twMerge } from "tailwind-merge";
10
- function cn(...inputs) {
11
- return twMerge(clsx(inputs));
12
- }
8
+ import { cn } from "cn";
13
9
 
14
10
  // ../../src/components/ui/card.tsx
15
11
  import { jsx } from "react/jsx-runtime";
@@ -15,11 +15,7 @@ import { Button as ButtonPrimitive } from "@base-ui/react/button";
15
15
  import { cva } from "class-variance-authority";
16
16
 
17
17
  // ../../src/lib/utils.ts
18
- import { clsx } from "clsx";
19
- import { twMerge } from "tailwind-merge";
20
- function cn(...inputs) {
21
- return twMerge(clsx(inputs));
22
- }
18
+ import { cn } from "cn";
23
19
 
24
20
  // ../../src/components/ui/button.tsx
25
21
  import { jsx } from "react/jsx-runtime";
@@ -14,11 +14,7 @@ import { Button as ButtonPrimitive } from "@base-ui/react/button";
14
14
  import { cva } from "class-variance-authority";
15
15
 
16
16
  // ../../src/lib/utils.ts
17
- import { clsx } from "clsx";
18
- import { twMerge } from "tailwind-merge";
19
- function cn(...inputs) {
20
- return twMerge(clsx(inputs));
21
- }
17
+ import { cn } from "cn";
22
18
 
23
19
  // ../../src/components/ui/button.tsx
24
20
  import { jsx } from "react/jsx-runtime";
package/dist/lib/docs.js CHANGED
@@ -125,11 +125,7 @@ import { useRender } from "@base-ui/react/use-render";
125
125
  import { cva } from "class-variance-authority";
126
126
 
127
127
  // ../../src/lib/utils.ts
128
- import { clsx } from "clsx";
129
- import { twMerge } from "tailwind-merge";
130
- function cn(...inputs) {
131
- return twMerge(clsx(inputs));
132
- }
128
+ import { cn } from "cn";
133
129
 
134
130
  // ../../src/components/ui/badge.tsx
135
131
  var badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
@@ -23,8 +23,7 @@ import { useRender } from "@base-ui/react/use-render";
23
23
  import { cva } from "class-variance-authority";
24
24
 
25
25
  // ../../src/lib/utils.ts
26
- import { clsx } from "clsx";
27
- import { twMerge } from "tailwind-merge";
26
+ import { cn } from "cn";
28
27
 
29
28
  // ../../src/components/ui/badge.tsx
30
29
  var badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
@@ -23,8 +23,7 @@ import { useRender } from "@base-ui/react/use-render";
23
23
  import { cva } from "class-variance-authority";
24
24
 
25
25
  // ../../src/lib/utils.ts
26
- import { clsx } from "clsx";
27
- import { twMerge } from "tailwind-merge";
26
+ import { cn } from "cn";
28
27
 
29
28
  // ../../src/components/ui/badge.tsx
30
29
  var badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
@@ -1,2 +1 @@
1
- import type { ClassValue } from "clsx";
2
- export declare function cn(...inputs: ClassValue[]): string;
1
+ export { cn } from "cn";
@@ -71,6 +71,7 @@ var reduceAgentEvent = (state, event) => {
71
71
  return { ...state, history: event.value };
72
72
  case "error":
73
73
  return failAgentState(state, event.code);
74
+ case "heartbeat":
74
75
  case "finish":
75
76
  return state;
76
77
  }
@@ -164,11 +165,7 @@ import { Button as ButtonPrimitive } from "@base-ui/react/button";
164
165
  import { cva } from "class-variance-authority";
165
166
 
166
167
  // ../../src/lib/utils.ts
167
- import { clsx } from "clsx";
168
- import { twMerge } from "tailwind-merge";
169
- function cn(...inputs) {
170
- return twMerge(clsx(inputs));
171
- }
168
+ import { cn } from "cn";
172
169
 
173
170
  // ../../src/components/ui/button.tsx
174
171
  import { jsx } from "react/jsx-runtime";
@@ -1567,6 +1564,7 @@ var AgentMarkdownCodeBlock = Schema2.Struct({
1567
1564
  language: Schema2.String
1568
1565
  }).annotate({ identifier: "AgentMarkdownCodeBlock" });
1569
1566
  var AgentEvent = Schema2.Union([
1567
+ Schema2.Struct({ type: Schema2.Literal("heartbeat") }),
1570
1568
  Schema2.Struct({
1571
1569
  type: Schema2.Literal("message-start"),
1572
1570
  messageId: Schema2.String
@@ -14,6 +14,8 @@ declare class AgentHistoryError extends AgentHistoryError_base {
14
14
  }
15
15
  declare const AgentService_base: Context.ServiceClass<AgentService, "AgentService", {
16
16
  stream: <Tools extends Record<string, Tool.Any>>(args_0: AgentStreamOptions<Tools>) => Effect.Effect<Stream.Stream<{
17
+ readonly type: "heartbeat";
18
+ } | {
17
19
  readonly type: "message-start";
18
20
  readonly messageId: string;
19
21
  } | {
@@ -68,6 +70,8 @@ declare const AgentService_base: Context.ServiceClass<AgentService, "AgentServic
68
70
  }> & {
69
71
  readonly make: Effect.Effect<{
70
72
  stream: <Tools extends Record<string, Tool.Any>>(args_0: AgentStreamOptions<Tools>) => Effect.Effect<Stream.Stream<{
73
+ readonly type: "heartbeat";
74
+ } | {
71
75
  readonly type: "message-start";
72
76
  readonly messageId: string;
73
77
  } | {
@@ -289,7 +289,7 @@ class AgentService extends Context.Service()("AgentService", {
289
289
  type: "error",
290
290
  code: "stream-failed"
291
291
  }, { type: "finish" })))));
292
- return Stream.concat(Stream.succeed({ type: "message-start", messageId }), response);
292
+ return Stream.concat(Stream.succeed({ type: "message-start", messageId }), response).pipe(Stream.merge(Stream.tick("5 seconds").pipe(Stream.drop(1), Stream.map(() => ({ type: "heartbeat" }))), { haltStrategy: "left" }), Stream.takeUntil((event) => event.type === "finish"));
293
293
  });
294
294
  return { stream };
295
295
  })
@@ -28,6 +28,8 @@ export declare const AgentMarkdownCodeBlock: Schema.Struct<{
28
28
  readonly language: Schema.String;
29
29
  }>;
30
30
  export declare const AgentEvent: Schema.Union<readonly [Schema.Struct<{
31
+ readonly type: Schema.Literal<"heartbeat">;
32
+ }>, Schema.Struct<{
31
33
  readonly type: Schema.Literal<"message-start">;
32
34
  readonly messageId: Schema.String;
33
35
  }>, Schema.Struct<{
@@ -99,6 +101,8 @@ export declare const makeAgentApiGroup: <const Resource extends Schema.Top>(reso
99
101
  }>>;
100
102
  readonly history: Schema.optional<Schema.String>;
101
103
  }>>, never, HttpApiSchema.StreamSse<HttpApiSchema.SseEventFromData<Schema.Union<readonly [Schema.Struct<{
104
+ readonly type: Schema.Literal<"heartbeat">;
105
+ }>, Schema.Struct<{
102
106
  readonly type: Schema.Literal<"message-start">;
103
107
  readonly messageId: Schema.String;
104
108
  }>, Schema.Struct<{
@@ -144,6 +148,8 @@ export declare const makeAgentApiGroup: <const Resource extends Schema.Top>(reso
144
148
  }>]>>, Schema.Struct<{
145
149
  readonly code: Schema.Literals<readonly ["unavailable", "stream-failed"]>;
146
150
  }>, {
151
+ readonly type: "heartbeat";
152
+ } | {
147
153
  readonly type: "message-start";
148
154
  readonly messageId: string;
149
155
  } | {
@@ -48,6 +48,7 @@ var AgentMarkdownCodeBlock = Schema.Struct({
48
48
  language: Schema.String
49
49
  }).annotate({ identifier: "AgentMarkdownCodeBlock" });
50
50
  var AgentEvent = Schema.Union([
51
+ Schema.Struct({ type: Schema.Literal("heartbeat") }),
51
52
  Schema.Struct({
52
53
  type: Schema.Literal("message-start"),
53
54
  messageId: Schema.String
@@ -16,11 +16,7 @@ import { useRender } from "@base-ui/react/use-render";
16
16
  import { cva } from "class-variance-authority";
17
17
 
18
18
  // ../../src/lib/utils.ts
19
- import { clsx } from "clsx";
20
- import { twMerge } from "tailwind-merge";
21
- function cn(...inputs) {
22
- return twMerge(clsx(inputs));
23
- }
19
+ import { cn } from "cn";
24
20
 
25
21
  // ../../src/components/ui/badge.tsx
26
22
  var badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
@@ -109,11 +109,7 @@ import { useRender } from "@base-ui/react/use-render";
109
109
  import { cva } from "class-variance-authority";
110
110
 
111
111
  // ../../src/lib/utils.ts
112
- import { clsx } from "clsx";
113
- import { twMerge } from "tailwind-merge";
114
- function cn(...inputs) {
115
- return twMerge(clsx(inputs));
116
- }
112
+ import { cn } from "cn";
117
113
 
118
114
  // ../../src/components/ui/badge.tsx
119
115
  var badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/registry",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -99,6 +99,10 @@
99
99
  "types": "./dist/components/ui/effect-form.d.ts",
100
100
  "import": "./dist/components/ui/effect-form.js"
101
101
  },
102
+ "./error-component": {
103
+ "types": "./dist/components/ui/error-component.d.ts",
104
+ "import": "./dist/components/ui/error-component.js"
105
+ },
102
106
  "./file-picker": {
103
107
  "types": "./dist/components/ui/file-picker.d.ts",
104
108
  "import": "./dist/components/ui/file-picker.js"
@@ -235,14 +239,13 @@
235
239
  "@tanstack/react-virtual": "^3.14.5",
236
240
  "@xberg-io/xberg": "1.0.14",
237
241
  "class-variance-authority": "^0.7.1",
238
- "clsx": "^2.1.1",
239
242
  "cmdk": "^1.1.1",
243
+ "cn": "^0.3.0",
240
244
  "drizzle-orm": "^1.0.0-rc.4-5d5b77c",
241
245
  "effect": "4.0.0-rc.112",
242
246
  "lucide-react": "^1.18.0",
243
247
  "react": "^19.2.0",
244
- "react-dom": "^19.2.0",
245
- "tailwind-merge": "^3.6.0"
248
+ "react-dom": "^19.2.0"
246
249
  },
247
250
  "peerDependenciesMeta": {
248
251
  "@aws-sdk/client-sesv2": {