@heyramzi/ui 2.21.0 → 2.21.1
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/shadcn/alert/alert-variants.js +9 -0
- package/dist/shadcn/alert/index.js +1 -1
- package/dist/shadcn/badge/badge-variants.js +17 -0
- package/dist/shadcn/badge/index.js +1 -1
- package/dist/shadcn/toggle/index.js +1 -1
- package/dist/shadcn/toggle/toggle-variants.js +20 -0
- package/dist/status/index.js +2 -1
- package/dist/status/pill-tint.js +13 -0
- package/package.json +23 -23
- package/src/record/record-rail.svelte +5 -1
- package/src/shadcn/alert/alert-variants.ts +17 -0
- package/src/shadcn/alert/alert.svelte +2 -16
- package/src/shadcn/alert/index.ts +1 -1
- package/src/shadcn/badge/badge-variants.ts +23 -0
- package/src/shadcn/badge/badge.svelte +2 -22
- package/src/shadcn/badge/index.ts +1 -1
- package/src/shadcn/toggle/index.ts +1 -1
- package/src/shadcn/toggle/toggle-variants.ts +26 -0
- package/src/shadcn/toggle/toggle.svelte +7 -25
- package/src/status/index.ts +2 -1
- package/src/status/pill-tint.ts +16 -0
- package/src/status/status-pill.svelte +2 -12
- package/src/svelte-reexports.test.ts +43 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
export const alertVariants = tv({
|
|
3
|
+
base: "relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
|
4
|
+
variants: { variant: {
|
|
5
|
+
default: "bg-card text-card-foreground",
|
|
6
|
+
destructive: "text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current"
|
|
7
|
+
} },
|
|
8
|
+
defaultVariants: { variant: "default" }
|
|
9
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Root from "../../../src/shadcn/alert/alert.svelte";
|
|
2
2
|
import Description from "../../../src/shadcn/alert/alert-description.svelte";
|
|
3
3
|
import Title from "../../../src/shadcn/alert/alert-title.svelte";
|
|
4
|
-
export { alertVariants } from "
|
|
4
|
+
export { alertVariants } from "./alert-variants.js";
|
|
5
5
|
export { Root, Description, Title,
|
|
6
6
|
//
|
|
7
7
|
Root as Alert, Description as AlertDescription, Title as AlertTitle };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
export const badgeVariants = tv({
|
|
3
|
+
// The chip radius, not a pill: DESIGN.md keeps `rounded-full` for status and counts,
|
|
4
|
+
// which `StatusBadge` owns. Tabular figures so a count that ticks doesn't shift.
|
|
5
|
+
base: "h-5 gap-1 rounded-sm border border-transparent px-2 py-0.5 text-xs font-medium tabular-nums has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! focus-visible:border-ring focus-visible:shadow-(--ring-focus) aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive group/badge inline-flex w-fit max-w-full shrink-0 items-center justify-center overflow-hidden whitespace-nowrap transition-[background-color,border-color,color,box-shadow] duration-[var(--duration-quick)] ease-[var(--ease-smooth-out)] [&>svg]:pointer-events-none",
|
|
6
|
+
variants: {
|
|
7
|
+
// Three weights a label can carry: filled, tinted, outlined. Severity is the
|
|
8
|
+
// `tone` prop, which reads `TONE_CLASS`, not a variant.
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
11
|
+
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
12
|
+
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
13
|
+
// For a consumer that wants one "this is wrong" badge without a tone prop.
|
|
14
|
+
destructive: "bg-destructive/10 text-destructive-ink [a]:hover:bg-destructive/20"
|
|
15
|
+
} },
|
|
16
|
+
defaultVariants: { variant: "default" }
|
|
17
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as Badge } from "../../../src/shadcn/badge/badge.svelte";
|
|
2
|
-
export { badgeVariants } from "
|
|
2
|
+
export { badgeVariants } from "./badge-variants.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
export const toggleVariants = tv({
|
|
3
|
+
base: "relative after:absolute after:top-1/2 after:left-1/2 after:h-[max(100%,2rem)] after:w-[max(100%,2rem)] after:-translate-x-1/2 after:-translate-y-1/2 any-pointer-coarse:after:h-[max(100%,2.75rem)] any-pointer-coarse:after:w-[max(100%,2.75rem)] hover:bg-muted hover:text-muted-foreground data-[state=on]:bg-accent data-[state=on]:text-accent-foreground focus-visible:shadow-(--ring-focus) aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[background-color,color,box-shadow] duration-[var(--duration-quick)] ease-[var(--ease-smooth-out)] outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
4
|
+
variants: {
|
|
5
|
+
variant: {
|
|
6
|
+
default: "bg-transparent",
|
|
7
|
+
outline: "border-input hover:bg-accent hover:text-accent-foreground border bg-transparent shadow-btn"
|
|
8
|
+
},
|
|
9
|
+
size: {
|
|
10
|
+
// Same steps as Button: sm 28, default 32, lg 36. 40 went with the scale.
|
|
11
|
+
default: "h-8 min-w-8 px-2",
|
|
12
|
+
sm: "h-7 min-w-7 px-1.5",
|
|
13
|
+
lg: "h-9 min-w-9 px-2.5"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
variant: "default",
|
|
18
|
+
size: "default"
|
|
19
|
+
}
|
|
20
|
+
});
|
package/dist/status/index.js
CHANGED
|
@@ -2,4 +2,5 @@ export { default as StatusBadge } from "../../src/status/status-badge.svelte";
|
|
|
2
2
|
export { default as StatusDot } from "../../src/status/status-dot.svelte";
|
|
3
3
|
export { default as StatusIcon } from "../../src/status/status-icon.svelte";
|
|
4
4
|
export { defineStatuses } from "./define-statuses.js";
|
|
5
|
-
export { default as StatusPill
|
|
5
|
+
export { default as StatusPill } from "../../src/status/status-pill.svelte";
|
|
6
|
+
export { PILL_TINT } from "./pill-tint.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// A quiet tint and no border: the icon and the text carry the tone, the fill only groups
|
|
2
|
+
// them. Neutral reads off the foreground, not `bg-muted`, because muted sits 0.005 L from
|
|
3
|
+
// the canvas and vanishes there (tokens board, "what fights the new scale").
|
|
4
|
+
// It lives in a .ts module, not status-pill.svelte's module script, so a plain tsc consumer
|
|
5
|
+
// can import it: tsc's `*.svelte` shim only knows a default export.
|
|
6
|
+
export const PILL_TINT = {
|
|
7
|
+
neutral: "bg-foreground/6 text-muted-foreground",
|
|
8
|
+
accent: "bg-[color-mix(in_oklab,var(--tone-accent,var(--color-primary))_12%,transparent)] text-[color:var(--tone-accent,var(--color-primary))]",
|
|
9
|
+
info: "bg-info/12 text-info-800 dark:text-info-400",
|
|
10
|
+
success: "bg-success/12 text-success-800 dark:text-success-400",
|
|
11
|
+
warning: "bg-warning/14 text-warning-800 dark:text-warning-400",
|
|
12
|
+
destructive: "bg-destructive/10 text-destructive-ink"
|
|
13
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heyramzi/ui",
|
|
3
|
-
"version": "2.21.
|
|
3
|
+
"version": "2.21.1",
|
|
4
4
|
"description": "Svelte 5 UI for apps: primitives, effects and animations, plus work (tasks and docs), charts, slides, an editor, onboarding and a canvas as subpaths.",
|
|
5
5
|
"homepage": "https://ui.heyramzi.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -387,29 +387,29 @@
|
|
|
387
387
|
"dependencies": {
|
|
388
388
|
"@dagrejs/dagre": "^3.1.3",
|
|
389
389
|
"@shadcn-svelte/primitives": "^0.0.1",
|
|
390
|
-
"@tiptap/core": "^3.32.
|
|
391
|
-
"@tiptap/extension-drag-handle": "^3.32.
|
|
392
|
-
"@tiptap/extension-image": "^3.32.
|
|
393
|
-
"@tiptap/extension-list": "^3.32.
|
|
394
|
-
"@tiptap/extension-placeholder": "^3.32.
|
|
395
|
-
"@tiptap/extension-table": "^3.32.
|
|
396
|
-
"@tiptap/pm": "^3.32.
|
|
397
|
-
"@tiptap/starter-kit": "^3.32.
|
|
398
|
-
"@zag-js/svelte": "^1.
|
|
399
|
-
"@zag-js/tour": "^1.
|
|
390
|
+
"@tiptap/core": "^3.32.2",
|
|
391
|
+
"@tiptap/extension-drag-handle": "^3.32.2",
|
|
392
|
+
"@tiptap/extension-image": "^3.32.2",
|
|
393
|
+
"@tiptap/extension-list": "^3.32.2",
|
|
394
|
+
"@tiptap/extension-placeholder": "^3.32.2",
|
|
395
|
+
"@tiptap/extension-table": "^3.32.2",
|
|
396
|
+
"@tiptap/pm": "^3.32.2",
|
|
397
|
+
"@tiptap/starter-kit": "^3.32.2",
|
|
398
|
+
"@zag-js/svelte": "^1.47.0",
|
|
399
|
+
"@zag-js/tour": "^1.47.0",
|
|
400
400
|
"clsx": "^2.1.1",
|
|
401
401
|
"cuelume": "^0.2.8",
|
|
402
|
-
"d3-scale": "^4.0.
|
|
403
|
-
"d3-shape": "^3.2.
|
|
404
|
-
"layerchart": "^2.9.
|
|
402
|
+
"d3-scale": "^4.0.3",
|
|
403
|
+
"d3-shape": "^3.2.1",
|
|
404
|
+
"layerchart": "^2.9.2",
|
|
405
405
|
"markdown-it": "^15.0.3",
|
|
406
|
-
"marked": "^18.1.
|
|
406
|
+
"marked": "^18.1.3",
|
|
407
407
|
"perfect-freehand": "^1.2.3",
|
|
408
408
|
"phosphor-svelte": "^3.1.1",
|
|
409
409
|
"roughjs": "^4.6.6",
|
|
410
|
-
"shiki": "^4.
|
|
410
|
+
"shiki": "^4.6.0",
|
|
411
411
|
"tailwind-merge": "^3.7.0",
|
|
412
|
-
"tailwind-variants": "^
|
|
412
|
+
"tailwind-variants": "^4.0.1",
|
|
413
413
|
"zod": "^4.6.7"
|
|
414
414
|
},
|
|
415
415
|
"devDependencies": {
|
|
@@ -417,16 +417,16 @@
|
|
|
417
417
|
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
418
418
|
"@types/d3-scale": "^4.0.9",
|
|
419
419
|
"@types/d3-shape": "^3.2.0",
|
|
420
|
-
"@types/node": "^26.6.
|
|
421
|
-
"@xyflow/svelte": "^1.7.
|
|
422
|
-
"bits-ui": "^2.20.
|
|
420
|
+
"@types/node": "^26.6.6",
|
|
421
|
+
"@xyflow/svelte": "^1.7.1",
|
|
422
|
+
"bits-ui": "^2.20.3",
|
|
423
423
|
"jsdom": "^30.1.3",
|
|
424
424
|
"mode-watcher": "^1.1.0",
|
|
425
425
|
"svelte": "^5.57.3",
|
|
426
|
-
"svelte-check": "^4.7.
|
|
427
|
-
"svelte-sonner": "^1.2.
|
|
426
|
+
"svelte-check": "^4.7.8",
|
|
427
|
+
"svelte-sonner": "^1.2.3",
|
|
428
428
|
"typescript": "~7.0.2",
|
|
429
|
-
"vite-plus": "1.
|
|
429
|
+
"vite-plus": "1.5.0"
|
|
430
430
|
},
|
|
431
431
|
"peerDependencies": {
|
|
432
432
|
"@internationalized/date": "^3.12.4",
|
|
@@ -51,7 +51,11 @@
|
|
|
51
51
|
|
|
52
52
|
<!-- A record's side rail with tabs: the fields in one, a thread or a log in the next,
|
|
53
53
|
so the thread sits beside the record and not a screen below it. One tab draws no strip. -->
|
|
54
|
-
<Tabs.Root
|
|
54
|
+
<Tabs.Root
|
|
55
|
+
value={open}
|
|
56
|
+
onValueChange={(next) => (value = next)}
|
|
57
|
+
class={cn("min-w-0 gap-0", className)}
|
|
58
|
+
>
|
|
55
59
|
{#if tabs.length > 1}
|
|
56
60
|
<div class={cn("pb-3", listClass)}>
|
|
57
61
|
<Tabs.List size="sm" class="w-full" aria-label={label}>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type VariantProps, tv } from "tailwind-variants";
|
|
2
|
+
|
|
3
|
+
export const alertVariants = tv({
|
|
4
|
+
base: "relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
|
5
|
+
variants: {
|
|
6
|
+
variant: {
|
|
7
|
+
default: "bg-card text-card-foreground",
|
|
8
|
+
destructive:
|
|
9
|
+
"text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
variant: "default",
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type AlertVariant = VariantProps<typeof alertVariants>["variant"];
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import { type
|
|
2
|
+
import { alertVariants, type AlertVariant } from "./alert-variants.js";
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
base: "relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
|
6
|
-
variants: {
|
|
7
|
-
variant: {
|
|
8
|
-
default: "bg-card text-card-foreground",
|
|
9
|
-
destructive:
|
|
10
|
-
"text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current",
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
defaultVariants: {
|
|
14
|
-
variant: "default",
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export type AlertVariant = VariantProps<typeof alertVariants>["variant"];
|
|
4
|
+
export { alertVariants, type AlertVariant };
|
|
19
5
|
</script>
|
|
20
6
|
|
|
21
7
|
<script lang="ts">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Root from "./alert.svelte";
|
|
2
2
|
import Description from "./alert-description.svelte";
|
|
3
3
|
import Title from "./alert-title.svelte";
|
|
4
|
-
export { alertVariants, type AlertVariant } from "./alert.
|
|
4
|
+
export { alertVariants, type AlertVariant } from "./alert-variants.js";
|
|
5
5
|
|
|
6
6
|
export {
|
|
7
7
|
Root,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type VariantProps, tv } from "tailwind-variants";
|
|
2
|
+
|
|
3
|
+
export const badgeVariants = tv({
|
|
4
|
+
// The chip radius, not a pill: DESIGN.md keeps `rounded-full` for status and counts,
|
|
5
|
+
// which `StatusBadge` owns. Tabular figures so a count that ticks doesn't shift.
|
|
6
|
+
base: "h-5 gap-1 rounded-sm border border-transparent px-2 py-0.5 text-xs font-medium tabular-nums has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! focus-visible:border-ring focus-visible:shadow-(--ring-focus) aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive group/badge inline-flex w-fit max-w-full shrink-0 items-center justify-center overflow-hidden whitespace-nowrap transition-[background-color,border-color,color,box-shadow] duration-[var(--duration-quick)] ease-[var(--ease-smooth-out)] [&>svg]:pointer-events-none",
|
|
7
|
+
variants: {
|
|
8
|
+
// Three weights a label can carry: filled, tinted, outlined. Severity is the
|
|
9
|
+
// `tone` prop, which reads `TONE_CLASS`, not a variant.
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
12
|
+
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
13
|
+
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
14
|
+
// For a consumer that wants one "this is wrong" badge without a tone prop.
|
|
15
|
+
destructive: "bg-destructive/10 text-destructive-ink [a]:hover:bg-destructive/20",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: "default",
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type BadgeVariant = VariantProps<typeof badgeVariants>["variant"];
|
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import { type
|
|
2
|
+
import { badgeVariants, type BadgeVariant } from "./badge-variants.js";
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
// The chip radius, not a pill: DESIGN.md keeps `rounded-full` for status and counts,
|
|
6
|
-
// which `StatusBadge` owns. Tabular figures so a count that ticks doesn't shift.
|
|
7
|
-
base: "h-5 gap-1 rounded-sm border border-transparent px-2 py-0.5 text-xs font-medium tabular-nums has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! focus-visible:border-ring focus-visible:shadow-(--ring-focus) aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive group/badge inline-flex w-fit max-w-full shrink-0 items-center justify-center overflow-hidden whitespace-nowrap transition-[background-color,border-color,color,box-shadow] duration-[var(--duration-quick)] ease-[var(--ease-smooth-out)] [&>svg]:pointer-events-none",
|
|
8
|
-
variants: {
|
|
9
|
-
// Three weights a label can carry: filled, tinted, outlined. Severity is the
|
|
10
|
-
// `tone` prop, which reads `TONE_CLASS`, not a variant.
|
|
11
|
-
variant: {
|
|
12
|
-
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
|
|
13
|
-
secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
|
|
14
|
-
outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
|
|
15
|
-
// For a consumer that wants one "this is wrong" badge without a tone prop.
|
|
16
|
-
destructive: "bg-destructive/10 text-destructive-ink [a]:hover:bg-destructive/20",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
defaultVariants: {
|
|
20
|
-
variant: "default",
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export type BadgeVariant = VariantProps<typeof badgeVariants>["variant"];
|
|
4
|
+
export { badgeVariants, type BadgeVariant };
|
|
25
5
|
</script>
|
|
26
6
|
|
|
27
7
|
<script lang="ts">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as Badge } from "./badge.svelte";
|
|
2
|
-
export { badgeVariants, type BadgeVariant } from "./badge.
|
|
2
|
+
export { badgeVariants, type BadgeVariant } from "./badge-variants.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type VariantProps, tv } from "tailwind-variants";
|
|
2
|
+
|
|
3
|
+
export const toggleVariants = tv({
|
|
4
|
+
base: "relative after:absolute after:top-1/2 after:left-1/2 after:h-[max(100%,2rem)] after:w-[max(100%,2rem)] after:-translate-x-1/2 after:-translate-y-1/2 any-pointer-coarse:after:h-[max(100%,2.75rem)] any-pointer-coarse:after:w-[max(100%,2.75rem)] hover:bg-muted hover:text-muted-foreground data-[state=on]:bg-accent data-[state=on]:text-accent-foreground focus-visible:shadow-(--ring-focus) aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[background-color,color,box-shadow] duration-[var(--duration-quick)] ease-[var(--ease-smooth-out)] outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
5
|
+
variants: {
|
|
6
|
+
variant: {
|
|
7
|
+
default: "bg-transparent",
|
|
8
|
+
outline:
|
|
9
|
+
"border-input hover:bg-accent hover:text-accent-foreground border bg-transparent shadow-btn",
|
|
10
|
+
},
|
|
11
|
+
size: {
|
|
12
|
+
// Same steps as Button: sm 28, default 32, lg 36. 40 went with the scale.
|
|
13
|
+
default: "h-8 min-w-8 px-2",
|
|
14
|
+
sm: "h-7 min-w-7 px-1.5",
|
|
15
|
+
lg: "h-9 min-w-9 px-2.5",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: "default",
|
|
20
|
+
size: "default",
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export type ToggleVariant = VariantProps<typeof toggleVariants>["variant"];
|
|
25
|
+
export type ToggleSize = VariantProps<typeof toggleVariants>["size"];
|
|
26
|
+
export type ToggleVariants = VariantProps<typeof toggleVariants>;
|
|
@@ -1,30 +1,12 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
toggleVariants,
|
|
4
|
+
type ToggleSize,
|
|
5
|
+
type ToggleVariant,
|
|
6
|
+
type ToggleVariants,
|
|
7
|
+
} from "./toggle-variants.js";
|
|
3
8
|
|
|
4
|
-
export
|
|
5
|
-
base: "relative after:absolute after:top-1/2 after:left-1/2 after:h-[max(100%,2rem)] after:w-[max(100%,2rem)] after:-translate-x-1/2 after:-translate-y-1/2 any-pointer-coarse:after:h-[max(100%,2.75rem)] any-pointer-coarse:after:w-[max(100%,2.75rem)] hover:bg-muted hover:text-muted-foreground data-[state=on]:bg-accent data-[state=on]:text-accent-foreground focus-visible:shadow-(--ring-focus) aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[background-color,color,box-shadow] duration-[var(--duration-quick)] ease-[var(--ease-smooth-out)] outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
6
|
-
variants: {
|
|
7
|
-
variant: {
|
|
8
|
-
default: "bg-transparent",
|
|
9
|
-
outline:
|
|
10
|
-
"border-input hover:bg-accent hover:text-accent-foreground border bg-transparent shadow-btn",
|
|
11
|
-
},
|
|
12
|
-
size: {
|
|
13
|
-
// Same steps as Button: sm 28, default 32, lg 36. 40 went with the scale.
|
|
14
|
-
default: "h-8 min-w-8 px-2",
|
|
15
|
-
sm: "h-7 min-w-7 px-1.5",
|
|
16
|
-
lg: "h-9 min-w-9 px-2.5",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
defaultVariants: {
|
|
20
|
-
variant: "default",
|
|
21
|
-
size: "default",
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export type ToggleVariant = VariantProps<typeof toggleVariants>["variant"];
|
|
26
|
-
export type ToggleSize = VariantProps<typeof toggleVariants>["size"];
|
|
27
|
-
export type ToggleVariants = VariantProps<typeof toggleVariants>;
|
|
9
|
+
export { toggleVariants, type ToggleSize, type ToggleVariant, type ToggleVariants };
|
|
28
10
|
</script>
|
|
29
11
|
|
|
30
12
|
<script lang="ts">
|
package/src/status/index.ts
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Tone } from "../lib/tone.js";
|
|
2
|
+
|
|
3
|
+
// A quiet tint and no border: the icon and the text carry the tone, the fill only groups
|
|
4
|
+
// them. Neutral reads off the foreground, not `bg-muted`, because muted sits 0.005 L from
|
|
5
|
+
// the canvas and vanishes there (tokens board, "what fights the new scale").
|
|
6
|
+
// It lives in a .ts module, not status-pill.svelte's module script, so a plain tsc consumer
|
|
7
|
+
// can import it: tsc's `*.svelte` shim only knows a default export.
|
|
8
|
+
export const PILL_TINT: Record<Tone, string> = {
|
|
9
|
+
neutral: "bg-foreground/6 text-muted-foreground",
|
|
10
|
+
accent:
|
|
11
|
+
"bg-[color-mix(in_oklab,var(--tone-accent,var(--color-primary))_12%,transparent)] text-[color:var(--tone-accent,var(--color-primary))]",
|
|
12
|
+
info: "bg-info/12 text-info-800 dark:text-info-400",
|
|
13
|
+
success: "bg-success/12 text-success-800 dark:text-success-400",
|
|
14
|
+
warning: "bg-warning/14 text-warning-800 dark:text-warning-400",
|
|
15
|
+
destructive: "bg-destructive/10 text-destructive-ink",
|
|
16
|
+
};
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Tone } from "../lib/tone.js";
|
|
3
|
+
import { PILL_TINT } from "./pill-tint.js";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
// them. Neutral reads off the foreground, not `bg-muted`, because muted sits 0.005 L from
|
|
6
|
-
// the canvas and vanishes there (tokens board, "what fights the new scale").
|
|
7
|
-
export const PILL_TINT: Record<Tone, string> = {
|
|
8
|
-
neutral: "bg-foreground/6 text-muted-foreground",
|
|
9
|
-
accent:
|
|
10
|
-
"bg-[color-mix(in_oklab,var(--tone-accent,var(--color-primary))_12%,transparent)] text-[color:var(--tone-accent,var(--color-primary))]",
|
|
11
|
-
info: "bg-info/12 text-info-800 dark:text-info-400",
|
|
12
|
-
success: "bg-success/12 text-success-800 dark:text-success-400",
|
|
13
|
-
warning: "bg-warning/14 text-warning-800 dark:text-warning-400",
|
|
14
|
-
destructive: "bg-destructive/10 text-destructive-ink",
|
|
15
|
-
};
|
|
5
|
+
export { PILL_TINT };
|
|
16
6
|
</script>
|
|
17
7
|
|
|
18
8
|
<script lang="ts">
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join, relative } from "node:path";
|
|
3
|
+
import { describe, expect, it } from "vite-plus/test";
|
|
4
|
+
|
|
5
|
+
// A plain tsc consumer (upsys app-cli) reads this package's src through a `*.svelte` shim that
|
|
6
|
+
// only knows a default export. A .ts file that re-exports a named value from a .svelte module
|
|
7
|
+
// fails there, as PILL_TINT did in 2.21.0. Named values live in a .ts module the component imports.
|
|
8
|
+
const root = import.meta.dirname;
|
|
9
|
+
|
|
10
|
+
function tsFiles(dir: string): string[] {
|
|
11
|
+
return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
|
|
12
|
+
const path = join(dir, entry.name);
|
|
13
|
+
if (entry.isDirectory()) return tsFiles(path);
|
|
14
|
+
return entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts") ? [path] : [];
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const reexport =
|
|
19
|
+
/export\s+(type\s+)?(\*|\{[^}]*\})\s*(?:as\s+\w+\s*)?from\s*["']([^"']+\.svelte)["']/g;
|
|
20
|
+
|
|
21
|
+
describe("re-exports from .svelte modules", () => {
|
|
22
|
+
it("carry only the default export or types", () => {
|
|
23
|
+
const offenders: string[] = [];
|
|
24
|
+
for (const file of tsFiles(root)) {
|
|
25
|
+
for (const [, typeOnly, list, from] of readFileSync(file, "utf8").matchAll(reexport)) {
|
|
26
|
+
if (typeOnly) continue;
|
|
27
|
+
const names =
|
|
28
|
+
list === "*"
|
|
29
|
+
? ["*"]
|
|
30
|
+
: list
|
|
31
|
+
.slice(1, -1)
|
|
32
|
+
.split(",")
|
|
33
|
+
.map((n) => n.trim());
|
|
34
|
+
const values = names.filter(
|
|
35
|
+
(n) => n && n !== "default" && !/^(type\s|default\s+as\s)/.test(n),
|
|
36
|
+
);
|
|
37
|
+
if (values.length)
|
|
38
|
+
offenders.push(`${relative(root, file)}: ${values.join(", ")} from ${from}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
expect(offenders).toEqual([]);
|
|
42
|
+
});
|
|
43
|
+
});
|