@vertz/ui 0.2.20 → 0.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/{chunk-4fwcwxn6.js → chunk-2qe6aqhb.js} +235 -1
- package/dist/shared/{chunk-mtsvrj9e.js → chunk-4cmt1ve8.js} +1 -1
- package/dist/shared/chunk-4xkw6h1s.js +73 -0
- package/dist/shared/{chunk-j5qtsm0b.js → chunk-67z8b0q8.js} +97 -21
- package/dist/shared/{chunk-fkbgbf3n.js → chunk-7g722pdh.js} +70 -12
- package/dist/shared/{chunk-6wd36w21.js → chunk-am9zaw4h.js} +3 -1
- package/dist/shared/{chunk-14eqne2a.js → chunk-bybgyjye.js} +1 -1
- package/dist/shared/{chunk-afawz764.js → chunk-c61572xp.js} +1 -1
- package/dist/shared/{chunk-07bh4m1e.js → chunk-kjwp5q5s.js} +10 -5
- package/dist/shared/chunk-mwc4v48d.js +36 -0
- package/dist/shared/{chunk-yjs76c7v.js → chunk-pdqr78k9.js} +1 -1
- package/dist/shared/{chunk-c3r237f0.js → chunk-pq8khh47.js} +32 -11
- package/dist/shared/{chunk-fs3eec4b.js → chunk-szk0hyjg.js} +3 -3
- package/dist/shared/chunk-vwz86vg9.js +208 -0
- package/dist/shared/{chunk-j09yyh34.js → chunk-yb4a0smw.js} +1 -1
- package/dist/src/auth/public.d.ts +30 -2
- package/dist/src/auth/public.js +95 -136
- package/dist/src/components/index.d.ts +70 -0
- package/dist/src/components/index.js +213 -0
- package/dist/src/css/public.d.ts +48 -14
- package/dist/src/css/public.js +4 -4
- package/dist/src/form/public.js +2 -2
- package/dist/src/index.d.ts +131 -20
- package/dist/src/index.js +45 -36
- package/dist/src/internals.d.ts +110 -62
- package/dist/src/internals.js +18 -14
- package/dist/src/jsx-runtime/index.d.ts +20 -0
- package/dist/src/jsx-runtime/index.js +13 -3
- package/dist/src/query/public.js +4 -4
- package/dist/src/router/public.d.ts +47 -1
- package/dist/src/router/public.js +10 -9
- package/dist/src/test/index.d.ts +33 -0
- package/dist/src/test/index.js +4 -4
- package/package.json +7 -3
- package/dist/shared/chunk-mgfrrrjq.js +0 -384
package/dist/src/auth/public.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RouterContext
|
|
3
|
-
} from "../../shared/chunk-
|
|
3
|
+
} from "../../shared/chunk-4cmt1ve8.js";
|
|
4
4
|
import {
|
|
5
5
|
isBrowser
|
|
6
|
-
} from "../../shared/chunk-
|
|
6
|
+
} from "../../shared/chunk-bybgyjye.js";
|
|
7
7
|
import {
|
|
8
8
|
_tryOnCleanup,
|
|
9
9
|
computed,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getSSRContext,
|
|
12
12
|
signal,
|
|
13
13
|
useContext
|
|
14
|
-
} from "../../shared/chunk-
|
|
14
|
+
} from "../../shared/chunk-2qe6aqhb.js";
|
|
15
15
|
|
|
16
16
|
// src/auth/access-context.ts
|
|
17
17
|
var AccessContext = createContext(undefined, "@vertz/ui::AccessContext");
|
|
@@ -153,6 +153,9 @@ function createAccessEventClient(options) {
|
|
|
153
153
|
}
|
|
154
154
|
return { connect, disconnect, dispose };
|
|
155
155
|
}
|
|
156
|
+
// src/auth/auth-context.ts
|
|
157
|
+
import { err, ok } from "@vertz/fetch";
|
|
158
|
+
|
|
156
159
|
// src/auth/access-event-handler.ts
|
|
157
160
|
function handleAccessEvent(accessSet, event, flagEntitlementMap) {
|
|
158
161
|
const current = accessSet.value;
|
|
@@ -250,7 +253,6 @@ function handleLimitUpdate(accessSet, current, entitlement, consumed, remaining,
|
|
|
250
253
|
}
|
|
251
254
|
|
|
252
255
|
// src/auth/auth-client.ts
|
|
253
|
-
import { err, ok } from "@vertz/fetch";
|
|
254
256
|
async function parseAuthError(res) {
|
|
255
257
|
let code = "SERVER_ERROR";
|
|
256
258
|
let message = "An unexpected error occurred";
|
|
@@ -276,48 +278,6 @@ async function parseAuthError(res) {
|
|
|
276
278
|
}
|
|
277
279
|
return { code, message, statusCode: res.status, retryAfter };
|
|
278
280
|
}
|
|
279
|
-
function createAuthMethod({
|
|
280
|
-
basePath,
|
|
281
|
-
endpoint,
|
|
282
|
-
httpMethod,
|
|
283
|
-
schema,
|
|
284
|
-
onSuccess
|
|
285
|
-
}) {
|
|
286
|
-
const url = `${basePath}/${endpoint}`;
|
|
287
|
-
const fn = async (body) => {
|
|
288
|
-
let res;
|
|
289
|
-
try {
|
|
290
|
-
res = await fetch(url, {
|
|
291
|
-
method: httpMethod,
|
|
292
|
-
headers: {
|
|
293
|
-
"Content-Type": "application/json",
|
|
294
|
-
"X-VTZ-Request": "1"
|
|
295
|
-
},
|
|
296
|
-
credentials: "include",
|
|
297
|
-
body: JSON.stringify(body)
|
|
298
|
-
});
|
|
299
|
-
} catch (e) {
|
|
300
|
-
const networkError = {
|
|
301
|
-
code: "NETWORK_ERROR",
|
|
302
|
-
message: e instanceof Error ? e.message : "Network error",
|
|
303
|
-
statusCode: 0
|
|
304
|
-
};
|
|
305
|
-
return err(Object.assign(new Error(networkError.message), networkError));
|
|
306
|
-
}
|
|
307
|
-
if (!res.ok) {
|
|
308
|
-
const authError = await parseAuthError(res);
|
|
309
|
-
return err(Object.assign(new Error(authError.message), authError));
|
|
310
|
-
}
|
|
311
|
-
const data = await res.json();
|
|
312
|
-
onSuccess(data);
|
|
313
|
-
return ok(data);
|
|
314
|
-
};
|
|
315
|
-
return Object.assign(fn, {
|
|
316
|
-
url,
|
|
317
|
-
method: httpMethod,
|
|
318
|
-
meta: { bodySchema: schema }
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
281
|
|
|
322
282
|
// src/auth/auth-types.ts
|
|
323
283
|
var signInSchema = {
|
|
@@ -331,9 +291,9 @@ var signInSchema = {
|
|
|
331
291
|
errors.push({ path: ["password"], message: "Password is required" });
|
|
332
292
|
}
|
|
333
293
|
if (errors.length > 0) {
|
|
334
|
-
const
|
|
335
|
-
|
|
336
|
-
return { ok: false, error:
|
|
294
|
+
const err = new Error("Validation failed");
|
|
295
|
+
err.issues = errors;
|
|
296
|
+
return { ok: false, error: err };
|
|
337
297
|
}
|
|
338
298
|
return { ok: true, data: { email: d.email, password: d.password } };
|
|
339
299
|
}
|
|
@@ -349,9 +309,9 @@ var signUpSchema = {
|
|
|
349
309
|
errors.push({ path: ["password"], message: "Password must be at least 8 characters" });
|
|
350
310
|
}
|
|
351
311
|
if (errors.length > 0) {
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
return { ok: false, error:
|
|
312
|
+
const err = new Error("Validation failed");
|
|
313
|
+
err.issues = errors;
|
|
314
|
+
return { ok: false, error: err };
|
|
355
315
|
}
|
|
356
316
|
const { email, password, ...rest } = d;
|
|
357
317
|
return {
|
|
@@ -364,11 +324,11 @@ var mfaSchema = {
|
|
|
364
324
|
parse(data) {
|
|
365
325
|
const d = data;
|
|
366
326
|
if (!d.code || typeof d.code !== "string" || d.code.length !== 6) {
|
|
367
|
-
const
|
|
368
|
-
|
|
327
|
+
const err = new Error("Validation failed");
|
|
328
|
+
err.issues = [
|
|
369
329
|
{ path: ["code"], message: "Enter a 6-digit code" }
|
|
370
330
|
];
|
|
371
|
-
return { ok: false, error:
|
|
331
|
+
return { ok: false, error: err };
|
|
372
332
|
}
|
|
373
333
|
return { ok: true, data: { code: d.code } };
|
|
374
334
|
}
|
|
@@ -377,11 +337,11 @@ var forgotPasswordSchema = {
|
|
|
377
337
|
parse(data) {
|
|
378
338
|
const d = data;
|
|
379
339
|
if (!d.email || typeof d.email !== "string" || !d.email.includes("@")) {
|
|
380
|
-
const
|
|
381
|
-
|
|
340
|
+
const err = new Error("Validation failed");
|
|
341
|
+
err.issues = [
|
|
382
342
|
{ path: ["email"], message: "Valid email is required" }
|
|
383
343
|
];
|
|
384
|
-
return { ok: false, error:
|
|
344
|
+
return { ok: false, error: err };
|
|
385
345
|
}
|
|
386
346
|
return { ok: true, data: { email: d.email } };
|
|
387
347
|
}
|
|
@@ -397,9 +357,9 @@ var resetPasswordSchema = {
|
|
|
397
357
|
errors.push({ path: ["password"], message: "Password must be at least 8 characters" });
|
|
398
358
|
}
|
|
399
359
|
if (errors.length > 0) {
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
return { ok: false, error:
|
|
360
|
+
const err = new Error("Validation failed");
|
|
361
|
+
err.issues = errors;
|
|
362
|
+
return { ok: false, error: err };
|
|
403
363
|
}
|
|
404
364
|
return {
|
|
405
365
|
ok: true,
|
|
@@ -489,6 +449,7 @@ function useAuth() {
|
|
|
489
449
|
return ctx;
|
|
490
450
|
}
|
|
491
451
|
function AuthProvider({
|
|
452
|
+
auth,
|
|
492
453
|
basePath = "/api/auth",
|
|
493
454
|
accessControl,
|
|
494
455
|
accessEvents,
|
|
@@ -500,12 +461,17 @@ function AuthProvider({
|
|
|
500
461
|
const userSignal = signal(null);
|
|
501
462
|
const statusSignal = signal("idle");
|
|
502
463
|
const errorSignal = signal(null);
|
|
503
|
-
const
|
|
464
|
+
const ssrProviders = isBrowser() && "__VERTZ_PROVIDERS__" in window ? window.__VERTZ_PROVIDERS__ : [];
|
|
465
|
+
const providersSignal = signal(ssrProviders);
|
|
504
466
|
if (isBrowser()) {
|
|
505
467
|
setTimeout(() => {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
468
|
+
if (auth.providers) {
|
|
469
|
+
Promise.resolve(auth.providers()).then((result) => {
|
|
470
|
+
if (result.ok) {
|
|
471
|
+
providersSignal.value = result.data;
|
|
472
|
+
}
|
|
473
|
+
}).catch(() => {});
|
|
474
|
+
}
|
|
509
475
|
}, 0);
|
|
510
476
|
}
|
|
511
477
|
let deferredRefreshTimer = null;
|
|
@@ -561,13 +527,6 @@ function AuthProvider({
|
|
|
561
527
|
};
|
|
562
528
|
}
|
|
563
529
|
}
|
|
564
|
-
const signInMethod = createAuthMethod({
|
|
565
|
-
basePath,
|
|
566
|
-
endpoint: "signin",
|
|
567
|
-
httpMethod: "POST",
|
|
568
|
-
schema: signInSchema,
|
|
569
|
-
onSuccess: handleAuthSuccess
|
|
570
|
-
});
|
|
571
530
|
const signIn = Object.assign(async (body) => {
|
|
572
531
|
if (deferredRefreshTimer) {
|
|
573
532
|
clearTimeout(deferredRefreshTimer);
|
|
@@ -575,22 +534,17 @@ function AuthProvider({
|
|
|
575
534
|
}
|
|
576
535
|
statusSignal.value = "loading";
|
|
577
536
|
errorSignal.value = null;
|
|
578
|
-
const result = await
|
|
579
|
-
if (
|
|
537
|
+
const result = await auth.signIn(body);
|
|
538
|
+
if (result.ok) {
|
|
539
|
+
handleAuthSuccess(result.data);
|
|
540
|
+
} else {
|
|
580
541
|
handleAuthError(result.error);
|
|
581
542
|
}
|
|
582
543
|
return result;
|
|
583
544
|
}, {
|
|
584
|
-
url:
|
|
585
|
-
method:
|
|
586
|
-
meta:
|
|
587
|
-
});
|
|
588
|
-
const signUpMethod = createAuthMethod({
|
|
589
|
-
basePath,
|
|
590
|
-
endpoint: "signup",
|
|
591
|
-
httpMethod: "POST",
|
|
592
|
-
schema: signUpSchema,
|
|
593
|
-
onSuccess: handleAuthSuccess
|
|
545
|
+
url: auth.signIn.url,
|
|
546
|
+
method: auth.signIn.method,
|
|
547
|
+
meta: { bodySchema: signInSchema }
|
|
594
548
|
});
|
|
595
549
|
const signUp = Object.assign(async (body) => {
|
|
596
550
|
if (deferredRefreshTimer) {
|
|
@@ -599,72 +553,79 @@ function AuthProvider({
|
|
|
599
553
|
}
|
|
600
554
|
statusSignal.value = "loading";
|
|
601
555
|
errorSignal.value = null;
|
|
602
|
-
const result = await
|
|
603
|
-
if (
|
|
556
|
+
const result = await auth.signUp(body);
|
|
557
|
+
if (result.ok) {
|
|
558
|
+
handleAuthSuccess(result.data);
|
|
559
|
+
} else {
|
|
604
560
|
handleAuthError(result.error);
|
|
605
561
|
}
|
|
606
562
|
return result;
|
|
607
563
|
}, {
|
|
608
|
-
url:
|
|
609
|
-
method:
|
|
610
|
-
meta:
|
|
611
|
-
});
|
|
612
|
-
const mfaChallengeMethod = createAuthMethod({
|
|
613
|
-
basePath,
|
|
614
|
-
endpoint: "mfa/challenge",
|
|
615
|
-
httpMethod: "POST",
|
|
616
|
-
schema: mfaSchema,
|
|
617
|
-
onSuccess: handleAuthSuccess
|
|
564
|
+
url: auth.signUp.url,
|
|
565
|
+
method: auth.signUp.method,
|
|
566
|
+
meta: { bodySchema: signUpSchema }
|
|
618
567
|
});
|
|
568
|
+
async function authFetch(endpoint, httpMethod, body) {
|
|
569
|
+
const url = `${basePath}/${endpoint}`;
|
|
570
|
+
let res;
|
|
571
|
+
try {
|
|
572
|
+
res = await fetch(url, {
|
|
573
|
+
method: httpMethod,
|
|
574
|
+
headers: {
|
|
575
|
+
"Content-Type": "application/json",
|
|
576
|
+
"X-VTZ-Request": "1"
|
|
577
|
+
},
|
|
578
|
+
credentials: "include",
|
|
579
|
+
body: JSON.stringify(body)
|
|
580
|
+
});
|
|
581
|
+
} catch (e) {
|
|
582
|
+
const networkError = {
|
|
583
|
+
code: "NETWORK_ERROR",
|
|
584
|
+
message: e instanceof Error ? e.message : "Network error",
|
|
585
|
+
statusCode: 0
|
|
586
|
+
};
|
|
587
|
+
return err(Object.assign(new Error(networkError.message), networkError));
|
|
588
|
+
}
|
|
589
|
+
if (!res.ok) {
|
|
590
|
+
const authError = await parseAuthError(res);
|
|
591
|
+
return err(Object.assign(new Error(authError.message), authError));
|
|
592
|
+
}
|
|
593
|
+
const data = await res.json();
|
|
594
|
+
return ok(data);
|
|
595
|
+
}
|
|
619
596
|
const mfaChallenge = Object.assign(async (body) => {
|
|
620
597
|
statusSignal.value = "loading";
|
|
621
598
|
errorSignal.value = null;
|
|
622
|
-
const result = await
|
|
623
|
-
if (
|
|
599
|
+
const result = await authFetch("mfa/challenge", "POST", body);
|
|
600
|
+
if (result.ok) {
|
|
601
|
+
handleAuthSuccess(result.data);
|
|
602
|
+
} else {
|
|
624
603
|
handleAuthError(result.error);
|
|
625
604
|
}
|
|
626
605
|
return result;
|
|
627
606
|
}, {
|
|
628
|
-
url:
|
|
629
|
-
method:
|
|
630
|
-
meta:
|
|
631
|
-
});
|
|
632
|
-
const forgotPasswordMethod = createAuthMethod({
|
|
633
|
-
basePath,
|
|
634
|
-
endpoint: "forgot-password",
|
|
635
|
-
httpMethod: "POST",
|
|
636
|
-
schema: forgotPasswordSchema,
|
|
637
|
-
onSuccess: () => {}
|
|
607
|
+
url: `${basePath}/mfa/challenge`,
|
|
608
|
+
method: "POST",
|
|
609
|
+
meta: { bodySchema: mfaSchema }
|
|
638
610
|
});
|
|
639
611
|
const forgotPassword = Object.assign(async (body) => {
|
|
640
|
-
return
|
|
612
|
+
return authFetch("forgot-password", "POST", body);
|
|
641
613
|
}, {
|
|
642
|
-
url:
|
|
643
|
-
method:
|
|
644
|
-
meta:
|
|
645
|
-
});
|
|
646
|
-
const resetPasswordMethod = createAuthMethod({
|
|
647
|
-
basePath,
|
|
648
|
-
endpoint: "reset-password",
|
|
649
|
-
httpMethod: "POST",
|
|
650
|
-
schema: resetPasswordSchema,
|
|
651
|
-
onSuccess: () => {}
|
|
614
|
+
url: `${basePath}/forgot-password`,
|
|
615
|
+
method: "POST",
|
|
616
|
+
meta: { bodySchema: forgotPasswordSchema }
|
|
652
617
|
});
|
|
653
618
|
const resetPassword = Object.assign(async (body) => {
|
|
654
|
-
return
|
|
619
|
+
return authFetch("reset-password", "POST", body);
|
|
655
620
|
}, {
|
|
656
|
-
url:
|
|
657
|
-
method:
|
|
658
|
-
meta:
|
|
621
|
+
url: `${basePath}/reset-password`,
|
|
622
|
+
method: "POST",
|
|
623
|
+
meta: { bodySchema: resetPasswordSchema }
|
|
659
624
|
});
|
|
660
625
|
const signOut = async (options) => {
|
|
661
626
|
tokenRefresh.cancel();
|
|
662
627
|
try {
|
|
663
|
-
await
|
|
664
|
-
method: "POST",
|
|
665
|
-
headers: { "X-VTZ-Request": "1" },
|
|
666
|
-
credentials: "include"
|
|
667
|
-
});
|
|
628
|
+
await auth.signOut();
|
|
668
629
|
} catch {}
|
|
669
630
|
userSignal.value = null;
|
|
670
631
|
statusSignal.value = "unauthenticated";
|
|
@@ -685,14 +646,9 @@ function AuthProvider({
|
|
|
685
646
|
const doRefresh = async () => {
|
|
686
647
|
statusSignal.value = "loading";
|
|
687
648
|
try {
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
credentials: "include"
|
|
692
|
-
});
|
|
693
|
-
if (res.ok) {
|
|
694
|
-
const data = await res.json();
|
|
695
|
-
handleAuthSuccess(data);
|
|
649
|
+
const result = await auth.refresh();
|
|
650
|
+
if (result.ok) {
|
|
651
|
+
handleAuthSuccess(result.data);
|
|
696
652
|
} else {
|
|
697
653
|
userSignal.value = null;
|
|
698
654
|
statusSignal.value = "unauthenticated";
|
|
@@ -775,6 +731,9 @@ function AuthProvider({
|
|
|
775
731
|
} else {
|
|
776
732
|
statusSignal.value = "unauthenticated";
|
|
777
733
|
}
|
|
734
|
+
if (ssrCtx.ssrAuth.providers) {
|
|
735
|
+
providersSignal.value = ssrCtx.ssrAuth.providers;
|
|
736
|
+
}
|
|
778
737
|
}
|
|
779
738
|
}
|
|
780
739
|
if (accessControl && accessSetSignal && accessLoadingSignal) {
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme component type registry.
|
|
3
|
+
*
|
|
4
|
+
* This interface is empty by default. Theme packages augment it via
|
|
5
|
+
* TypeScript module augmentation to provide typed components.
|
|
6
|
+
*
|
|
7
|
+
* When `@vertz/theme-shadcn` is installed, it augments this interface with
|
|
8
|
+
* all component types (Button, Dialog, Select, etc.), giving full type safety
|
|
9
|
+
* to imports from `@vertz/ui/components`.
|
|
10
|
+
*
|
|
11
|
+
* Without a theme package, components are typed as `unknown` (from the index signature).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* // In @vertz/theme-shadcn (module augmentation):
|
|
16
|
+
* declare module '@vertz/ui/components' {
|
|
17
|
+
* interface ThemeComponentMap {
|
|
18
|
+
* Button: (props: ButtonProps) => HTMLButtonElement;
|
|
19
|
+
* Dialog: ThemedDialogComponent;
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
interface ThemeComponentMap {
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
declare const Button: ThemeComponentMap["Button"];
|
|
28
|
+
declare const Badge: ThemeComponentMap["Badge"];
|
|
29
|
+
declare const Input: ThemeComponentMap["Input"];
|
|
30
|
+
declare const Textarea: ThemeComponentMap["Textarea"];
|
|
31
|
+
declare const Label: ThemeComponentMap["Label"];
|
|
32
|
+
declare const Separator: ThemeComponentMap["Separator"];
|
|
33
|
+
declare const Breadcrumb: ThemeComponentMap["Breadcrumb"];
|
|
34
|
+
declare const Pagination: ThemeComponentMap["Pagination"];
|
|
35
|
+
declare const Alert: ThemeComponentMap["Alert"];
|
|
36
|
+
declare const Card: ThemeComponentMap["Card"];
|
|
37
|
+
declare const FormGroup: ThemeComponentMap["FormGroup"];
|
|
38
|
+
declare const Avatar: ThemeComponentMap["Avatar"];
|
|
39
|
+
declare const Skeleton: ThemeComponentMap["Skeleton"];
|
|
40
|
+
declare const Table: ThemeComponentMap["Table"];
|
|
41
|
+
declare const AlertDialog: ThemeComponentMap["AlertDialog"];
|
|
42
|
+
declare const Dialog: ThemeComponentMap["Dialog"];
|
|
43
|
+
declare const DropdownMenu: ThemeComponentMap["DropdownMenu"];
|
|
44
|
+
declare const Select: ThemeComponentMap["Select"];
|
|
45
|
+
declare const Tabs: ThemeComponentMap["Tabs"];
|
|
46
|
+
declare const Popover: ThemeComponentMap["Popover"];
|
|
47
|
+
declare const RadioGroup: ThemeComponentMap["RadioGroup"];
|
|
48
|
+
declare const Accordion: ThemeComponentMap["Accordion"];
|
|
49
|
+
declare const Tooltip: ThemeComponentMap["Tooltip"];
|
|
50
|
+
declare const ContextMenu: ThemeComponentMap["ContextMenu"];
|
|
51
|
+
declare const Sheet: ThemeComponentMap["Sheet"];
|
|
52
|
+
declare const Drawer: ThemeComponentMap["Drawer"];
|
|
53
|
+
declare const Carousel: ThemeComponentMap["Carousel"];
|
|
54
|
+
declare const Calendar: ThemeComponentMap["Calendar"];
|
|
55
|
+
declare const Checkbox: ThemeComponentMap["Checkbox"];
|
|
56
|
+
declare const Switch: ThemeComponentMap["Switch"];
|
|
57
|
+
declare const Progress: ThemeComponentMap["Progress"];
|
|
58
|
+
declare const Slider: ThemeComponentMap["Slider"];
|
|
59
|
+
declare const Toggle: ThemeComponentMap["Toggle"];
|
|
60
|
+
declare const Toast: ThemeComponentMap["Toast"];
|
|
61
|
+
declare const Collapsible: ThemeComponentMap["Collapsible"];
|
|
62
|
+
declare const Command: ThemeComponentMap["Command"];
|
|
63
|
+
declare const DatePicker: ThemeComponentMap["DatePicker"];
|
|
64
|
+
declare const HoverCard: ThemeComponentMap["HoverCard"];
|
|
65
|
+
declare const Menubar: ThemeComponentMap["Menubar"];
|
|
66
|
+
declare const NavigationMenu: ThemeComponentMap["NavigationMenu"];
|
|
67
|
+
declare const ResizablePanel: ThemeComponentMap["ResizablePanel"];
|
|
68
|
+
declare const ScrollArea: ThemeComponentMap["ScrollArea"];
|
|
69
|
+
declare const ToggleGroup: ThemeComponentMap["ToggleGroup"];
|
|
70
|
+
export { Tooltip, ToggleGroup, Toggle, Toast, ThemeComponentMap, Textarea, Tabs, Table, Switch, Slider, Skeleton, Sheet, Separator, Select, ScrollArea, ResizablePanel, RadioGroup, Progress, Popover, Pagination, NavigationMenu, Menubar, Label, Input, HoverCard, FormGroup, DropdownMenu, Drawer, Dialog, DatePicker, ContextMenu, Command, Collapsible, Checkbox, Carousel, Card, Calendar, Button, Breadcrumb, Badge, Avatar, AlertDialog, Alert, Accordion };
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import {
|
|
2
|
+
_getComponent,
|
|
3
|
+
_getPrimitive
|
|
4
|
+
} from "../../shared/chunk-mwc4v48d.js";
|
|
5
|
+
|
|
6
|
+
// src/components/index.ts
|
|
7
|
+
function createComponentProxy(name) {
|
|
8
|
+
return (...args) => {
|
|
9
|
+
const fn = _getComponent(name);
|
|
10
|
+
if (typeof fn !== "function") {
|
|
11
|
+
throw new Error(`Component "${name}" is not a function in the registered theme. ` + `Check that your theme package provides this component.`);
|
|
12
|
+
}
|
|
13
|
+
return fn(...args);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function createSuiteProxy(name, subComponents) {
|
|
17
|
+
const suite = {};
|
|
18
|
+
for (const sub of subComponents) {
|
|
19
|
+
Object.defineProperty(suite, sub, {
|
|
20
|
+
get: () => {
|
|
21
|
+
const parent = _getComponent(name);
|
|
22
|
+
return Reflect.get(parent, sub);
|
|
23
|
+
},
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return suite;
|
|
29
|
+
}
|
|
30
|
+
function createCompoundProxy(name, subComponents) {
|
|
31
|
+
const root = (...args) => {
|
|
32
|
+
const fn = _getPrimitive(name);
|
|
33
|
+
if (typeof fn !== "function") {
|
|
34
|
+
throw new Error(`Primitive "${name}" is not callable in the registered theme. ` + `Check that your theme package provides this component.`);
|
|
35
|
+
}
|
|
36
|
+
return fn(...args);
|
|
37
|
+
};
|
|
38
|
+
for (const sub of subComponents) {
|
|
39
|
+
Object.defineProperty(root, sub, {
|
|
40
|
+
get: () => {
|
|
41
|
+
const parent = _getPrimitive(name);
|
|
42
|
+
return Reflect.get(parent, sub);
|
|
43
|
+
},
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return root;
|
|
49
|
+
}
|
|
50
|
+
function createPrimitiveProxy(name) {
|
|
51
|
+
return (...args) => {
|
|
52
|
+
const fn = _getPrimitive(name);
|
|
53
|
+
if (typeof fn !== "function") {
|
|
54
|
+
throw new Error(`Primitive "${name}" is not a function in the registered theme. ` + `Check that your theme package provides this component.`);
|
|
55
|
+
}
|
|
56
|
+
return fn(...args);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
var Button = /* @__PURE__ */ createComponentProxy("Button");
|
|
60
|
+
var Badge = /* @__PURE__ */ createComponentProxy("Badge");
|
|
61
|
+
var Input = /* @__PURE__ */ createComponentProxy("Input");
|
|
62
|
+
var Textarea = /* @__PURE__ */ createComponentProxy("Textarea");
|
|
63
|
+
var Label = /* @__PURE__ */ createComponentProxy("Label");
|
|
64
|
+
var Separator = /* @__PURE__ */ createComponentProxy("Separator");
|
|
65
|
+
var Breadcrumb = /* @__PURE__ */ createComponentProxy("Breadcrumb");
|
|
66
|
+
var Pagination = /* @__PURE__ */ createComponentProxy("Pagination");
|
|
67
|
+
var Alert = /* @__PURE__ */ createSuiteProxy("Alert", [
|
|
68
|
+
"Alert",
|
|
69
|
+
"AlertTitle",
|
|
70
|
+
"AlertDescription"
|
|
71
|
+
]);
|
|
72
|
+
var Card = /* @__PURE__ */ createSuiteProxy("Card", [
|
|
73
|
+
"Card",
|
|
74
|
+
"CardHeader",
|
|
75
|
+
"CardTitle",
|
|
76
|
+
"CardDescription",
|
|
77
|
+
"CardContent",
|
|
78
|
+
"CardFooter",
|
|
79
|
+
"CardAction"
|
|
80
|
+
]);
|
|
81
|
+
var FormGroup = /* @__PURE__ */ createSuiteProxy("FormGroup", ["FormGroup", "FormError"]);
|
|
82
|
+
var Avatar = /* @__PURE__ */ createSuiteProxy("Avatar", [
|
|
83
|
+
"Avatar",
|
|
84
|
+
"AvatarImage",
|
|
85
|
+
"AvatarFallback"
|
|
86
|
+
]);
|
|
87
|
+
var Skeleton = /* @__PURE__ */ createSuiteProxy("Skeleton", ["Skeleton"]);
|
|
88
|
+
var Table = /* @__PURE__ */ createSuiteProxy("Table", [
|
|
89
|
+
"Table",
|
|
90
|
+
"TableHeader",
|
|
91
|
+
"TableBody",
|
|
92
|
+
"TableRow",
|
|
93
|
+
"TableHead",
|
|
94
|
+
"TableCell",
|
|
95
|
+
"TableCaption",
|
|
96
|
+
"TableFooter"
|
|
97
|
+
]);
|
|
98
|
+
var AlertDialog = /* @__PURE__ */ createCompoundProxy("AlertDialog", ["Trigger", "Content", "Header", "Title", "Description", "Footer", "Cancel", "Action"]);
|
|
99
|
+
var Dialog = /* @__PURE__ */ createCompoundProxy("Dialog", [
|
|
100
|
+
"Trigger",
|
|
101
|
+
"Content",
|
|
102
|
+
"Header",
|
|
103
|
+
"Title",
|
|
104
|
+
"Description",
|
|
105
|
+
"Footer",
|
|
106
|
+
"Close"
|
|
107
|
+
]);
|
|
108
|
+
var DropdownMenu = /* @__PURE__ */ createCompoundProxy("DropdownMenu", ["Trigger", "Content", "Item", "Group", "Label", "Separator"]);
|
|
109
|
+
var Select = /* @__PURE__ */ createCompoundProxy("Select", [
|
|
110
|
+
"Trigger",
|
|
111
|
+
"Content",
|
|
112
|
+
"Item",
|
|
113
|
+
"Group",
|
|
114
|
+
"Separator"
|
|
115
|
+
]);
|
|
116
|
+
var Tabs = /* @__PURE__ */ createCompoundProxy("Tabs", [
|
|
117
|
+
"List",
|
|
118
|
+
"Trigger",
|
|
119
|
+
"Content"
|
|
120
|
+
]);
|
|
121
|
+
var Popover = /* @__PURE__ */ createCompoundProxy("Popover", ["Trigger", "Content"]);
|
|
122
|
+
var RadioGroup = /* @__PURE__ */ createCompoundProxy("RadioGroup", ["Item"]);
|
|
123
|
+
var Accordion = /* @__PURE__ */ createCompoundProxy("Accordion", ["Item", "Trigger", "Content"]);
|
|
124
|
+
var Tooltip = /* @__PURE__ */ createCompoundProxy("Tooltip", ["Trigger", "Content"]);
|
|
125
|
+
var ContextMenu = /* @__PURE__ */ createCompoundProxy("ContextMenu", ["Trigger", "Content", "Item", "Group", "Label", "Separator"]);
|
|
126
|
+
var Sheet = /* @__PURE__ */ createCompoundProxy("Sheet", [
|
|
127
|
+
"Trigger",
|
|
128
|
+
"Content",
|
|
129
|
+
"Title",
|
|
130
|
+
"Description",
|
|
131
|
+
"Close"
|
|
132
|
+
]);
|
|
133
|
+
var Drawer = /* @__PURE__ */ createCompoundProxy("Drawer", [
|
|
134
|
+
"Trigger",
|
|
135
|
+
"Content",
|
|
136
|
+
"Header",
|
|
137
|
+
"Title",
|
|
138
|
+
"Description",
|
|
139
|
+
"Footer",
|
|
140
|
+
"Handle"
|
|
141
|
+
]);
|
|
142
|
+
var Carousel = /* @__PURE__ */ createCompoundProxy("Carousel", ["Slide", "Previous", "Next"]);
|
|
143
|
+
var Calendar = /* @__PURE__ */ createPrimitiveProxy("Calendar");
|
|
144
|
+
var Checkbox = /* @__PURE__ */ createPrimitiveProxy("Checkbox");
|
|
145
|
+
var Switch = /* @__PURE__ */ createPrimitiveProxy("Switch");
|
|
146
|
+
var Progress = /* @__PURE__ */ createPrimitiveProxy("Progress");
|
|
147
|
+
var Slider = /* @__PURE__ */ createPrimitiveProxy("Slider");
|
|
148
|
+
var Toggle = /* @__PURE__ */ createPrimitiveProxy("Toggle");
|
|
149
|
+
var Toast = /* @__PURE__ */ createPrimitiveProxy("Toast");
|
|
150
|
+
var Collapsible = /* @__PURE__ */ createCompoundProxy("Collapsible", ["Trigger", "Content"]);
|
|
151
|
+
var Command = /* @__PURE__ */ createCompoundProxy("Command", ["Input", "List", "Empty", "Item", "Group", "Separator"]);
|
|
152
|
+
var DatePicker = /* @__PURE__ */ createCompoundProxy("DatePicker", ["Trigger", "Content"]);
|
|
153
|
+
var HoverCard = /* @__PURE__ */ createCompoundProxy("HoverCard", ["Trigger", "Content"]);
|
|
154
|
+
var Menubar = /* @__PURE__ */ createCompoundProxy("Menubar", ["Menu", "Trigger", "Content", "Item", "Group", "Label", "Separator"]);
|
|
155
|
+
var NavigationMenu = /* @__PURE__ */ createCompoundProxy("NavigationMenu", [
|
|
156
|
+
"List",
|
|
157
|
+
"Item",
|
|
158
|
+
"Trigger",
|
|
159
|
+
"Content",
|
|
160
|
+
"Link",
|
|
161
|
+
"Viewport"
|
|
162
|
+
]);
|
|
163
|
+
var ResizablePanel = /* @__PURE__ */ createCompoundProxy("ResizablePanel", [
|
|
164
|
+
"Panel",
|
|
165
|
+
"Handle"
|
|
166
|
+
]);
|
|
167
|
+
var ScrollArea = /* @__PURE__ */ createPrimitiveProxy("ScrollArea");
|
|
168
|
+
var ToggleGroup = /* @__PURE__ */ createCompoundProxy("ToggleGroup", ["Item"]);
|
|
169
|
+
export {
|
|
170
|
+
Tooltip,
|
|
171
|
+
ToggleGroup,
|
|
172
|
+
Toggle,
|
|
173
|
+
Toast,
|
|
174
|
+
Textarea,
|
|
175
|
+
Tabs,
|
|
176
|
+
Table,
|
|
177
|
+
Switch,
|
|
178
|
+
Slider,
|
|
179
|
+
Skeleton,
|
|
180
|
+
Sheet,
|
|
181
|
+
Separator,
|
|
182
|
+
Select,
|
|
183
|
+
ScrollArea,
|
|
184
|
+
ResizablePanel,
|
|
185
|
+
RadioGroup,
|
|
186
|
+
Progress,
|
|
187
|
+
Popover,
|
|
188
|
+
Pagination,
|
|
189
|
+
NavigationMenu,
|
|
190
|
+
Menubar,
|
|
191
|
+
Label,
|
|
192
|
+
Input,
|
|
193
|
+
HoverCard,
|
|
194
|
+
FormGroup,
|
|
195
|
+
DropdownMenu,
|
|
196
|
+
Drawer,
|
|
197
|
+
Dialog,
|
|
198
|
+
DatePicker,
|
|
199
|
+
ContextMenu,
|
|
200
|
+
Command,
|
|
201
|
+
Collapsible,
|
|
202
|
+
Checkbox,
|
|
203
|
+
Carousel,
|
|
204
|
+
Card,
|
|
205
|
+
Calendar,
|
|
206
|
+
Button,
|
|
207
|
+
Breadcrumb,
|
|
208
|
+
Badge,
|
|
209
|
+
Avatar,
|
|
210
|
+
AlertDialog,
|
|
211
|
+
Alert,
|
|
212
|
+
Accordion
|
|
213
|
+
};
|