@adea-ai/ui 0.162.14 → 0.162.16
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/components/composites/accent-picker/accent-picker.js +1 -1
- package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
- package/dist/components/composites/accent-picker/custom-color-popover.js +1 -1
- package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js +1 -1
- package/dist/components/composites/appearance-editor/accent-swatch-groups.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +2 -2
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/confirmation/confirmation.js +1 -1
- package/dist/components/composites/confirmation/confirmation.js.map +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js +1 -1
- package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
- package/dist/components/composites/list-row/list-row-control.js +1 -1
- package/dist/components/composites/list-row/list-row-control.js.map +1 -1
- package/dist/components/composites/settings/settings.js +1 -1
- package/dist/components/composites/settings/settings.js.map +1 -1
- package/dist/components/composites/stack-trace/stack-trace.js +1 -1
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -1
- package/dist/components/composites/tree/tree.js +1 -1
- package/dist/components/composites/tree/tree.js.map +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js +1 -1
- package/dist/components/composites/workspace-mark/workspace-mark.js.map +1 -1
- package/dist/components/conversation/thread-panel.js +1 -1
- package/dist/components/conversation/thread-panel.js.map +1 -1
- package/dist/components/layout/app-shell/skip-link.js +1 -1
- package/dist/components/layout/app-shell/skip-link.js.map +1 -1
- package/dist/components/layout/side-rail/side-rail.js +1 -1
- package/dist/components/layout/side-rail/side-rail.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-classes.js +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav-classes.js.map +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js +1 -1
- package/dist/components/layout/sidebar-nav/sidebar-nav.js.map +1 -1
- package/dist/components/layout/top-bar/top-bar.js +2 -2
- package/dist/components/layout/top-bar/top-bar.js.map +1 -1
- package/dist/components/ui/accordion/accordion.js +1 -1
- package/dist/components/ui/accordion/accordion.js.map +1 -1
- package/dist/components/ui/annotation-surface/annotation-surface.js +1 -1
- package/dist/components/ui/annotation-surface/annotation-surface.js.map +1 -1
- package/dist/components/ui/attachment/attachment.js +2 -2
- package/dist/components/ui/attachment/attachment.js.map +1 -1
- package/dist/components/ui/board/board.js +2 -2
- package/dist/components/ui/board/board.js.map +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.js +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/ui/button/button.js +1 -1
- package/dist/components/ui/button/button.js.map +1 -1
- package/dist/components/ui/checkbox/checkbox.js +1 -1
- package/dist/components/ui/checkbox/checkbox.js.map +1 -1
- package/dist/components/ui/collapsible/collapsible.js +1 -1
- package/dist/components/ui/collapsible/collapsible.js.map +1 -1
- package/dist/components/ui/combobox/combobox.js +3 -3
- package/dist/components/ui/combobox/combobox.js.map +1 -1
- package/dist/components/ui/field/field.js +2 -2
- package/dist/components/ui/field/field.js.map +1 -1
- package/dist/components/ui/input/input-control.js +1 -1
- package/dist/components/ui/input/input-control.js.map +1 -1
- package/dist/components/ui/input-group/input-group.js +1 -1
- package/dist/components/ui/input-group/input-group.js.map +1 -1
- package/dist/components/ui/input-otp/input-otp.js +1 -1
- package/dist/components/ui/input-otp/input-otp.js.map +1 -1
- package/dist/components/ui/menubar/menubar.js +1 -1
- package/dist/components/ui/menubar/menubar.js.map +1 -1
- package/dist/components/ui/native-select/native-select.js +1 -1
- package/dist/components/ui/native-select/native-select.js.map +1 -1
- package/dist/components/ui/pagination/pagination.js +1 -1
- package/dist/components/ui/pagination/pagination.js.map +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js +1 -1
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -1
- package/dist/components/ui/radio-group/radio-group.js +2 -2
- package/dist/components/ui/radio-group/radio-group.js.map +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js +1 -1
- package/dist/components/ui/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/ui/select/select.js +1 -1
- package/dist/components/ui/select/select.js.map +1 -1
- package/dist/components/ui/slider/slider.js +1 -1
- package/dist/components/ui/slider/slider.js.map +1 -1
- package/dist/components/ui/switch/switch.js +1 -1
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/tabs/tabs.js +1 -1
- package/dist/components/ui/tabs/tabs.js.map +1 -1
- package/dist/components/ui/text-link/text-link.js +1 -1
- package/dist/components/ui/text-link/text-link.js.map +1 -1
- package/dist/components/ui/textarea/textarea.js +1 -1
- package/dist/components/ui/textarea/textarea.js.map +1 -1
- package/dist/components/ui/toast/toast.js +1 -1
- package/dist/components/ui/toast/toast.js.map +1 -1
- package/dist/components/ui/trace/trace.js +1 -1
- package/dist/components/ui/trace/trace.js.map +1 -1
- package/dist/lib/overlay.d.ts.map +1 -1
- package/dist/lib/overlay.js +1 -1
- package/dist/lib/overlay.js.map +1 -1
- package/dist/lib/tokens.d.ts.map +1 -1
- package/dist/lib/tokens.js +2 -2
- package/dist/lib/tokens.js.map +1 -1
- package/dist/lib/variants.d.ts +1 -1
- package/dist/lib/variants.d.ts.map +1 -1
- package/dist/lib/variants.js +1 -1
- package/dist/lib/variants.js.map +1 -1
- package/dist/r/src/components/composites/accent-picker/accent-picker.tsx +1 -1
- package/dist/r/src/components/composites/accent-picker/custom-color-popover.tsx +1 -1
- package/dist/r/src/components/composites/appearance-editor/accent-swatch-groups.tsx +1 -1
- package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +2 -5
- package/dist/r/src/components/composites/confirmation/confirmation.tsx +1 -1
- package/dist/r/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/dist/r/src/components/composites/list-row/list-row-control.tsx +1 -1
- package/dist/r/src/components/composites/settings/settings.tsx +1 -1
- package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +1 -1
- package/dist/r/src/components/composites/tree/tree.tsx +1 -1
- package/dist/r/src/components/composites/workspace-mark/workspace-mark.tsx +1 -1
- package/dist/r/src/components/conversation/thread-panel.tsx +1 -1
- package/dist/r/src/components/layout/app-shell/skip-link.tsx +1 -1
- package/dist/r/src/components/layout/side-rail/side-rail.tsx +1 -1
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav-classes.ts +1 -1
- package/dist/r/src/components/layout/sidebar-nav/sidebar-nav.tsx +1 -1
- package/dist/r/src/components/layout/top-bar/top-bar.tsx +2 -2
- package/dist/r/src/components/ui/accordion/accordion.tsx +1 -1
- package/dist/r/src/components/ui/annotation-surface/annotation-surface.tsx +1 -1
- package/dist/r/src/components/ui/attachment/attachment.tsx +2 -2
- package/dist/r/src/components/ui/board/board.tsx +2 -2
- package/dist/r/src/components/ui/breadcrumb/breadcrumb.tsx +1 -1
- package/dist/r/src/components/ui/button/button.tsx +1 -1
- package/dist/r/src/components/ui/checkbox/checkbox.tsx +1 -1
- package/dist/r/src/components/ui/collapsible/collapsible.tsx +1 -1
- package/dist/r/src/components/ui/combobox/combobox.tsx +3 -3
- package/dist/r/src/components/ui/field/field.tsx +2 -2
- package/dist/r/src/components/ui/input/input-control.tsx +1 -1
- package/dist/r/src/components/ui/input-group/input-group.tsx +1 -1
- package/dist/r/src/components/ui/input-otp/input-otp.tsx +1 -1
- package/dist/r/src/components/ui/menubar/menubar.tsx +1 -1
- package/dist/r/src/components/ui/native-select/native-select.tsx +1 -1
- package/dist/r/src/components/ui/pagination/pagination.tsx +1 -1
- package/dist/r/src/components/ui/questionnaire/questionnaire.tsx +1 -1
- package/dist/r/src/components/ui/radio-group/radio-group.tsx +2 -2
- package/dist/r/src/components/ui/scroll-area/scroll-area.tsx +1 -1
- package/dist/r/src/components/ui/select/select.tsx +1 -1
- package/dist/r/src/components/ui/slider/slider.tsx +1 -1
- package/dist/r/src/components/ui/switch/switch.tsx +1 -1
- package/dist/r/src/components/ui/tabs/tabs.tsx +1 -1
- package/dist/r/src/components/ui/text-link/text-link.tsx +1 -1
- package/dist/r/src/components/ui/textarea/textarea.tsx +1 -1
- package/dist/r/src/components/ui/toast/toast.tsx +1 -1
- package/dist/r/src/components/ui/trace/trace.tsx +1 -1
- package/dist/r/src/lib/overlay.ts +1 -1
- package/dist/r/src/lib/tokens.ts +4 -2
- package/dist/r/src/lib/variants.ts +1 -1
- package/dist/r/src/styles/base.css +35 -7
- package/dist/vite/tailwind-sources.d.ts.map +1 -1
- package/dist/vite/tailwind-sources.js +16 -5
- package/dist/vite/tailwind-sources.js.map +1 -1
- package/package.json +1 -1
- package/src/components/composites/accent-picker/accent-picker.tsx +1 -1
- package/src/components/composites/accent-picker/custom-color-popover.tsx +1 -1
- package/src/components/composites/appearance-editor/accent-swatch-groups.tsx +1 -1
- package/src/components/composites/appearance-editor/appearance-choices.tsx +2 -5
- package/src/components/composites/confirmation/confirmation.tsx +1 -1
- package/src/components/composites/icon-picker/icon-picker.tsx +1 -1
- package/src/components/composites/list-row/list-row-control.tsx +1 -1
- package/src/components/composites/settings/settings.tsx +1 -1
- package/src/components/composites/stack-trace/stack-trace.tsx +1 -1
- package/src/components/composites/tree/tree.tsx +1 -1
- package/src/components/composites/workspace-mark/workspace-mark.tsx +1 -1
- package/src/components/conversation/thread-panel.tsx +1 -1
- package/src/components/layout/app-shell/skip-link.tsx +1 -1
- package/src/components/layout/side-rail/side-rail.tsx +1 -1
- package/src/components/layout/sidebar-nav/sidebar-nav-classes.ts +1 -1
- package/src/components/layout/sidebar-nav/sidebar-nav.tsx +1 -1
- package/src/components/layout/top-bar/top-bar.tsx +2 -2
- package/src/components/ui/accordion/accordion.tsx +1 -1
- package/src/components/ui/annotation-surface/annotation-surface.tsx +1 -1
- package/src/components/ui/attachment/attachment.tsx +2 -2
- package/src/components/ui/board/board.tsx +2 -2
- package/src/components/ui/breadcrumb/breadcrumb.tsx +1 -1
- package/src/components/ui/button/button.tsx +1 -1
- package/src/components/ui/checkbox/checkbox.tsx +1 -1
- package/src/components/ui/collapsible/collapsible.tsx +1 -1
- package/src/components/ui/combobox/combobox.tsx +3 -3
- package/src/components/ui/field/field.tsx +2 -2
- package/src/components/ui/input/input-control.tsx +1 -1
- package/src/components/ui/input-group/input-group.tsx +1 -1
- package/src/components/ui/input-otp/input-otp.tsx +1 -1
- package/src/components/ui/menubar/menubar.tsx +1 -1
- package/src/components/ui/native-select/native-select.tsx +1 -1
- package/src/components/ui/pagination/pagination.tsx +1 -1
- package/src/components/ui/questionnaire/questionnaire.tsx +1 -1
- package/src/components/ui/radio-group/radio-group.tsx +2 -2
- package/src/components/ui/scroll-area/scroll-area.tsx +1 -1
- package/src/components/ui/select/select.tsx +1 -1
- package/src/components/ui/slider/slider.tsx +1 -1
- package/src/components/ui/switch/switch.tsx +1 -1
- package/src/components/ui/tabs/tabs.tsx +1 -1
- package/src/components/ui/text-link/text-link.tsx +1 -1
- package/src/components/ui/textarea/textarea.tsx +1 -1
- package/src/components/ui/toast/toast.tsx +1 -1
- package/src/components/ui/trace/trace.tsx +1 -1
- package/src/lib/overlay.ts +1 -1
- package/src/lib/tokens.ts +4 -2
- package/src/lib/variants.ts +1 -1
- package/src/styles/base.css +35 -7
- package/src/vite/tailwind-sources.ts +20 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-link.js","names":["<a\n data-slot=\"textlink\"\n class={cn(\n 'rounded-sm text-foreground underline decoration-primary underline-offset-4',\n 'transition-colors ease-out hover:decoration-foreground outline-none',\n 'focus-visible:border-ring focus-visible:
|
|
1
|
+
{"version":3,"file":"text-link.js","names":["<a\n data-slot=\"textlink\"\n class={cn(\n 'rounded-sm text-foreground underline decoration-primary underline-offset-4',\n 'transition-colors ease-out hover:decoration-foreground outline-none',\n 'focus-visible:border-ring focus-visible:focus-outline',\n 'motion-reduce:transition-none',\n local.class\n )}\n tabindex={local.tabindex ?? 0}\n {...rest}\n />","_$spread"],"sources":["../../../../src/components/ui/text-link/text-link.tsx"],"sourcesContent":["import type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport { cn } from '#lib/utils'\n\n/**\n * TextLink.\n *\n * An inline, underlined link for prose and content navigation. Use ActionButton\n * or ListRow when the link is a compact action or a row-sized target.\n */\nexport function TextLink(props: ComponentProps<'a'>) {\n const local = props\n const rest = omit(props, 'class', 'tabindex')\n\n return (\n <a\n data-slot=\"textlink\"\n class={cn(\n 'rounded-sm text-foreground underline decoration-primary underline-offset-4',\n 'transition-colors ease-out hover:decoration-foreground outline-none',\n 'focus-visible:border-ring focus-visible:focus-outline',\n 'motion-reduce:transition-none',\n local.class\n )}\n tabindex={local.tabindex ?? 0}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAgB,SAAS,OAA4B;CACnD,MAAM,QAAQ;CACd,MAAM,OAAO,KAAK,OAAO,SAAS,UAAU;CAG1C,IAAA,OAAA,OAWC;CADCC,OAAA,MAAA,CAAA;EATA,aAAA;EACA,IAAA,UAAA;GAAO,OAAA,GACL,8EACA,uEACA,yDACA,iCACA,MAAM,KACR;EAAC;EACD,IAAA,WAAA;GAAU,OAAA,MAAM,YAAY;EAAC;CACrB,GAAJ,IAAA,GAAA,KAAA;CAXR,OACED;AAaJ"}
|
|
@@ -10,7 +10,7 @@ var textareaVariants = cva([
|
|
|
10
10
|
"transition-[color,box-shadow,border-color] ease-out outline-none",
|
|
11
11
|
"placeholder:text-muted-foreground",
|
|
12
12
|
"selection:bg-primary selection:text-primary-foreground",
|
|
13
|
-
"focus-visible:border-ring focus-visible:
|
|
13
|
+
"focus-visible:border-ring focus-visible:focus-outline",
|
|
14
14
|
"aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive-subtle",
|
|
15
15
|
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50"
|
|
16
16
|
], {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.js","names":["ref={local.ref}","<textarea\n data-slot=\"textarea\"\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n ref={local.ref}\n class={cn(\n textareaVariants({ variant: local.variant, size: local.size, resize: local.resize }),\n local.class\n )}\n {...rest}\n />","_$spread"],"sources":["../../../../src/components/ui/textarea/textarea.tsx"],"sourcesContent":["import type { Ref } from 'solid-js'\nimport type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\n\nexport const textareaVariants = cva(\n [\n 'flex field-sizing-content w-full rounded-md border border-input bg-transparent px-control-md py-2 text-sm',\n 'transition-[color,box-shadow,border-color] ease-out outline-none',\n 'placeholder:text-muted-foreground',\n 'selection:bg-primary selection:text-primary-foreground',\n 'focus-visible:border-ring focus-visible:
|
|
1
|
+
{"version":3,"file":"textarea.js","names":["ref={local.ref}","<textarea\n data-slot=\"textarea\"\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n ref={local.ref}\n class={cn(\n textareaVariants({ variant: local.variant, size: local.size, resize: local.resize }),\n local.class\n )}\n {...rest}\n />","_$spread"],"sources":["../../../../src/components/ui/textarea/textarea.tsx"],"sourcesContent":["import type { Ref } from 'solid-js'\nimport type { ComponentProps } from '@solidjs/web'\nimport { omit } from 'solid-js'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\n\nexport const textareaVariants = cva(\n [\n 'flex field-sizing-content w-full rounded-md border border-input bg-transparent px-control-md py-2 text-sm',\n 'transition-[color,box-shadow,border-color] ease-out outline-none',\n 'placeholder:text-muted-foreground',\n 'selection:bg-primary selection:text-primary-foreground',\n 'focus-visible:border-ring focus-visible:focus-outline',\n 'aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive-subtle',\n 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',\n ],\n {\n variants: {\n variant: {\n default: '',\n composer: 'border-0 bg-transparent p-0 shadow-none focus-visible:ring-0',\n code: 'font-mono',\n },\n size: {\n default: 'min-h-16',\n comfortable: 'min-h-16 max-h-48',\n },\n resize: {\n vertical: 'resize-y',\n none: 'resize-none',\n both: 'resize',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n resize: 'vertical',\n },\n }\n)\n\nexport type TextareaProps = Omit<ComponentProps<'textarea'>, 'size'> &\n VariantProps<typeof textareaVariants> & {\n /** Solid's actual textarea element, rather than its containing component or form. */\n ref?: Ref<HTMLTextAreaElement>\n }\n\n/**\n * Textarea.\n *\n * Shares the Input's border, focus and invalid treatment exactly, the two are\n * the same control at different aspect ratios, and a form that mixes them must\n * not show a seam between them.\n *\n * `field-sizing: content` lets the element grow with its content where the\n * engine supports it, which is the behaviour a chat composer wants; `rows`\n * remains the fallback so an unsupported engine still gets a usable height.\n * `variant=\"composer\"` removes the standalone field surface when nested in a\n * composer shell. `variant=\"code\"` keeps the field surface and sets the\n * monospace face, for commands, snippets and other literal text. `size=\"comfortable\"` caps growth at the shared 12rem rung, and\n * the finite `resize` variants keep browser resize behavior explicit.\n */\nexport function Textarea(props: TextareaProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'variant',\n 'size',\n 'resize',\n 'ref',\n 'id',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage'\n )\n const field = useFormFieldControl('control', local)\n\n return (\n <textarea\n data-slot=\"textarea\"\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n ref={local.ref}\n class={cn(\n textareaVariants({ variant: local.variant, size: local.size, resize: local.resize }),\n local.class\n )}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;AAOA,IAAa,mBAAmB,IAC9B;CACE;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,UAAU;GACV,MAAM;EACR;EACA,MAAM;GACJ,SAAS;GACT,aAAa;EACf;EACA,QAAQ;GACN,UAAU;GACV,MAAM;GACN,MAAM;EACR;CACF;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;EACN,QAAQ;CACV;AACF,CACF;;;;;;;;;;;;;;;;AAuBA,SAAgB,SAAS,OAAsB;CAC7C,MAAM,QAAQ;CACd,MAAM,OAAO,KACX,OACA,SACA,WACA,QACA,UACA,OACA,MACA,cACA,mBACA,oBACA,gBACA,mBACF;CACA,MAAM,QAAQ,oBAAoB,WAAW,KAAK;CAGhD,IAAA,OAAA,OAcC;CADCE,OAAA,MAAA,CAAA;EAZA,aAAA;EACA,IAAA,KAAA;GAAI,OAAA,OAAO,MAAM,MAAM;EAAE;EACzB,IAAA,eAAA;GAAY,OAAA,MAAM;EAAa;EAC/B,IAAA,oBAAA;GAAiB,OAAA,QAAQ,sBAAsB,MAAM;EAAkB;EACvE,IAAA,qBAAA;GAAkB,OAAA,QAAQ,uBAAuB,MAAM;EAAmB;EAC1E,IAAA,iBAAA;GAAc,OAAA,QAAQ,mBAAmB,MAAM;EAAe;EAC9D,IAAA,sBAAA;GAAmB,OAAA,QAAQ,wBAAwB,MAAM;EAAoB;EAE7E,IAAA,UAAA;GAAO,OAAA,GACL,iBAAiB;IAAE,SAAS,MAAM;IAAS,MAAM,MAAM;IAAM,QAAQ,MAAM;GAAO,CAAC,GACnF,MAAM,KACR;EAAC;CACO,GAAJ,IAAA,GAAA,KAAA;CALJ,IAAA,QAAK,MAAM;CAAX,OAAA,UAAA,cAAA,MAAA,QAAA,KAAc,IAAdF,UAAAA;;CAAc,GAAdA,IAAc,IAAd,MAAW,MAAXA;CATJ,OACEC;AAgBJ"}
|
|
@@ -124,7 +124,7 @@ function ToastCard(props) {
|
|
|
124
124
|
})(),
|
|
125
125
|
createComponent(ToastClose, {
|
|
126
126
|
"aria-label": "Dismiss notification",
|
|
127
|
-
class: "text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:
|
|
127
|
+
class: "text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:focus-outline",
|
|
128
128
|
get children() {
|
|
129
129
|
return createComponent(X, { class: "size-3.5" });
|
|
130
130
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","names":["<UiToast\n // Kobalte marked a shown toast `data-opened` and a leaving one\n // `data-closed`; the animation classes below read those, so the card\n // carries them from ui-sdk's `leaving` state.\n render={(cardProps, state) => (\n <li\n {...cardProps}\n data-opened={state.leaving ? undefined : ''}\n data-closed={state.leaving ? '' : undefined}\n />\n )}\n class={cn(\n 'pointer-events-auto flex w-full items-start gap-3 rounded-xl border border-border bg-popover p-3 shadow-lg',\n 'data-[opened]:animate-in data-[opened]:slide-in-from-right-full data-[opened]:fade-in-0',\n 'data-[closed]:animate-out data-[closed]:slide-out-to-right-full data-[closed]:fade-out-0',\n // ui-sdk marks a toast being dragged `data-swiping` and writes the\n // drag to `--toast-swipe-x` and `--toast-swipe-y` (Kobalte:\n // `data-swipe=\"move\"`, `--kb-toast-swipe-move-x`). A released swipe\n // that does not dismiss drops the attribute and the card eases back.\n 'transition-transform data-swiping:translate-x-(--toast-swipe-x) data-swiping:translate-y-(--toast-swipe-y) data-swiping:transition-none',\n 'data-[swipe-direction=down]:slide-out-to-bottom-full data-[swipe-direction=up]:slide-out-to-top-full'\n )}\n style={{ '--toast-tone': toastTones[data().tone] }}\n >\n <span\n aria-hidden=\"true\"\n class=\"mt-1.5 size-1.5 shrink-0 rounded-full\"\n style={{ 'background-color': 'var(--toast-tone)' }}\n />\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <UiToastTitle class=\"text-sm font-medium\" />\n <Show when={props.toast.description}>\n <UiToastDescription class=\"text-sm text-muted-foreground\" />\n </Show>\n <Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>\n </div>\n <UiToastClose\n aria-label=\"Dismiss notification\"\n class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n <X class=\"size-3.5\" />\n </UiToastClose>\n </UiToast>","render={(cardProps, state) => (\n <li\n {...cardProps}\n data-opened={state.leaving ? undefined : ''}\n data-closed={state.leaving ? '' : undefined}\n />\n )}","<span\n aria-hidden=\"true\"\n class=\"mt-1.5 size-1.5 shrink-0 rounded-full\"\n style={{ 'background-color': 'var(--toast-tone)' }}\n />","<UiToastTitle class=\"text-sm font-medium\" />","class=\"text-sm font-medium\"","<div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <UiToastTitle class=\"text-sm font-medium\" />\n <Show when={props.toast.description}>\n <UiToastDescription class=\"text-sm text-muted-foreground\" />\n </Show>\n <Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>\n </div>","<UiToastDescription class=\"text-sm text-muted-foreground\" />","class=\"text-sm text-muted-foreground\"","<Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>","<UiToastClose\n aria-label=\"Dismiss notification\"\n class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n <X class=\"size-3.5\" />\n </UiToastClose>","class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle\"","<X class=\"size-3.5\" />","class=\"size-3.5\"","<UiToastRegion\n toaster={toasterFor(props.region)}\n side={toasterPlacement[position()].side}\n align={toasterPlacement[position()].align}\n maxVisible={3}\n /**\n * The toast region is a top layer: opening a dialog must not hide an\n * in-flight notification, and clicking a toast must not dismiss the\n * dialog behind it.\n */\n class={cn(\n 'pointer-events-none fixed z-(--z-toast) flex max-h-screen w-full flex-col gap-2 p-4 sm:max-w-sm',\n toasterPosition[position()],\n props.class\n )}\n {...rest}\n ref={(element: HTMLElement) => {\n setRegion(element)\n forwardRef(() => props.ref, element)\n }}\n >\n {(item) => <ToastCard toast={item} />}\n </UiToastRegion>","maxVisible={3}","ref={(element: HTMLElement) => {\n setRegion(element)\n forwardRef(() => props.ref, element)\n }}","<ToastCard toast={item} />","toast={item}","LucideX","_$spread","_$insert"],"sources":["../../../../src/components/ui/toast/toast.tsx"],"sourcesContent":["import {\n createToaster,\n Toast as UiToast,\n ToastClose as UiToastClose,\n ToastDescription as UiToastDescription,\n ToastRegion as UiToastRegion,\n ToastTitle as UiToastTitle,\n type ToastData,\n type ToastRegionProps as UiToastRegionProps,\n type ToastType,\n} from '@ui-sdk/solid/toast'\nimport { X as LucideX } from '@lucide/solid'\nimport type { JSX } from '@solidjs/web'\nimport { createEffect, createSignal, Show, omit } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { fastIcon } from '#lib/fast-icon'\nimport { forwardRef } from '#lib/refs'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst X = fastIcon(LucideX)\n\n/**\n * Toast.\n *\n * A short, self-dismissing message about something that already happened.\n *\n * The rules that make toasts helpful rather than hostile are built into this\n * API rather than left to callers:\n *\n * - A toast never carries the only route to an action. Anything important\n * enough to need doing belongs in the interface, not in a message that\n * disappears. `action` exists, but it is a convenience, not a flow.\n * - Errors from user-initiated work get `priority=\"high\"` so a screen reader\n * interrupts to announce them; background progress uses the default low\n * priority so it is not read over whatever the user is doing.\n * - A toast with a way to undo is preferred to a confirmation dialog for a\n * reversible action. Undo after the fact costs the user nothing; a modal\n * before it costs everyone a click.\n *\n * `Toaster` is mounted once, near the root of the app.\n *\n * ui-sdk's toast runs the queue, the timers (paused while the pointer or focus\n * is in the stack), the announcements (through shared live regions, so the\n * visible region is not itself live), swipe-to-dismiss, F6 to reach the\n * newest toast, and the top layer, so a toast stays above an open dialog.\n */\n\ntype ToastTone = 'default' | 'success' | 'warning' | 'destructive' | 'info'\n\n/**\n * The tone dot's colour. A custom property rather than five colour utilities\n * because the value is applied inline (the tone is data, not markup) and a\n * Tailwind colour class cannot be built from a runtime value without becoming\n * invisible to the linter.\n */\nconst toastTones: Record<ToastTone, string> = {\n default: 'var(--foreground)',\n success: 'var(--success)',\n warning: 'var(--warning)',\n destructive: 'var(--destructive)',\n info: 'var(--info)',\n}\n\nexport type ToastOptions = {\n title: string\n description?: string\n tone?: ToastTone\n /**\n * Renders a control inside the toast, usually an Undo: `action: () => <Button…>`.\n * A function, so the control is built inside the toast that shows it (under\n * its owner, and again for each toast) rather than once where `show` is called.\n */\n action?: () => JSX.Element\n /** Keep the toast until it is dismissed. Use for a failure the user must see. */\n persistent?: boolean\n /** Milliseconds before auto-dismiss. Overrides the region's setting. */\n duration?: number\n /** Which Toaster region to render into. */\n region?: string\n}\n\n/** The kit's tone as ui-sdk's toast type, which the card carries as `data-type`. */\nconst toastTypes: Record<ToastTone, ToastType> = {\n default: 'default',\n success: 'success',\n warning: 'warning',\n destructive: 'error',\n info: 'info',\n}\n\n/** What the kit keeps on each ui-sdk toast as its `data`. */\ntype ToastCardData = { tone: ToastTone; action?: () => JSX.Element }\n\n/**\n * One queue per named region, created on first use, so a toast sent to a\n * region shows only there. The unnamed region is `undefined`.\n */\nconst toasters = new Map<string | undefined, ReturnType<typeof createToaster<JSX.Element>>>()\n\nfunction toasterFor(region: string | undefined) {\n let queue = toasters.get(region)\n if (!queue) {\n // Kobalte's region default, which every caller was tuned against.\n queue = createToaster<JSX.Element>({ duration: 5000 })\n toasters.set(region, queue)\n }\n return queue\n}\n\n/**\n * Toast ids stay numbers, as they were: ui-sdk's are strings, so each toast\n * takes the next number as its ui-sdk id.\n */\nlet nextId = 0\n\n/** The ui-sdk options a kit toast becomes; also an update of a shown one. */\nfunction toastFields(options: ToastOptions) {\n const tone = options.tone ?? 'default'\n return {\n title: options.title,\n description: options.description,\n type: toastTypes[tone],\n duration: options.persistent ? Infinity : options.duration,\n /**\n * A user-initiated outcome is announced; a background one waits its turn.\n * A failure the user caused is worth interrupting for; a sync finishing\n * quietly is not.\n */\n priority: tone === 'destructive' ? ('assertive' as const) : ('polite' as const),\n data: { tone, action: options.action } satisfies ToastCardData,\n }\n}\n\nfunction ToastCard(props: { toast: ToastData<JSX.Element> }) {\n const data = () => (props.toast.data as ToastCardData | undefined) ?? { tone: 'default' as const }\n\n return (\n <UiToast\n // Kobalte marked a shown toast `data-opened` and a leaving one\n // `data-closed`; the animation classes below read those, so the card\n // carries them from ui-sdk's `leaving` state.\n render={(cardProps, state) => (\n <li\n {...cardProps}\n data-opened={state.leaving ? undefined : ''}\n data-closed={state.leaving ? '' : undefined}\n />\n )}\n class={cn(\n 'pointer-events-auto flex w-full items-start gap-3 rounded-xl border border-border bg-popover p-3 shadow-lg',\n 'data-[opened]:animate-in data-[opened]:slide-in-from-right-full data-[opened]:fade-in-0',\n 'data-[closed]:animate-out data-[closed]:slide-out-to-right-full data-[closed]:fade-out-0',\n // ui-sdk marks a toast being dragged `data-swiping` and writes the\n // drag to `--toast-swipe-x` and `--toast-swipe-y` (Kobalte:\n // `data-swipe=\"move\"`, `--kb-toast-swipe-move-x`). A released swipe\n // that does not dismiss drops the attribute and the card eases back.\n 'transition-transform data-swiping:translate-x-(--toast-swipe-x) data-swiping:translate-y-(--toast-swipe-y) data-swiping:transition-none',\n 'data-[swipe-direction=down]:slide-out-to-bottom-full data-[swipe-direction=up]:slide-out-to-top-full'\n )}\n style={{ '--toast-tone': toastTones[data().tone] }}\n >\n <span\n aria-hidden=\"true\"\n class=\"mt-1.5 size-1.5 shrink-0 rounded-full\"\n style={{ 'background-color': 'var(--toast-tone)' }}\n />\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <UiToastTitle class=\"text-sm font-medium\" />\n <Show when={props.toast.description}>\n <UiToastDescription class=\"text-sm text-muted-foreground\" />\n </Show>\n <Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>\n </div>\n <UiToastClose\n aria-label=\"Dismiss notification\"\n class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle\"\n >\n <X class=\"size-3.5\" />\n </UiToastClose>\n </UiToast>\n )\n}\n\n/**\n * The error contract, resolved: destructive tone, persistent unless the caller\n * says otherwise. Exported because this decision is the part a caller depends\n * on and the part testable without a browser — the card render itself needs one.\n */\nexport function errorToastOptions(\n title: string,\n options?: Omit<ToastOptions, 'title' | 'tone'>\n): ToastOptions {\n return { ...options, title, tone: 'destructive', persistent: options?.persistent ?? true }\n}\n\n/**\n * The toast API. `show` is the general form; the tone helpers are shorthand for\n * the four cases that come up constantly.\n */\nexport const toast = {\n show(options: ToastOptions): number {\n const id = nextId++\n toasterFor(options.region)({ ...toastFields(options), id: String(id) })\n return id\n },\n success(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show({ ...options, title, tone: 'success' })\n },\n /**\n * A failure the user caused. Persistent by default — an error that times out\n * while its reader is mid-sentence has not been reported — but `persistent`\n * stays caller-owned: a failure inside a retry loop (a failed \"check again\",\n * a background poll) passes `persistent: false` and a `duration`, because a\n * dismiss-only toast there is one more thing to close by hand.\n */\n error(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show(errorToastOptions(title, options))\n },\n warning(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show({ ...options, title, tone: 'warning' })\n },\n info(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show({ ...options, title, tone: 'info' })\n },\n /**\n * A toast that resolves with a promise: pending, then success or failure.\n * The right shape for an operation with a visible duration, because the user\n * gets one message instead of three. The pending toast stays until the\n * promise settles, and the same toast then turns into the outcome, which\n * keeps its place in the stack; a failure stays until it is dismissed.\n */\n promise<T>(\n promise: Promise<T> | (() => Promise<T>),\n messages: {\n pending: string\n success: string | ((data: T) => string)\n error: string | ((error: unknown) => string)\n }\n ): Promise<T> {\n const resolved = typeof promise === 'function' ? promise() : promise\n const id = toast.show({ title: messages.pending, persistent: true })\n const queue = toasterFor(undefined)\n resolved.then(\n (data) =>\n queue.update(\n String(id),\n toastFields({\n title:\n typeof messages.success === 'function' ? messages.success(data) : messages.success,\n tone: 'success',\n })\n ),\n (error: unknown) =>\n queue.update(\n String(id),\n toastFields({\n title: typeof messages.error === 'function' ? messages.error(error) : messages.error,\n tone: 'destructive',\n persistent: true,\n })\n )\n )\n return resolved\n },\n /** Dismisses one toast, wherever it is shown. */\n dismiss(id: number): void {\n for (const queue of toasters.values()) queue.dismiss(String(id))\n },\n /** Dismisses every toast in every region. */\n clear(): void {\n for (const queue of toasters.values()) queue.dismiss()\n },\n}\n\n/**\n * The imperative half under its Kobalte-era name, for callers that imported\n * `toaster` to dismiss or clear. Prefer `toast`.\n */\nexport const toaster = { dismiss: toast.dismiss, clear: toast.clear }\n\nexport type ToasterProps = Omit<\n UiToastRegionProps,\n 'children' | 'toaster' | 'side' | 'align' | 'maxVisible' | 'class'\n> & {\n /** Where the stack sits. Defaults to the bottom-right, clear of the shell. */\n position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n region?: string\n class?: string\n}\n\n/**\n * `class` lands on the region too: the props describe the region, and the\n * region is the element a caller lays out (an inset clear of a status bar, a\n * narrower stack). The list inside it is an implementation detail.\n *\n * The corner is set on the region, not the list. The region is the `fixed`\n * element: an inset on the list inside it positions nothing, and the region falls\n * back to wherever it happens to sit in the document flow.\n */\nconst toasterPosition = {\n 'top-left': 'top-0 left-0',\n 'top-right': 'top-0 right-0',\n 'bottom-left': 'bottom-0 left-0',\n 'bottom-right': 'bottom-0 right-0',\n}\n\nconst toasterAlignment = {\n 'top-left': 'items-start',\n 'top-right': 'items-end',\n 'bottom-left': 'items-start',\n 'bottom-right': 'items-end',\n}\n\n/**\n * The corner as ui-sdk's side and alignment, which decide the swipe\n * directions: toward the edge the stack sits on, and toward its corner.\n * Physical, like the classes: `left` is the start only in a left-to-right page.\n */\nconst toasterPlacement = {\n 'top-left': { side: 'top', align: 'start' },\n 'top-right': { side: 'top', align: 'end' },\n 'bottom-left': { side: 'bottom', align: 'start' },\n 'bottom-right': { side: 'bottom', align: 'end' },\n} as const\n\n/** Mount once, near the root. Renders the stack and owns its timing defaults. */\nexport function Toaster(props: ToasterProps) {\n const rest = omit(props, 'position', 'region', 'class', 'ref')\n const position = () => props.position ?? 'bottom-right'\n const [region, setRegion] = createSignal<HTMLElement>()\n\n // ui-sdk renders the list inside the region itself and takes no props for\n // it, so the list's classes (the stack's alignment in its corner) are\n // written onto it once it is in the page.\n createEffect(\n () => ({ element: region(), position: position() }),\n ({ element, position: corner }) => {\n const list = element?.querySelector('[data-slot=\"toast-list\"]')\n if (list) list.setAttribute('class', cn('flex flex-col gap-2', toasterAlignment[corner]))\n }\n )\n\n return (\n <UiToastRegion\n toaster={toasterFor(props.region)}\n side={toasterPlacement[position()].side}\n align={toasterPlacement[position()].align}\n maxVisible={3}\n /**\n * The toast region is a top layer: opening a dialog must not hide an\n * in-flight notification, and clicking a toast must not dismiss the\n * dialog behind it.\n */\n class={cn(\n 'pointer-events-none fixed z-(--z-toast) flex max-h-screen w-full flex-col gap-2 p-4 sm:max-w-sm',\n toasterPosition[position()],\n props.class\n )}\n {...rest}\n ref={(element: HTMLElement) => {\n setRegion(element)\n forwardRef(() => props.ref, element)\n }}\n >\n {(item) => <ToastCard toast={item} />}\n </UiToastRegion>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,IAAM,IAAI,SAASkB,GAAO;;;;;;;AAoC1B,IAAM,aAAwC;CAC5C,SAAS;CACT,SAAS;CACT,SAAS;CACT,aAAa;CACb,MAAM;AACR;;AAqBA,IAAM,aAA2C;CAC/C,SAAS;CACT,SAAS;CACT,SAAS;CACT,aAAa;CACb,MAAM;AACR;;;;;AASA,IAAM,2BAAW,IAAI,IAAuE;AAE5F,SAAS,WAAW,QAA4B;CAC9C,IAAI,QAAQ,SAAS,IAAI,MAAM;CAC/B,IAAI,CAAC,OAAO;EAEV,QAAQ,cAA2B,EAAE,UAAU,IAAK,CAAC;EACrD,SAAS,IAAI,QAAQ,KAAK;CAC5B;CACA,OAAO;AACT;;;;;AAMA,IAAI,SAAS;;AAGb,SAAS,YAAY,SAAuB;CAC1C,MAAM,OAAO,QAAQ,QAAQ;CAC7B,OAAO;EACL,OAAO,QAAQ;EACf,aAAa,QAAQ;EACrB,MAAM,WAAW;EACjB,UAAU,QAAQ,aAAa,QAAW,QAAQ;;;;;;EAMlD,UAAU,SAAS,gBAAiB,cAAyB;EAC7D,MAAM;GAAE;GAAM,QAAQ,QAAQ;EAAO;CACvC;AACF;AAEA,SAAS,UAAU,OAA0C;CAC3D,MAAM,aAAc,MAAM,MAAM,QAAsC,EAAE,MAAM,UAAmB;CAEjG,OACElB,gBAAAA,OAAAA;EAI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EAgBEC,MAAM,YAAyB;GAC7B,UAAU,OAAO;GACjB,iBAAiB,MAAM,KAAK,OAAO;EACrC;EAnBFF,WAqBI,SAASG,gBAAAA,WAAAA,EAAWC,OAAO,KAAO,CAAA;CACvB,CAAA,CAAA;AAEnB"}
|
|
1
|
+
{"version":3,"file":"toast.js","names":["<UiToast\n // Kobalte marked a shown toast `data-opened` and a leaving one\n // `data-closed`; the animation classes below read those, so the card\n // carries them from ui-sdk's `leaving` state.\n render={(cardProps, state) => (\n <li\n {...cardProps}\n data-opened={state.leaving ? undefined : ''}\n data-closed={state.leaving ? '' : undefined}\n />\n )}\n class={cn(\n 'pointer-events-auto flex w-full items-start gap-3 rounded-xl border border-border bg-popover p-3 shadow-lg',\n 'data-[opened]:animate-in data-[opened]:slide-in-from-right-full data-[opened]:fade-in-0',\n 'data-[closed]:animate-out data-[closed]:slide-out-to-right-full data-[closed]:fade-out-0',\n // ui-sdk marks a toast being dragged `data-swiping` and writes the\n // drag to `--toast-swipe-x` and `--toast-swipe-y` (Kobalte:\n // `data-swipe=\"move\"`, `--kb-toast-swipe-move-x`). A released swipe\n // that does not dismiss drops the attribute and the card eases back.\n 'transition-transform data-swiping:translate-x-(--toast-swipe-x) data-swiping:translate-y-(--toast-swipe-y) data-swiping:transition-none',\n 'data-[swipe-direction=down]:slide-out-to-bottom-full data-[swipe-direction=up]:slide-out-to-top-full'\n )}\n style={{ '--toast-tone': toastTones[data().tone] }}\n >\n <span\n aria-hidden=\"true\"\n class=\"mt-1.5 size-1.5 shrink-0 rounded-full\"\n style={{ 'background-color': 'var(--toast-tone)' }}\n />\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <UiToastTitle class=\"text-sm font-medium\" />\n <Show when={props.toast.description}>\n <UiToastDescription class=\"text-sm text-muted-foreground\" />\n </Show>\n <Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>\n </div>\n <UiToastClose\n aria-label=\"Dismiss notification\"\n class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:focus-outline\"\n >\n <X class=\"size-3.5\" />\n </UiToastClose>\n </UiToast>","render={(cardProps, state) => (\n <li\n {...cardProps}\n data-opened={state.leaving ? undefined : ''}\n data-closed={state.leaving ? '' : undefined}\n />\n )}","<span\n aria-hidden=\"true\"\n class=\"mt-1.5 size-1.5 shrink-0 rounded-full\"\n style={{ 'background-color': 'var(--toast-tone)' }}\n />","<UiToastTitle class=\"text-sm font-medium\" />","class=\"text-sm font-medium\"","<div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <UiToastTitle class=\"text-sm font-medium\" />\n <Show when={props.toast.description}>\n <UiToastDescription class=\"text-sm text-muted-foreground\" />\n </Show>\n <Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>\n </div>","<UiToastDescription class=\"text-sm text-muted-foreground\" />","class=\"text-sm text-muted-foreground\"","<Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>","<UiToastClose\n aria-label=\"Dismiss notification\"\n class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:focus-outline\"\n >\n <X class=\"size-3.5\" />\n </UiToastClose>","class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:focus-outline\"","<X class=\"size-3.5\" />","class=\"size-3.5\"","<UiToastRegion\n toaster={toasterFor(props.region)}\n side={toasterPlacement[position()].side}\n align={toasterPlacement[position()].align}\n maxVisible={3}\n /**\n * The toast region is a top layer: opening a dialog must not hide an\n * in-flight notification, and clicking a toast must not dismiss the\n * dialog behind it.\n */\n class={cn(\n 'pointer-events-none fixed z-(--z-toast) flex max-h-screen w-full flex-col gap-2 p-4 sm:max-w-sm',\n toasterPosition[position()],\n props.class\n )}\n {...rest}\n ref={(element: HTMLElement) => {\n setRegion(element)\n forwardRef(() => props.ref, element)\n }}\n >\n {(item) => <ToastCard toast={item} />}\n </UiToastRegion>","maxVisible={3}","ref={(element: HTMLElement) => {\n setRegion(element)\n forwardRef(() => props.ref, element)\n }}","<ToastCard toast={item} />","toast={item}","LucideX","_$spread","_$insert"],"sources":["../../../../src/components/ui/toast/toast.tsx"],"sourcesContent":["import {\n createToaster,\n Toast as UiToast,\n ToastClose as UiToastClose,\n ToastDescription as UiToastDescription,\n ToastRegion as UiToastRegion,\n ToastTitle as UiToastTitle,\n type ToastData,\n type ToastRegionProps as UiToastRegionProps,\n type ToastType,\n} from '@ui-sdk/solid/toast'\nimport { X as LucideX } from '@lucide/solid'\nimport type { JSX } from '@solidjs/web'\nimport { createEffect, createSignal, Show, omit } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { fastIcon } from '#lib/fast-icon'\nimport { forwardRef } from '#lib/refs'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst X = fastIcon(LucideX)\n\n/**\n * Toast.\n *\n * A short, self-dismissing message about something that already happened.\n *\n * The rules that make toasts helpful rather than hostile are built into this\n * API rather than left to callers:\n *\n * - A toast never carries the only route to an action. Anything important\n * enough to need doing belongs in the interface, not in a message that\n * disappears. `action` exists, but it is a convenience, not a flow.\n * - Errors from user-initiated work get `priority=\"high\"` so a screen reader\n * interrupts to announce them; background progress uses the default low\n * priority so it is not read over whatever the user is doing.\n * - A toast with a way to undo is preferred to a confirmation dialog for a\n * reversible action. Undo after the fact costs the user nothing; a modal\n * before it costs everyone a click.\n *\n * `Toaster` is mounted once, near the root of the app.\n *\n * ui-sdk's toast runs the queue, the timers (paused while the pointer or focus\n * is in the stack), the announcements (through shared live regions, so the\n * visible region is not itself live), swipe-to-dismiss, F6 to reach the\n * newest toast, and the top layer, so a toast stays above an open dialog.\n */\n\ntype ToastTone = 'default' | 'success' | 'warning' | 'destructive' | 'info'\n\n/**\n * The tone dot's colour. A custom property rather than five colour utilities\n * because the value is applied inline (the tone is data, not markup) and a\n * Tailwind colour class cannot be built from a runtime value without becoming\n * invisible to the linter.\n */\nconst toastTones: Record<ToastTone, string> = {\n default: 'var(--foreground)',\n success: 'var(--success)',\n warning: 'var(--warning)',\n destructive: 'var(--destructive)',\n info: 'var(--info)',\n}\n\nexport type ToastOptions = {\n title: string\n description?: string\n tone?: ToastTone\n /**\n * Renders a control inside the toast, usually an Undo: `action: () => <Button…>`.\n * A function, so the control is built inside the toast that shows it (under\n * its owner, and again for each toast) rather than once where `show` is called.\n */\n action?: () => JSX.Element\n /** Keep the toast until it is dismissed. Use for a failure the user must see. */\n persistent?: boolean\n /** Milliseconds before auto-dismiss. Overrides the region's setting. */\n duration?: number\n /** Which Toaster region to render into. */\n region?: string\n}\n\n/** The kit's tone as ui-sdk's toast type, which the card carries as `data-type`. */\nconst toastTypes: Record<ToastTone, ToastType> = {\n default: 'default',\n success: 'success',\n warning: 'warning',\n destructive: 'error',\n info: 'info',\n}\n\n/** What the kit keeps on each ui-sdk toast as its `data`. */\ntype ToastCardData = { tone: ToastTone; action?: () => JSX.Element }\n\n/**\n * One queue per named region, created on first use, so a toast sent to a\n * region shows only there. The unnamed region is `undefined`.\n */\nconst toasters = new Map<string | undefined, ReturnType<typeof createToaster<JSX.Element>>>()\n\nfunction toasterFor(region: string | undefined) {\n let queue = toasters.get(region)\n if (!queue) {\n // Kobalte's region default, which every caller was tuned against.\n queue = createToaster<JSX.Element>({ duration: 5000 })\n toasters.set(region, queue)\n }\n return queue\n}\n\n/**\n * Toast ids stay numbers, as they were: ui-sdk's are strings, so each toast\n * takes the next number as its ui-sdk id.\n */\nlet nextId = 0\n\n/** The ui-sdk options a kit toast becomes; also an update of a shown one. */\nfunction toastFields(options: ToastOptions) {\n const tone = options.tone ?? 'default'\n return {\n title: options.title,\n description: options.description,\n type: toastTypes[tone],\n duration: options.persistent ? Infinity : options.duration,\n /**\n * A user-initiated outcome is announced; a background one waits its turn.\n * A failure the user caused is worth interrupting for; a sync finishing\n * quietly is not.\n */\n priority: tone === 'destructive' ? ('assertive' as const) : ('polite' as const),\n data: { tone, action: options.action } satisfies ToastCardData,\n }\n}\n\nfunction ToastCard(props: { toast: ToastData<JSX.Element> }) {\n const data = () => (props.toast.data as ToastCardData | undefined) ?? { tone: 'default' as const }\n\n return (\n <UiToast\n // Kobalte marked a shown toast `data-opened` and a leaving one\n // `data-closed`; the animation classes below read those, so the card\n // carries them from ui-sdk's `leaving` state.\n render={(cardProps, state) => (\n <li\n {...cardProps}\n data-opened={state.leaving ? undefined : ''}\n data-closed={state.leaving ? '' : undefined}\n />\n )}\n class={cn(\n 'pointer-events-auto flex w-full items-start gap-3 rounded-xl border border-border bg-popover p-3 shadow-lg',\n 'data-[opened]:animate-in data-[opened]:slide-in-from-right-full data-[opened]:fade-in-0',\n 'data-[closed]:animate-out data-[closed]:slide-out-to-right-full data-[closed]:fade-out-0',\n // ui-sdk marks a toast being dragged `data-swiping` and writes the\n // drag to `--toast-swipe-x` and `--toast-swipe-y` (Kobalte:\n // `data-swipe=\"move\"`, `--kb-toast-swipe-move-x`). A released swipe\n // that does not dismiss drops the attribute and the card eases back.\n 'transition-transform data-swiping:translate-x-(--toast-swipe-x) data-swiping:translate-y-(--toast-swipe-y) data-swiping:transition-none',\n 'data-[swipe-direction=down]:slide-out-to-bottom-full data-[swipe-direction=up]:slide-out-to-top-full'\n )}\n style={{ '--toast-tone': toastTones[data().tone] }}\n >\n <span\n aria-hidden=\"true\"\n class=\"mt-1.5 size-1.5 shrink-0 rounded-full\"\n style={{ 'background-color': 'var(--toast-tone)' }}\n />\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <UiToastTitle class=\"text-sm font-medium\" />\n <Show when={props.toast.description}>\n <UiToastDescription class=\"text-sm text-muted-foreground\" />\n </Show>\n <Show when={data().action}>\n {(action) => <div class=\"mt-1.5 flex items-center gap-2\">{action()()}</div>}\n </Show>\n </div>\n <UiToastClose\n aria-label=\"Dismiss notification\"\n class=\"text-muted-foreground shrink-0 rounded-sm p-0.5 transition-colors ease-out outline-none hover:text-foreground focus-visible:border-ring focus-visible:focus-outline\"\n >\n <X class=\"size-3.5\" />\n </UiToastClose>\n </UiToast>\n )\n}\n\n/**\n * The error contract, resolved: destructive tone, persistent unless the caller\n * says otherwise. Exported because this decision is the part a caller depends\n * on and the part testable without a browser — the card render itself needs one.\n */\nexport function errorToastOptions(\n title: string,\n options?: Omit<ToastOptions, 'title' | 'tone'>\n): ToastOptions {\n return { ...options, title, tone: 'destructive', persistent: options?.persistent ?? true }\n}\n\n/**\n * The toast API. `show` is the general form; the tone helpers are shorthand for\n * the four cases that come up constantly.\n */\nexport const toast = {\n show(options: ToastOptions): number {\n const id = nextId++\n toasterFor(options.region)({ ...toastFields(options), id: String(id) })\n return id\n },\n success(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show({ ...options, title, tone: 'success' })\n },\n /**\n * A failure the user caused. Persistent by default — an error that times out\n * while its reader is mid-sentence has not been reported — but `persistent`\n * stays caller-owned: a failure inside a retry loop (a failed \"check again\",\n * a background poll) passes `persistent: false` and a `duration`, because a\n * dismiss-only toast there is one more thing to close by hand.\n */\n error(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show(errorToastOptions(title, options))\n },\n warning(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show({ ...options, title, tone: 'warning' })\n },\n info(title: string, options?: Omit<ToastOptions, 'title' | 'tone'>): number {\n return toast.show({ ...options, title, tone: 'info' })\n },\n /**\n * A toast that resolves with a promise: pending, then success or failure.\n * The right shape for an operation with a visible duration, because the user\n * gets one message instead of three. The pending toast stays until the\n * promise settles, and the same toast then turns into the outcome, which\n * keeps its place in the stack; a failure stays until it is dismissed.\n */\n promise<T>(\n promise: Promise<T> | (() => Promise<T>),\n messages: {\n pending: string\n success: string | ((data: T) => string)\n error: string | ((error: unknown) => string)\n }\n ): Promise<T> {\n const resolved = typeof promise === 'function' ? promise() : promise\n const id = toast.show({ title: messages.pending, persistent: true })\n const queue = toasterFor(undefined)\n resolved.then(\n (data) =>\n queue.update(\n String(id),\n toastFields({\n title:\n typeof messages.success === 'function' ? messages.success(data) : messages.success,\n tone: 'success',\n })\n ),\n (error: unknown) =>\n queue.update(\n String(id),\n toastFields({\n title: typeof messages.error === 'function' ? messages.error(error) : messages.error,\n tone: 'destructive',\n persistent: true,\n })\n )\n )\n return resolved\n },\n /** Dismisses one toast, wherever it is shown. */\n dismiss(id: number): void {\n for (const queue of toasters.values()) queue.dismiss(String(id))\n },\n /** Dismisses every toast in every region. */\n clear(): void {\n for (const queue of toasters.values()) queue.dismiss()\n },\n}\n\n/**\n * The imperative half under its Kobalte-era name, for callers that imported\n * `toaster` to dismiss or clear. Prefer `toast`.\n */\nexport const toaster = { dismiss: toast.dismiss, clear: toast.clear }\n\nexport type ToasterProps = Omit<\n UiToastRegionProps,\n 'children' | 'toaster' | 'side' | 'align' | 'maxVisible' | 'class'\n> & {\n /** Where the stack sits. Defaults to the bottom-right, clear of the shell. */\n position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\n region?: string\n class?: string\n}\n\n/**\n * `class` lands on the region too: the props describe the region, and the\n * region is the element a caller lays out (an inset clear of a status bar, a\n * narrower stack). The list inside it is an implementation detail.\n *\n * The corner is set on the region, not the list. The region is the `fixed`\n * element: an inset on the list inside it positions nothing, and the region falls\n * back to wherever it happens to sit in the document flow.\n */\nconst toasterPosition = {\n 'top-left': 'top-0 left-0',\n 'top-right': 'top-0 right-0',\n 'bottom-left': 'bottom-0 left-0',\n 'bottom-right': 'bottom-0 right-0',\n}\n\nconst toasterAlignment = {\n 'top-left': 'items-start',\n 'top-right': 'items-end',\n 'bottom-left': 'items-start',\n 'bottom-right': 'items-end',\n}\n\n/**\n * The corner as ui-sdk's side and alignment, which decide the swipe\n * directions: toward the edge the stack sits on, and toward its corner.\n * Physical, like the classes: `left` is the start only in a left-to-right page.\n */\nconst toasterPlacement = {\n 'top-left': { side: 'top', align: 'start' },\n 'top-right': { side: 'top', align: 'end' },\n 'bottom-left': { side: 'bottom', align: 'start' },\n 'bottom-right': { side: 'bottom', align: 'end' },\n} as const\n\n/** Mount once, near the root. Renders the stack and owns its timing defaults. */\nexport function Toaster(props: ToasterProps) {\n const rest = omit(props, 'position', 'region', 'class', 'ref')\n const position = () => props.position ?? 'bottom-right'\n const [region, setRegion] = createSignal<HTMLElement>()\n\n // ui-sdk renders the list inside the region itself and takes no props for\n // it, so the list's classes (the stack's alignment in its corner) are\n // written onto it once it is in the page.\n createEffect(\n () => ({ element: region(), position: position() }),\n ({ element, position: corner }) => {\n const list = element?.querySelector('[data-slot=\"toast-list\"]')\n if (list) list.setAttribute('class', cn('flex flex-col gap-2', toasterAlignment[corner]))\n }\n )\n\n return (\n <UiToastRegion\n toaster={toasterFor(props.region)}\n side={toasterPlacement[position()].side}\n align={toasterPlacement[position()].align}\n maxVisible={3}\n /**\n * The toast region is a top layer: opening a dialog must not hide an\n * in-flight notification, and clicking a toast must not dismiss the\n * dialog behind it.\n */\n class={cn(\n 'pointer-events-none fixed z-(--z-toast) flex max-h-screen w-full flex-col gap-2 p-4 sm:max-w-sm',\n toasterPosition[position()],\n props.class\n )}\n {...rest}\n ref={(element: HTMLElement) => {\n setRegion(element)\n forwardRef(() => props.ref, element)\n }}\n >\n {(item) => <ToastCard toast={item} />}\n </UiToastRegion>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAmBA,IAAM,IAAI,SAASkB,GAAO;;;;;;;AAoC1B,IAAM,aAAwC;CAC5C,SAAS;CACT,SAAS;CACT,SAAS;CACT,aAAa;CACb,MAAM;AACR;;AAqBA,IAAM,aAA2C;CAC/C,SAAS;CACT,SAAS;CACT,SAAS;CACT,aAAa;CACb,MAAM;AACR;;;;;AASA,IAAM,2BAAW,IAAI,IAAuE;AAE5F,SAAS,WAAW,QAA4B;CAC9C,IAAI,QAAQ,SAAS,IAAI,MAAM;CA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AAE,SAAS,OAAO;EAAG,UAAU,SAAS;CAAE,KAChD,EAAE,SAAS,UAAU,aAAa;EACjC,MAAM,OAAO,SAAS,cAAc,4BAA0B;EAC9D,IAAI,MAAM,KAAK,aAAa,SAAS,GAAG,uBAAuB,iBAAiB,OAAO,CAAC;CAC1F,CACF;CAEA,OACEC,gBAAAA,aAAAA,WAAAA;EACE,IAAA,UAAA;GAAS,OAAA,WAAW,MAAM,MAAM;EAAC;EACjC,IAAA,OAAA;GAAM,OAAA,iBAAiB,SAAS,EAAE,CAAC;EAAI;EACvC,IAAA,QAAA;GAAO,OAAA,iBAAiB,SAAS,EAAE,CAAC;EAAK;EACzCC,YAAY;;;;;;EAMZ,IAAA,UAAA;GAAO,OAAA,GACL,mGACA,gBAAgB,SAAS,IACzB,MAAM,KACR;EAAC;CAQY,GAPT,MAfN;EAgBEC,MAAM,YAAyB;GAC7B,UAAU,OAAO;GACjB,iBAAiB,MAAM,KAAK,OAAO;EACrC;EAnBFF,WAqBI,SAASG,gBAAAA,WAAAA,EAAWC,OAAO,KAAO,CAAA;CACvB,CAAA,CAAA;AAEnB"}
|
|
@@ -217,7 +217,7 @@ function LineHead(props) {
|
|
|
217
217
|
];
|
|
218
218
|
}
|
|
219
219
|
var lineClass = "flex min-h-control-xs w-full min-w-0 items-center gap-2 rounded-md px-1.5 py-0.5 text-start outline-none";
|
|
220
|
-
var interactiveClass = "cursor-pointer transition-colors ease-out hover:bg-muted/60 focus-visible:
|
|
220
|
+
var interactiveClass = "cursor-pointer transition-colors ease-out hover:bg-muted/60 focus-visible:focus-outline-inset focus-visible:border-ring";
|
|
221
221
|
function TraceLine(props) {
|
|
222
222
|
const local = props;
|
|
223
223
|
const rest = omit(props, "class", "title", "description", "icon", "status", "statusLabel", "meta", "open", "defaultOpen", "onOpenChange", "href", "onSelect", "selectHaspopup", "children");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trace.js","names":["role=\"list\"","<ul\n role=\"list\"\n data-slot=\"trace\"\n data-size={local.size ?? 'default'}\n class={cn('m-0 flex min-w-0 list-none flex-col gap-px p-0', local.class)}\n {...rest}\n >\n {local.children}\n </ul>","<LoaderCircle class=\"motion-safe:animate-spin\" />","class=\"motion-safe:animate-spin\"","<Show\n when={props.status === 'error'}\n fallback={\n <Show\n when={props.status === 'cancelled'}\n fallback={\n <Show\n when={props.status === 'pending'}\n fallback={props.icon ?? (props.completed ? <Check /> : <Dot />)}\n >\n <CircleDashed />\n </Show>\n }\n >\n <CircleSlash />\n </Show>\n }\n >\n <CircleAlert />\n </Show>","<Show\n when={props.status === 'cancelled'}\n fallback={\n <Show\n when={props.status === 'pending'}\n fallback={props.icon ?? (props.completed ? <Check /> : <Dot />)}\n >\n <CircleDashed />\n </Show>\n }\n >\n <CircleSlash />\n </Show>","<Show\n when={props.status === 'pending'}\n fallback={props.icon ?? (props.completed ? <Check /> : <Dot />)}\n >\n <CircleDashed />\n </Show>","<Check />","<Dot />","<CircleDashed />","<CircleSlash />","<CircleAlert />","class={cn('grid size-4 shrink-0 place-items-center [&_svg]:size-3.5', props.class, {\n 'text-muted-foreground': props.status !== 'error' && props.status !== 'running',\n 'text-destructive': props.status === 'error',\n 'text-info': props.status === 'running',\n })}","<span\n data-slot={props.slot ?? 'trace-mark'}\n aria-hidden=\"true\"\n class={cn('grid size-4 shrink-0 place-items-center [&_svg]:size-3.5', props.class, {\n 'text-muted-foreground': props.status !== 'error' && props.status !== 'running',\n 'text-destructive': props.status === 'error',\n 'text-info': props.status === 'running',\n })}\n >\n <Show\n when={props.status === 'running'}\n fallback={\n <Show\n when={props.status === 'error'}\n fallback={\n <Show\n when={props.status === 'cancelled'}\n fallback={\n <Show\n when={props.status === 'pending'}\n fallback={props.icon ?? (props.completed ? <Check /> : <Dot />)}\n >\n <CircleDashed />\n </Show>\n }\n >\n <CircleSlash />\n </Show>\n }\n >\n <CircleAlert />\n </Show>\n }\n >\n <LoaderCircle class=\"motion-safe:animate-spin\" />\n </Show>\n </span>","<TraceMark\n status={statusOwnsMark(props.status) ? props.status : undefined}\n icon={props.icon}\n completed={props.status === 'success'}\n />","statusOwnsMark(props.status) ? props.status : undefined","<Show when={props.description}>\n {(descriptionSlot) => (\n <span\n data-slot=\"trace-description\"\n class=\"min-w-0 truncate text-xs text-muted-foreground\"\n >\n {descriptionSlot()}\n </span>\n )}\n </Show>","<Show when={props.status}>\n {(status) => (\n <span class=\"sr-only\">{props.statusLabel ?? TRACE_STATUS_LABELS[status()]}</span>\n )}\n </Show>","<Show when={props.meta}>\n {(metaSlot) => (\n <span data-slot=\"trace-meta\" class=\"shrink-0 text-xs text-muted-foreground tabular-nums\">\n {metaSlot()}\n </span>\n )}\n </Show>","{props.trailing}","<LineHead\n title={local.title}\n description={local.description}\n icon={local.icon}\n status={local.status}\n statusLabel={local.statusLabel}\n meta={local.meta}\n trailing={trailing}\n />","<Show\n when={local.onSelect === undefined}\n fallback={\n <button\n type=\"button\"\n aria-haspopup={local.selectHaspopup ?? 'dialog'}\n class={cn(lineClass, interactiveClass)}\n onClick={() => local.onSelect?.()}\n >\n {head(\n <ChevronRight aria-hidden=\"true\" class=\"size-3.5 shrink-0 text-muted-foreground\" />\n )}\n </button>\n }\n >\n <Show when={content()} fallback={<div class={lineClass}>{head()}</div>}>\n <div class=\"group/trace\" data-expanded={isOpen() ? '' : undefined}>\n <button\n type=\"button\"\n aria-expanded={isOpen() ? 'true' : 'false'}\n aria-controls={isOpen() ? contentId : undefined}\n class={cn(lineClass, interactiveClass)}\n onClick={() => setOpen(!isOpen())}\n >\n {head(\n <ChevronRight\n aria-hidden=\"true\"\n class=\"size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-data-[expanded]/trace:rotate-90\"\n />\n )}\n </button>\n <Show when={isOpen()}>\n <div\n id={contentId}\n data-slot=\"trace-content\"\n data-expanded=\"\"\n class=\"overflow-hidden animate-in fade-in-0\"\n >\n {/* The rail is drawn from the mark's centre, so a nested line reads as\n belonging to the one above it without an indent that eats the width. */}\n <div class=\"ms-[0.6875rem] mt-0.5 mb-1 flex min-w-0 flex-col gap-1 border-s border-border ps-3\">\n {content()}\n </div>\n </div>\n </Show>\n </div>\n </Show>\n </Show>","<Show when={content()} fallback={<div class={lineClass}>{head()}</div>}>\n <div class=\"group/trace\" data-expanded={isOpen() ? '' : undefined}>\n <button\n type=\"button\"\n aria-expanded={isOpen() ? 'true' : 'false'}\n aria-controls={isOpen() ? contentId : undefined}\n class={cn(lineClass, interactiveClass)}\n onClick={() => setOpen(!isOpen())}\n >\n {head(\n <ChevronRight\n aria-hidden=\"true\"\n class=\"size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-data-[expanded]/trace:rotate-90\"\n />\n )}\n </button>\n <Show when={isOpen()}>\n <div\n id={contentId}\n data-slot=\"trace-content\"\n data-expanded=\"\"\n class=\"overflow-hidden animate-in fade-in-0\"\n >\n {/* The rail is drawn from the mark's centre, so a nested line reads as\n belonging to the one above it without an indent that eats the width. */}\n <div class=\"ms-[0.6875rem] mt-0.5 mb-1 flex min-w-0 flex-col gap-1 border-s border-border ps-3\">\n {content()}\n </div>\n </div>\n </Show>\n </div>\n </Show>","<ChevronRight\n aria-hidden=\"true\"\n class=\"size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-data-[expanded]/trace:rotate-90\"\n />","class=\"size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-data-[expanded]/trace:rotate-90\"","aria-expanded={isOpen() ? 'true' : 'false'}","aria-controls={isOpen() ? contentId : undefined}","class={cn(lineClass, interactiveClass)}","<ChevronRight aria-hidden=\"true\" class=\"size-3.5 shrink-0 text-muted-foreground\" />","class=\"size-3.5 shrink-0 text-muted-foreground\"","<ExternalLink aria-hidden=\"true\" class=\"size-3 shrink-0 text-muted-foreground\" />","class=\"size-3 shrink-0 text-muted-foreground\"","<li\n data-slot=\"trace-line\"\n data-status={local.status}\n aria-busy={local.status === 'running' ? 'true' : undefined}\n class={cn('min-w-0', local.class)}\n {...rest}\n >\n <Show\n when={local.href === undefined}\n fallback={\n <a\n href={local.href}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class={cn(lineClass, interactiveClass)}\n >\n {head(\n <ExternalLink aria-hidden=\"true\" class=\"size-3 shrink-0 text-muted-foreground\" />\n )}\n </a>\n }\n >\n <Show\n when={local.onSelect === undefined}\n fallback={\n <button\n type=\"button\"\n aria-haspopup={local.selectHaspopup ?? 'dialog'}\n class={cn(lineClass, interactiveClass)}\n onClick={() => local.onSelect?.()}\n >\n {head(\n <ChevronRight aria-hidden=\"true\" class=\"size-3.5 shrink-0 text-muted-foreground\" />\n )}\n </button>\n }\n >\n <Show when={content()} fallback={<div class={lineClass}>{head()}</div>}>\n <div class=\"group/trace\" data-expanded={isOpen() ? '' : undefined}>\n <button\n type=\"button\"\n aria-expanded={isOpen() ? 'true' : 'false'}\n aria-controls={isOpen() ? contentId : undefined}\n class={cn(lineClass, interactiveClass)}\n onClick={() => setOpen(!isOpen())}\n >\n {head(\n <ChevronRight\n aria-hidden=\"true\"\n class=\"size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-data-[expanded]/trace:rotate-90\"\n />\n )}\n </button>\n <Show when={isOpen()}>\n <div\n id={contentId}\n data-slot=\"trace-content\"\n data-expanded=\"\"\n class=\"overflow-hidden animate-in fade-in-0\"\n >\n {/* The rail is drawn from the mark's centre, so a nested line reads as\n belonging to the one above it without an indent that eats the width. */}\n <div class=\"ms-[0.6875rem] mt-0.5 mb-1 flex min-w-0 flex-col gap-1 border-s border-border ps-3\">\n {content()}\n </div>\n </div>\n </Show>\n </div>\n </Show>\n </Show>\n </Show>\n </li>","<div\n data-slot=\"trace-detail\"\n class={cn('min-w-0 text-xs leading-5 text-muted-foreground', local.class)}\n {...rest}\n >\n {local.children}\n </div>","<CodeBlock\n size=\"sm\"\n title=\"Error\"\n language=\"error\"\n code={props.text}\n lineMarks={marks()}\n complete\n maxHeight={ERROR_MAX_HEIGHT}\n wrap\n />","size=\"sm\"","title=\"Error\"","language=\"error\"","maxHeight={ERROR_MAX_HEIGHT}","<div class=\"flex min-w-0 flex-col gap-1\">\n <CodeBlock\n size=\"sm\"\n title=\"Error\"\n language=\"error\"\n code={props.text}\n lineMarks={marks()}\n complete\n maxHeight={ERROR_MAX_HEIGHT}\n wrap\n />\n {props.children}\n </div>","LucideCheck","LucideChevronRight","LucideCircleAlert","LucideCircleDashed","LucideCircleSlash","LucideDot","LucideExternalLink","LucideLoaderCircle","_$spread","_$insert","_$effect","_$readShallow","_$setAttribute","_$className"],"sources":["../../../../src/components/ui/trace/trace.tsx"],"sourcesContent":["import {\n Check as LucideCheck,\n ChevronRight as LucideChevronRight,\n CircleAlert as LucideCircleAlert,\n CircleDashed as LucideCircleDashed,\n CircleSlash as LucideCircleSlash,\n Dot as LucideDot,\n ExternalLink as LucideExternalLink,\n LoaderCircle as LucideLoaderCircle,\n} from '@lucide/solid'\nimport { createMemo, createSignal, createUniqueId, Show, omit } from 'solid-js'\nimport { type ComponentProps, type JSX } from '@solidjs/web'\nimport { cn } from '#lib/utils'\nimport { CodeBlock, type CodeLineMark } from '../code-block'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst Check = fastIcon(LucideCheck)\nconst ChevronRight = fastIcon(LucideChevronRight)\nconst CircleAlert = fastIcon(LucideCircleAlert)\nconst CircleDashed = fastIcon(LucideCircleDashed)\nconst CircleSlash = fastIcon(LucideCircleSlash)\nconst Dot = fastIcon(LucideDot)\nconst ExternalLink = fastIcon(LucideExternalLink)\nconst LoaderCircle = fastIcon(LucideLoaderCircle)\n\n/**\n * Trace.\n *\n * A list of lines, one per thing an agent did. Reasoning, a tool call, a source\n * it read, a plan step and a whole subagent run all share one shape — *something\n * the agent did, and what happened* — so they share one row: a leading mark, a\n * title, an optional description, a status and, when there is more to say, a\n * disclosure. A transcript built from this reads as one quiet column of activity\n * under the answer instead of a stack of competing cards.\n *\n * ## One row, three behaviours\n *\n * - **Children** make the line expandable. The trigger is a real button with\n * `aria-expanded`, so keyboard and screen-reader users get the disclosure for\n * free. Children can themselves be a `Trace`, which is how a summary expands\n * into steps and a step into its output. A `TraceLineBody` function is a lazy\n * body: it makes the line expandable without running, and runs once, when the\n * content first mounts, so a folded line builds none of its detail.\n * - **`href`** makes the line a link — a source, a file, a run page.\n * - **`onSelect`** makes the line a button that opens something *else* (a dialog,\n * sheet, drawer or popover owned by the caller). The line says so with\n * `aria-haspopup`; the surface itself is not this component's business.\n * - None of the three: a static line. It is not focusable, because a control that\n * does nothing is a tab stop with no purpose.\n *\n * ## Status is a claim, so it is optional\n *\n * `status` is rendered only when the caller has it. A line without one makes no\n * statement about success, which matters for runtime events whose lifecycle the\n * producer has not told us: showing a tick on an event that merely *arrived* is\n * a small lie that accumulates. `running` shimmers the title and spins the mark,\n * both of which stop under reduced motion; `error` and `cancelled` change the\n * mark's shape as well as its colour; every status is also spoken (`sr-only`),\n * because a coloured dot alone fails anyone who cannot see it.\n */\nexport type TraceStatus = 'pending' | 'running' | 'success' | 'error' | 'cancelled'\n\n/** The words spoken for each status. Override per line for another language. */\nexport const TRACE_STATUS_LABELS: Readonly<Record<TraceStatus, string>> = {\n pending: 'Pending',\n running: 'Running',\n success: 'Completed',\n error: 'Failed',\n cancelled: 'Cancelled',\n}\n\n/**\n * The status of a piece of work an agent set itself — a task item, a plan step,\n * a queued todo, a chain-of-thought step — as opposed to a call that ran. Each\n * maps onto a `TraceStatus`, so a work item draws the same mark as a line.\n */\nexport type WorkStatus = 'complete' | 'active' | 'pending' | 'failed' | 'skipped'\n\n/** The words spoken for each work status. */\nexport const WORK_STATUS_LABELS: Readonly<Record<WorkStatus, string>> = {\n complete: 'Completed',\n active: 'In progress',\n pending: 'Pending',\n failed: 'Failed',\n skipped: 'Skipped',\n}\n\n/** The line status each work status is drawn as. */\nexport const WORK_TRACE_STATUS: Readonly<Record<WorkStatus, TraceStatus>> = {\n complete: 'success',\n active: 'running',\n pending: 'pending',\n failed: 'error',\n skipped: 'cancelled',\n}\n\n/** `4` → `4s`, `65` → `1m 5s`. Nothing for a value that is not a finite duration. */\nexport function formatDuration(seconds: number | undefined): string | undefined {\n if (seconds === undefined || !Number.isFinite(seconds) || seconds < 0) return undefined\n const total = Math.round(seconds)\n if (total === 0) return '<1s'\n if (total < 60) return `${total}s`\n const hours = Math.floor(total / 3600)\n const minutes = Math.floor((total % 3600) / 60)\n const rest = total % 60\n if (hours > 0) return minutes > 0 ? `${hours}h ${minutes}m` : `${hours}h`\n return rest > 0 ? `${minutes}m ${rest}s` : `${minutes}m`\n}\n\nexport type TraceProps = ComponentProps<'ul'> & {\n /** Tighter rows, for output nested inside another line. */\n size?: 'default' | 'sm'\n}\n\nexport function Trace(props: TraceProps) {\n const local = props\n const rest = omit(props, 'class', 'size', 'children')\n return (\n // `role=\"list\"` restores list semantics that `list-none` strips in WebKit.\n <ul\n role=\"list\"\n data-slot=\"trace\"\n data-size={local.size ?? 'default'}\n class={cn('m-0 flex min-w-0 list-none flex-col gap-px p-0', local.class)}\n {...rest}\n >\n {local.children}\n </ul>\n )\n}\n\n/**\n * A line's details: elements, or a function that builds them. The function is\n * not called to decide whether the line can expand, only when the content\n * mounts, and then once.\n */\nexport type TraceLineBody = JSX.Element | (() => JSX.Element)\n\nexport type TraceLineProps = Omit<ComponentProps<'li'>, 'title' | 'onSelect' | 'children'> & {\n title: JSX.Element\n description?: JSX.Element\n /** The line's own glyph. A `running`, `error`, `pending` or `cancelled` status replaces it. */\n icon?: JSX.Element\n status?: TraceStatus\n /** Spoken in place of the default status word. */\n statusLabel?: string\n /** Trailing text: a duration, a count, a file size. */\n meta?: JSX.Element\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n /** Make the line a link. Mutually exclusive with children and `onSelect`. */\n href?: string\n /** Make the line open a surface the caller owns. */\n onSelect?: () => void\n /** Which kind of surface `onSelect` opens, for assistive technology. */\n selectHaspopup?: 'dialog' | 'menu' | 'true'\n /** Details. Their presence makes the line expandable. */\n children?: TraceLineBody\n}\n\n/**\n * The mark at the start of a line. A `TaskItemRow` uses it too, so a work item\n * and a line draw a status the same way.\n */\nexport function TraceMark(props: {\n status?: TraceStatus\n icon?: JSX.Element\n completed?: boolean\n class?: string\n slot?: string\n}) {\n return (\n <span\n data-slot={props.slot ?? 'trace-mark'}\n aria-hidden=\"true\"\n class={cn('grid size-4 shrink-0 place-items-center [&_svg]:size-3.5', props.class, {\n 'text-muted-foreground': props.status !== 'error' && props.status !== 'running',\n 'text-destructive': props.status === 'error',\n 'text-info': props.status === 'running',\n })}\n >\n <Show\n when={props.status === 'running'}\n fallback={\n <Show\n when={props.status === 'error'}\n fallback={\n <Show\n when={props.status === 'cancelled'}\n fallback={\n <Show\n when={props.status === 'pending'}\n fallback={props.icon ?? (props.completed ? <Check /> : <Dot />)}\n >\n <CircleDashed />\n </Show>\n }\n >\n <CircleSlash />\n </Show>\n }\n >\n <CircleAlert />\n </Show>\n }\n >\n <LoaderCircle class=\"motion-safe:animate-spin\" />\n </Show>\n </span>\n )\n}\n\n/**\n * Whether the status takes over the mark. A completed line keeps its own glyph\n * (the tool, the file) because \"done\" is the default expectation and a column of\n * identical ticks says nothing; the states that need noticing replace it.\n */\nfunction statusOwnsMark(status: TraceStatus | undefined): boolean {\n return (\n status === 'running' || status === 'error' || status === 'pending' || status === 'cancelled'\n )\n}\n\nfunction LineHead(props: {\n title: JSX.Element\n description?: JSX.Element\n icon?: JSX.Element\n status?: TraceStatus\n statusLabel?: string\n meta?: JSX.Element\n trailing?: JSX.Element\n}) {\n return (\n <>\n <TraceMark\n status={statusOwnsMark(props.status) ? props.status : undefined}\n icon={props.icon}\n completed={props.status === 'success'}\n />\n <span class=\"flex min-w-0 flex-1 items-baseline gap-2\">\n <span\n data-slot=\"trace-title\"\n class={cn('truncate text-sm', {\n 'text-shimmer': props.status === 'running',\n 'text-destructive': props.status === 'error',\n 'text-muted-foreground': props.status !== 'running' && props.status !== 'error',\n })}\n >\n {props.title}\n </span>\n <Show when={props.description}>\n {(descriptionSlot) => (\n <span\n data-slot=\"trace-description\"\n class=\"min-w-0 truncate text-xs text-muted-foreground\"\n >\n {descriptionSlot()}\n </span>\n )}\n </Show>\n </span>\n <Show when={props.status}>\n {(status) => (\n <span class=\"sr-only\">{props.statusLabel ?? TRACE_STATUS_LABELS[status()]}</span>\n )}\n </Show>\n <Show when={props.meta}>\n {(metaSlot) => (\n <span data-slot=\"trace-meta\" class=\"shrink-0 text-xs text-muted-foreground tabular-nums\">\n {metaSlot()}\n </span>\n )}\n </Show>\n {props.trailing}\n </>\n )\n}\n\nconst lineClass =\n 'flex min-h-control-xs w-full min-w-0 items-center gap-2 rounded-md px-1.5 py-0.5 text-start outline-none'\nconst interactiveClass =\n 'cursor-pointer transition-colors ease-out hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-primary-subtle focus-visible:border-ring'\n\nexport function TraceLine(props: TraceLineProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'title',\n 'description',\n 'icon',\n 'status',\n 'statusLabel',\n 'meta',\n 'open',\n 'defaultOpen',\n 'onOpenChange',\n 'href',\n 'onSelect',\n 'selectHaspopup',\n 'children'\n )\n // Read once. `local.children` is a getter that builds the subtree each time it\n // is read, so testing it in `when` and then placing it built every nested line\n // twice, and a chain of lines nested n deep built 2^n of them. It is not resolved\n // (`children()`), so a body that renders nothing yet, such as a `Show` that is\n // closed, still makes the line a disclosure, and a lazy body is not run until\n // `insert` places it.\n const content = createMemo(() => local.children as JSX.Element)\n // A plain disclosure: a button with aria-expanded and a region mounted while open.\n // A Collapsible primitive (Kobalte's, when this was written) cost a polymorphic\n // button, a presence tracker and three contexts per line, more than the rest of the line put together.\n const [ownOpen, setOwnOpen] = createSignal(() => local.defaultOpen ?? false)\n const isOpen = () => local.open ?? ownOpen()\n const setOpen = (next: boolean) => {\n if (local.open === undefined) setOwnOpen(next)\n local.onOpenChange?.(next)\n }\n const contentId = createUniqueId()\n const head = (trailing?: JSX.Element) => (\n <LineHead\n title={local.title}\n description={local.description}\n icon={local.icon}\n status={local.status}\n statusLabel={local.statusLabel}\n meta={local.meta}\n trailing={trailing}\n />\n )\n\n return (\n <li\n data-slot=\"trace-line\"\n data-status={local.status}\n aria-busy={local.status === 'running' ? 'true' : undefined}\n class={cn('min-w-0', local.class)}\n {...rest}\n >\n <Show\n when={local.href === undefined}\n fallback={\n <a\n href={local.href}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class={cn(lineClass, interactiveClass)}\n >\n {head(\n <ExternalLink aria-hidden=\"true\" class=\"size-3 shrink-0 text-muted-foreground\" />\n )}\n </a>\n }\n >\n <Show\n when={local.onSelect === undefined}\n fallback={\n <button\n type=\"button\"\n aria-haspopup={local.selectHaspopup ?? 'dialog'}\n class={cn(lineClass, interactiveClass)}\n onClick={() => local.onSelect?.()}\n >\n {head(\n <ChevronRight aria-hidden=\"true\" class=\"size-3.5 shrink-0 text-muted-foreground\" />\n )}\n </button>\n }\n >\n <Show when={content()} fallback={<div class={lineClass}>{head()}</div>}>\n <div class=\"group/trace\" data-expanded={isOpen() ? '' : undefined}>\n <button\n type=\"button\"\n aria-expanded={isOpen() ? 'true' : 'false'}\n aria-controls={isOpen() ? contentId : undefined}\n class={cn(lineClass, interactiveClass)}\n onClick={() => setOpen(!isOpen())}\n >\n {head(\n <ChevronRight\n aria-hidden=\"true\"\n class=\"size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-data-[expanded]/trace:rotate-90\"\n />\n )}\n </button>\n <Show when={isOpen()}>\n <div\n id={contentId}\n data-slot=\"trace-content\"\n data-expanded=\"\"\n class=\"overflow-hidden animate-in fade-in-0\"\n >\n {/* The rail is drawn from the mark's centre, so a nested line reads as\n belonging to the one above it without an indent that eats the width. */}\n <div class=\"ms-[0.6875rem] mt-0.5 mb-1 flex min-w-0 flex-col gap-1 border-s border-border ps-3\">\n {content()}\n </div>\n </div>\n </Show>\n </div>\n </Show>\n </Show>\n </Show>\n </li>\n )\n}\n\n/**\n * Free-form detail inside an expanded line: an input, an output, a paragraph. It\n * is a plain block with the type scale already set, so a caller does not restyle\n * a line's children to make a paragraph fit.\n */\nexport function TraceDetail(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class', 'children')\n return (\n <div\n data-slot=\"trace-detail\"\n class={cn('min-w-0 text-xs leading-5 text-muted-foreground', local.class)}\n {...rest}\n >\n {local.children}\n </div>\n )\n}\n\n/** Height an error section scrolls within. */\nconst ERROR_MAX_HEIGHT = '16rem'\n\n/**\n * A failure inside an expanded line, as text. Every line is marked as an error\n * rather than recolouring the block, which keeps the mark in the gutter (a glyph,\n * not colour alone) and the copy exact. `children` go below it, e.g. a note that\n * the text was cut.\n */\nexport function TraceError(props: { text: string; children?: JSX.Element }) {\n const marks = createMemo((): Readonly<Record<number, CodeLineMark>> =>\n Object.fromEntries(\n Array.from({ length: props.text.split('\\n').length }, (_, index) => [index + 1, 'error'])\n )\n )\n return (\n <div class=\"flex min-w-0 flex-col gap-1\">\n <CodeBlock\n size=\"sm\"\n title=\"Error\"\n language=\"error\"\n code={props.text}\n lineMarks={marks()}\n complete\n maxHeight={ERROR_MAX_HEIGHT}\n wrap\n />\n {props.children}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBA,IAAM,QAAQ,SAASwC,OAAW;AAClC,IAAM,eAAe,SAASC,cAAkB;AAChD,IAAM,cAAc,SAASC,aAAiB;AAC9C,IAAM,eAAe,SAASC,cAAkB;AAChD,IAAM,cAAc,SAASC,aAAiB;AAC9C,IAAM,MAAM,SAASC,KAAS;AAC9B,IAAM,eAAe,SAASC,cAAkB;AAChD,IAAM,eAAe,SAASC,cAAkB;;AAwChD,IAAa,sBAA6D;CACxE,SAAS;CACT,SAAS;CACT,SAAS;CACT,OAAO;CACP,WAAW;AACb;;AAUA,IAAa,qBAA2D;CACtE,UAAU;CACV,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,SAAS;AACX;;AAGA,IAAa,oBAA+D;CAC1E,UAAU;CACV,QAAQ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;EACEC,MAAK;EACLC,OAAM;EACNC,UAAS;EACT,IAAA,OAAA;GAAM,OAAA,MAAM;EAAI;EAChB,IAAA,YAAA;GAAW,OAAA,MAAM;EAAC;EAClB,UAAA;EACAC,WAAW;EACX,MAAA;CACD,CAAA,GAVHC,MAYK;CAZLU,OAAA,cAWE;EAAC,OAAA,MAAM;CAAQ,GAXjBV,MAYK;CAbP,OACEA;AAcJ"}
|
|
1
|
+
{"version":3,"file":"trace.js","names":["role=\"list\"","<ul\n role=\"list\"\n data-slot=\"trace\"\n data-size={local.size ?? 'default'}\n class={cn('m-0 flex min-w-0 list-none flex-col gap-px p-0', local.class)}\n {...rest}\n >\n {local.children}\n </ul>","<LoaderCircle class=\"motion-safe:animate-spin\" />","class=\"motion-safe:animate-spin\"","<Show\n when={props.status === 'error'}\n fallback={\n <Show\n when={props.status === 'cancelled'}\n fallback={\n <Show\n when={props.status === 'pending'}\n fallback={props.icon ?? (props.completed ? <Check /> : <Dot />)}\n >\n <CircleDashed />\n </Show>\n }\n >\n <CircleSlash />\n </Show>\n }\n >\n <CircleAlert />\n </Show>","<Show\n when={props.status === 'cancelled'}\n fallback={\n <Show\n when={props.status === 'pending'}\n fallback={props.icon ?? (props.completed ? <Check /> : <Dot />)}\n >\n <CircleDashed />\n </Show>\n }\n >\n <CircleSlash />\n </Show>","<Show\n when={props.status === 'pending'}\n fallback={props.icon ?? (props.completed ? <Check /> : <Dot />)}\n >\n <CircleDashed />\n </Show>","<Check />","<Dot />","<CircleDashed />","<CircleSlash />","<CircleAlert />","class={cn('grid size-4 shrink-0 place-items-center [&_svg]:size-3.5', props.class, {\n 'text-muted-foreground': props.status !== 'error' && props.status !== 'running',\n 'text-destructive': props.status === 'error',\n 'text-info': props.status === 'running',\n })}","<span\n data-slot={props.slot ?? 'trace-mark'}\n aria-hidden=\"true\"\n class={cn('grid size-4 shrink-0 place-items-center [&_svg]:size-3.5', props.class, {\n 'text-muted-foreground': props.status !== 'error' && props.status !== 'running',\n 'text-destructive': props.status === 'error',\n 'text-info': props.status === 'running',\n })}\n >\n <Show\n when={props.status === 'running'}\n fallback={\n <Show\n when={props.status === 'error'}\n fallback={\n <Show\n when={props.status === 'cancelled'}\n fallback={\n <Show\n when={props.status === 'pending'}\n fallback={props.icon ?? (props.completed ? <Check /> : <Dot />)}\n >\n <CircleDashed />\n </Show>\n }\n >\n <CircleSlash />\n </Show>\n }\n >\n <CircleAlert />\n </Show>\n }\n >\n <LoaderCircle class=\"motion-safe:animate-spin\" />\n </Show>\n </span>","<TraceMark\n status={statusOwnsMark(props.status) ? props.status : undefined}\n icon={props.icon}\n completed={props.status === 'success'}\n />","statusOwnsMark(props.status) ? props.status : undefined","<Show when={props.description}>\n {(descriptionSlot) => (\n <span\n data-slot=\"trace-description\"\n class=\"min-w-0 truncate text-xs text-muted-foreground\"\n >\n {descriptionSlot()}\n </span>\n )}\n </Show>","<Show when={props.status}>\n {(status) => (\n <span class=\"sr-only\">{props.statusLabel ?? TRACE_STATUS_LABELS[status()]}</span>\n )}\n </Show>","<Show when={props.meta}>\n {(metaSlot) => (\n <span data-slot=\"trace-meta\" class=\"shrink-0 text-xs text-muted-foreground tabular-nums\">\n {metaSlot()}\n </span>\n )}\n </Show>","{props.trailing}","<LineHead\n title={local.title}\n description={local.description}\n icon={local.icon}\n status={local.status}\n statusLabel={local.statusLabel}\n meta={local.meta}\n trailing={trailing}\n />","<Show\n when={local.onSelect === undefined}\n fallback={\n <button\n type=\"button\"\n aria-haspopup={local.selectHaspopup ?? 'dialog'}\n class={cn(lineClass, interactiveClass)}\n onClick={() => local.onSelect?.()}\n >\n {head(\n <ChevronRight aria-hidden=\"true\" class=\"size-3.5 shrink-0 text-muted-foreground\" />\n )}\n </button>\n }\n >\n <Show when={content()} fallback={<div class={lineClass}>{head()}</div>}>\n <div class=\"group/trace\" data-expanded={isOpen() ? '' : undefined}>\n <button\n type=\"button\"\n aria-expanded={isOpen() ? 'true' : 'false'}\n aria-controls={isOpen() ? contentId : undefined}\n class={cn(lineClass, interactiveClass)}\n onClick={() => setOpen(!isOpen())}\n >\n {head(\n <ChevronRight\n aria-hidden=\"true\"\n class=\"size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-data-[expanded]/trace:rotate-90\"\n />\n )}\n </button>\n <Show when={isOpen()}>\n <div\n id={contentId}\n data-slot=\"trace-content\"\n data-expanded=\"\"\n class=\"overflow-hidden animate-in fade-in-0\"\n >\n {/* The rail is drawn from the mark's centre, so a nested line reads as\n belonging to the one above it without an indent that eats the width. */}\n <div class=\"ms-[0.6875rem] mt-0.5 mb-1 flex min-w-0 flex-col gap-1 border-s border-border ps-3\">\n {content()}\n </div>\n </div>\n </Show>\n </div>\n </Show>\n </Show>","<Show when={content()} fallback={<div class={lineClass}>{head()}</div>}>\n <div class=\"group/trace\" data-expanded={isOpen() ? '' : undefined}>\n <button\n type=\"button\"\n aria-expanded={isOpen() ? 'true' : 'false'}\n aria-controls={isOpen() ? contentId : undefined}\n class={cn(lineClass, interactiveClass)}\n onClick={() => setOpen(!isOpen())}\n >\n {head(\n <ChevronRight\n aria-hidden=\"true\"\n class=\"size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-data-[expanded]/trace:rotate-90\"\n />\n )}\n </button>\n <Show when={isOpen()}>\n <div\n id={contentId}\n data-slot=\"trace-content\"\n data-expanded=\"\"\n class=\"overflow-hidden animate-in fade-in-0\"\n >\n {/* The rail is drawn from the mark's centre, so a nested line reads as\n belonging to the one above it without an indent that eats the width. */}\n <div class=\"ms-[0.6875rem] mt-0.5 mb-1 flex min-w-0 flex-col gap-1 border-s border-border ps-3\">\n {content()}\n </div>\n </div>\n </Show>\n </div>\n </Show>","<ChevronRight\n aria-hidden=\"true\"\n class=\"size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-data-[expanded]/trace:rotate-90\"\n />","class=\"size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-data-[expanded]/trace:rotate-90\"","aria-expanded={isOpen() ? 'true' : 'false'}","aria-controls={isOpen() ? contentId : undefined}","class={cn(lineClass, interactiveClass)}","<ChevronRight aria-hidden=\"true\" class=\"size-3.5 shrink-0 text-muted-foreground\" />","class=\"size-3.5 shrink-0 text-muted-foreground\"","<ExternalLink aria-hidden=\"true\" class=\"size-3 shrink-0 text-muted-foreground\" />","class=\"size-3 shrink-0 text-muted-foreground\"","<li\n data-slot=\"trace-line\"\n data-status={local.status}\n aria-busy={local.status === 'running' ? 'true' : undefined}\n class={cn('min-w-0', local.class)}\n {...rest}\n >\n <Show\n when={local.href === undefined}\n fallback={\n <a\n href={local.href}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class={cn(lineClass, interactiveClass)}\n >\n {head(\n <ExternalLink aria-hidden=\"true\" class=\"size-3 shrink-0 text-muted-foreground\" />\n )}\n </a>\n }\n >\n <Show\n when={local.onSelect === undefined}\n fallback={\n <button\n type=\"button\"\n aria-haspopup={local.selectHaspopup ?? 'dialog'}\n class={cn(lineClass, interactiveClass)}\n onClick={() => local.onSelect?.()}\n >\n {head(\n <ChevronRight aria-hidden=\"true\" class=\"size-3.5 shrink-0 text-muted-foreground\" />\n )}\n </button>\n }\n >\n <Show when={content()} fallback={<div class={lineClass}>{head()}</div>}>\n <div class=\"group/trace\" data-expanded={isOpen() ? '' : undefined}>\n <button\n type=\"button\"\n aria-expanded={isOpen() ? 'true' : 'false'}\n aria-controls={isOpen() ? contentId : undefined}\n class={cn(lineClass, interactiveClass)}\n onClick={() => setOpen(!isOpen())}\n >\n {head(\n <ChevronRight\n aria-hidden=\"true\"\n class=\"size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-data-[expanded]/trace:rotate-90\"\n />\n )}\n </button>\n <Show when={isOpen()}>\n <div\n id={contentId}\n data-slot=\"trace-content\"\n data-expanded=\"\"\n class=\"overflow-hidden animate-in fade-in-0\"\n >\n {/* The rail is drawn from the mark's centre, so a nested line reads as\n belonging to the one above it without an indent that eats the width. */}\n <div class=\"ms-[0.6875rem] mt-0.5 mb-1 flex min-w-0 flex-col gap-1 border-s border-border ps-3\">\n {content()}\n </div>\n </div>\n </Show>\n </div>\n </Show>\n </Show>\n </Show>\n </li>","<div\n data-slot=\"trace-detail\"\n class={cn('min-w-0 text-xs leading-5 text-muted-foreground', local.class)}\n {...rest}\n >\n {local.children}\n </div>","<CodeBlock\n size=\"sm\"\n title=\"Error\"\n language=\"error\"\n code={props.text}\n lineMarks={marks()}\n complete\n maxHeight={ERROR_MAX_HEIGHT}\n wrap\n />","size=\"sm\"","title=\"Error\"","language=\"error\"","maxHeight={ERROR_MAX_HEIGHT}","<div class=\"flex min-w-0 flex-col gap-1\">\n <CodeBlock\n size=\"sm\"\n title=\"Error\"\n language=\"error\"\n code={props.text}\n lineMarks={marks()}\n complete\n maxHeight={ERROR_MAX_HEIGHT}\n wrap\n />\n {props.children}\n </div>","LucideCheck","LucideChevronRight","LucideCircleAlert","LucideCircleDashed","LucideCircleSlash","LucideDot","LucideExternalLink","LucideLoaderCircle","_$spread","_$insert","_$effect","_$readShallow","_$setAttribute","_$className"],"sources":["../../../../src/components/ui/trace/trace.tsx"],"sourcesContent":["import {\n Check as LucideCheck,\n ChevronRight as LucideChevronRight,\n CircleAlert as LucideCircleAlert,\n CircleDashed as LucideCircleDashed,\n CircleSlash as LucideCircleSlash,\n Dot as LucideDot,\n ExternalLink as LucideExternalLink,\n LoaderCircle as LucideLoaderCircle,\n} from '@lucide/solid'\nimport { createMemo, createSignal, createUniqueId, Show, omit } from 'solid-js'\nimport { type ComponentProps, type JSX } from '@solidjs/web'\nimport { cn } from '#lib/utils'\nimport { CodeBlock, type CodeLineMark } from '../code-block'\nimport { fastIcon } from '#lib/fast-icon'\n\n// lucide icons drawn from a cloned template (see fastIcon).\nconst Check = fastIcon(LucideCheck)\nconst ChevronRight = fastIcon(LucideChevronRight)\nconst CircleAlert = fastIcon(LucideCircleAlert)\nconst CircleDashed = fastIcon(LucideCircleDashed)\nconst CircleSlash = fastIcon(LucideCircleSlash)\nconst Dot = fastIcon(LucideDot)\nconst ExternalLink = fastIcon(LucideExternalLink)\nconst LoaderCircle = fastIcon(LucideLoaderCircle)\n\n/**\n * Trace.\n *\n * A list of lines, one per thing an agent did. Reasoning, a tool call, a source\n * it read, a plan step and a whole subagent run all share one shape — *something\n * the agent did, and what happened* — so they share one row: a leading mark, a\n * title, an optional description, a status and, when there is more to say, a\n * disclosure. A transcript built from this reads as one quiet column of activity\n * under the answer instead of a stack of competing cards.\n *\n * ## One row, three behaviours\n *\n * - **Children** make the line expandable. The trigger is a real button with\n * `aria-expanded`, so keyboard and screen-reader users get the disclosure for\n * free. Children can themselves be a `Trace`, which is how a summary expands\n * into steps and a step into its output. A `TraceLineBody` function is a lazy\n * body: it makes the line expandable without running, and runs once, when the\n * content first mounts, so a folded line builds none of its detail.\n * - **`href`** makes the line a link — a source, a file, a run page.\n * - **`onSelect`** makes the line a button that opens something *else* (a dialog,\n * sheet, drawer or popover owned by the caller). The line says so with\n * `aria-haspopup`; the surface itself is not this component's business.\n * - None of the three: a static line. It is not focusable, because a control that\n * does nothing is a tab stop with no purpose.\n *\n * ## Status is a claim, so it is optional\n *\n * `status` is rendered only when the caller has it. A line without one makes no\n * statement about success, which matters for runtime events whose lifecycle the\n * producer has not told us: showing a tick on an event that merely *arrived* is\n * a small lie that accumulates. `running` shimmers the title and spins the mark,\n * both of which stop under reduced motion; `error` and `cancelled` change the\n * mark's shape as well as its colour; every status is also spoken (`sr-only`),\n * because a coloured dot alone fails anyone who cannot see it.\n */\nexport type TraceStatus = 'pending' | 'running' | 'success' | 'error' | 'cancelled'\n\n/** The words spoken for each status. Override per line for another language. */\nexport const TRACE_STATUS_LABELS: Readonly<Record<TraceStatus, string>> = {\n pending: 'Pending',\n running: 'Running',\n success: 'Completed',\n error: 'Failed',\n cancelled: 'Cancelled',\n}\n\n/**\n * The status of a piece of work an agent set itself — a task item, a plan step,\n * a queued todo, a chain-of-thought step — as opposed to a call that ran. Each\n * maps onto a `TraceStatus`, so a work item draws the same mark as a line.\n */\nexport type WorkStatus = 'complete' | 'active' | 'pending' | 'failed' | 'skipped'\n\n/** The words spoken for each work status. */\nexport const WORK_STATUS_LABELS: Readonly<Record<WorkStatus, string>> = {\n complete: 'Completed',\n active: 'In progress',\n pending: 'Pending',\n failed: 'Failed',\n skipped: 'Skipped',\n}\n\n/** The line status each work status is drawn as. */\nexport const WORK_TRACE_STATUS: Readonly<Record<WorkStatus, TraceStatus>> = {\n complete: 'success',\n active: 'running',\n pending: 'pending',\n failed: 'error',\n skipped: 'cancelled',\n}\n\n/** `4` → `4s`, `65` → `1m 5s`. Nothing for a value that is not a finite duration. */\nexport function formatDuration(seconds: number | undefined): string | undefined {\n if (seconds === undefined || !Number.isFinite(seconds) || seconds < 0) return undefined\n const total = Math.round(seconds)\n if (total === 0) return '<1s'\n if (total < 60) return `${total}s`\n const hours = Math.floor(total / 3600)\n const minutes = Math.floor((total % 3600) / 60)\n const rest = total % 60\n if (hours > 0) return minutes > 0 ? `${hours}h ${minutes}m` : `${hours}h`\n return rest > 0 ? `${minutes}m ${rest}s` : `${minutes}m`\n}\n\nexport type TraceProps = ComponentProps<'ul'> & {\n /** Tighter rows, for output nested inside another line. */\n size?: 'default' | 'sm'\n}\n\nexport function Trace(props: TraceProps) {\n const local = props\n const rest = omit(props, 'class', 'size', 'children')\n return (\n // `role=\"list\"` restores list semantics that `list-none` strips in WebKit.\n <ul\n role=\"list\"\n data-slot=\"trace\"\n data-size={local.size ?? 'default'}\n class={cn('m-0 flex min-w-0 list-none flex-col gap-px p-0', local.class)}\n {...rest}\n >\n {local.children}\n </ul>\n )\n}\n\n/**\n * A line's details: elements, or a function that builds them. The function is\n * not called to decide whether the line can expand, only when the content\n * mounts, and then once.\n */\nexport type TraceLineBody = JSX.Element | (() => JSX.Element)\n\nexport type TraceLineProps = Omit<ComponentProps<'li'>, 'title' | 'onSelect' | 'children'> & {\n title: JSX.Element\n description?: JSX.Element\n /** The line's own glyph. A `running`, `error`, `pending` or `cancelled` status replaces it. */\n icon?: JSX.Element\n status?: TraceStatus\n /** Spoken in place of the default status word. */\n statusLabel?: string\n /** Trailing text: a duration, a count, a file size. */\n meta?: JSX.Element\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n /** Make the line a link. Mutually exclusive with children and `onSelect`. */\n href?: string\n /** Make the line open a surface the caller owns. */\n onSelect?: () => void\n /** Which kind of surface `onSelect` opens, for assistive technology. */\n selectHaspopup?: 'dialog' | 'menu' | 'true'\n /** Details. Their presence makes the line expandable. */\n children?: TraceLineBody\n}\n\n/**\n * The mark at the start of a line. A `TaskItemRow` uses it too, so a work item\n * and a line draw a status the same way.\n */\nexport function TraceMark(props: {\n status?: TraceStatus\n icon?: JSX.Element\n completed?: boolean\n class?: string\n slot?: string\n}) {\n return (\n <span\n data-slot={props.slot ?? 'trace-mark'}\n aria-hidden=\"true\"\n class={cn('grid size-4 shrink-0 place-items-center [&_svg]:size-3.5', props.class, {\n 'text-muted-foreground': props.status !== 'error' && props.status !== 'running',\n 'text-destructive': props.status === 'error',\n 'text-info': props.status === 'running',\n })}\n >\n <Show\n when={props.status === 'running'}\n fallback={\n <Show\n when={props.status === 'error'}\n fallback={\n <Show\n when={props.status === 'cancelled'}\n fallback={\n <Show\n when={props.status === 'pending'}\n fallback={props.icon ?? (props.completed ? <Check /> : <Dot />)}\n >\n <CircleDashed />\n </Show>\n }\n >\n <CircleSlash />\n </Show>\n }\n >\n <CircleAlert />\n </Show>\n }\n >\n <LoaderCircle class=\"motion-safe:animate-spin\" />\n </Show>\n </span>\n )\n}\n\n/**\n * Whether the status takes over the mark. A completed line keeps its own glyph\n * (the tool, the file) because \"done\" is the default expectation and a column of\n * identical ticks says nothing; the states that need noticing replace it.\n */\nfunction statusOwnsMark(status: TraceStatus | undefined): boolean {\n return (\n status === 'running' || status === 'error' || status === 'pending' || status === 'cancelled'\n )\n}\n\nfunction LineHead(props: {\n title: JSX.Element\n description?: JSX.Element\n icon?: JSX.Element\n status?: TraceStatus\n statusLabel?: string\n meta?: JSX.Element\n trailing?: JSX.Element\n}) {\n return (\n <>\n <TraceMark\n status={statusOwnsMark(props.status) ? props.status : undefined}\n icon={props.icon}\n completed={props.status === 'success'}\n />\n <span class=\"flex min-w-0 flex-1 items-baseline gap-2\">\n <span\n data-slot=\"trace-title\"\n class={cn('truncate text-sm', {\n 'text-shimmer': props.status === 'running',\n 'text-destructive': props.status === 'error',\n 'text-muted-foreground': props.status !== 'running' && props.status !== 'error',\n })}\n >\n {props.title}\n </span>\n <Show when={props.description}>\n {(descriptionSlot) => (\n <span\n data-slot=\"trace-description\"\n class=\"min-w-0 truncate text-xs text-muted-foreground\"\n >\n {descriptionSlot()}\n </span>\n )}\n </Show>\n </span>\n <Show when={props.status}>\n {(status) => (\n <span class=\"sr-only\">{props.statusLabel ?? TRACE_STATUS_LABELS[status()]}</span>\n )}\n </Show>\n <Show when={props.meta}>\n {(metaSlot) => (\n <span data-slot=\"trace-meta\" class=\"shrink-0 text-xs text-muted-foreground tabular-nums\">\n {metaSlot()}\n </span>\n )}\n </Show>\n {props.trailing}\n </>\n )\n}\n\nconst lineClass =\n 'flex min-h-control-xs w-full min-w-0 items-center gap-2 rounded-md px-1.5 py-0.5 text-start outline-none'\nconst interactiveClass =\n 'cursor-pointer transition-colors ease-out hover:bg-muted/60 focus-visible:focus-outline-inset focus-visible:border-ring'\n\nexport function TraceLine(props: TraceLineProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'title',\n 'description',\n 'icon',\n 'status',\n 'statusLabel',\n 'meta',\n 'open',\n 'defaultOpen',\n 'onOpenChange',\n 'href',\n 'onSelect',\n 'selectHaspopup',\n 'children'\n )\n // Read once. `local.children` is a getter that builds the subtree each time it\n // is read, so testing it in `when` and then placing it built every nested line\n // twice, and a chain of lines nested n deep built 2^n of them. It is not resolved\n // (`children()`), so a body that renders nothing yet, such as a `Show` that is\n // closed, still makes the line a disclosure, and a lazy body is not run until\n // `insert` places it.\n const content = createMemo(() => local.children as JSX.Element)\n // A plain disclosure: a button with aria-expanded and a region mounted while open.\n // A Collapsible primitive (Kobalte's, when this was written) cost a polymorphic\n // button, a presence tracker and three contexts per line, more than the rest of the line put together.\n const [ownOpen, setOwnOpen] = createSignal(() => local.defaultOpen ?? false)\n const isOpen = () => local.open ?? ownOpen()\n const setOpen = (next: boolean) => {\n if (local.open === undefined) setOwnOpen(next)\n local.onOpenChange?.(next)\n }\n const contentId = createUniqueId()\n const head = (trailing?: JSX.Element) => (\n <LineHead\n title={local.title}\n description={local.description}\n icon={local.icon}\n status={local.status}\n statusLabel={local.statusLabel}\n meta={local.meta}\n trailing={trailing}\n />\n )\n\n return (\n <li\n data-slot=\"trace-line\"\n data-status={local.status}\n aria-busy={local.status === 'running' ? 'true' : undefined}\n class={cn('min-w-0', local.class)}\n {...rest}\n >\n <Show\n when={local.href === undefined}\n fallback={\n <a\n href={local.href}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class={cn(lineClass, interactiveClass)}\n >\n {head(\n <ExternalLink aria-hidden=\"true\" class=\"size-3 shrink-0 text-muted-foreground\" />\n )}\n </a>\n }\n >\n <Show\n when={local.onSelect === undefined}\n fallback={\n <button\n type=\"button\"\n aria-haspopup={local.selectHaspopup ?? 'dialog'}\n class={cn(lineClass, interactiveClass)}\n onClick={() => local.onSelect?.()}\n >\n {head(\n <ChevronRight aria-hidden=\"true\" class=\"size-3.5 shrink-0 text-muted-foreground\" />\n )}\n </button>\n }\n >\n <Show when={content()} fallback={<div class={lineClass}>{head()}</div>}>\n <div class=\"group/trace\" data-expanded={isOpen() ? '' : undefined}>\n <button\n type=\"button\"\n aria-expanded={isOpen() ? 'true' : 'false'}\n aria-controls={isOpen() ? contentId : undefined}\n class={cn(lineClass, interactiveClass)}\n onClick={() => setOpen(!isOpen())}\n >\n {head(\n <ChevronRight\n aria-hidden=\"true\"\n class=\"size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-data-[expanded]/trace:rotate-90\"\n />\n )}\n </button>\n <Show when={isOpen()}>\n <div\n id={contentId}\n data-slot=\"trace-content\"\n data-expanded=\"\"\n class=\"overflow-hidden animate-in fade-in-0\"\n >\n {/* The rail is drawn from the mark's centre, so a nested line reads as\n belonging to the one above it without an indent that eats the width. */}\n <div class=\"ms-[0.6875rem] mt-0.5 mb-1 flex min-w-0 flex-col gap-1 border-s border-border ps-3\">\n {content()}\n </div>\n </div>\n </Show>\n </div>\n </Show>\n </Show>\n </Show>\n </li>\n )\n}\n\n/**\n * Free-form detail inside an expanded line: an input, an output, a paragraph. It\n * is a plain block with the type scale already set, so a caller does not restyle\n * a line's children to make a paragraph fit.\n */\nexport function TraceDetail(props: ComponentProps<'div'>) {\n const local = props\n const rest = omit(props, 'class', 'children')\n return (\n <div\n data-slot=\"trace-detail\"\n class={cn('min-w-0 text-xs leading-5 text-muted-foreground', local.class)}\n {...rest}\n >\n {local.children}\n </div>\n )\n}\n\n/** Height an error section scrolls within. */\nconst ERROR_MAX_HEIGHT = '16rem'\n\n/**\n * A failure inside an expanded line, as text. Every line is marked as an error\n * rather than recolouring the block, which keeps the mark in the gutter (a glyph,\n * not colour alone) and the copy exact. `children` go below it, e.g. a note that\n * the text was cut.\n */\nexport function TraceError(props: { text: string; children?: JSX.Element }) {\n const marks = createMemo((): Readonly<Record<number, CodeLineMark>> =>\n Object.fromEntries(\n Array.from({ length: props.text.split('\\n').length }, (_, index) => [index + 1, 'error'])\n )\n )\n return (\n <div class=\"flex min-w-0 flex-col gap-1\">\n <CodeBlock\n size=\"sm\"\n title=\"Error\"\n language=\"error\"\n code={props.text}\n lineMarks={marks()}\n complete\n maxHeight={ERROR_MAX_HEIGHT}\n wrap\n />\n {props.children}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBA,IAAM,QAAQ,SAASwC,OAAW;AAClC,IAAM,eAAe,SAASC,cAAkB;AAChD,IAAM,cAAc,SAASC,aAAiB;AAC9C,IAAM,eAAe,SAASC,cAAkB;AAChD,IAAM,cAAc,SAASC,aA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;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,QAO+D,CAAA;AAEpF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,sHACqF,CAAA;AAErH,4CAA4C;AAC5C,eAAO,MAAM,SAAS,mFAC4D,CAAA;AAElF,+EAA+E;AAC/E,eAAO,MAAM,YAAY,0DAA0D,CAAA;AAEnF,oCAAoC;AACpC,eAAO,MAAM,aAAa,8BAA8B,CAAA;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;8EAYzB,CAAA;AAEF,8CAA8C;AAC9C,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAErF,iDAAiD;AACjD,eAAO,MAAM,kBAAkB,QAAQ,CAAA;AAEvC;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa;aAAK,mBAAmB,EAAE,EAAE;CAAW,CAAA;AAEjE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,8BAA8B,CAAA;AAU7D,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,IAAI,CASlE;AAED,eAAO,MAAM,UAAU,SAAU,OAAO,YAA8B,CAAA"}
|
package/dist/lib/overlay.js
CHANGED
|
@@ -57,7 +57,7 @@ var overlayFooter = "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end";
|
|
|
57
57
|
/** The sentence under an overlay title. */
|
|
58
58
|
var overlayDescription = "text-muted-foreground text-sm";
|
|
59
59
|
/** The icon-only close in a dialog or sheet's top-end corner. */
|
|
60
|
-
var overlayCornerClose = "absolute top-3.5 end-3.5 rounded-md p-1 text-muted-foreground transition-colors ease-out hover:bg-surface-hover hover:text-foreground focus-visible:border-ring focus-visible:
|
|
60
|
+
var overlayCornerClose = "absolute top-3.5 end-3.5 rounded-md p-1 text-muted-foreground transition-colors ease-out hover:bg-surface-hover hover:text-foreground focus-visible:border-ring focus-visible:focus-outline outline-none";
|
|
61
61
|
/**
|
|
62
62
|
* The tip: shadcn's inverted chip, foreground on background, so an explanation
|
|
63
63
|
* never reads as a popover that could hold controls. The side rail draws it
|
package/dist/lib/overlay.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.js","names":[],"sources":["../../src/lib/overlay.ts"],"sourcesContent":["/**\n * Shared strings for the overlay layer: dialogs, sheets, menus, popovers,\n * tooltips and the command palette.\n *\n * These live here rather than in each component because the overlay family is\n * where consistency is most visible and least likely to survive duplication.\n * A dialog, a sheet and a dropdown that disagree about their border, radius,\n * motion or shadow read as three different apps, and an app that adopts this\n * library would inherit all three. Declaring the surface once is what makes\n * \"an overlay looks like this\" a fact rather than a convention.\n */\n\nimport { cva, type VariantProps } from '#lib/variants'\n\n/**\n * One CSS layout unit (1/64px), added to every side offset. ui-sdk snaps a\n * layer's position to whole device pixels after undoing the layer's entry\n * transform (`zoom-in-95`), and that undo carries float noise of about 1e-7px:\n * a layer due at an anchor edge of 75.5px lands at 75.4999997px and snaps to\n * 75px, half a pixel inside its trigger. A layout unit is far above the noise\n * and far below a pixel, so whole-pixel anchors land exactly where they did and\n * half-pixel ones round away from the anchor as intended. Remove once ui-sdk\n * rounds its untransformed origin (ui-notes/ui-sdk-issue-snap.md).\n */\nexport const SNAP_GUARD = 1 / 64\n\n/** The panel itself: fill, hairline edge, radius, elevation. Menus, popovers\n * and the command palette float on the elevated overlay rung (`--popover`). */\nexport const overlaySurface =\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * The modal panel: the same hairline edge, radius and elevation, painted on the\n * *neutral* theme surface instead of the elevated overlay rung.\n *\n * `--popover` is the catalogue's `surfaceElevated`, whose derivation amplifies\n * the canvas hue's chroma on the elevated step. On the dark default's violet\n * canvas that makes the dialog the most chromatic surface in the ladder,\n * `oklch(0.2406 0.0088 300.91)`, red above green in sRGB, and on a full dialog\n * panel that cast reads as a warm tint the canvas never has. shadcn's own\n * convention already splits the two: a Dialog paints `bg-background`, menus and\n * popovers paint `bg-popover`. The veil, the hairline and the elevation shadow\n * carry the separation the lighter fill no longer provides.\n */\nexport const dialogSurface =\n 'bg-background text-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * Overlay titles have one fixed typography role. Keep this small recipe shared\n * without loading the configurable Heading component into every dialog.\n */\nexport const overlayTitle = 'font-semibold text-base tracking-tight leading-none'\n\n/** The span of the portal wrapper that centres a dialog-like overlay. */\nexport const overlayPositioner = 'fixed inset-0 z-(--z-dialog) grid place-items-center p-4'\n\n/** The dimming layer behind a modal overlay. */\nexport const overlayScrim =\n 'fixed inset-0 z-(--z-dialog) bg-scrim/50 supports-[backdrop-filter]:backdrop-blur-xs'\n\n/** The scrim fades; it never zooms with the panel above it. */\nexport const overlayScrimMotion =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0'\n\n/** The title block of a dialog-shaped panel. */\nexport const overlayHeader = 'flex flex-col gap-1.5 text-start'\n\n/** The action row of a dialog-shaped panel: stacked on a phone, trailing on a wider window. */\nexport const overlayFooter = 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end'\n\n/** The sentence under an overlay title. */\nexport const overlayDescription = 'text-muted-foreground text-sm'\n\n/** The icon-only close in a dialog or sheet's top-end corner. */\nexport const overlayCornerClose =\n 'absolute top-3.5 end-3.5 rounded-md p-1 text-muted-foreground ' +\n 'transition-colors ease-out hover:bg-surface-hover hover:text-foreground ' +\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle outline-none'\n\n/**\n * The tip: shadcn's inverted chip, foreground on background, so an explanation\n * never reads as a popover that could hold controls. The side rail draws it\n * flush to a collapsed row and every floating tooltip composes the same fill\n * and type, so a control never explains itself in two visual languages.\n */\nexport const tooltipTip = 'bg-foreground text-background rounded-md text-xs font-medium'\n\n/**\n * Entrance and exit motion, expressed as data-state classes.\n *\n * `data-expanded` / `data-closed` are the open and closed state every overlay\n * part carries (the names it had under Kobalte, kept by the overlays on top of\n * ui-sdk's `data-open`); `data-side-*` come from the positioning and let a menu\n * slide in from the edge it is anchored to,\n * which is what makes a dropdown feel attached to its trigger rather than\n * dropped on the screen. Exit motion is shorter than entry, because a\n * dismissal should feel immediate while an arrival benefits from being seen.\n */\nexport const overlayZoom =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95 ' +\n 'data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95'\n\n/** `overlayZoom` at the panel's pace: menus, dialogs. */\nexport const overlayMotion = `${overlayZoom} data-expanded:duration-200 data-closed:duration-150`\n\n/** `overlayZoom` at a hint's pace: the tooltip and the hover card. */\nexport const tooltipMotion = `${overlayZoom} data-expanded:duration-150 data-closed:duration-100`\n\n/** Popover-style motion: no zoom, so a panel anchored to a control does not\n * appear to breathe away from it. */\nexport const popoverMotion =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0 ' +\n 'data-expanded:duration-150 data-closed:duration-100'\n\n/** The popper arrow. Sized in the component; coloured here. */\nexport const popoverArrow = 'fill-popover stroke-border'\n\n/**\n * A menu row: the shared height, radius, hover fill and focus treatment for\n * every item inside a menu, listbox or command list.\n *\n * The row sizes and dims the icons a caller puts in it, but not the glyph of\n * its selection indicator (any `[data-slot$=-indicator]`): a descendant `svg`\n * rule outranks a single utility on the glyph, so without the exclusion a\n * radio item's `size-2` dot drew as a 16px muted disc and every check lost the\n * indicator's accent.\n */\nexport const menuItem =\n 'relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none ' +\n 'transition-colors ease-out ' +\n 'data-[highlighted]:bg-surface-hover data-[highlighted]:text-foreground ' +\n 'data-[disabled]:pointer-events-none data-[disabled]:text-muted-foreground ' +\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 ' +\n '[&_svg:not([data-slot$=-indicator]_*)]:size-4 ' +\n '[&_svg:not([class*=text-]):not([data-slot$=-indicator]_*)]:text-muted-foreground'\n\n/**\n * A destructive action keeps readable body text; its icon takes the status colour and the\n * highlight a destructive tint. No edge bar: the row lines up with its neighbours.\n */\nexport const destructiveMenuItem =\n 'text-foreground data-[highlighted]:bg-destructive-subtle [&_svg:not([data-slot$=-indicator]_*)]:text-destructive!'\n\n/** The label above a group of menu rows. */\nexport const menuLabel =\n 'px-2 py-1.5 text-2xs font-medium tracking-wide text-muted-foreground uppercase'\n\n/** The chord drawn at a row's trailing edge: menus and the command palette. */\nexport const menuShortcut = 'text-muted-foreground ms-auto text-xs tracking-widest'\n\n/** The rule between menu groups. */\nexport const menuSeparator = 'bg-border -mx-1 my-1 h-px'\n\n/**\n * A leading colour swatch on a menu or select row: the sanctioned way to carry\n * a card-tone colour into a list of options. The tones are the system's accent\n * and status roles, the vocabulary a Badge already speaks, so the colour an\n * option shows in a menu is the colour its badge carries on a card, and a\n * caller never passes a raw colour into a list. The dot is `aria-hidden`; the\n * label carries the meaning, so a tone is never the only signal.\n */\nexport const menuSwatchTone = cva('size-2 shrink-0 rounded-full', {\n variants: {\n tone: {\n neutral: 'bg-muted-foreground',\n primary: 'bg-primary',\n success: 'bg-success',\n warning: 'bg-warning',\n destructive: 'bg-destructive',\n info: 'bg-info',\n },\n },\n defaultVariants: { tone: 'neutral' },\n})\n\n/** The tones a menu row's swatch can take. */\nexport type MenuSwatchTone = NonNullable<VariantProps<typeof menuSwatchTone>['tone']>\n\n/** Padding shared by every menu-list surface. */\nexport const menuContentPadding = 'p-1'\n\n/**\n * Marks a floating layer, a menu, a listbox, a popover, as part of the top\n * layer.\n *\n * A modal dialog hides everything outside itself from assistive technology\n * (`aria-hidden` on its siblings) and keeps watching `<body>` for new nodes.\n * A menu or select opened from inside the dialog portals to `<body>`, so the\n * dialog hid it too: the list was on screen, focused, and invisible to a\n * screen reader, and an outside-click check could treat a click on it as a\n * click away from the dialog. Kobalte exempted nodes carrying this attribute\n * from both, so every floating layer carries it.\n *\n * ui-sdk renders popups in place in the browser's top layer and makes the page\n * behind a modal inert itself, so nothing in it reads this attribute; it stays\n * until the overlays that spread it stop doing so.\n */\nexport const topLayerProps = { 'data-kb-top-layer': '' } as const\n\n/**\n * Marks a portal mounted while another modal layer is already open as a layer\n * of its own rather than background.\n *\n * Kobalte's hide-outside observer walked body children added after its layer\n * opened and aria-hid them a frame later, so a non-modal dialog portaled in\n * during that window would land outside the accessibility tree. That observer\n * exempts added nodes carrying the React Aria spelling it ported;\n * `data-kb-top-layer` (`topLayerProps`) is only honoured by a newer layer's\n * initial walk, which must still hide this portal.\n */\nexport const lateLayerAttribute = 'data-react-aria-top-layer'\n\n/**\n * Elements the kit itself has made inert (ModalDialog's background), counted per\n * writer. The dialog layer's guard against ui-sdk clearing app-set `inert` (see\n * `guardAppInert` in dialog-layer.tsx) skips these: they are the kit's own\n * bookkeeping, which ModalDialog undoes itself, not inertness an app asked for.\n */\nconst kitInertWriters = new WeakMap<Element, number>()\n\nexport function holdKitInert(nodes: readonly Element[]): () => void {\n for (const node of nodes) kitInertWriters.set(node, (kitInertWriters.get(node) ?? 0) + 1)\n return () => {\n for (const node of nodes) {\n const count = (kitInertWriters.get(node) ?? 1) - 1\n if (count > 0) kitInertWriters.set(node, count)\n else kitInertWriters.delete(node)\n }\n }\n}\n\nexport const isKitInert = (node: Element) => kitInertWriters.has(node)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAa,aAAa,IAAI;;;AAI9B,IAAa,iBACX;;;;;;;;;;;;;;AAeF,IAAa,gBACX;;;;;AAMF,IAAa,eAAe;;AAG5B,IAAa,oBAAoB;;AAGjC,IAAa,eACX;;AAGF,IAAa,qBACX;;AAGF,IAAa,gBAAgB;;AAG7B,IAAa,gBAAgB;;AAG7B,IAAa,qBAAqB;;AAGlC,IAAa,qBACX;;;;;;;AAUF,IAAa,aAAa;;;;;;;;;;;;AAa1B,IAAa,cACX;;AAIF,IAAa,gBAAgB,GAAG,YAAY;;AAG5C,IAAa,gBAAgB,GAAG,YAAY;;;AAI5C,IAAa,gBACX;;AAIF,IAAa,eAAe;;;;;;;;;;;AAY5B,IAAa,WACX;;;;;AAYF,IAAa,sBACX;;AAGF,IAAa,YACX;;AAGF,IAAa,eAAe;;AAG5B,IAAa,gBAAgB;;;;;;;;;AAU7B,IAAa,iBAAiB,IAAI,gCAAgC;CAChE,UAAU,EACR,MAAM;EACJ,SAAS;EACT,SAAS;EACT,SAAS;EACT,SAAS;EACT,aAAa;EACb,MAAM;CACR,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;;AAMD,IAAa,qBAAqB;;;;;;;;;;;;;;;;;AAkBlC,IAAa,gBAAgB,EAAE,qBAAqB,GAAG;;;;;;;;;;;;AAavD,IAAa,qBAAqB;;;;;;;AAQlC,IAAM,kCAAkB,IAAI,QAAyB;AAErD,SAAgB,aAAa,OAAuC;CAClE,KAAK,MAAM,QAAQ,OAAO,gBAAgB,IAAI,OAAO,gBAAgB,IAAI,IAAI,KAAK,KAAK,CAAC;CACxF,aAAa;EACX,KAAK,MAAM,QAAQ,OAAO;GACxB,MAAM,SAAS,gBAAgB,IAAI,IAAI,KAAK,KAAK;GACjD,IAAI,QAAQ,GAAG,gBAAgB,IAAI,MAAM,KAAK;QACzC,gBAAgB,OAAO,IAAI;EAClC;CACF;AACF;AAEA,IAAa,cAAc,SAAkB,gBAAgB,IAAI,IAAI"}
|
|
1
|
+
{"version":3,"file":"overlay.js","names":[],"sources":["../../src/lib/overlay.ts"],"sourcesContent":["/**\n * Shared strings for the overlay layer: dialogs, sheets, menus, popovers,\n * tooltips and the command palette.\n *\n * These live here rather than in each component because the overlay family is\n * where consistency is most visible and least likely to survive duplication.\n * A dialog, a sheet and a dropdown that disagree about their border, radius,\n * motion or shadow read as three different apps, and an app that adopts this\n * library would inherit all three. Declaring the surface once is what makes\n * \"an overlay looks like this\" a fact rather than a convention.\n */\n\nimport { cva, type VariantProps } from '#lib/variants'\n\n/**\n * One CSS layout unit (1/64px), added to every side offset. ui-sdk snaps a\n * layer's position to whole device pixels after undoing the layer's entry\n * transform (`zoom-in-95`), and that undo carries float noise of about 1e-7px:\n * a layer due at an anchor edge of 75.5px lands at 75.4999997px and snaps to\n * 75px, half a pixel inside its trigger. A layout unit is far above the noise\n * and far below a pixel, so whole-pixel anchors land exactly where they did and\n * half-pixel ones round away from the anchor as intended. Remove once ui-sdk\n * rounds its untransformed origin (ui-notes/ui-sdk-issue-snap.md).\n */\nexport const SNAP_GUARD = 1 / 64\n\n/** The panel itself: fill, hairline edge, radius, elevation. Menus, popovers\n * and the command palette float on the elevated overlay rung (`--popover`). */\nexport const overlaySurface =\n 'bg-popover text-popover-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * The modal panel: the same hairline edge, radius and elevation, painted on the\n * *neutral* theme surface instead of the elevated overlay rung.\n *\n * `--popover` is the catalogue's `surfaceElevated`, whose derivation amplifies\n * the canvas hue's chroma on the elevated step. On the dark default's violet\n * canvas that makes the dialog the most chromatic surface in the ladder,\n * `oklch(0.2406 0.0088 300.91)`, red above green in sRGB, and on a full dialog\n * panel that cast reads as a warm tint the canvas never has. shadcn's own\n * convention already splits the two: a Dialog paints `bg-background`, menus and\n * popovers paint `bg-popover`. The veil, the hairline and the elevation shadow\n * carry the separation the lighter fill no longer provides.\n */\nexport const dialogSurface =\n 'bg-background text-foreground rounded-xl border border-border shadow-lg'\n\n/**\n * Overlay titles have one fixed typography role. Keep this small recipe shared\n * without loading the configurable Heading component into every dialog.\n */\nexport const overlayTitle = 'font-semibold text-base tracking-tight leading-none'\n\n/** The span of the portal wrapper that centres a dialog-like overlay. */\nexport const overlayPositioner = 'fixed inset-0 z-(--z-dialog) grid place-items-center p-4'\n\n/** The dimming layer behind a modal overlay. */\nexport const overlayScrim =\n 'fixed inset-0 z-(--z-dialog) bg-scrim/50 supports-[backdrop-filter]:backdrop-blur-xs'\n\n/** The scrim fades; it never zooms with the panel above it. */\nexport const overlayScrimMotion =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0'\n\n/** The title block of a dialog-shaped panel. */\nexport const overlayHeader = 'flex flex-col gap-1.5 text-start'\n\n/** The action row of a dialog-shaped panel: stacked on a phone, trailing on a wider window. */\nexport const overlayFooter = 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end'\n\n/** The sentence under an overlay title. */\nexport const overlayDescription = 'text-muted-foreground text-sm'\n\n/** The icon-only close in a dialog or sheet's top-end corner. */\nexport const overlayCornerClose =\n 'absolute top-3.5 end-3.5 rounded-md p-1 text-muted-foreground ' +\n 'transition-colors ease-out hover:bg-surface-hover hover:text-foreground ' +\n 'focus-visible:border-ring focus-visible:focus-outline outline-none'\n\n/**\n * The tip: shadcn's inverted chip, foreground on background, so an explanation\n * never reads as a popover that could hold controls. The side rail draws it\n * flush to a collapsed row and every floating tooltip composes the same fill\n * and type, so a control never explains itself in two visual languages.\n */\nexport const tooltipTip = 'bg-foreground text-background rounded-md text-xs font-medium'\n\n/**\n * Entrance and exit motion, expressed as data-state classes.\n *\n * `data-expanded` / `data-closed` are the open and closed state every overlay\n * part carries (the names it had under Kobalte, kept by the overlays on top of\n * ui-sdk's `data-open`); `data-side-*` come from the positioning and let a menu\n * slide in from the edge it is anchored to,\n * which is what makes a dropdown feel attached to its trigger rather than\n * dropped on the screen. Exit motion is shorter than entry, because a\n * dismissal should feel immediate while an arrival benefits from being seen.\n */\nexport const overlayZoom =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-expanded:zoom-in-95 ' +\n 'data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95'\n\n/** `overlayZoom` at the panel's pace: menus, dialogs. */\nexport const overlayMotion = `${overlayZoom} data-expanded:duration-200 data-closed:duration-150`\n\n/** `overlayZoom` at a hint's pace: the tooltip and the hover card. */\nexport const tooltipMotion = `${overlayZoom} data-expanded:duration-150 data-closed:duration-100`\n\n/** Popover-style motion: no zoom, so a panel anchored to a control does not\n * appear to breathe away from it. */\nexport const popoverMotion =\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0 ' +\n 'data-expanded:duration-150 data-closed:duration-100'\n\n/** The popper arrow. Sized in the component; coloured here. */\nexport const popoverArrow = 'fill-popover stroke-border'\n\n/**\n * A menu row: the shared height, radius, hover fill and focus treatment for\n * every item inside a menu, listbox or command list.\n *\n * The row sizes and dims the icons a caller puts in it, but not the glyph of\n * its selection indicator (any `[data-slot$=-indicator]`): a descendant `svg`\n * rule outranks a single utility on the glyph, so without the exclusion a\n * radio item's `size-2` dot drew as a 16px muted disc and every check lost the\n * indicator's accent.\n */\nexport const menuItem =\n 'relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none ' +\n 'transition-colors ease-out ' +\n 'data-[highlighted]:bg-surface-hover data-[highlighted]:text-foreground ' +\n 'data-[disabled]:pointer-events-none data-[disabled]:text-muted-foreground ' +\n '[&_svg]:pointer-events-none [&_svg]:shrink-0 ' +\n '[&_svg:not([data-slot$=-indicator]_*)]:size-4 ' +\n '[&_svg:not([class*=text-]):not([data-slot$=-indicator]_*)]:text-muted-foreground'\n\n/**\n * A destructive action keeps readable body text; its icon takes the status colour and the\n * highlight a destructive tint. No edge bar: the row lines up with its neighbours.\n */\nexport const destructiveMenuItem =\n 'text-foreground data-[highlighted]:bg-destructive-subtle [&_svg:not([data-slot$=-indicator]_*)]:text-destructive!'\n\n/** The label above a group of menu rows. */\nexport const menuLabel =\n 'px-2 py-1.5 text-2xs font-medium tracking-wide text-muted-foreground uppercase'\n\n/** The chord drawn at a row's trailing edge: menus and the command palette. */\nexport const menuShortcut = 'text-muted-foreground ms-auto text-xs tracking-widest'\n\n/** The rule between menu groups. */\nexport const menuSeparator = 'bg-border -mx-1 my-1 h-px'\n\n/**\n * A leading colour swatch on a menu or select row: the sanctioned way to carry\n * a card-tone colour into a list of options. The tones are the system's accent\n * and status roles, the vocabulary a Badge already speaks, so the colour an\n * option shows in a menu is the colour its badge carries on a card, and a\n * caller never passes a raw colour into a list. The dot is `aria-hidden`; the\n * label carries the meaning, so a tone is never the only signal.\n */\nexport const menuSwatchTone = cva('size-2 shrink-0 rounded-full', {\n variants: {\n tone: {\n neutral: 'bg-muted-foreground',\n primary: 'bg-primary',\n success: 'bg-success',\n warning: 'bg-warning',\n destructive: 'bg-destructive',\n info: 'bg-info',\n },\n },\n defaultVariants: { tone: 'neutral' },\n})\n\n/** The tones a menu row's swatch can take. */\nexport type MenuSwatchTone = NonNullable<VariantProps<typeof menuSwatchTone>['tone']>\n\n/** Padding shared by every menu-list surface. */\nexport const menuContentPadding = 'p-1'\n\n/**\n * Marks a floating layer, a menu, a listbox, a popover, as part of the top\n * layer.\n *\n * A modal dialog hides everything outside itself from assistive technology\n * (`aria-hidden` on its siblings) and keeps watching `<body>` for new nodes.\n * A menu or select opened from inside the dialog portals to `<body>`, so the\n * dialog hid it too: the list was on screen, focused, and invisible to a\n * screen reader, and an outside-click check could treat a click on it as a\n * click away from the dialog. Kobalte exempted nodes carrying this attribute\n * from both, so every floating layer carries it.\n *\n * ui-sdk renders popups in place in the browser's top layer and makes the page\n * behind a modal inert itself, so nothing in it reads this attribute; it stays\n * until the overlays that spread it stop doing so.\n */\nexport const topLayerProps = { 'data-kb-top-layer': '' } as const\n\n/**\n * Marks a portal mounted while another modal layer is already open as a layer\n * of its own rather than background.\n *\n * Kobalte's hide-outside observer walked body children added after its layer\n * opened and aria-hid them a frame later, so a non-modal dialog portaled in\n * during that window would land outside the accessibility tree. That observer\n * exempts added nodes carrying the React Aria spelling it ported;\n * `data-kb-top-layer` (`topLayerProps`) is only honoured by a newer layer's\n * initial walk, which must still hide this portal.\n */\nexport const lateLayerAttribute = 'data-react-aria-top-layer'\n\n/**\n * Elements the kit itself has made inert (ModalDialog's background), counted per\n * writer. The dialog layer's guard against ui-sdk clearing app-set `inert` (see\n * `guardAppInert` in dialog-layer.tsx) skips these: they are the kit's own\n * bookkeeping, which ModalDialog undoes itself, not inertness an app asked for.\n */\nconst kitInertWriters = new WeakMap<Element, number>()\n\nexport function holdKitInert(nodes: readonly Element[]): () => void {\n for (const node of nodes) kitInertWriters.set(node, (kitInertWriters.get(node) ?? 0) + 1)\n return () => {\n for (const node of nodes) {\n const count = (kitInertWriters.get(node) ?? 1) - 1\n if (count > 0) kitInertWriters.set(node, count)\n else kitInertWriters.delete(node)\n }\n }\n}\n\nexport const isKitInert = (node: Element) => kitInertWriters.has(node)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAa,aAAa,IAAI;;;AAI9B,IAAa,iBACX;;;;;;;;;;;;;;AAeF,IAAa,gBACX;;;;;AAMF,IAAa,eAAe;;AAG5B,IAAa,oBAAoB;;AAGjC,IAAa,eACX;;AAGF,IAAa,qBACX;;AAGF,IAAa,gBAAgB;;AAG7B,IAAa,gBAAgB;;AAG7B,IAAa,qBAAqB;;AAGlC,IAAa,qBACX;;;;;;;AAUF,IAAa,aAAa;;;;;;;;;;;;AAa1B,IAAa,cACX;;AAIF,IAAa,gBAAgB,GAAG,YAAY;;AAG5C,IAAa,gBAAgB,GAAG,YAAY;;;AAI5C,IAAa,gBACX;;AAIF,IAAa,eAAe;;;;;;;;;;;AAY5B,IAAa,WACX;;;;;AAYF,IAAa,sBACX;;AAGF,IAAa,YACX;;AAGF,IAAa,eAAe;;AAG5B,IAAa,gBAAgB;;;;;;;;;AAU7B,IAAa,iBAAiB,IAAI,gCAAgC;CAChE,UAAU,EACR,MAAM;EACJ,SAAS;EACT,SAAS;EACT,SAAS;EACT,SAAS;EACT,aAAa;EACb,MAAM;CACR,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;;AAMD,IAAa,qBAAqB;;;;;;;;;;;;;;;;;AAkBlC,IAAa,gBAAgB,EAAE,qBAAqB,GAAG;;;;;;;;;;;;AAavD,IAAa,qBAAqB;;;;;;;AAQlC,IAAM,kCAAkB,IAAI,QAAyB;AAErD,SAAgB,aAAa,OAAuC;CAClE,KAAK,MAAM,QAAQ,OAAO,gBAAgB,IAAI,OAAO,gBAAgB,IAAI,IAAI,KAAK,KAAK,CAAC;CACxF,aAAa;EACX,KAAK,MAAM,QAAQ,OAAO;GACxB,MAAM,SAAS,gBAAgB,IAAI,IAAI,KAAK,KAAK;GACjD,IAAI,QAAQ,GAAG,gBAAgB,IAAI,MAAM,KAAK;QACzC,gBAAgB,OAAO,IAAI;EAClC;CACF;AACF;AAEA,IAAa,cAAc,SAAkB,gBAAgB,IAAI,IAAI"}
|
package/dist/lib/tokens.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/lib/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,WAAW,GACX,aAAa,GACb,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,MAAM,CAAA;AAEV,MAAM,MAAM,eAAe,GAAG;IAC5B,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,SAAS,CAAA;IACf,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAA;IACnB,oEAAoE;IACpE,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/lib/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,WAAW,GACX,aAAa,GACb,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,MAAM,CAAA;AAEV,MAAM,MAAM,eAAe,GAAG;IAC5B,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,SAAS,CAAA;IACf,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAA;IACnB,oEAAoE;IACpE,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,eAAe,EAsVxC,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,eAAe,EAezC,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,eAAe,EA+I7C,CAAA;AAED;;+EAE+E;AAC/E,eAAO,MAAM,aAAa,EAAE,eAAe,EAwF1C,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,eAAe,EA2B5C,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,eAAe,EAkBzC,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,eAAe,EAyBzC,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEnE,qCAAqC;AACrC,eAAO,MAAM,YAAY;aACvB,KAAK;aACL,MAAM;aACN,UAAU;aACV,OAAO;aACP,SAAS;aACT,MAAM;aACN,MAAM;CACE,CAAA;AAEV,yDAAyD;AACzD,eAAO,MAAM,SAAS,EAAE,eAAe,EAAuC,CAAA;AAE9E;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,EAAe,CAAA"}
|
package/dist/lib/tokens.js
CHANGED
|
@@ -127,7 +127,7 @@ var colorTokens = [
|
|
|
127
127
|
name: "primary-subtle",
|
|
128
128
|
kind: "color",
|
|
129
129
|
themed: true,
|
|
130
|
-
description: "Tinted primary fill: selected rows, focus
|
|
130
|
+
description: "Tinted primary fill: selected rows, subtle buttons. Never a focus cue: it is below 3:1."
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
133
|
name: "secondary",
|
|
@@ -265,7 +265,7 @@ var colorTokens = [
|
|
|
265
265
|
name: "ring",
|
|
266
266
|
kind: "color",
|
|
267
267
|
themed: true,
|
|
268
|
-
description: "The focus
|
|
268
|
+
description: "The focus indicator, drawn by the `focus-outline` and `focus-ring` utilities as a solid 2px outline. Held to 3:1 on the canvas."
|
|
269
269
|
},
|
|
270
270
|
{
|
|
271
271
|
name: "scrim",
|