@miadi/stateloom-canvas 0.1.8 → 0.1.10
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/CompanionDock.d.ts +56 -5
- package/dist/CompanionDock.js +35 -11
- package/dist/MarkCards.d.ts +16 -3
- package/dist/MarkCards.js +24 -10
- package/dist/StageCaption.d.ts +23 -6
- package/dist/StageCaption.js +6 -3
- package/dist/StageOverlay.d.ts +6 -2
- package/dist/StageOverlay.js +33 -4
- package/dist/icons.d.ts +2 -0
- package/dist/icons.js +4 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +7 -1
- package/dist/names.d.ts +48 -0
- package/dist/names.js +90 -0
- package/dist/pins.d.ts +50 -0
- package/dist/pins.js +108 -0
- package/dist/styles.css +153 -21
- package/package.json +3 -1
package/dist/CompanionDock.d.ts
CHANGED
|
@@ -4,9 +4,17 @@
|
|
|
4
4
|
* The phone page's conversation, folded into a corner of the board: one button records a
|
|
5
5
|
* take (Record → Stop & send → Sending…, Send again when a send failed), the line under
|
|
6
6
|
* it says what happened, and the conversation reads newest first — the person's takes
|
|
7
|
-
* (with the drawing they were looking at)
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* (with the drawing they were looking at), the companion's replies, each with ▶ to hear
|
|
8
|
+
* it walk the diagram again and a thumb, and the person's marks on the episode's drawings
|
|
9
|
+
* with their threads ("You marked Witnessing on Screenwalk", the words, the companion's
|
|
10
|
+
* answers, whether it waits). A mark has no play button and no thumb; tapping it opens
|
|
11
|
+
* that drawing at that mark (`onOpenMark`). A reply that answers a mark says which.
|
|
12
|
+
*
|
|
13
|
+
* Who is in the room is said in words in the header ("listening", "answering take 12",
|
|
14
|
+
* "away"), never by a coloured dot alone. Closed, it is one round button (`variant:
|
|
15
|
+
* "fab"`) that shows the clock while recording and how many replies are new, or — on a
|
|
16
|
+
* phone, where the host makes it the handle of the sheet at the bottom of the board —
|
|
17
|
+
* a bar across the width (`variant: "bar"`) that says the same in words.
|
|
10
18
|
*
|
|
11
19
|
* Props in, callbacks out: the host holds the recorder, the conversation and the stage
|
|
12
20
|
* (`createTakeRecorder`, `createCompanionThread`, `present` in `@miadi/stateloom-react`).
|
|
@@ -47,11 +55,54 @@ export interface DockReply {
|
|
|
47
55
|
unvoiced?: string;
|
|
48
56
|
feedback?: "up" | "down";
|
|
49
57
|
steps?: DockStep[];
|
|
58
|
+
/** The mark this reply answers, in its thread and in the companion's voice. */
|
|
59
|
+
mark?: {
|
|
60
|
+
id: string;
|
|
61
|
+
doc: string;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** A person's (or the companion's) mark on one of the episode's drawings, with its thread. */
|
|
65
|
+
export interface DockMark {
|
|
66
|
+
kind: "mark";
|
|
67
|
+
id: string;
|
|
68
|
+
/** The drawing, absolute. */
|
|
69
|
+
doc: string;
|
|
70
|
+
/** Its file name. */
|
|
71
|
+
drawing?: string;
|
|
72
|
+
/** Its own name (settings.name), when it has one. */
|
|
73
|
+
title?: string;
|
|
74
|
+
elements: string[];
|
|
75
|
+
region?: {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
width: number;
|
|
79
|
+
height: number;
|
|
80
|
+
};
|
|
81
|
+
text: string;
|
|
82
|
+
author: {
|
|
83
|
+
name: string;
|
|
84
|
+
role: "person" | "agent";
|
|
85
|
+
};
|
|
86
|
+
at: string;
|
|
87
|
+
lastAt?: string;
|
|
88
|
+
status: "open" | "answered" | "resolved";
|
|
89
|
+
replies: {
|
|
90
|
+
author: {
|
|
91
|
+
name: string;
|
|
92
|
+
role: "person" | "agent";
|
|
93
|
+
};
|
|
94
|
+
text: string;
|
|
95
|
+
at: string;
|
|
96
|
+
}[];
|
|
50
97
|
}
|
|
51
|
-
export type DockItem = DockTake | DockReply;
|
|
98
|
+
export type DockItem = DockTake | DockReply | DockMark;
|
|
52
99
|
export interface CompanionDockProps {
|
|
53
100
|
open: boolean;
|
|
54
101
|
onOpenChange: (open: boolean) => void;
|
|
102
|
+
/** Closed: a round button (default), or a bar across the width that names the room in words. */
|
|
103
|
+
variant?: "fab" | "bar";
|
|
104
|
+
/** Open the drawing a mark is on, at that mark's thread. Absent: marks are read, not opened. */
|
|
105
|
+
onOpenMark?: (mark: DockMark) => void;
|
|
55
106
|
/** Who answers. Default "Mia". */
|
|
56
107
|
who?: string;
|
|
57
108
|
episode: string | null;
|
|
@@ -97,5 +148,5 @@ export interface CompanionDockProps {
|
|
|
97
148
|
className?: string;
|
|
98
149
|
style?: CSSProperties;
|
|
99
150
|
}
|
|
100
|
-
export declare function CompanionDock({ open, onOpenChange, who, episode, episodes, onEpisode, presence, recorder, onRecord, items, unheard, playing, playingStep, onPlay, onStop, onFeedback, autoplay, onAutoplay, waiting, notice, error, theme, className, style, }: CompanionDockProps): import("react").JSX.Element;
|
|
151
|
+
export declare function CompanionDock({ open, onOpenChange, variant, onOpenMark, who, episode, episodes, onEpisode, presence, recorder, onRecord, items, unheard, playing, playingStep, onPlay, onStop, onFeedback, autoplay, onAutoplay, waiting, notice, error, theme, className, style, }: CompanionDockProps): import("react").JSX.Element;
|
|
101
152
|
export default CompanionDock;
|
package/dist/CompanionDock.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { themeStyle } from "./theme.js";
|
|
3
|
-
import { CloseIcon, MicIcon, PlayIcon, SpeakerIcon, StopIcon, ThumbDownIcon, ThumbUpIcon } from "./icons.js";
|
|
3
|
+
import { CloseIcon, MicIcon, PinIcon, PlayIcon, SpeakerIcon, StopIcon, ThumbDownIcon, ThumbUpIcon } from "./icons.js";
|
|
4
|
+
import { drawingName, markPlace, markStanding, marksSummary } from "./names.js";
|
|
4
5
|
const clock = (s) => `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
|
|
5
6
|
const when = (iso) => {
|
|
6
7
|
const d = new Date(iso);
|
|
@@ -20,18 +21,28 @@ function litOf(step) {
|
|
|
20
21
|
}
|
|
21
22
|
function presenceLine(who, presence, episode) {
|
|
22
23
|
if (!episode)
|
|
23
|
-
return { text: "Choose the episode you are speaking in.", away: true };
|
|
24
|
+
return { text: "Choose the episode you are speaking in.", word: "no episode", away: true };
|
|
24
25
|
switch (presence?.state) {
|
|
25
26
|
case "listening":
|
|
26
|
-
return { text: `${who} is listening.`, away: false };
|
|
27
|
-
case "answering":
|
|
28
|
-
|
|
27
|
+
return { text: `${who} is listening.`, word: "listening", away: false };
|
|
28
|
+
case "answering": {
|
|
29
|
+
const takes = presence.takes?.length ? ` take ${presence.takes.join(", ")}` : "";
|
|
30
|
+
return { text: `${who} is answering${takes}.`, word: `answering${takes}`, away: false };
|
|
31
|
+
}
|
|
29
32
|
case "answered":
|
|
30
|
-
return { text: `${who} has answered and is getting ready to listen again.`, away: false };
|
|
33
|
+
return { text: `${who} has answered and is getting ready to listen again.`, word: "answered", away: false };
|
|
31
34
|
default:
|
|
32
|
-
return { text: `Nobody is listening yet. A take waits in the episode until ${who} does.`, away: true };
|
|
35
|
+
return { text: `Nobody is listening yet. A take waits in the episode until ${who} does.`, word: "away", away: true };
|
|
33
36
|
}
|
|
34
37
|
}
|
|
38
|
+
/** Who said it, as the conversation names them: the person is "You". */
|
|
39
|
+
const speaker = (author, who) => (author.role === "agent" ? author.name || who : "You");
|
|
40
|
+
const STANDING_TEXT = (who) => ({
|
|
41
|
+
"waits for agent": `waits for ${who}`,
|
|
42
|
+
"waits for you": "waits for you",
|
|
43
|
+
answered: "answered",
|
|
44
|
+
resolved: "resolved",
|
|
45
|
+
});
|
|
35
46
|
const RECORD_LABEL = {
|
|
36
47
|
idle: "● Record",
|
|
37
48
|
starting: "Opening the mic…",
|
|
@@ -39,21 +50,34 @@ const RECORD_LABEL = {
|
|
|
39
50
|
sending: "Sending…",
|
|
40
51
|
retry: "Send again",
|
|
41
52
|
};
|
|
42
|
-
export function CompanionDock({ open, onOpenChange, who = "Mia", episode, episodes, onEpisode, presence, recorder, onRecord, items, unheard = [], playing = null, playingStep = null, onPlay, onStop, onFeedback, autoplay, onAutoplay, waiting, notice, error, theme, className, style, }) {
|
|
53
|
+
export function CompanionDock({ open, onOpenChange, variant = "fab", onOpenMark, who = "Mia", episode, episodes, onEpisode, presence, recorder, onRecord, items, unheard = [], playing = null, playingStep = null, onPlay, onStop, onFeedback, autoplay, onAutoplay, waiting, notice, error, theme, className, style, }) {
|
|
43
54
|
const live = recorder.state === "recording";
|
|
44
55
|
const busy = recorder.state === "starting" || recorder.state === "sending";
|
|
45
56
|
const fresh = unheard.length;
|
|
57
|
+
const line = presenceLine(who, presence, episode);
|
|
58
|
+
if (!open && variant === "bar") {
|
|
59
|
+
return (_jsx("div", { className: `slc-talk slc-talk--bar${className ? ` ${className}` : ""}`, style: { ...themeStyle(theme), ...style }, children: _jsxs("button", { type: "button", className: `slc-talk-bar${live ? " slc-talk-bar--live" : ""}${!live && playing ? " slc-talk-bar--speaking" : ""}`, onClick: () => (live ? onRecord() : onOpenChange(true)), "aria-label": live ? `Stop and send (${clock(recorder.seconds)})` : `Talk with ${who}: ${line.word}${fresh ? `, ${fresh} new` : ""}. Open the conversation`, title: live ? "Stop and send your take" : `Talk with ${who} about what is on the canvas`, children: [live ? _jsx(StopIcon, {}) : playing ? _jsx(SpeakerIcon, {}) : _jsx(MicIcon, {}), _jsx("span", { className: "slc-talk-bar-title", children: live ? "Stop and send" : playing ? `${who} is speaking` : `Talk with ${who}` }), live ? (_jsx("span", { className: "slc-talk-clock", children: clock(recorder.seconds) })) : (!playing && _jsx("span", { className: `slc-talk-state${line.away ? " slc-talk-state--away" : ""}`, children: line.word })), _jsx("span", { className: "slc-stage-spacer" }), !live && fresh > 0 && _jsxs("span", { className: "slc-talk-new", children: [fresh, " new"] })] }) }));
|
|
60
|
+
}
|
|
46
61
|
if (!open) {
|
|
47
62
|
return (_jsx("div", { className: `slc-talk${className ? ` ${className}` : ""}`, style: { ...themeStyle(theme), ...style }, children: _jsxs("button", { type: "button", className: `slc-talk-fab${live ? " slc-talk-fab--live" : ""}${!live && playing ? " slc-talk-fab--speaking" : ""}`, onClick: () => (live ? onRecord() : onOpenChange(true)), "aria-label": live ? `Stop and send (${clock(recorder.seconds)})` : playing ? `${who} is speaking. Open the conversation` : `Talk with ${who}${fresh ? `, ${fresh} new` : ""}`, title: live ? "Stop and send your take" : playing ? `${who} is walking the diagram` : `Talk with ${who} about what is on the canvas`, children: [live ? _jsx("span", { className: "slc-talk-fab-clock", children: clock(recorder.seconds) }) : playing ? _jsx(SpeakerIcon, { size: 24 }) : _jsx(MicIcon, { size: 24 }), !live && fresh > 0 && _jsx("span", { className: "slc-talk-fab-badge", children: fresh })] }) }));
|
|
48
63
|
}
|
|
49
|
-
const line = presenceLine(who, presence, episode);
|
|
50
64
|
const newest = [...items].reverse();
|
|
51
|
-
|
|
65
|
+
const marks = items.filter((i) => i.kind === "mark");
|
|
66
|
+
const marksById = new Map(marks.map((m) => [m.id, m]));
|
|
67
|
+
const saidAny = items.some((i) => i.kind === "take" || i.kind === "reply");
|
|
68
|
+
const standing = STANDING_TEXT(who);
|
|
69
|
+
/** "Witnessing on Screenwalk": what a mark points at, on which drawing. */
|
|
70
|
+
const placeOf = (m) => `${markPlace(m)} on ${drawingName(m.doc ?? m.drawing, m.title)}`;
|
|
71
|
+
return (_jsx("div", { className: `slc-talk slc-talk--open${className ? ` ${className}` : ""}`, style: { ...themeStyle(theme), ...style }, children: _jsxs("section", { className: "slc-talk-panel", "aria-label": `Conversation with ${who}`, onPointerDown: (e) => e.stopPropagation(), children: [_jsxs("header", { className: "slc-talk-head", children: [_jsxs("span", { className: "slc-talk-title", children: [_jsx(MicIcon, {}), " Talk with ", who] }), _jsx("span", { className: `slc-talk-state${line.away ? " slc-talk-state--away" : ""}`, title: line.text, children: line.word }), _jsx("span", { className: "slc-stage-spacer" }), _jsx("button", { type: "button", className: "slc-stage-btn slc-stage-btn--quiet", onClick: () => onOpenChange(false), "aria-label": "Close the conversation", children: _jsx(CloseIcon, {}) })] }), episodes?.length && onEpisode ? (_jsxs("select", { className: "slc-stage-input slc-talk-episode", value: episode ?? "", onChange: (e) => onEpisode(e.target.value), disabled: live || busy, "aria-label": "The episode this conversation belongs to", children: [!episode && _jsx("option", { value: "", children: "Choose the episode\u2026" }), episodes.map((ep) => (_jsxs("option", { value: ep.path, children: [ep.number ? `${String(ep.number).padStart(3, "0")} · ` : "", ep.path.replace(/^\d{4}-\d{2}-\d{2}-episode-\d+-/, "")] }, ep.path)))] })) : (_jsx("div", { className: "slc-talk-meta", children: episode ?? "No episode chosen." })), _jsx("div", { className: `slc-talk-meta${line.away ? " slc-talk-meta--away" : ""}`, children: line.text }), _jsxs("button", { type: "button", className: `slc-talk-record${live ? " slc-talk-record--live" : ""}${recorder.state === "retry" ? " slc-talk-record--retry" : ""}`, onClick: onRecord, disabled: busy || !!recorder.unavailable || !episode, title: recorder.unavailable ? `Cannot record: ${recorder.unavailable}` : live ? "Stop and send your take" : "Speak to the episode, about what is on the canvas", children: [RECORD_LABEL[recorder.state], live && _jsx("span", { className: "slc-talk-clock", children: clock(recorder.seconds) })] }), recorder.unavailable && _jsxs("div", { className: "slc-talk-meta slc-talk-meta--error", children: ["Cannot record here: ", recorder.unavailable, "."] }), recorder.message && _jsx("div", { className: `slc-talk-meta${recorder.error ? " slc-talk-meta--error" : ""}`, children: recorder.message }), waiting && _jsxs("div", { className: "slc-talk-meta", children: ["Waiting for ", who, "\u2026 ", clock(waiting.seconds)] }), notice && _jsx("div", { className: "slc-talk-notice", children: notice }), error && _jsx("div", { className: "slc-talk-meta slc-talk-meta--error", children: error }), _jsxs("label", { className: "slc-talk-toggle", children: [_jsx("input", { type: "checkbox", checked: autoplay, onChange: (e) => onAutoplay(e.target.checked) }), "Play ", who, "'s replies on the diagram as they arrive"] }), _jsxs("ol", { className: "slc-talk-thread", children: [newest.length === 0 && (_jsx("li", { className: "slc-stage-empty", children: "Nothing said or marked in this episode yet. Look at a drawing, press Record, and speak, or mark it." })), !saidAny && marks.length > 0 && (_jsxs("li", { className: "slc-stage-empty", children: [marksSummary(marks, who), ". Nothing said by voice yet."] })), newest.map((item) => item.kind === "mark" ? (_jsx("li", { className: `slc-talk-entry slc-talk-entry--mark${markStanding(item) === "waits for agent" ? " slc-talk-entry--waits" : ""}`, children: _jsxs("button", { type: "button", className: "slc-talk-mark", onClick: () => onOpenMark?.(item), disabled: !onOpenMark, title: `Open ${drawingName(item.doc ?? item.drawing, item.title)} at this mark`, children: [_jsxs("span", { className: "slc-talk-who", children: [_jsx(PinIcon, { size: 14 }), _jsxs("span", { className: "slc-talk-mark-head", children: [_jsx("strong", { children: speaker(item.author, who) }), " marked ", placeOf(item)] }), _jsx("span", { children: when(item.at) })] }), _jsx("span", { className: "slc-talk-text", children: item.text }), item.replies.length > 0 && (_jsx("span", { className: "slc-talk-mark-replies", children: item.replies.map((r, i) => (_jsxs("span", { className: `slc-talk-mark-reply slc-talk-mark-reply--${r.author.role}`, children: [_jsxs("span", { className: "slc-talk-mark-by", children: [speaker(r.author, who), r.at ? ` · ${when(r.at)}` : ""] }), _jsx("span", { className: "slc-talk-text", children: r.text })] }, i))) })), _jsx("span", { className: `slc-talk-mark-state${markStanding(item) === "waits for agent" ? " slc-talk-mark-state--waits" : ""}`, children: standing[markStanding(item)] })] }) }, `m${item.id}`)) : item.kind === "take" ? (_jsxs("li", { className: "slc-talk-entry slc-talk-entry--take", children: [_jsxs("div", { className: "slc-talk-who", children: [_jsx("strong", { children: "You" }), _jsxs("span", { children: ["take ", item.take, " \u00B7 ", when(item.at)] })] }), item.canvas?.doc && (_jsxs("div", { className: "slc-talk-canvas", children: ["on ", drawingOf(item.canvas.doc), item.canvas.focus ? ` · ${item.canvas.focus.slice(item.canvas.focus.indexOf(":") + 1)}` : "", item.canvas.step?.title ? ` · during “${item.canvas.step.title}”` : ""] })), _jsx("div", { className: "slc-talk-text", children: item.text || "(no transcript yet)" })] }, `t${item.take}`)) : (_jsxs("li", { className: `slc-talk-entry slc-talk-entry--reply${unheard.includes(item.id) ? " slc-talk-entry--new" : ""}`, children: [_jsxs("div", { className: "slc-talk-who", children: [_jsx("strong", { children: who }), _jsx("span", { children: when(item.at) }), (!item.unvoiced || (item.steps?.length ?? 0) > 0) &&
|
|
52
72
|
(playing === item.id ? (_jsx("button", { type: "button", className: "slc-stage-btn slc-talk-play slc-talk-play--on", onClick: onStop, "aria-label": "Stop", title: "Stop", children: _jsx(StopIcon, {}) })) : (_jsxs("button", { type: "button", className: "slc-stage-btn slc-talk-play", onClick: () => onPlay(item.id), disabled: live, title: item.unvoiced
|
|
53
73
|
? `Walk the diagram with ${who}'s words (no voice)`
|
|
54
74
|
: item.steps?.length
|
|
55
75
|
? `Hear ${who} walk the diagram (${item.steps.length} steps)`
|
|
56
|
-
: `Hear ${who}`, children: [_jsx(PlayIcon, {}), (item.steps?.length ?? 0) > 0 ? _jsxs("span", { children: ["Walk ", item.steps.length, " steps"] }) : null, unheard.includes(item.id) ? _jsx("span", { className: "slc-talk-new", children: "New" }) : null] }))), onFeedback && (_jsx("span", { className: "slc-talk-thumbs", children: ["up", "down"].map((v) => (_jsx("button", { type: "button", className: `slc-talk-thumb${item.feedback === v ? " slc-talk-thumb--on" : ""}`, onClick: () => onFeedback(item.id, item.feedback === v ? "" : v), "aria-label": v === "up" ? "This reply worked" : "This reply missed", children: v === "up" ? _jsx(ThumbUpIcon, { size: 15 }) : _jsx(ThumbDownIcon, { size: 15 }) }, v))) }))] }),
|
|
76
|
+
: `Hear ${who}`, children: [_jsx(PlayIcon, {}), (item.steps?.length ?? 0) > 0 ? _jsxs("span", { children: ["Walk ", item.steps.length, " steps"] }) : null, unheard.includes(item.id) ? _jsx("span", { className: "slc-talk-new", children: "New" }) : null] }))), onFeedback && (_jsx("span", { className: "slc-talk-thumbs", children: ["up", "down"].map((v) => (_jsx("button", { type: "button", className: `slc-talk-thumb${item.feedback === v ? " slc-talk-thumb--on" : ""}`, onClick: () => onFeedback(item.id, item.feedback === v ? "" : v), "aria-label": v === "up" ? "This reply worked" : "This reply missed", children: v === "up" ? _jsx(ThumbUpIcon, { size: 15 }) : _jsx(ThumbDownIcon, { size: 15 }) }, v))) }))] }), item.mark && (_jsxs("button", { type: "button", className: "slc-talk-answers", onClick: () => {
|
|
77
|
+
const m = marksById.get(item.mark.id);
|
|
78
|
+
if (m)
|
|
79
|
+
onOpenMark?.(m);
|
|
80
|
+
}, disabled: !onOpenMark || !marksById.has(item.mark.id), children: [_jsx(PinIcon, { size: 13 }), "answers your mark on ", marksById.has(item.mark.id) ? placeOf(marksById.get(item.mark.id)) : drawingName(item.mark.doc)] })), (item.steps?.length ?? 0) > 0 ? (_jsx("ol", { className: "slc-talk-steps", "aria-label": `${who}'s walk through the diagram`, children: item.steps.map((step, i) => {
|
|
57
81
|
const here = playing === item.id && playingStep === i;
|
|
58
82
|
return (_jsx("li", { children: _jsxs("button", { type: "button", className: `slc-talk-step${here ? " slc-talk-step--here" : ""}`, onClick: () => onPlay(item.id, i), disabled: live, "aria-current": here ? "step" : undefined, title: `Walk from step ${i + 1}`, children: [_jsx("span", { className: "slc-talk-step-n", children: i + 1 }), _jsxs("span", { className: "slc-talk-step-body", children: [(step.title || step.doc) && (_jsxs("span", { className: "slc-talk-step-head", children: [step.title && _jsx("strong", { children: step.title }), (step.doc || litOf(step)) && (_jsx("span", { className: "slc-talk-step-where", children: [drawingOf(step.doc), litOf(step)].filter(Boolean).join(" · ") }))] })), _jsx("span", { className: "slc-talk-step-say", children: step.say })] })] }) }, i));
|
|
59
83
|
}) })) : (_jsx("div", { className: "slc-talk-text", children: item.text })), item.unvoiced && _jsx("div", { className: "slc-talk-meta", children: item.unvoiced })] }, `r${item.id}`)))] })] }) }));
|
package/dist/MarkCards.d.ts
CHANGED
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
* - `<MarkNotice>`: one line near the board's controls when an agent answers
|
|
11
11
|
* ("Mia answered mark 3"); a tap opens that thread. It takes no focus.
|
|
12
12
|
*
|
|
13
|
+
* Elements are named as the person sees them on the board ("Witnessing", "id in
|
|
14
|
+
* WaveCount", "message 8"), never by their focus keys; a host passes `labels`
|
|
15
|
+
* (focus key → words) for what only it can name, such as a message's words.
|
|
16
|
+
*
|
|
13
17
|
* Props in, callbacks out, as the canvases: the host writes the sidecar and
|
|
14
18
|
* tells the hub. A host that knows who will answer says so in `note`: one quiet
|
|
15
19
|
* line under the card ("Mia is listening in episode 412: she answers here"). The listener is any object shaped like
|
|
@@ -19,6 +23,7 @@
|
|
|
19
23
|
import { type CSSProperties, type ReactNode } from "react";
|
|
20
24
|
import { type Box, type Mark, type MarkKind } from "@miadi/stateloom-protocol";
|
|
21
25
|
import { type CanvasTheme } from "./theme.js";
|
|
26
|
+
import { type ElementLabels } from "./names.js";
|
|
22
27
|
/** Something that turns speech into words (`browserDictation()`). */
|
|
23
28
|
export interface ListenerLike {
|
|
24
29
|
start(onText: (text: string, final: boolean) => void, onEnd?: (error?: string) => void): void;
|
|
@@ -45,13 +50,17 @@ export interface MarkComposerProps {
|
|
|
45
50
|
placeholder?: string;
|
|
46
51
|
/** Who will answer the mark, from the host: one quiet line under the card. */
|
|
47
52
|
note?: ReactNode;
|
|
53
|
+
/** Words for elements only the host can name (a message's words), by focus key. */
|
|
54
|
+
labels?: ElementLabels;
|
|
48
55
|
theme?: Partial<CanvasTheme>;
|
|
49
56
|
className?: string;
|
|
50
57
|
style?: CSSProperties;
|
|
51
58
|
}
|
|
52
|
-
export declare function MarkComposer({ elements, region, author, onAuthorChange, onSubmit, onCancel, listener, listenAtOnce, busy, error, placeholder, note, theme, className, style, }: MarkComposerProps): import("react").JSX.Element;
|
|
59
|
+
export declare function MarkComposer({ elements, region, author, onAuthorChange, onSubmit, onCancel, listener, listenAtOnce, busy, error, placeholder, note, labels, theme, className, style, }: MarkComposerProps): import("react").JSX.Element;
|
|
53
60
|
export interface MarkThreadProps {
|
|
54
61
|
mark: Mark;
|
|
62
|
+
/** Play the linked narration, when the host has it for this reply. */
|
|
63
|
+
playReply?: (reply: NonNullable<Mark["replies"]>[number]) => (() => void) | undefined;
|
|
55
64
|
/** Its number on the board. */
|
|
56
65
|
number?: number;
|
|
57
66
|
onReply?: (text: string) => void;
|
|
@@ -67,11 +76,13 @@ export interface MarkThreadProps {
|
|
|
67
76
|
* agent: the last word is a person's and the mark is not resolved.
|
|
68
77
|
*/
|
|
69
78
|
note?: ReactNode;
|
|
79
|
+
/** Words for elements only the host can name (a message's words), by focus key. */
|
|
80
|
+
labels?: ElementLabels;
|
|
70
81
|
theme?: Partial<CanvasTheme>;
|
|
71
82
|
className?: string;
|
|
72
83
|
style?: CSSProperties;
|
|
73
84
|
}
|
|
74
|
-
export declare function MarkThread({ mark, number, onReply, onResolve, onReopen, onRemove, onClose, listener, busy, error, note, theme, className, style, }: MarkThreadProps): import("react").JSX.Element;
|
|
85
|
+
export declare function MarkThread({ mark, playReply, number, onReply, onResolve, onReopen, onRemove, onClose, listener, busy, error, note, labels, theme, className, style, }: MarkThreadProps): import("react").JSX.Element;
|
|
75
86
|
export interface MarksPanelProps {
|
|
76
87
|
marks: readonly Mark[];
|
|
77
88
|
selected?: string | null;
|
|
@@ -87,11 +98,13 @@ export interface MarksPanelProps {
|
|
|
87
98
|
* marked "new". `unreadMarks(marks, read)` from the protocol.
|
|
88
99
|
*/
|
|
89
100
|
unread?: readonly string[];
|
|
101
|
+
/** Words for elements only the host can name (a message's words), by focus key. */
|
|
102
|
+
labels?: ElementLabels;
|
|
90
103
|
theme?: Partial<CanvasTheme>;
|
|
91
104
|
className?: string;
|
|
92
105
|
style?: CSSProperties;
|
|
93
106
|
}
|
|
94
|
-
export declare function MarksPanel({ marks, selected, onSelect, onCopy, copied, onClose, note, unread, theme, className, style }: MarksPanelProps): import("react").JSX.Element;
|
|
107
|
+
export declare function MarksPanel({ marks, selected, onSelect, onCopy, copied, onClose, note, unread, labels, theme, className, style }: MarksPanelProps): import("react").JSX.Element;
|
|
95
108
|
export interface MarkNoticeProps {
|
|
96
109
|
/** The line: `agentWordText(agentWordIn(envelope))`, e.g. "Mia answered mark 3". */
|
|
97
110
|
children: ReactNode;
|
package/dist/MarkCards.js
CHANGED
|
@@ -11,6 +11,10 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
11
11
|
* - `<MarkNotice>`: one line near the board's controls when an agent answers
|
|
12
12
|
* ("Mia answered mark 3"); a tap opens that thread. It takes no focus.
|
|
13
13
|
*
|
|
14
|
+
* Elements are named as the person sees them on the board ("Witnessing", "id in
|
|
15
|
+
* WaveCount", "message 8"), never by their focus keys; a host passes `labels`
|
|
16
|
+
* (focus key → words) for what only it can name, such as a message's words.
|
|
17
|
+
*
|
|
14
18
|
* Props in, callbacks out, as the canvases: the host writes the sidecar and
|
|
15
19
|
* tells the hub. A host that knows who will answer says so in `note`: one quiet
|
|
16
20
|
* line under the card ("Mia is listening in episode 412: she answers here"). The listener is any object shaped like
|
|
@@ -18,9 +22,10 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
18
22
|
* socket and no speech code of its own.
|
|
19
23
|
*/
|
|
20
24
|
import { useEffect, useRef, useState } from "react";
|
|
21
|
-
import { MARK_KINDS, lastWordOf
|
|
25
|
+
import { MARK_KINDS, lastWordOf } from "@miadi/stateloom-protocol";
|
|
22
26
|
import { themeStyle } from "./theme.js";
|
|
23
|
-
import {
|
|
27
|
+
import { elementName, markPlace } from "./names.js";
|
|
28
|
+
import { CloseIcon, MicIcon, PlayIcon } from "./icons.js";
|
|
24
29
|
const KIND_LABEL = {
|
|
25
30
|
comment: "Comment",
|
|
26
31
|
question: "Question",
|
|
@@ -45,10 +50,16 @@ function useListening(listener, onText) {
|
|
|
45
50
|
};
|
|
46
51
|
return { listening, toggle };
|
|
47
52
|
}
|
|
48
|
-
function Anchor({ elements, region }) {
|
|
53
|
+
function Anchor({ elements, region, labels }) {
|
|
49
54
|
if (!elements?.length && !region)
|
|
50
55
|
return _jsx("span", { className: "slc-stage-chip slc-stage-chip--quiet", children: "the drawing" });
|
|
51
|
-
|
|
56
|
+
// An entity's attributes are left to the entity when it is marked too.
|
|
57
|
+
const marked = new Set(elements ?? []);
|
|
58
|
+
const shown = (elements ?? []).filter((e) => {
|
|
59
|
+
const owner = /^attribute:([^.]+)\./.exec(e);
|
|
60
|
+
return !owner || !marked.has(`entity:${owner[1]}`);
|
|
61
|
+
});
|
|
62
|
+
return (_jsxs(_Fragment, { children: [shown.map((e) => (_jsx("span", { className: "slc-stage-chip", title: e, children: elementName(e, labels) }, e))), region && !elements?.length && _jsx("span", { className: "slc-stage-chip slc-stage-chip--quiet", children: "an area" })] }));
|
|
52
63
|
}
|
|
53
64
|
/** Who will answer, as the host knows it: one muted line, nothing when the host has nothing to say. */
|
|
54
65
|
function Note({ children }) {
|
|
@@ -65,7 +76,7 @@ function finePointer() {
|
|
|
65
76
|
return false;
|
|
66
77
|
}
|
|
67
78
|
}
|
|
68
|
-
export function MarkComposer({ elements, region, author, onAuthorChange, onSubmit, onCancel, listener, listenAtOnce = false, busy = false, error, placeholder = "What should the agent know about this?", note, theme, className, style, }) {
|
|
79
|
+
export function MarkComposer({ elements, region, author, onAuthorChange, onSubmit, onCancel, listener, listenAtOnce = false, busy = false, error, placeholder = "What should the agent know about this?", note, labels, theme, className, style, }) {
|
|
69
80
|
const [text, setText] = useState("");
|
|
70
81
|
const [kind, setKind] = useState("comment");
|
|
71
82
|
const [name, setName] = useState(author);
|
|
@@ -93,14 +104,14 @@ export function MarkComposer({ elements, region, author, onAuthorChange, onSubmi
|
|
|
93
104
|
onAuthorChange?.(signed);
|
|
94
105
|
onSubmit({ text: text.trim(), kind, author: signed });
|
|
95
106
|
};
|
|
96
|
-
return (_jsxs("form", { className: `slc-stage-card slc-stage-composer${className ? ` ${className}` : ""}`, style: { ...themeStyle(theme), ...style }, onSubmit: submit, onPointerDown: (e) => e.stopPropagation(), children: [_jsxs("div", { className: "slc-stage-card-anchor", children: [_jsx("span", { className: "slc-stage-card-label", children: "On" }), _jsx(Anchor, { elements: elements, region: region })] }), _jsx("textarea", { ref: area, className: "slc-stage-input slc-stage-textarea", value: text, placeholder: listening ? "Listening…" : placeholder, onChange: (e) => setText(e.target.value), onKeyDown: (e) => {
|
|
107
|
+
return (_jsxs("form", { className: `slc-stage-card slc-stage-composer${className ? ` ${className}` : ""}`, style: { ...themeStyle(theme), ...style }, onSubmit: submit, onPointerDown: (e) => e.stopPropagation(), children: [_jsxs("div", { className: "slc-stage-card-anchor", children: [_jsx("span", { className: "slc-stage-card-label", children: "On" }), _jsx(Anchor, { elements: elements, region: region, labels: labels })] }), _jsx("textarea", { ref: area, className: "slc-stage-input slc-stage-textarea", value: text, placeholder: listening ? "Listening…" : placeholder, onChange: (e) => setText(e.target.value), onKeyDown: (e) => {
|
|
97
108
|
if (e.key === "Enter" && (e.metaKey || e.ctrlKey))
|
|
98
109
|
submit();
|
|
99
110
|
if (e.key === "Escape")
|
|
100
111
|
onCancel();
|
|
101
112
|
}, rows: 3 }), !author && (_jsx("input", { className: "slc-stage-input", value: name, placeholder: "Your name (signs your marks)", onChange: (e) => setName(e.target.value) })), _jsxs("div", { className: "slc-stage-card-row", children: [_jsx("select", { className: "slc-stage-input slc-stage-select", value: kind, onChange: (e) => setKind(e.target.value), "aria-label": "Kind of mark", children: MARK_KINDS.map((k) => (_jsx("option", { value: k, children: KIND_LABEL[k] }, k))) }), listener && (_jsx("button", { type: "button", className: `slc-stage-btn${listening ? " slc-stage-btn--live" : ""}`, onClick: () => toggle(text), "aria-pressed": listening, title: listening ? "Stop listening" : "Speak instead of typing", children: _jsx(MicIcon, {}) })), _jsx("span", { className: "slc-stage-spacer" }), _jsx("button", { type: "button", className: "slc-stage-btn slc-stage-btn--quiet", onClick: onCancel, children: "Cancel" }), _jsx("button", { type: "submit", className: "slc-stage-btn slc-stage-btn--main", disabled: !text.trim() || busy || (!author && !name.trim()), children: busy ? "Saving…" : "Mark" })] }), _jsx(Note, { children: note }), error && _jsx("div", { className: "slc-stage-card-error", children: error })] }));
|
|
102
113
|
}
|
|
103
|
-
export function MarkThread({ mark, number, onReply, onResolve, onReopen, onRemove, onClose, listener, busy = false, error, note, theme, className, style, }) {
|
|
114
|
+
export function MarkThread({ mark, playReply, number, onReply, onResolve, onReopen, onRemove, onClose, listener, busy = false, error, note, labels, theme, className, style, }) {
|
|
104
115
|
const [reply, setReply] = useState("");
|
|
105
116
|
const { listening, toggle } = useListening(listener, setReply);
|
|
106
117
|
const send = (e) => {
|
|
@@ -112,11 +123,14 @@ export function MarkThread({ mark, number, onReply, onResolve, onReopen, onRemov
|
|
|
112
123
|
onReply?.(reply.trim());
|
|
113
124
|
setReply("");
|
|
114
125
|
};
|
|
115
|
-
return (_jsxs("div", { className: `slc-stage-card slc-stage-thread${className ? ` ${className}` : ""}`, style: { ...themeStyle(theme), ...style }, onPointerDown: (e) => e.stopPropagation(), children: [_jsxs("div", { className: "slc-stage-card-row", children: [number !== undefined && _jsx("span", { className: `slc-stage-pin slc-stage-pin--inline slc-stage-pin--${mark.status === "resolved" ? "resolved" : mark.status}`, children: number }), _jsxs("span", { className: "slc-stage-card-label", children: [KIND_LABEL[mark.kind], " \u00B7 ", mark.status] }), _jsx("span", { className: "slc-stage-spacer" }), _jsx("button", { type: "button", className: "slc-stage-btn slc-stage-btn--quiet", onClick: onClose, "aria-label": "Close", children: _jsx(CloseIcon, {}) })] }), _jsx("div", { className: "slc-stage-card-anchor", children: _jsx(Anchor, { elements: mark.elements, region: mark.region }) }), _jsxs("ol", { className: "slc-stage-thread-list", children: [_jsxs("li", { className: `slc-stage-said slc-stage-said--${mark.author.role}`, children: [_jsx("span", { className: "slc-stage-said-who", children: mark.author.name }), _jsx("span", { className: "slc-stage-said-text", children: mark.text })] }), (mark.replies ?? []).map((r, i) =>
|
|
126
|
+
return (_jsxs("div", { className: `slc-stage-card slc-stage-thread${className ? ` ${className}` : ""}`, style: { ...themeStyle(theme), ...style }, onPointerDown: (e) => e.stopPropagation(), children: [_jsxs("div", { className: "slc-stage-card-row", children: [number !== undefined && _jsx("span", { className: `slc-stage-pin slc-stage-pin--inline slc-stage-pin--${mark.status === "resolved" ? "resolved" : mark.status}`, children: number }), _jsxs("span", { className: "slc-stage-card-label", children: [KIND_LABEL[mark.kind], " \u00B7 ", mark.status] }), _jsx("span", { className: "slc-stage-spacer" }), _jsx("button", { type: "button", className: "slc-stage-btn slc-stage-btn--quiet", onClick: onClose, "aria-label": "Close", children: _jsx(CloseIcon, {}) })] }), _jsx("div", { className: "slc-stage-card-anchor", children: _jsx(Anchor, { elements: mark.elements, region: mark.region, labels: labels }) }), _jsxs("ol", { className: "slc-stage-thread-list", children: [_jsxs("li", { className: `slc-stage-said slc-stage-said--${mark.author.role}`, children: [_jsx("span", { className: "slc-stage-said-who", children: mark.author.name }), _jsx("span", { className: "slc-stage-said-text", children: mark.text })] }), (mark.replies ?? []).map((r, i) => {
|
|
127
|
+
const play = r.author.role === "agent" ? playReply?.(r) : undefined;
|
|
128
|
+
return (_jsxs("li", { className: `slc-stage-said slc-stage-said--${r.author.role}`, children: [_jsxs("div", { className: "slc-stage-card-row", children: [_jsx("span", { className: "slc-stage-said-who", children: r.author.name }), play && (_jsx("button", { type: "button", className: "slc-stage-btn slc-stage-btn--quiet", onClick: play, "aria-label": `Play reply from ${r.author.name}`, title: `Play reply from ${r.author.name}`, children: _jsx(PlayIcon, {}) }))] }), _jsx("span", { className: "slc-stage-said-text", children: r.text })] }, i));
|
|
129
|
+
})] }), mark.status !== "resolved" && lastWordOf(mark) === "person" && _jsx(Note, { children: note }), onReply && (_jsxs("form", { className: "slc-stage-card-row", onSubmit: send, children: [_jsx("input", { className: "slc-stage-input slc-stage-grow", value: reply, placeholder: listening ? "Listening…" : "Reply…", onChange: (e) => setReply(e.target.value) }), listener && (_jsx("button", { type: "button", className: `slc-stage-btn${listening ? " slc-stage-btn--live" : ""}`, onClick: () => toggle(reply), "aria-pressed": listening, title: "Speak the reply", children: _jsx(MicIcon, {}) })), _jsx("button", { type: "submit", className: "slc-stage-btn slc-stage-btn--main", disabled: !reply.trim() || busy, children: "Reply" })] })), _jsxs("div", { className: "slc-stage-card-row", children: [mark.status === "resolved"
|
|
116
130
|
? onReopen && (_jsx("button", { type: "button", className: "slc-stage-btn", onClick: onReopen, children: "Reopen" }))
|
|
117
131
|
: onResolve && (_jsx("button", { type: "button", className: "slc-stage-btn", onClick: onResolve, children: "Resolve" })), _jsx("span", { className: "slc-stage-spacer" }), onRemove && (_jsx("button", { type: "button", className: "slc-stage-btn slc-stage-btn--danger", onClick: onRemove, children: "Remove" }))] }), error && _jsx("div", { className: "slc-stage-card-error", children: error })] }));
|
|
118
132
|
}
|
|
119
|
-
export function MarksPanel({ marks, selected, onSelect, onCopy, copied, onClose, note, unread, theme, className, style }) {
|
|
133
|
+
export function MarksPanel({ marks, selected, onSelect, onCopy, copied, onClose, note, unread, labels, theme, className, style }) {
|
|
120
134
|
const [all, setAll] = useState(false);
|
|
121
135
|
const unreadIds = new Set(unread ?? []);
|
|
122
136
|
// Numbered as on the board; the ones with an agent's word not yet read first.
|
|
@@ -124,7 +138,7 @@ export function MarksPanel({ marks, selected, onSelect, onCopy, copied, onClose,
|
|
|
124
138
|
const ordered = [...numbered.filter(({ m }) => unreadIds.has(m.id)), ...numbered.filter(({ m }) => !unreadIds.has(m.id))];
|
|
125
139
|
const shown = all ? ordered : ordered.filter(({ m }) => m.status !== "resolved");
|
|
126
140
|
const open = marks.filter((m) => m.status !== "resolved").length;
|
|
127
|
-
return (_jsxs("div", { className: `slc-stage-card slc-stage-panel${className ? ` ${className}` : ""}`, style: { ...themeStyle(theme), ...style }, onPointerDown: (e) => e.stopPropagation(), children: [_jsxs("div", { className: "slc-stage-card-row", children: [_jsx("span", { className: "slc-stage-card-label", children: "Marks on this drawing" }), _jsx("span", { className: "slc-stage-spacer" }), _jsxs("span", { className: "slc-stage-segment", role: "group", "aria-label": "Which marks to list", children: [_jsxs("button", { type: "button", className: `slc-stage-segment-btn${all ? "" : " slc-stage-segment-btn--on"}`, "aria-pressed": !all, onClick: () => setAll(false), children: ["Open ", open] }), _jsxs("button", { type: "button", className: `slc-stage-segment-btn${all ? " slc-stage-segment-btn--on" : ""}`, "aria-pressed": all, onClick: () => setAll(true), children: ["All ", marks.length] })] }), onClose && (_jsx("button", { type: "button", className: "slc-stage-btn slc-stage-btn--quiet", onClick: onClose, "aria-label": "Close", children: _jsx(CloseIcon, {}) }))] }), shown.length === 0 && _jsx("div", { className: "slc-stage-empty", children: marks.length ? "Every mark is resolved." : "No marks yet. Turn on marking (✎) and tap or draw around what you mean." }), _jsx("ul", { className: "slc-stage-panel-list", children: shown.map(({ m, n }) => (_jsx("li", { children: _jsxs("button", { type: "button", className: `slc-stage-panel-item${m.id === selected ? " slc-stage-panel-item--selected" : ""}`, onClick: () => onSelect(m.id), children: [_jsx("span", { className: `slc-stage-pin slc-stage-pin--inline slc-stage-pin--${m.status === "resolved" ? "resolved" : m.author.role === "agent" && m.status === "open" ? "question" : m.status}${unreadIds.has(m.id) ? " slc-stage-pin--new" : ""}`, children: n }), _jsxs("span", { className: "slc-stage-panel-text", children: [_jsx("span", { className: "slc-stage-panel-said", children: m.text }), _jsxs("span", { className: "slc-stage-panel-meta", children: [unreadIds.has(m.id) && _jsx("span", { className: "slc-stage-new", children: "new" }), m.author.name, " \u00B7 ",
|
|
141
|
+
return (_jsxs("div", { className: `slc-stage-card slc-stage-panel${className ? ` ${className}` : ""}`, style: { ...themeStyle(theme), ...style }, onPointerDown: (e) => e.stopPropagation(), children: [_jsxs("div", { className: "slc-stage-card-row", children: [_jsx("span", { className: "slc-stage-card-label", children: "Marks on this drawing" }), _jsx("span", { className: "slc-stage-spacer" }), _jsxs("span", { className: "slc-stage-segment", role: "group", "aria-label": "Which marks to list", children: [_jsxs("button", { type: "button", className: `slc-stage-segment-btn${all ? "" : " slc-stage-segment-btn--on"}`, "aria-pressed": !all, onClick: () => setAll(false), children: ["Open ", open] }), _jsxs("button", { type: "button", className: `slc-stage-segment-btn${all ? " slc-stage-segment-btn--on" : ""}`, "aria-pressed": all, onClick: () => setAll(true), children: ["All ", marks.length] })] }), onClose && (_jsx("button", { type: "button", className: "slc-stage-btn slc-stage-btn--quiet", onClick: onClose, "aria-label": "Close", children: _jsx(CloseIcon, {}) }))] }), shown.length === 0 && _jsx("div", { className: "slc-stage-empty", children: marks.length ? "Every mark is resolved." : "No marks yet. Turn on marking (✎) and tap or draw around what you mean." }), _jsx("ul", { className: "slc-stage-panel-list", children: shown.map(({ m, n }) => (_jsx("li", { children: _jsxs("button", { type: "button", className: `slc-stage-panel-item${m.id === selected ? " slc-stage-panel-item--selected" : ""}`, onClick: () => onSelect(m.id), children: [_jsx("span", { className: `slc-stage-pin slc-stage-pin--inline slc-stage-pin--${m.status === "resolved" ? "resolved" : m.author.role === "agent" && m.status === "open" ? "question" : m.status}${unreadIds.has(m.id) ? " slc-stage-pin--new" : ""}`, children: n }), _jsxs("span", { className: "slc-stage-panel-text", children: [_jsx("span", { className: "slc-stage-panel-said", children: m.text }), _jsxs("span", { className: "slc-stage-panel-meta", children: [unreadIds.has(m.id) && _jsx("span", { className: "slc-stage-new", children: "new" }), m.author.name, " \u00B7 ", markPlace(m, labels), m.replies?.length ? ` · ${m.replies.length} repl${m.replies.length === 1 ? "y" : "ies"}` : ""] })] })] }) }, m.id))) }), _jsx(Note, { children: note }), onCopy && (_jsxs("div", { className: "slc-stage-card-row", children: [_jsx("span", { className: "slc-stage-spacer" }), _jsx("button", { type: "button", className: "slc-stage-btn", onClick: onCopy, title: "Copy what is on screen and the waiting marks, to paste into any agent", children: copied ? "Copied" : "Copy for the agent" })] }))] }));
|
|
128
142
|
}
|
|
129
143
|
/**
|
|
130
144
|
* One line that says an agent answered, near the board's controls. A polite
|
package/dist/StageCaption.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The words of the step on stage, and the buttons that move a tour (Spec 83).
|
|
3
3
|
*
|
|
4
|
-
* A card over the bottom of the board: who is presenting, the
|
|
5
|
-
*
|
|
6
|
-
* the
|
|
7
|
-
*
|
|
8
|
-
* the
|
|
4
|
+
* A card over the bottom of the board: who is presenting, the step's own title
|
|
5
|
+
* as the heading (it may wrap to two lines), the step's place and the tour's
|
|
6
|
+
* name on the line under it, what the agent says, where the tour stands. The
|
|
7
|
+
* controls are the person's: back, play or pause, forward, the voice on or off,
|
|
8
|
+
* answer (the host opens a mark on what is lit), close. Nothing here plays
|
|
9
|
+
* anything; the buttons call the host, which holds the stage session.
|
|
10
|
+
*
|
|
11
|
+
* When the step is about a drawing that is not on the board (`held`: a page
|
|
12
|
+
* opened on another drawing caught up with what the stage holds), the caption
|
|
13
|
+
* says which drawing it is about, its main button opens that drawing and plays
|
|
14
|
+
* ("Open and play"), and Answer is absent — a mark would land on the wrong
|
|
15
|
+
* drawing.
|
|
9
16
|
*/
|
|
10
17
|
import type { CSSProperties } from "react";
|
|
11
18
|
import type { TourStep } from "@miadi/stateloom-protocol";
|
|
@@ -20,6 +27,7 @@ export interface StageCaptionProps {
|
|
|
20
27
|
} | null;
|
|
21
28
|
playing?: boolean;
|
|
22
29
|
speaking?: boolean;
|
|
30
|
+
playbackError?: string | null;
|
|
23
31
|
/** The canvas's voice is on. Absent: no voice button. */
|
|
24
32
|
voice?: boolean;
|
|
25
33
|
onToggleVoice?: () => void;
|
|
@@ -31,9 +39,18 @@ export interface StageCaptionProps {
|
|
|
31
39
|
onClose?: () => void;
|
|
32
40
|
/** Answer what is lit: the host opens a mark on it. Absent: no answer button. */
|
|
33
41
|
onAnswer?: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* The step is about a drawing that is not on the board: its name, and what opens it.
|
|
44
|
+
* The caption names it, its main button says `label` ("Open and play"), and Answer is absent.
|
|
45
|
+
*/
|
|
46
|
+
held?: {
|
|
47
|
+
drawing: string;
|
|
48
|
+
label?: string;
|
|
49
|
+
onOpen: () => void;
|
|
50
|
+
} | null;
|
|
34
51
|
theme?: Partial<CanvasTheme>;
|
|
35
52
|
className?: string;
|
|
36
53
|
style?: CSSProperties;
|
|
37
54
|
}
|
|
38
|
-
export declare function StageCaption({ shown, playing, speaking, voice, onToggleVoice, onPlay, onPause, onNext, onPrev, onGoto, onClose, onAnswer, theme, className, style, }: StageCaptionProps): import("react").JSX.Element | null;
|
|
55
|
+
export declare function StageCaption({ shown, playing, speaking, playbackError, voice, onToggleVoice, onPlay, onPause, onNext, onPrev, onGoto, onClose, onAnswer, held, theme, className, style, }: StageCaptionProps): import("react").JSX.Element | null;
|
|
39
56
|
export default StageCaption;
|
package/dist/StageCaption.js
CHANGED
|
@@ -3,13 +3,16 @@ import { themeStyle } from "./theme.js";
|
|
|
3
3
|
import { CloseIcon, NextIcon, PauseIcon, PlayIcon, PrevIcon, SpeakerIcon, SpeakerOffIcon } from "./icons.js";
|
|
4
4
|
/** Past this many steps the dots give way to the count alone. */
|
|
5
5
|
const MAX_DOTS = 24;
|
|
6
|
-
export function StageCaption({ shown, playing = false, speaking = false, voice, onToggleVoice, onPlay, onPause, onNext, onPrev, onGoto, onClose, onAnswer, theme, className, style, }) {
|
|
6
|
+
export function StageCaption({ shown, playing = false, speaking = false, playbackError, voice, onToggleVoice, onPlay, onPause, onNext, onPrev, onGoto, onClose, onAnswer, held = null, theme, className, style, }) {
|
|
7
7
|
if (!shown)
|
|
8
8
|
return null;
|
|
9
9
|
const { step, index, count, title, origin } = shown;
|
|
10
10
|
const inTour = index !== null && count !== null;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
// The step's own title is the heading; the tour's name goes beside the count.
|
|
12
|
+
const heading = step.title || title || "";
|
|
13
|
+
const place = [inTour ? `${index + 1} / ${count}` : "", step.title ? title : ""].filter(Boolean).join(" · ");
|
|
14
|
+
const many = inTour && count > 7;
|
|
15
|
+
return (_jsxs("section", { className: `slc-stage-caption${className ? ` ${className}` : ""}`, style: { ...themeStyle(theme), ...style }, role: "region", "aria-label": "What the agent is showing", "aria-live": "polite", children: [_jsxs("header", { className: "slc-stage-caption-head", children: [origin && _jsx("span", { className: "slc-stage-caption-origin", children: origin }), _jsxs("span", { className: "slc-stage-caption-heading", children: [heading && _jsx("span", { className: "slc-stage-caption-title", children: heading }), place && _jsx("span", { className: "slc-stage-caption-count", children: place })] }), speaking && _jsx("span", { className: "slc-stage-caption-speaking", "aria-label": "speaking" }), onClose && (_jsx("button", { type: "button", className: "slc-stage-btn slc-stage-btn--quiet", onClick: onClose, "aria-label": "Close", title: "Close", children: _jsx(CloseIcon, {}) }))] }), held && (_jsxs("p", { className: "slc-stage-caption-held", children: ["About ", _jsx("strong", { children: held.drawing }), ", not the drawing open here."] })), _jsx("p", { className: "slc-stage-caption-say", children: step.say }), playbackError && _jsx("div", { className: "slc-stage-card-error", role: "status", children: playbackError }), inTour && count <= MAX_DOTS && count > 1 && (_jsx("nav", { className: `slc-stage-dots${many ? " slc-stage-dots--many" : ""}`, "aria-label": "Steps", children: Array.from({ length: count }, (_, i) => (_jsx("button", { type: "button", className: `slc-stage-dot${i === index ? " slc-stage-dot--current" : i < index ? " slc-stage-dot--seen" : ""}`, onClick: () => onGoto?.(i), "aria-label": `Step ${i + 1}`, "aria-current": i === index ? "step" : undefined }, i))) })), _jsxs("footer", { className: "slc-stage-caption-controls", children: [inTour && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "slc-stage-btn", onClick: onPrev, disabled: index === 0, "aria-label": "Previous step", title: "Previous step", children: _jsx(PrevIcon, {}) }), held ? (_jsxs("button", { type: "button", className: "slc-stage-btn slc-stage-btn--main", onClick: held.onOpen, title: `Open ${held.drawing} and play from this step`, children: [_jsx(PlayIcon, {}), held.label ?? "Open and play"] })) : playing ? (_jsx("button", { type: "button", className: "slc-stage-btn slc-stage-btn--main", onClick: onPause, "aria-label": "Pause", title: "Pause", children: _jsx(PauseIcon, {}) })) : (_jsx("button", { type: "button", className: "slc-stage-btn slc-stage-btn--main", onClick: onPlay, "aria-label": "Play", title: "Play", children: _jsx(PlayIcon, {}) })), _jsx("button", { type: "button", className: "slc-stage-btn", onClick: onNext, disabled: index === count - 1, "aria-label": "Next step", title: "Next step", children: _jsx(NextIcon, {}) })] })), !inTour && held && (_jsx("button", { type: "button", className: "slc-stage-btn slc-stage-btn--main", onClick: held.onOpen, title: `Open ${held.drawing}`, children: held.label ?? "Open the drawing" })), _jsx("span", { className: "slc-stage-spacer" }), voice !== undefined && (_jsx("button", { type: "button", className: `slc-stage-btn${voice ? " slc-stage-btn--on" : ""}`, onClick: onToggleVoice, "aria-pressed": voice, title: voice ? "Voice on — the steps are read aloud" : "Voice off — the steps are read on screen", children: voice ? _jsx(SpeakerIcon, {}) : _jsx(SpeakerOffIcon, {}) })), onAnswer && !held && (_jsx("button", { type: "button", className: "slc-stage-btn slc-stage-btn--answer", onClick: onAnswer, title: "Answer \u2014 mark what is lit and say something about it", children: "Answer" }))] })] }));
|
|
13
16
|
}
|
|
14
17
|
export default StageCaption;
|
|
15
18
|
//# sourceMappingURL=StageCaption.js.map
|
package/dist/StageOverlay.d.ts
CHANGED
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
* - **pins** each mark at what it points at, numbered, coloured by whether it
|
|
13
13
|
* waits (open), was answered, or is done — a tap opens its thread; a mark
|
|
14
14
|
* the host lists in `unread` (an agent's word not yet opened) wears a quiet
|
|
15
|
-
* "new" ring and dot
|
|
15
|
+
* "new" ring and dot. Every pin stays inside the board, pins that land on one
|
|
16
|
+
* point fan out down its right edge, and none sits under a box the host says
|
|
17
|
+
* to keep clear (`avoid`: the board's own buttons) — `placePins`;
|
|
16
18
|
* - **takes a mark** when the host turns marking on: a tap names the element
|
|
17
19
|
* under it, a drag names the elements inside the area drawn (and the area).
|
|
18
20
|
* A mouse or pen tap on empty board marks a small area there; a finger's tap
|
|
@@ -55,11 +57,13 @@ export interface StageOverlayProps {
|
|
|
55
57
|
onDraft?: (draft: MarkDraft) => void;
|
|
56
58
|
/** A mark being written: its elements ringed, its area framed. */
|
|
57
59
|
draft?: MarkDraft | null;
|
|
60
|
+
/** Boxes no pin may cover, in the board's screen coordinates: the host's buttons over the board. */
|
|
61
|
+
avoid?: readonly Box[];
|
|
58
62
|
theme?: Partial<CanvasTheme>;
|
|
59
63
|
className?: string;
|
|
60
64
|
style?: CSSProperties;
|
|
61
65
|
}
|
|
62
66
|
/** Where a mark sits: its elements that are drawn here, else its area. */
|
|
63
67
|
export declare function markAnchor(mark: Pick<Mark, "elements" | "region">, boxes: readonly ElementBox[]): Box | null;
|
|
64
|
-
export declare function StageOverlay({ viewport, boxes, spotlight, region, marks, selectedMark, onSelectMark, unread, hideResolved, marking, onDraft, draft, theme, className, style, }: StageOverlayProps): import("react").JSX.Element;
|
|
68
|
+
export declare function StageOverlay({ viewport, boxes, spotlight, region, marks, selectedMark, onSelectMark, unread, hideResolved, marking, onDraft, draft, avoid, theme, className, style, }: StageOverlayProps): import("react").JSX.Element;
|
|
65
69
|
export default StageOverlay;
|
package/dist/StageOverlay.js
CHANGED
|
@@ -13,7 +13,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
13
13
|
* - **pins** each mark at what it points at, numbered, coloured by whether it
|
|
14
14
|
* waits (open), was answered, or is done — a tap opens its thread; a mark
|
|
15
15
|
* the host lists in `unread` (an agent's word not yet opened) wears a quiet
|
|
16
|
-
* "new" ring and dot
|
|
16
|
+
* "new" ring and dot. Every pin stays inside the board, pins that land on one
|
|
17
|
+
* point fan out down its right edge, and none sits under a box the host says
|
|
18
|
+
* to keep clear (`avoid`: the board's own buttons) — `placePins`;
|
|
17
19
|
* - **takes a mark** when the host turns marking on: a tap names the element
|
|
18
20
|
* under it, a drag names the elements inside the area drawn (and the area).
|
|
19
21
|
* A mouse or pen tap on empty board marks a small area there; a finger's tap
|
|
@@ -24,9 +26,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
24
26
|
* box); it lets every pointer through to the canvas except on its pins and
|
|
25
27
|
* while marking.
|
|
26
28
|
*/
|
|
27
|
-
import { useId, useMemo, useRef, useState } from "react";
|
|
29
|
+
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
|
28
30
|
import { boxesOf, elementAt, elementsInRegion, padBox, screenToWorld, unionBox, viewportTransform, worldToScreen, } from "@miadi/stateloom-protocol";
|
|
29
31
|
import { themeStyle } from "./theme.js";
|
|
32
|
+
import { placePins } from "./pins.js";
|
|
30
33
|
/** Below this many screen pixels a press is a tap, not an area. */
|
|
31
34
|
const DRAG_THRESHOLD = 6;
|
|
32
35
|
/** A tap on empty board marks a square this many screen pixels wide around it. */
|
|
@@ -44,11 +47,35 @@ function pinTone(mark) {
|
|
|
44
47
|
return mark.status === "answered" ? "answered" : "question";
|
|
45
48
|
return mark.status === "answered" ? "answered" : "open";
|
|
46
49
|
}
|
|
47
|
-
export function StageOverlay({ viewport, boxes, spotlight, region, marks, selectedMark = null, onSelectMark, unread, hideResolved = true, marking = false, onDraft, draft = null, theme, className, style, }) {
|
|
50
|
+
export function StageOverlay({ viewport, boxes, spotlight, region, marks, selectedMark = null, onSelectMark, unread, hideResolved = true, marking = false, onDraft, draft = null, avoid, theme, className, style, }) {
|
|
48
51
|
const maskId = `slc-stage-mask-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
49
52
|
const rootRef = useRef(null);
|
|
50
53
|
const press = useRef(null);
|
|
51
54
|
const [drag, setDrag] = useState(null);
|
|
55
|
+
// The board's size, for keeping pins inside it; and whether a finger (bigger pins) points.
|
|
56
|
+
const [size, setSize] = useState(null);
|
|
57
|
+
const [coarse, setCoarse] = useState(false);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
const el = rootRef.current;
|
|
60
|
+
if (!el)
|
|
61
|
+
return;
|
|
62
|
+
const measure = () => {
|
|
63
|
+
const r = el.getBoundingClientRect();
|
|
64
|
+
setSize((s) => (s && s.w === r.width && s.h === r.height ? s : { w: r.width, h: r.height }));
|
|
65
|
+
};
|
|
66
|
+
measure();
|
|
67
|
+
try {
|
|
68
|
+
setCoarse(window.matchMedia("(pointer: coarse)").matches);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// No media queries here: mouse-sized pins.
|
|
72
|
+
}
|
|
73
|
+
if (typeof ResizeObserver === "undefined")
|
|
74
|
+
return;
|
|
75
|
+
const watch = new ResizeObserver(measure);
|
|
76
|
+
watch.observe(el);
|
|
77
|
+
return () => watch.disconnect();
|
|
78
|
+
}, []);
|
|
52
79
|
const holes = useMemo(() => (spotlight?.length ? boxesOf(boxes, spotlight).map((b) => padBox(b, HOLE_PAD)) : []), [boxes, spotlight]);
|
|
53
80
|
const vt = viewportTransform(viewport);
|
|
54
81
|
const selected = marks?.find((m) => m.id === selectedMark) ?? null;
|
|
@@ -62,7 +89,7 @@ export function StageOverlay({ viewport, boxes, spotlight, region, marks, select
|
|
|
62
89
|
return out.map((b) => padBox(b, 4));
|
|
63
90
|
}, [boxes, selected, draft]);
|
|
64
91
|
const framed = [selected?.region, draft?.region].filter((b) => !!b);
|
|
65
|
-
const
|
|
92
|
+
const anchored = (marks ?? [])
|
|
66
93
|
.map((m, i) => ({ mark: m, n: i + 1 }))
|
|
67
94
|
.filter(({ mark }) => !(hideResolved && mark.status === "resolved" && mark.id !== selectedMark))
|
|
68
95
|
.map(({ mark, n }) => {
|
|
@@ -73,6 +100,8 @@ export function StageOverlay({ viewport, boxes, spotlight, region, marks, select
|
|
|
73
100
|
return { mark, n, x: p.x, y: p.y };
|
|
74
101
|
})
|
|
75
102
|
.filter((p) => p !== null);
|
|
103
|
+
const placed = size?.w ? placePins(anchored, { width: size.w, height: size.h, size: coarse ? 30 : 22, avoid }) : anchored;
|
|
104
|
+
const pins = anchored.map((p, i) => ({ ...p, x: placed[i].x, y: placed[i].y }));
|
|
76
105
|
const local = (e) => {
|
|
77
106
|
const r = rootRef.current?.getBoundingClientRect();
|
|
78
107
|
return { x: e.clientX - (r?.left ?? 0), y: e.clientY - (r?.top ?? 0) };
|
package/dist/icons.d.ts
CHANGED
|
@@ -25,4 +25,6 @@ export declare function ThumbDownIcon(p: IconProps): import("react").JSX.Element
|
|
|
25
25
|
export declare function CloseIcon(p: IconProps): import("react").JSX.Element;
|
|
26
26
|
/** A pencil: marking is on, a tap or a drag marks the drawing. */
|
|
27
27
|
export declare function MarkIcon(p: IconProps): import("react").JSX.Element;
|
|
28
|
+
/** A map pin: a mark on a drawing, in the conversation. */
|
|
29
|
+
export declare function PinIcon(p: IconProps): import("react").JSX.Element;
|
|
28
30
|
export {};
|
package/dist/icons.js
CHANGED
|
@@ -43,4 +43,8 @@ export function CloseIcon(p) {
|
|
|
43
43
|
export function MarkIcon(p) {
|
|
44
44
|
return (_jsxs(Icon, { ...p, children: [_jsx("path", { d: "M4.5 19.5l1-4.2L15.8 5a1.8 1.8 0 0 1 2.5 0l.7.7a1.8 1.8 0 0 1 0 2.5L8.7 18.5z" }), _jsx("path", { d: "M13.8 7l3.2 3.2" })] }));
|
|
45
45
|
}
|
|
46
|
+
/** A map pin: a mark on a drawing, in the conversation. */
|
|
47
|
+
export function PinIcon(p) {
|
|
48
|
+
return (_jsxs(Icon, { ...p, children: [_jsx("path", { d: "M12 21s-6.5-6.2-6.5-11.2a6.5 6.5 0 0 1 13 0C18.5 14.8 12 21 12 21z" }), _jsx("circle", { cx: "12", cy: "9.8", r: "2.3" })] }));
|
|
49
|
+
}
|
|
46
50
|
//# sourceMappingURL=icons.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -20,13 +20,17 @@ export { SequenceCanvas, drawableSequence } from "./SequenceCanvas.js";
|
|
|
20
20
|
export type { SequenceCanvasProps, SequenceCanvasTarget, SequenceSelection, SequenceTargetKind, } from "./SequenceCanvas.js";
|
|
21
21
|
export { StageOverlay, markAnchor } from "./StageOverlay.js";
|
|
22
22
|
export type { StageOverlayProps, MarkDraft } from "./StageOverlay.js";
|
|
23
|
+
export { placePins, fitLegibly } from "./pins.js";
|
|
24
|
+
export type { PinSpot, PinLayout, LegibleFitOptions } from "./pins.js";
|
|
25
|
+
export { elementName, markedNames, namesText, markPlace, drawingName, markStanding, marksSummary } from "./names.js";
|
|
26
|
+
export type { ElementLabels, MarkLike, MarkStanding } from "./names.js";
|
|
23
27
|
export { StageCaption } from "./StageCaption.js";
|
|
24
28
|
export type { StageCaptionProps } from "./StageCaption.js";
|
|
25
29
|
export { MarkComposer, MarkThread, MarksPanel, MarkNotice } from "./MarkCards.js";
|
|
26
30
|
export { useMarksRead, loadMarksRead, saveMarksRead, marksReadKey } from "./marksRead.js";
|
|
27
31
|
export { CompanionDock } from "./CompanionDock.js";
|
|
28
|
-
export type { CompanionDockProps, DockItem, DockReply, DockStep, DockTake } from "./CompanionDock.js";
|
|
29
|
-
export { MicIcon, SpeakerIcon, SpeakerOffIcon, MarksIcon, MarkIcon, PlayIcon, PauseIcon, StopIcon, PrevIcon, NextIcon, ThumbUpIcon, ThumbDownIcon, CloseIcon, } from "./icons.js";
|
|
32
|
+
export type { CompanionDockProps, DockItem, DockMark, DockReply, DockStep, DockTake } from "./CompanionDock.js";
|
|
33
|
+
export { MicIcon, SpeakerIcon, SpeakerOffIcon, MarksIcon, MarkIcon, PlayIcon, PauseIcon, StopIcon, PrevIcon, NextIcon, ThumbUpIcon, ThumbDownIcon, CloseIcon, PinIcon, } from "./icons.js";
|
|
30
34
|
export type { MarkComposerProps, MarkThreadProps, MarksPanelProps, MarkNoticeProps, ListenerLike } from "./MarkCards.js";
|
|
31
35
|
export { themeStyle, CANVAS_THEME_VARS } from "./theme.js";
|
|
32
36
|
export type { CanvasTheme } from "./theme.js";
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,12 @@ export { SequenceCanvas, drawableSequence } from "./SequenceCanvas.js";
|
|
|
19
19
|
// agent points at and takes a person's marks, the caption that plays a tour,
|
|
20
20
|
// and the cards marks are written and read in.
|
|
21
21
|
export { StageOverlay, markAnchor } from "./StageOverlay.js";
|
|
22
|
+
// Where pins stand (inside the board, fanned, clear of the board's buttons), and a view
|
|
23
|
+
// that frames the marks without going below a legible scale.
|
|
24
|
+
export { placePins, fitLegibly } from "./pins.js";
|
|
25
|
+
// Elements and marks in the person's words: "Witnessing", "id in WaveCount", "message 8";
|
|
26
|
+
// "Witnessing and 2 more"; "7 marks on Screenwalk, 6 answered".
|
|
27
|
+
export { elementName, markedNames, namesText, markPlace, drawingName, markStanding, marksSummary } from "./names.js";
|
|
22
28
|
export { StageCaption } from "./StageCaption.js";
|
|
23
29
|
export { MarkComposer, MarkThread, MarksPanel, MarkNotice } from "./MarkCards.js";
|
|
24
30
|
// Whether an agent's word has been read, per drawing in this browser, and
|
|
@@ -31,7 +37,7 @@ export { MarkComposer, MarkThread, MarksPanel, MarkNotice } from "./MarkCards.js
|
|
|
31
37
|
export { useMarksRead, loadMarksRead, saveMarksRead, marksReadKey } from "./marksRead.js";
|
|
32
38
|
// Talking with a companion from the canvas (Spec 84).
|
|
33
39
|
export { CompanionDock } from "./CompanionDock.js";
|
|
34
|
-
export { MicIcon, SpeakerIcon, SpeakerOffIcon, MarksIcon, MarkIcon, PlayIcon, PauseIcon, StopIcon, PrevIcon, NextIcon, ThumbUpIcon, ThumbDownIcon, CloseIcon, } from "./icons.js";
|
|
40
|
+
export { MicIcon, SpeakerIcon, SpeakerOffIcon, MarksIcon, MarkIcon, PlayIcon, PauseIcon, StopIcon, PrevIcon, NextIcon, ThumbUpIcon, ThumbDownIcon, CloseIcon, PinIcon, } from "./icons.js";
|
|
35
41
|
export { themeStyle, CANVAS_THEME_VARS } from "./theme.js";
|
|
36
42
|
export { childByName, childStatesAt, childrenOf, definedEvents, findState, livePath, parentAt, } from "./drill.js";
|
|
37
43
|
// The geometry and the model, re-exported at the address a host reaching for a
|
package/dist/names.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The elements a mark points at, named as the person sees them on the board (Spec 83).
|
|
3
|
+
*
|
|
4
|
+
* A mark keeps its elements as focus keys — `state:Witnessing`, `attribute:Screenwalk.state`,
|
|
5
|
+
* `message:8` — which is what agents read. A person reads the board: a state's name, an
|
|
6
|
+
* entity's name, a message's number and words. The host may pass `labels` (focus key →
|
|
7
|
+
* words), which win; a sequence host gives each message its words that way.
|
|
8
|
+
*
|
|
9
|
+
* Pure: no React, no DOM.
|
|
10
|
+
*/
|
|
11
|
+
import type { Box } from "@miadi/stateloom-protocol";
|
|
12
|
+
export type ElementLabels = Readonly<Record<string, string>>;
|
|
13
|
+
/** One element by the name the board shows: `state:Witnessing` → "Witnessing", `message:8` → "message 8". */
|
|
14
|
+
export declare function elementName(focus: string, labels?: ElementLabels): string;
|
|
15
|
+
/** The names of what is marked; an entity's attributes are left to the entity when it is marked too. */
|
|
16
|
+
export declare function markedNames(elements: readonly string[] | undefined, labels?: ElementLabels): string[];
|
|
17
|
+
/** "A", "A and B", "A, B and C", "A, B and 4 more". */
|
|
18
|
+
export declare function namesText(names: readonly string[]): string;
|
|
19
|
+
/** What a mark points at, in words: its elements, else an area (inside a machine's level), else the drawing. */
|
|
20
|
+
export declare function markPlace(mark: {
|
|
21
|
+
elements?: readonly string[];
|
|
22
|
+
region?: Box | null;
|
|
23
|
+
level?: string;
|
|
24
|
+
}, labels?: ElementLabels): string;
|
|
25
|
+
/** A drawing named for a person: its own name when known, else its file name without the format's extensions. */
|
|
26
|
+
export declare function drawingName(path: string | null | undefined, title?: string | null): string;
|
|
27
|
+
/** A mark as the conversation lists it: who wrote it, what it points at, and where it stands. */
|
|
28
|
+
export interface MarkLike {
|
|
29
|
+
doc?: string;
|
|
30
|
+
drawing?: string;
|
|
31
|
+
title?: string;
|
|
32
|
+
elements?: readonly string[];
|
|
33
|
+
region?: Box | null;
|
|
34
|
+
level?: string;
|
|
35
|
+
status: string;
|
|
36
|
+
author: {
|
|
37
|
+
name?: string;
|
|
38
|
+
role?: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export type MarkStanding = "waits for agent" | "waits for you" | "answered" | "resolved";
|
|
42
|
+
/**
|
|
43
|
+
* Where a mark stands: a person's mark waits for the agent until answered; an agent's
|
|
44
|
+
* question waits for the person until answered, and then for the agent.
|
|
45
|
+
*/
|
|
46
|
+
export declare function markStanding(mark: Pick<MarkLike, "status" | "author">): MarkStanding;
|
|
47
|
+
/** "7 marks on Screenwalk, 6 answered, 1 resolved; 1 mark on ScreenwalkRecords, 1 answered". */
|
|
48
|
+
export declare function marksSummary(marks: readonly MarkLike[], who?: string): string;
|
package/dist/names.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** One element by the name the board shows: `state:Witnessing` → "Witnessing", `message:8` → "message 8". */
|
|
2
|
+
export function elementName(focus, labels) {
|
|
3
|
+
const given = labels?.[focus];
|
|
4
|
+
if (given)
|
|
5
|
+
return given;
|
|
6
|
+
const at = focus.indexOf(":");
|
|
7
|
+
if (at <= 0)
|
|
8
|
+
return focus;
|
|
9
|
+
const kind = focus.slice(0, at);
|
|
10
|
+
const name = focus.slice(at + 1);
|
|
11
|
+
if (kind === "message")
|
|
12
|
+
return `message ${name}`;
|
|
13
|
+
if (kind === "attribute") {
|
|
14
|
+
const dot = name.indexOf(".");
|
|
15
|
+
return dot > 0 ? `${name.slice(dot + 1)} in ${name.slice(0, dot)}` : name;
|
|
16
|
+
}
|
|
17
|
+
return name;
|
|
18
|
+
}
|
|
19
|
+
/** The names of what is marked; an entity's attributes are left to the entity when it is marked too. */
|
|
20
|
+
export function markedNames(elements, labels) {
|
|
21
|
+
const refs = elements ?? [];
|
|
22
|
+
const marked = new Set(refs);
|
|
23
|
+
return refs
|
|
24
|
+
.filter((ref) => {
|
|
25
|
+
const owner = /^attribute:([^.]+)\./.exec(ref);
|
|
26
|
+
return !owner || !marked.has(`entity:${owner[1]}`);
|
|
27
|
+
})
|
|
28
|
+
.map((ref) => elementName(ref, labels));
|
|
29
|
+
}
|
|
30
|
+
/** "A", "A and B", "A, B and C", "A, B and 4 more". */
|
|
31
|
+
export function namesText(names) {
|
|
32
|
+
if (names.length <= 1)
|
|
33
|
+
return names[0] ?? "";
|
|
34
|
+
if (names.length <= 3)
|
|
35
|
+
return `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
|
|
36
|
+
return `${names.slice(0, 2).join(", ")} and ${names.length - 2} more`;
|
|
37
|
+
}
|
|
38
|
+
/** What a mark points at, in words: its elements, else an area (inside a machine's level), else the drawing. */
|
|
39
|
+
export function markPlace(mark, labels) {
|
|
40
|
+
const names = markedNames(mark.elements, labels);
|
|
41
|
+
if (names.length)
|
|
42
|
+
return namesText(names);
|
|
43
|
+
if (mark.region)
|
|
44
|
+
return mark.level && mark.level !== "Root" ? `an area inside ${mark.level}` : "an area";
|
|
45
|
+
return "the drawing";
|
|
46
|
+
}
|
|
47
|
+
/** A drawing named for a person: its own name when known, else its file name without the format's extensions. */
|
|
48
|
+
export function drawingName(path, title) {
|
|
49
|
+
if (title)
|
|
50
|
+
return title;
|
|
51
|
+
const file = path ? path.split("/").pop() ?? path : "";
|
|
52
|
+
return file.replace(/\.(smdf|erdf|sqdf|sysdf)\.json$/i, "").replace(/\.json$/i, "") || "the drawing";
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Where a mark stands: a person's mark waits for the agent until answered; an agent's
|
|
56
|
+
* question waits for the person until answered, and then for the agent.
|
|
57
|
+
*/
|
|
58
|
+
export function markStanding(mark) {
|
|
59
|
+
if (mark.status === "resolved")
|
|
60
|
+
return "resolved";
|
|
61
|
+
const agent = mark.author?.role === "agent";
|
|
62
|
+
if (mark.status === "answered")
|
|
63
|
+
return agent ? "waits for agent" : "answered";
|
|
64
|
+
return agent ? "waits for you" : "waits for agent";
|
|
65
|
+
}
|
|
66
|
+
/** "7 marks on Screenwalk, 6 answered, 1 resolved; 1 mark on ScreenwalkRecords, 1 answered". */
|
|
67
|
+
export function marksSummary(marks, who = "the agent") {
|
|
68
|
+
const byDrawing = new Map();
|
|
69
|
+
for (const m of marks) {
|
|
70
|
+
const name = drawingName(m.doc ?? m.drawing, m.title);
|
|
71
|
+
byDrawing.set(name, [...(byDrawing.get(name) ?? []), m]);
|
|
72
|
+
}
|
|
73
|
+
return [...byDrawing.entries()]
|
|
74
|
+
.sort((a, b) => b[1].length - a[1].length)
|
|
75
|
+
.map(([name, list]) => {
|
|
76
|
+
const count = (s) => list.filter((m) => markStanding(m) === s).length;
|
|
77
|
+
const parts = [`${list.length} mark${list.length === 1 ? "" : "s"} on ${name}`];
|
|
78
|
+
if (count("answered"))
|
|
79
|
+
parts.push(`${count("answered")} answered`);
|
|
80
|
+
if (count("waits for agent"))
|
|
81
|
+
parts.push(`${count("waits for agent")} waiting on ${who}`);
|
|
82
|
+
if (count("waits for you"))
|
|
83
|
+
parts.push(`${count("waits for you")} waiting on you`);
|
|
84
|
+
if (count("resolved"))
|
|
85
|
+
parts.push(`${count("resolved")} resolved`);
|
|
86
|
+
return parts.join(", ");
|
|
87
|
+
})
|
|
88
|
+
.join("; ");
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=names.js.map
|
package/dist/pins.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a drawing's pins stand on the screen, and the view that shows its marks (Spec 83).
|
|
3
|
+
*
|
|
4
|
+
* A pin is drawn at the top-right corner of what its mark points at. Marks that point at
|
|
5
|
+
* the same elements share that corner, a corner can fall outside the board, and the
|
|
6
|
+
* board's own buttons sit in its top-right corner too. `placePins` moves each pin as
|
|
7
|
+
* little as it can so that every one can be read and tapped:
|
|
8
|
+
*
|
|
9
|
+
* - inside the board, `inset` pixels from each edge;
|
|
10
|
+
* - out from under the boxes it is told to keep clear of (the board's buttons): just
|
|
11
|
+
* below them;
|
|
12
|
+
* - apart from the pins already placed: pins on one point fan down the anchor's right
|
|
13
|
+
* edge, `spacing` apart, and upward when the board ends first.
|
|
14
|
+
*
|
|
15
|
+
* `fitLegibly` frames boxes as `fitToBoxes` does, but never below a scale at which a
|
|
16
|
+
* state's name can still be read: past that floor the view keeps the floor and starts at
|
|
17
|
+
* the boxes' top (and left, when they are wider than the board).
|
|
18
|
+
*
|
|
19
|
+
* Pure: no React, no DOM.
|
|
20
|
+
*/
|
|
21
|
+
import { type Box, type Viewport } from "@miadi/stateloom-protocol";
|
|
22
|
+
export interface PinSpot {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
}
|
|
26
|
+
export interface PinLayout {
|
|
27
|
+
/** The board's size on screen. */
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
/** A pin's side, in screen pixels. Default 22 (30 under a finger). */
|
|
31
|
+
size?: number;
|
|
32
|
+
/** How far apart fanned pins stand. Default size + 4. */
|
|
33
|
+
spacing?: number;
|
|
34
|
+
/** Distance kept from the board's edges. Default 8. */
|
|
35
|
+
inset?: number;
|
|
36
|
+
/** Boxes no pin may cover, in the board's screen coordinates (the board's buttons). */
|
|
37
|
+
avoid?: readonly Box[];
|
|
38
|
+
}
|
|
39
|
+
/** Each spot moved as little as needed: clamped into the board, clear of `avoid`, apart from the others. In order. */
|
|
40
|
+
export declare function placePins(spots: readonly PinSpot[], layout: PinLayout): PinSpot[];
|
|
41
|
+
export interface LegibleFitOptions {
|
|
42
|
+
/** Screen-space breathing room on every side. Default 48. */
|
|
43
|
+
padding?: number;
|
|
44
|
+
/** The smallest scale the view may take. Default 0.55. */
|
|
45
|
+
floor?: number;
|
|
46
|
+
/** Never larger than this. Default 1. */
|
|
47
|
+
maxScale?: number;
|
|
48
|
+
}
|
|
49
|
+
/** The view that frames `boxes` in a board of `width` × `height`, never smaller than `floor`. */
|
|
50
|
+
export declare function fitLegibly(boxes: readonly Box[], width: number, height: number, options?: LegibleFitOptions): Viewport;
|
package/dist/pins.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a drawing's pins stand on the screen, and the view that shows its marks (Spec 83).
|
|
3
|
+
*
|
|
4
|
+
* A pin is drawn at the top-right corner of what its mark points at. Marks that point at
|
|
5
|
+
* the same elements share that corner, a corner can fall outside the board, and the
|
|
6
|
+
* board's own buttons sit in its top-right corner too. `placePins` moves each pin as
|
|
7
|
+
* little as it can so that every one can be read and tapped:
|
|
8
|
+
*
|
|
9
|
+
* - inside the board, `inset` pixels from each edge;
|
|
10
|
+
* - out from under the boxes it is told to keep clear of (the board's buttons): just
|
|
11
|
+
* below them;
|
|
12
|
+
* - apart from the pins already placed: pins on one point fan down the anchor's right
|
|
13
|
+
* edge, `spacing` apart, and upward when the board ends first.
|
|
14
|
+
*
|
|
15
|
+
* `fitLegibly` frames boxes as `fitToBoxes` does, but never below a scale at which a
|
|
16
|
+
* state's name can still be read: past that floor the view keeps the floor and starts at
|
|
17
|
+
* the boxes' top (and left, when they are wider than the board).
|
|
18
|
+
*
|
|
19
|
+
* Pure: no React, no DOM.
|
|
20
|
+
*/
|
|
21
|
+
import { fitToBoxes } from "@miadi/stateloom-protocol";
|
|
22
|
+
/** A pin is drawn translated by (-40%, -60%) of its size from its point. */
|
|
23
|
+
const LEFT = 0.4;
|
|
24
|
+
const UP = 0.6;
|
|
25
|
+
const AVOID_GAP = 4;
|
|
26
|
+
function overlaps(a, b, gap = 0) {
|
|
27
|
+
return a.x < b.x + b.width + gap && b.x < a.x + a.width + gap && a.y < b.y + b.height + gap && b.y < a.y + a.height + gap;
|
|
28
|
+
}
|
|
29
|
+
/** Each spot moved as little as needed: clamped into the board, clear of `avoid`, apart from the others. In order. */
|
|
30
|
+
export function placePins(spots, layout) {
|
|
31
|
+
const size = layout.size ?? 22;
|
|
32
|
+
const spacing = layout.spacing ?? size + 4;
|
|
33
|
+
const inset = layout.inset ?? 8;
|
|
34
|
+
const avoid = layout.avoid ?? [];
|
|
35
|
+
const minX = inset + LEFT * size;
|
|
36
|
+
const maxX = layout.width - inset - (1 - LEFT) * size;
|
|
37
|
+
const minY = inset + UP * size;
|
|
38
|
+
const maxY = layout.height - inset - (1 - UP) * size;
|
|
39
|
+
const clamp = (v, lo, hi) => (hi < lo ? (lo + hi) / 2 : Math.min(hi, Math.max(lo, v)));
|
|
40
|
+
const boxAt = (x, y) => ({ x: x - LEFT * size, y: y - UP * size, width: size, height: size });
|
|
41
|
+
const blocked = (x, y) => avoid.find((a) => overlaps(boxAt(x, y), a, AVOID_GAP));
|
|
42
|
+
const placed = [];
|
|
43
|
+
const crowded = (x, y) => placed.some((q) => Math.abs(q.x - x) < size && Math.abs(q.y - y) < size);
|
|
44
|
+
const limit = spots.length + avoid.length + 2;
|
|
45
|
+
/** Down from `y` until nothing is in the way. */
|
|
46
|
+
const down = (x, y) => {
|
|
47
|
+
for (let i = 0; i < limit; i++) {
|
|
48
|
+
const under = blocked(x, y);
|
|
49
|
+
if (under)
|
|
50
|
+
y = under.y + under.height + AVOID_GAP + UP * size;
|
|
51
|
+
else if (crowded(x, y))
|
|
52
|
+
y += spacing;
|
|
53
|
+
else
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
return y;
|
|
57
|
+
};
|
|
58
|
+
/** Up from `y` until nothing is in the way. */
|
|
59
|
+
const up = (x, y) => {
|
|
60
|
+
for (let i = 0; i < limit; i++) {
|
|
61
|
+
const over = blocked(x, y);
|
|
62
|
+
if (over)
|
|
63
|
+
y = over.y - AVOID_GAP - (1 - UP) * size;
|
|
64
|
+
else if (crowded(x, y))
|
|
65
|
+
y -= spacing;
|
|
66
|
+
else
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
return y;
|
|
70
|
+
};
|
|
71
|
+
for (const spot of spots) {
|
|
72
|
+
const x = clamp(spot.x, minX, maxX);
|
|
73
|
+
const wanted = clamp(spot.y, minY, maxY);
|
|
74
|
+
let y = down(x, wanted);
|
|
75
|
+
// The board ended first: fan upward from where the pin wanted to be.
|
|
76
|
+
if (y > maxY)
|
|
77
|
+
y = Math.max(minY, up(x, wanted));
|
|
78
|
+
placed.push({ x, y });
|
|
79
|
+
}
|
|
80
|
+
return placed;
|
|
81
|
+
}
|
|
82
|
+
/** The view that frames `boxes` in a board of `width` × `height`, never smaller than `floor`. */
|
|
83
|
+
export function fitLegibly(boxes, width, height, options = {}) {
|
|
84
|
+
const padding = options.padding ?? 48;
|
|
85
|
+
const floor = options.floor ?? 0.55;
|
|
86
|
+
const fitted = fitToBoxes(boxes, width, height, { padding, maxScale: options.maxScale ?? 1 });
|
|
87
|
+
if (!boxes.length || fitted.scale >= floor)
|
|
88
|
+
return fitted;
|
|
89
|
+
let minX = Infinity;
|
|
90
|
+
let minY = Infinity;
|
|
91
|
+
let maxX = -Infinity;
|
|
92
|
+
let maxY = -Infinity;
|
|
93
|
+
for (const b of boxes) {
|
|
94
|
+
minX = Math.min(minX, b.x);
|
|
95
|
+
minY = Math.min(minY, b.y);
|
|
96
|
+
maxX = Math.max(maxX, b.x + b.width);
|
|
97
|
+
maxY = Math.max(maxY, b.y + b.height);
|
|
98
|
+
}
|
|
99
|
+
const scale = floor;
|
|
100
|
+
const w = (maxX - minX) * scale;
|
|
101
|
+
const h = (maxY - minY) * scale;
|
|
102
|
+
return {
|
|
103
|
+
x: w <= width - padding * 2 ? (width - w) / 2 - minX * scale : padding - minX * scale,
|
|
104
|
+
y: h <= height - padding * 2 ? (height - h) / 2 - minY * scale : padding - minY * scale,
|
|
105
|
+
scale,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=pins.js.map
|
package/dist/styles.css
CHANGED
|
@@ -803,7 +803,7 @@
|
|
|
803
803
|
|
|
804
804
|
.slc-stage-caption-head {
|
|
805
805
|
display: flex;
|
|
806
|
-
align-items:
|
|
806
|
+
align-items: flex-start;
|
|
807
807
|
gap: 8px;
|
|
808
808
|
min-width: 0;
|
|
809
809
|
font-size: 11px;
|
|
@@ -819,17 +819,49 @@
|
|
|
819
819
|
font-weight: 600;
|
|
820
820
|
}
|
|
821
821
|
|
|
822
|
+
/* The step's own title, then its place and the tour's name on the line under it. */
|
|
823
|
+
.slc-stage-caption-heading {
|
|
824
|
+
flex: 1;
|
|
825
|
+
min-width: 0;
|
|
826
|
+
display: flex;
|
|
827
|
+
flex-direction: column;
|
|
828
|
+
gap: 1px;
|
|
829
|
+
margin-top: 1px;
|
|
830
|
+
}
|
|
831
|
+
|
|
822
832
|
.slc-stage-caption-title {
|
|
833
|
+
color: var(--slc-label);
|
|
834
|
+
font-size: 13px;
|
|
835
|
+
font-weight: 600;
|
|
836
|
+
line-height: 1.3;
|
|
837
|
+
display: -webkit-box;
|
|
838
|
+
-webkit-line-clamp: 2;
|
|
839
|
+
-webkit-box-orient: vertical;
|
|
840
|
+
overflow: hidden;
|
|
841
|
+
overflow-wrap: anywhere;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
.slc-stage-caption-count {
|
|
823
845
|
min-width: 0;
|
|
824
|
-
flex: 1;
|
|
825
846
|
overflow: hidden;
|
|
826
847
|
text-overflow: ellipsis;
|
|
827
848
|
white-space: nowrap;
|
|
828
|
-
|
|
829
|
-
font-weight: 600;
|
|
849
|
+
font-variant-numeric: tabular-nums;
|
|
830
850
|
}
|
|
831
851
|
|
|
832
|
-
.slc-stage-caption-
|
|
852
|
+
.slc-stage-caption-origin { margin-top: 1px; }
|
|
853
|
+
|
|
854
|
+
/* The step is about a drawing that is not on the board. */
|
|
855
|
+
.slc-stage-caption-held {
|
|
856
|
+
margin: 0;
|
|
857
|
+
padding: 5px 8px;
|
|
858
|
+
border-radius: 8px;
|
|
859
|
+
background: rgb(255 255 255 / 0.05);
|
|
860
|
+
color: var(--slc-muted);
|
|
861
|
+
font-size: 12.5px;
|
|
862
|
+
line-height: 1.35;
|
|
863
|
+
}
|
|
864
|
+
.slc-stage-caption-held strong { color: var(--slc-label); font-weight: 600; }
|
|
833
865
|
|
|
834
866
|
.slc-stage-caption-speaking {
|
|
835
867
|
flex: none;
|
|
@@ -853,20 +885,39 @@
|
|
|
853
885
|
white-space: pre-wrap;
|
|
854
886
|
}
|
|
855
887
|
|
|
856
|
-
.slc-stage-dots { display: flex; flex-wrap: wrap; gap:
|
|
888
|
+
.slc-stage-dots { display: flex; flex-wrap: wrap; gap: 0; margin: 0 -3px; }
|
|
857
889
|
|
|
890
|
+
/* The button is the hit area; the dot is drawn inside it. */
|
|
858
891
|
.slc-stage-dot {
|
|
892
|
+
display: inline-flex;
|
|
893
|
+
align-items: center;
|
|
894
|
+
justify-content: center;
|
|
895
|
+
width: 15px;
|
|
896
|
+
height: 15px;
|
|
897
|
+
padding: 0;
|
|
898
|
+
border: 0;
|
|
899
|
+
background: transparent;
|
|
900
|
+
cursor: pointer;
|
|
901
|
+
}
|
|
902
|
+
.slc-stage-dot::before {
|
|
903
|
+
content: "";
|
|
904
|
+
box-sizing: border-box;
|
|
859
905
|
width: 9px;
|
|
860
906
|
height: 9px;
|
|
861
|
-
padding: 0;
|
|
862
907
|
border-radius: 50%;
|
|
863
908
|
border: 1px solid var(--slc-faint);
|
|
864
|
-
background: transparent;
|
|
865
|
-
cursor: pointer;
|
|
866
909
|
}
|
|
867
910
|
|
|
868
|
-
.slc-stage-dot--seen { background: var(--slc-faint); }
|
|
869
|
-
.slc-stage-dot--current { background: var(--slc-stage-light); border-color: var(--slc-stage-light); }
|
|
911
|
+
.slc-stage-dot--seen::before { background: var(--slc-faint); }
|
|
912
|
+
.slc-stage-dot--current::before { background: var(--slc-stage-light); border-color: var(--slc-stage-light); }
|
|
913
|
+
|
|
914
|
+
/* Under a finger each dot is a 44 px target; past seven steps the count and the arrows say where the tour stands. */
|
|
915
|
+
@media (pointer: coarse) {
|
|
916
|
+
.slc-stage-dots { margin: -6px -14px; }
|
|
917
|
+
.slc-stage-dot { width: 44px; height: 44px; }
|
|
918
|
+
.slc-stage-dot::before { width: 10px; height: 10px; }
|
|
919
|
+
.slc-stage-dots--many { display: none; }
|
|
920
|
+
}
|
|
870
921
|
|
|
871
922
|
.slc-stage-caption-controls,
|
|
872
923
|
.slc-stage-card-row {
|
|
@@ -907,7 +958,7 @@
|
|
|
907
958
|
.slc-stage-btn--answer { border-color: var(--slc-mark-open); color: var(--slc-mark-open); }
|
|
908
959
|
|
|
909
960
|
@media (pointer: coarse) {
|
|
910
|
-
.slc-stage-btn { min-height:
|
|
961
|
+
.slc-stage-btn { min-height: 44px; min-width: 44px; font-size: 15px; }
|
|
911
962
|
}
|
|
912
963
|
|
|
913
964
|
/* Cards: the composer, a thread, the list of marks. */
|
|
@@ -1026,6 +1077,11 @@
|
|
|
1026
1077
|
|
|
1027
1078
|
.slc-stage-thread-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
|
|
1028
1079
|
|
|
1080
|
+
/* A thread scrolls its words and keeps the reply row in reach at the card's bottom. */
|
|
1081
|
+
.slc-stage-thread { overflow: hidden; }
|
|
1082
|
+
.slc-stage-thread > * { flex: none; }
|
|
1083
|
+
.slc-stage-thread > .slc-stage-thread-list { flex: 1 1 auto; min-height: 3.5em; overflow-y: auto; overscroll-behavior: contain; }
|
|
1084
|
+
|
|
1029
1085
|
.slc-stage-said {
|
|
1030
1086
|
display: flex;
|
|
1031
1087
|
flex-direction: column;
|
|
@@ -1131,6 +1187,29 @@
|
|
|
1131
1187
|
|
|
1132
1188
|
.slc-talk-fab--speaking { border-color: var(--slc-stage-light); box-shadow: 0 0 0 3px rgb(251 191 36 / 0.25); }
|
|
1133
1189
|
|
|
1190
|
+
/* Closed, on a phone: the handle of the sheet at the bottom of the board, in words. */
|
|
1191
|
+
.slc-talk--bar { width: 100%; }
|
|
1192
|
+
.slc-talk-bar {
|
|
1193
|
+
display: flex;
|
|
1194
|
+
align-items: center;
|
|
1195
|
+
gap: 8px;
|
|
1196
|
+
width: 100%;
|
|
1197
|
+
min-height: 44px;
|
|
1198
|
+
padding: 0 12px;
|
|
1199
|
+
border-radius: 12px;
|
|
1200
|
+
border: 1px solid var(--slc-panel-border);
|
|
1201
|
+
background: var(--slc-panel-bg);
|
|
1202
|
+
color: var(--slc-label);
|
|
1203
|
+
font: 600 14px ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
1204
|
+
text-align: left;
|
|
1205
|
+
cursor: pointer;
|
|
1206
|
+
box-shadow: 0 8px 24px rgb(0 0 0 / 0.45);
|
|
1207
|
+
backdrop-filter: blur(6px);
|
|
1208
|
+
}
|
|
1209
|
+
.slc-talk-bar-title { flex: none; white-space: nowrap; }
|
|
1210
|
+
.slc-talk-bar--live { background: var(--slc-talk-live); border-color: var(--slc-talk-live); color: white; animation: slc-talk-ring 1.4s ease-in-out infinite; }
|
|
1211
|
+
.slc-talk-bar--speaking { border-color: var(--slc-stage-light); }
|
|
1212
|
+
|
|
1134
1213
|
.slc-talk-fab-clock { font: 700 13px ui-monospace, SFMono-Regular, Menlo, monospace; color: white; }
|
|
1135
1214
|
|
|
1136
1215
|
.slc-talk-fab-badge {
|
|
@@ -1165,19 +1244,25 @@
|
|
|
1165
1244
|
.slc-talk-head { display: flex; align-items: center; gap: 8px; }
|
|
1166
1245
|
.slc-talk-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
|
|
1167
1246
|
|
|
1168
|
-
.
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1247
|
+
/* Who is in the room, in words: "listening", "answering take 12", "away". */
|
|
1248
|
+
.slc-talk-state {
|
|
1249
|
+
min-width: 0;
|
|
1250
|
+
overflow: hidden;
|
|
1251
|
+
text-overflow: ellipsis;
|
|
1252
|
+
white-space: nowrap;
|
|
1253
|
+
padding: 1px 8px;
|
|
1254
|
+
border-radius: 999px;
|
|
1255
|
+
border: 1px solid rgb(34 197 94 / 0.5);
|
|
1256
|
+
color: #86efac;
|
|
1257
|
+
font-size: 11.5px;
|
|
1258
|
+
font-weight: 500;
|
|
1174
1259
|
}
|
|
1175
|
-
|
|
1176
|
-
.slc-talk-presence--away { background: var(--slc-faint); box-shadow: none; }
|
|
1260
|
+
.slc-talk-state--away { border-color: var(--slc-panel-border); color: var(--slc-muted); }
|
|
1177
1261
|
|
|
1178
1262
|
.slc-talk-episode { width: 100%; }
|
|
1179
1263
|
.slc-talk-meta { color: var(--slc-muted); font-size: 12px; line-height: 1.4; }
|
|
1180
|
-
|
|
1264
|
+
/* Amber is kept for what waits on the companion; "nobody is listening" is said quietly. */
|
|
1265
|
+
.slc-talk-meta--away { color: var(--slc-muted); }
|
|
1181
1266
|
.slc-talk-meta--error { color: var(--slc-danger); }
|
|
1182
1267
|
|
|
1183
1268
|
.slc-talk-notice {
|
|
@@ -1237,6 +1322,52 @@
|
|
|
1237
1322
|
}
|
|
1238
1323
|
|
|
1239
1324
|
.slc-talk-entry--reply { border-left-color: var(--slc-mark-question); background: rgb(167 139 250 / 0.07); }
|
|
1325
|
+
|
|
1326
|
+
/* A mark on one of the episode's drawings: the whole entry opens that drawing at that mark. */
|
|
1327
|
+
.slc-talk-entry--mark { padding: 0; border-left-color: var(--slc-panel-border); }
|
|
1328
|
+
.slc-talk-entry--waits { border-left-color: var(--slc-mark-open); }
|
|
1329
|
+
.slc-talk-mark {
|
|
1330
|
+
display: flex;
|
|
1331
|
+
flex-direction: column;
|
|
1332
|
+
gap: 3px;
|
|
1333
|
+
width: 100%;
|
|
1334
|
+
padding: 7px 9px;
|
|
1335
|
+
border: 0;
|
|
1336
|
+
border-radius: 10px;
|
|
1337
|
+
background: transparent;
|
|
1338
|
+
color: var(--slc-label);
|
|
1339
|
+
font: inherit;
|
|
1340
|
+
text-align: left;
|
|
1341
|
+
cursor: pointer;
|
|
1342
|
+
}
|
|
1343
|
+
.slc-talk-mark:hover:not(:disabled) { background: rgb(255 255 255 / 0.04); }
|
|
1344
|
+
.slc-talk-mark:disabled { cursor: default; }
|
|
1345
|
+
.slc-talk-mark > span { display: flex; }
|
|
1346
|
+
.slc-talk-mark > .slc-talk-text { display: block; }
|
|
1347
|
+
.slc-talk-mark-head { flex: 1; min-width: 0; color: var(--slc-muted); overflow-wrap: anywhere; }
|
|
1348
|
+
.slc-talk-mark-head strong { color: var(--slc-label); }
|
|
1349
|
+
.slc-talk-mark-replies { flex-direction: column; gap: 6px; margin-top: 3px; padding-left: 9px; border-left: 2px solid var(--slc-panel-border); }
|
|
1350
|
+
.slc-talk-mark-reply { display: flex; flex-direction: column; gap: 1px; }
|
|
1351
|
+
.slc-talk-mark-by { font-size: 11px; font-weight: 600; color: var(--slc-muted); }
|
|
1352
|
+
.slc-talk-mark-reply--agent .slc-talk-mark-by { color: var(--slc-mark-question); }
|
|
1353
|
+
.slc-talk-mark-state { margin-top: 2px; font-size: 11.5px; color: var(--slc-muted); }
|
|
1354
|
+
.slc-talk-mark-state--waits { color: var(--slc-mark-open); }
|
|
1355
|
+
|
|
1356
|
+
/* A reply that answers a mark says which, and opens it. */
|
|
1357
|
+
.slc-talk-answers {
|
|
1358
|
+
display: inline-flex;
|
|
1359
|
+
align-items: center;
|
|
1360
|
+
gap: 5px;
|
|
1361
|
+
align-self: flex-start;
|
|
1362
|
+
padding: 0;
|
|
1363
|
+
border: 0;
|
|
1364
|
+
background: transparent;
|
|
1365
|
+
color: var(--slc-accent-ink);
|
|
1366
|
+
font: 11.5px ui-sans-serif, system-ui, sans-serif;
|
|
1367
|
+
text-align: left;
|
|
1368
|
+
cursor: pointer;
|
|
1369
|
+
}
|
|
1370
|
+
.slc-talk-answers:disabled { cursor: default; color: var(--slc-muted); }
|
|
1240
1371
|
.slc-talk-entry--new { box-shadow: inset 0 0 0 1px var(--slc-mark-question); }
|
|
1241
1372
|
|
|
1242
1373
|
.slc-talk-who { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--slc-muted); }
|
|
@@ -1320,6 +1451,7 @@
|
|
|
1320
1451
|
.slc-talk-step-say { line-height: 1.4; overflow-wrap: anywhere; }
|
|
1321
1452
|
|
|
1322
1453
|
@media (pointer: coarse) {
|
|
1454
|
+
.slc-talk-answers { min-height: 32px; }
|
|
1323
1455
|
.slc-talk-play { min-height: 34px; min-width: 40px; }
|
|
1324
1456
|
.slc-talk-thumb { min-width: 36px; min-height: 36px; }
|
|
1325
1457
|
.slc-talk-step { padding: 8px 6px; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miadi/stateloom-canvas",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "The reusable SMDF design surface: a pannable, zoomable, drillable React SVG canvas with routed edges, settled labels and a navigation HUD",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "tsc && node scripts/copy-styles.mjs",
|
|
28
|
+
"test": "node --test dist/tests/*.test.js",
|
|
28
29
|
"clean": "rm -rf dist"
|
|
29
30
|
},
|
|
30
31
|
"keywords": [
|
|
@@ -49,6 +50,7 @@
|
|
|
49
50
|
"react": "^19"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
53
|
+
"@types/node": "^22",
|
|
52
54
|
"@types/react": "^19",
|
|
53
55
|
"react": "^19",
|
|
54
56
|
"typescript": "^5.7"
|