@adea-ai/ui 0.151.15 → 0.152.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/components/composites/accent-picker/accent-picker.d.ts +44 -10
  2. package/dist/components/composites/accent-picker/accent-picker.d.ts.map +1 -1
  3. package/dist/components/composites/accent-picker/accent-picker.js +155 -58
  4. package/dist/components/composites/accent-picker/accent-picker.js.map +1 -1
  5. package/dist/components/composites/accent-picker/color-math.d.ts +13 -0
  6. package/dist/components/composites/accent-picker/color-math.d.ts.map +1 -0
  7. package/dist/components/composites/accent-picker/color-math.js +61 -0
  8. package/dist/components/composites/accent-picker/color-math.js.map +1 -0
  9. package/dist/components/composites/accent-picker/custom-color-popover.d.ts +18 -0
  10. package/dist/components/composites/accent-picker/custom-color-popover.d.ts.map +1 -0
  11. package/dist/components/composites/accent-picker/custom-color-popover.js +248 -0
  12. package/dist/components/composites/accent-picker/custom-color-popover.js.map +1 -0
  13. package/dist/components/composites/accent-picker/index.d.ts +1 -1
  14. package/dist/components/composites/accent-picker/index.d.ts.map +1 -1
  15. package/dist/components/composites/accent-picker/index.js +1 -1
  16. package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
  17. package/dist/components/composites/appearance-editor/appearance-choices.js +37 -74
  18. package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
  19. package/dist/components/composites/icon-picker/icon-picker.js +1 -1
  20. package/dist/components/composites/icon-picker/icon-picker.js.map +1 -1
  21. package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
  22. package/dist/components/conversation/scroll-follow.js +14 -1
  23. package/dist/components/conversation/scroll-follow.js.map +1 -1
  24. package/dist/index.js +2 -2
  25. package/dist/r/accent-picker.json +13 -0
  26. package/dist/r/appearance-editor.json +1 -0
  27. package/dist/r/registry.json +14 -0
  28. package/dist/r/src/components/composites/accent-picker/accent-picker.tsx +154 -38
  29. package/dist/r/src/components/composites/accent-picker/color-math.ts +54 -0
  30. package/dist/r/src/components/composites/accent-picker/custom-color-popover.tsx +220 -0
  31. package/dist/r/src/components/composites/accent-picker/index.ts +6 -1
  32. package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +34 -58
  33. package/dist/r/src/components/composites/icon-picker/icon-picker.tsx +1 -1
  34. package/dist/r/src/components/conversation/scroll-follow.ts +24 -1
  35. package/package.json +1 -1
  36. package/registry.json +14 -0
  37. package/src/components/composites/accent-picker/accent-picker.tsx +154 -38
  38. package/src/components/composites/accent-picker/color-math.ts +54 -0
  39. package/src/components/composites/accent-picker/custom-color-popover.tsx +220 -0
  40. package/src/components/composites/accent-picker/index.ts +6 -1
  41. package/src/components/composites/appearance-editor/appearance-choices.tsx +34 -58
  42. package/src/components/composites/icon-picker/icon-picker.tsx +1 -1
  43. package/src/components/conversation/scroll-follow.ts +24 -1
@@ -1 +1 @@
1
- {"version":3,"file":"icon-picker.js","names":["RadioGroup","Radio","ChevronDown","ImageUp","Trash2","JSX","For","Show","createSignal","createUniqueId","splitProps","Dynamic","createLatestAction","cn","Button","Popover","PopoverContent","PopoverTrigger","MarkImageError","markImageFromFile","markImageProblemCopy","MARK_IMAGE_MAX_SOURCE_BYTES","resolveShellIcon","shellIconEntries","shellIconLabel","IconPickerProps","label","value","onValueChange","key","defaultKey","image","onImageChange","disabled","class","IconPicker","props","inputId","problem","setProblem","uploads","fileInput","setFileInput","HTMLInputElement","upload","file","File","undefined","outcome","run","status","error","_el$","_tmpl$3","_$insert","_$createComponent","when","children","_el$2","_tmpl$","_el$3","firstChild","_el$4","nextSibling","_el$5","fallback","src","_el$0","_tmpl$4","_$effect","_$setAttribute","addEventListener","event","input","currentTarget","files","_$use","type","variant","size","pending","onClick","click","_$memo","_p$","_v$","_v$2","e","t","message","_el$1","_tmpl$5","_el$6","_tmpl$2","_el$7","_el$9","_el$8","aria-label","onChange","each","entry","Icon","Item","ItemInput","ItemLabel","title","_el$10","_tmpl$6","_$className","IconPickerDropdownProps","trigger","Element","IconPickerDropdown","open","setOpen","local","picker","Current","onOpenChange","placement","as","_el$11","_tmpl$7","component","_el$12","_tmpl$8","_$mergeProps","_$createComponent","_$setAttribute","_$memo","Radio","_$className","_$mergeProps"],"sources":["../../../../src/components/composites/icon-picker/icon-picker.tsx"],"sourcesContent":["import { RadioGroup as Radio } from '@kobalte/core/radio-group'\nimport { ChevronDown, ImageUp, Trash2 } from 'lucide-solid'\nimport type { JSX } from 'solid-js'\nimport { For, Show, createSignal, createUniqueId, splitProps } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { createLatestAction } from '#lib/async-action'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover'\nimport {\n MarkImageError,\n markImageFromFile,\n markImageProblemCopy,\n MARK_IMAGE_MAX_SOURCE_BYTES,\n} from './image-data-url'\nimport { resolveShellIcon, shellIconEntries, shellIconLabel } from './shell-icons'\n\n/**\n * IconPicker.\n *\n * The control behind \"choose an icon\" for a workspace or a project: a grid of\n * curated glyphs, and optionally an uploaded picture in their place.\n *\n * It is a single-choice group. The glyph grid is a Kobalte radio group, so\n * arrow keys move the choice and Tab enters and leaves the grid as one stop,\n * which is the contract a 56-cell grid needs to stay usable from a keyboard. An\n * uploaded image is a separate state, not a 57th cell: while `image` is set no\n * glyph is checked, and choosing a glyph asks the caller to drop the image, so\n * the stored mark is never both.\n *\n * The picker does not persist anything. The caller owns `value` and `image`\n * and saves them with the rest of its form; the image arrives already resized\n * to the stored square (see `markImageFromFile`).\n */\nexport type IconPickerProps = {\n /** The group's accessible name, e.g. \"Workspace icon\". */\n label: string\n /** The checked icon key; ignored while `image` is set. */\n value: string | undefined\n onValueChange(key: string): void\n /** The key the surface treats as unset, labelled \"default\" in the grid. */\n defaultKey?: string\n /** An uploaded mark (a data URL) currently chosen in place of a glyph. */\n image?: string\n /**\n * Called with the resized upload, or `undefined` for Remove. Omit it for a\n * surface that offers glyphs only; the upload row then does not render.\n */\n onImageChange?(image: string | undefined): void\n disabled?: boolean\n class?: string\n}\n\nexport function IconPicker(props: IconPickerProps) {\n const inputId = createUniqueId()\n const [problem, setProblem] = createSignal<string>()\n const uploads = createLatestAction()\n const [fileInput, setFileInput] = createSignal<HTMLInputElement>()\n\n const upload = async (file: File | undefined) => {\n if (!file || !props.onImageChange) return\n setProblem(undefined)\n const outcome = await uploads.run(() => markImageFromFile(file))\n if (outcome.status === 'done') props.onImageChange?.(outcome.value)\n else if (outcome.status === 'failed')\n setProblem(\n markImageProblemCopy[\n outcome.error instanceof MarkImageError ? outcome.error.problem : 'unreadable'\n ]\n )\n }\n\n return (\n <div data-slot=\"icon-picker\" class={cn('flex flex-col gap-3', props.class)}>\n <Show when={props.onImageChange}>\n <div class=\"flex items-center gap-3\" data-slot=\"icon-picker-upload\">\n <span\n aria-hidden=\"true\"\n class=\"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-muted\"\n >\n <Show\n when={props.image}\n fallback={<ImageUp class=\"size-5 text-muted-foreground\" aria-hidden=\"true\" />}\n >\n {(src) => <img src={src()} alt=\"\" class=\"size-full object-cover\" />}\n </Show>\n </span>\n <div class=\"flex flex-wrap items-center gap-2\">\n <input\n ref={setFileInput}\n id={inputId}\n type=\"file\"\n class=\"sr-only\"\n tabIndex={-1}\n // The visible button drives this input; hide the duplicate from assistive\n // technology but keep a name so the form-label rule is satisfied.\n aria-hidden=\"true\"\n aria-label={props.image ? 'Replace image' : 'Upload image'}\n accept=\"image/png,image/jpeg,image/webp,image/gif\"\n disabled={props.disabled}\n onChange={(event) => {\n const input = event.currentTarget\n void upload(input.files?.[0])\n // Clearing the value lets the same file be chosen again after Remove.\n input.value = ''\n }}\n />\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n disabled={props.disabled || uploads.pending()}\n onClick={() => fileInput()?.click()}\n >\n <ImageUp aria-hidden=\"true\" />\n {props.image ? 'Replace image' : 'Upload image'}\n </Button>\n <Show when={props.image}>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={props.disabled || uploads.pending()}\n onClick={() => {\n setProblem(undefined)\n props.onImageChange?.(undefined)\n }}\n >\n <Trash2 aria-hidden=\"true\" />\n Remove image\n </Button>\n </Show>\n </div>\n </div>\n <Show when={problem()}>\n {(message) => (\n <p role=\"alert\" class=\"text-sm text-destructive\">\n {message()}\n </p>\n )}\n </Show>\n <p class=\"text-xs text-muted-foreground\">\n PNG, JPEG, WebP or GIF up to {MARK_IMAGE_MAX_SOURCE_BYTES / 1024 / 1024} MB. It is cropped\n to a square.\n </p>\n </Show>\n <Radio\n aria-label={props.label}\n value={props.image ? '' : (props.value ?? '')}\n disabled={props.disabled}\n onChange={(key) => {\n if (key) props.onValueChange(key)\n }}\n class=\"grid grid-cols-[repeat(auto-fill,minmax(2.5rem,1fr))] gap-1.5\"\n >\n <For each={shellIconEntries}>\n {(entry) => {\n const Icon = resolveShellIcon(entry.key)\n return (\n <Radio.Item value={entry.key} class=\"contents\">\n <Radio.ItemInput class=\"peer\" />\n <Radio.ItemLabel\n title={entry.key === props.defaultKey ? `${entry.label} (default)` : entry.label}\n class={cn(\n 'flex size-10 cursor-pointer items-center justify-center rounded-lg border border-border bg-card text-muted-foreground',\n 'transition-colors ease-out',\n 'hover:bg-surface-hover hover:text-foreground',\n 'peer-focus-visible:border-ring peer-focus-visible:ring-3 peer-focus-visible:ring-primary-subtle',\n 'data-[checked]:border-primary data-[checked]:bg-primary-subtle data-[checked]:text-primary',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50'\n )}\n >\n <Icon class=\"size-5\" aria-hidden=\"true\" />\n <span class=\"sr-only\">\n {entry.label}\n {entry.key === props.defaultKey ? ' (default)' : ''}\n </span>\n </Radio.ItemLabel>\n </Radio.Item>\n )\n }}\n </For>\n </Radio>\n </div>\n )\n}\n\n/**\n * IconPickerDropdown.\n *\n * The compact form of the picker for a settings row: one button showing the\n * current mark, opening the full grid (and the upload row, when the host offers\n * it) in a popover. Choosing a glyph applies it and closes the popover; an\n * upload or Remove leaves it open so the result is visible. The host owns the\n * value exactly as it does for `IconPicker`.\n */\nexport type IconPickerDropdownProps = IconPickerProps & {\n /** The mark shown on the trigger; defaults to the checked glyph or the uploaded image. */\n trigger?: JSX.Element\n}\n\nexport function IconPickerDropdown(props: IconPickerDropdownProps) {\n const [open, setOpen] = createSignal(false)\n const [local, picker] = splitProps(props, ['trigger', 'class'])\n const Current = () => resolveShellIcon(props.value ?? props.defaultKey ?? '')\n return (\n <Popover open={open()} onOpenChange={setOpen} placement=\"bottom-start\">\n <PopoverTrigger\n as={Button}\n type=\"button\"\n variant=\"outline\"\n data-slot=\"icon-picker-trigger\"\n aria-label={`${props.label}: ${props.image ? 'uploaded image' : shellIconLabel(props.value ?? props.defaultKey ?? '')}`}\n disabled={props.disabled}\n class={cn('gap-2', local.class)}\n >\n <span aria-hidden=\"true\" class=\"flex size-5 items-center justify-center overflow-hidden\">\n <Show\n when={local.trigger}\n fallback={\n <Show\n when={props.image}\n fallback={<Dynamic component={Current()} class=\"size-4\" aria-hidden=\"true\" />}\n >\n {(src) => <img src={src()} alt=\"\" class=\"size-full rounded-sm object-cover\" />}\n </Show>\n }\n >\n {local.trigger}\n </Show>\n </span>\n <ChevronDown class=\"size-4 text-muted-foreground\" aria-hidden=\"true\" />\n </PopoverTrigger>\n <PopoverContent class=\"w-[min(22rem,var(--kb-popper-available-width))]\">\n <IconPicker\n {...picker}\n onValueChange={(key) => {\n picker.onValueChange(key)\n setOpen(false)\n }}\n />\n </PopoverContent>\n </Popover>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,SAAgBmC,WAAWC,OAAwB;CACjD,MAAMC,UAAU5B,eAAe;CAC/B,MAAM,CAAC6B,SAASC,cAAc/B,aAAqB;CACnD,MAAMgC,UAAU5B,mBAAmB;CACnC,MAAM,CAAC6B,WAAWC,gBAAgBlC,aAA+B;CAEjE,MAAMoC,SAAS,OAAOC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D,MAAI;SAAA,IACHiD,OAAI;UAAA,OAAEpB,MAAML;SAAK;SAAA,IACjBkC,WAAQ;UAAA,OAAAV,gBAAG5C,SAAO;WAAA,IAACgH,YAAS;YAAA,OAAEN,QAAQ;WAAC;WAAA,SAAA;WAAA,eAAA;UAAA,CAAA;SAAA;SAAA5D,WAErCS,eAAG;UAAA,IAAA0D,SAAAC,QAAA;UAAAxD,aAAAC,aAAAsD,QAAA,OAAe1D,IAAI,CAAC,CAAA;UAAA,OAAA0D;SAAA,EAAA,CAAA;QAAqD,CAAA;OAAA;OAAA,IAAAnE,WAAA;QAAA,OAIjF0D,MAAML;OAAO;MAAA,CAAA,CAAA;MAAA,OAAAW;KAAA,EAAA,CAAA,GAAAlE,gBAGjBrD,aAAW;MAAA,SAAA;MAAA,eAAA;KAAA,CAAA,CAAA;IAAA;GAAA,CAAA,GAAAqD,gBAEbvC,gBAAc;IAAA,SAAA;IAAA,IAAAyC,WAAA;KAAA,OAAAF,gBACZpB,YAAU2F,WACLV,QAAM,EACVxF,gBAAgBC,QAAQ;MACtBuF,OAAOxF,cAAcC,GAAG;MACxBqF,QAAQ,KAAK;KACf,EAAC,CAAA,CAAA;IAAA;GAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAKX"}
1
+ {"version":3,"file":"icon-picker.js","names":["RadioGroup","Radio","ChevronDown","ImageUp","Trash2","JSX","For","Show","createSignal","createUniqueId","splitProps","Dynamic","createLatestAction","cn","Button","Popover","PopoverContent","PopoverTrigger","MarkImageError","markImageFromFile","markImageProblemCopy","MARK_IMAGE_MAX_SOURCE_BYTES","resolveShellIcon","shellIconEntries","shellIconLabel","IconPickerProps","label","value","onValueChange","key","defaultKey","image","onImageChange","disabled","class","IconPicker","props","inputId","problem","setProblem","uploads","fileInput","setFileInput","HTMLInputElement","upload","file","File","undefined","outcome","run","status","error","_el$","_tmpl$3","_$insert","_$createComponent","when","children","_el$2","_tmpl$","_el$3","firstChild","_el$4","nextSibling","_el$5","fallback","src","_el$0","_tmpl$4","_$effect","_$setAttribute","addEventListener","event","input","currentTarget","files","_$use","type","variant","size","pending","onClick","click","_$memo","_p$","_v$","_v$2","e","t","message","_el$1","_tmpl$5","_el$6","_tmpl$2","_el$7","_el$9","_el$8","aria-label","onChange","each","entry","Icon","Item","ItemInput","ItemLabel","title","_el$10","_tmpl$6","_$className","IconPickerDropdownProps","trigger","Element","IconPickerDropdown","open","setOpen","local","picker","Current","onOpenChange","placement","as","_el$11","_tmpl$7","component","_el$12","_tmpl$8","_$mergeProps","_$createComponent","_$setAttribute","_$memo","Radio","_$className","_$mergeProps"],"sources":["../../../../src/components/composites/icon-picker/icon-picker.tsx"],"sourcesContent":["import { RadioGroup as Radio } from '@kobalte/core/radio-group'\nimport { ChevronDown, ImageUp, Trash2 } from 'lucide-solid'\nimport type { JSX } from 'solid-js'\nimport { For, Show, createSignal, createUniqueId, splitProps } from 'solid-js'\nimport { Dynamic } from 'solid-js/web'\nimport { createLatestAction } from '#lib/async-action'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover'\nimport {\n MarkImageError,\n markImageFromFile,\n markImageProblemCopy,\n MARK_IMAGE_MAX_SOURCE_BYTES,\n} from './image-data-url'\nimport { resolveShellIcon, shellIconEntries, shellIconLabel } from './shell-icons'\n\n/**\n * IconPicker.\n *\n * The control behind \"choose an icon\" for a workspace or a project: a grid of\n * curated glyphs, and optionally an uploaded picture in their place.\n *\n * It is a single-choice group. The glyph grid is a Kobalte radio group, so\n * arrow keys move the choice and Tab enters and leaves the grid as one stop,\n * which is the contract a 56-cell grid needs to stay usable from a keyboard. An\n * uploaded image is a separate state, not a 57th cell: while `image` is set no\n * glyph is checked, and choosing a glyph asks the caller to drop the image, so\n * the stored mark is never both.\n *\n * The picker does not persist anything. The caller owns `value` and `image`\n * and saves them with the rest of its form; the image arrives already resized\n * to the stored square (see `markImageFromFile`).\n */\nexport type IconPickerProps = {\n /** The group's accessible name, e.g. \"Workspace icon\". */\n label: string\n /** The checked icon key; ignored while `image` is set. */\n value: string | undefined\n onValueChange(key: string): void\n /** The key the surface treats as unset, labelled \"default\" in the grid. */\n defaultKey?: string\n /** An uploaded mark (a data URL) currently chosen in place of a glyph. */\n image?: string\n /**\n * Called with the resized upload, or `undefined` for Remove. Omit it for a\n * surface that offers glyphs only; the upload row then does not render.\n */\n onImageChange?(image: string | undefined): void\n disabled?: boolean\n class?: string\n}\n\nexport function IconPicker(props: IconPickerProps) {\n const inputId = createUniqueId()\n const [problem, setProblem] = createSignal<string>()\n const uploads = createLatestAction()\n const [fileInput, setFileInput] = createSignal<HTMLInputElement>()\n\n const upload = async (file: File | undefined) => {\n if (!file || !props.onImageChange) return\n setProblem(undefined)\n const outcome = await uploads.run(() => markImageFromFile(file))\n if (outcome.status === 'done') props.onImageChange?.(outcome.value)\n else if (outcome.status === 'failed')\n setProblem(\n markImageProblemCopy[\n outcome.error instanceof MarkImageError ? outcome.error.problem : 'unreadable'\n ]\n )\n }\n\n return (\n <div data-slot=\"icon-picker\" class={cn('flex flex-col gap-3', props.class)}>\n <Show when={props.onImageChange}>\n <div class=\"flex items-center gap-3\" data-slot=\"icon-picker-upload\">\n <span\n aria-hidden=\"true\"\n class=\"flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-muted\"\n >\n <Show\n when={props.image}\n fallback={<ImageUp class=\"size-5 text-muted-foreground\" aria-hidden=\"true\" />}\n >\n {(src) => <img src={src()} alt=\"\" class=\"size-full object-cover\" />}\n </Show>\n </span>\n <div class=\"flex flex-wrap items-center gap-2\">\n <input\n ref={setFileInput}\n id={inputId}\n type=\"file\"\n class=\"sr-only\"\n tabIndex={-1}\n // The visible button drives this input; hide the duplicate from assistive\n // technology but keep a name so the form-label rule is satisfied.\n aria-hidden=\"true\"\n aria-label={props.image ? 'Replace image' : 'Upload image'}\n accept=\"image/png,image/jpeg,image/webp,image/gif\"\n disabled={props.disabled}\n onChange={(event) => {\n const input = event.currentTarget\n void upload(input.files?.[0])\n // Clearing the value lets the same file be chosen again after Remove.\n input.value = ''\n }}\n />\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n disabled={props.disabled || uploads.pending()}\n onClick={() => fileInput()?.click()}\n >\n <ImageUp aria-hidden=\"true\" />\n {props.image ? 'Replace image' : 'Upload image'}\n </Button>\n <Show when={props.image}>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={props.disabled || uploads.pending()}\n onClick={() => {\n setProblem(undefined)\n props.onImageChange?.(undefined)\n }}\n >\n <Trash2 aria-hidden=\"true\" />\n Remove image\n </Button>\n </Show>\n </div>\n </div>\n <Show when={problem()}>\n {(message) => (\n <p role=\"alert\" class=\"text-sm text-destructive\">\n {message()}\n </p>\n )}\n </Show>\n <p class=\"text-xs text-muted-foreground\">\n PNG, JPEG, WebP or GIF up to {MARK_IMAGE_MAX_SOURCE_BYTES / 1024 / 1024} MB. It is cropped\n to a square.\n </p>\n </Show>\n <Radio\n aria-label={props.label}\n value={props.image ? '' : (props.value ?? '')}\n disabled={props.disabled}\n onChange={(key) => {\n if (key) props.onValueChange(key)\n }}\n class=\"grid grid-cols-[repeat(auto-fill,minmax(2.5rem,1fr))] gap-1.5\"\n >\n <For each={shellIconEntries}>\n {(entry) => {\n const Icon = resolveShellIcon(entry.key)\n return (\n <Radio.Item value={entry.key} class=\"contents\">\n <Radio.ItemInput class=\"peer\" />\n <Radio.ItemLabel\n title={entry.key === props.defaultKey ? `${entry.label} (default)` : entry.label}\n class={cn(\n 'flex size-10 cursor-pointer items-center justify-center rounded-lg border border-border bg-card text-muted-foreground',\n 'transition-colors ease-out',\n 'hover:bg-surface-hover hover:text-foreground',\n 'peer-focus-visible:border-ring peer-focus-visible:ring-3 peer-focus-visible:ring-primary-subtle',\n 'data-[checked]:border-primary data-[checked]:bg-primary-subtle data-[checked]:text-primary',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50'\n )}\n >\n <Icon class=\"size-5\" aria-hidden=\"true\" />\n <span class=\"sr-only\">\n {entry.label}\n {entry.key === props.defaultKey ? ' (default)' : ''}\n </span>\n </Radio.ItemLabel>\n </Radio.Item>\n )\n }}\n </For>\n </Radio>\n </div>\n )\n}\n\n/**\n * IconPickerDropdown.\n *\n * The compact form of the picker for a settings row: one button showing the\n * current mark, opening the full grid (and the upload row, when the host offers\n * it) in a popover. Choosing a glyph applies it and closes the popover; an\n * upload or Remove leaves it open so the result is visible. The host owns the\n * value exactly as it does for `IconPicker`.\n */\nexport type IconPickerDropdownProps = IconPickerProps & {\n /** The mark shown on the trigger; defaults to the checked glyph or the uploaded image. */\n trigger?: JSX.Element\n}\n\nexport function IconPickerDropdown(props: IconPickerDropdownProps) {\n const [open, setOpen] = createSignal(false)\n const [local, picker] = splitProps(props, ['trigger', 'class'])\n const Current = () => resolveShellIcon(props.value ?? props.defaultKey ?? '')\n return (\n <Popover open={open()} onOpenChange={setOpen} placement=\"bottom-start\">\n <PopoverTrigger\n as={Button}\n type=\"button\"\n variant=\"outline\"\n data-slot=\"icon-picker-trigger\"\n aria-label={`${props.label}: ${props.image ? 'uploaded image' : shellIconLabel(props.value ?? props.defaultKey ?? '')}`}\n disabled={props.disabled}\n class={cn('gap-2', local.class)}\n >\n <span aria-hidden=\"true\" class=\"flex size-5 items-center justify-center overflow-hidden\">\n <Show\n when={local.trigger}\n fallback={\n <Show\n when={props.image}\n fallback={<Dynamic component={Current()} class=\"size-4\" aria-hidden=\"true\" />}\n >\n {(src) => <img src={src()} alt=\"\" class=\"size-full rounded-sm object-cover\" />}\n </Show>\n }\n >\n {local.trigger}\n </Show>\n </span>\n <ChevronDown class=\"size-4 text-muted-foreground\" aria-hidden=\"true\" />\n </PopoverTrigger>\n <PopoverContent class=\"w-88 max-w-(--kb-popper-content-available-width)\">\n <IconPicker\n {...picker}\n onValueChange={(key) => {\n picker.onValueChange(key)\n setOpen(false)\n }}\n />\n </PopoverContent>\n </Popover>\n )\n}\n"],"m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AAA;CAAE,CAAC,CAAA;AAEvF,yGAAyG;AACzG,MAAM,MAAM,gBAAgB,GAAG,MAAM,MAAM,IAAI,CAAA;AAE/C,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAC1C,OAAO,EAAE,MAAM,OAAO,CAAA;IACtB,QAAQ,EAAE,MAAM,MAAM,GAAG,SAAS,CAAA;IAClC,SAAS,EAAE,MAAM,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,MAAM,2BAA2B,GAAG,SAAS,CAAA;IAC/D,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,2BAA2B,KAAK,IAAI,CAAA;CACnE;;;;;4BAgT2B,cAAc;2BAKf,cAAc;EAIxC"}
1
+ {"version":3,"file":"scroll-follow.d.ts","sourceRoot":"","sources":["../../../src/components/conversation/scroll-follow.ts"],"names":[],"mappings":"AAkCA,sGAAsG;AACtG,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC,CAAA;AAEvF,yGAAyG;AACzG,MAAM,MAAM,gBAAgB,GAAG,MAAM,MAAM,IAAI,CAAA;AAE/C,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAC1C,OAAO,EAAE,MAAM,OAAO,CAAA;IACtB,QAAQ,EAAE,MAAM,MAAM,GAAG,SAAS,CAAA;IAClC,SAAS,EAAE,MAAM,MAAM,CAAA;IACvB,eAAe,CAAC,EAAE,MAAM,2BAA2B,GAAG,SAAS,CAAA;IAC/D,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,2BAA2B,KAAK,IAAI,CAAA;CACnE;;;;;4BAuU2B,cAAc;2BAKf,cAAc;EAIxC"}
@@ -13,6 +13,7 @@ function createScrollFollow(options) {
13
13
  let readerMovedSinceWrite = false;
14
14
  let previousTop = -1;
15
15
  let lastScrollClientHeight = 0;
16
+ let endRow = null;
16
17
  let pendingRestore;
17
18
  let pendingRestoreUserIntent = false;
18
19
  let holds = 0;
@@ -36,6 +37,7 @@ function createScrollFollow(options) {
36
37
  };
37
38
  onCleanup(reportPosition);
38
39
  const rememberPosition = (element) => {
40
+ endRow = content?.lastElementChild ?? null;
39
41
  lastWriteTop = element.scrollTop;
40
42
  lastWriteClientHeight = element.clientHeight;
41
43
  previousTop = element.scrollTop;
@@ -53,6 +55,11 @@ function createScrollFollow(options) {
53
55
  readerMovedSinceWrite
54
56
  })) rememberPosition(element);
55
57
  };
58
+ const appendedHeight = () => {
59
+ const last = content?.lastElementChild;
60
+ if (!last || !endRow || last === endRow || endRow.parentElement !== content) return 0;
61
+ return Math.max(0, last.getBoundingClientRect().bottom - endRow.getBoundingClientRect().bottom);
62
+ };
56
63
  const pinHeld = (element) => {
57
64
  const geom = scrollGeometry(element);
58
65
  stick = true;
@@ -194,7 +201,13 @@ function createScrollFollow(options) {
194
201
  contentObserver = new MutationObserver(() => {
195
202
  if (!scroller || !options.enabled() || pendingRestore || holds > 0 || !stick || readerMovedSinceWrite || lastWriteTop < 0) return;
196
203
  if (scroller.scrollTop >= lastWriteTop - 2) return;
197
- if (isAtEnd(scrollGeometry(scroller))) rememberPosition(scroller);
204
+ const geom = scrollGeometry(scroller);
205
+ if (isAtEnd(geom)) return rememberPosition(scroller);
206
+ const grown = appendedHeight();
207
+ if (grown > 0 && isAtEnd({
208
+ ...geom,
209
+ scrollHeight: geom.scrollHeight - grown
210
+ })) rememberPosition(scroller);
198
211
  });
199
212
  contentObserver.observe(content, {
200
213
  childList: true,
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-follow.js","names":["geometry"],"sources":["../../../src/components/conversation/scroll-follow.ts"],"sourcesContent":["/*\n * Substantially translated from KiroCrew website/src/app-sdk/useChatScrollFollow.ts,\n * pinned at 283e136c0f902e965a535a7c9548c57c7504fed0.\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * This product includes software developed at Amazon.com, Inc. (https://www.amazon.com/).\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy at http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software distributed\n * under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations under the License.\n * Solid owner effects replace React refs/effects; native geometry and the\n * content/viewport observer contract are retained. No session store is copied.\n */\nimport { createEffect, createSignal, onCleanup, untrack } from 'solid-js'\nimport {\n bottomTarget,\n computeAtBottom,\n isAtEnd,\n scrollGeometry as geometry,\n} from '#lib/scroll-geometry'\nimport {\n evaluateAutoPin,\n isScrollIntent,\n isScrollUpIntent,\n isSelfScroll,\n isViewportGrowthClamp,\n READER_INPUT_EVENTS,\n readerInput,\n resolveUserScrollStick,\n SELF_SCROLL_EPSILON,\n} from './scroll-follow-core'\n\n/** Where the reader is in a transcript: the native offset, and whether they are following its end. */\nexport type ConversationReadingPosition = Readonly<{ top: number; following: boolean }>\n\n/** Opens a hold on the follow position (see `createScrollFollow`); the function it returns closes it. */\nexport type ScrollFollowHold = () => () => void\n\n/** Internal plain-scroller binding; host-owned restoration can disable follow. */\nexport function createScrollFollow(options: {\n enabled: () => boolean\n resetKey: () => string | undefined\n threshold: () => number\n initialPosition?: () => ConversationReadingPosition | undefined\n onPositionChange?: (position: ConversationReadingPosition) => void\n}) {\n const [atBottom, setAtBottom] = createSignal(true)\n let scroller: HTMLDivElement | undefined\n let content: HTMLDivElement | undefined\n let stick = true\n let lastWriteTop = -1\n let lastWriteClientHeight = -1\n let readerMovedSinceWrite = false\n let previousTop = -1\n let lastScrollClientHeight = 0\n let pendingRestore: { frame: number; fromTop: number; target: number } | undefined\n let pendingRestoreUserIntent = false\n // A hold is the caller saying it is positioning the view (see `hold`): while one is\n // open and the reader was following, the content's moves are not read as the reader's.\n let holds = 0\n let holdFollowing = false\n let holdIntent = false\n let holdTop = -1\n // Bumped on every identity change, so a hold opened for the previous conversation can\n // neither pin the next one nor close over its state.\n let holdGeneration = 0\n const holding = () => holds > 0 && holdFollowing && !holdIntent\n // Is the view still where the hold left it? The content can move the offset only by\n // clamping it to the end it has now; anything else moved it from outside (a reveal, a\n // search jump), and that is the caller's to keep, so the hold gives way.\n const holdsPosition = (element: HTMLDivElement) => {\n if (!holding()) return false\n const end = bottomTarget(geometry(element))\n if (Math.abs(element.scrollTop - Math.min(holdTop, end)) <= SELF_SCROLL_EPSILON) return true\n holdIntent = true\n return false\n }\n const reportPosition = () => {\n if (scroller)\n untrack(() =>\n options.onPositionChange?.({\n top: scroller!.scrollTop,\n following: options.enabled() && stick,\n })\n )\n }\n onCleanup(reportPosition)\n\n const rememberPosition = (element: HTMLDivElement) => {\n lastWriteTop = element.scrollTop\n lastWriteClientHeight = element.clientHeight\n previousTop = element.scrollTop\n readerMovedSinceWrite = false\n }\n const writePin = (element: HTMLDivElement, target: number) => {\n // Instant writes keep the self-scroll reference synchronized. A smooth\n // animation would produce intermediate positions that resemble user input.\n element.scrollTop = target\n rememberPosition(element)\n }\n const acceptViewportClamp = (element: HTMLDivElement) => {\n if (\n stick &&\n isViewportGrowthClamp({\n geom: geometry(element),\n lastWriteTop,\n lastWriteClientHeight,\n readerMovedSinceWrite,\n })\n )\n rememberPosition(element)\n }\n const pinHeld = (element: HTMLDivElement) => {\n const geom = geometry(element)\n stick = true\n if (!isAtEnd(geom)) writePin(element, bottomTarget(geom))\n // An end the engine already clamped to is accepted as it stands, and is the reference\n // from here on: the write before it is further down than the content now reaches.\n else rememberPosition(element)\n holdTop = element.scrollTop\n setAtBottom(computeAtBottom(geometry(element), options.threshold()))\n reportPosition()\n }\n const pinAuto = () => {\n if (!scroller || !options.enabled() || pendingRestore) return\n if (holdsPosition(scroller)) return pinHeld(scroller)\n acceptViewportClamp(scroller)\n const geom = geometry(scroller)\n const result = evaluateAutoPin({\n stick,\n geom,\n lastWriteTop,\n viewportShrink: lastWriteClientHeight >= 0 ? lastWriteClientHeight - geom.clientHeight : 0,\n })\n stick = result.stick\n if (result.pin) writePin(scroller, result.target)\n else if (result.stick) rememberPosition(scroller)\n setAtBottom(computeAtBottom(geometry(scroller), options.threshold()))\n reportPosition()\n }\n const onScroll = () => {\n if (!scroller) return\n if (pendingRestore) {\n // A reset can clamp the outgoing offset while the incoming rows are\n // shorter. That notification is layout, not reader intent, and must not\n // cancel the snapshot waiting for the new rows to commit.\n const clampedFromTop = Math.min(pendingRestore.fromTop, bottomTarget(geometry(scroller)))\n if (\n pendingRestore.fromTop - clampedFromTop > 1 &&\n Math.abs(scroller.scrollTop - clampedFromTop) <= 1\n )\n return\n // An unexplained offset change can also be a browser clamp. Only actual\n // user scroll intent followed by a non-clamp movement cancels restoration.\n if (!pendingRestoreUserIntent) return\n cancelAnimationFrame(pendingRestore.frame)\n pendingRestore = undefined\n pendingRestoreUserIntent = false\n }\n if (!options.enabled()) {\n reportPosition()\n return\n }\n if (holdsPosition(scroller)) return pinHeld(scroller)\n acceptViewportClamp(scroller)\n const geom = geometry(scroller)\n setAtBottom(computeAtBottom(geom, options.threshold()))\n if (!isSelfScroll(geom.scrollTop, lastWriteTop)) {\n stick = resolveUserScrollStick({\n stick,\n scrollTop: geom.scrollTop,\n prevScrollTop: previousTop,\n geom,\n viewportGrowth: lastScrollClientHeight > 0 ? geom.clientHeight - lastScrollClientHeight : 0,\n })\n if (!stick) {\n lastWriteTop = -1\n lastWriteClientHeight = -1\n }\n }\n // A content-collapse clamp can arrive before ResizeObserver. Keep its new\n // bottom as our reference if viewport growth and more output follow next.\n if (stick && isAtEnd(geom)) rememberPosition(scroller)\n previousTop = geom.scrollTop\n // This baseline belongs only to scroll events, not observer callbacks.\n // Advancing it during resize would erase the viewport-clamp evidence.\n lastScrollClientHeight = geom.clientHeight\n reportPosition()\n }\n const jump = () => {\n if (!scroller || !options.enabled()) return\n stick = true\n writePin(scroller, bottomTarget(geometry(scroller)))\n setAtBottom(true)\n reportPosition()\n // The jump control disappears at the bottom. Return its keyboard focus to\n // the transcript instead of leaving the reader on a detached button.\n scroller.focus({ preventScroll: true })\n }\n\n // Open while the caller moves content under a reader who is following, so a clamp or an\n // insert it causes is not mistaken for the reader leaving the end. It gives way to the\n // reader's own scroll-up (`isScrollUpIntent`) and to anything else that moves the view\n // from outside (a reveal, a search jump); closing it puts a reader who is still following\n // back at the end. A change of conversation invalidates it, so the next conversation's\n // saved position is its own. A reveal or search jump outside a hold is never affected.\n const hold = () => {\n if (holds === 0) {\n holdFollowing = options.enabled() && stick && scroller !== undefined\n holdIntent = false\n holdTop = scroller ? scroller.scrollTop : -1\n }\n holds += 1\n const generation = holdGeneration\n let open = true\n return () => {\n if (!open || generation !== holdGeneration) return\n open = false\n // Asked while this hold still counts: `holdsPosition` is false once none is open.\n const last = holds === 1\n const resume = last && scroller !== undefined && holdsPosition(scroller)\n holds -= 1\n if (!last) return\n holdFollowing = false\n holdIntent = false\n if (resume && scroller && options.enabled() && !pendingRestore) pinHeld(scroller)\n }\n }\n const noteReaderInput = (event: Event) => {\n if (!scroller) return\n const input = readerInput(event, scroller)\n if (!input) return\n // Only reader intent followed by an unexplained offset change cancels a\n // pending snapshot restore; a browser clamp alone must not.\n if (pendingRestore && isScrollIntent(input)) pendingRestoreUserIntent = true\n if (isScrollUpIntent(input)) {\n readerMovedSinceWrite = true\n if (holds > 0) holdIntent = true\n }\n }\n\n createEffect(() => {\n options.resetKey()\n const enabled = options.enabled()\n // Capture before any reporting callback can replace the host snapshot.\n const candidate = untrack(() => options.initialPosition?.())\n const initial =\n candidate && Number.isFinite(candidate.top) && candidate.top >= 0 ? candidate : undefined\n let scheduledRestore: typeof pendingRestore\n let observer: ResizeObserver | undefined\n let contentObserver: MutationObserver | undefined\n onCleanup(() => {\n if (scheduledRestore) {\n cancelAnimationFrame(scheduledRestore.frame)\n if (pendingRestore === scheduledRestore) pendingRestore = undefined\n }\n pendingRestoreUserIntent = false\n observer?.disconnect()\n contentObserver?.disconnect()\n })\n stick = true\n holdGeneration += 1\n holds = 0\n holdFollowing = false\n holdIntent = false\n lastWriteTop = -1\n lastWriteClientHeight = -1\n readerMovedSinceWrite = false\n previousTop = -1\n lastScrollClientHeight = 0\n setAtBottom(true)\n if (!enabled || !scroller) return\n // Snapshot updates must not become another positioning owner. Consume the\n // host's snapshot only at entry/reset, then native reader intent owns follow.\n if (initial) {\n stick = enabled && initial.following\n }\n\n const observe = () => {\n if (!enabled || typeof ResizeObserver === 'undefined') return\n observer = new ResizeObserver(pinAuto)\n observer.observe(scroller!)\n if (content) {\n observer.observe(content)\n if (typeof MutationObserver !== 'undefined') {\n contentObserver = new MutationObserver(() => {\n // A collapsed turn can clamp the offset before any scroll/resize\n // callback. Remember that bottom at the mutation boundary, before\n // a later task grows the viewport or streams more content. This is\n // bookkeeping only: never pin, re-arm, or compete with another owner.\n if (\n !scroller ||\n !options.enabled() ||\n pendingRestore ||\n holds > 0 ||\n !stick ||\n readerMovedSinceWrite ||\n lastWriteTop < 0\n )\n return\n // Read the offset once per mutation batch. This can flush pending\n // layout, but deferring it loses a collapse clamp before a later task\n // grows the viewport/output. Ordinary growth needs no other geometry.\n if (scroller.scrollTop >= lastWriteTop - SELF_SCROLL_EPSILON) return\n if (isAtEnd(geometry(scroller))) rememberPosition(scroller)\n })\n contentObserver.observe(content, { childList: true, characterData: true, subtree: true })\n }\n }\n }\n\n if (initial && !stick) {\n // The identity effect can run before Solid has inserted the new rows. A\n // synchronous write is clamped by the outgoing short transcript, so defer\n // restoration until the browser has committed the new content and layout.\n const restore = {\n frame: 0,\n fromTop: scroller.scrollTop,\n target: initial.top,\n }\n scheduledRestore = restore\n pendingRestore = restore\n pendingRestoreUserIntent = false\n // Keep resize observation alive during the pending frame. Its callback is\n // guarded above, and remains active if user input cancels restoration.\n observe()\n restore.frame = requestAnimationFrame(() => {\n if (pendingRestore !== restore || !scroller) return\n pendingRestore = undefined\n pendingRestoreUserIntent = false\n writePin(scroller, restore.target)\n setAtBottom(computeAtBottom(geometry(scroller), options.threshold()))\n reportPosition()\n })\n return\n }\n\n if (!initial && enabled) writePin(scroller, bottomTarget(geometry(scroller)))\n else if (initial && stick) writePin(scroller, bottomTarget(geometry(scroller)))\n setAtBottom(computeAtBottom(geometry(scroller), options.threshold()))\n reportPosition()\n observe()\n })\n\n return {\n atBottom,\n onScroll,\n jump,\n hold,\n bindScroller: (element: HTMLDivElement) => {\n scroller = element\n for (const type of READER_INPUT_EVENTS)\n element.addEventListener(type, noteReaderInput, { passive: true })\n },\n bindContent: (element: HTMLDivElement) => {\n content = element\n },\n }\n}\n"],"mappings":";;;;;AAyCA,SAAgB,mBAAmB,SAMhC;CACD,MAAM,CAAC,UAAU,eAAe,aAAa,IAAI;CACjD,IAAI;CACJ,IAAI;CACJ,IAAI,QAAQ;CACZ,IAAI,eAAe;CACnB,IAAI,wBAAwB;CAC5B,IAAI,wBAAwB;CAC5B,IAAI,cAAc;CAClB,IAAI,yBAAyB;CAC7B,IAAI;CACJ,IAAI,2BAA2B;CAG/B,IAAI,QAAQ;CACZ,IAAI,gBAAgB;CACpB,IAAI,aAAa;CACjB,IAAI,UAAU;CAGd,IAAI,iBAAiB;CACrB,MAAM,gBAAgB,QAAQ,KAAK,iBAAiB,CAAC;CAIrD,MAAM,iBAAiB,YAA4B;EACjD,IAAI,CAAC,QAAQ,GAAG,OAAO;EACvB,MAAM,MAAM,aAAaA,eAAS,OAAO,CAAC;EAC1C,IAAI,KAAK,IAAI,QAAQ,YAAY,KAAK,IAAI,SAAS,GAAG,CAAC,KAAA,GAA0B,OAAO;EACxF,aAAa;EACb,OAAO;CACT;CACA,MAAM,uBAAuB;EAC3B,IAAI,UACF,cACE,QAAQ,mBAAmB;GACzB,KAAK,SAAU;GACf,WAAW,QAAQ,QAAQ,KAAK;EAClC,CAAC,CACH;CACJ;CACA,UAAU,cAAc;CAExB,MAAM,oBAAoB,YAA4B;EACpD,eAAe,QAAQ;EACvB,wBAAwB,QAAQ;EAChC,cAAc,QAAQ;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ACjB,kBACA,QAAQ,KACR,CAAC,SACD,yBACA,eAAe,GAEf;MAIF,IAAI,SAAS,aAAa,eAAA,GAAoC;MAC9D,IAAI,QAAQA,eAAS,QAAQ,CAAC,GAAG,iBAAiB,QAAQ;KAC5D,CAAC;KACD,gBAAgB,QAAQ,SAAS;MAAE,WAAW;MAAM,eAAe;MAAM,SAAS;KAAK,CAAC;IAC1F;GACF;EACF;EAEA,IAAI,WAAW,CAAC,OAAO;GAIrB,MAAM,UAAU;IACd,OAAO;IACP,SAAS,SAAS;IAClB,QAAQ,QAAQ;GAClB;GACA,mBAAmB;GACnB,iBAAiB;GACjB,2BAA2B;GAG3B,QAAQ;GACR,QAAQ,QAAQ,4BAA4B;IAC1C,IAAI,mBAAmB,WAAW,CAAC,UAAU;IAC7C,iBAAiB,KAAA;IACjB,2BAA2B;IAC3B,SAAS,UAAU,QAAQ,MAAM;IACjC,YAAY,gBAAgBA,eAAS,QAAQ,GAAG,QAAQ,UAAU,CAAC,CAAC;IACpE,eAAe;GACjB,CAAC;GACD;EACF;EAEA,IAAI,CAAC,WAAW,SAAS,SAAS,UAAU,aAAaA,eAAS,QAAQ,CAAC,CAAC;OACvE,IAAI,WAAW,OAAO,SAAS,UAAU,aAAaA,eAAS,QAAQ,CAAC,CAAC;EAC9E,YAAY,gBAAgBA,eAAS,QAAQ,GAAG,QAAQ,UAAU,CAAC,CAAC;EACpE,eAAe;EACf,QAAQ;CACV,CAAC;CAED,OAAO;EACL;EACA;EACA;EACA;EACA,eAAe,YAA4B;GACzC,WAAW;GACX,KAAK,MAAM,QAAQ,qBACjB,QAAQ,iBAAiB,MAAM,iBAAiB,EAAE,SAAS,KAAK,CAAC;EACrE;EACA,cAAc,YAA4B;GACxC,UAAU;EACZ;CACF;AACF"}
1
+ {"version":3,"file":"scroll-follow.js","names":["geometry"],"sources":["../../../src/components/conversation/scroll-follow.ts"],"sourcesContent":["/*\n * Substantially translated from KiroCrew website/src/app-sdk/useChatScrollFollow.ts,\n * pinned at 283e136c0f902e965a535a7c9548c57c7504fed0.\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * This product includes software developed at Amazon.com, Inc. (https://www.amazon.com/).\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy at http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software distributed\n * under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations under the License.\n * Solid owner effects replace React refs/effects; native geometry and the\n * content/viewport observer contract are retained. No session store is copied.\n */\nimport { createEffect, createSignal, onCleanup, untrack } from 'solid-js'\nimport {\n bottomTarget,\n computeAtBottom,\n isAtEnd,\n scrollGeometry as geometry,\n} from '#lib/scroll-geometry'\nimport {\n evaluateAutoPin,\n isScrollIntent,\n isScrollUpIntent,\n isSelfScroll,\n isViewportGrowthClamp,\n READER_INPUT_EVENTS,\n readerInput,\n resolveUserScrollStick,\n SELF_SCROLL_EPSILON,\n} from './scroll-follow-core'\n\n/** Where the reader is in a transcript: the native offset, and whether they are following its end. */\nexport type ConversationReadingPosition = Readonly<{ top: number; following: boolean }>\n\n/** Opens a hold on the follow position (see `createScrollFollow`); the function it returns closes it. */\nexport type ScrollFollowHold = () => () => void\n\n/** Internal plain-scroller binding; host-owned restoration can disable follow. */\nexport function createScrollFollow(options: {\n enabled: () => boolean\n resetKey: () => string | undefined\n threshold: () => number\n initialPosition?: () => ConversationReadingPosition | undefined\n onPositionChange?: (position: ConversationReadingPosition) => void\n}) {\n const [atBottom, setAtBottom] = createSignal(true)\n let scroller: HTMLDivElement | undefined\n let content: HTMLDivElement | undefined\n let stick = true\n let lastWriteTop = -1\n let lastWriteClientHeight = -1\n let readerMovedSinceWrite = false\n let previousTop = -1\n let lastScrollClientHeight = 0\n // The content's last row when the offset was last taken as the reader's own. Rows added\n // after it are what an append put in since.\n let endRow: Element | null = null\n let pendingRestore: { frame: number; fromTop: number; target: number } | undefined\n let pendingRestoreUserIntent = false\n // A hold is the caller saying it is positioning the view (see `hold`): while one is\n // open and the reader was following, the content's moves are not read as the reader's.\n let holds = 0\n let holdFollowing = false\n let holdIntent = false\n let holdTop = -1\n // Bumped on every identity change, so a hold opened for the previous conversation can\n // neither pin the next one nor close over its state.\n let holdGeneration = 0\n const holding = () => holds > 0 && holdFollowing && !holdIntent\n // Is the view still where the hold left it? The content can move the offset only by\n // clamping it to the end it has now; anything else moved it from outside (a reveal, a\n // search jump), and that is the caller's to keep, so the hold gives way.\n const holdsPosition = (element: HTMLDivElement) => {\n if (!holding()) return false\n const end = bottomTarget(geometry(element))\n if (Math.abs(element.scrollTop - Math.min(holdTop, end)) <= SELF_SCROLL_EPSILON) return true\n holdIntent = true\n return false\n }\n const reportPosition = () => {\n if (scroller)\n untrack(() =>\n options.onPositionChange?.({\n top: scroller!.scrollTop,\n following: options.enabled() && stick,\n })\n )\n }\n onCleanup(reportPosition)\n\n const rememberPosition = (element: HTMLDivElement) => {\n endRow = content?.lastElementChild ?? null\n lastWriteTop = element.scrollTop\n lastWriteClientHeight = element.clientHeight\n previousTop = element.scrollTop\n readerMovedSinceWrite = false\n }\n const writePin = (element: HTMLDivElement, target: number) => {\n // Instant writes keep the self-scroll reference synchronized. A smooth\n // animation would produce intermediate positions that resemble user input.\n element.scrollTop = target\n rememberPosition(element)\n }\n const acceptViewportClamp = (element: HTMLDivElement) => {\n if (\n stick &&\n isViewportGrowthClamp({\n geom: geometry(element),\n lastWriteTop,\n lastWriteClientHeight,\n readerMovedSinceWrite,\n })\n )\n rememberPosition(element)\n }\n // How much the rows appended after `endRow` add to the content's height, or 0 when the\n // content changed in any other way. A tail append never moves the offset, so taking it\n // off the height gives the end the reader had before it.\n const appendedHeight = () => {\n const last = content?.lastElementChild\n if (!last || !endRow || last === endRow || endRow.parentElement !== content) return 0\n return Math.max(0, last.getBoundingClientRect().bottom - endRow.getBoundingClientRect().bottom)\n }\n const pinHeld = (element: HTMLDivElement) => {\n const geom = geometry(element)\n stick = true\n if (!isAtEnd(geom)) writePin(element, bottomTarget(geom))\n // An end the engine already clamped to is accepted as it stands, and is the reference\n // from here on: the write before it is further down than the content now reaches.\n else rememberPosition(element)\n holdTop = element.scrollTop\n setAtBottom(computeAtBottom(geometry(element), options.threshold()))\n reportPosition()\n }\n const pinAuto = () => {\n if (!scroller || !options.enabled() || pendingRestore) return\n if (holdsPosition(scroller)) return pinHeld(scroller)\n acceptViewportClamp(scroller)\n const geom = geometry(scroller)\n const result = evaluateAutoPin({\n stick,\n geom,\n lastWriteTop,\n viewportShrink: lastWriteClientHeight >= 0 ? lastWriteClientHeight - geom.clientHeight : 0,\n })\n stick = result.stick\n if (result.pin) writePin(scroller, result.target)\n else if (result.stick) rememberPosition(scroller)\n setAtBottom(computeAtBottom(geometry(scroller), options.threshold()))\n reportPosition()\n }\n const onScroll = () => {\n if (!scroller) return\n if (pendingRestore) {\n // A reset can clamp the outgoing offset while the incoming rows are\n // shorter. That notification is layout, not reader intent, and must not\n // cancel the snapshot waiting for the new rows to commit.\n const clampedFromTop = Math.min(pendingRestore.fromTop, bottomTarget(geometry(scroller)))\n if (\n pendingRestore.fromTop - clampedFromTop > 1 &&\n Math.abs(scroller.scrollTop - clampedFromTop) <= 1\n )\n return\n // An unexplained offset change can also be a browser clamp. Only actual\n // user scroll intent followed by a non-clamp movement cancels restoration.\n if (!pendingRestoreUserIntent) return\n cancelAnimationFrame(pendingRestore.frame)\n pendingRestore = undefined\n pendingRestoreUserIntent = false\n }\n if (!options.enabled()) {\n reportPosition()\n return\n }\n if (holdsPosition(scroller)) return pinHeld(scroller)\n acceptViewportClamp(scroller)\n const geom = geometry(scroller)\n setAtBottom(computeAtBottom(geom, options.threshold()))\n if (!isSelfScroll(geom.scrollTop, lastWriteTop)) {\n stick = resolveUserScrollStick({\n stick,\n scrollTop: geom.scrollTop,\n prevScrollTop: previousTop,\n geom,\n viewportGrowth: lastScrollClientHeight > 0 ? geom.clientHeight - lastScrollClientHeight : 0,\n })\n if (!stick) {\n lastWriteTop = -1\n lastWriteClientHeight = -1\n }\n }\n // A content-collapse clamp can arrive before ResizeObserver. Keep its new\n // bottom as our reference if viewport growth and more output follow next.\n if (stick && isAtEnd(geom)) rememberPosition(scroller)\n previousTop = geom.scrollTop\n // This baseline belongs only to scroll events, not observer callbacks.\n // Advancing it during resize would erase the viewport-clamp evidence.\n lastScrollClientHeight = geom.clientHeight\n reportPosition()\n }\n const jump = () => {\n if (!scroller || !options.enabled()) return\n stick = true\n writePin(scroller, bottomTarget(geometry(scroller)))\n setAtBottom(true)\n reportPosition()\n // The jump control disappears at the bottom. Return its keyboard focus to\n // the transcript instead of leaving the reader on a detached button.\n scroller.focus({ preventScroll: true })\n }\n\n // Open while the caller moves content under a reader who is following, so a clamp or an\n // insert it causes is not mistaken for the reader leaving the end. It gives way to the\n // reader's own scroll-up (`isScrollUpIntent`) and to anything else that moves the view\n // from outside (a reveal, a search jump); closing it puts a reader who is still following\n // back at the end. A change of conversation invalidates it, so the next conversation's\n // saved position is its own. A reveal or search jump outside a hold is never affected.\n const hold = () => {\n if (holds === 0) {\n holdFollowing = options.enabled() && stick && scroller !== undefined\n holdIntent = false\n holdTop = scroller ? scroller.scrollTop : -1\n }\n holds += 1\n const generation = holdGeneration\n let open = true\n return () => {\n if (!open || generation !== holdGeneration) return\n open = false\n // Asked while this hold still counts: `holdsPosition` is false once none is open.\n const last = holds === 1\n const resume = last && scroller !== undefined && holdsPosition(scroller)\n holds -= 1\n if (!last) return\n holdFollowing = false\n holdIntent = false\n if (resume && scroller && options.enabled() && !pendingRestore) pinHeld(scroller)\n }\n }\n const noteReaderInput = (event: Event) => {\n if (!scroller) return\n const input = readerInput(event, scroller)\n if (!input) return\n // Only reader intent followed by an unexplained offset change cancels a\n // pending snapshot restore; a browser clamp alone must not.\n if (pendingRestore && isScrollIntent(input)) pendingRestoreUserIntent = true\n if (isScrollUpIntent(input)) {\n readerMovedSinceWrite = true\n if (holds > 0) holdIntent = true\n }\n }\n\n createEffect(() => {\n options.resetKey()\n const enabled = options.enabled()\n // Capture before any reporting callback can replace the host snapshot.\n const candidate = untrack(() => options.initialPosition?.())\n const initial =\n candidate && Number.isFinite(candidate.top) && candidate.top >= 0 ? candidate : undefined\n let scheduledRestore: typeof pendingRestore\n let observer: ResizeObserver | undefined\n let contentObserver: MutationObserver | undefined\n onCleanup(() => {\n if (scheduledRestore) {\n cancelAnimationFrame(scheduledRestore.frame)\n if (pendingRestore === scheduledRestore) pendingRestore = undefined\n }\n pendingRestoreUserIntent = false\n observer?.disconnect()\n contentObserver?.disconnect()\n })\n stick = true\n holdGeneration += 1\n holds = 0\n holdFollowing = false\n holdIntent = false\n lastWriteTop = -1\n lastWriteClientHeight = -1\n readerMovedSinceWrite = false\n previousTop = -1\n lastScrollClientHeight = 0\n setAtBottom(true)\n if (!enabled || !scroller) return\n // Snapshot updates must not become another positioning owner. Consume the\n // host's snapshot only at entry/reset, then native reader intent owns follow.\n if (initial) {\n stick = enabled && initial.following\n }\n\n const observe = () => {\n if (!enabled || typeof ResizeObserver === 'undefined') return\n observer = new ResizeObserver(pinAuto)\n observer.observe(scroller!)\n if (content) {\n observer.observe(content)\n if (typeof MutationObserver !== 'undefined') {\n contentObserver = new MutationObserver(() => {\n // A collapsed turn can clamp the offset before any scroll/resize\n // callback. Remember that bottom at the mutation boundary, before\n // a later task grows the viewport or streams more content. This is\n // bookkeeping only: never pin, re-arm, or compete with another owner.\n if (\n !scroller ||\n !options.enabled() ||\n pendingRestore ||\n holds > 0 ||\n !stick ||\n readerMovedSinceWrite ||\n lastWriteTop < 0\n )\n return\n // Read the offset once per mutation batch. This can flush pending\n // layout, but deferring it loses a collapse clamp before a later task\n // grows the viewport/output. Ordinary growth needs no other geometry.\n if (scroller.scrollTop >= lastWriteTop - SELF_SCROLL_EPSILON) return\n const geom = geometry(scroller)\n if (isAtEnd(geom)) return rememberPosition(scroller)\n // Rows that size themselves late can shrink the content, and a layout read\n // anywhere clamps the offset at once, while the scroll event and resize\n // callback that report it wait for the next frame. A turn appended before\n // that frame (WebKit paints late under load) leaves the offset at the end the\n // content had without the new turn, which those callbacks would then measure\n // against the grown content and take for the reader scrolling up. An offset\n // exactly at that earlier end is the clamp; a reveal lands anywhere else.\n const grown = appendedHeight()\n if (grown > 0 && isAtEnd({ ...geom, scrollHeight: geom.scrollHeight - grown }))\n rememberPosition(scroller)\n })\n contentObserver.observe(content, { childList: true, characterData: true, subtree: true })\n }\n }\n }\n\n if (initial && !stick) {\n // The identity effect can run before Solid has inserted the new rows. A\n // synchronous write is clamped by the outgoing short transcript, so defer\n // restoration until the browser has committed the new content and layout.\n const restore = {\n frame: 0,\n fromTop: scroller.scrollTop,\n target: initial.top,\n }\n scheduledRestore = restore\n pendingRestore = restore\n pendingRestoreUserIntent = false\n // Keep resize observation alive during the pending frame. Its callback is\n // guarded above, and remains active if user input cancels restoration.\n observe()\n restore.frame = requestAnimationFrame(() => {\n if (pendingRestore !== restore || !scroller) return\n pendingRestore = undefined\n pendingRestoreUserIntent = false\n writePin(scroller, restore.target)\n setAtBottom(computeAtBottom(geometry(scroller), options.threshold()))\n reportPosition()\n })\n return\n }\n\n if (!initial && enabled) writePin(scroller, bottomTarget(geometry(scroller)))\n else if (initial && stick) writePin(scroller, bottomTarget(geometry(scroller)))\n setAtBottom(computeAtBottom(geometry(scroller), options.threshold()))\n reportPosition()\n observe()\n })\n\n return {\n atBottom,\n onScroll,\n jump,\n hold,\n bindScroller: (element: HTMLDivElement) => {\n scroller = element\n for (const type of READER_INPUT_EVENTS)\n element.addEventListener(type, noteReaderInput, { passive: true })\n },\n bindContent: (element: HTMLDivElement) => {\n content = element\n },\n }\n}\n"],"mappings":";;;;;AAyCA,SAAgB,mBAAmB,SAMhC;CACD,MAAM,CAAC,UAAU,eAAe,aAAa,IAAI;CACjD,IAAI;CACJ,IAAI;CACJ,IAAI,QAAQ;CACZ,IAAI,eAAe;CACnB,IA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AAM,cAAc,KAAK,eAAe;MAAM,CAAC,GAC3E,iBAAiB,QAAQ;KAC7B,CAAC;KACD,gBAAgB,QAAQ,SAAS;MAAE,WAAW;MAAM,eAAe;MAAM,SAAS;KAAK,CAAC;IAC1F;GACF;EACF;EAEA,IAAI,WAAW,CAAC,OAAO;GAIrB,MAAM,UAAU;IACd,OAAO;IACP,SAAS,SAAS;IAClB,QAAQ,QAAQ;GAClB;GACA,mBAAmB;GACnB,iBAAiB;GACjB,2BAA2B;GAG3B,QAAQ;GACR,QAAQ,QAAQ,4BAA4B;IAC1C,IAAI,mBAAmB,WAAW,CAAC,UAAU;IAC7C,iBAAiB,KAAA;IACjB,2BAA2B;IAC3B,SAAS,UAAU,QAAQ,MAAM;IACjC,YAAY,gBAAgBA,eAAS,QAAQ,GAAG,QAAQ,UAAU,CAAC,CAAC;IACpE,eAAe;GACjB,CAAC;GACD;EACF;EAEA,IAAI,CAAC,WAAW,SAAS,SAAS,UAAU,aAAaA,eAAS,QAAQ,CAAC,CAAC;OACvE,IAAI,WAAW,OAAO,SAAS,UAAU,aAAaA,eAAS,QAAQ,CAAC,CAAC;EAC9E,YAAY,gBAAgBA,eAAS,QAAQ,GAAG,QAAQ,UAAU,CAAC,CAAC;EACpE,eAAe;EACf,QAAQ;CACV,CAAC;CAED,OAAO;EACL;EACA;EACA;EACA;EACA,eAAe,YAA4B;GACzC,WAAW;GACX,KAAK,MAAM,QAAQ,qBACjB,QAAQ,iBAAiB,MAAM,iBAAiB,EAAE,SAAS,KAAK,CAAC;EACrE;EACA,cAAc,YAA4B;GACxC,UAAU;EACZ;CACF;AACF"}
package/dist/index.js CHANGED
@@ -189,6 +189,7 @@ import { SceneControls } from "./components/composites/scene-controls/scene-cont
189
189
  import { PropertyList, PropertyRow, PropertyTerm, PropertyValue, Stat, StatGroup } from "./components/composites/stat/stat.js";
190
190
  import { PalettePreview, ThemeMiniature, ThemeMiniatureSplit } from "./components/composites/appearance-editor/theme-preview.js";
191
191
  import { SettingsRow } from "./components/composites/appearance-editor/appearance-rows.js";
192
+ import { AccentPicker, isCustomAccentValue } from "./components/composites/accent-picker/accent-picker.js";
192
193
  import { AppearanceEditor, AppearanceEditorActions, AppearancePopover } from "./components/composites/appearance-editor/appearance-editor.js";
193
194
  import { formatBytes, formatReleaseDate, plainTextFromMarkdown } from "./lib/version-notes.js";
194
195
  import { UpdateDialog } from "./components/composites/update-dialog/update-dialog.js";
@@ -202,6 +203,5 @@ import { WorkspaceReorderDialog } from "./components/composites/workspace-switch
202
203
  import { MARK_IMAGE_MAX_DATA_URL_LENGTH, MARK_IMAGE_MAX_SOURCE_BYTES, MARK_IMAGE_SIZE, MarkImageError, centredSquare, checkMarkImageFile, isMarkImageDataUrl, markImageFromFile, markImageProblemCopy } from "./components/composites/icon-picker/image-data-url.js";
203
204
  import { isShellIconKey, resolveShellIcon, shellIconEntries, shellIconLabel } from "./components/composites/icon-picker/shell-icons.js";
204
205
  import { IconPicker, IconPickerDropdown } from "./components/composites/icon-picker/icon-picker.js";
205
- import { AccentPicker } from "./components/composites/accent-picker/accent-picker.js";
206
206
  import { allTokens, colorTokens, densityTokens, designTokens, elevationTokens, motionTokens, radiusTokens, typographyTokens, undocumentedTokenAliases, zIndexTokens } from "./lib/tokens.js";
207
- export { ANSI_MAX_LINE_LENGTH, ANSI_RETAIN_LINES, APPEARANCE_EDITOR_FONT_AXES, APPEARANCE_EDITOR_FONT_SIZE_MAX, APPEARANCE_EDITOR_FONT_SIZE_MIN, AboutDialog, AccentPicker, AccentSwatchGroups, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountMenu, ActionButton, Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnnotationSurface, AppShell, AppShellBody, AppShellContent, AppShellMain, AppearanceEditor, AppearanceEditorActions, AppearanceFontSettingsGroup, AppearancePanel, AppearancePopover, SettingsRow as AppearanceSettingsRow, AspectRatio, Attachment, AttachmentCard, AttachmentList, Avatar, AvatarFallback, AvatarImage, Badge, Board, BoardCardBody, BoardCardTitle, BoardCardTrigger, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Bubble, BusySendButton, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHAIN_OF_THOUGHT_STATUS_LABELS, CODE_BLOCK_LINE_LIMIT, CalendarSurface, Callout, CalloutTitle, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CatalogBrowser, CatalogDetail, CatalogDetailSection, ChainOfThought, ChainOfThoughtResult, ChainOfThoughtResults, ChainOfThoughtStep, Chat, ChatComposer, ChatEmpty, ChatHeader, ChatNotice, Checkbox, CheckboxDescription, CheckboxLabel, Checkpoint, CodeBlock, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxClear, ComboboxContent, ComboboxControl, ComboboxInput, ComboboxItem, ComboboxSection, ComboboxTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandHint, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut, CommandStatus, ComposerAttachmentButton, ComposerHint, ComposerMenu, ComposerMenuItem, Confirmation, Context, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, ContextualSidebar, ConversationAvatar, ConversationPane, ConversationSurface, DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS, DatePicker, DetailPanel, DetailPanelBody, DetailPanelField, DetailPanelHeader, DetailPanelSection, Dialog, DialogClose, DialogCloseButton, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiffBlock, DiffSummary, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, EntityIcon, FILE_CHANGE_LABELS, FILE_TREE_AUTO_EXPAND_LIMIT, FILE_TREE_MAX_DEPTH, FILE_TREE_MAX_ROWS, FLOATING_PREVIEW_CORNER_RADIUS, FLOATING_PREVIEW_EDGE_GAP, Field, FieldDescription, FieldError, FieldGroup, FieldInput, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTextArea, FileTree, FloatingPreview, FormField, Heading, HelpCenter, HoverCard, HoverCardContent, HoverCardTrigger, IconPicker, IconPickerDropdown, InlineCitation, InlineCode, Input, InputControl, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputOtp, InputOtpCaret, Item, ItemDescription, ItemEmpty, ItemGroup, ItemGroupEntry, ItemTitle, Kbd, KbdChord, KbdGroup, Label, ListGroup, ListRow, ListRowControl, MARK_IMAGE_MAX_DATA_URL_LENGTH, MARK_IMAGE_MAX_SOURCE_BYTES, MARK_IMAGE_SIZE, MAX_LAYOUT_DEPTH, MAX_LAYOUT_LEAVES, MAX_SPLIT_RATIO, MIN_SPLIT_RATIO, MODEL_SEARCH_THRESHOLD, MarkImageError, Marker, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Message, MessageActions, MessageBody, MessageComposer, MessageContent, MessageDayDivider, MessageFooter, MessageGroup, MessageHeader, MessageRow, MessageScroller, MessageText, ModalDialog, ModelSelector, Motion, NativeSelect, NavigationMenu, NavigationMenuContent, NavigationMenuGroup, NavigationMenuGroupLabel, NavigationMenuItem, NavigationMenuMenu, NavigationMenuSeparator, NavigationMenuTrigger, NavigationMenuViewport, NumberField, OrbitItem, OrbitLayout, PASTE_THRESHOLD_CHARS, PASTE_THRESHOLD_LINES, PASTE_TOKEN_REGEX, Page, PageHeader, PageHeaderActions, PageHeaderContent, PageHeaderDescription, PageHeaderTitle, PageSection, Pagination, PaginationEllipsis, PaginationItem, PaginationNext, PaginationPrevious, PalettePreview, Panel, PanelActions, PanelBody, PanelCard, PanelDescription, PanelFooter, PanelHeader, PanelPlaceholder, PanelTitle, PanelToolbar, PixelPane, PixelResizeHandle, Plan, Popover, PopoverAnchor, PopoverCloseButton, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, Presence, Progress, PropertyList, PropertyRow, PropertyTerm, PropertyValue, Questionnaire, Queue, QueueFollowUps, REDUCED_TRANSPARENCY_QUERY, RadioGroup, RadioGroupItem, Reasoning, ResizableHandle, ResizablePanel, ResizablePanelGroup, SOURCE_SNIPPET_LIMIT, SOURCE_TITLE_LIMIT, STACK_MAX_LINES, STACK_TRACE_MAX_BLOCKS, SceneControls, ScrollArea, SecretInputGroup, Select, SelectChevronsUpDown, SelectContent, SelectItem, SelectLabel, SelectSection, SelectTrigger, SelectValue, Separator, SettingsField, SettingsLayout, SettingsNavigation, SettingsPage, SettingsRow$1 as SettingsRow, SettingsSection, Sheet, SheetBody, SheetCloseButton, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, ShellRail, ShellTopBar, SideRail, SideRailButton, SideRailContent, SideRailFooter, SideRailHeader, SideRailItem, SideRailSection, SidebarNav, SidebarNavButton, SidebarNavContent, SidebarNavFooter, SidebarNavHeader, SidebarNavItem, SidebarNavLabel, SidebarNavResizeHandle, SidebarNavRow, SidebarNavSection, SidebarNavTitle, Skeleton, SkipLink, Slider, Sources, Spinner, SplitLayout, StackTrace, Stat, StatGroup, StatusBar, StatusBarItem, StatusBarSpacer, StatusChip, StatusList, Subagent, Suggestion, Suggestions, Switch, SwitchDescription, SwitchLabel, TALL_CODE_BLOCK_PX, TASK_ITEM_STATUS_LABELS, TERMINAL_MAX_LINES, TEST_RESULTS_LIST_LIMIT, TOOL_STATUS_LABELS, TOOL_VALUE_MAX_CHARS, TRACE_STATUS_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableNumericCell, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Task, TaskItemList, TaskItemRow, Terminal, TestResults, Text, TextLink, Textarea, ThemeMiniature, ThemeMiniatureSplit, ThemeModeToggle, ThemePicker, ThemePreview, ThemeProvider, ThemeSwatch, ThemeToggle, ThreadPanel, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tool, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TopBar, TopBarBreadcrumb, TopBarPill, TopBarSearch, TopBarSection, TopBarTitle, Trace, TraceDetail, TraceError, TraceLine, TraceMark, TranscriptComposition, Tree, TreeRow, TreeRowActions, UpdateChannelControl, UpdateDialog, ValueCombobox, VirtualWindow, WORK_STATUS_LABELS, WORK_TRACE_STATUS, WorkspaceMark, WorkspaceReorderDialog, WorkspaceSwitcher, accentPresets, alertVariants, allTokens, ansi256ToColor, ansiLineText, appearancePreviewThemes, applyAppearanceFontSettings, badgeVariants, boardCardTitleVariants, boundText, breakdownRows, bubbleVariants, buildFileTree, builtinThemes, buttonVariants, calloutVariants, captureAnchor, cardVariants, centredSquare, chatNoticeVariants, checkMarkImageFile, checkpointLabel, checkpointStatus, citationLabel, citationName, clampFloatingPreviewPosition, clampSplitRatio, clampWindow, classifyFrame, closePane, cn, colorTokens, computeLayoutFrames, confirmationOutcome, contextLabel, contextLevel, contextLevelWord, contextPercent, contextShort, contrastRatio, controlInteractive, controlSize, controlSizeIcon, controlSizes, countChanges, countLeaves, countLines, createAnsiParser, createAppMenuItems, createLayoutState, createVersionedPersistence, cva, decisionReason, dedentLines, defaultDarkThemeId, defaultLightThemeId, defaultPreferenceStorage, defaultThemeSelection, densityTokens, describeChanges, describeCount, describeFrameGroup, designTokens, diffLineVariants, diffStats, diffTargetPath, editorPaletteFor, elevationTokens, entityIconVariants, expandAll, findModel, findTokenRanges, firstFailureKey, flattenFileTree, focusPane, fontOptions, fontSettingsBootstrapScript, fontZoomShortcut, formatAttachmentSize, formatBytes, formatCost, formatDuration, formatExact, formatReleaseDate, formatDuration$1 as formatTestDuration, formatToken, formatTokens, formatToolValue, frameLocation, groupModels, groupStackEntries, hasContextFigures, headingElement, headingVariants, indexFileTree, initialExpanded, initialsFrom, safeScriptStringLiteral as inlineScriptLiteral, isAwaitingAnswer, isCustomAccent, isFailedExit, isFigure, isMarkImageDataUrl, isPasteBlock, isPlainStyle, isQuestionAnswered, isShellIconKey, isThemeAccentId, itemVariants, kbdChordKeys, kbdGroupVariants, kbdVariants, keyedRows, layoutDepth, listLeaves, listedCounts, localStoragePersistence, markImageFromFile, markImageProblemCopy, markerVariants, messageCitations, modelSearchValue, monogram, motionTokens, movePane, moveTarget, moveWorkspace, nearestAnsiColor, needsSearch, neighborLeaf, nextCitationMode, nextSeq, normalizeAppearanceEditorFontSettings, normalizeAppearanceEditorFontSize, normalizeCustomAccent, normalizeEfforts, normalizeLayout, normalizePath, normalizeSurface, paintAccentRoles, parseAnsi, parseDiff, parseInline, parseMessageText, parseStackTrace, partitionQueue, placeCitationMarkers, plainTextFromMarkdown, platformModifierKey, pruneBlocks, quarantineRecord, radiusTokens, readLegacyValue, readVersionedRecord, reasoningTitle, recollapsePastes, reconcileCounts, recoveryEnvelope, recoveryKeyFor, remapCarriedBlocks, resizeFloatingPreview, resizeSplit, resolveAccentPreset, resolveAccentRoles, resolveColors, resolveEffort, resolveFloatingPreviewFrame, resolveShellIcon, resolveSurface, resolveSurfaceState, resolveVariant, resolvedDensity, restoreAnchor, restoreControl, restoreDialogCopy, revealInWindow, safeHref, safePreviewSrc, safeSourceUrl, searchShortcutKeyshortcuts, searchShortcutLabel, settleDecision, sheetVariants, shellIconEntries, shellIconLabel, shouldCollapse, sidebarNavItemClass, sidebarNavItemStateClass, sourceHost, sourceTitle, sourcesLabel, splitLocation, splitPane, splitPaneBalanced, statusDotVariants, stepAppearanceFontSizes, stepCountLabel, stripTrailingBlankLines, suiteKey, suiteState, surfaceAlpha, surfaceInteractive, swapPanes, taskProgress, taskProgressLabel, terminalCssVariables, terminalStatusLabel, testKey, textElement, textVariants, textareaVariants, themeAccentsFor, themeById, themeCssVariables, themeFamilies, themeRecordById, themeRecords, themeScript, themeSurfaces, themesForAppearance, toast, toaster, toggleVariants, tokenRangeAt, tokensAsHex, transcriptDisclosureKey, typeaheadIndex, typographyTokens, undoClosePane, undocumentedTokenAliases, useOptionalTheme, useSideRail, useTheme, validateTheme, validateThemeRegistry, variantFromRecord, withAccent, wrapIndex, writeClipboardText, writeVersionedRecord, zIndexTokens };
207
+ export { ANSI_MAX_LINE_LENGTH, ANSI_RETAIN_LINES, APPEARANCE_EDITOR_FONT_AXES, APPEARANCE_EDITOR_FONT_SIZE_MAX, APPEARANCE_EDITOR_FONT_SIZE_MIN, AboutDialog, AccentPicker, AccentSwatchGroups, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountMenu, ActionButton, Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnnotationSurface, AppShell, AppShellBody, AppShellContent, AppShellMain, AppearanceEditor, AppearanceEditorActions, AppearanceFontSettingsGroup, AppearancePanel, AppearancePopover, SettingsRow as AppearanceSettingsRow, AspectRatio, Attachment, AttachmentCard, AttachmentList, Avatar, AvatarFallback, AvatarImage, Badge, Board, BoardCardBody, BoardCardTitle, BoardCardTrigger, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Bubble, BusySendButton, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHAIN_OF_THOUGHT_STATUS_LABELS, CODE_BLOCK_LINE_LIMIT, CalendarSurface, Callout, CalloutTitle, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CatalogBrowser, CatalogDetail, CatalogDetailSection, ChainOfThought, ChainOfThoughtResult, ChainOfThoughtResults, ChainOfThoughtStep, Chat, ChatComposer, ChatEmpty, ChatHeader, ChatNotice, Checkbox, CheckboxDescription, CheckboxLabel, Checkpoint, CodeBlock, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, ComboboxClear, ComboboxContent, ComboboxControl, ComboboxInput, ComboboxItem, ComboboxSection, ComboboxTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandHint, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut, CommandStatus, ComposerAttachmentButton, ComposerHint, ComposerMenu, ComposerMenuItem, Confirmation, Context, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, ContextualSidebar, ConversationAvatar, ConversationPane, ConversationSurface, DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS, DatePicker, DetailPanel, DetailPanelBody, DetailPanelField, DetailPanelHeader, DetailPanelSection, Dialog, DialogClose, DialogCloseButton, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiffBlock, DiffSummary, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, EntityIcon, FILE_CHANGE_LABELS, FILE_TREE_AUTO_EXPAND_LIMIT, FILE_TREE_MAX_DEPTH, FILE_TREE_MAX_ROWS, FLOATING_PREVIEW_CORNER_RADIUS, FLOATING_PREVIEW_EDGE_GAP, Field, FieldDescription, FieldError, FieldGroup, FieldInput, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTextArea, FileTree, FloatingPreview, FormField, Heading, HelpCenter, HoverCard, HoverCardContent, HoverCardTrigger, IconPicker, IconPickerDropdown, InlineCitation, InlineCode, Input, InputControl, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputOtp, InputOtpCaret, Item, ItemDescription, ItemEmpty, ItemGroup, ItemGroupEntry, ItemTitle, Kbd, KbdChord, KbdGroup, Label, ListGroup, ListRow, ListRowControl, MARK_IMAGE_MAX_DATA_URL_LENGTH, MARK_IMAGE_MAX_SOURCE_BYTES, MARK_IMAGE_SIZE, MAX_LAYOUT_DEPTH, MAX_LAYOUT_LEAVES, MAX_SPLIT_RATIO, MIN_SPLIT_RATIO, MODEL_SEARCH_THRESHOLD, MarkImageError, Marker, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Message, MessageActions, MessageBody, MessageComposer, MessageContent, MessageDayDivider, MessageFooter, MessageGroup, MessageHeader, MessageRow, MessageScroller, MessageText, ModalDialog, ModelSelector, Motion, NativeSelect, NavigationMenu, NavigationMenuContent, NavigationMenuGroup, NavigationMenuGroupLabel, NavigationMenuItem, NavigationMenuMenu, NavigationMenuSeparator, NavigationMenuTrigger, NavigationMenuViewport, NumberField, OrbitItem, OrbitLayout, PASTE_THRESHOLD_CHARS, PASTE_THRESHOLD_LINES, PASTE_TOKEN_REGEX, Page, PageHeader, PageHeaderActions, PageHeaderContent, PageHeaderDescription, PageHeaderTitle, PageSection, Pagination, PaginationEllipsis, PaginationItem, PaginationNext, PaginationPrevious, PalettePreview, Panel, PanelActions, PanelBody, PanelCard, PanelDescription, PanelFooter, PanelHeader, PanelPlaceholder, PanelTitle, PanelToolbar, PixelPane, PixelResizeHandle, Plan, Popover, PopoverAnchor, PopoverCloseButton, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, Presence, Progress, PropertyList, PropertyRow, PropertyTerm, PropertyValue, Questionnaire, Queue, QueueFollowUps, REDUCED_TRANSPARENCY_QUERY, RadioGroup, RadioGroupItem, Reasoning, ResizableHandle, ResizablePanel, ResizablePanelGroup, SOURCE_SNIPPET_LIMIT, SOURCE_TITLE_LIMIT, STACK_MAX_LINES, STACK_TRACE_MAX_BLOCKS, SceneControls, ScrollArea, SecretInputGroup, Select, SelectChevronsUpDown, SelectContent, SelectItem, SelectLabel, SelectSection, SelectTrigger, SelectValue, Separator, SettingsField, SettingsLayout, SettingsNavigation, SettingsPage, SettingsRow$1 as SettingsRow, SettingsSection, Sheet, SheetBody, SheetCloseButton, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, ShellRail, ShellTopBar, SideRail, SideRailButton, SideRailContent, SideRailFooter, SideRailHeader, SideRailItem, SideRailSection, SidebarNav, SidebarNavButton, SidebarNavContent, SidebarNavFooter, SidebarNavHeader, SidebarNavItem, SidebarNavLabel, SidebarNavResizeHandle, SidebarNavRow, SidebarNavSection, SidebarNavTitle, Skeleton, SkipLink, Slider, Sources, Spinner, SplitLayout, StackTrace, Stat, StatGroup, StatusBar, StatusBarItem, StatusBarSpacer, StatusChip, StatusList, Subagent, Suggestion, Suggestions, Switch, SwitchDescription, SwitchLabel, TALL_CODE_BLOCK_PX, TASK_ITEM_STATUS_LABELS, TERMINAL_MAX_LINES, TEST_RESULTS_LIST_LIMIT, TOOL_STATUS_LABELS, TOOL_VALUE_MAX_CHARS, TRACE_STATUS_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableNumericCell, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Task, TaskItemList, TaskItemRow, Terminal, TestResults, Text, TextLink, Textarea, ThemeMiniature, ThemeMiniatureSplit, ThemeModeToggle, ThemePicker, ThemePreview, ThemeProvider, ThemeSwatch, ThemeToggle, ThreadPanel, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tool, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TopBar, TopBarBreadcrumb, TopBarPill, TopBarSearch, TopBarSection, TopBarTitle, Trace, TraceDetail, TraceError, TraceLine, TraceMark, TranscriptComposition, Tree, TreeRow, TreeRowActions, UpdateChannelControl, UpdateDialog, ValueCombobox, VirtualWindow, WORK_STATUS_LABELS, WORK_TRACE_STATUS, WorkspaceMark, WorkspaceReorderDialog, WorkspaceSwitcher, accentPresets, alertVariants, allTokens, ansi256ToColor, ansiLineText, appearancePreviewThemes, applyAppearanceFontSettings, badgeVariants, boardCardTitleVariants, boundText, breakdownRows, bubbleVariants, buildFileTree, builtinThemes, buttonVariants, calloutVariants, captureAnchor, cardVariants, centredSquare, chatNoticeVariants, checkMarkImageFile, checkpointLabel, checkpointStatus, citationLabel, citationName, clampFloatingPreviewPosition, clampSplitRatio, clampWindow, classifyFrame, closePane, cn, colorTokens, computeLayoutFrames, confirmationOutcome, contextLabel, contextLevel, contextLevelWord, contextPercent, contextShort, contrastRatio, controlInteractive, controlSize, controlSizeIcon, controlSizes, countChanges, countLeaves, countLines, createAnsiParser, createAppMenuItems, createLayoutState, createVersionedPersistence, cva, decisionReason, dedentLines, defaultDarkThemeId, defaultLightThemeId, defaultPreferenceStorage, defaultThemeSelection, densityTokens, describeChanges, describeCount, describeFrameGroup, designTokens, diffLineVariants, diffStats, diffTargetPath, editorPaletteFor, elevationTokens, entityIconVariants, expandAll, findModel, findTokenRanges, firstFailureKey, flattenFileTree, focusPane, fontOptions, fontSettingsBootstrapScript, fontZoomShortcut, formatAttachmentSize, formatBytes, formatCost, formatDuration, formatExact, formatReleaseDate, formatDuration$1 as formatTestDuration, formatToken, formatTokens, formatToolValue, frameLocation, groupModels, groupStackEntries, hasContextFigures, headingElement, headingVariants, indexFileTree, initialExpanded, initialsFrom, safeScriptStringLiteral as inlineScriptLiteral, isAwaitingAnswer, isCustomAccent, isCustomAccentValue, isFailedExit, isFigure, isMarkImageDataUrl, isPasteBlock, isPlainStyle, isQuestionAnswered, isShellIconKey, isThemeAccentId, itemVariants, kbdChordKeys, kbdGroupVariants, kbdVariants, keyedRows, layoutDepth, listLeaves, listedCounts, localStoragePersistence, markImageFromFile, markImageProblemCopy, markerVariants, messageCitations, modelSearchValue, monogram, motionTokens, movePane, moveTarget, moveWorkspace, nearestAnsiColor, needsSearch, neighborLeaf, nextCitationMode, nextSeq, normalizeAppearanceEditorFontSettings, normalizeAppearanceEditorFontSize, normalizeCustomAccent, normalizeEfforts, normalizeLayout, normalizePath, normalizeSurface, paintAccentRoles, parseAnsi, parseDiff, parseInline, parseMessageText, parseStackTrace, partitionQueue, placeCitationMarkers, plainTextFromMarkdown, platformModifierKey, pruneBlocks, quarantineRecord, radiusTokens, readLegacyValue, readVersionedRecord, reasoningTitle, recollapsePastes, reconcileCounts, recoveryEnvelope, recoveryKeyFor, remapCarriedBlocks, resizeFloatingPreview, resizeSplit, resolveAccentPreset, resolveAccentRoles, resolveColors, resolveEffort, resolveFloatingPreviewFrame, resolveShellIcon, resolveSurface, resolveSurfaceState, resolveVariant, resolvedDensity, restoreAnchor, restoreControl, restoreDialogCopy, revealInWindow, safeHref, safePreviewSrc, safeSourceUrl, searchShortcutKeyshortcuts, searchShortcutLabel, settleDecision, sheetVariants, shellIconEntries, shellIconLabel, shouldCollapse, sidebarNavItemClass, sidebarNavItemStateClass, sourceHost, sourceTitle, sourcesLabel, splitLocation, splitPane, splitPaneBalanced, statusDotVariants, stepAppearanceFontSizes, stepCountLabel, stripTrailingBlankLines, suiteKey, suiteState, surfaceAlpha, surfaceInteractive, swapPanes, taskProgress, taskProgressLabel, terminalCssVariables, terminalStatusLabel, testKey, textElement, textVariants, textareaVariants, themeAccentsFor, themeById, themeCssVariables, themeFamilies, themeRecordById, themeRecords, themeScript, themeSurfaces, themesForAppearance, toast, toaster, toggleVariants, tokenRangeAt, tokensAsHex, transcriptDisclosureKey, typeaheadIndex, typographyTokens, undoClosePane, undocumentedTokenAliases, useOptionalTheme, useSideRail, useTheme, validateTheme, validateThemeRegistry, variantFromRecord, withAccent, wrapIndex, writeClipboardText, writeVersionedRecord, zIndexTokens };
@@ -7,6 +7,9 @@
7
7
  "@kobalte/core@^0.13.14"
8
8
  ],
9
9
  "registryDependencies": [
10
+ "@adea-ai/ui/button",
11
+ "@adea-ai/ui/input",
12
+ "@adea-ai/ui/popover",
10
13
  "@adea-ai/ui/tooltip",
11
14
  "lib"
12
15
  ],
@@ -16,6 +19,16 @@
16
19
  "type": "registry:ui",
17
20
  "target": "components/composites/accent-picker/accent-picker.tsx"
18
21
  },
22
+ {
23
+ "path": "src/components/composites/accent-picker/color-math.ts",
24
+ "type": "registry:ui",
25
+ "target": "components/composites/accent-picker/color-math.ts"
26
+ },
27
+ {
28
+ "path": "src/components/composites/accent-picker/custom-color-popover.tsx",
29
+ "type": "registry:ui",
30
+ "target": "components/composites/accent-picker/custom-color-popover.tsx"
31
+ },
19
32
  {
20
33
  "path": "src/components/composites/accent-picker/index.ts",
21
34
  "type": "registry:ui",
@@ -9,6 +9,7 @@
9
9
  "lucide-solid@^1.65.0"
10
10
  ],
11
11
  "registryDependencies": [
12
+ "@adea-ai/ui/accent-picker",
12
13
  "@adea-ai/ui/action-button",
13
14
  "@adea-ai/ui/button",
14
15
  "@adea-ai/ui/dropdown-menu",
@@ -2248,6 +2248,9 @@
2248
2248
  "@kobalte/core@^0.13.14"
2249
2249
  ],
2250
2250
  "registryDependencies": [
2251
+ "@adea-ai/ui/button",
2252
+ "@adea-ai/ui/input",
2253
+ "@adea-ai/ui/popover",
2251
2254
  "@adea-ai/ui/tooltip",
2252
2255
  "lib"
2253
2256
  ],
@@ -2257,6 +2260,16 @@
2257
2260
  "type": "registry:ui",
2258
2261
  "target": "components/composites/accent-picker/accent-picker.tsx"
2259
2262
  },
2263
+ {
2264
+ "path": "src/components/composites/accent-picker/color-math.ts",
2265
+ "type": "registry:ui",
2266
+ "target": "components/composites/accent-picker/color-math.ts"
2267
+ },
2268
+ {
2269
+ "path": "src/components/composites/accent-picker/custom-color-popover.tsx",
2270
+ "type": "registry:ui",
2271
+ "target": "components/composites/accent-picker/custom-color-popover.tsx"
2272
+ },
2260
2273
  {
2261
2274
  "path": "src/components/composites/accent-picker/index.ts",
2262
2275
  "type": "registry:ui",
@@ -2328,6 +2341,7 @@
2328
2341
  "lucide-solid@^1.65.0"
2329
2342
  ],
2330
2343
  "registryDependencies": [
2344
+ "@adea-ai/ui/accent-picker",
2331
2345
  "@adea-ai/ui/action-button",
2332
2346
  "@adea-ai/ui/button",
2333
2347
  "@adea-ai/ui/dropdown-menu",
@@ -1,66 +1,177 @@
1
1
  import { RadioGroup as Radio } from '@kobalte/core/radio-group'
2
2
  import type { JSX } from 'solid-js'
3
- import { For } from 'solid-js'
3
+ import { For, Show } from 'solid-js'
4
4
  import { accents } from '../../../lib/accent-presets'
5
5
  import { cn } from '../../../lib/utils'
6
+ import { Input } from '../../ui/input'
6
7
  import { Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip'
8
+ import { CustomColorPopover } from './custom-color-popover'
7
9
 
8
10
  /**
9
11
  * AccentPicker.
10
12
  *
11
- * A row of accent swatches with a leading "none" choice, for a setting that
12
- * overrides the accent it would otherwise inherit: a project's icon colour, a
13
- * workspace's colour over the app's. `null` is a real value, not an empty one:
14
- * it means "do not override", so the swatch row never has an unchecked state and
15
- * the control can say what the inherited colour is through `inheritLabel`.
13
+ * The one accent control every level of the app uses: the app's own appearance,
14
+ * a workspace's accent over the app's, a project's icon colour over its
15
+ * workspace's. It is a row of preset swatches, optionally led by an "inherit"
16
+ * swatch and followed by a Custom button that opens a colour picker anchored
17
+ * under it.
16
18
  *
17
- * The swatches are the theme's own accent presets, each carrying its light and
18
- * dark colour and switching on the `dark` class, so a swatch is the colour the
19
- * setting will produce in whichever appearance is in force and the picker needs
20
- * no theme provider.
19
+ * - `null` is a real value, not an empty one: it means "do not override", so
20
+ * with `inherit` on the swatch row never has an unchecked state and the
21
+ * control can say what the inherited colour is through `inheritLabel`.
22
+ * - A custom colour is a lowercase `#rrggbb`. While one is set no swatch is
23
+ * checked; the Custom button reads pressed and shows the colour. Opening the
24
+ * picker changes nothing until Apply.
25
+ *
26
+ * Swatches paint each preset's light and dark colour on the `dark` class, so a
27
+ * swatch is the colour the setting produces in whichever appearance is in
28
+ * force and the picker needs no theme provider. A host previewing a different
29
+ * appearance (the appearance editor's draft) pins the side with `appearance`.
21
30
  */
31
+ export type AccentPickerOption = Readonly<{
32
+ id: string
33
+ label: string
34
+ light?: string
35
+ dark?: string
36
+ }>
37
+
22
38
  export type AccentPickerProps = {
23
39
  /** The group's accessible name, e.g. "Icon colour". */
24
40
  label: string
25
- /** An accent preset id, or `null` for no override. */
41
+ /** A preset id, a custom `#rrggbb`, or `null` for no override. */
26
42
  value: string | null
27
43
  onValueChange(value: string | null): void
44
+ /**
45
+ * Whether the row leads with the "inherit" swatch (`null`). On by default;
46
+ * the app's own appearance, which has nothing above it, turns it off.
47
+ */
48
+ inherit?: boolean
28
49
  /** What `null` means here, e.g. "Inherit workspace accent". Also the first swatch's name and tooltip. */
29
50
  inheritLabel?: string
51
+ /** The swatches after the inherit one. Defaults to the six brand presets. */
52
+ options?: readonly AccentPickerOption[]
53
+ /** Whether the Custom button follows the swatches. On by default. */
54
+ custom?: boolean
55
+ /** The colour the Custom picker starts on while no custom colour is set. */
56
+ customSeed?: string
57
+ /** Pins the swatches to one side of each preset pair instead of following the `dark` class. */
58
+ appearance?: 'light' | 'dark'
59
+ /**
60
+ * `wrap` (the default) wraps at the container's edge. `row` keeps every
61
+ * swatch on one line at a smaller size, sharing the width equally, so a
62
+ * narrow panel does not wrap them.
63
+ */
64
+ layout?: 'wrap' | 'row'
30
65
  disabled?: boolean
31
66
  class?: string
32
67
  }
33
68
 
34
69
  const NONE = '__none__'
70
+ const CUSTOM = '__custom__'
71
+ const HEX = /^#[0-9a-f]{6}$/i
72
+ const DEFAULT_CUSTOM_SEED = '#7c3aed'
73
+
74
+ /** Whether a stored accent is a custom `#rrggbb` colour rather than a preset id or `null`. */
75
+ export function isCustomAccentValue(value: string | null | undefined): value is `#${string}` {
76
+ return typeof value === 'string' && HEX.test(value)
77
+ }
35
78
 
36
79
  export function AccentPicker(props: AccentPickerProps) {
80
+ const customValue = () =>
81
+ isCustomAccentValue(props.value) ? props.value.toLowerCase() : undefined
82
+ const inherit = () => props.inherit ?? true
83
+ const row = () => props.layout === 'row'
84
+ const radioValue = () => (customValue() ? CUSTOM : (props.value ?? NONE))
85
+
86
+ // The native colour field stays in the tree, visually hidden, as the
87
+ // control assistive technology and automation can set directly; people use
88
+ // the anchored picker behind the Custom button.
89
+ const commitCustom = (raw: string) => {
90
+ const value = raw.trim().toLowerCase()
91
+ // Only `#rrggbb` is stored; anything else is ignored rather than saved.
92
+ if (HEX.test(value) && value !== customValue()) props.onValueChange(value)
93
+ }
94
+
37
95
  return (
38
- <Radio
39
- data-slot="swatch-picker"
40
- aria-label={props.label}
41
- value={props.value ?? NONE}
42
- disabled={props.disabled}
43
- onChange={(id) => props.onValueChange(id === NONE ? null : id)}
44
- class={cn('flex flex-wrap items-center gap-2', props.class)}
96
+ <div
97
+ data-slot="swatch-row"
98
+ data-accent-choices
99
+ class={cn('flex min-w-0 items-center gap-2', row() ? 'w-full' : 'flex-wrap', props.class)}
45
100
  >
46
- <SwatchItem id={NONE} label={props.inheritLabel ?? 'Inherit (default)'}>
47
- <InheritSwatch />
48
- </SwatchItem>
49
- <For each={accents}>
50
- {(accent) => (
51
- <SwatchItem id={accent.id} label={accent.label}>
52
- <span
53
- aria-hidden="true"
54
- class="block size-full rounded-full bg-(--swatch-light) dark:bg-(--swatch-dark)"
55
- style={{
56
- '--swatch-light': accent.light ?? 'currentColor',
57
- '--swatch-dark': accent.dark ?? accent.light ?? 'currentColor',
58
- }}
59
- />
60
- </SwatchItem>
101
+ <Radio
102
+ data-slot="swatch-picker"
103
+ aria-label={props.label}
104
+ orientation="horizontal"
105
+ value={radioValue()}
106
+ disabled={props.disabled}
107
+ onChange={(id) => {
108
+ if (id === CUSTOM) return
109
+ props.onValueChange(id === NONE ? null : id)
110
+ }}
111
+ class={cn(
112
+ row()
113
+ ? 'grid min-w-0 flex-1 auto-cols-fr grid-flow-col'
114
+ : 'flex flex-wrap items-center gap-2'
61
115
  )}
62
- </For>
63
- </Radio>
116
+ >
117
+ <Show when={inherit()}>
118
+ <SwatchItem id={NONE} label={props.inheritLabel ?? 'Inherit (default)'} row={row()}>
119
+ <InheritSwatch />
120
+ </SwatchItem>
121
+ </Show>
122
+ <For each={props.options ?? accents}>
123
+ {(option) => {
124
+ const light = () => option.light ?? ''
125
+ const dark = () => option.dark ?? option.light ?? ''
126
+ return (
127
+ <SwatchItem id={option.id} label={option.label} row={row()}>
128
+ <svg class="size-full" viewBox="0 0 16 16" aria-hidden="true">
129
+ <Show
130
+ when={props.appearance}
131
+ fallback={
132
+ <circle
133
+ cx="8"
134
+ cy="8"
135
+ r="8"
136
+ class="fill-(--swatch-light) dark:fill-(--swatch-dark)"
137
+ style={{ '--swatch-light': light(), '--swatch-dark': dark() }}
138
+ />
139
+ }
140
+ >
141
+ {(appearance) => (
142
+ <circle
143
+ cx="8"
144
+ cy="8"
145
+ r="8"
146
+ fill={appearance() === 'light' ? light() : dark()}
147
+ />
148
+ )}
149
+ </Show>
150
+ </svg>
151
+ </SwatchItem>
152
+ )
153
+ }}
154
+ </For>
155
+ </Radio>
156
+ <Show when={props.custom ?? true}>
157
+ <CustomColorPopover
158
+ value={customValue()}
159
+ seed={props.customSeed ?? DEFAULT_CUSTOM_SEED}
160
+ disabled={props.disabled}
161
+ onCommit={commitCustom}
162
+ />
163
+ <Input
164
+ type="color"
165
+ // `w-px` beats the Input's own `w-full` and keeps the hidden field from sizing a narrow panel's scroll width.
166
+ class="sr-only w-px"
167
+ tabIndex={-1}
168
+ aria-label="Custom accent color"
169
+ value={customValue() ?? props.customSeed ?? DEFAULT_CUSTOM_SEED}
170
+ disabled={props.disabled}
171
+ onChange={(event) => commitCustom(event.currentTarget.value)}
172
+ />
173
+ </Show>
174
+ </div>
64
175
  )
65
176
  }
66
177
 
@@ -82,15 +193,20 @@ function InheritSwatch() {
82
193
  )
83
194
  }
84
195
 
85
- function SwatchItem(props: { id: string; label: string; children: JSX.Element }) {
196
+ function SwatchItem(props: { id: string; label: string; row: boolean; children: JSX.Element }) {
86
197
  return (
87
- <Radio.Item value={props.id} data-accent-option={props.id} class="contents">
198
+ <Radio.Item
199
+ value={props.id}
200
+ data-accent-option={props.id}
201
+ class={props.row ? 'flex justify-center' : 'contents'}
202
+ >
88
203
  <Radio.ItemInput class="peer" />
89
204
  <Tooltip>
90
205
  <TooltipTrigger
91
206
  as={Radio.ItemLabel}
92
207
  class={cn(
93
- 'flex size-7 cursor-pointer items-center justify-center rounded-full border border-border p-0.5',
208
+ 'flex cursor-pointer items-center justify-center rounded-full border border-border p-0.5',
209
+ props.row ? 'size-6' : 'size-7',
94
210
  'peer-focus-visible:border-ring peer-focus-visible:ring-3 peer-focus-visible:ring-primary-subtle',
95
211
  'data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary',
96
212
  'data-[disabled]:pointer-events-none data-[disabled]:opacity-50'