@actioneer/ads 0.7.0 → 0.8.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.
@@ -8,7 +8,7 @@ import { Plus as _, FileText as h, WarningCircle as R, At as L, Bolt as S, Close
8
8
  import { Spinner as v } from "../spinner.js";
9
9
  import { CONTEXT_MIME as D } from "./composer-add-context.js";
10
10
  import { HARNESS_MIME as F } from "./composer-harness.js";
11
- import { ComposerPrimitive as z, useComposerRuntime as k, MessagePrimitive as M, useAui as O, useAuiState as l, AttachmentPrimitive as s } from "@assistant-ui/react";
11
+ import { ComposerPrimitive as z, useComposerRuntime as j, MessagePrimitive as M, useAui as O, useAuiState as l, AttachmentPrimitive as s } from "@assistant-ui/react";
12
12
  import { useShallow as H } from "zustand/shallow";
13
13
  import { Tooltip as $, TooltipTrigger as q, TooltipContent as B } from "../ui/tooltip.js";
14
14
  import { Dialog as G, DialogTrigger as W, DialogContent as X, DialogTitle as Y } from "../ui/dialog.js";
@@ -27,7 +27,7 @@ const V = (a) => {
27
27
  URL.revokeObjectURL(n);
28
28
  };
29
29
  }, [a]), t;
30
- }, j = () => {
30
+ }, k = () => {
31
31
  const { file: a, src: t } = l(
32
32
  H((r) => {
33
33
  var c, m;
@@ -71,7 +71,7 @@ const V = (a) => {
71
71
  }
72
72
  );
73
73
  }, ee = ({ children: a }) => {
74
- const t = j();
74
+ const t = k();
75
75
  return t ? /* @__PURE__ */ i(G, { children: [
76
76
  /* @__PURE__ */ e(
77
77
  W,
@@ -87,7 +87,7 @@ const V = (a) => {
87
87
  ] })
88
88
  ] }) : a;
89
89
  }, te = () => {
90
- const a = j();
90
+ const a = k();
91
91
  return /* @__PURE__ */ i(J, { className: "aui-attachment-tile-avatar h-full w-full rounded-none", children: [
92
92
  /* @__PURE__ */ e(
93
93
  K,
@@ -219,7 +219,7 @@ const V = (a) => {
219
219
  f,
220
220
  {
221
221
  tooltip: "Remove file",
222
- className: "aui-attachment-tile-remove text-muted-foreground hover:[&_svg]:text-destructive absolute end-1.5 top-1.5 size-3.5 rounded-full bg-white opacity-100 shadow-sm hover:bg-white! [&_svg]:text-black",
222
+ className: "aui-attachment-tile-remove text-muted-foreground hover:[&_svg]:text-destructive absolute end-1.5 top-1.5 size-3.5 rounded-full bg-card opacity-100 shadow-100 hover:bg-card! [&_svg]:text-foreground",
223
223
  side: "top",
224
224
  children: /* @__PURE__ */ e(T, { className: "aui-attachment-remove-icon size-3" })
225
225
  }
@@ -299,8 +299,8 @@ class ze {
299
299
  async remove() {
300
300
  }
301
301
  }
302
- const ke = () => {
303
- const a = k(), t = w(null), r = (n) => {
302
+ const je = () => {
303
+ const a = j(), t = w(null), r = (n) => {
304
304
  if (n != null && n.length)
305
305
  for (const c of Array.from(n))
306
306
  c.type.startsWith("image/") && !se.has(c.type) || a.addAttachment(c);
@@ -337,8 +337,8 @@ const ke = () => {
337
337
  }
338
338
  )
339
339
  ] });
340
- }, je = () => {
341
- const a = k(), t = w(null);
340
+ }, ke = () => {
341
+ const a = j(), t = w(null);
342
342
  return /* @__PURE__ */ i(N, { children: [
343
343
  /* @__PURE__ */ e(
344
344
  "input",
@@ -378,8 +378,8 @@ export {
378
378
  b as ACTIONEER_FILE_ACCEPT,
379
379
  ze as ActioneerFileAttachmentAdapter,
380
380
  Te as ComposerAddAttachment,
381
- je as ComposerAddDocument,
382
- ke as ComposerAddImage,
381
+ ke as ComposerAddDocument,
382
+ je as ComposerAddImage,
383
383
  Re as ComposerAttachments,
384
384
  Ce as UserMessageAttachments
385
385
  };
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { jsx as d } from "react/jsx-runtime";
3
- import { Slot as s } from "radix-ui";
4
- import { cva as g } from "class-variance-authority";
5
- import { cn as u } from "../../lib/cn.js";
6
- const i = g(
2
+ import { jsx as s } from "react/jsx-runtime";
3
+ import { Slot as g } from "radix-ui";
4
+ import { cva as d } from "class-variance-authority";
5
+ import { cn as i } from "../../lib/cn.js";
6
+ const c = d(
7
7
  "inline-flex items-center justify-center gap-1 rounded-md text-xs font-medium transition-colors [&_svg]:size-3 [&_svg]:shrink-0",
8
8
  {
9
9
  variants: {
@@ -12,10 +12,10 @@ const i = g(
12
12
  secondary: "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/80",
13
13
  muted: "bg-muted text-muted-foreground [a&]:hover:bg-accent [a&]:hover:text-foreground",
14
14
  ghost: "text-muted-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground bg-transparent",
15
- info: "bg-blue-100 text-blue-700 [a&]:hover:bg-blue-100/80",
16
- warning: "bg-amber-100 text-amber-700 [a&]:hover:bg-amber-100/80",
17
- success: "bg-emerald-100 text-emerald-700 [a&]:hover:bg-emerald-100/80",
18
- destructive: "bg-red-100 text-red-700 [a&]:hover:bg-red-100/80"
15
+ info: "bg-info-100 text-info-700 [a&]:hover:bg-info-100/80",
16
+ warning: "bg-warning-100 text-warning-700 [a&]:hover:bg-warning-100/80",
17
+ success: "bg-success-100 text-success-700 [a&]:hover:bg-success-100/80",
18
+ destructive: "bg-danger-100 text-danger-700 [a&]:hover:bg-danger-100/80"
19
19
  },
20
20
  size: {
21
21
  sm: "px-1.5 py-0.5",
@@ -29,26 +29,26 @@ const i = g(
29
29
  }
30
30
  }
31
31
  );
32
- function l({
32
+ function x({
33
33
  className: r,
34
34
  variant: e,
35
35
  size: t,
36
36
  asChild: a = !1,
37
- ...o
37
+ ...n
38
38
  }) {
39
- const n = a ? s.Root : "span";
40
- return /* @__PURE__ */ d(
41
- n,
39
+ const o = a ? g.Root : "span";
40
+ return /* @__PURE__ */ s(
41
+ o,
42
42
  {
43
43
  "data-slot": "badge",
44
44
  "data-variant": e,
45
45
  "data-size": t,
46
- className: u(i({ variant: e, size: t }), r),
47
- ...o
46
+ className: i(c({ variant: e, size: t }), r),
47
+ ...n
48
48
  }
49
49
  );
50
50
  }
51
51
  export {
52
- l as Badge,
53
- i as badgeVariants
52
+ x as Badge,
53
+ c as badgeVariants
54
54
  };
@@ -47,7 +47,7 @@ const _ = ({
47
47
  loadingLabel: a
48
48
  }) => {
49
49
  const { isLoading: l } = N();
50
- return /* @__PURE__ */ e(n.Unstable_TriggerPopoverItems, { children: (g) => /* @__PURE__ */ s(
50
+ return /* @__PURE__ */ e(n.Unstable_TriggerPopoverItems, { children: (p) => /* @__PURE__ */ s(
51
51
  "div",
52
52
  {
53
53
  "data-slot": "composer-trigger-popover-items",
@@ -58,9 +58,9 @@ const _ = ({
58
58
  i
59
59
  ] }),
60
60
  /* @__PURE__ */ s("div", { className: "py-1", children: [
61
- g.map((t, m) => {
61
+ p.map((t, m) => {
62
62
  var d;
63
- const p = typeof ((d = t.metadata) == null ? void 0 : d.icon) == "string" ? t.metadata.icon : void 0, v = x(p, o, r);
63
+ const g = typeof ((d = t.metadata) == null ? void 0 : d.icon) == "string" ? t.metadata.icon : void 0, v = x(g, o, r);
64
64
  return /* @__PURE__ */ s(
65
65
  n.Unstable_TriggerPopoverItem,
66
66
  {
@@ -78,7 +78,7 @@ const _ = ({
78
78
  t.id
79
79
  );
80
80
  }),
81
- g.length === 0 && /* @__PURE__ */ s(
81
+ p.length === 0 && /* @__PURE__ */ s(
82
82
  "div",
83
83
  {
84
84
  role: l ? "status" : void 0,
@@ -100,19 +100,19 @@ const _ = ({
100
100
  emptyCategoriesLabel: c = "No items available",
101
101
  emptyItemsLabel: a = "No matching items",
102
102
  loadingLabel: l = "Loading…",
103
- className: g,
103
+ className: p,
104
104
  directive: t,
105
105
  action: m,
106
- ...p
106
+ ...g
107
107
  }) => (b(!1), /* @__PURE__ */ s(
108
108
  n.Unstable_TriggerPopover,
109
109
  {
110
110
  "data-slot": "composer-trigger-popover",
111
111
  className: I(
112
- "aui-composer-trigger-popover bg-popover text-popover-foreground absolute start-0 bottom-full z-50 mb-2 w-64 overflow-hidden rounded-xl border shadow-lg",
113
- g
112
+ "aui-composer-trigger-popover bg-popover text-popover-foreground absolute start-0 bottom-full z-50 mb-2 w-64 overflow-hidden rounded-xl border shadow-300",
113
+ p
114
114
  ),
115
- ...p,
115
+ ...g,
116
116
  children: [
117
117
  t ? /* @__PURE__ */ e(
118
118
  n.Unstable_TriggerPopover.Directive,
@@ -7,8 +7,8 @@ import { ComposerAddContext as B } from "./composer-add-context.js";
7
7
  import { ComposerHarness as H } from "./composer-harness.js";
8
8
  import { ComposerQuotePreview as K } from "./quote.js";
9
9
  import { ThreadComponentsContext as j } from "./thread-context.js";
10
- import { TooltipIconButton as z } from "./tooltip-icon-button.js";
11
- import { Button as P } from "../ui/button.js";
10
+ import { TooltipIconButton as P } from "./tooltip-icon-button.js";
11
+ import { Button as A } from "../ui/button.js";
12
12
  import { ComposerPrimitive as s, MessagePrimitive as q, unstable_useComposerInput as U, AuiIf as S } from "@assistant-ui/react";
13
13
  import { Mic as Y, Stop as M, ArrowUp as O } from "../../lib/icons.js";
14
14
  const Q = 24, V = 850, X = 1800, G = 3e3;
@@ -18,7 +18,7 @@ function J(a) {
18
18
  Math.max(V, a.length * Q)
19
19
  );
20
20
  }
21
- function W(a, n, r, f, w) {
21
+ function W(a, n, r, f, x) {
22
22
  if (n <= 0 || a.length === 0)
23
23
  return r(a), { promise: Promise.resolve(), cancel: () => {
24
24
  } };
@@ -32,7 +32,7 @@ function W(a, n, r, f, w) {
32
32
  y();
33
33
  return;
34
34
  }
35
- if (w()) {
35
+ if (x()) {
36
36
  h === null && (h = i), C = window.setTimeout(() => T(performance.now()), 100);
37
37
  return;
38
38
  }
@@ -54,7 +54,7 @@ function W(a, n, r, f, w) {
54
54
  const Z = ({
55
55
  autoFocus: a = !0
56
56
  }) => {
57
- const { setText: n } = U(), r = u.useContext(L), [f, w] = u.useState(
57
+ const { setText: n } = U(), r = u.useContext(L), [f, x] = u.useState(
58
58
  (r == null ? void 0 : r[0]) ?? "Send a message…"
59
59
  ), [v, C] = u.useState(!1), N = u.useRef(null), [o, y] = u.useState(null), m = u.useRef(!1), h = u.useCallback((i) => {
60
60
  N.current = i, y(i);
@@ -71,55 +71,55 @@ const Z = ({
71
71
  window.clearTimeout(i), i = window.setTimeout(c, 0);
72
72
  }, b = () => {
73
73
  m.current = o.value.length > 0 || document.activeElement === o;
74
- }, _ = (t, d) => {
74
+ }, z = (t, d) => {
75
75
  n(t), o.value = t, o.dispatchEvent(new Event("input", { bubbles: !0 })), l(t.length > 0), window.setTimeout(() => {
76
76
  document.activeElement === o && o.setSelectionRange(d, d);
77
77
  }, 0);
78
- }, A = (t) => {
79
- const d = o.selectionStart ?? 0, R = o.selectionEnd ?? d;
80
- return d === R || t.inputType !== "deleteContentBackward" && t.inputType !== "deleteContentForward" && t.inputType !== "deleteByCut" ? !1 : (t.preventDefault(), _(
81
- o.value.slice(0, d) + o.value.slice(R),
78
+ }, R = (t) => {
79
+ const d = o.selectionStart ?? 0, _ = o.selectionEnd ?? d;
80
+ return d === _ || t.inputType !== "deleteContentBackward" && t.inputType !== "deleteContentForward" && t.inputType !== "deleteByCut" ? !1 : (t.preventDefault(), z(
81
+ o.value.slice(0, d) + o.value.slice(_),
82
82
  d
83
83
  ), !0);
84
84
  }, E = (t) => {
85
- if (!t.isComposing && !A(t)) {
85
+ if (!t.isComposing && !R(t)) {
86
86
  if (typeof t.data == "string" && t.data.length > 0) {
87
87
  l(!0);
88
88
  return;
89
89
  }
90
90
  g();
91
91
  }
92
- }, x = (t) => {
92
+ }, w = (t) => {
93
93
  (t.metaKey || t.ctrlKey) && !t.altKey && t.key.toLowerCase() === "a" && (t.preventDefault(), o.select());
94
94
  };
95
- return c(), o.addEventListener("beforeinput", E), o.addEventListener("input", c), o.addEventListener("focus", b), o.addEventListener("blur", b), o.addEventListener("keydown", x), () => {
96
- window.clearTimeout(i), o.removeEventListener("beforeinput", E), o.removeEventListener("input", c), o.removeEventListener("focus", b), o.removeEventListener("blur", b), o.removeEventListener("keydown", x);
95
+ return c(), o.addEventListener("beforeinput", E), o.addEventListener("input", c), o.addEventListener("focus", b), o.addEventListener("blur", b), o.addEventListener("keydown", w), () => {
96
+ window.clearTimeout(i), o.removeEventListener("beforeinput", E), o.removeEventListener("input", c), o.removeEventListener("focus", b), o.removeEventListener("blur", b), o.removeEventListener("keydown", w);
97
97
  };
98
98
  }, [o, n]), u.useEffect(() => {
99
99
  var E;
100
100
  if (!(r != null && r.length)) {
101
- w("Send a message…");
101
+ x("Send a message…");
102
102
  return;
103
103
  }
104
104
  if ((E = window.matchMedia) != null && E.call(window, "(prefers-reduced-motion: reduce)").matches) {
105
- w(r[0]);
105
+ x(r[0]);
106
106
  return;
107
107
  }
108
108
  let i = !1, l = 0, c, g;
109
- const b = (x) => new Promise((t) => {
110
- c = window.setTimeout(t, x);
111
- }), _ = () => i;
109
+ const b = (w) => new Promise((t) => {
110
+ c = window.setTimeout(t, w);
111
+ }), z = () => i;
112
112
  return (async () => {
113
113
  for (; !i; ) {
114
114
  for (; m.current && !i; ) await b(100);
115
115
  if (i) return;
116
- const x = r[l];
117
- w("");
116
+ const w = r[l];
117
+ x("");
118
118
  const { promise: t, cancel: d } = W(
119
- x,
120
- J(x),
121
119
  w,
122
- _,
120
+ J(w),
121
+ x,
122
+ z,
123
123
  () => m.current
124
124
  );
125
125
  if (g = d, await t, g = void 0, i) return;
@@ -174,7 +174,7 @@ const pe = ({
174
174
  var f;
175
175
  n.target.closest("button, a, input, textarea, [role='button']") || (f = n.currentTarget.querySelector("textarea")) == null || f.focus();
176
176
  },
177
- className: "border-ng2 data-[dragging=true]:border-ring focus-within:border-border relative flex w-full flex-col gap-2 rounded-(--composer-radius) border bg-(--composer-bg) p-(--composer-padding) shadow-400 transition-[border-color,box-shadow] data-[dragging=true]:border-dashed data-[dragging=true]:bg-[color-mix(in_oklab,var(--color-accent)_50%,var(--color-background))]",
177
+ className: "border-wg2 data-[dragging=true]:border-ring focus-within:border-border relative flex w-full flex-col gap-2 rounded-(--composer-radius) border bg-(--composer-bg) p-(--composer-padding) shadow-400 transition-[border-color,box-shadow] data-[dragging=true]:border-dashed data-[dragging=true]:bg-[color-mix(in_oklab,var(--color-accent)_50%,var(--color-background))]",
178
178
  children: [
179
179
  /* @__PURE__ */ e(K, { className: "mx-0 mt-0" }),
180
180
  /* @__PURE__ */ e(k, {}),
@@ -189,7 +189,7 @@ const pe = ({
189
189
  /* @__PURE__ */ p("div", { className: "flex items-center gap-1.5", children: [
190
190
  /* @__PURE__ */ p(S, { condition: (n) => n.thread.capabilities.dictation, children: [
191
191
  /* @__PURE__ */ e(S, { condition: (n) => n.composer.dictation == null, children: /* @__PURE__ */ e(s.Dictate, { asChild: !0, children: /* @__PURE__ */ e(
192
- z,
192
+ P,
193
193
  {
194
194
  tooltip: "Voice input",
195
195
  side: "bottom",
@@ -202,7 +202,7 @@ const pe = ({
202
202
  }
203
203
  ) }) }),
204
204
  /* @__PURE__ */ e(S, { condition: (n) => n.composer.dictation != null, children: /* @__PURE__ */ e(s.StopDictation, { asChild: !0, children: /* @__PURE__ */ e(
205
- z,
205
+ P,
206
206
  {
207
207
  tooltip: "Stop dictation",
208
208
  side: "bottom",
@@ -216,7 +216,7 @@ const pe = ({
216
216
  ) }) })
217
217
  ] }),
218
218
  /* @__PURE__ */ e(S, { condition: (n) => !n.thread.isRunning, children: /* @__PURE__ */ e(s.Send, { asChild: !0, children: /* @__PURE__ */ e(
219
- z,
219
+ P,
220
220
  {
221
221
  tooltip: "Send message",
222
222
  side: "bottom",
@@ -229,7 +229,7 @@ const pe = ({
229
229
  }
230
230
  ) }) }),
231
231
  /* @__PURE__ */ e(S, { condition: (n) => n.thread.isRunning, children: /* @__PURE__ */ e(s.Cancel, { asChild: !0, children: /* @__PURE__ */ e(
232
- P,
232
+ A,
233
233
  {
234
234
  type: "button",
235
235
  variant: "default",
@@ -250,7 +250,7 @@ const pe = ({
250
250
  {
251
251
  "data-slot": "aui_edit-composer-wrapper",
252
252
  className: "flex flex-col px-2 [contain-intrinsic-size:auto_200px] [content-visibility:auto]",
253
- children: /* @__PURE__ */ p(s.Root, { className: "aui-edit-composer-root border-border/60 ms-auto flex w-full max-w-[85%] flex-col rounded-(--composer-radius) border bg-(--composer-bg) shadow-[0_4px_16px_-8px_rgba(0,0,0,0.08),0_1px_2px_rgba(0,0,0,0.04)]", children: [
253
+ children: /* @__PURE__ */ p(s.Root, { className: "aui-edit-composer-root border-border/60 ms-auto flex w-full max-w-[85%] flex-col rounded-(--composer-radius) border bg-(--composer-bg) shadow-200", children: [
254
254
  /* @__PURE__ */ e(
255
255
  s.Input,
256
256
  {
@@ -260,7 +260,7 @@ const pe = ({
260
260
  ),
261
261
  /* @__PURE__ */ p("div", { className: "aui-edit-composer-footer mx-2.5 mb-2.5 flex items-center gap-1.5 self-end", children: [
262
262
  /* @__PURE__ */ e(s.Cancel, { asChild: !0, children: /* @__PURE__ */ e(
263
- P,
263
+ A,
264
264
  {
265
265
  variant: "ghost",
266
266
  size: "sm",
@@ -268,7 +268,7 @@ const pe = ({
268
268
  children: "Cancel"
269
269
  }
270
270
  ) }),
271
- /* @__PURE__ */ e(s.Send, { asChild: !0, children: /* @__PURE__ */ e(P, { size: "sm", className: "h-8 rounded-full px-3.5", children: "Update" }) })
271
+ /* @__PURE__ */ e(s.Send, { asChild: !0, children: /* @__PURE__ */ e(A, { size: "sm", className: "h-8 rounded-full px-3.5", children: "Update" }) })
272
272
  ] })
273
273
  ] })
274
274
  }