@alfadocs/ui-kit-debug 1.47.0 → 1.47.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{calendar-workspace-DDnQmiIL.js → calendar-workspace-BmscntRR.js} +5320 -5219
- package/dist/_chunks/calendar-workspace-BmscntRR.js.map +1 -0
- package/dist/_chunks/control-room-rail-CdBOXIqX.js +366 -0
- package/dist/_chunks/control-room-rail-CdBOXIqX.js.map +1 -0
- package/dist/agent-catalog.json +1 -1
- package/dist/components/control-room-rail/control-room-rail.d.ts +9 -2
- package/dist/components/control-room-rail/control-room-rail.d.ts.map +1 -1
- package/dist/components/control-room-rail/index.d.ts +1 -1
- package/dist/components/control-room-rail/index.d.ts.map +1 -1
- package/dist/components/control-room-rail/index.js +1 -1
- package/dist/index.js +2 -2
- package/dist/patterns/calendar/calendar-workspace.d.ts +88 -0
- package/dist/patterns/calendar/calendar-workspace.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar.journey.d.ts +2 -0
- package/dist/patterns/calendar/calendar.journey.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar.sheets.d.ts +2 -0
- package/dist/patterns/calendar/calendar.sheets.d.ts.map +1 -1
- package/dist/patterns/calendar/calendar.surface.d.ts +6 -1
- package/dist/patterns/calendar/calendar.surface.d.ts.map +1 -1
- package/dist/patterns/calendar/index.d.ts +1 -1
- package/dist/patterns/calendar/index.d.ts.map +1 -1
- package/dist/patterns/calendar/index.js +1 -1
- package/package.json +1 -1
- package/dist/_chunks/calendar-workspace-DDnQmiIL.js.map +0 -1
- package/dist/_chunks/control-room-rail-Cv7GpMqX.js +0 -354
- package/dist/_chunks/control-room-rail-Cv7GpMqX.js.map +0 -1
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { jsx as A, jsxs as Y, Fragment as Ro } from "react/jsx-runtime";
|
|
2
|
+
import { useState as X, useCallback as b, useMemo as w, useRef as $, useContext as O, useId as vo, useEffect as To, createContext as bo, forwardRef as Co } from "react";
|
|
3
|
+
import { useTranslation as ho } from "react-i18next";
|
|
4
|
+
import { I as Z } from "./icon-button-CehAeZoP.js";
|
|
5
|
+
import { a as xo } from "./panel-header-D_mTdhUp.js";
|
|
6
|
+
import { T as yo } from "./tool-rail-CCFqDfAn.js";
|
|
7
|
+
import { u as W } from "./use-persistent-state-nZwZAnE9.js";
|
|
8
|
+
import { S as Ao } from "./star-Bf9L2Uot.js";
|
|
9
|
+
import { X as wo } from "./x-B5YnXwCz.js";
|
|
10
|
+
const So = {
|
|
11
|
+
id: "control-room-rail",
|
|
12
|
+
capabilities: ["open", "close", "select_single"],
|
|
13
|
+
state: {
|
|
14
|
+
activeToolId: {
|
|
15
|
+
type: "string | null",
|
|
16
|
+
descriptionKey: "ui.toolRail.agent.state.activeToolId",
|
|
17
|
+
description: "Id of the tool whose panel is currently open, or null when the rail is collapsed to its strip. No panel content is ever exposed.",
|
|
18
|
+
read: (t) => t.getActiveToolId()
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
actions: {
|
|
22
|
+
open: {
|
|
23
|
+
// Pure ephemeral panel state (open) — no data loss, no external effect.
|
|
24
|
+
safety: "read",
|
|
25
|
+
argsType: "{ id: string }",
|
|
26
|
+
argsSchema: {
|
|
27
|
+
type: "object",
|
|
28
|
+
properties: { id: { type: "string" } },
|
|
29
|
+
required: ["id"]
|
|
30
|
+
},
|
|
31
|
+
idempotent: !0,
|
|
32
|
+
descriptionKey: "ui.toolRail.agent.actions.open",
|
|
33
|
+
description: "Open the given tool's panel.",
|
|
34
|
+
examples: [{ args: { id: "inbox" }, note: "Open the inbox tool panel." }],
|
|
35
|
+
invoke: (t, s) => {
|
|
36
|
+
t.open(s.id);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
close: {
|
|
40
|
+
safety: "read",
|
|
41
|
+
idempotent: !0,
|
|
42
|
+
descriptionKey: "ui.toolRail.agent.actions.close",
|
|
43
|
+
description: "Collapse the rail to its strip (no active tool).",
|
|
44
|
+
invoke: (t) => {
|
|
45
|
+
t.close();
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
select_tool: {
|
|
49
|
+
safety: "read",
|
|
50
|
+
argsType: "{ id: string | null }",
|
|
51
|
+
argsSchema: {
|
|
52
|
+
type: "object",
|
|
53
|
+
properties: { id: { type: ["string", "null"] } },
|
|
54
|
+
required: ["id"]
|
|
55
|
+
},
|
|
56
|
+
idempotent: !0,
|
|
57
|
+
descriptionKey: "ui.toolRail.agent.actions.selectTool",
|
|
58
|
+
description: "Set the active tool by id (opens its panel), or pass null to collapse.",
|
|
59
|
+
invoke: (t, s) => {
|
|
60
|
+
t.setActiveTool(s.id);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
domHooks: {
|
|
65
|
+
root: {
|
|
66
|
+
attr: "data-component",
|
|
67
|
+
value: "control-room-rail",
|
|
68
|
+
description: "Marks the ControlRoomRail wrapper."
|
|
69
|
+
},
|
|
70
|
+
instanceId: {
|
|
71
|
+
attr: "data-component-id",
|
|
72
|
+
sourceProp: "id",
|
|
73
|
+
description: "Sourced from the id prop. Required to address a specific rail from the agent."
|
|
74
|
+
},
|
|
75
|
+
item: {
|
|
76
|
+
attr: "data-tool-id",
|
|
77
|
+
description: "Stable tool id emitted on each strip IconButton. The active icon also carries data-active set to its id."
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}, H = bo(null);
|
|
81
|
+
function Xo({
|
|
82
|
+
globalTools: t = [],
|
|
83
|
+
children: s
|
|
84
|
+
}) {
|
|
85
|
+
const [l, n] = X(
|
|
86
|
+
() => /* @__PURE__ */ new Map()
|
|
87
|
+
), f = b(
|
|
88
|
+
(i, a) => {
|
|
89
|
+
n((R) => {
|
|
90
|
+
const q = new Map(R);
|
|
91
|
+
return q.set(i, a), q;
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
[]
|
|
95
|
+
), x = b((i) => {
|
|
96
|
+
n((a) => {
|
|
97
|
+
if (!a.has(i)) return a;
|
|
98
|
+
const R = new Map(a);
|
|
99
|
+
return R.delete(i), R;
|
|
100
|
+
});
|
|
101
|
+
}, []), c = w(
|
|
102
|
+
() => Array.from(l.values()).flat(),
|
|
103
|
+
[l]
|
|
104
|
+
), p = $(null), y = b((i) => {
|
|
105
|
+
p.current = i;
|
|
106
|
+
}, []), d = b((i) => {
|
|
107
|
+
var a;
|
|
108
|
+
(a = p.current) == null || a.setActiveTool(i);
|
|
109
|
+
}, []), m = b(() => {
|
|
110
|
+
var i;
|
|
111
|
+
(i = p.current) == null || i.setActiveTool(null);
|
|
112
|
+
}, []), g = w(
|
|
113
|
+
() => ({
|
|
114
|
+
globalTools: t,
|
|
115
|
+
contextualTools: c,
|
|
116
|
+
registerContextualTools: f,
|
|
117
|
+
unregisterContextualTools: x,
|
|
118
|
+
registerRail: y,
|
|
119
|
+
openTool: d,
|
|
120
|
+
closeTool: m
|
|
121
|
+
}),
|
|
122
|
+
[
|
|
123
|
+
t,
|
|
124
|
+
c,
|
|
125
|
+
f,
|
|
126
|
+
x,
|
|
127
|
+
y,
|
|
128
|
+
d,
|
|
129
|
+
m
|
|
130
|
+
]
|
|
131
|
+
);
|
|
132
|
+
return /* @__PURE__ */ A(H.Provider, { value: g, children: s });
|
|
133
|
+
}
|
|
134
|
+
function $o(t) {
|
|
135
|
+
const s = O(H), l = s == null ? void 0 : s.registerContextualTools, n = s == null ? void 0 : s.unregisterContextualTools, f = vo();
|
|
136
|
+
To(() => {
|
|
137
|
+
if (!(!l || !n))
|
|
138
|
+
return l(f, t), () => n(f);
|
|
139
|
+
}, [l, n, f, t]);
|
|
140
|
+
}
|
|
141
|
+
function ko() {
|
|
142
|
+
const t = O(H);
|
|
143
|
+
return w(() => {
|
|
144
|
+
if (!t) return [];
|
|
145
|
+
const s = t.contextualTools.map((n) => ({
|
|
146
|
+
...n,
|
|
147
|
+
scope: "contextual"
|
|
148
|
+
})), l = t.globalTools.map((n) => ({
|
|
149
|
+
...n,
|
|
150
|
+
scope: "global"
|
|
151
|
+
}));
|
|
152
|
+
return [...s, ...l];
|
|
153
|
+
}, [t]);
|
|
154
|
+
}
|
|
155
|
+
function Do() {
|
|
156
|
+
const t = O(H), s = b(() => {
|
|
157
|
+
}, []);
|
|
158
|
+
return {
|
|
159
|
+
openTool: (t == null ? void 0 : t.openTool) ?? s,
|
|
160
|
+
closeTool: (t == null ? void 0 : t.closeTool) ?? s
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function Mo() {
|
|
164
|
+
const t = O(H), s = b((l) => {
|
|
165
|
+
}, []);
|
|
166
|
+
return (t == null ? void 0 : t.registerRail) ?? s;
|
|
167
|
+
}
|
|
168
|
+
function Vo(t, s, l, n) {
|
|
169
|
+
const f = s.includes(t), x = l.includes(t);
|
|
170
|
+
if (!f && x) return { toolId: t, action: "pin" };
|
|
171
|
+
if (f && !x)
|
|
172
|
+
return n != null && n.includes(t) ? void 0 : { toolId: t, action: "unpin" };
|
|
173
|
+
const c = (m) => n != null && n.length ? [...n, ...m.filter((g) => !n.includes(g))] : m, p = c(s), y = c(l);
|
|
174
|
+
return p.length !== y.length || p.some((m, g) => y[g] !== m) ? { toolId: t, action: "reorder" } : void 0;
|
|
175
|
+
}
|
|
176
|
+
const Go = Co(function({
|
|
177
|
+
tools: s,
|
|
178
|
+
railLabel: l,
|
|
179
|
+
reorderable: n = !0,
|
|
180
|
+
favoriteIds: f,
|
|
181
|
+
defaultFavoriteIds: x,
|
|
182
|
+
pinnedFavoriteIds: c,
|
|
183
|
+
onFavoriteIdsChange: p,
|
|
184
|
+
persistFavoritesKey: y = "ui.controlRoom.favorites",
|
|
185
|
+
activeToolId: d,
|
|
186
|
+
defaultActiveToolId: m = null,
|
|
187
|
+
onActiveToolChange: g,
|
|
188
|
+
panelWidth: i,
|
|
189
|
+
onPanelWidthChange: a,
|
|
190
|
+
persistPanelWidthKey: R,
|
|
191
|
+
...q
|
|
192
|
+
}, M) {
|
|
193
|
+
const { t: C } = ho(), [F, P] = X(
|
|
194
|
+
d ?? m ?? null
|
|
195
|
+
), D = d !== void 0 ? d : F, I = b(
|
|
196
|
+
(o) => {
|
|
197
|
+
d === void 0 && P(o), g == null || g(o);
|
|
198
|
+
},
|
|
199
|
+
[d, g]
|
|
200
|
+
), oo = ko(), S = s ?? oo, _ = f !== void 0, [to, eo] = W(
|
|
201
|
+
y,
|
|
202
|
+
() => x ?? S.filter((o) => o.scope === "global").map((o) => o.id),
|
|
203
|
+
{ disabled: _ }
|
|
204
|
+
), B = _ ? f : to, V = w(() => c != null && c.length ? [
|
|
205
|
+
...c,
|
|
206
|
+
...B.filter((o) => !c.includes(o))
|
|
207
|
+
] : B, [c, B]), z = i !== void 0, [no, G] = W(R ?? "ui.controlRoom.panelWidth.unused", null, {
|
|
208
|
+
disabled: z || !R
|
|
209
|
+
}), so = z ? i : R ? no : void 0, ro = b(
|
|
210
|
+
(o) => {
|
|
211
|
+
!z && R && G(o), a == null || a(o);
|
|
212
|
+
},
|
|
213
|
+
[
|
|
214
|
+
z,
|
|
215
|
+
R,
|
|
216
|
+
G,
|
|
217
|
+
a
|
|
218
|
+
]
|
|
219
|
+
), v = w(() => {
|
|
220
|
+
const o = /* @__PURE__ */ new Map();
|
|
221
|
+
for (const r of S) o.set(r.id, r);
|
|
222
|
+
return o;
|
|
223
|
+
}, [S]), j = w(
|
|
224
|
+
() => new Set(V.filter((o) => v.has(o))),
|
|
225
|
+
[V, v]
|
|
226
|
+
), J = (o, r) => {
|
|
227
|
+
const e = V.filter((T) => v.has(T)), u = r(e);
|
|
228
|
+
_ || eo((T) => r(T.filter((k) => v.has(k)))), p == null || p(
|
|
229
|
+
u,
|
|
230
|
+
Vo(o, e, u, c)
|
|
231
|
+
);
|
|
232
|
+
}, K = w(() => {
|
|
233
|
+
if (!n) return S;
|
|
234
|
+
const o = V.filter((e) => v.has(e)).map((e) => ({
|
|
235
|
+
...v.get(e),
|
|
236
|
+
scope: "global",
|
|
237
|
+
reorderable: !0
|
|
238
|
+
})), r = S.filter((e) => !j.has(e.id)).map((e) => ({
|
|
239
|
+
...e,
|
|
240
|
+
scope: "contextual",
|
|
241
|
+
reorderable: !0
|
|
242
|
+
}));
|
|
243
|
+
return [...o, ...r];
|
|
244
|
+
}, [n, S, V, v, j]), [lo, io] = X(""), L = $(!1), co = (o, r) => {
|
|
245
|
+
const e = r ? C("controlRoom.pinnedAnnounce", {
|
|
246
|
+
tool: o,
|
|
247
|
+
defaultValue: "Pinned {{tool}} to favourites"
|
|
248
|
+
}) : C("controlRoom.unpinnedAnnounce", {
|
|
249
|
+
tool: o,
|
|
250
|
+
defaultValue: "Removed {{tool}} from favourites"
|
|
251
|
+
});
|
|
252
|
+
L.current = !L.current, io(L.current ? e : `${e}`);
|
|
253
|
+
}, ao = (o) => {
|
|
254
|
+
var r;
|
|
255
|
+
co(((r = v.get(o)) == null ? void 0 : r.label) ?? o, !j.has(o)), J(
|
|
256
|
+
o,
|
|
257
|
+
(e) => e.includes(o) ? e.filter((u) => u !== o) : [...e, o]
|
|
258
|
+
);
|
|
259
|
+
}, uo = (o, r) => {
|
|
260
|
+
var u;
|
|
261
|
+
const e = (u = K[o]) == null ? void 0 : u.id;
|
|
262
|
+
e !== void 0 && J(e, (T) => {
|
|
263
|
+
const k = T.filter((h) => v.has(h)), N = k.length;
|
|
264
|
+
if (o < N) {
|
|
265
|
+
if (r >= N) return k.filter((go) => go !== e);
|
|
266
|
+
const h = k.slice();
|
|
267
|
+
return h.splice(o, 1), h.splice(r, 0, e), h;
|
|
268
|
+
}
|
|
269
|
+
if (r <= N) {
|
|
270
|
+
const h = k.slice();
|
|
271
|
+
return h.splice(Math.min(r, N), 0, e), h;
|
|
272
|
+
}
|
|
273
|
+
return T;
|
|
274
|
+
});
|
|
275
|
+
}, fo = ({
|
|
276
|
+
tool: o,
|
|
277
|
+
from: r,
|
|
278
|
+
to: e
|
|
279
|
+
}) => {
|
|
280
|
+
const u = j.size, T = r < u;
|
|
281
|
+
return T && e >= u ? C("controlRoom.unpinnedAnnounce", {
|
|
282
|
+
tool: o.label,
|
|
283
|
+
defaultValue: "Removed {{tool}} from favourites"
|
|
284
|
+
}) : !T && e <= u ? C("controlRoom.pinnedAnnounce", {
|
|
285
|
+
tool: o.label,
|
|
286
|
+
defaultValue: "Pinned {{tool}} to favourites"
|
|
287
|
+
}) : T && e < u ? C("controlRoom.reorderAnnounce", {
|
|
288
|
+
tool: o.label,
|
|
289
|
+
to: e + 1,
|
|
290
|
+
total: u,
|
|
291
|
+
defaultValue: "{{tool}} moved to position {{to}} of {{total}}"
|
|
292
|
+
}) : "";
|
|
293
|
+
}, Q = $(null), U = Mo(), po = b(
|
|
294
|
+
(o) => {
|
|
295
|
+
Q.current = o, U(o), typeof M == "function" ? M(o) : M && (M.current = o);
|
|
296
|
+
},
|
|
297
|
+
[U, M]
|
|
298
|
+
), E = D != null ? v.get(D) ?? null : null, mo = E ? /* @__PURE__ */ Y(Ro, { children: [
|
|
299
|
+
n ? (() => {
|
|
300
|
+
const o = j.has(E.id);
|
|
301
|
+
return /* @__PURE__ */ A(
|
|
302
|
+
Z,
|
|
303
|
+
{
|
|
304
|
+
icon: /* @__PURE__ */ A(
|
|
305
|
+
Ao,
|
|
306
|
+
{
|
|
307
|
+
"aria-hidden": "true",
|
|
308
|
+
fill: o ? "currentColor" : "none",
|
|
309
|
+
className: o ? "ds:text-[color:var(--accent)]" : void 0
|
|
310
|
+
}
|
|
311
|
+
),
|
|
312
|
+
intent: "ghost",
|
|
313
|
+
size: "sm",
|
|
314
|
+
"aria-pressed": o,
|
|
315
|
+
"aria-label": C("controlRoom.favorite", {
|
|
316
|
+
defaultValue: "Favourite"
|
|
317
|
+
}),
|
|
318
|
+
onClick: () => ao(E.id)
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
})() : null,
|
|
322
|
+
/* @__PURE__ */ A(
|
|
323
|
+
Z,
|
|
324
|
+
{
|
|
325
|
+
icon: /* @__PURE__ */ A(wo, { "aria-hidden": "true" }),
|
|
326
|
+
intent: "ghost",
|
|
327
|
+
size: "sm",
|
|
328
|
+
"aria-label": C("controlRoom.close", { defaultValue: "Close" }),
|
|
329
|
+
onClick: () => {
|
|
330
|
+
var o;
|
|
331
|
+
return (o = Q.current) == null ? void 0 : o.close();
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
] }) : null;
|
|
336
|
+
return /* @__PURE__ */ Y(xo, { actions: mo, children: [
|
|
337
|
+
/* @__PURE__ */ A(
|
|
338
|
+
yo,
|
|
339
|
+
{
|
|
340
|
+
ref: po,
|
|
341
|
+
dataComponent: "control-room-rail",
|
|
342
|
+
agentAdapter: So,
|
|
343
|
+
tools: K,
|
|
344
|
+
activeToolId: d,
|
|
345
|
+
defaultActiveToolId: m,
|
|
346
|
+
onActiveToolChange: I,
|
|
347
|
+
panelWidth: so,
|
|
348
|
+
onPanelWidthChange: ro,
|
|
349
|
+
railLabel: l ?? C("controlRoom.railLabel", { defaultValue: "Control room" }),
|
|
350
|
+
onReorder: n ? uo : void 0,
|
|
351
|
+
formatReorderAnnouncement: n ? fo : void 0,
|
|
352
|
+
...q
|
|
353
|
+
}
|
|
354
|
+
),
|
|
355
|
+
n ? /* @__PURE__ */ A("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: lo }) : null
|
|
356
|
+
] });
|
|
357
|
+
});
|
|
358
|
+
export {
|
|
359
|
+
Xo as C,
|
|
360
|
+
Go as a,
|
|
361
|
+
ko as b,
|
|
362
|
+
So as c,
|
|
363
|
+
$o as d,
|
|
364
|
+
Do as u
|
|
365
|
+
};
|
|
366
|
+
//# sourceMappingURL=control-room-rail-CdBOXIqX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-room-rail-CdBOXIqX.js","sources":["../../src/components/control-room-rail/control-room-rail.agent.ts","../../src/components/control-room-rail/control-room-context.tsx","../../src/components/control-room-rail/control-room-rail.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* Agent adapter — ControlRoomRail. */\n/* */\n/* The product surface built on ToolRail: the docked \"Control Room\". */\n/* It claims its OWN agent identity ('control-room-rail') so an agent and */\n/* the DOM / cascade boundary can tell the Control Room apart from a bare */\n/* ToolRail. Generic rail surface only: open / close a tool's panel and */\n/* read which tool is active. State is strictly the active tool id — never */\n/* any tool's panel CONTENT (which may carry PHI). */\n/* */\n/* The descriptionKeys deliberately REUSE the existing */\n/* `ui.toolRail.agent.*` translations — no new i18n keys are coined this */\n/* pass. */\n/* */\n/* NOTE: pin / unpin / reorder favourites are intentionally NOT yet an */\n/* agent capability. Exposing them is a deferred follow-up: it needs a */\n/* closed-vocabulary capability addition (DS-maintainer approval per */\n/* src/docs/26-agent-readiness.mdx) plus its own 18-locale descriptionKeys */\n/* — neither of which this pass introduces. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { ControlRoomRailHandle } from './control-room-rail';\n\nexport const controlRoomRailAgent: AgentAdapter<ControlRoomRailHandle> = {\n id: 'control-room-rail',\n capabilities: ['open', 'close', 'select_single'],\n state: {\n activeToolId: {\n type: 'string | null',\n descriptionKey: 'ui.toolRail.agent.state.activeToolId',\n description:\n 'Id of the tool whose panel is currently open, or null when the rail is collapsed to its strip. No panel content is ever exposed.',\n read: (handle) => handle.getActiveToolId(),\n },\n },\n actions: {\n open: {\n // Pure ephemeral panel state (open) — no data loss, no external effect.\n safety: 'read',\n argsType: '{ id: string }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: 'string' } },\n required: ['id'],\n },\n idempotent: true,\n descriptionKey: 'ui.toolRail.agent.actions.open',\n description: \"Open the given tool's panel.\",\n examples: [{ args: { id: 'inbox' }, note: 'Open the inbox tool panel.' }],\n invoke: (handle, args: { id: string }) => {\n handle.open(args.id);\n },\n },\n close: {\n safety: 'read',\n idempotent: true,\n descriptionKey: 'ui.toolRail.agent.actions.close',\n description: 'Collapse the rail to its strip (no active tool).',\n invoke: (handle) => {\n handle.close();\n },\n },\n select_tool: {\n safety: 'read',\n argsType: '{ id: string | null }',\n argsSchema: {\n type: 'object',\n properties: { id: { type: ['string', 'null'] } },\n required: ['id'],\n },\n idempotent: true,\n descriptionKey: 'ui.toolRail.agent.actions.selectTool',\n description:\n 'Set the active tool by id (opens its panel), or pass null to collapse.',\n invoke: (handle, args: { id: string | null }) => {\n handle.setActiveTool(args.id);\n },\n },\n },\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'control-room-rail',\n description: 'Marks the ControlRoomRail wrapper.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description:\n 'Sourced from the id prop. Required to address a specific rail from the agent.',\n },\n item: {\n attr: 'data-tool-id',\n description:\n 'Stable tool id emitted on each strip IconButton. The active icon also carries data-active set to its id.',\n },\n },\n};\n","import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport type { ToolRailHandle, ToolRailTool } from '../tool-rail';\n\n/* ------------------------------------------------------------------ */\n/* Control Room context — the scope mechanism */\n/* */\n/* The DS provides the plumbing; the CONSUMER declares scope by which */\n/* API it reaches for: */\n/* - <ControlRoomProvider globalTools={…}> → `global` tools, set */\n/* once at the app shell, persist across navigation. */\n/* - useControlRoomTools([…]) → `contextual` tools, */\n/* registered per-page, swap with the open entity. */\n/* `<ControlRoomRail>` reads the merged set; `global` tools seed the */\n/* default favourites (pinned on top), `contextual` tools fall below */\n/* the divider. The rail renders the divider between the two groups. */\n/* ------------------------------------------------------------------ */\n\ninterface ControlRoomContextValue {\n globalTools: ToolRailTool[];\n contextualTools: ToolRailTool[];\n registerContextualTools: (id: string, tools: ToolRailTool[]) => void;\n unregisterContextualTools: (id: string) => void;\n // The rail registers its imperative handle here so pages can drive it\n // (e.g. open the X-ray panel when a tooth is clicked). Null until mounted.\n registerRail: (handle: ToolRailHandle | null) => void;\n openTool: (id: string) => void;\n closeTool: () => void;\n}\n\nconst ControlRoomContext = createContext<ControlRoomContextValue | null>(null);\n\nexport interface ControlRoomProviderProps {\n /**\n * Tools valid in every context (Alia, Inbox). Set once at the app shell —\n * they pin to the rail's far end and persist across navigation. Memoise\n * this array so it doesn't re-register every render.\n */\n globalTools?: ToolRailTool[];\n children: ReactNode;\n}\n\n/**\n * Holds the Control Room's global tools and the registry of per-context\n * contextual tools. Mount once at the app shell, inside the frame that also\n * renders `<ControlRoomRail>`.\n */\nexport function ControlRoomProvider({\n globalTools = [],\n children,\n}: ControlRoomProviderProps) {\n // id → that registration's contextual tools. Multiple concurrent\n // registrations merge in insertion order (rare, but composes cleanly).\n const [registry, setRegistry] = useState<Map<string, ToolRailTool[]>>(\n () => new Map(),\n );\n\n const registerContextualTools = useCallback(\n (id: string, tools: ToolRailTool[]) => {\n setRegistry((prev) => {\n const next = new Map(prev);\n next.set(id, tools);\n return next;\n });\n },\n [],\n );\n\n const unregisterContextualTools = useCallback((id: string) => {\n setRegistry((prev) => {\n if (!prev.has(id)) return prev;\n const next = new Map(prev);\n next.delete(id);\n return next;\n });\n }, []);\n\n const contextualTools = useMemo(\n () => Array.from(registry.values()).flat(),\n [registry],\n );\n\n // The rail's imperative handle, registered by <ControlRoomRail> on mount.\n // openTool/closeTool drive it so a page can open a panel (e.g. the X-ray\n // viewer when a tooth is clicked) without holding a ref to the rail itself.\n const railHandleRef = useRef<ToolRailHandle | null>(null);\n const registerRail = useCallback((handle: ToolRailHandle | null) => {\n railHandleRef.current = handle;\n }, []);\n const openTool = useCallback((id: string) => {\n railHandleRef.current?.setActiveTool(id);\n }, []);\n const closeTool = useCallback(() => {\n railHandleRef.current?.setActiveTool(null);\n }, []);\n\n const value = useMemo<ControlRoomContextValue>(\n () => ({\n globalTools,\n contextualTools,\n registerContextualTools,\n unregisterContextualTools,\n registerRail,\n openTool,\n closeTool,\n }),\n [\n globalTools,\n contextualTools,\n registerContextualTools,\n unregisterContextualTools,\n registerRail,\n openTool,\n closeTool,\n ],\n );\n\n return (\n <ControlRoomContext.Provider value={value}>\n {children}\n </ControlRoomContext.Provider>\n );\n}\n\n/**\n * Register this context's **contextual** tools (Notes, Appointments, the entity\n * summary). They sit below the favourites divider and unregister automatically\n * when the calling component unmounts (i.e. when you leave the context).\n *\n * Pass a **stable / memoised** array — like `useEffect` deps, a fresh array\n * every render re-registers every render. Wrap it in `useMemo`.\n *\n * No-op when rendered outside a `<ControlRoomProvider>`.\n */\nexport function useControlRoomTools(tools: ToolRailTool[]): void {\n const ctx = useContext(ControlRoomContext);\n // Depend on the STABLE register/unregister callbacks, never the whole\n // context value: the value object changes every time the registry updates\n // (which this very effect triggers), so depending on `ctx` would re-register\n // on every change — an infinite loop. The callbacks are `useCallback([])`.\n const register = ctx?.registerContextualTools;\n const unregister = ctx?.unregisterContextualTools;\n const id = useId();\n useEffect(() => {\n if (!register || !unregister) return undefined;\n register(id, tools);\n return () => unregister(id);\n }, [register, unregister, id, tools]);\n}\n\n/**\n * The merged tool set the rail consumes: contextual tools (auto-tagged\n * `scope: 'contextual'`) then globals (`scope: 'global'`). Scope is assigned\n * here by which API registered the tool — `global` seeds the Control Room's\n * default favourites (pinned on top); `contextual` falls below the divider.\n * `ControlRoomRail` re-groups by favourite membership for the final order.\n * Returns `[]` outside a provider.\n */\nexport function useControlRoomMergedTools(): ToolRailTool[] {\n const ctx = useContext(ControlRoomContext);\n return useMemo(() => {\n if (!ctx) return [];\n const contextual = ctx.contextualTools.map((tool) => ({\n ...tool,\n scope: 'contextual' as const,\n }));\n const global = ctx.globalTools.map((tool) => ({\n ...tool,\n scope: 'global' as const,\n }));\n return [...contextual, ...global];\n }, [ctx]);\n}\n\n/**\n * Imperative actions to drive the rail from a page: open a tool's panel (e.g.\n * the X-ray viewer when a tooth is clicked) or collapse it. No-ops outside a\n * `<ControlRoomProvider>`. The functions are stable across renders.\n */\nexport function useControlRoomActions(): {\n openTool: (id: string) => void;\n closeTool: () => void;\n} {\n const ctx = useContext(ControlRoomContext);\n const noop = useCallback(() => {}, []);\n return {\n openTool: ctx?.openTool ?? noop,\n closeTool: ctx?.closeTool ?? noop,\n };\n}\n\n/**\n * Internal: the rail registers its imperative handle with the provider so\n * `useControlRoomActions().openTool` can drive it. Returns the stable\n * `registerRail` callback (or a no-op outside a provider).\n */\nexport function useControlRoomRailRegister(): (\n handle: ToolRailHandle | null,\n) => void {\n const ctx = useContext(ControlRoomContext);\n const noop = useCallback((_handle: ToolRailHandle | null) => {}, []);\n return ctx?.registerRail ?? noop;\n}\n","import {\n forwardRef,\n useCallback,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { Star, X } from 'lucide-react';\nimport { IconButton } from '../button/icon-button';\nimport { PanelHeaderActionsProvider } from '../panel-header/panel-header';\nimport {\n ToolRail,\n type ToolRailHandle,\n type ToolRailProps,\n type ToolRailTool,\n} from '../tool-rail';\nimport { usePersistentState } from '../../hooks/use-persistent-state';\nimport { controlRoomRailAgent } from './control-room-rail.agent';\nimport {\n useControlRoomMergedTools,\n useControlRoomRailRegister,\n} from './control-room-context';\n\n/* ------------------------------------------------------------------ */\n/* ControlRoomRail — the unified, contextual workspace rail. */\n/* */\n/* The docked right-hand \"Control Room\": the single home for the */\n/* assistant, inbox, notes, appointments and entity summaries */\n/* alongside the main work surface. One panel open at a time, */\n/* non-modal. */\n/* */\n/* It layers a FAVOURITES model over the proven ToolRail (its prior */\n/* name): favourited tools form a pinned group at the TOP of the strip */\n/* above a divider, then everything else below. The default favourites */\n/* are the host's `global` tools (Alia, Inbox) — so the rail opens with */\n/* notifications + Alia on top, the Control Room's default arrangement. */\n/* */\n/* Favouriting is DRAG-FIRST, no per-icon star: drag a tool up across */\n/* the divider to pin it (and drop it where you want in the order), */\n/* drag a favourite back down to unpin. The keyboard equivalent is */\n/* `Alt`+Arrow (crossing the divider pins / unpins, announced). The */\n/* non-drag pointer path — and the discoverable entry point — is an */\n/* add / remove control in each open tool's panel header. */\n/* */\n/* ToolRail stays favourite-agnostic: this layer maps favourite */\n/* membership onto the rail's generic `scope` grouping + (whole-strip) */\n/* `reorderable` run, reads cross-divider moves as pin / unpin, and */\n/* injects the favourite + close controls into the active panel's */\n/* PanelHeader via <PanelHeaderActionsProvider> (no separate header */\n/* row — the controls live inline-end of the panel's title row). */\n/* ------------------------------------------------------------------ */\n\n/** A Control Room tool — the rail tool descriptor, `scope`-aware. */\nexport type ControlRoomTool = ToolRailTool;\n\n/** Imperative handle — open / collapse a tool panel without the DOM. */\nexport type ControlRoomRailHandle = ToolRailHandle;\n\n/** What one favourites write did, for the tool the user acted on. */\nexport interface ControlRoomFavoriteChange {\n toolId: string;\n action: 'pin' | 'unpin' | 'reorder';\n}\n\n/* A hard-pinned id re-pins on the next render, so unpinning it changes\n nothing and reports nothing. */\nfunction favoriteChangeOf(\n toolId: string,\n previous: readonly string[],\n next: readonly string[],\n hardPinned: readonly string[] | undefined,\n): ControlRoomFavoriteChange | undefined {\n const was = previous.includes(toolId);\n const is = next.includes(toolId);\n if (!was && is) return { toolId, action: 'pin' };\n if (was && !is)\n return hardPinned?.includes(toolId)\n ? undefined\n : { toolId, action: 'unpin' };\n /* Compare what the rail shows: hard-pinned ids always lead. */\n const shown = (list: readonly string[]) =>\n hardPinned?.length\n ? [...hardPinned, ...list.filter((id) => !hardPinned.includes(id))]\n : list;\n const before = shown(previous);\n const after = shown(next);\n const reordered =\n before.length !== after.length ||\n before.some((id, index) => after[index] !== id);\n return reordered ? { toolId, action: 'reorder' } : undefined;\n}\n\nexport interface ControlRoomRailProps extends Omit<\n ToolRailProps,\n | 'tools'\n | 'onReorder'\n | 'formatReorderAnnouncement'\n | 'renderToolAffordance'\n | 'renderPanelHeader'\n> {\n /**\n * Explicit tool set. Omit to read the merged global + contextual tools from\n * the nearest `<ControlRoomProvider>` (+ `useControlRoomTools`).\n */\n tools?: ControlRoomTool[];\n /**\n * Enable the favourites model: a pinned top group, drag / `Alt`+Arrow\n * reordering, and the panel-header add / remove control. Default `true`. Set\n * `false` for the legacy flat strip (tools render in the order / `scope` you\n * pass, no drag, no panel-header control).\n */\n reorderable?: boolean;\n /**\n * Controlled favourite tool ids, in pinned order. When set, the rail does not\n * persist — the host owns the value and is notified via `onFavoriteIdsChange`.\n */\n favoriteIds?: string[];\n /**\n * HARD-PINNED favourite ids — always rendered at the very START of the\n * pinned group, ahead of (and deduped from) user favourites, in both\n * controlled and uncontrolled modes. Immune to unpin: removing one via\n * the panel-header control or a drag is a no-op (it re-pins on the next\n * render). For tools the product wants permanently one glance away —\n * e.g. notifications at the top of the strip.\n */\n pinnedFavoriteIds?: string[];\n /**\n * Uncontrolled initial favourites. Defaults to the ids of the tools the host\n * marked `scope: 'global'` (Alia, Inbox) — pinning them on top by default.\n */\n defaultFavoriteIds?: string[];\n /** Fires with the next favourites order whenever the user pins / reorders.\n * `change` names the tool acted on and what happened to it; it is\n * absent when the write changed nothing. */\n onFavoriteIdsChange?: (\n next: string[],\n change?: ControlRoomFavoriteChange,\n ) => void;\n /** localStorage key for the uncontrolled favourites. */\n persistFavoritesKey?: string;\n /**\n * localStorage key for the uncontrolled committed panel width, mirroring\n * `persistFavoritesKey`: when set and `panelWidth` is absent, the rail\n * seeds its width from storage on mount and writes each commit back.\n * Unlike `persistFavoritesKey` this has no default — persistence is\n * opt-in. Only meaningful with `resizablePanel` — there is nothing to\n * persist without the resize handle.\n */\n persistPanelWidthKey?: string;\n}\n\nexport const ControlRoomRail = forwardRef<\n ControlRoomRailHandle,\n ControlRoomRailProps\n>(function ControlRoomRail(\n {\n tools,\n railLabel,\n reorderable = true,\n favoriteIds,\n defaultFavoriteIds,\n pinnedFavoriteIds,\n onFavoriteIdsChange,\n persistFavoritesKey = 'ui.controlRoom.favorites',\n activeToolId,\n defaultActiveToolId = null,\n onActiveToolChange,\n panelWidth,\n onPanelWidthChange,\n persistPanelWidthKey,\n ...rest\n },\n ref,\n) {\n const { t } = useTranslation();\n\n // Mirror the active tool id so the rail can build the panel-header controls\n // (favourite + close) for whichever tool is open. Controlled hosts own the\n // value via `activeToolId`; otherwise we seed from `defaultActiveToolId` and\n // track subsequent changes through the intercepted `onActiveToolChange`.\n const [activeTracked, setActiveTracked] = useState<string | null>(\n activeToolId ?? defaultActiveToolId ?? null,\n );\n const activeId = activeToolId !== undefined ? activeToolId : activeTracked;\n const handleActiveToolChange = useCallback(\n (id: string | null) => {\n if (activeToolId === undefined) setActiveTracked(id);\n onActiveToolChange?.(id);\n },\n [activeToolId, onActiveToolChange],\n );\n // Provider-driven tools when none are passed explicitly. Calling the hook\n // unconditionally is safe — it returns [] outside a provider.\n const merged = useControlRoomMergedTools();\n const resolved = tools ?? merged;\n\n const isControlled = favoriteIds !== undefined;\n // Uncontrolled favourites persist to localStorage; the lazy initial seeds\n // from the host's `global` tools on first mount only (later tool changes\n // don't re-seed — favourites are user-owned once set). When controlled, the\n // hook is disabled so it never reads or writes storage.\n const [storedFavorites, setStoredFavorites] = usePersistentState<string[]>(\n persistFavoritesKey,\n () =>\n defaultFavoriteIds ??\n resolved.filter((tl) => tl.scope === 'global').map((tl) => tl.id),\n { disabled: isControlled },\n );\n const userFavorites = isControlled ? favoriteIds : storedFavorites;\n /* Hard-pinned ids lead the group every render — user favourites follow,\n deduped. Because the merge happens HERE (not in storage), an unpin\n write simply has no effect on a pinned id. */\n const favorites = useMemo(() => {\n if (!pinnedFavoriteIds?.length) return userFavorites;\n return [\n ...pinnedFavoriteIds,\n ...userFavorites.filter((id) => !pinnedFavoriteIds.includes(id)),\n ];\n }, [pinnedFavoriteIds, userFavorites]);\n\n // Uncontrolled panel-width persistence mirrors favourites, but is opt-in\n // (no default key) since not every rail wants its width remembered.\n // The hook is called unconditionally — `disabled` just keeps it from\n // touching storage when controlled or when no key was given.\n const isWidthControlled = panelWidth !== undefined;\n const [storedPanelWidth, setStoredPanelWidth] = usePersistentState<\n number | null\n >(persistPanelWidthKey ?? 'ui.controlRoom.panelWidth.unused', null, {\n disabled: isWidthControlled || !persistPanelWidthKey,\n });\n const resolvedPanelWidth = isWidthControlled\n ? panelWidth\n : persistPanelWidthKey\n ? storedPanelWidth\n : undefined;\n const handlePanelWidthChange = useCallback(\n (next: number | null) => {\n if (!isWidthControlled && persistPanelWidthKey) {\n setStoredPanelWidth(next);\n }\n onPanelWidthChange?.(next);\n },\n [\n isWidthControlled,\n persistPanelWidthKey,\n setStoredPanelWidth,\n onPanelWidthChange,\n ],\n );\n\n const byId = useMemo(() => {\n const map = new Map<string, ControlRoomTool>();\n for (const tl of resolved) map.set(tl.id, tl);\n return map;\n }, [resolved]);\n\n // Favourites filtered to currently-present tools — stale ids are ignored\n // (and dropped on the next write).\n const favoriteSet = useMemo(\n () => new Set(favorites.filter((id) => byId.has(id))),\n [favorites, byId],\n );\n\n const updateFavorites = (\n toolId: string,\n updater: (prev: string[]) => string[],\n ) => {\n // `updater` must be pure — it is invoked twice (once to compute the\n // reported `next`, once inside the functional setState below).\n const previous = favorites.filter((id) => byId.has(id));\n const next = updater(previous);\n // Persist via a functional update so rapid pin/reorder events compose\n // (mirrors the Sidebar's useFavorites); controlled hosts own the value.\n if (!isControlled)\n setStoredFavorites((prev) => updater(prev.filter((id) => byId.has(id))));\n onFavoriteIdsChange?.(\n next,\n favoriteChangeOf(toolId, previous, next, pinnedFavoriteIds),\n );\n };\n\n // Re-group into the pinned run (favourites order, tagged so ToolRail draws\n // the divider) followed by the rest. EVERY tool is `reorderable` so the rail's\n // reorder run spans the whole strip — that's what lets a drag / Alt+Arrow\n // cross the divider; `handleReorder` reads the crossing as pin / unpin.\n const railTools = useMemo<ControlRoomTool[]>(() => {\n if (!reorderable) return resolved;\n const favTools = favorites\n .filter((id) => byId.has(id))\n .map((id) => ({\n ...(byId.get(id) as ControlRoomTool),\n scope: 'global' as const,\n reorderable: true,\n }));\n const rest = resolved\n .filter((tl) => !favoriteSet.has(tl.id))\n .map((tl) => ({\n ...tl,\n scope: 'contextual' as const,\n reorderable: true,\n }));\n return [...favTools, ...rest];\n }, [reorderable, resolved, favorites, byId, favoriteSet]);\n\n // The drag / Alt+Arrow path announces through the rail's own reorder live\n // region; the panel-header button toggles outside it, so it needs its own\n // polite announcement. The zero-width-space toggle forces a re-announce of an\n // identical message (e.g. pin → unpin → pin the same tool).\n const [pinMessage, setPinMessage] = useState('');\n const pinAnnounceToggle = useRef(false);\n const announcePinChange = (label: string, willPin: boolean) => {\n const text = willPin\n ? t('controlRoom.pinnedAnnounce', {\n tool: label,\n defaultValue: 'Pinned {{tool}} to favourites',\n })\n : t('controlRoom.unpinnedAnnounce', {\n tool: label,\n defaultValue: 'Removed {{tool}} from favourites',\n });\n pinAnnounceToggle.current = !pinAnnounceToggle.current;\n setPinMessage(pinAnnounceToggle.current ? text : `${text}\\u200B`);\n };\n\n const togglePin = (id: string) => {\n announcePinChange(byId.get(id)?.label ?? id, !favoriteSet.has(id));\n updateFavorites(id, (prev) =>\n prev.includes(id) ? prev.filter((p) => p !== id) : [...prev, id],\n );\n };\n\n // The rail fires `onReorder` with indices into `railTools` (favourites first,\n // then the rest). The divider sits at `favCount`, so the index either side of\n // it tells us whether a move is a reorder, a pin, an unpin, or a no-op.\n const handleReorder = (from: number, to: number) => {\n const movedId = railTools[from]?.id;\n if (movedId === undefined) return;\n updateFavorites(movedId, (prev) => {\n const present = prev.filter((id) => byId.has(id));\n const favCount = present.length;\n const wasFav = from < favCount;\n if (wasFav) {\n // Dropped below the divider → unpin.\n if (to >= favCount) return present.filter((id) => id !== movedId);\n // Reorder within favourites (full-strip index == favourites index).\n const next = present.slice();\n next.splice(from, 1);\n next.splice(to, 0, movedId);\n return next;\n }\n // A contextual tool dropped onto / above the divider → pin at that slot.\n if (to <= favCount) {\n const next = present.slice();\n next.splice(Math.min(to, favCount), 0, movedId);\n return next;\n }\n // Contextual → contextual: that group is host-ordered, so nothing to do.\n return prev;\n });\n };\n\n // Membership-aware live-region phrasing for the rail's reorder announcer.\n const formatReorderAnnouncement = ({\n tool,\n from,\n to,\n }: {\n tool: ControlRoomTool;\n from: number;\n to: number;\n }): string => {\n const favCount = favoriteSet.size;\n const wasFav = from < favCount;\n if (wasFav && to >= favCount)\n return t('controlRoom.unpinnedAnnounce', {\n tool: tool.label,\n defaultValue: 'Removed {{tool}} from favourites',\n });\n if (!wasFav && to <= favCount)\n return t('controlRoom.pinnedAnnounce', {\n tool: tool.label,\n defaultValue: 'Pinned {{tool}} to favourites',\n });\n if (wasFav && to < favCount)\n return t('controlRoom.reorderAnnounce', {\n tool: tool.label,\n to: to + 1,\n total: favCount,\n defaultValue: '{{tool}} moved to position {{to}} of {{total}}',\n });\n // Contextual → contextual is a no-op; stay silent.\n return '';\n };\n\n // Register the rail's imperative handle with the provider (so a page's\n // useControlRoomActions().openTool can drive it) AND forward it to the\n // consumer's ref. A callback ref does both; no-op without a provider. We also\n // stash it locally so the injected close control can collapse the panel.\n const railHandleRef = useRef<ToolRailHandle | null>(null);\n const registerRail = useControlRoomRailRegister();\n const setRefs = useCallback(\n (handle: ToolRailHandle | null) => {\n railHandleRef.current = handle;\n registerRail(handle);\n if (typeof ref === 'function') ref(handle);\n else if (ref) ref.current = handle;\n },\n [registerRail, ref],\n );\n\n // The active tool's panel-header controls, injected into its PanelHeader's\n // action cluster (inline-end of the title row) via context — no separate\n // header row. When a tool is open: an icon-only favourite toggle (only when\n // reorderable; pressed state via aria-pressed + the filled star) followed by\n // a close control that collapses the panel. Nothing injected when collapsed\n // or where the panel renders no PanelHeader.\n const activeTool = activeId != null ? (byId.get(activeId) ?? null) : null;\n const injectedActions: ReactNode = activeTool ? (\n <>\n {reorderable\n ? (() => {\n const pinned = favoriteSet.has(activeTool.id);\n return (\n <IconButton\n icon={\n <Star\n aria-hidden=\"true\"\n fill={pinned ? 'currentColor' : 'none'}\n className={\n pinned ? 'ds:text-[color:var(--accent)]' : undefined\n }\n />\n }\n intent=\"ghost\"\n size=\"sm\"\n aria-pressed={pinned}\n aria-label={t('controlRoom.favorite', {\n defaultValue: 'Favourite',\n })}\n onClick={() => togglePin(activeTool.id)}\n />\n );\n })()\n : null}\n <IconButton\n icon={<X aria-hidden=\"true\" />}\n intent=\"ghost\"\n size=\"sm\"\n aria-label={t('controlRoom.close', { defaultValue: 'Close' })}\n onClick={() => railHandleRef.current?.close()}\n />\n </>\n ) : null;\n return (\n <PanelHeaderActionsProvider actions={injectedActions}>\n <ToolRail\n ref={setRefs}\n dataComponent=\"control-room-rail\"\n agentAdapter={controlRoomRailAgent}\n tools={railTools}\n activeToolId={activeToolId}\n defaultActiveToolId={defaultActiveToolId}\n onActiveToolChange={handleActiveToolChange}\n panelWidth={resolvedPanelWidth}\n onPanelWidthChange={handlePanelWidthChange}\n railLabel={\n railLabel ??\n t('controlRoom.railLabel', { defaultValue: 'Control room' })\n }\n onReorder={reorderable ? handleReorder : undefined}\n formatReorderAnnouncement={\n reorderable ? formatReorderAnnouncement : undefined\n }\n {...rest}\n />\n {/* Polite announcement for the panel-header pin / unpin button (the\n drag / Alt+Arrow path announces via the rail's own reorder region). */}\n {reorderable ? (\n <span role=\"status\" aria-live=\"polite\" className=\"ds:sr-only\">\n {pinMessage}\n </span>\n ) : null}\n </PanelHeaderActionsProvider>\n );\n});\n"],"names":["controlRoomRailAgent","handle","args","ControlRoomContext","createContext","ControlRoomProvider","globalTools","children","registry","setRegistry","useState","registerContextualTools","useCallback","id","tools","prev","next","unregisterContextualTools","contextualTools","useMemo","railHandleRef","useRef","registerRail","openTool","_a","closeTool","value","jsx","useControlRoomTools","ctx","useContext","register","unregister","useId","useEffect","useControlRoomMergedTools","contextual","tool","global","useControlRoomActions","noop","useControlRoomRailRegister","_handle","favoriteChangeOf","toolId","previous","hardPinned","was","is","shown","list","before","after","index","ControlRoomRail","forwardRef","railLabel","reorderable","favoriteIds","defaultFavoriteIds","pinnedFavoriteIds","onFavoriteIdsChange","persistFavoritesKey","activeToolId","defaultActiveToolId","onActiveToolChange","panelWidth","onPanelWidthChange","persistPanelWidthKey","rest","ref","t","useTranslation","activeTracked","setActiveTracked","activeId","handleActiveToolChange","merged","resolved","isControlled","storedFavorites","setStoredFavorites","usePersistentState","tl","userFavorites","favorites","isWidthControlled","storedPanelWidth","setStoredPanelWidth","resolvedPanelWidth","handlePanelWidthChange","byId","map","favoriteSet","updateFavorites","updater","railTools","favTools","pinMessage","setPinMessage","pinAnnounceToggle","announcePinChange","label","willPin","text","togglePin","p","handleReorder","from","to","movedId","present","favCount","formatReorderAnnouncement","wasFav","setRefs","activeTool","injectedActions","jsxs","Fragment","pinned","IconButton","Star","X","PanelHeaderActionsProvider","ToolRail"],"mappings":";;;;;;;;;AAwBO,MAAMA,KAA4D;AAAA,EACvE,IAAI;AAAA,EACJ,cAAc,CAAC,QAAQ,SAAS,eAAe;AAAA,EAC/C,OAAO;AAAA,IACL,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,gBAAgB;AAAA,MAChB,aACE;AAAA,MACF,MAAM,CAACC,MAAWA,EAAO,gBAAA;AAAA,IAAgB;AAAA,EAC3C;AAAA,EAEF,SAAS;AAAA,IACP,MAAM;AAAA;AAAA,MAEJ,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY,EAAE,IAAI,EAAE,MAAM,WAAS;AAAA,QACnC,UAAU,CAAC,IAAI;AAAA,MAAA;AAAA,MAEjB,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,WAAW,MAAM,8BAA8B;AAAA,MACxE,QAAQ,CAACA,GAAQC,MAAyB;AACxC,QAAAD,EAAO,KAAKC,EAAK,EAAE;AAAA,MACrB;AAAA,IAAA;AAAA,IAEF,OAAO;AAAA,MACL,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,aAAa;AAAA,MACb,QAAQ,CAACD,MAAW;AAClB,QAAAA,EAAO,MAAA;AAAA,MACT;AAAA,IAAA;AAAA,IAEF,aAAa;AAAA,MACX,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,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AAA,MAAM;AAAA,IAAA;AAAA,EAC9C,EAAA,CACF,IACE;AACJ,SACE,gBAAA8F,EAACM,IAAA,EAA2B,SAASP,IACnC,UAAA;AAAA,IAAA,gBAAA1F;AAAA,MAACkG;AAAA,MAAA;AAAA,QACC,KAAKV;AAAA,QACL,eAAc;AAAA,QACd,cAAcnH;AAAA,QACd,OAAOgG;AAAA,QACP,cAAAjC;AAAA,QACA,qBAAAC;AAAA,QACA,oBAAoBY;AAAA,QACpB,YAAYa;AAAA,QACZ,oBAAoBC;AAAA,QACpB,WACElC,KACAe,EAAE,yBAAyB,EAAE,cAAc,gBAAgB;AAAA,QAE7D,WAAWd,IAAckD,KAAgB;AAAA,QACzC,2BACElD,IAAcwD,KAA4B;AAAA,QAE3C,GAAG5C;AAAA,MAAA;AAAA,IAAA;AAAA,IAILZ,IACC,gBAAA9B,EAAC,QAAA,EAAK,MAAK,UAAS,aAAU,UAAS,WAAU,cAC9C,UAAAuE,GAAA,CACH,IACE;AAAA,EAAA,GACN;AAEJ,CAAC;"}
|
package/dist/agent-catalog.json
CHANGED
|
@@ -3,6 +3,11 @@ import { type ToolRailHandle, type ToolRailProps, type ToolRailTool } from '../t
|
|
|
3
3
|
export type ControlRoomTool = ToolRailTool;
|
|
4
4
|
/** Imperative handle — open / collapse a tool panel without the DOM. */
|
|
5
5
|
export type ControlRoomRailHandle = ToolRailHandle;
|
|
6
|
+
/** What one favourites write did, for the tool the user acted on. */
|
|
7
|
+
export interface ControlRoomFavoriteChange {
|
|
8
|
+
toolId: string;
|
|
9
|
+
action: 'pin' | 'unpin' | 'reorder';
|
|
10
|
+
}
|
|
6
11
|
export interface ControlRoomRailProps extends Omit<ToolRailProps, 'tools' | 'onReorder' | 'formatReorderAnnouncement' | 'renderToolAffordance' | 'renderPanelHeader'> {
|
|
7
12
|
/**
|
|
8
13
|
* Explicit tool set. Omit to read the merged global + contextual tools from
|
|
@@ -35,8 +40,10 @@ export interface ControlRoomRailProps extends Omit<ToolRailProps, 'tools' | 'onR
|
|
|
35
40
|
* marked `scope: 'global'` (Alia, Inbox) — pinning them on top by default.
|
|
36
41
|
*/
|
|
37
42
|
defaultFavoriteIds?: string[];
|
|
38
|
-
/** Fires with the next favourites order whenever the user pins / reorders.
|
|
39
|
-
|
|
43
|
+
/** Fires with the next favourites order whenever the user pins / reorders.
|
|
44
|
+
* `change` names the tool acted on and what happened to it; it is
|
|
45
|
+
* absent when the write changed nothing. */
|
|
46
|
+
onFavoriteIdsChange?: (next: string[], change?: ControlRoomFavoriteChange) => void;
|
|
40
47
|
/** localStorage key for the uncontrolled favourites. */
|
|
41
48
|
persistFavoritesKey?: string;
|
|
42
49
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-room-rail.d.ts","sourceRoot":"","sources":["../../../src/components/control-room-rail/control-room-rail.tsx"],"names":[],"mappings":"AAYA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AAqCtB,qEAAqE;AACrE,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAE3C,wEAAwE;AACxE,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAEnD,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAChD,aAAa,EACX,OAAO,GACP,WAAW,GACX,2BAA2B,GAC3B,sBAAsB,GACtB,mBAAmB,CACtB;IACC;;;OAGG;IACH,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;IAC1B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B
|
|
1
|
+
{"version":3,"file":"control-room-rail.d.ts","sourceRoot":"","sources":["../../../src/components/control-room-rail/control-room-rail.tsx"],"names":[],"mappings":"AAYA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AAqCtB,qEAAqE;AACrE,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAE3C,wEAAwE;AACxE,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAEnD,qEAAqE;AACrE,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;CACrC;AA8BD,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAChD,aAAa,EACX,OAAO,GACP,WAAW,GACX,2BAA2B,GAC3B,sBAAsB,GACtB,mBAAmB,CACtB;IACC;;;OAGG;IACH,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;IAC1B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B;;iDAE6C;IAC7C,mBAAmB,CAAC,EAAE,CACpB,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,CAAC,EAAE,yBAAyB,KAC/B,IAAI,CAAC;IACV,wDAAwD;IACxD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;;;OAOG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,eAAe,iHA6U1B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ControlRoomRail } from './control-room-rail';
|
|
2
|
-
export type { ControlRoomRailProps, ControlRoomRailHandle, ControlRoomTool, } from './control-room-rail';
|
|
2
|
+
export type { ControlRoomRailProps, ControlRoomRailHandle, ControlRoomFavoriteChange, ControlRoomTool, } from './control-room-rail';
|
|
3
3
|
export { controlRoomRailAgent } from './control-room-rail.agent';
|
|
4
4
|
export { ControlRoomProvider, useControlRoomTools, useControlRoomMergedTools, useControlRoomActions, } from './control-room-context';
|
|
5
5
|
export type { ControlRoomProviderProps } from './control-room-context';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/control-room-rail/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/control-room-rail/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as r, a as l, c as a, u as t, b as e, d as n } from "../../_chunks/control-room-rail-
|
|
1
|
+
import { C as r, a as l, c as a, u as t, b as e, d as n } from "../../_chunks/control-room-rail-CdBOXIqX.js";
|
|
2
2
|
export {
|
|
3
3
|
r as ControlRoomProvider,
|
|
4
4
|
l as ControlRoomRail,
|
package/dist/index.js
CHANGED
|
@@ -111,7 +111,7 @@ import { S as en } from "./_chunks/stat-Bs80Z6Yv.js";
|
|
|
111
111
|
import { T as rn } from "./_chunks/tag-Ci3xJPcH.js";
|
|
112
112
|
import { T as tn, t as nn } from "./_chunks/timeline-61AihzYz.js";
|
|
113
113
|
import { T as mn } from "./_chunks/timestamp-BV2lC-wV.js";
|
|
114
|
-
import { C as dn, a as An, c as cn, u as fn, b as gn, d as Sn } from "./_chunks/control-room-rail-
|
|
114
|
+
import { C as dn, a as An, c as cn, u as fn, b as gn, d as Sn } from "./_chunks/control-room-rail-CdBOXIqX.js";
|
|
115
115
|
import { B as Tn, a as xn, b as un, c as Pn, d as In, e as En, f as Rn } from "./_chunks/breadcrumb-agut0PwN.js";
|
|
116
116
|
import { C as _n, a as Nn, b as Dn, c as hn, d as On, e as Fn, f as Ln, g as Mn, h as yn, i as kn, j as Bn, k as vn, u as Gn } from "./_chunks/command-palette-DQl_SNEv.js";
|
|
117
117
|
import { H as wn, a as Wn, b as Vn, c as Un, d as Kn, e as Yn, f as Xn, g as qn } from "./_chunks/header-3o9o9v_T.js";
|
|
@@ -244,7 +244,7 @@ import { W as MC, a as yC, w as kC } from "./_chunks/workflow-status-CuJAOuKL.js
|
|
|
244
244
|
import { C as vC, W as GC, a as HC, b as wC, c as WC, i as VC, l as UC, m as KC, r as YC, w as XC, d as qC, e as zC, f as jC } from "./_chunks/workflow-map-DhR_h5yw.js";
|
|
245
245
|
import { A as ZC, a as JC, b as $C, c as aT } from "./_chunks/alia-sidebar-CUqaJNPQ.js";
|
|
246
246
|
import { A as sT, a as rT, L as oT, P as tT, S as nT, T as iT, b as pT, c as mT, d as lT, e as dT, f as AT, g as cT, h as fT, i as gT, j as ST, k as CT, l as TT, m as xT, n as uT, o as PT, p as IT, r as ET, q as RT, s as bT, t as _T, u as NT } from "./_chunks/anamnesis-summary-rows-DI-UX5r6.js";
|
|
247
|
-
import { C as hT, a as OT, b as FT, c as LT, D as MT, d as yT, S as kT, V as BT, W as vT, e as GT, i as HT, m as wT, r as WT, u as VT, f as UT, g as KT } from "./_chunks/calendar-workspace-
|
|
247
|
+
import { C as hT, a as OT, b as FT, c as LT, D as MT, d as yT, S as kT, V as BT, W as vT, e as GT, i as HT, m as wT, r as WT, u as VT, f as UT, g as KT } from "./_chunks/calendar-workspace-BmscntRR.js";
|
|
248
248
|
import { A as XT, a as qT, b as zT, H as jT, c as QT, u as ZT } from "./_chunks/help-me-write-templates-DHIwa4xR.js";
|
|
249
249
|
import { C as $T, M as ax, P as ex } from "./_chunks/marketplace-app-shell-PB89Dkk_.js";
|
|
250
250
|
import { P as rx } from "./_chunks/payment-automation-upsell-BKmBXU4i.js";
|
|
@@ -1,3 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calendar pattern — the WORKSPACE ROOT.
|
|
3
|
+
*
|
|
4
|
+
* The practice agenda page the platform mounts from the kit: the grid
|
|
5
|
+
* and its two-strip toolbar (`calendar.surface.tsx`) beside a MINIMAL
|
|
6
|
+
* Control Room rail docked inline-end — up to six tools, in strip
|
|
7
|
+
* order: the upcoming Appointments panel (the rail's resting state and
|
|
8
|
+
* its default), ONE appointment editor / details tool, the waiting list,
|
|
9
|
+
* patient notes when in context, online bookings and the free-slot finder. Nothing else — no Inbox,
|
|
10
|
+
* no Alia, no patient tabs, no care plan, no tasks. The panels are the
|
|
11
|
+
* extracted modules from `calendar.sheets.tsx`; `calendar.host.ts`'s
|
|
12
|
+
* open / close seam maps onto the rail's dock, with `close()` returning
|
|
13
|
+
* to the Appointments panel so no path leaves an empty rail.
|
|
14
|
+
*
|
|
15
|
+
* Six is the ceiling, not the floor: `availableTools` narrows the set
|
|
16
|
+
* to what the host can actually back with data, hiding the rail tool AND
|
|
17
|
+
* the toolbar control that opens it, and routing anything aimed at a
|
|
18
|
+
* withheld tool to the Appointments panel. A host with no business
|
|
19
|
+
* hours, holidays or closures must withhold the free-slot finder — it
|
|
20
|
+
* would otherwise report booked and shut-day times as free.
|
|
21
|
+
*
|
|
22
|
+
* The host owns the data and the domain state: it hands in a
|
|
23
|
+
* `CalendarData` read model (`calendar.data.ts`) and a `CalendarJourney`
|
|
24
|
+
* (`calendar.journey.ts`) — the demos from their fixtures and the
|
|
25
|
+
* fixture-backed journey hook, the platform island from
|
|
26
|
+
* `/internalApi/...`. The workspace owns what sits between the two: the
|
|
27
|
+
* cog's display settings, the privacy flag, the one polite region, the
|
|
28
|
+
* editor tool's mode, the placement / create modes, the deep-link
|
|
29
|
+
* effects and the tasks filter. It renders NO header or sidebar — the
|
|
30
|
+
* host page has its own — and expects a bounded block-size from its
|
|
31
|
+
* parent (it fills it; the surface scrolls inside, the rail stays put),
|
|
32
|
+
* exactly what `AppFrame`'s `<main>` gives a page.
|
|
33
|
+
*
|
|
34
|
+
* The confirmations stay kit `Dialog`s — they interrupt rather than
|
|
35
|
+
* dock: the move confirm, the delete confirm with its recurring scope
|
|
36
|
+
* and care-plan cleanup and the Create-bill confirm.
|
|
37
|
+
*/
|
|
38
|
+
import type { CalendarView } from '../../components/calendar';
|
|
39
|
+
import { type ControlRoomFavoriteChange } from '../../components/control-room-rail';
|
|
1
40
|
import { type CalendarAppointmentEditorLoader } from './calendar-editor-hydration';
|
|
2
41
|
import { type CalendarAppointmentDetailsLoader } from './calendar-appointment-details';
|
|
3
42
|
import { type CalendarData } from './calendar.data';
|
|
@@ -18,6 +57,46 @@ export interface CalendarOnlineBookings {
|
|
|
18
57
|
createdAtById?: Readonly<Record<string, string>>;
|
|
19
58
|
onRetry?: () => void;
|
|
20
59
|
}
|
|
60
|
+
/** Where a tool panel was opened from. `system` is a dock the workspace
|
|
61
|
+
* made on its own (the resting panel, a return after a save, a
|
|
62
|
+
* toolbar or journey hand-off), not a pick on the rail. */
|
|
63
|
+
export type CalendarToolOpenSource = 'rail' | 'appointment_panel' | 'selection' | 'system';
|
|
64
|
+
/** Where the appointment behind a details panel was selected. `host` is
|
|
65
|
+
* a selection the journey made itself. */
|
|
66
|
+
export type CalendarDetailsOpenSource = 'calendar' | 'appointments_panel' | 'bookings_panel' | 'waiting_list' | 'deep_link' | 'host';
|
|
67
|
+
/**
|
|
68
|
+
* Usage callbacks for the host's analytics. The kit raises no event of
|
|
69
|
+
* its own and passes identifiers only, never patient data: the host owns
|
|
70
|
+
* the calls, the property allow-list and any once-per guard.
|
|
71
|
+
*/
|
|
72
|
+
export interface CalendarWorkspaceAnalytics {
|
|
73
|
+
/** A tool panel opened. Not raised again while it stays open. */
|
|
74
|
+
onToolOpen?: (event: {
|
|
75
|
+
toolId: CalendarWorkspaceToolId;
|
|
76
|
+
source: CalendarToolOpenSource;
|
|
77
|
+
view: CalendarView;
|
|
78
|
+
}) => void;
|
|
79
|
+
/** An appointment's preview opened. Raised on EVERY opening: the
|
|
80
|
+
* once-per-appointment guard is the host's. */
|
|
81
|
+
onAppointmentPreviewOpen?: (event: {
|
|
82
|
+
eventId: string;
|
|
83
|
+
view: CalendarView;
|
|
84
|
+
privacy: boolean;
|
|
85
|
+
}) => void;
|
|
86
|
+
/** An appointment's details docked for a new selection. Not raised when
|
|
87
|
+
* details come back after an edit. */
|
|
88
|
+
onAppointmentDetailsOpen?: (event: {
|
|
89
|
+
eventId: string;
|
|
90
|
+
source: CalendarDetailsOpenSource;
|
|
91
|
+
view: CalendarView;
|
|
92
|
+
}) => void;
|
|
93
|
+
/** A rail preference was saved on this device. `resize` is raised only
|
|
94
|
+
* with `persistPanelWidthKey`, since without it nothing is saved. */
|
|
95
|
+
onToolPreferencesChange?: (event: {
|
|
96
|
+
action: ControlRoomFavoriteChange['action'] | 'resize';
|
|
97
|
+
toolId: string;
|
|
98
|
+
}) => void;
|
|
99
|
+
}
|
|
21
100
|
export interface CalendarWorkspaceProps {
|
|
22
101
|
/** Optional canonical read for every existing-appointment editor route.
|
|
23
102
|
* The form waits for this response; failures/refusals expose no editable
|
|
@@ -131,6 +210,15 @@ export interface CalendarWorkspaceProps {
|
|
|
131
210
|
* it cannot show never marks the cog. */
|
|
132
211
|
backlogFilters?: Readonly<Record<BacklogGap, boolean>>;
|
|
133
212
|
onBacklogFiltersChange?: (filters: Readonly<Record<BacklogGap, boolean>>) => void;
|
|
213
|
+
/** Device key the rail saves pinned tools and their order under. Omit
|
|
214
|
+
* it and the rail keeps its generic default, `ui.controlRoom.favorites`. */
|
|
215
|
+
persistFavoritesKey?: string;
|
|
216
|
+
/** Device key the rail saves the panel width under. Omit it and width
|
|
217
|
+
* is not saved, as before. On-device only; nothing reaches a server. */
|
|
218
|
+
persistPanelWidthKey?: string;
|
|
219
|
+
/** Usage callbacks for the host's analytics. Omit it and nothing is
|
|
220
|
+
* reported. */
|
|
221
|
+
analytics?: CalendarWorkspaceAnalytics;
|
|
134
222
|
}
|
|
135
223
|
/**
|
|
136
224
|
* The cog's settings as the workspace opens with them: the remembered
|