@adea-ai/ui 0.155.0 → 0.156.0

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 (93) hide show
  1. package/dist/NOTICE +27 -0
  2. package/dist/components/composites/model-selector/model-selector.js +45 -53
  3. package/dist/components/composites/model-selector/model-selector.js.map +1 -1
  4. package/dist/components/composites/prompt-input/index.d.ts +2 -0
  5. package/dist/components/composites/prompt-input/index.d.ts.map +1 -0
  6. package/dist/components/composites/prompt-input/index.js +1 -0
  7. package/dist/components/composites/prompt-input/prompt-input.d.ts +71 -0
  8. package/dist/components/composites/prompt-input/prompt-input.d.ts.map +1 -0
  9. package/dist/components/composites/prompt-input/prompt-input.js +247 -0
  10. package/dist/components/composites/prompt-input/prompt-input.js.map +1 -0
  11. package/dist/components/conversation/chat-composer.d.ts.map +1 -1
  12. package/dist/components/conversation/chat-composer.js +43 -29
  13. package/dist/components/conversation/chat-composer.js.map +1 -1
  14. package/dist/components/conversation/internal/chat-composer-shell.d.ts.map +1 -1
  15. package/dist/components/conversation/internal/chat-composer-shell.js +155 -163
  16. package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
  17. package/dist/components/conversation/message-composer.d.ts.map +1 -1
  18. package/dist/components/conversation/message-composer.js +186 -192
  19. package/dist/components/conversation/message-composer.js.map +1 -1
  20. package/dist/components/conversation/paste-token-editor.js +2 -2
  21. package/dist/components/conversation/paste-token-editor.js.map +1 -1
  22. package/dist/components/theme/theme-provider-value.d.ts.map +1 -1
  23. package/dist/components/theme/theme-provider-value.js +9 -1
  24. package/dist/components/theme/theme-provider-value.js.map +1 -1
  25. package/dist/components/ui/badge/badge.js +1 -1
  26. package/dist/components/ui/badge/badge.js.map +1 -1
  27. package/dist/components/ui/input-group/index.d.ts +1 -1
  28. package/dist/components/ui/input-group/index.d.ts.map +1 -1
  29. package/dist/components/ui/input-group/index.js +2 -2
  30. package/dist/components/ui/input-group/input-group.d.ts +34 -9
  31. package/dist/components/ui/input-group/input-group.d.ts.map +1 -1
  32. package/dist/components/ui/input-group/input-group.js +101 -28
  33. package/dist/components/ui/input-group/input-group.js.map +1 -1
  34. package/dist/components/ui/kbd/kbd.d.ts.map +1 -1
  35. package/dist/components/ui/kbd/kbd.js +6 -1
  36. package/dist/components/ui/kbd/kbd.js.map +1 -1
  37. package/dist/components/ui/message/index.d.ts +1 -1
  38. package/dist/components/ui/message/index.d.ts.map +1 -1
  39. package/dist/components/ui/message/index.js +2 -2
  40. package/dist/components/ui/message/message.d.ts +16 -0
  41. package/dist/components/ui/message/message.d.ts.map +1 -1
  42. package/dist/components/ui/message/message.js +52 -1
  43. package/dist/components/ui/message/message.js.map +1 -1
  44. package/dist/components/ui/tooltip/tooltip.js +1 -1
  45. package/dist/components/ui/tooltip/tooltip.js.map +1 -1
  46. package/dist/index.d.ts +1 -0
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +4 -3
  49. package/dist/lib/overlay.d.ts +5 -5
  50. package/dist/lib/overlay.d.ts.map +1 -1
  51. package/dist/lib/overlay.js +5 -5
  52. package/dist/lib/overlay.js.map +1 -1
  53. package/dist/r/conversation.json +1 -2
  54. package/dist/r/input-group.json +1 -0
  55. package/dist/r/message.json +4 -1
  56. package/dist/r/model-selector.json +1 -1
  57. package/dist/r/prompt-input.json +28 -0
  58. package/dist/r/registry.json +35 -4
  59. package/dist/r/src/components/composites/model-selector/model-selector.tsx +19 -25
  60. package/dist/r/src/components/composites/prompt-input/index.ts +15 -0
  61. package/dist/r/src/components/composites/prompt-input/prompt-input.tsx +267 -0
  62. package/dist/r/src/components/conversation/chat-composer.tsx +4 -2
  63. package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +27 -38
  64. package/dist/r/src/components/conversation/message-composer.tsx +93 -97
  65. package/dist/r/src/components/conversation/paste-token-editor.tsx +2 -2
  66. package/dist/r/src/components/theme/theme-provider-value.ts +7 -4
  67. package/dist/r/src/components/ui/badge/badge.tsx +1 -1
  68. package/dist/r/src/components/ui/input-group/index.ts +3 -0
  69. package/dist/r/src/components/ui/input-group/input-group.tsx +121 -29
  70. package/dist/r/src/components/ui/kbd/kbd.tsx +3 -0
  71. package/dist/r/src/components/ui/message/index.ts +3 -0
  72. package/dist/r/src/components/ui/message/message.tsx +56 -0
  73. package/dist/r/src/components/ui/tooltip/tooltip.tsx +1 -1
  74. package/dist/r/src/lib/overlay.ts +5 -6
  75. package/package.json +1 -1
  76. package/registry.json +35 -4
  77. package/src/components/composites/model-selector/model-selector.tsx +19 -25
  78. package/src/components/composites/prompt-input/index.ts +15 -0
  79. package/src/components/composites/prompt-input/prompt-input.tsx +267 -0
  80. package/src/components/conversation/chat-composer.tsx +4 -2
  81. package/src/components/conversation/internal/chat-composer-shell.tsx +27 -38
  82. package/src/components/conversation/message-composer.tsx +93 -97
  83. package/src/components/conversation/paste-token-editor.tsx +2 -2
  84. package/src/components/theme/theme-provider-value.ts +7 -4
  85. package/src/components/ui/badge/badge.tsx +1 -1
  86. package/src/components/ui/input-group/index.ts +3 -0
  87. package/src/components/ui/input-group/input-group.tsx +121 -29
  88. package/src/components/ui/kbd/kbd.tsx +3 -0
  89. package/src/components/ui/message/index.ts +3 -0
  90. package/src/components/ui/message/message.tsx +56 -0
  91. package/src/components/ui/tooltip/tooltip.tsx +1 -1
  92. package/src/index.ts +1 -0
  93. package/src/lib/overlay.ts +5 -6
@@ -1,13 +1,15 @@
1
+ import { callHandler } from "../../../lib/events.js";
1
2
  import { useFormFieldControl } from "../../../lib/form-field.js";
2
3
  import { cn } from "../../../lib/utils.js";
3
- import { insert, mergeProps, spread, template } from "solid-js/web";
4
+ import { Button } from "../button/button.js";
5
+ import { createComponent, delegateEvents, insert, mergeProps, spread, template } from "solid-js/web";
4
6
  import { splitProps } from "solid-js";
5
7
  // src/components/ui/input-group/input-group.tsx
6
- var _tmpl$ = /*#__PURE__*/ template(`<div data-slot=input-group>`);
7
- var _tmpl$2 = /*#__PURE__*/ template(`<input data-slot=input-group-input>`);
8
- var _tmpl$3 = /*#__PURE__*/ template(`<span data-slot=input-group-addon>`);
9
- var _tmpl$4 = /*#__PURE__*/ template(`<button type=button data-slot=input-group-button>`);
10
- var _tmpl$5 = /*#__PURE__*/ template(`<span>`);
8
+ var _tmpl$ = /*#__PURE__*/ template(`<div role=group data-slot=input-group>`);
9
+ var _tmpl$2 = /*#__PURE__*/ template(`<input data-slot=input-group-input data-input-group-control>`);
10
+ var _tmpl$3 = /*#__PURE__*/ template(`<textarea data-slot=input-group-textarea data-input-group-control rows=1>`);
11
+ var _tmpl$4 = /*#__PURE__*/ template(`<div role=group data-slot=input-group-addon>`);
12
+ var _tmpl$5 = /*#__PURE__*/ template(`<span data-slot=input-group-text>`);
11
13
  function InputGroup(props) {
12
14
  const [local, rest] = splitProps(props, ["class", "size"]);
13
15
  return (() => {
@@ -21,7 +23,7 @@ function InputGroup(props) {
21
23
  "h-control-sm px-control-xs": local.size === "sm",
22
24
  "h-control-md px-control-sm": local.size === "md" || local.size === void 0,
23
25
  "h-control-lg px-control-md": local.size === "lg"
24
- }, "transition-[color,box-shadow,border-color] ease-out", "focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle", "has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-3 has-[[aria-invalid=true]]:ring-destructive-subtle", "has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50", local.class);
26
+ }, "has-[>textarea]:h-auto", "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:items-stretch", "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:items-stretch", "transition-[color,box-shadow,border-color] ease-out", "focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle", "has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-3 has-[[aria-invalid=true]]:ring-destructive-subtle", "has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50", "has-[textarea:disabled]:cursor-not-allowed has-[textarea:disabled]:opacity-50", local.class);
25
27
  }
26
28
  }, rest), false, false);
27
29
  return _el$;
@@ -67,41 +69,111 @@ function InputGroupInput(props) {
67
69
  })();
68
70
  }
69
71
  /**
70
- * A non-interactive adornment. `pointer-events-none` by default, because an
71
- * adornment that swallows a click makes the whole control feel dead just to
72
- * the left of the caret — the most annoying possible bug. Pass `align="end"`
73
- * and a real element when the adornment must be clickable.
72
+ * The multi-line field of a group. It grows with its content up to the
73
+ * group's cap (`max-h-48`, the comfortable textarea ceiling) and then scrolls,
74
+ * so a long draft never pushes the footer row off screen.
74
75
  */
75
- function InputGroupAddon(props) {
76
+ function InputGroupTextarea(props) {
76
77
  const [local, rest] = splitProps(props, [
77
78
  "class",
78
- "align",
79
- "children"
79
+ "id",
80
+ "aria-label",
81
+ "aria-labelledby",
82
+ "aria-describedby",
83
+ "aria-invalid",
84
+ "aria-errormessage"
80
85
  ]);
86
+ const field = useFormFieldControl("control", local);
81
87
  return (() => {
82
88
  var _el$3 = _tmpl$3();
83
- spread(_el$3, mergeProps({ get ["class"]() {
84
- return cn("text-muted-foreground flex shrink-0 items-center gap-1.5 text-sm select-none", "[&_svg]:pointer-events-none [&_svg]:size-4", "group-data-[size=sm]/input-group:text-xs group-data-[size=sm]/input-group:[&_svg]:size-3.5", {
85
- "order-first": local.align !== "end",
86
- "order-last": local.align === "end"
87
- }, local.class);
88
- } }, rest), false, true);
89
- insert(_el$3, () => local.children);
89
+ spread(_el$3, mergeProps({
90
+ get id() {
91
+ return field?.id ?? local.id;
92
+ },
93
+ get ["aria-label"]() {
94
+ return local["aria-label"];
95
+ },
96
+ get ["aria-labelledby"]() {
97
+ return field?.["aria-labelledby"] ?? local["aria-labelledby"];
98
+ },
99
+ get ["aria-describedby"]() {
100
+ return field?.["aria-describedby"] ?? local["aria-describedby"];
101
+ },
102
+ get ["aria-invalid"]() {
103
+ return field?.["aria-invalid"] ?? local["aria-invalid"];
104
+ },
105
+ get ["aria-errormessage"]() {
106
+ return field?.["aria-errormessage"] ?? local["aria-errormessage"];
107
+ },
108
+ get ["class"]() {
109
+ return cn("field-sizing-content max-h-48 min-h-10 w-full min-w-0 flex-1 resize-none bg-transparent py-2 text-sm outline-none", "placeholder:text-muted-foreground", "disabled:cursor-not-allowed", local.class);
110
+ }
111
+ }, rest), false, false);
90
112
  return _el$3;
91
113
  })();
92
114
  }
93
- /** A clickable trailing button, sized to the group's height. */
94
- function InputGroupButton(props) {
95
- const [local, rest] = splitProps(props, ["class", "children"]);
115
+ function addonAlign(align) {
116
+ if (align === "end") return "inline-end";
117
+ if (align === "start" || align === void 0) return "inline-start";
118
+ return align;
119
+ }
120
+ /**
121
+ * An adornment: an icon, a unit, a row of actions. A press on the addon
122
+ * itself, outside a control it holds, moves focus to the group's field, as in
123
+ * shadcn, so the whole group behaves as one control instead of having a dead
124
+ * strip beside the caret.
125
+ */
126
+ function InputGroupAddon(props) {
127
+ const [local, rest] = splitProps(props, [
128
+ "class",
129
+ "align",
130
+ "children",
131
+ "onClick"
132
+ ]);
133
+ const align = () => addonAlign(local.align);
96
134
  return (() => {
97
135
  var _el$4 = _tmpl$4();
98
- spread(_el$4, mergeProps({ get ["class"]() {
99
- return cn("text-muted-foreground -me-1 flex size-6 shrink-0 items-center justify-center rounded-sm", "transition-colors ease-out outline-none hover:bg-surface-hover hover:text-foreground", "focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle", "disabled:pointer-events-none disabled:opacity-50", "[&_svg]:size-3.5", local.class);
100
- } }, rest), false, true);
136
+ _el$4.$$click = (event) => {
137
+ callHandler(local.onClick, event);
138
+ if (event.defaultPrevented) return;
139
+ if (event.target.closest("button, a, input, textarea, select, [role=button], [role=combobox]")) return;
140
+ (event.currentTarget.parentElement?.querySelector("[data-input-group-control]"))?.focus();
141
+ };
142
+ spread(_el$4, mergeProps({
143
+ get ["data-align"]() {
144
+ return align();
145
+ },
146
+ get ["class"]() {
147
+ return cn("text-muted-foreground flex shrink-0 cursor-text items-center gap-1.5 text-sm select-none", "[&_svg]:pointer-events-none [&>svg]:size-4", "group-data-[size=sm]/input-group:text-xs group-data-[size=sm]/input-group:[&>svg]:size-3.5", {
148
+ "order-first": align() === "inline-start" || align() === "block-start",
149
+ "order-last": align() === "inline-end" || align() === "block-end",
150
+ "w-full justify-start gap-1": align() === "block-start" || align() === "block-end",
151
+ "pt-2": align() === "block-start",
152
+ "pb-2": align() === "block-end"
153
+ }, local.class);
154
+ }
155
+ }, rest), false, true);
101
156
  insert(_el$4, () => local.children);
102
157
  return _el$4;
103
158
  })();
104
159
  }
160
+ /**
161
+ * A button inside the group. It is a `Button` (ghost by default), so it shares
162
+ * the system's pressed, focus and disabled states rather than drawing its own.
163
+ */
164
+ function InputGroupButton(props) {
165
+ const [local, rest] = splitProps(props, ["size", "variant"]);
166
+ return createComponent(Button, mergeProps({
167
+ type: "button",
168
+ "data-slot": "input-group-button",
169
+ get variant() {
170
+ return local.variant ?? "ghost";
171
+ },
172
+ get size() {
173
+ return local.size ?? "icon-xs";
174
+ }
175
+ }, rest));
176
+ }
105
177
  /** Text that reads as a value but is not an input, e.g. a unit or a suffix. */
106
178
  function InputGroupText(props) {
107
179
  const [local, rest] = splitProps(props, ["class"]);
@@ -113,6 +185,7 @@ function InputGroupText(props) {
113
185
  return _el$5;
114
186
  })();
115
187
  }
116
- export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText };
188
+ delegateEvents(["click"]);
189
+ export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea };
117
190
 
118
191
  //# sourceMappingURL=input-group.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input-group.js","names":["splitProps","useFormFieldControl","cn","size","InputGroup","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","undefined","InputGroupInput","field","_el$2","_tmpl$2","id","align","InputGroupAddon","_el$3","_tmpl$3","_$insert","children","InputGroupButton","_el$4","_tmpl$4","InputGroupText","_el$5","_tmpl$5"],"sources":["../../../../src/components/ui/input-group/input-group.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\n\n/**\n * InputGroup.\n *\n * A field with attached chrome: a leading icon, a unit, a trailing button, a\n * clear affordance. The point of the component is that the adornments and the\n * input share *one* border and *one* focus ring, so the group reads as a single\n * control. Two separate elements side by side always drift, the ring appears\n * on the wrong box, or the border doubles where they meet.\n *\n * The focus ring therefore lives on the group and follows `focus-within`. A\n * group containing several focusable things still reads as focused once, which\n * is the correct affordance: the user is somewhere inside it.\n *\n * `size` is the control rung, matching `Input`: `sm` for a toolbar search beside\n * `icon-sm` actions, `md` (the default) everywhere else. The group's input and\n * text follow it.\n */\nexport type InputGroupProps = ComponentProps<'div'> & {\n size?: 'sm' | 'md' | 'lg'\n}\n\nexport function InputGroup(props: InputGroupProps) {\n const [local, rest] = splitProps(props, ['class', 'size'])\n\n return (\n <div\n data-slot=\"input-group\"\n data-size={local.size}\n class={cn(\n 'group/input-group border-input flex w-full min-w-0 items-center gap-1.5 rounded-md border bg-transparent',\n {\n 'h-control-sm px-control-xs': local.size === 'sm',\n 'h-control-md px-control-sm': local.size === 'md' || local.size === undefined,\n 'h-control-lg px-control-md': local.size === 'lg',\n },\n 'transition-[color,box-shadow,border-color] ease-out',\n 'focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle',\n 'has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-3 has-[[aria-invalid=true]]:ring-destructive-subtle',\n 'has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function InputGroupInput(props: ComponentProps<'input'>) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'id',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage',\n ])\n const field = useFormFieldControl('control', local)\n\n return (\n <input\n data-slot=\"input-group-input\"\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n class={cn(\n 'h-full min-w-0 flex-1 bg-transparent text-sm outline-none group-data-[size=sm]/input-group:text-xs',\n 'placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport type InputGroupAddonProps = ComponentProps<'span'> & {\n /** Which edge the adornment sits on; also sets the pointer-events rule. */\n align?: 'start' | 'end'\n}\n\n/**\n * A non-interactive adornment. `pointer-events-none` by default, because an\n * adornment that swallows a click makes the whole control feel dead just to\n * the left of the caret — the most annoying possible bug. Pass `align=\"end\"`\n * and a real element when the adornment must be clickable.\n */\nexport function InputGroupAddon(props: InputGroupAddonProps) {\n const [local, rest] = splitProps(props, ['class', 'align', 'children'])\n\n return (\n <span\n data-slot=\"input-group-addon\"\n class={cn(\n 'text-muted-foreground flex shrink-0 items-center gap-1.5 text-sm select-none',\n '[&_svg]:pointer-events-none [&_svg]:size-4',\n 'group-data-[size=sm]/input-group:text-xs group-data-[size=sm]/input-group:[&_svg]:size-3.5',\n { 'order-first': local.align !== 'end', 'order-last': local.align === 'end' },\n local.class\n )}\n {...rest}\n >\n {local.children}\n </span>\n )\n}\n\n/** A clickable trailing button, sized to the group's height. */\nexport function InputGroupButton(props: ComponentProps<'button'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n\n return (\n <button\n type=\"button\"\n data-slot=\"input-group-button\"\n class={cn(\n 'text-muted-foreground -me-1 flex size-6 shrink-0 items-center justify-center rounded-sm',\n 'transition-colors ease-out outline-none hover:bg-surface-hover hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle',\n 'disabled:pointer-events-none disabled:opacity-50',\n '[&_svg]:size-3.5',\n local.class\n )}\n {...rest}\n >\n {local.children}\n </button>\n )\n}\n\n/** Text that reads as a value but is not an input, e.g. a unit or a suffix. */\nexport function InputGroupText(props: ComponentProps<'span'> & { children?: JSX.Element }) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <span\n class={cn(\n 'text-muted-foreground text-sm group-data-[size=sm]/input-group:text-xs',\n local.class\n )}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;AA0BA,SAAgBI,WAAWC,OAAwB;CACjD,MAAM,CAACC,OAAOC,QAAQP,WAAWK,OAAO,CAAC,SAAS,MAAM,CAAC;CAEzD,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA;GAAA,KAAA,eAAA;IAAA,OAGeL,MAAMH;GAAI;GAAA,KAAA,WAAA;IAAA,OACdD,GACL,4GACA;KACE,8BAA8BI,MAAMH,SAAS;KAC7C,8BAA8BG,MAAMH,SAAS,QAAQG,MAAMH,SAASU,KAAAA;KACpE,8BAA8BP,MAAMH,SAAS;IAC/C,GACA,uDACA,iFACA,mIACA,2EACAG,MAAMM,KACR;GAAC;EAAA,GACGL,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAGd;AAEA,SAAgBM,gBAAgBT,OAAgC;CAC9D,MAAM,CAACC,OAAOC,QAAQP,WAAWK,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;CAAmB,CACpB;CACD,MAAMU,QAAQd,oBAAoB,WAAWK,KAAK;CAElD,cAAA;EAAA,IAAAU,QAAAC,QAAA;EAAAP,OAAAM,OAAAL,WAAA;GAAA,IAGIO,KAAE;IAAA,OAAEH,OAAOG,MAAMZ,MAAMY;GAAE;GAAA,KAAA,gBAAA;IAAA,OACbZ,MAAM;GAAa;GAAA,KAAA,qBAAA;IAAA,OACdS,QAAQ,sBAAsBT,MAAM;GAAkB;GAAA,KA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AC;CACjD,cAAA;EAAA,IAAAwB,QAAAC,QAAA;EAAApB,OAAAmB,OAAAlB,WAAA,EAAA,KAAA,WAAA;GAAA,OAEWT,GACL,0EACAI,MAAMM,KACR;EAAC,EAAA,GACGL,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAsB;CAAA,EAAA,CAAA;AAGd"}
1
+ {"version":3,"file":"input-group.js","names":["splitProps","callHandler","useFormFieldControl","cn","Button","size","InputGroup","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","undefined","InputGroupInput","field","_el$2","_tmpl$2","id","InputGroupTextarea","_el$3","_tmpl$3","align","addonAlign","InputGroupAddon","_el$4","_tmpl$4","$$click","event","onClick","defaultPrevented","target","closest","control","currentTarget","parentElement","querySelector","focus","_$insert","children","InputGroupButton","_$createComponent","type","variant","InputGroupText","_el$5","_tmpl$5","_$delegateEvents"],"sources":["../../../../src/components/ui/input-group/input-group.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from 'solid-js'\nimport { splitProps } from 'solid-js'\nimport { callHandler } from '#lib/events'\nimport { useFormFieldControl } from '#lib/form-field'\nimport { cn } from '#lib/utils'\nimport { Button, type ButtonProps } from '../button'\n\n/**\n * InputGroup.\n *\n * A field with attached chrome: a leading icon, a unit, a trailing button, a\n * clear affordance. The point of the component is that the adornments and the\n * input share *one* border and *one* focus ring, so the group reads as a single\n * control. Two separate elements side by side always drift, the ring appears\n * on the wrong box, or the border doubles where they meet.\n *\n * The focus ring therefore lives on the group and follows `focus-within`. A\n * group containing several focusable things still reads as focused once, which\n * is the correct affordance: the user is somewhere inside it.\n *\n * `size` is the control rung, matching `Input`: `sm` for a toolbar search beside\n * `icon-sm` actions, `md` (the default) everywhere else. The group's input and\n * text follow it.\n *\n * The part list and alignments follow shadcn's InputGroup: an addon aligned\n * `block-start` or `block-end` turns the group into a column (a header or a\n * footer row around a field), and an `InputGroupTextarea` lets the group grow\n * with its content. That column form is what a prompt input is, so the chat\n * composers are built from these parts instead of their own box.\n */\nexport type InputGroupProps = ComponentProps<'div'> & {\n size?: 'sm' | 'md' | 'lg'\n}\n\nexport function InputGroup(props: InputGroupProps) {\n const [local, rest] = splitProps(props, ['class', 'size'])\n\n return (\n <div\n role=\"group\"\n data-slot=\"input-group\"\n data-size={local.size}\n class={cn(\n 'group/input-group border-input flex w-full min-w-0 items-center gap-1.5 rounded-md border bg-transparent',\n {\n 'h-control-sm px-control-xs': local.size === 'sm',\n 'h-control-md px-control-sm': local.size === 'md' || local.size === undefined,\n 'h-control-lg px-control-md': local.size === 'lg',\n },\n // A textarea, or an addon on a block edge, makes the group a column\n // that grows with its content: shadcn's prompt-input form.\n 'has-[>textarea]:h-auto',\n 'has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:items-stretch',\n 'has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:items-stretch',\n 'transition-[color,box-shadow,border-color] ease-out',\n 'focus-within:border-ring focus-within:ring-3 focus-within:ring-primary-subtle',\n 'has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-3 has-[[aria-invalid=true]]:ring-destructive-subtle',\n 'has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50',\n 'has-[textarea:disabled]:cursor-not-allowed has-[textarea:disabled]:opacity-50',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport function InputGroupInput(props: ComponentProps<'input'>) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'id',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage',\n ])\n const field = useFormFieldControl('control', local)\n\n return (\n <input\n data-slot=\"input-group-input\"\n data-input-group-control=\"\"\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n class={cn(\n 'h-full min-w-0 flex-1 bg-transparent text-sm outline-none group-data-[size=sm]/input-group:text-xs',\n 'placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n local.class\n )}\n {...rest}\n />\n )\n}\n\n/**\n * The multi-line field of a group. It grows with its content up to the\n * group's cap (`max-h-48`, the comfortable textarea ceiling) and then scrolls,\n * so a long draft never pushes the footer row off screen.\n */\nexport function InputGroupTextarea(props: ComponentProps<'textarea'>) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'id',\n 'aria-label',\n 'aria-labelledby',\n 'aria-describedby',\n 'aria-invalid',\n 'aria-errormessage',\n ])\n const field = useFormFieldControl('control', local)\n\n return (\n <textarea\n data-slot=\"input-group-textarea\"\n data-input-group-control=\"\"\n id={field?.id ?? local.id}\n aria-label={local['aria-label']}\n aria-labelledby={field?.['aria-labelledby'] ?? local['aria-labelledby']}\n aria-describedby={field?.['aria-describedby'] ?? local['aria-describedby']}\n aria-invalid={field?.['aria-invalid'] ?? local['aria-invalid']}\n aria-errormessage={field?.['aria-errormessage'] ?? local['aria-errormessage']}\n rows={1}\n class={cn(\n 'field-sizing-content max-h-48 min-h-10 w-full min-w-0 flex-1 resize-none bg-transparent py-2 text-sm outline-none',\n 'placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport type InputGroupAddonAlign =\n | 'inline-start'\n | 'inline-end'\n | 'block-start'\n | 'block-end'\n /** @deprecated Use `inline-start`. */\n | 'start'\n /** @deprecated Use `inline-end`. */\n | 'end'\n\nexport type InputGroupAddonProps = ComponentProps<'div'> & {\n /** Which edge the adornment sits on. Block edges make the group a column. */\n align?: InputGroupAddonAlign\n}\n\nfunction addonAlign(align: InputGroupAddonAlign | undefined) {\n if (align === 'end') return 'inline-end'\n if (align === 'start' || align === undefined) return 'inline-start'\n return align\n}\n\n/**\n * An adornment: an icon, a unit, a row of actions. A press on the addon\n * itself, outside a control it holds, moves focus to the group's field, as in\n * shadcn, so the whole group behaves as one control instead of having a dead\n * strip beside the caret.\n */\nexport function InputGroupAddon(props: InputGroupAddonProps) {\n const [local, rest] = splitProps(props, ['class', 'align', 'children', 'onClick'])\n const align = () => addonAlign(local.align)\n\n return (\n <div\n role=\"group\"\n data-slot=\"input-group-addon\"\n data-align={align()}\n class={cn(\n 'text-muted-foreground flex shrink-0 cursor-text items-center gap-1.5 text-sm select-none',\n '[&_svg]:pointer-events-none [&>svg]:size-4',\n 'group-data-[size=sm]/input-group:text-xs group-data-[size=sm]/input-group:[&>svg]:size-3.5',\n {\n 'order-first': align() === 'inline-start' || align() === 'block-start',\n 'order-last': align() === 'inline-end' || align() === 'block-end',\n 'w-full justify-start gap-1': align() === 'block-start' || align() === 'block-end',\n 'pt-2': align() === 'block-start',\n 'pb-2': align() === 'block-end',\n },\n local.class\n )}\n onClick={(event) => {\n callHandler(local.onClick, event)\n if (event.defaultPrevented) return\n const target = event.target as Element\n if (target.closest('button, a, input, textarea, select, [role=button], [role=combobox]'))\n return\n const control = event.currentTarget.parentElement?.querySelector<HTMLElement>(\n '[data-input-group-control]'\n )\n control?.focus()\n }}\n {...rest}\n >\n {local.children}\n </div>\n )\n}\n\nexport type InputGroupButtonProps = Omit<ButtonProps, 'size'> & {\n /** shadcn's four InputGroupButton sizes, mapped onto the control ladder. */\n size?: 'xs' | 'sm' | 'icon-xs' | 'icon-sm'\n}\n\n/**\n * A button inside the group. It is a `Button` (ghost by default), so it shares\n * the system's pressed, focus and disabled states rather than drawing its own.\n */\nexport function InputGroupButton(props: InputGroupButtonProps) {\n const [local, rest] = splitProps(props, ['size', 'variant'])\n\n return (\n <Button\n type=\"button\"\n data-slot=\"input-group-button\"\n variant={local.variant ?? 'ghost'}\n size={local.size ?? 'icon-xs'}\n {...rest}\n />\n )\n}\n\n/** Text that reads as a value but is not an input, e.g. a unit or a suffix. */\nexport function InputGroupText(props: ComponentProps<'span'> & { children?: JSX.Element }) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <span\n data-slot=\"input-group-text\"\n class={cn(\n 'text-muted-foreground text-sm group-data-[size=sm]/input-group:text-xs',\n local.class\n )}\n {...rest}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;AAkCA,SAAgBM,WAAWC,OAAwB;CACjD,MAAM,CAACC,OAAOC,QAAQT,WAAWO,OAAO,CAAC,SAAS,MAAM,CAAC;CAEzD,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA;GAAA,KAAA,eAAA;IAAA,OAIeL,MAAMH;GAAI;GAAA,KAAA,WAAA;IAAA,OACdF,GACL,4GACA;KACE,8BAA8BK,MAAMH,SAAS;KAC7C,8BAA8BG,MAAMH,SAAS,QAAQG,MAAMH,SAASU,KAAAA;KACpE,8BAA8BP,MAAMH,SAAS;IAC/C,GAGA,0BACA,iIACA,2HACA,uDACA,iFACA,mIACA,2EACA,iFACAG,MAAMM,KACR;GAAC;EAAA,GACGL,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAGd;AAEA,SAAgBM,gBAAgBT,OAAgC;CAC9D,MAAM,CAACC,OAAOC,QAAQT,WAAWO,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;EACA;CAAmB,CACpB;CACD,MAAMU,QAAQf,oBAAoB,WAAWM,KAAK;CAElD,cAAA;EAAA,IAAAU,QAAAC,QAAA;EAAAP,OAAAM,OAAAL,WAAA;GAAA,IAIIO,KAAE;IAAA,OAAEH,OAAOG,MAAMZ,MAAMY;GAAE;GAAA,KAAA,gBAAA;IAAA,OACbZ,MAAM;GAAa;GAAA,KAAA,qBAAA;IAAA,OACdS,QAAQ,sBAAsBT,MAAM;GAAkB;GAAA,KAAA,sBAAA;IAAA,OACrDS,QAAQ,uBAAuBT,MAAM;GAAmB;GAAA,KAAA,kBAAA;IAAA,OAC5DS,QAAQ,mBAAmBT,MAAM;GAAe;GA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A;GAAA,OAGWV,GACL,0EACAK,MAAMM,KACR;EAAC,EAAA,GACGL,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAsC;CAAA,EAAA,CAAA;AAGd;AAACE,eAAA,CAAA,OAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"kbd.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/kbd/kbd.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAGtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW;;8EAgBvB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAE3E,wBAAgB,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,kCAMpE;AAED,eAAO,MAAM,gBAAgB;;8EAW3B,CAAA;AAEF;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,kCAU1E;AAMD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAuBnD;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG;IACrE,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,kCAQ5C"}
1
+ {"version":3,"file":"kbd.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/kbd/kbd.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAGtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW;;8EAmBvB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAE3E,wBAAgB,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,kCAMpE;AAED,eAAO,MAAM,gBAAgB;;8EAW3B,CAAA;AAEF;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,kCAU1E;AAMD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAuBnD;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG;IACrE,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,kCAQ5C"}
@@ -25,7 +25,12 @@ var _tmpl$2 = /*#__PURE__*/ template(`<span data-slot=kbd-group>`);
25
25
  * `KbdGroup` exists because a shortcut is a sequence: typing `⌘` then `K`
26
26
  * needs a gap between them that is a layout concern, not punctuation.
27
27
  */
28
- var kbdVariants = cva(["bg-muted text-muted-foreground pointer-events-none inline-flex min-h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none", "[&_svg:not([class*='size-'])]:size-3"], {
28
+ var kbdVariants = cva([
29
+ "bg-muted text-muted-foreground pointer-events-none inline-flex min-h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none",
30
+ "[&_svg:not([class*='size-'])]:size-3",
31
+ "[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background",
32
+ "[[data-slot=side-rail-tip]_&]:bg-background/20 [[data-slot=side-rail-tip]_&]:text-background"
33
+ ], {
29
34
  variants: { size: {
30
35
  default: "",
31
36
  compact: "min-h-4 min-w-4 bg-muted/40 px-0.5 font-normal leading-none"
@@ -1 +1 @@
1
- {"version":3,"file":"kbd.js","names":["For","splitProps","cva","cn","kbdVariants","variants","size","default","compact","defaultVariants","Kbd","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","kbdGroupVariants","KbdGroup","_el$2","_tmpl$2","NAMED_KEY","kbdChordKeys","keys","caps","separated","length","first","slice","named","exec","cap","test","charAt","String","fromCodePoint","codePointAt","push","KbdChord","_$createComponent","children","each","key"],"sources":["../../../../src/components/ui/kbd/kbd.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { For, splitProps } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Kbd.\n *\n * A keyboard key, ported from shadcn/ui's `Kbd` (MIT, see NOTICE). The element\n * is a real `<kbd>` so the semantics survive copy-paste.\n *\n * The cap is set in the UI face at `text-xs`, as shadcn draws it, not in the\n * code face. Monospace faces carry letters but rarely the modifier glyphs, so\n * a mono `⌘` fell back to another font and sat visibly smaller than the mono\n * `K` beside it. The UI face draws `⌘ ⇧ ⌥ ⌃` and letters as one family, so\n * every cap in a chord reads at the same size.\n *\n * `size=\"compact\"` exists for the dense rows a default cap would outweigh, a\n * rail search row, a sidebar shortcut hint. It drops a height rung, and it\n * lightens the fill and weight with it because at that size a solid muted cap\n * reads heavier than the row text it sits in.\n *\n * `KbdGroup` exists because a shortcut is a sequence: typing `⌘` then `K`\n * needs a gap between them that is a layout concern, not punctuation.\n */\nexport const kbdVariants = cva(\n [\n 'bg-muted text-muted-foreground pointer-events-none inline-flex min-h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none',\n \"[&_svg:not([class*='size-'])]:size-3\",\n ],\n {\n variants: {\n size: {\n default: '',\n compact: 'min-h-4 min-w-4 bg-muted/40 px-0.5 font-normal leading-none',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n)\n\nexport type KbdSize = NonNullable<VariantProps<typeof kbdVariants>['size']>\n\nexport function Kbd(props: ComponentProps<'kbd'> & { size?: KbdSize }) {\n const [local, rest] = splitProps(props, ['size', 'class'])\n\n return (\n <kbd data-slot=\"kbd\" class={cn(kbdVariants({ size: local.size }), local.class)} {...rest} />\n )\n}\n\nexport const kbdGroupVariants = cva('inline-flex items-center gap-1', {\n variants: {\n size: {\n default: '',\n /** The gap is what separates caps, so it tightens with them. */\n compact: 'gap-0.5',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n})\n\n/**\n * shadcn renders the group as a `<kbd>`; it stays a `<span>` here so a\n * `kbd` selector still finds exactly the caps, which hosts and tests count.\n */\nexport function KbdGroup(props: ComponentProps<'span'> & { size?: KbdSize }) {\n const [local, rest] = splitProps(props, ['size', 'class'])\n\n return (\n <span\n data-slot=\"kbd-group\"\n class={cn(kbdGroupVariants({ size: local.size }), local.class)}\n {...rest}\n />\n )\n}\n\n/** Key names that are drawn as one word on one cap. */\nconst NAMED_KEY =\n /^(?:Ctrl|Control|Alt|Option|Opt|Shift|Cmd|Command|Meta|Super|Win|Fn|Enter|Return|Escape|Esc|Tab|Space|Backspace|Delete|Del|Insert|Home|End|PageUp|PageDown|PgUp|PgDn|Up|Down|Left|Right|F(?:1\\d|2[0-4]|[1-9]))/\n\n/**\n * Split a written chord into one entry per key cap.\n *\n * - Glyph chords draw one cap per character: `⌘K` is `⌘` + `K`, and `⇧⌘P`\n * stays three caps wide, which matches how the system draws chords in menus.\n * - Spelled-out names stay whole: `CtrlK` is `Ctrl` + `K`, `⇧Enter` is\n * `⇧` + `Enter`.\n * - `+` and spaces separate keys and are not drawn (`Ctrl+K`, `Ctrl Shift P`),\n * except a `+` that is itself the key (`Ctrl++`, `⌘+`).\n */\nexport function kbdChordKeys(keys: string): string[] {\n const caps: string[] = []\n let rest = keys\n let separated = true\n while (rest.length > 0) {\n const first = rest[0]!\n if (first === ' ' || (first === '+' && !separated && rest.length > 1)) {\n rest = rest.slice(1)\n separated = true\n continue\n }\n const named = NAMED_KEY.exec(rest)?.[0]\n // A name only counts when a lowercase letter does not continue it: `Tab`\n // in `Table` is not a key, so a caller's literal text is drawn as written.\n const cap =\n named && !/^[a-z]/.test(rest.charAt(named.length))\n ? named\n : String.fromCodePoint(rest.codePointAt(0)!)\n caps.push(cap)\n rest = rest.slice(cap.length)\n separated = false\n }\n return caps\n}\n\nexport type KbdChordProps = Omit<ComponentProps<'span'>, 'children'> & {\n /** The chord as it is drawn, e.g. `\"⌘K\"`, `\"⇧⌘P\"` or `\"Ctrl+K\"`. See `kbdChordKeys`. */\n keys: string\n size?: KbdSize\n}\n\n/**\n * KbdChord.\n *\n * A written chord drawn as caps, one per key (see `kbdChordKeys`). Decoration only: the\n * composition renders `aria-hidden`, so the accessible name and the parseable\n * `aria-keyshortcuts` stay on the control the chord belongs to. That is why\n * there is no children, the chord says what was drawn, nothing more.\n */\nexport function KbdChord(props: KbdChordProps) {\n const [local, rest] = splitProps(props, ['keys', 'size', 'class'])\n\n return (\n <KbdGroup {...rest} size={local.size} class={local.class} aria-hidden=\"true\">\n <For each={kbdChordKeys(local.keys)}>{(key) => <Kbd size={local.size}>{key}</Kbd>}</For>\n </KbdGroup>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAaI,cAAcF,IACzB,CACE,oLACA,sCAAsC,GAExC;CACEG,UAAU,EACRC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AAY;GACZ;EACF;EACA,MAAMI,QAAQR,UAAUS,KAAKnB,IAAI,CAAC,GAAG;EAGrC,MAAMoB,MACJF,SAAS,CAAC,SAASG,KAAKrB,KAAKsB,OAAOJ,MAAMH,MAAM,CAAC,IAC7CG,QACAK,OAAOC,cAAcxB,KAAKyB,YAAY,CAAC,CAAE;EAC/CZ,KAAKa,KAAKN,GAAG;EACbpB,OAAOA,KAAKiB,MAAMG,IAAIL,MAAM;EAC5BD,YAAY;CACd;CACA,OAAOD;AACT;;;;;;;;;AAgBA,SAAgBc,SAAS7B,OAAsB;CAC7C,MAAM,CAACC,OAAOC,QAAQZ,WAAWU,OAAO;EAAC;EAAQ;EAAQ;CAAO,CAAC;CAEjE,OAAA8B,gBACGrB,UAAQH,WAAKJ,MAAI;EAAA,IAAEP,OAAI;GAAA,OAAEM,MAAMN;EAAI;EAAA,KAAA,WAAA;GAAA,OAASM,MAAMM;EAAK;EAAA,eAAA;EAAA,IAAAwB,WAAA;GAAA,OAAAD,gBACrDzC,KAAG;IAAA,IAAC2C,OAAI;KAAA,OAAEnB,aAAaZ,MAAMa,IAAI;IAAC;IAAAiB,WAAIE,QAAGH,gBAAM/B,KAAG;KAAA,IAACJ,OAAI;MAAA,OAAEM,MAAMN;KAAI;KAAAoC,UAAGE;IAAG,CAAA;GAAO,CAAA;EAAA;CAAA,CAAA,CAAA;AAGvF"}
1
+ {"version":3,"file":"kbd.js","names":["For","splitProps","cva","cn","kbdVariants","variants","size","default","compact","defaultVariants","Kbd","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","class","kbdGroupVariants","KbdGroup","_el$2","_tmpl$2","NAMED_KEY","kbdChordKeys","keys","caps","separated","length","first","slice","named","exec","cap","test","charAt","String","fromCodePoint","codePointAt","push","KbdChord","_$createComponent","children","each","key"],"sources":["../../../../src/components/ui/kbd/kbd.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { For, splitProps } from 'solid-js'\nimport { cva, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Kbd.\n *\n * A keyboard key, ported from shadcn/ui's `Kbd` (MIT, see NOTICE). The element\n * is a real `<kbd>` so the semantics survive copy-paste.\n *\n * The cap is set in the UI face at `text-xs`, as shadcn draws it, not in the\n * code face. Monospace faces carry letters but rarely the modifier glyphs, so\n * a mono `⌘` fell back to another font and sat visibly smaller than the mono\n * `K` beside it. The UI face draws `⌘ ⇧ ⌥ ⌃` and letters as one family, so\n * every cap in a chord reads at the same size.\n *\n * `size=\"compact\"` exists for the dense rows a default cap would outweigh, a\n * rail search row, a sidebar shortcut hint. It drops a height rung, and it\n * lightens the fill and weight with it because at that size a solid muted cap\n * reads heavier than the row text it sits in.\n *\n * `KbdGroup` exists because a shortcut is a sequence: typing `⌘` then `K`\n * needs a gap between them that is a layout concern, not punctuation.\n */\nexport const kbdVariants = cva(\n [\n 'bg-muted text-muted-foreground pointer-events-none inline-flex min-h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none',\n \"[&_svg:not([class*='size-'])]:size-3\",\n // Inside the inverted tooltip chip the cap inverts with it, as in shadcn.\n '[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background',\n '[[data-slot=side-rail-tip]_&]:bg-background/20 [[data-slot=side-rail-tip]_&]:text-background',\n ],\n {\n variants: {\n size: {\n default: '',\n compact: 'min-h-4 min-w-4 bg-muted/40 px-0.5 font-normal leading-none',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n }\n)\n\nexport type KbdSize = NonNullable<VariantProps<typeof kbdVariants>['size']>\n\nexport function Kbd(props: ComponentProps<'kbd'> & { size?: KbdSize }) {\n const [local, rest] = splitProps(props, ['size', 'class'])\n\n return (\n <kbd data-slot=\"kbd\" class={cn(kbdVariants({ size: local.size }), local.class)} {...rest} />\n )\n}\n\nexport const kbdGroupVariants = cva('inline-flex items-center gap-1', {\n variants: {\n size: {\n default: '',\n /** The gap is what separates caps, so it tightens with them. */\n compact: 'gap-0.5',\n },\n },\n defaultVariants: {\n size: 'default',\n },\n})\n\n/**\n * shadcn renders the group as a `<kbd>`; it stays a `<span>` here so a\n * `kbd` selector still finds exactly the caps, which hosts and tests count.\n */\nexport function KbdGroup(props: ComponentProps<'span'> & { size?: KbdSize }) {\n const [local, rest] = splitProps(props, ['size', 'class'])\n\n return (\n <span\n data-slot=\"kbd-group\"\n class={cn(kbdGroupVariants({ size: local.size }), local.class)}\n {...rest}\n />\n )\n}\n\n/** Key names that are drawn as one word on one cap. */\nconst NAMED_KEY =\n /^(?:Ctrl|Control|Alt|Option|Opt|Shift|Cmd|Command|Meta|Super|Win|Fn|Enter|Return|Escape|Esc|Tab|Space|Backspace|Delete|Del|Insert|Home|End|PageUp|PageDown|PgUp|PgDn|Up|Down|Left|Right|F(?:1\\d|2[0-4]|[1-9]))/\n\n/**\n * Split a written chord into one entry per key cap.\n *\n * - Glyph chords draw one cap per character: `⌘K` is `⌘` + `K`, and `⇧⌘P`\n * stays three caps wide, which matches how the system draws chords in menus.\n * - Spelled-out names stay whole: `CtrlK` is `Ctrl` + `K`, `⇧Enter` is\n * `⇧` + `Enter`.\n * - `+` and spaces separate keys and are not drawn (`Ctrl+K`, `Ctrl Shift P`),\n * except a `+` that is itself the key (`Ctrl++`, `⌘+`).\n */\nexport function kbdChordKeys(keys: string): string[] {\n const caps: string[] = []\n let rest = keys\n let separated = true\n while (rest.length > 0) {\n const first = rest[0]!\n if (first === ' ' || (first === '+' && !separated && rest.length > 1)) {\n rest = rest.slice(1)\n separated = true\n continue\n }\n const named = NAMED_KEY.exec(rest)?.[0]\n // A name only counts when a lowercase letter does not continue it: `Tab`\n // in `Table` is not a key, so a caller's literal text is drawn as written.\n const cap =\n named && !/^[a-z]/.test(rest.charAt(named.length))\n ? named\n : String.fromCodePoint(rest.codePointAt(0)!)\n caps.push(cap)\n rest = rest.slice(cap.length)\n separated = false\n }\n return caps\n}\n\nexport type KbdChordProps = Omit<ComponentProps<'span'>, 'children'> & {\n /** The chord as it is drawn, e.g. `\"⌘K\"`, `\"⇧⌘P\"` or `\"Ctrl+K\"`. See `kbdChordKeys`. */\n keys: string\n size?: KbdSize\n}\n\n/**\n * KbdChord.\n *\n * A written chord drawn as caps, one per key (see `kbdChordKeys`). Decoration only: the\n * composition renders `aria-hidden`, so the accessible name and the parseable\n * `aria-keyshortcuts` stay on the control the chord belongs to. That is why\n * there is no children, the chord says what was drawn, nothing more.\n */\nexport function KbdChord(props: KbdChordProps) {\n const [local, rest] = splitProps(props, ['keys', 'size', 'class'])\n\n return (\n <KbdGroup {...rest} size={local.size} class={local.class} aria-hidden=\"true\">\n <For each={kbdChordKeys(local.keys)}>{(key) => <Kbd size={local.size}>{key}</Kbd>}</For>\n </KbdGroup>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAaI,cAAcF,IACzB;CACE;CACA;CAEA;CACA;AAA8F,GAEhG;CACEG,UAAU,EACRC,MAAM;EACJC,SAAS;EACTC,SAAS;CACX,EACF;CACAC,iBAAiB,EACfH,MAAM,UACR;AACF,CACF;AAIA,SAAgBI,IAAIC,OAAmD;CACrE,MAAM,CAACC,OAAOC,QAAQZ,WAAWU,OAAO,CAAC,QAAQ,OAAO,CAAC;CAEzD,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA,EAAA,KAAA,WAAA;GAAA,OAC8Bd,GAAGC,YAAY,EAAEE,MAAMM,MAAMN,KAAK,CAAC,GAAGM,MAAMM,KAAK;EAAC,EAAA,GAAML,IAAI,GAAA,OAAA,KAAA;EAAA,OAAAC;CAAA,EAAA,CAAA;AAE5F;AAEA,IAAaK,mBAAmBjB,IAAI,kCAAkC;CACpEG,UAAU,EACRC,MAAM;EACJC,SAAS;;EAETC,SAAS;CACX,EACF;CACAC,iBAAiB,EACfH,MAAM,UACR;AACF,CAAC;;;;;AAMD,SAAgBc,SAAST,OAAoD;CAC3E,MAAM,C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,gBACrDzC,KAAG;IAAA,IAAC2C,OAAI;KAAA,OAAEnB,aAAaZ,MAAMa,IAAI;IAAC;IAAAiB,WAAIE,QAAGH,gBAAM/B,KAAG;KAAA,IAACJ,OAAI;MAAA,OAAEM,MAAMN;KAAI;KAAAoC,UAAGE;IAAG,CAAA;GAAO,CAAA;EAAA;CAAA,CAAA,CAAA;AAGvF"}
@@ -1,4 +1,4 @@
1
- export { Message, MessageActions, MessageContent, MessageFooter, MessageHeader, MessageText, type MessageCitations, type MessageCodeBlockInfo, type MessageCodeBlockProps, type MessageProps, type MessageRole, type MessageTextProps, } from './message';
1
+ export { Message, MessageAction, MessageActions, MessageCopyAction, MessageContent, MessageFooter, MessageHeader, MessageText, type MessageCitations, type MessageCodeBlockInfo, type MessageCodeBlockProps, type MessageActionProps, type MessageProps, type MessageRole, type MessageTextProps, } from './message';
2
2
  export { placeCitationMarkers, type CitationPlacement, type PlacedCitations } from './cite-ranges';
3
3
  export { parseInline, parseMessageText, parseMessageTextIncremental, safeHref, type MessageBlock, type MessageInline, type MessageParse, type MessageParseOptions, type ParseInlineOptions, } from './parse-message-text';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/message/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,EACb,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AAClG,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,2BAA2B,EAC3B,QAAQ,EACR,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/message/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,aAAa,EACb,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AAClG,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,2BAA2B,EAC3B,QAAQ,EACR,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,sBAAsB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { safeHref } from "../../../lib/url.js";
2
- import { Message, MessageActions, MessageContent, MessageFooter, MessageHeader, MessageText } from "./message.js";
2
+ import { Message, MessageAction, MessageActions, MessageContent, MessageCopyAction, MessageFooter, MessageHeader, MessageText } from "./message.js";
3
3
  import { placeCitationMarkers } from "./cite-ranges.js";
4
4
  import { parseInline, parseMessageText, parseMessageTextIncremental } from "./parse-message-text.js";
5
- export { Message, MessageActions, MessageContent, MessageFooter, MessageHeader, MessageText, parseInline, parseMessageText, parseMessageTextIncremental, placeCitationMarkers, safeHref };
5
+ export { Message, MessageAction, MessageActions, MessageContent, MessageCopyAction, MessageFooter, MessageHeader, MessageText, parseInline, parseMessageText, parseMessageTextIncremental, placeCitationMarkers, safeHref };
@@ -1,4 +1,5 @@
1
1
  import { type ComponentProps, type JSX } from 'solid-js';
2
+ import { type ActionButtonProps } from '../../composites/action-button';
2
3
  import { type CodeBlockProps } from '../code-block';
3
4
  /**
4
5
  * Message.
@@ -45,6 +46,21 @@ export declare function MessageContent(props: ComponentProps<'div'>): JSX.Elemen
45
46
  * and on a touch screen there is no hover, so coarse pointers always see them.
46
47
  */
47
48
  export declare function MessageActions(props: ComponentProps<'div'>): JSX.Element;
49
+ export type MessageActionProps = Omit<ActionButtonProps, 'tooltip' | 'aria-label'> & {
50
+ /** The action's name: its accessible name and its tooltip. */
51
+ label: string;
52
+ };
53
+ /**
54
+ * One action on a turn: an icon button whose name is also its tooltip, as in
55
+ * AI Elements' MessageAction. Turn actions are icons, never words, so a row of
56
+ * them stays one line under any message.
57
+ */
58
+ export declare function MessageAction(props: MessageActionProps): JSX.Element;
59
+ /** Copies the turn's text and shows a check for a moment once the clipboard took it. */
60
+ export declare function MessageCopyAction(props: Omit<MessageActionProps, 'label' | 'children' | 'onClick'> & {
61
+ text: string | (() => string);
62
+ label?: string;
63
+ }): JSX.Element;
48
64
  export declare function MessageFooter(props: ComponentProps<'footer'>): JSX.Element;
49
65
  /** The props of a fenced block the host may set. */
50
66
  export type MessageCodeBlockProps = Pick<CodeBlockProps, 'loadHighlight' | 'maxHeight' | 'wrap' | 'showLineNumbers' | 'lineMarks' | 'lineLimit'>;
@@ -1 +1 @@
1
- {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/message/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,cAAc,EACnB,KAAK,GAAG,EACT,MAAM,UAAU,CAAA;AAEjB,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AAQ1E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAEzD,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,GAA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CAAC,OAAO,CAAA;CACpD,CAAC,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACvE,IAAI,EAAE,MAAM,CAAA;IACZ,uFAAuF;IACvF,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,qBAAqB,GAAG,CAAC,CAAC,KAAK,EAAE,oBAAoB,KAAK,qBAAqB,CAAC,CAAA;IACjG,mEAAmE;IACnE,SAAS,CAAC,EAAE,gBAAgB,CAAA;CAC7B,CAAA;AAWD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,eA0DlD"}
@@ -1,7 +1,10 @@
1
+ import { createCopyFeedback } from "../../../lib/clipboard.js";
1
2
  import { cn } from "../../../lib/utils.js";
3
+ import { ActionButton } from "../../composites/action-button/action-button.js";
2
4
  import { CodeBlock, InlineCode } from "../code-block/code-block.js";
3
5
  import { parseMessageTextIncremental } from "./parse-message-text.js";
4
6
  import { createComponent, effect, insert, memo, mergeProps, setAttribute, spread, template } from "solid-js/web";
7
+ import { Check, Copy } from "lucide-solid";
5
8
  import { For, Index, Match, Show, Switch, createMemo, splitProps } from "solid-js";
6
9
  // src/components/ui/message/message.tsx
7
10
  var _tmpl$ = /*#__PURE__*/ template(`<article data-slot=message>`);
@@ -118,6 +121,54 @@ function MessageActions(props) {
118
121
  return _el$6;
119
122
  })();
120
123
  }
124
+ /**
125
+ * One action on a turn: an icon button whose name is also its tooltip, as in
126
+ * AI Elements' MessageAction. Turn actions are icons, never words, so a row of
127
+ * them stays one line under any message.
128
+ */
129
+ function MessageAction(props) {
130
+ const [local, rest] = splitProps(props, ["label"]);
131
+ return createComponent(ActionButton, mergeProps({
132
+ type: "button",
133
+ variant: "ghost",
134
+ size: "icon-xs",
135
+ "data-slot": "message-action",
136
+ get ["aria-label"]() {
137
+ return local.label;
138
+ },
139
+ get tooltip() {
140
+ return local.label;
141
+ },
142
+ tooltipSide: "bottom"
143
+ }, rest));
144
+ }
145
+ /** Copies the turn's text and shows a check for a moment once the clipboard took it. */
146
+ function MessageCopyAction(props) {
147
+ const [local, rest] = splitProps(props, ["text", "label"]);
148
+ const feedback = createCopyFeedback();
149
+ const label = () => feedback.copied() ? "Copied" : feedback.failed() ? "Copy failed" : local.label ?? "Copy";
150
+ return createComponent(MessageAction, mergeProps({
151
+ get label() {
152
+ return label();
153
+ },
154
+ onClick: () => {
155
+ const text = typeof local.text === "function" ? local.text() : local.text;
156
+ feedback.copy(text);
157
+ }
158
+ }, rest, { get children() {
159
+ return createComponent(Show, {
160
+ get when() {
161
+ return feedback.copied();
162
+ },
163
+ get fallback() {
164
+ return createComponent(Copy, {});
165
+ },
166
+ get children() {
167
+ return createComponent(Check, {});
168
+ }
169
+ });
170
+ } }));
171
+ }
121
172
  function MessageFooter(props) {
122
173
  const [local, rest] = splitProps(props, ["class", "children"]);
123
174
  return (() => {
@@ -437,6 +488,6 @@ function Inline(props) {
437
488
  } })
438
489
  });
439
490
  }
440
- export { Message, MessageActions, MessageContent, MessageFooter, MessageHeader, MessageText };
491
+ export { Message, MessageAction, MessageActions, MessageContent, MessageCopyAction, MessageFooter, MessageHeader, MessageText };
441
492
 
442
493
  //# sourceMappingURL=message.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"message.js","names":["createMemo","For","Index","Match","Show","splitProps","Switch","cn","CodeBlock","InlineCode","parseMessageTextIncremental","role","label","streaming","anchorId","Message","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","undefined","class","_$insert","children","MessageHeader","avatar","time","_el$2","_tmpl$2","_el$3","firstChild","_$createComponent","when","avatarSlot","_$memo","timeSlot","_el$4","_tmpl$3","MessageContent","_el$5","_tmpl$4","MessageActions","_el$6","_tmpl$5","MessageFooter","_el$7","_tmpl$6","index","language","code","complete","count","render","numbers","text","codeBlockProps","block","citations","sameBlock","a","b","kind","raw","MessageText","previous","previousCount","parsed","citationCount","blocks","next","merged","map","codeIndexes","lastIsProse","last","at","_el$8","_tmpl$8","each","BlockView","codeProps","codeIndex","_tmpl$7","chosen","choice","heading","_el$0","_tmpl$9","Inline","nodes","inline","_$effect","_$setAttribute","level","list","ordered","fallback","_el$10","_tmpl$1","items","item","_el$11","_tmpl$10","_el$1","_tmpl$0","_el$12","start","quote","_el$13","_tmpl$11","paragraph","_el$14","_tmpl$12","node","strong","_el$15","_tmpl$13","em","_el$16","_tmpl$14","link","_el$17","_tmpl$15","href","cite","marker"],"sources":["../../../../src/components/ui/message/message.tsx"],"sourcesContent":["import {\n createMemo,\n For,\n Index,\n Match,\n Show,\n splitProps,\n Switch,\n type ComponentProps,\n type JSX,\n} from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { CodeBlock, InlineCode, type CodeBlockProps } from '../code-block'\nimport {\n parseMessageTextIncremental,\n type MessageBlock,\n type MessageInline,\n type MessageParse,\n} from './parse-message-text'\n\n/**\n * Message.\n *\n * One turn. The two speakers are laid out differently on purpose, and that is\n * the whole design:\n *\n * - **The person's turn is a bubble on the trailing edge** — short, bounded, and\n * easy to find when scrolling back through a long session.\n * - **The assistant's turn is the page.** It has no surface, spans the reading\n * column, and holds everything the agent did *for that request* — activity\n * (a `Trace`), prose, code, a pending decision — in one place, so a turn\n * reads as an answer with its working underneath it rather than as a chain of\n * unrelated cards.\n *\n * `label` is the turn's accessible name (\"You\", \"Assistant\"): the avatar and\n * name are not drawn for every turn, because a transcript that repeats a speaker\n * on every line is one nobody reads, but the name must still be announced.\n * `streaming` sets `aria-busy`, which tells assistive technology to wait for the\n * turn to settle before reading it instead of announcing every token.\n *\n * `anchorId` is the stable identity `MessageScroller` uses to keep the reader's\n * place when older turns are inserted above it.\n */\nexport type MessageRole = 'user' | 'assistant' | 'system'\n\nexport type MessageProps = Omit<ComponentProps<'article'>, 'role'> & {\n role: MessageRole\n label: string\n streaming?: boolean\n anchorId?: string\n}\n\nexport function Message(props: MessageProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'role',\n 'label',\n 'streaming',\n 'anchorId',\n 'children',\n ])\n return (\n <article\n data-slot=\"message\"\n data-role={local.role}\n data-anchor-id={local.anchorId}\n aria-label={local.label}\n aria-busy={local.streaming || undefined}\n class={cn(\n 'group/message mx-auto flex w-full max-w-3xl min-w-0 flex-col gap-2 py-2',\n // The engine may skip layout for turns far off screen; the intrinsic size\n // keeps the scrollbar honest while it does.\n '[content-visibility:auto] [contain-intrinsic-size:auto_6rem]',\n {\n 'items-end ps-[clamp(0rem,12%,4rem)]': local.role === 'user',\n 'items-stretch': local.role !== 'user',\n },\n local.class\n )}\n {...rest}\n >\n {local.children}\n </article>\n )\n}\n\n/** The speaker's mark and name, for the turns that draw one. */\nexport function MessageHeader(\n props: ComponentProps<'header'> & { avatar?: JSX.Element; time?: JSX.Element }\n) {\n const [local, rest] = splitProps(props, ['class', 'avatar', 'time', 'children'])\n return (\n <header\n data-slot=\"message-header\"\n class={cn('flex items-center gap-2 text-xs text-muted-foreground', local.class)}\n {...rest}\n >\n <Show when={local.avatar}>{(avatarSlot) => <>{avatarSlot()}</>}</Show>\n <span class=\"font-medium text-foreground\">{local.children}</span>\n <Show when={local.time}>{(timeSlot) => <span class=\"tabular-nums\">{timeSlot()}</span>}</Show>\n </header>\n )\n}\n\n/** The turn's parts, stacked. Gap is the rhythm between prose, activity and code. */\nexport function MessageContent(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <div\n data-slot=\"message-content\"\n class={cn(\n 'flex w-full max-w-3xl min-w-0 flex-col gap-3 font-content text-content',\n local.class\n )}\n {...rest}\n >\n {local.children}\n </div>\n )\n}\n\n/**\n * Actions that belong to the turn (copy, retry). Hidden until the turn is hovered\n * or focused so the column is not a wall of buttons, but never `display: none`:\n * a control that only exists under the pointer cannot be reached by keyboard,\n * and on a touch screen there is no hover, so coarse pointers always see them.\n */\nexport function MessageActions(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <div\n data-slot=\"message-actions\"\n class={cn(\n 'flex items-center gap-1 opacity-0 transition-opacity ease-out group-focus-within/message:opacity-100 group-hover/message:opacity-100 [@media(hover:none)]:opacity-100',\n local.class\n )}\n {...rest}\n >\n {local.children}\n </div>\n )\n}\n\nexport function MessageFooter(props: ComponentProps<'footer'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <footer\n data-slot=\"message-footer\"\n class={cn('flex min-w-0 items-center gap-2 text-xs text-muted-foreground', local.class)}\n {...rest}\n >\n {local.children}\n </footer>\n )\n}\n\n/** The props of a fenced block the host may set. */\nexport type MessageCodeBlockProps = Pick<\n CodeBlockProps,\n 'loadHighlight' | 'maxHeight' | 'wrap' | 'showLineNumbers' | 'lineMarks' | 'lineLimit'\n>\n\n/** What the host is told about a fenced block when it chooses that block's props. */\nexport type MessageCodeBlockInfo = Readonly<{\n /** Position among the text's fenced blocks, from 0. */\n index: number\n language: string | undefined\n code: string\n complete: boolean\n}>\n\n/**\n * How `MessageText` draws citation markers. `count` is how many sources the host\n * has; a `[^n]` marker is a citation only when every `n` is within it. `render`\n * receives the 1-based source numbers and draws the marker, so the host decides\n * what a number means (`messageCitations` in the inline-citation composite does\n * this for a `Source` list).\n */\nexport type MessageCitations = Readonly<{\n count: number\n render: (numbers: readonly number[]) => JSX.Element\n}>\n\nexport type MessageTextProps = Omit<ComponentProps<'div'>, 'children'> & {\n text: string\n /** True while text may still arrive: a trailing open fence renders as partial code. */\n streaming?: boolean\n /**\n * Forwarded to each fenced block, e.g. to supply a lazy highlighter. A function\n * chooses per block, which is how line marks reach a block: marks belong to the\n * host's knowledge of the code (a diff, a failing line), never to the text.\n */\n codeBlockProps?: MessageCodeBlockProps | ((block: MessageCodeBlockInfo) => MessageCodeBlockProps)\n /** Without it, `[^1]` stays the literal text it was written as. */\n citations?: MessageCitations\n}\n\nfunction sameBlock(a: MessageBlock | undefined, b: MessageBlock): boolean {\n return (\n a !== undefined &&\n a.kind === b.kind &&\n a.raw === b.raw &&\n (a.kind !== 'code' || (b.kind === 'code' && a.complete === b.complete))\n )\n}\n\n/**\n * Text, read safely.\n *\n * Renders `parseMessageText`'s blocks as elements: nothing is interpreted as\n * HTML and a link only becomes an anchor when its scheme is http, https or\n * mailto. Blocks are kept by *position* and reuse their previous parsed object\n * when unchanged, so a streaming turn updates the block that is growing and\n * leaves every earlier paragraph and code block — and any selection or focus\n * inside them — untouched.\n */\nexport function MessageText(props: MessageTextProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'text',\n 'streaming',\n 'codeBlockProps',\n 'citations',\n ])\n let previous: readonly MessageBlock[] = []\n let previousCount = 0\n let parsed: MessageParse | undefined\n // Only the number of sources reaches the parser, so a new `render` function\n // does not reparse the text, and a changed count does.\n const citationCount = () => local.citations?.count ?? 0\n const blocks = createMemo(() => {\n const count = citationCount()\n if (count !== previousCount) previous = []\n previousCount = count\n // A streamed reply only grows, so each delta parses the tail it touched\n // rather than the whole reply (which made a long reply quadratic).\n parsed = parseMessageTextIncremental(parsed, local.text, {\n streaming: local.streaming,\n citations: count || undefined,\n })\n const next = parsed.blocks\n const merged = next.map((block, index) =>\n sameBlock(previous[index], block) ? previous[index]! : block\n )\n previous = merged\n return merged\n })\n // The nth fenced block, so a host can address it. Blocks keep their positions\n // while text streams in after them, so an index stays attached to its block.\n const codeIndexes = createMemo(() => {\n let next = 0\n return blocks().map((block) => (block.kind === 'code' ? next++ : -1))\n })\n const lastIsProse = () => {\n const last = blocks().at(-1)\n return last !== undefined && last.kind !== 'code'\n }\n return (\n <div data-slot=\"message-text\" class={cn('flex min-w-0 flex-col gap-3', local.class)} {...rest}>\n <Index each={blocks()}>\n {(block, index) => (\n <BlockView\n block={block()}\n codeProps={local.codeBlockProps}\n codeIndex={() => codeIndexes()[index] ?? 0}\n citations={local.citations}\n />\n )}\n </Index>\n <Show when={local.streaming && lastIsProse()}>\n <span class=\"streaming-caret\" aria-hidden=\"true\" />\n </Show>\n </div>\n )\n}\n\nfunction BlockView(props: {\n block: MessageBlock\n codeProps?: MessageTextProps['codeBlockProps']\n codeIndex: () => number\n citations?: MessageCitations\n}) {\n return (\n <Switch>\n <Match when={props.block.kind === 'code' && props.block}>\n {(block) => {\n const code = () => block() as Extract<MessageBlock, { kind: 'code' }>\n const chosen = () => {\n const choice = props.codeProps\n return typeof choice === 'function'\n ? choice({\n index: props.codeIndex(),\n language: code().language,\n code: code().code,\n complete: code().complete,\n })\n : choice\n }\n return (\n <CodeBlock\n code={code().code}\n language={code().language}\n complete={code().complete}\n {...chosen()}\n />\n )\n }}\n </Match>\n <Match when={props.block.kind === 'heading' && props.block}>\n {(block) => {\n const heading = () => block() as Extract<MessageBlock, { kind: 'heading' }>\n return (\n <p\n role=\"heading\"\n aria-level={heading().level + 2}\n class=\"font-semibold text-foreground [overflow-wrap:anywhere]\"\n >\n <Inline nodes={heading().inline} citations={props.citations} />\n </p>\n )\n }}\n </Match>\n <Match when={props.block.kind === 'list' && props.block}>\n {(block) => {\n const list = () => block() as Extract<MessageBlock, { kind: 'list' }>\n return (\n <Show\n when={list().ordered}\n fallback={\n <ul class=\"m-0 ms-5 flex list-disc flex-col gap-1 p-0 marker:text-muted-foreground\">\n <For each={list().items}>\n {(item) => (\n <li class=\"[overflow-wrap:anywhere]\">\n <Inline nodes={item} citations={props.citations} />\n </li>\n )}\n </For>\n </ul>\n }\n >\n <ol\n start={list().start}\n class=\"m-0 ms-5 flex list-decimal flex-col gap-1 p-0 marker:text-muted-foreground\"\n >\n <For each={list().items}>\n {(item) => (\n <li class=\"[overflow-wrap:anywhere]\">\n <Inline nodes={item} citations={props.citations} />\n </li>\n )}\n </For>\n </ol>\n </Show>\n )\n }}\n </Match>\n <Match when={props.block.kind === 'quote' && props.block}>\n {(block) => {\n const quote = () => block() as Extract<MessageBlock, { kind: 'quote' }>\n return (\n <blockquote class=\"m-0 border-s-2 border-border ps-3 whitespace-pre-wrap text-muted-foreground [overflow-wrap:anywhere]\">\n <Inline nodes={quote().inline} citations={props.citations} />\n </blockquote>\n )\n }}\n </Match>\n <Match when={props.block.kind === 'paragraph' && props.block}>\n {(block) => {\n const paragraph = () => block() as Extract<MessageBlock, { kind: 'paragraph' }>\n return (\n <p class=\"m-0 whitespace-pre-wrap [overflow-wrap:anywhere]\">\n <Inline nodes={paragraph().inline} citations={props.citations} />\n </p>\n )\n }}\n </Match>\n </Switch>\n )\n}\n\nfunction Inline(props: { nodes: readonly MessageInline[]; citations?: MessageCitations }) {\n // By position, not identity: the parser returns fresh nodes for the growing\n // paragraph on every streamed token, and a keyed list would rebuild each one.\n return (\n <Index each={props.nodes}>\n {(node) => (\n <Switch>\n {/* Fragments keep the reads reactive: Match runs its callback untracked. */}\n <Match when={node().kind === 'text' && node()}>\n {(text) => <>{(text() as { text: string }).text}</>}\n </Match>\n <Match when={node().kind === 'code' && node()}>\n {(code) => <InlineCode>{(code() as { text: string }).text}</InlineCode>}\n </Match>\n <Match when={node().kind === 'strong' && node()}>\n {(strong) => (\n <strong class=\"font-semibold\">\n <Inline\n nodes={(strong() as { children: readonly MessageInline[] }).children}\n citations={props.citations}\n />\n </strong>\n )}\n </Match>\n <Match when={node().kind === 'em' && node()}>\n {(em) => (\n <em>\n <Inline\n nodes={(em() as { children: readonly MessageInline[] }).children}\n citations={props.citations}\n />\n </em>\n )}\n </Match>\n <Match when={node().kind === 'link' && node()}>\n {(link) => (\n <a\n href={(link() as { href: string }).href}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class=\"text-primary underline underline-offset-2 hover:no-underline\"\n >\n <Inline nodes={(link() as { children: readonly MessageInline[] }).children} />\n </a>\n )}\n </Match>\n <Match when={node().kind === 'cite' && node()}>\n {(cite) => {\n const marker = () => cite() as { numbers: readonly number[]; raw: string }\n // The parser read this as a citation only while the host had sources;\n // if they have gone since, the marker is the text it was written as.\n // Match invokes this callback untracked; JSX keeps renderer and\n // same-count source replacements reactive without replacing the block.\n return (\n <>{props.citations ? props.citations.render(marker().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OAAO,CAAC,CAAC/D,GAAG;KAEhF;IAAC,CAAA;GAAA;EAAA,EAAA,CAAA;CAGN,CAAA;AAGP"}
1
+ {"version":3,"file":"message.js","names":["createMemo","For","Index","Match","Show","splitProps","Switch","Check","Copy","createCopyFeedback","cn","ActionButton","CodeBlock","InlineCode","parseMessageTextIncremental","role","label","streaming","anchorId","Message","props","local","rest","_el$","_tmpl$","_$spread","_$mergeProps","undefined","class","_$insert","children","MessageHeader","avatar","time","_el$2","_tmpl$2","_el$3","firstChild","_$createComponent","when","avatarSlot","_$memo","timeSlot","_el$4","_tmpl$3","MessageContent","_el$5","_tmpl$4","MessageActions","_el$6","_tmpl$5","MessageAction","type","variant","size","tooltip","tooltipSide","MessageCopyAction","text","feedback","copied","failed","onClick","copy","fallback","MessageFooter","_el$7","_tmpl$6","index","language","code","complete","count","render","numbers","codeBlockProps","block","citations","sameBlock","a","b","kind","raw","MessageText","previous","previousCount","parsed","citationCount","blocks","next","merged","map","codeIndexes","lastIsProse","last","at","_el$8","_tmpl$8","each","BlockView","codeProps","codeIndex","_tmpl$7","chosen","choice","heading","_el$0","_tmpl$9","Inline","nodes","inline","_$effect","_$setAttribute","level","list","ordered","_el$10","_tmpl$1","items","item","_el$11","_tmpl$10","_el$1","_tmpl$0","_el$12","start","quote","_el$13","_tmpl$11","paragraph","_el$14","_tmpl$12","node","strong","_el$15","_tmpl$13","em","_el$16","_tmpl$14","link","_el$17","_tmpl$15","href","cite","marker"],"sources":["../../../../src/components/ui/message/message.tsx"],"sourcesContent":["import {\n createMemo,\n For,\n Index,\n Match,\n Show,\n splitProps,\n Switch,\n type ComponentProps,\n type JSX,\n} from 'solid-js'\nimport { Check, Copy } from 'lucide-solid'\nimport { createCopyFeedback } from '#lib/clipboard'\nimport { cn } from '#lib/utils'\nimport { ActionButton, type ActionButtonProps } from '../../composites/action-button'\nimport { CodeBlock, InlineCode, type CodeBlockProps } from '../code-block'\nimport {\n parseMessageTextIncremental,\n type MessageBlock,\n type MessageInline,\n type MessageParse,\n} from './parse-message-text'\n\n/**\n * Message.\n *\n * One turn. The two speakers are laid out differently on purpose, and that is\n * the whole design:\n *\n * - **The person's turn is a bubble on the trailing edge** — short, bounded, and\n * easy to find when scrolling back through a long session.\n * - **The assistant's turn is the page.** It has no surface, spans the reading\n * column, and holds everything the agent did *for that request* — activity\n * (a `Trace`), prose, code, a pending decision — in one place, so a turn\n * reads as an answer with its working underneath it rather than as a chain of\n * unrelated cards.\n *\n * `label` is the turn's accessible name (\"You\", \"Assistant\"): the avatar and\n * name are not drawn for every turn, because a transcript that repeats a speaker\n * on every line is one nobody reads, but the name must still be announced.\n * `streaming` sets `aria-busy`, which tells assistive technology to wait for the\n * turn to settle before reading it instead of announcing every token.\n *\n * `anchorId` is the stable identity `MessageScroller` uses to keep the reader's\n * place when older turns are inserted above it.\n */\nexport type MessageRole = 'user' | 'assistant' | 'system'\n\nexport type MessageProps = Omit<ComponentProps<'article'>, 'role'> & {\n role: MessageRole\n label: string\n streaming?: boolean\n anchorId?: string\n}\n\nexport function Message(props: MessageProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'role',\n 'label',\n 'streaming',\n 'anchorId',\n 'children',\n ])\n return (\n <article\n data-slot=\"message\"\n data-role={local.role}\n data-anchor-id={local.anchorId}\n aria-label={local.label}\n aria-busy={local.streaming || undefined}\n class={cn(\n 'group/message mx-auto flex w-full max-w-3xl min-w-0 flex-col gap-2 py-2',\n // The engine may skip layout for turns far off screen; the intrinsic size\n // keeps the scrollbar honest while it does.\n '[content-visibility:auto] [contain-intrinsic-size:auto_6rem]',\n {\n 'items-end ps-[clamp(0rem,12%,4rem)]': local.role === 'user',\n 'items-stretch': local.role !== 'user',\n },\n local.class\n )}\n {...rest}\n >\n {local.children}\n </article>\n )\n}\n\n/** The speaker's mark and name, for the turns that draw one. */\nexport function MessageHeader(\n props: ComponentProps<'header'> & { avatar?: JSX.Element; time?: JSX.Element }\n) {\n const [local, rest] = splitProps(props, ['class', 'avatar', 'time', 'children'])\n return (\n <header\n data-slot=\"message-header\"\n class={cn('flex items-center gap-2 text-xs text-muted-foreground', local.class)}\n {...rest}\n >\n <Show when={local.avatar}>{(avatarSlot) => <>{avatarSlot()}</>}</Show>\n <span class=\"font-medium text-foreground\">{local.children}</span>\n <Show when={local.time}>{(timeSlot) => <span class=\"tabular-nums\">{timeSlot()}</span>}</Show>\n </header>\n )\n}\n\n/** The turn's parts, stacked. Gap is the rhythm between prose, activity and code. */\nexport function MessageContent(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <div\n data-slot=\"message-content\"\n class={cn(\n 'flex w-full max-w-3xl min-w-0 flex-col gap-3 font-content text-content',\n local.class\n )}\n {...rest}\n >\n {local.children}\n </div>\n )\n}\n\n/**\n * Actions that belong to the turn (copy, retry). Hidden until the turn is hovered\n * or focused so the column is not a wall of buttons, but never `display: none`:\n * a control that only exists under the pointer cannot be reached by keyboard,\n * and on a touch screen there is no hover, so coarse pointers always see them.\n */\nexport function MessageActions(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <div\n data-slot=\"message-actions\"\n class={cn(\n 'flex items-center gap-1 opacity-0 transition-opacity ease-out group-focus-within/message:opacity-100 group-hover/message:opacity-100 [@media(hover:none)]:opacity-100',\n local.class\n )}\n {...rest}\n >\n {local.children}\n </div>\n )\n}\n\nexport type MessageActionProps = Omit<ActionButtonProps, 'tooltip' | 'aria-label'> & {\n /** The action's name: its accessible name and its tooltip. */\n label: string\n}\n\n/**\n * One action on a turn: an icon button whose name is also its tooltip, as in\n * AI Elements' MessageAction. Turn actions are icons, never words, so a row of\n * them stays one line under any message.\n */\nexport function MessageAction(props: MessageActionProps) {\n const [local, rest] = splitProps(props, ['label'])\n return (\n <ActionButton\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-xs\"\n data-slot=\"message-action\"\n aria-label={local.label}\n tooltip={local.label}\n tooltipSide=\"bottom\"\n {...(rest as ActionButtonProps)}\n />\n )\n}\n\n/** Copies the turn's text and shows a check for a moment once the clipboard took it. */\nexport function MessageCopyAction(\n props: Omit<MessageActionProps, 'label' | 'children' | 'onClick'> & {\n text: string | (() => string)\n label?: string\n }\n) {\n const [local, rest] = splitProps(props, ['text', 'label'])\n const feedback = createCopyFeedback()\n const label = () =>\n feedback.copied() ? 'Copied' : feedback.failed() ? 'Copy failed' : (local.label ?? 'Copy')\n return (\n <MessageAction\n label={label()}\n onClick={() => {\n const text = typeof local.text === 'function' ? local.text() : local.text\n void feedback.copy(text)\n }}\n {...rest}\n >\n <Show when={feedback.copied()} fallback={<Copy />}>\n <Check />\n </Show>\n </MessageAction>\n )\n}\n\nexport function MessageFooter(props: ComponentProps<'footer'>) {\n const [local, rest] = splitProps(props, ['class', 'children'])\n return (\n <footer\n data-slot=\"message-footer\"\n class={cn('flex min-w-0 items-center gap-2 text-xs text-muted-foreground', local.class)}\n {...rest}\n >\n {local.children}\n </footer>\n )\n}\n\n/** The props of a fenced block the host may set. */\nexport type MessageCodeBlockProps = Pick<\n CodeBlockProps,\n 'loadHighlight' | 'maxHeight' | 'wrap' | 'showLineNumbers' | 'lineMarks' | 'lineLimit'\n>\n\n/** What the host is told about a fenced block when it chooses that block's props. */\nexport type MessageCodeBlockInfo = Readonly<{\n /** Position among the text's fenced blocks, from 0. */\n index: number\n language: string | undefined\n code: string\n complete: boolean\n}>\n\n/**\n * How `MessageText` draws citation markers. `count` is how many sources the host\n * has; a `[^n]` marker is a citation only when every `n` is within it. `render`\n * receives the 1-based source numbers and draws the marker, so the host decides\n * what a number means (`messageCitations` in the inline-citation composite does\n * this for a `Source` list).\n */\nexport type MessageCitations = Readonly<{\n count: number\n render: (numbers: readonly number[]) => JSX.Element\n}>\n\nexport type MessageTextProps = Omit<ComponentProps<'div'>, 'children'> & {\n text: string\n /** True while text may still arrive: a trailing open fence renders as partial code. */\n streaming?: boolean\n /**\n * Forwarded to each fenced block, e.g. to supply a lazy highlighter. A function\n * chooses per block, which is how line marks reach a block: marks belong to the\n * host's knowledge of the code (a diff, a failing line), never to the text.\n */\n codeBlockProps?: MessageCodeBlockProps | ((block: MessageCodeBlockInfo) => MessageCodeBlockProps)\n /** Without it, `[^1]` stays the literal text it was written as. */\n citations?: MessageCitations\n}\n\nfunction sameBlock(a: MessageBlock | undefined, b: MessageBlock): boolean {\n return (\n a !== undefined &&\n a.kind === b.kind &&\n a.raw === b.raw &&\n (a.kind !== 'code' || (b.kind === 'code' && a.complete === b.complete))\n )\n}\n\n/**\n * Text, read safely.\n *\n * Renders `parseMessageText`'s blocks as elements: nothing is interpreted as\n * HTML and a link only becomes an anchor when its scheme is http, https or\n * mailto. Blocks are kept by *position* and reuse their previous parsed object\n * when unchanged, so a streaming turn updates the block that is growing and\n * leaves every earlier paragraph and code block — and any selection or focus\n * inside them — untouched.\n */\nexport function MessageText(props: MessageTextProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'text',\n 'streaming',\n 'codeBlockProps',\n 'citations',\n ])\n let previous: readonly MessageBlock[] = []\n let previousCount = 0\n let parsed: MessageParse | undefined\n // Only the number of sources reaches the parser, so a new `render` function\n // does not reparse the text, and a changed count does.\n const citationCount = () => local.citations?.count ?? 0\n const blocks = createMemo(() => {\n const count = citationCount()\n if (count !== previousCount) previous = []\n previousCount = count\n // A streamed reply only grows, so each delta parses the tail it touched\n // rather than the whole reply (which made a long reply quadratic).\n parsed = parseMessageTextIncremental(parsed, local.text, {\n streaming: local.streaming,\n citations: count || undefined,\n })\n const next = parsed.blocks\n const merged = next.map((block, index) =>\n sameBlock(previous[index], block) ? previous[index]! : block\n )\n previous = merged\n return merged\n })\n // The nth fenced block, so a host can address it. Blocks keep their positions\n // while text streams in after them, so an index stays attached to its block.\n const codeIndexes = createMemo(() => {\n let next = 0\n return blocks().map((block) => (block.kind === 'code' ? next++ : -1))\n })\n const lastIsProse = () => {\n const last = blocks().at(-1)\n return last !== undefined && last.kind !== 'code'\n }\n return (\n <div data-slot=\"message-text\" class={cn('flex min-w-0 flex-col gap-3', local.class)} {...rest}>\n <Index each={blocks()}>\n {(block, index) => (\n <BlockView\n block={block()}\n codeProps={local.codeBlockProps}\n codeIndex={() => codeIndexes()[index] ?? 0}\n citations={local.citations}\n />\n )}\n </Index>\n <Show when={local.streaming && lastIsProse()}>\n <span class=\"streaming-caret\" aria-hidden=\"true\" />\n </Show>\n </div>\n )\n}\n\nfunction BlockView(props: {\n block: MessageBlock\n codeProps?: MessageTextProps['codeBlockProps']\n codeIndex: () => number\n citations?: MessageCitations\n}) {\n return (\n <Switch>\n <Match when={props.block.kind === 'code' && props.block}>\n {(block) => {\n const code = () => block() as Extract<MessageBlock, { kind: 'code' }>\n const chosen = () => {\n const choice = props.codeProps\n return typeof choice === 'function'\n ? choice({\n index: props.codeIndex(),\n language: code().language,\n code: code().code,\n complete: code().complete,\n })\n : choice\n }\n return (\n <CodeBlock\n code={code().code}\n language={code().language}\n complete={code().complete}\n {...chosen()}\n />\n )\n }}\n </Match>\n <Match when={props.block.kind === 'heading' && props.block}>\n {(block) => {\n const heading = () => block() as Extract<MessageBlock, { kind: 'heading' }>\n return (\n <p\n role=\"heading\"\n aria-level={heading().level + 2}\n class=\"font-semibold text-foreground [overflow-wrap:anywhere]\"\n >\n <Inline nodes={heading().inline} citations={props.citations} />\n </p>\n )\n }}\n </Match>\n <Match when={props.block.kind === 'list' && props.block}>\n {(block) => {\n const list = () => block() as Extract<MessageBlock, { kind: 'list' }>\n return (\n <Show\n when={list().ordered}\n fallback={\n <ul class=\"m-0 ms-5 flex list-disc flex-col gap-1 p-0 marker:text-muted-foreground\">\n <For each={list().items}>\n {(item) => (\n <li class=\"[overflow-wrap:anywhere]\">\n <Inline nodes={item} citations={props.citations} />\n </li>\n )}\n </For>\n </ul>\n }\n >\n <ol\n start={list().start}\n class=\"m-0 ms-5 flex list-decimal flex-col gap-1 p-0 marker:text-muted-foreground\"\n >\n <For each={list().items}>\n {(item) => (\n <li class=\"[overflow-wrap:anywhere]\">\n <Inline nodes={item} citations={props.citations} />\n </li>\n )}\n </For>\n </ol>\n </Show>\n )\n }}\n </Match>\n <Match when={props.block.kind === 'quote' && props.block}>\n {(block) => {\n const quote = () => block() as Extract<MessageBlock, { kind: 'quote' }>\n return (\n <blockquote class=\"m-0 border-s-2 border-border ps-3 whitespace-pre-wrap text-muted-foreground [overflow-wrap:anywhere]\">\n <Inline nodes={quote().inline} citations={props.citations} />\n </blockquote>\n )\n }}\n </Match>\n <Match when={props.block.kind === 'paragraph' && props.block}>\n {(block) => {\n const paragraph = () => block() as Extract<MessageBlock, { kind: 'paragraph' }>\n return (\n <p class=\"m-0 whitespace-pre-wrap [overflow-wrap:anywhere]\">\n <Inline nodes={paragraph().inline} citations={props.citations} />\n </p>\n )\n }}\n </Match>\n </Switch>\n )\n}\n\nfunction Inline(props: { nodes: readonly MessageInline[]; citations?: MessageCitations }) {\n // By position, not identity: the parser returns fresh nodes for the growing\n // paragraph on every streamed token, and a keyed list would rebuild each one.\n return (\n <Index each={props.nodes}>\n {(node) => (\n <Switch>\n {/* Fragments keep the reads reactive: Match runs its callback untracked. */}\n <Match when={node().kind === 'text' && node()}>\n {(text) => <>{(text() as { text: string }).text}</>}\n </Match>\n <Match when={node().kind === 'code' && node()}>\n {(code) => <InlineCode>{(code() as { text: string }).text}</InlineCode>}\n </Match>\n <Match when={node().kind === 'strong' && node()}>\n {(strong) => (\n <strong class=\"font-semibold\">\n <Inline\n nodes={(strong() as { children: readonly MessageInline[] }).children}\n citations={props.citations}\n />\n </strong>\n )}\n </Match>\n <Match when={node().kind === 'em' && node()}>\n {(em) => (\n <em>\n <Inline\n nodes={(em() as { children: readonly MessageInline[] }).children}\n citations={props.citations}\n />\n </em>\n )}\n </Match>\n <Match when={node().kind === 'link' && node()}>\n {(link) => (\n <a\n href={(link() as { href: string }).href}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n class=\"text-primary underline underline-offset-2 hover:no-underline\"\n >\n <Inline nodes={(link() as { children: readonly MessageInline[] }).children} />\n </a>\n )}\n </Match>\n <Match when={node().kind === 'cite' && node()}>\n {(cite) => {\n const marker = () => cite() as { numbers: readonly number[]; raw: string }\n // The parser read this as a citation only while the host had sources;\n // if they have gone since, the marker is the text it was written as.\n // Match invokes this callback untracked; JSX keeps renderer and\n // same-count source replacements reactive without replacing the block.\n return (\n <>{props.citations ? props.citations.render(marker().numbers) : marker().raw}</>\n )\n }}\n </Match>\n </Switch>\n )}\n </Index>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,SAAgBmB,QAAQC,OAAqB;CAC3C,MAAM,CAACC,OAAOC,QAAQjB,WAAWe,OAAO;EACtC;EACA;EACA;EACA;EACA;EACA;CAAU,CACX;CACD,cAAA;EAAA,IAAAG,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA;GAAA,KAAA,eAAA;IAAA,OAGeL,MAAMN;GAAI;GAAA,KAAA,oBAAA;IAAA,OACLM,MAAMH;GAAQ;GAAA,KAAA,gBAAA;IAAA,OAClBG,MAAML;GAAK;GAAA,KAAA,eAAA;IAAA,OACZK,MAAMJ,aAAaU,KAAAA;GAAS;GAAA,KAAA,WAAA;IAAA,OAChCjB,GACL,2EAGA,gEACA;KACE,uCAAuCW,MAAMN,SAAS;KACtD,iBAAiBM,MAAMN,SAAS;IAClC,GACAM,MAAMO,KACR;GAAC;EAAA,GACGN,IAAI,GAAA,OAAA,IAAA;EAAAO,OAAAN,YAEPF,MAAMS,QAAQ;EAAA,OAAAP;CAAA,EAAA,CAAA;AAGrB;;AAGA,SAAgBQ,cACdX,OACA;CACA,MAAM,CAACC,OAAOC,QAAQjB,WAAWe,OAAO;EAAC;EAAS;EAAU;EAAQ;CAAU,CAAC;CAC/E,cAAA;EAAA,IAAAc,QAAAC,QAAA,GAAAC,QAAAF,MAAAG;EAAAZ,OAAAS,OAAAR,WAAA,EAAA,KAAA,WAAA;GAAA,OAGWhB,GAAG,yDAAyDW,MAAMO,KAAK;EAAC,EAAA,GA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UAAUJ,OAAOuE,OAAO,CAAC,CAACtE,OAAO,IAAIsE,OAAO,CAAC,CAAC9D,GAAG;KAEhF;IAAC,CAAA;GAAA;EAAA,EAAA,CAAA;CAGN,CAAA;AAGP"}
@@ -291,7 +291,7 @@ function TooltipContent(props) {
291
291
  return createComponent(Tooltip.Content, mergeProps({
292
292
  "data-slot": "tooltip-content",
293
293
  get ["class"]() {
294
- return cn(tooltipTip, "z-(--z-tooltip) w-fit max-w-(--tooltip-max-width) px-2 py-1", "origin-(--kb-tooltip-content-transform-origin) text-balance", tooltipMotion, { "flex items-center gap-2 whitespace-nowrap": !!icon() }, local.class);
294
+ return cn(tooltipTip, "z-(--z-tooltip) w-fit max-w-(--tooltip-max-width) px-3 py-1.5", "origin-(--kb-tooltip-content-transform-origin) text-balance", tooltipMotion, { "flex items-center gap-2 whitespace-nowrap": !!icon() }, local.class);
295
295
  },
296
296
  style: { "pointer-events": "none" },
297
297
  get ["aria-hidden"]() {