@burdenoff/microfe-bigconsole 2026.1122.2 → 2026.1122.4

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 (35) hide show
  1. package/dist/bigconsole/asof/AsOfProvider.d.ts +7 -0
  2. package/dist/bigconsole/asof/AsOfProvider.js +5 -2
  3. package/dist/bigconsole/asof/asOfParam.d.ts +5 -0
  4. package/dist/bigconsole/asof/asOfParam.js +7 -4
  5. package/dist/bigconsole/asof/index.d.ts +2 -2
  6. package/dist/bigconsole/asof/index.js +6 -6
  7. package/dist/bigconsole/asof/liveOnlySurfaces.d.ts +43 -0
  8. package/dist/bigconsole/components/dashboard/DashboardCanvas.js +133 -127
  9. package/dist/bigconsole/components/dashboard/DashboardCommentsDrawer.d.ts +16 -0
  10. package/dist/bigconsole/components/dashboard/DashboardCommentsDrawer.js +308 -0
  11. package/dist/bigconsole/components/dashboard/DashboardPresenceBar.d.ts +8 -0
  12. package/dist/bigconsole/components/dashboard/DashboardPresenceBar.js +138 -0
  13. package/dist/bigconsole/components/dashboard/DashboardToolbar.js +51 -51
  14. package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterChip.d.ts +3 -1
  15. package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterChip.js +34 -34
  16. package/dist/bigconsole/components/dashboard/GlobalFiltersBar/GlobalFiltersBar.js +154 -145
  17. package/dist/bigconsole/components/dashboard/ShareDialog/ShareDialog.js +302 -294
  18. package/dist/bigconsole/components/dashboard/index.d.ts +2 -0
  19. package/dist/bigconsole/components/dashboard/index.js +3 -1
  20. package/dist/bigconsole/components/widgets/WidgetWrapper.js +165 -163
  21. package/dist/bigconsole/components/widgets/comments/WidgetComments.d.ts +13 -0
  22. package/dist/bigconsole/components/widgets/comments/WidgetComments.js +213 -117
  23. package/dist/bigconsole/components/widgets/comments/commentMentions.d.ts +58 -0
  24. package/dist/bigconsole/components/widgets/comments/commentMentions.js +66 -0
  25. package/dist/bigconsole/hooks/index.d.ts +2 -1
  26. package/dist/bigconsole/hooks/index.js +1 -0
  27. package/dist/bigconsole/hooks/useDashboardPresence.d.ts +44 -0
  28. package/dist/bigconsole/hooks/useDashboardPresence.js +147 -0
  29. package/dist/bigconsole/hooks/useWidgetComments.d.ts +12 -1
  30. package/dist/bigconsole/hooks/useWidgetComments.js +25 -13
  31. package/dist/bigconsole/pages/DashboardBuilderPage.js +88 -64
  32. package/dist/bigconsole/pages/DashboardViewPage.js +255 -221
  33. package/dist/generated/wspace-operations.d.ts +35 -0
  34. package/dist/generated/wspace-operations.js +353 -54
  35. package/package.json +1 -1
@@ -1,8 +1,21 @@
1
1
  import { FC } from 'react';
2
+ import { MentionCandidate } from './commentMentions';
2
3
  export interface WidgetCommentsProps {
3
4
  widgetId: string;
5
+ /** Optional widget title stored as anchor context on new comments. */
6
+ widgetTitle?: string;
4
7
  /** Close the panel. */
5
8
  onClose: () => void;
6
9
  }
10
+ export interface CommentComposerProps {
11
+ placeholder: string;
12
+ busy: boolean;
13
+ autoFocus?: boolean;
14
+ candidates: readonly MentionCandidate[];
15
+ /** Returns false when the post failed — the draft is kept so it isn't lost. */
16
+ onSubmit: (text: string, mentionUserIds: string[], mentionNames: string[]) => boolean | void | Promise<boolean | void>;
17
+ onCancel?: () => void;
18
+ }
19
+ export declare const CommentComposer: FC<CommentComposerProps>;
7
20
  export declare const WidgetComments: FC<WidgetCommentsProps>;
8
21
  export default WidgetComments;
@@ -1,78 +1,83 @@
1
1
  import e from "../../../hooks/useWidgetComments.js";
2
- import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
3
- import { Check as a, CornerDownRight as o, Loader2 as s, MessageSquare as c, RotateCcw as l, Send as u, Trash2 as d, X as f } from "lucide-react";
4
- import { useI18n as p } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
5
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
2
+ import { useShareRecipients as t } from "../../../hooks/useShareRecipients.js";
3
+ import { findActiveMentionTrigger as n, insertMention as r, parseCommentMentionNames as i, resolveActiveMentionIds as a, splitTextWithMentions as o } from "./commentMentions.js";
4
+ import { useCallback as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
5
+ import { AtSign as f, Check as p, CornerDownRight as m, Loader2 as h, MessageSquare as g, RotateCcw as _, Send as v, Trash2 as y, X as b } from "lucide-react";
6
+ import { useI18n as x } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
7
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
6
8
  // src/bigconsole/components/widgets/comments/WidgetComments.tsx
7
- function g(e, t) {
8
- return e("bigconsole.widget.comments.authorLabel", "User {{id}}", { id: t.slice(0, 6) });
9
+ function w(e, t, n) {
10
+ return n.get(t) || e("bigconsole.widget.comments.authorLabel", "User {{id}}", { id: t.slice(0, 6) });
9
11
  }
10
- function _(e) {
12
+ function T(e) {
11
13
  let t = new Date(e);
12
14
  return Number.isNaN(t.getTime()) ? "" : new Intl.DateTimeFormat(void 0, {
13
15
  dateStyle: "medium",
14
16
  timeStyle: "short"
15
17
  }).format(t);
16
18
  }
17
- var v = ({ comment: e, isReply: t, busy: n, onResolve: r, onDelete: i, onReply: s }) => {
18
- let { t: c } = p(), u = !!e.resolvedAt, f = e.content.text ?? e.content.markdown ?? "";
19
- return /* @__PURE__ */ m("div", {
19
+ var E = ({ comment: e, isReply: t, busy: n, memberNames: r, onResolve: a, onDelete: s, onReply: c }) => {
20
+ let { t: u } = x(), d = !!e.resolvedAt, f = e.content.text ?? e.content.markdown ?? "", h = l(() => i(e.metadata), [e.metadata]), g = l(() => o(f, h), [f, h]);
21
+ return /* @__PURE__ */ S("div", {
20
22
  className: t ? "pl-6" : "",
21
- children: /* @__PURE__ */ h("div", {
23
+ children: /* @__PURE__ */ C("div", {
22
24
  className: "rounded-md border border-[var(--color-border-default)] bg-bg-surface p-2.5",
23
25
  children: [
24
- /* @__PURE__ */ h("div", {
26
+ /* @__PURE__ */ C("div", {
25
27
  className: "flex items-center justify-between gap-2",
26
- children: [/* @__PURE__ */ m("span", {
28
+ children: [/* @__PURE__ */ S("span", {
27
29
  className: "text-xs font-medium text-text-primary",
28
- children: g(c, e.authorId)
29
- }), /* @__PURE__ */ m("span", {
30
+ children: w(u, e.authorId, r)
31
+ }), /* @__PURE__ */ S("span", {
30
32
  className: "text-[10px] text-text-muted tabular-nums",
31
- children: _(e.createdAt)
33
+ children: T(e.createdAt)
32
34
  })]
33
35
  }),
34
- /* @__PURE__ */ m("p", {
36
+ /* @__PURE__ */ S("p", {
35
37
  className: "mt-1 whitespace-pre-wrap break-words text-sm text-text-secondary",
36
- children: f
38
+ children: g.map((e, t) => e.isMention ? /* @__PURE__ */ S("span", {
39
+ className: "rounded bg-bg-sunken px-1 py-0.5 text-xs font-medium text-action-primary-bg",
40
+ children: e.text
41
+ }, t) : /* @__PURE__ */ S("span", { children: e.text }, t))
37
42
  }),
38
- /* @__PURE__ */ h("div", {
43
+ /* @__PURE__ */ C("div", {
39
44
  className: "mt-1.5 flex items-center gap-2",
40
45
  children: [
41
- u && /* @__PURE__ */ h("span", {
46
+ d && /* @__PURE__ */ C("span", {
42
47
  className: "inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium bg-status-success-bg text-status-success-text",
43
48
  children: [
44
- /* @__PURE__ */ m(a, { className: "h-3 w-3" }),
49
+ /* @__PURE__ */ S(p, { className: "h-3 w-3" }),
45
50
  " ",
46
- c("bigconsole.widget.comments.resolvedBadge", "Resolved")
51
+ u("bigconsole.widget.comments.resolvedBadge", "Resolved")
47
52
  ]
48
53
  }),
49
- s && /* @__PURE__ */ h("button", {
54
+ c && /* @__PURE__ */ C("button", {
50
55
  type: "button",
51
56
  disabled: n,
52
- onClick: () => s(e.id),
57
+ onClick: () => c(e.id),
53
58
  className: "inline-flex items-center gap-1 text-[11px] text-text-muted hover:text-text-primary disabled:opacity-50",
54
59
  children: [
55
- /* @__PURE__ */ m(o, { className: "h-3 w-3" }),
60
+ /* @__PURE__ */ S(m, { className: "h-3 w-3" }),
56
61
  " ",
57
- c("bigconsole.widget.comments.reply", "Reply")
62
+ u("bigconsole.widget.comments.reply", "Reply")
58
63
  ]
59
64
  }),
60
- /* @__PURE__ */ h("button", {
65
+ /* @__PURE__ */ C("button", {
61
66
  type: "button",
62
67
  disabled: n,
63
- onClick: () => r(e.id, !u),
68
+ onClick: () => a(e.id, !d),
64
69
  className: "inline-flex items-center gap-1 text-[11px] text-text-muted hover:text-text-primary disabled:opacity-50",
65
- children: [m(u ? l : a, { className: "h-3 w-3" }), u ? c("bigconsole.widget.comments.reopen", "Reopen") : c("bigconsole.widget.comments.resolve", "Resolve")]
70
+ children: [S(d ? _ : p, { className: "h-3 w-3" }), d ? u("bigconsole.widget.comments.reopen", "Reopen") : u("bigconsole.widget.comments.resolve", "Resolve")]
66
71
  }),
67
- /* @__PURE__ */ h("button", {
72
+ /* @__PURE__ */ C("button", {
68
73
  type: "button",
69
74
  disabled: n,
70
- onClick: () => i(e.id),
75
+ onClick: () => s(e.id),
71
76
  className: "inline-flex items-center gap-1 text-[11px] text-status-error-text hover:opacity-80 disabled:opacity-50",
72
77
  children: [
73
- /* @__PURE__ */ m(d, { className: "h-3 w-3" }),
78
+ /* @__PURE__ */ S(y, { className: "h-3 w-3" }),
74
79
  " ",
75
- c("bigconsole.widget.comments.delete", "Delete")
80
+ u("bigconsole.widget.comments.delete", "Delete")
76
81
  ]
77
82
  })
78
83
  ]
@@ -80,145 +85,236 @@ var v = ({ comment: e, isReply: t, busy: n, onResolve: r, onDelete: i, onReply:
80
85
  ]
81
86
  })
82
87
  });
83
- }, y = ({ placeholder: e, busy: t, autoFocus: n, onSubmit: r, onCancel: a }) => {
84
- let { t: o } = p(), [c, l] = i(""), d = async () => {
85
- let e = c.trim();
86
- e && await r(e) !== !1 && l("");
88
+ }, D = ({ placeholder: e, busy: t, autoFocus: i, candidates: o, onSubmit: s, onCancel: c }) => {
89
+ let { t: p } = x(), [m, g] = d(""), [_, y] = d(null), [w, T] = d(() => /* @__PURE__ */ new Map()), E = u(null), D = l(() => {
90
+ if (!_) return [];
91
+ let e = _.query.trim().toLowerCase();
92
+ return o.filter((t) => !e || t.name.toLowerCase().includes(e) || (t.email?.toLowerCase().includes(e) ?? !1)).slice(0, 6);
93
+ }, [o, _]), O = (e, t) => {
94
+ g(e), y(n(e, t));
95
+ }, k = (e) => {
96
+ if (!_) return;
97
+ let { nextText: t, nextCursor: n } = r(m, _, e.name);
98
+ g(t), y(null), T((t) => {
99
+ let n = new Map(t);
100
+ return n.set(e.id, e.name), n;
101
+ }), window.requestAnimationFrame(() => {
102
+ let e = E.current;
103
+ e && (e.focus(), e.setSelectionRange(n, n));
104
+ });
105
+ }, A = () => {
106
+ let e = E.current, t = e?.selectionStart ?? m.length, n = m.slice(0, t), r = m.slice(t), i = n.length > 0 && !/\s$/.test(n) ? " " : "", a = `${n}${i}@${r}`, o = n.length + i.length + 1;
107
+ O(a, o), window.requestAnimationFrame(() => {
108
+ e && (e.focus(), e.setSelectionRange(o, o));
109
+ });
110
+ }, j = async () => {
111
+ let e = m.trim();
112
+ if (!e) return;
113
+ let t = a(e, w);
114
+ await s(e, t, t.map((e) => w.get(e)).filter((e) => !!e)) !== !1 && (g(""), y(null), T(/* @__PURE__ */ new Map()));
87
115
  };
88
- return /* @__PURE__ */ h("div", {
89
- className: "flex items-end gap-2",
90
- children: [/* @__PURE__ */ m("textarea", {
91
- autoFocus: n,
92
- value: c,
93
- onChange: (e) => l(e.target.value),
94
- onKeyDown: (e) => {
95
- e.stopPropagation(), (e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), d());
96
- },
97
- rows: 2,
98
- placeholder: e,
99
- className: "flex-1 resize-none rounded-md border border-[var(--color-border-default)] bg-bg-surface px-2.5 py-1.5 text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-action-primary-bg"
100
- }), /* @__PURE__ */ h("div", {
101
- className: "flex flex-col gap-1",
102
- children: [/* @__PURE__ */ m("button", {
116
+ return /* @__PURE__ */ C("div", {
117
+ className: "relative",
118
+ children: [_ && D.length > 0 && /* @__PURE__ */ S("div", {
119
+ role: "listbox",
120
+ "aria-label": p("bigconsole.widget.comments.mentionPickerAria", "Mention a workspace member"),
121
+ "data-testid": "comment-mention-picker",
122
+ className: "absolute bottom-full left-0 right-0 z-50 mb-1 max-h-40 overflow-auto rounded-md border border-[var(--color-border-default)] bg-bg-surface py-1 shadow-lg",
123
+ children: D.map((e) => /* @__PURE__ */ C("button", {
103
124
  type: "button",
104
- disabled: t || !c.trim(),
105
- onClick: () => void d(),
106
- title: o("bigconsole.widget.comments.postTitle", "Post (⌘/Ctrl + Enter)"),
107
- className: "inline-flex items-center justify-center rounded-md bg-action-primary-bg p-1.5 text-action-primary-text hover:opacity-90 disabled:opacity-50",
108
- children: t ? /* @__PURE__ */ m(s, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ m(u, { className: "h-4 w-4" })
109
- }), a && /* @__PURE__ */ m("button", {
110
- type: "button",
111
- onClick: a,
112
- className: "inline-flex items-center justify-center rounded-md border border-[var(--color-border-default)] p-1.5 text-text-muted hover:text-text-primary",
113
- title: o("bigconsole.widget.comments.cancelReplyTitle", "Cancel reply"),
114
- children: /* @__PURE__ */ m(f, { className: "h-4 w-4" })
125
+ role: "option",
126
+ "aria-selected": !1,
127
+ "data-testid": "comment-mention-option",
128
+ onMouseDown: (t) => {
129
+ t.preventDefault(), k(e);
130
+ },
131
+ className: "flex w-full items-center justify-between gap-2 px-2.5 py-1.5 text-left text-xs text-text-primary hover:bg-bg-sunken",
132
+ children: [/* @__PURE__ */ S("span", {
133
+ className: "truncate font-medium",
134
+ children: e.name
135
+ }), e.email && /* @__PURE__ */ S("span", {
136
+ className: "truncate text-[10px] text-text-muted",
137
+ children: e.email
138
+ })]
139
+ }, e.id))
140
+ }), /* @__PURE__ */ C("div", {
141
+ className: "flex items-end gap-2",
142
+ children: [/* @__PURE__ */ S("textarea", {
143
+ ref: E,
144
+ autoFocus: i,
145
+ value: m,
146
+ onChange: (e) => O(e.target.value, e.target.selectionStart ?? e.target.value.length),
147
+ onKeyUp: (e) => {
148
+ let t = e.currentTarget;
149
+ y(n(t.value, t.selectionStart ?? t.value.length));
150
+ },
151
+ onKeyDown: (e) => {
152
+ e.stopPropagation(), e.key === "Escape" && _ ? (e.preventDefault(), y(null)) : (e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), j());
153
+ },
154
+ rows: 2,
155
+ placeholder: e,
156
+ className: "flex-1 resize-none rounded-md border border-[var(--color-border-default)] bg-bg-surface px-2.5 py-1.5 text-sm text-text-primary placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-action-primary-bg"
157
+ }), /* @__PURE__ */ C("div", {
158
+ className: "flex flex-col gap-1",
159
+ children: [
160
+ o.length > 0 && /* @__PURE__ */ S("button", {
161
+ type: "button",
162
+ onClick: A,
163
+ title: p("bigconsole.widget.comments.mentionTitle", "Mention a teammate (@)"),
164
+ "aria-label": p("bigconsole.widget.comments.mentionTitle", "Mention a teammate (@)"),
165
+ className: "inline-flex items-center justify-center rounded-md border border-[var(--color-border-default)] p-1.5 text-text-muted hover:bg-bg-sunken hover:text-text-primary",
166
+ children: /* @__PURE__ */ S(f, { className: "h-3.5 w-3.5" })
167
+ }),
168
+ /* @__PURE__ */ S("button", {
169
+ type: "button",
170
+ disabled: t || !m.trim(),
171
+ onClick: () => void j(),
172
+ title: p("bigconsole.widget.comments.postTitle", "Post (⌘/Ctrl + Enter)"),
173
+ className: "inline-flex items-center justify-center rounded-md bg-action-primary-bg p-1.5 text-action-primary-text hover:opacity-90 disabled:opacity-50",
174
+ children: t ? /* @__PURE__ */ S(h, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ S(v, { className: "h-4 w-4" })
175
+ }),
176
+ c && /* @__PURE__ */ S("button", {
177
+ type: "button",
178
+ onClick: c,
179
+ className: "inline-flex items-center justify-center rounded-md border border-[var(--color-border-default)] p-1.5 text-text-muted hover:text-text-primary",
180
+ title: p("bigconsole.widget.comments.cancelReplyTitle", "Cancel reply"),
181
+ children: /* @__PURE__ */ S(b, { className: "h-4 w-4" })
182
+ })
183
+ ]
115
184
  })]
116
185
  })]
117
186
  });
118
- }, b = ({ widgetId: a, onClose: o }) => {
119
- let { t: l } = p(), { threads: u, count: d, loading: g, error: _, mutating: b, addComment: x, resolveComment: S, deleteComment: C } = e(a), [w, T] = i(null), [E, D] = i(!1), O = r(null);
120
- n(() => {
121
- if (!E) return;
122
- let e = O.current;
187
+ }, O = ({ widgetId: n, widgetTitle: r, onClose: i }) => {
188
+ let { t: a } = x(), { threads: o, count: f, loading: p, error: m, mutating: _, addComment: v, resolveComment: y, deleteComment: w } = e(n), { results: T } = t(!0, ""), [O, k] = d(null), [A, j] = d(!1), M = u(null), N = l(() => T.filter((e) => e.type === "USER").map((e) => ({
189
+ id: e.id,
190
+ name: e.name,
191
+ ...e.email ? { email: e.email } : {}
192
+ })), [T]), P = l(() => {
193
+ let e = /* @__PURE__ */ new Map();
194
+ for (let t of N) e.set(t.id, t.name);
195
+ return e;
196
+ }, [N]);
197
+ c(() => {
198
+ if (!A) return;
199
+ let e = M.current;
123
200
  e?.scrollTo({
124
201
  top: e.scrollHeight,
125
202
  behavior: "smooth"
126
- }), D(!1);
127
- }, [E, u]);
128
- let k = t(async (e, t) => {
129
- let n = await x(e, t);
130
- return n && (t ? T(null) : D(!0)), n;
131
- }, [x]);
132
- return /* @__PURE__ */ h("div", {
203
+ }), j(!1);
204
+ }, [A, o]);
205
+ let F = s(async (e, t, i, a) => {
206
+ let o = {
207
+ ...a ? { parentCommentId: a } : {},
208
+ ...t.length > 0 ? {
209
+ mentionUserIds: t,
210
+ mentionNames: i
211
+ } : {},
212
+ anchor: {
213
+ anchorType: "widget",
214
+ widgetId: n,
215
+ ...r ? { widgetTitle: r } : {}
216
+ }
217
+ }, s = await v(e, o);
218
+ return s && (a ? k(null) : j(!0)), s;
219
+ }, [
220
+ v,
221
+ n,
222
+ r
223
+ ]);
224
+ return /* @__PURE__ */ C("div", {
133
225
  className: "absolute inset-0 z-40 flex flex-col bg-bg-surface/98 backdrop-blur-sm",
134
226
  role: "dialog",
135
- "aria-label": l("bigconsole.widget.comments.dialogAriaLabel", "Widget comments"),
227
+ "aria-label": a("bigconsole.widget.comments.dialogAriaLabel", "Widget comments"),
136
228
  tabIndex: -1,
137
229
  onClick: (e) => e.stopPropagation(),
138
230
  onKeyDown: (e) => {
139
- e.key === "Escape" && (e.stopPropagation(), o());
231
+ e.key === "Escape" && (e.stopPropagation(), i());
140
232
  },
141
233
  children: [
142
- /* @__PURE__ */ h("div", {
234
+ /* @__PURE__ */ C("div", {
143
235
  className: "flex min-w-0 items-center justify-between gap-2 border-b border-[var(--color-border-subtle)] bg-bg-surface px-3 py-2 sm:px-4",
144
- children: [/* @__PURE__ */ h("h3", {
236
+ children: [/* @__PURE__ */ C("h3", {
145
237
  className: "flex min-w-0 items-center gap-2 text-sm font-semibold leading-tight tracking-tight text-text-primary",
146
238
  children: [
147
- /* @__PURE__ */ m(c, {
239
+ /* @__PURE__ */ S(g, {
148
240
  "aria-hidden": "true",
149
241
  className: "h-icon-sm w-icon-sm shrink-0 text-text-secondary"
150
242
  }),
151
- l("bigconsole.widget.comments.title", "Comments"),
152
- /* @__PURE__ */ m("span", {
243
+ a("bigconsole.widget.comments.title", "Comments"),
244
+ /* @__PURE__ */ S("span", {
153
245
  className: "rounded-full bg-bg-sunken px-1.5 py-0.5 text-[10px] text-text-secondary tabular-nums",
154
- children: d
246
+ children: f
155
247
  })
156
248
  ]
157
- }), /* @__PURE__ */ m("button", {
249
+ }), /* @__PURE__ */ S("button", {
158
250
  type: "button",
159
- onClick: o,
160
- "aria-label": l("bigconsole.widget.comments.closeAriaLabel", "Close comments"),
251
+ onClick: i,
252
+ "aria-label": a("bigconsole.widget.comments.closeAriaLabel", "Close comments"),
161
253
  className: "shrink-0 rounded-button p-1 text-text-muted hover:bg-bg-sunken hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-bg-surface",
162
- children: /* @__PURE__ */ m(f, { className: "h-4 w-4" })
254
+ children: /* @__PURE__ */ S(b, { className: "h-4 w-4" })
163
255
  })]
164
256
  }),
165
- /* @__PURE__ */ h("div", {
166
- ref: O,
257
+ /* @__PURE__ */ C("div", {
258
+ ref: M,
167
259
  className: "flex-1 space-y-3 overflow-auto p-3",
168
260
  children: [
169
- g && u.length === 0 && /* @__PURE__ */ m("div", {
261
+ p && o.length === 0 && /* @__PURE__ */ S("div", {
170
262
  className: "flex items-center justify-center py-8 text-text-muted",
171
- children: /* @__PURE__ */ m(s, { className: "h-5 w-5 animate-spin" })
263
+ children: /* @__PURE__ */ S(h, { className: "h-5 w-5 animate-spin" })
172
264
  }),
173
- _ && !g && /* @__PURE__ */ m("p", {
265
+ m && !p && /* @__PURE__ */ S("p", {
174
266
  role: "alert",
175
267
  className: "rounded-input border border-[var(--color-status-error-border)] bg-status-error-bg-subtle px-2.5 py-2 text-xs text-[var(--color-status-error-text)]",
176
- children: l("bigconsole.widget.comments.loadError", "Couldn’t load comments.")
268
+ children: a("bigconsole.widget.comments.loadError", "Couldn’t load comments.")
177
269
  }),
178
- !g && !_ && u.length === 0 && /* @__PURE__ */ m("p", {
270
+ !p && !m && o.length === 0 && /* @__PURE__ */ S("p", {
179
271
  className: "py-8 text-center text-sm text-text-muted",
180
- children: l("bigconsole.widget.comments.empty", "No comments yet. Start the conversation.")
272
+ children: a("bigconsole.widget.comments.empty", "No comments yet. Start the conversation.")
181
273
  }),
182
- u.map(({ comment: e, replies: t }) => /* @__PURE__ */ h("div", {
274
+ o.map(({ comment: e, replies: t }) => /* @__PURE__ */ C("div", {
183
275
  className: "space-y-2",
184
276
  children: [
185
- /* @__PURE__ */ m(v, {
277
+ /* @__PURE__ */ S(E, {
186
278
  comment: e,
187
- busy: b,
188
- onResolve: (e, t) => void S(e, t),
189
- onDelete: (e) => void C(e),
190
- onReply: (e) => T((t) => t === e ? null : e)
279
+ busy: _,
280
+ memberNames: P,
281
+ onResolve: (e, t) => void y(e, t),
282
+ onDelete: (e) => void w(e),
283
+ onReply: (e) => k((t) => t === e ? null : e)
191
284
  }),
192
- t.map((e) => /* @__PURE__ */ m(v, {
285
+ t.map((e) => /* @__PURE__ */ S(E, {
193
286
  comment: e,
194
287
  isReply: !0,
195
- busy: b,
196
- onResolve: (e, t) => void S(e, t),
197
- onDelete: (e) => void C(e)
288
+ busy: _,
289
+ memberNames: P,
290
+ onResolve: (e, t) => void y(e, t),
291
+ onDelete: (e) => void w(e)
198
292
  }, e.id)),
199
- w === e.id && /* @__PURE__ */ m("div", {
293
+ O === e.id && /* @__PURE__ */ S("div", {
200
294
  className: "pl-6",
201
- children: /* @__PURE__ */ m(y, {
202
- placeholder: l("bigconsole.widget.comments.replyPlaceholder", "Write a reply…"),
203
- busy: b,
295
+ children: /* @__PURE__ */ S(D, {
296
+ placeholder: a("bigconsole.widget.comments.replyPlaceholder", "Write a reply… (type @ to mention)"),
297
+ busy: _,
204
298
  autoFocus: !0,
205
- onSubmit: (t) => k(t, e.id),
206
- onCancel: () => T(null)
299
+ candidates: N,
300
+ onSubmit: (t, n, r) => F(t, n, r, e.id),
301
+ onCancel: () => k(null)
207
302
  })
208
303
  })
209
304
  ]
210
305
  }, e.id))
211
306
  ]
212
307
  }),
213
- /* @__PURE__ */ m("div", {
308
+ /* @__PURE__ */ S("div", {
214
309
  className: "border-t border-[var(--color-border-default)] p-3",
215
- children: /* @__PURE__ */ m(y, {
216
- placeholder: l("bigconsole.widget.comments.addPlaceholder", "Add a comment…"),
217
- busy: b,
218
- onSubmit: (e) => k(e)
310
+ children: /* @__PURE__ */ S(D, {
311
+ placeholder: a("bigconsole.widget.comments.addPlaceholder", "Add a comment… (type @ to mention)"),
312
+ busy: _,
313
+ candidates: N,
314
+ onSubmit: (e, t, n) => F(e, t, n)
219
315
  })
220
316
  })
221
317
  ]
222
318
  });
223
319
  };
224
- export { b as WidgetComments, b as default };
320
+ export { D as CommentComposer, O as WidgetComments, O as default };
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Helpers for @mention detection, mention extraction, text segment rendering,
3
+ * and structured inline-anchor metadata on BigConsole EntityComments.
4
+ */
5
+ export type CommentAnchorType = 'dashboard' | 'widget' | 'region';
6
+ export interface CommentAnchor {
7
+ anchorType: CommentAnchorType;
8
+ widgetId?: string;
9
+ widgetTitle?: string;
10
+ regionLabel?: string;
11
+ }
12
+ export interface MentionCandidate {
13
+ id: string;
14
+ name: string;
15
+ email?: string;
16
+ }
17
+ export interface MentionTriggerMatch {
18
+ /** Character index of the leading `@`. */
19
+ start: number;
20
+ /** Character index of the end of the active token (cursor position). */
21
+ end: number;
22
+ /** Partial query typed after `@`. */
23
+ query: string;
24
+ }
25
+ export interface TextSegment {
26
+ text: string;
27
+ isMention: boolean;
28
+ }
29
+ /**
30
+ * Find an active `@mention` token immediately before `cursorPos`.
31
+ * Matches `@` at string start or after whitespace, followed by up to 40
32
+ * non-newline characters without consecutive spaces.
33
+ */
34
+ export declare function findActiveMentionTrigger(text: string, cursorPos: number): MentionTriggerMatch | null;
35
+ /**
36
+ * Replace the active `@query` span with `@<displayName> ` and return the new
37
+ * string plus the cursor index immediately after the inserted space.
38
+ */
39
+ export declare function insertMention(text: string, trigger: MentionTriggerMatch, displayName: string): {
40
+ nextText: string;
41
+ nextCursor: number;
42
+ token: string;
43
+ };
44
+ /**
45
+ * Keep only mentioned user ids whose `@<name>` token still appears in `text`,
46
+ * deduplicated in insertion order.
47
+ */
48
+ export declare function resolveActiveMentionIds(text: string, selectedMentions: ReadonlyMap<string, string>): string[];
49
+ /**
50
+ * Split comment body text into plain and `@mention` segments for safe React
51
+ * rendering (no HTML injection). Recognises explicit mention names from
52
+ * metadata first, then simple `@handle` tokens.
53
+ */
54
+ export declare function splitTextWithMentions(text: string, knownMentionNames?: readonly string[]): TextSegment[];
55
+ /** Parse optional inline anchor metadata stored on an EntityComment. */
56
+ export declare function parseCommentAnchor(metadata: unknown): CommentAnchor | null;
57
+ /** Parse optional mention display names stored alongside a comment. */
58
+ export declare function parseCommentMentionNames(metadata: unknown): string[];
@@ -0,0 +1,66 @@
1
+ // src/bigconsole/components/widgets/comments/commentMentions.ts
2
+ function e(e, t) {
3
+ let n = Math.max(0, Math.min(t, e.length)), r = e.slice(0, n), i = /(^|[\s(])@([^\s@\n]{0,40})$/.exec(r);
4
+ if (!i) return null;
5
+ let a = i[2] ?? "";
6
+ return {
7
+ start: n - a.length - 1,
8
+ end: n,
9
+ query: a
10
+ };
11
+ }
12
+ function t(e, t, n) {
13
+ let r = `@${n.trim().replace(/\s+/g, " ")}`, i = e.slice(0, t.start), a = e.slice(t.end), o = a.length === 0 || !a.startsWith(" ") ? `${r} ` : r;
14
+ return {
15
+ nextText: `${i}${o}${a}`,
16
+ nextCursor: i.length + o.length,
17
+ token: r
18
+ };
19
+ }
20
+ function n(e, t) {
21
+ let n = e.toLowerCase(), r = [];
22
+ for (let [e, i] of t.entries()) {
23
+ let t = `@${i.trim().replace(/\s+/g, " ").toLowerCase()}`;
24
+ t.length > 1 && n.includes(t) && !r.includes(e) && r.push(e);
25
+ }
26
+ return r;
27
+ }
28
+ function r(e, t) {
29
+ if (!e) return [];
30
+ let n = [...(t ?? []).map((e) => e.trim().replace(/\s+/g, " ")).filter((e) => e.length > 0).sort((e, t) => t.length - e.length).map((e) => `@${e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`), "@[A-Za-z0-9._-]{2,40}"], r = RegExp(`(${n.join("|")})`, "gi"), i = [], a = 0, o;
31
+ for (; (o = r.exec(e)) !== null;) {
32
+ let t = o.index;
33
+ t > 0 && /[A-Za-z0-9._%+-]/.test(e[t - 1] ?? "") || (t > a && i.push({
34
+ text: e.slice(a, t),
35
+ isMention: !1
36
+ }), i.push({
37
+ text: o[0],
38
+ isMention: !0
39
+ }), a = t + o[0].length);
40
+ }
41
+ return a < e.length && i.push({
42
+ text: e.slice(a),
43
+ isMention: !1
44
+ }), i;
45
+ }
46
+ function i(e) {
47
+ return typeof e == "object" && !!e && !Array.isArray(e);
48
+ }
49
+ function a(e) {
50
+ if (!i(e)) return null;
51
+ let t = i(e.anchor) ? e.anchor : e, n = t.anchorType;
52
+ if (n !== "dashboard" && n !== "widget" && n !== "region") return null;
53
+ let r = typeof t.widgetId == "string" && t.widgetId.trim() ? t.widgetId.trim() : void 0, a = typeof t.widgetTitle == "string" && t.widgetTitle.trim() ? t.widgetTitle.trim() : void 0, o = typeof t.regionLabel == "string" && t.regionLabel.trim() ? t.regionLabel.trim() : void 0;
54
+ return {
55
+ anchorType: n,
56
+ ...r ? { widgetId: r } : {},
57
+ ...a ? { widgetTitle: a } : {},
58
+ ...o ? { regionLabel: o } : {}
59
+ };
60
+ }
61
+ function o(e) {
62
+ if (!i(e)) return [];
63
+ let t = e.mentionNames;
64
+ return Array.isArray(t) ? t.filter((e) => typeof e == "string" && e.trim().length > 0) : i(t) ? Object.values(t).filter((e) => typeof e == "string" && e.trim().length > 0) : [];
65
+ }
66
+ export { e as findActiveMentionTrigger, t as insertMention, a as parseCommentAnchor, o as parseCommentMentionNames, n as resolveActiveMentionIds, r as splitTextWithMentions };
@@ -9,7 +9,8 @@ export { useWidgetCatalog, default as useWidgetCatalogDefault } from './useWidge
9
9
  export type { UseWidgetCatalogParams, UseWidgetCatalogResult } from './useWidgetCatalog';
10
10
  export { useAutoRefresh, useWidgetAutoRefresh, formatTimeUntilRefresh, default as useAutoRefreshDefault, } from './useAutoRefresh';
11
11
  export { useWidgetOperations, default as useWidgetOperationsDefault } from './useWidgetOperations';
12
- export { useWidgetComments, WIDGET_COMMENT_ENTITY_TYPE, type WidgetCommentThread, type UseWidgetCommentsResult, default as useWidgetCommentsDefault, } from './useWidgetComments';
12
+ export { useWidgetComments, useDashboardComments, useEntityComments, WIDGET_COMMENT_ENTITY_TYPE, DASHBOARD_COMMENT_ENTITY_TYPE, type AddCommentOptions, type WidgetCommentThread, type UseWidgetCommentsResult, default as useWidgetCommentsDefault, } from './useWidgetComments';
13
+ export { useDashboardPresence, buildPresenceConnectionId, PRESENCE_HEARTBEAT_INTERVAL_MS, PRESENCE_POLL_INTERVAL_MS, PRESENCE_ACTIVE_WINDOW_MS, type DashboardPresenceViewerInfo, type UseDashboardPresenceResult, default as useDashboardPresenceDefault, } from './useDashboardPresence';
13
14
  export { useWidgetConfigPersist, type UseWidgetConfigPersistResult, default as useWidgetConfigPersistDefault, } from './useWidgetConfigPersist';
14
15
  export { useDashboardOperations, default as useDashboardOperationsDefault, type DashboardListItem, } from './useDashboardOperations';
15
16
  export { useWidgetExport, type UseWidgetExportOptions, type UseWidgetExportResult, default as useWidgetExportDefault, } from './useWidgetExport';
@@ -4,6 +4,7 @@ import "./useWidgetCatalog.js";
4
4
  import { formatTimeUntilRefresh as n, useWidgetAutoRefresh as r } from "./useAutoRefresh.js";
5
5
  import i from "./useWidgetOperations.js";
6
6
  import a from "./useWidgetComments.js";
7
+ import "./useDashboardPresence.js";
7
8
  import o from "./useWidgetConfigPersist.js";
8
9
  import s from "./useDashboardOperations.js";
9
10
  import c from "./useWidgetExport.js";