@graview/primitives 0.1.18 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/dist/app-bar.d.ts +30 -6
  2. package/dist/app-bar.d.ts.map +1 -1
  3. package/dist/app-bar.js +55 -27
  4. package/dist/app-bar.js.map +1 -1
  5. package/dist/arrange-bar.d.ts +42 -25
  6. package/dist/arrange-bar.d.ts.map +1 -1
  7. package/dist/arrange-bar.js +129 -194
  8. package/dist/arrange-bar.js.map +1 -1
  9. package/dist/arrange-lists.d.ts +56 -0
  10. package/dist/arrange-lists.d.ts.map +1 -0
  11. package/dist/arrange-lists.js +196 -0
  12. package/dist/arrange-lists.js.map +1 -0
  13. package/dist/bar-panes.d.ts +3 -1
  14. package/dist/bar-panes.d.ts.map +1 -1
  15. package/dist/bar-panes.js +36 -21
  16. package/dist/bar-panes.js.map +1 -1
  17. package/dist/chat.d.ts +68 -30
  18. package/dist/chat.d.ts.map +1 -1
  19. package/dist/chat.js +205 -222
  20. package/dist/chat.js.map +1 -1
  21. package/dist/connections.d.ts.map +1 -1
  22. package/dist/connections.js +19 -3
  23. package/dist/connections.js.map +1 -1
  24. package/dist/declared-lens-doors.d.ts +18 -0
  25. package/dist/declared-lens-doors.d.ts.map +1 -1
  26. package/dist/declared-lens-doors.js +25 -3
  27. package/dist/declared-lens-doors.js.map +1 -1
  28. package/dist/declared-lenses.d.ts.map +1 -1
  29. package/dist/declared-lenses.js +4 -7
  30. package/dist/declared-lenses.js.map +1 -1
  31. package/dist/draft-door.d.ts +3 -0
  32. package/dist/draft-door.d.ts.map +1 -0
  33. package/dist/draft-door.js +22 -0
  34. package/dist/draft-door.js.map +1 -0
  35. package/dist/draft-frame.d.ts +25 -0
  36. package/dist/draft-frame.d.ts.map +1 -0
  37. package/dist/draft-frame.js +69 -0
  38. package/dist/draft-frame.js.map +1 -0
  39. package/dist/editable.d.ts +4 -1
  40. package/dist/editable.d.ts.map +1 -1
  41. package/dist/editable.js +9 -8
  42. package/dist/editable.js.map +1 -1
  43. package/dist/find.d.ts.map +1 -1
  44. package/dist/find.js +23 -5
  45. package/dist/find.js.map +1 -1
  46. package/dist/frame.d.ts +5 -4
  47. package/dist/frame.d.ts.map +1 -1
  48. package/dist/frame.js +5 -4
  49. package/dist/frame.js.map +1 -1
  50. package/dist/index.d.ts +14 -7
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +15 -6
  53. package/dist/index.js.map +1 -1
  54. package/dist/lens/board.d.ts.map +1 -1
  55. package/dist/lens/board.js +7 -3
  56. package/dist/lens/board.js.map +1 -1
  57. package/dist/lens/calendar-options.d.ts +8 -1
  58. package/dist/lens/calendar-options.d.ts.map +1 -1
  59. package/dist/lens/calendar-options.js +5 -0
  60. package/dist/lens/calendar-options.js.map +1 -1
  61. package/dist/lens/calendar-view.d.ts.map +1 -1
  62. package/dist/lens/calendar-view.js +2 -2
  63. package/dist/lens/calendar-view.js.map +1 -1
  64. package/dist/lens/columns.d.ts.map +1 -1
  65. package/dist/lens/columns.js +2 -2
  66. package/dist/lens/columns.js.map +1 -1
  67. package/dist/lens/coverage.d.ts.map +1 -1
  68. package/dist/lens/coverage.js +14 -10
  69. package/dist/lens/coverage.js.map +1 -1
  70. package/dist/lens/more.d.ts.map +1 -1
  71. package/dist/lens/more.js +2 -1
  72. package/dist/lens/more.js.map +1 -1
  73. package/dist/lens-keeping.d.ts +17 -0
  74. package/dist/lens-keeping.d.ts.map +1 -0
  75. package/dist/lens-keeping.js +127 -0
  76. package/dist/lens-keeping.js.map +1 -0
  77. package/dist/lines-key.d.ts +12 -0
  78. package/dist/lines-key.d.ts.map +1 -0
  79. package/dist/lines-key.js +74 -0
  80. package/dist/lines-key.js.map +1 -0
  81. package/dist/notice-place.d.ts +3 -3
  82. package/dist/notice-place.d.ts.map +1 -1
  83. package/dist/notice-place.js +4 -4
  84. package/dist/notice-place.js.map +1 -1
  85. package/dist/notices.d.ts +6 -0
  86. package/dist/notices.d.ts.map +1 -1
  87. package/dist/notices.js +7 -1
  88. package/dist/notices.js.map +1 -1
  89. package/dist/pages.d.ts +10 -5
  90. package/dist/pages.d.ts.map +1 -1
  91. package/dist/pages.js +10 -5
  92. package/dist/pages.js.map +1 -1
  93. package/dist/places.d.ts +0 -24
  94. package/dist/places.d.ts.map +1 -1
  95. package/dist/places.js +5 -1
  96. package/dist/places.js.map +1 -1
  97. package/dist/profile.d.ts +7 -1
  98. package/dist/profile.d.ts.map +1 -1
  99. package/dist/profile.js +2 -2
  100. package/dist/profile.js.map +1 -1
  101. package/dist/quick-relations.d.ts.map +1 -1
  102. package/dist/quick-relations.js +2 -2
  103. package/dist/quick-relations.js.map +1 -1
  104. package/dist/reader-lenses.d.ts +21 -0
  105. package/dist/reader-lenses.d.ts.map +1 -0
  106. package/dist/reader-lenses.js +27 -0
  107. package/dist/reader-lenses.js.map +1 -0
  108. package/dist/relation-key.d.ts +2 -0
  109. package/dist/relation-key.d.ts.map +1 -1
  110. package/dist/relation-key.js +13 -23
  111. package/dist/relation-key.js.map +1 -1
  112. package/dist/rule-line.d.ts +36 -0
  113. package/dist/rule-line.d.ts.map +1 -0
  114. package/dist/rule-line.js +91 -0
  115. package/dist/rule-line.js.map +1 -0
  116. package/dist/scene-bar.d.ts +29 -0
  117. package/dist/scene-bar.d.ts.map +1 -0
  118. package/dist/scene-bar.js +72 -0
  119. package/dist/scene-bar.js.map +1 -0
  120. package/dist/scene-css.d.ts.map +1 -1
  121. package/dist/scene-css.js +525 -0
  122. package/dist/scene-css.js.map +1 -1
  123. package/dist/scene.d.ts +5 -2
  124. package/dist/scene.d.ts.map +1 -1
  125. package/dist/scene.js +5 -1
  126. package/dist/scene.js.map +1 -1
  127. package/dist/seat-field.d.ts +58 -0
  128. package/dist/seat-field.d.ts.map +1 -0
  129. package/dist/seat-field.js +171 -0
  130. package/dist/seat-field.js.map +1 -0
  131. package/dist/seat-move.d.ts +32 -0
  132. package/dist/seat-move.d.ts.map +1 -0
  133. package/dist/seat-move.js +56 -0
  134. package/dist/seat-move.js.map +1 -0
  135. package/dist/seat-panel.d.ts +37 -0
  136. package/dist/seat-panel.d.ts.map +1 -0
  137. package/dist/seat-panel.js +134 -0
  138. package/dist/seat-panel.js.map +1 -0
  139. package/dist/seat.d.ts +20 -58
  140. package/dist/seat.d.ts.map +1 -1
  141. package/dist/seat.js +28 -45
  142. package/dist/seat.js.map +1 -1
  143. package/dist/seeding.d.ts.map +1 -1
  144. package/dist/seeding.js +4 -4
  145. package/dist/seeding.js.map +1 -1
  146. package/dist/shell.d.ts +25 -21
  147. package/dist/shell.d.ts.map +1 -1
  148. package/dist/shell.js +46 -116
  149. package/dist/shell.js.map +1 -1
  150. package/dist/spec-css.d.ts.map +1 -1
  151. package/dist/spec-css.js +2 -0
  152. package/dist/spec-css.js.map +1 -1
  153. package/dist/spec-views.d.ts.map +1 -1
  154. package/dist/spec-views.js +10 -2
  155. package/dist/spec-views.js.map +1 -1
  156. package/dist/subject.d.ts +4 -2
  157. package/dist/subject.d.ts.map +1 -1
  158. package/dist/subject.js +12 -8
  159. package/dist/subject.js.map +1 -1
  160. package/dist/theme.d.ts.map +1 -1
  161. package/dist/theme.js +6 -523
  162. package/dist/theme.js.map +1 -1
  163. package/dist/view-doors.d.ts.map +1 -1
  164. package/dist/view-doors.js +7 -0
  165. package/dist/view-doors.js.map +1 -1
  166. package/dist/workbench/activity.d.ts.map +1 -1
  167. package/dist/workbench/activity.js +9 -9
  168. package/dist/workbench/activity.js.map +1 -1
  169. package/dist/workbench/back-out.js +3 -3
  170. package/dist/workbench/back-out.js.map +1 -1
  171. package/dist/workbench/inspector.d.ts +11 -6
  172. package/dist/workbench/inspector.d.ts.map +1 -1
  173. package/dist/workbench/inspector.js +42 -56
  174. package/dist/workbench/inspector.js.map +1 -1
  175. package/dist/workbench/standing.d.ts +8 -2
  176. package/dist/workbench/standing.d.ts.map +1 -1
  177. package/dist/workbench/standing.js +9 -4
  178. package/dist/workbench/standing.js.map +1 -1
  179. package/dist/workbench/trail.d.ts +10 -17
  180. package/dist/workbench/trail.d.ts.map +1 -1
  181. package/dist/workbench/trail.js +29 -41
  182. package/dist/workbench/trail.js.map +1 -1
  183. package/package.json +7 -7
  184. package/dist/companion.d.ts +0 -58
  185. package/dist/companion.d.ts.map +0 -1
  186. package/dist/companion.js +0 -463
  187. package/dist/companion.js.map +0 -1
  188. package/dist/ladder.d.ts +0 -2
  189. package/dist/ladder.d.ts.map +0 -1
  190. package/dist/ladder.js +0 -48
  191. package/dist/ladder.js.map +0 -1
  192. package/dist/popover.d.ts +0 -21
  193. package/dist/popover.d.ts.map +0 -1
  194. package/dist/popover.js +0 -28
  195. package/dist/popover.js.map +0 -1
  196. package/dist/wordmark.d.ts +0 -15
  197. package/dist/wordmark.d.ts.map +0 -1
  198. package/dist/wordmark.js +0 -50
  199. package/dist/wordmark.js.map +0 -1
@@ -0,0 +1,171 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { layer } from "@graview/core";
3
+ import { retryingImport } from "@graview/core/retry";
4
+ import { lazyModule, useGraview, useSeatTalkState } from "@graview/react/provider";
5
+ import { Suspense, useEffect, useLayoutEffect, useRef, useState } from "react";
6
+ import { FOOT_MOVED } from "./notice-place.js";
7
+ import { VISUALLY_HIDDEN } from "./primitives/measure.js";
8
+ /** The field's width on a desk, and the gap between it and the picture's edges. */
9
+ export const SEAT_WIDTH = 336;
10
+ const GAP = 16;
11
+ /** Narrower than this the seat is a field across the foot, and a bottom sheet when open. */
12
+ export const SEAT_PHONE_BELOW = 640;
13
+ const panelModule = lazyModule(retryingImport(() => import("./seat-panel.js")));
14
+ const Panel = panelModule.part((module, props) => {
15
+ const Drawn = module.SeatPanel;
16
+ return _jsx(Drawn, { ...props });
17
+ }, { what: "The conversation" });
18
+ /**
19
+ * The seat, at the foot of the box it is drawn in — the scene's picture, or
20
+ * on Pages a box the routed face lays over the window (or its embed).
21
+ */
22
+ export function SeatField({ respond, onCall, onPick, start = "field", onMove, place, onDraft }) {
23
+ const { brand, seatTalk } = useGraview();
24
+ const talk = useSeatTalkState(seatTalk);
25
+ const name = brand?.name?.trim() || "this app";
26
+ const region = useRef(null);
27
+ const field = useRef(null);
28
+ const [draft, setDraft] = useState("");
29
+ const [phone, setPhone] = useState(false);
30
+ /* Where the keyboard was before it came into the seat: where Escape puts it back. */
31
+ const cameFrom = useRef(null);
32
+ const hidden = start === "hidden";
33
+ const open = talk.open && !hidden;
34
+ /* Drawn: Find offers "Ask:" where a seat is. */
35
+ useEffect(() => (hidden ? undefined : seatTalk.drawn()), [seatTalk, hidden]);
36
+ /* A PHONE'S SEAT is a field across the foot, measured from the box it is drawn in, not the window. */
37
+ useLayoutEffect(() => {
38
+ const box = region.current?.parentElement;
39
+ if (!box)
40
+ return;
41
+ const measure = () => setPhone(box.getBoundingClientRect().width < SEAT_PHONE_BELOW);
42
+ measure();
43
+ if (typeof ResizeObserver === "undefined")
44
+ return;
45
+ const watch = new ResizeObserver(measure);
46
+ watch.observe(box);
47
+ return () => watch.disconnect();
48
+ }, [hidden]);
49
+ /* What stands above the foot — a notice — places itself again when the seat grows, shrinks or moves. */
50
+ useEffect(() => {
51
+ if (typeof window !== "undefined")
52
+ window.dispatchEvent(new Event(FOOT_MOVED));
53
+ }, [open, talk.side, phone]);
54
+ /*
55
+ * THE END OF A PAGE SCROLLS CLEAR OF THE FIELD. The field stands over the
56
+ * page's foot, and on a phone it covered a list's last row however far
57
+ * the page scrolled. Closed, it says how much room it takes from the
58
+ * bottom — its height, where it stands, and a gutter — as
59
+ * `--graview-foot-room` on the embed (or the page), and a page that ends
60
+ * under it pads its end by that much (`PageMain`, an app's own main).
61
+ */
62
+ useEffect(() => {
63
+ const element = region.current;
64
+ if (hidden || open || !element || typeof window === "undefined")
65
+ return;
66
+ const holder = (element.closest("[data-graview-embed]") ?? document.documentElement).style;
67
+ const measure = () => {
68
+ const box = element.getBoundingClientRect();
69
+ const frame = element.offsetParent?.getBoundingClientRect();
70
+ const from = frame ? frame.bottom - box.top : box.height + GAP;
71
+ holder.setProperty("--graview-foot-room", `${Math.max(0, Math.round(from + GAP))}px`);
72
+ };
73
+ measure();
74
+ const watch = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
75
+ watch?.observe(element);
76
+ return () => {
77
+ watch?.disconnect();
78
+ holder.removeProperty("--graview-foot-room");
79
+ };
80
+ }, [hidden, open, phone, talk.side]);
81
+ /* ASKED FROM ELSEWHERE (Find's "Ask:" row): the keyboard comes to the field, so the reader can go on. */
82
+ useEffect(() => {
83
+ if (!open || talk.pending === null)
84
+ return;
85
+ remember();
86
+ field.current?.focus({ preventScroll: true });
87
+ }, [open, talk.pending]);
88
+ const remember = () => {
89
+ const at = typeof document === "undefined" ? null : document.activeElement;
90
+ if (at instanceof HTMLElement && at !== document.body && !region.current?.contains(at))
91
+ cameFrom.current = at;
92
+ };
93
+ const openIt = () => {
94
+ remember();
95
+ panelModule.prefetch();
96
+ seatTalk.setOpen(true);
97
+ };
98
+ const close = () => {
99
+ seatTalk.setOpen(false);
100
+ const back = cameFrom.current;
101
+ cameFrom.current = null;
102
+ if (back?.isConnected)
103
+ back.focus({ preventScroll: true });
104
+ // Gone, or no longer something the keyboard can stand on (a view drawn over it): the field keeps it.
105
+ if (document.activeElement !== back)
106
+ field.current?.focus({ preventScroll: true });
107
+ };
108
+ if (hidden)
109
+ return null;
110
+ const right = !phone && talk.side === "right";
111
+ const style = phone
112
+ ? open
113
+ ? { left: 0, right: 0, bottom: 0, padding: `8px 12px calc(12px + env(safe-area-inset-bottom, 0px))`, borderRadius: "12px 12px 0 0", ...OPEN_BOX }
114
+ : { left: GAP, right: GAP, bottom: `calc(${GAP}px + env(safe-area-inset-bottom, 0px))` }
115
+ : open
116
+ ? /* The box around the field, so the field itself stays where it stood: its padding and hairline outside it. */
117
+ { [right ? "right" : "left"]: GAP / 2 - 1, bottom: GAP / 2 - 1, width: SEAT_WIDTH + GAP + 2, padding: GAP / 2, borderRadius: 12, ...OPEN_BOX }
118
+ : { [right ? "right" : "left"]: GAP, bottom: GAP, width: SEAT_WIDTH };
119
+ return (_jsxs("section", { ref: region, role: "region", "aria-label": `Ask ${name}`, "data-testid": "seat", "data-graview-seat": open ? "open" : "closed", "data-graview-seat-side": right ? "right" : "left", "data-graview-seat-shape": phone ? "phone" : "desk", "data-graview-foot": "", "data-graview-offstage": "", onMouseDown: (event) => event.stopPropagation(), onKeyDown: (event) => {
120
+ if (event.key !== "Escape" || !open)
121
+ return;
122
+ // The seat's Escape is the seat's: the scene's back-out does not hear it too.
123
+ event.preventDefault();
124
+ event.stopPropagation();
125
+ close();
126
+ }, style: {
127
+ position: "absolute",
128
+ zIndex: layer("rail"),
129
+ boxSizing: "border-box",
130
+ display: "flex",
131
+ flexDirection: "column",
132
+ gap: 8,
133
+ pointerEvents: "auto",
134
+ ...style,
135
+ }, children: [_jsxs("h2", { style: { ...VISUALLY_HIDDEN, margin: 0 }, children: ["Ask ", name] }), open ? (_jsx(Suspense, { fallback: null, children: _jsx(Panel, { phone: phone, side: right ? "right" : "left", name: name, onClose: close, ...(respond ? { respond: respond } : {}), ...(onCall ? { onCall } : {}), ...(onPick ? { onPick } : {}), ...(onMove ? { onMove } : {}), ...(place ? { place } : {}), ...(onDraft ? { onDraft } : {}) }) })) : null, _jsx("form", { onSubmit: (event) => {
136
+ event.preventDefault();
137
+ const asked = draft.trim();
138
+ if (!open)
139
+ openIt();
140
+ if (!asked || talk.busy)
141
+ return;
142
+ seatTalk.ask(asked);
143
+ setDraft("");
144
+ }, style: { display: "flex", margin: 0 }, children: _jsx("input", { ref: field, "data-testid": "seat-field", type: "text", enterKeyHint: "send", autoComplete: "off", value: draft, placeholder: `Ask ${name}…`, "aria-label": `Ask ${name}`, onPointerEnter: () => panelModule.prefetch(), onFocus: () => panelModule.prefetch(), onClick: () => {
145
+ if (!open)
146
+ openIt();
147
+ }, onChange: (event) => {
148
+ setDraft(event.target.value);
149
+ if (!open)
150
+ openIt();
151
+ }, style: {
152
+ flex: "1 1 auto",
153
+ minWidth: 0,
154
+ boxSizing: "border-box",
155
+ height: 38,
156
+ padding: "0 12px",
157
+ font: "inherit",
158
+ fontSize: "0.9375rem",
159
+ color: "var(--graview-ink)",
160
+ background: "var(--graview-panel)",
161
+ border: "1px solid var(--graview-edge)",
162
+ borderRadius: 8,
163
+ } }) })] }));
164
+ }
165
+ /** The open seat: the floating panel's ground, a hairline, and the lift that says it is over the picture. */
166
+ const OPEN_BOX = {
167
+ background: "var(--graview-float)",
168
+ border: "1px solid var(--graview-edge)",
169
+ boxShadow: "var(--graview-lift-high)",
170
+ };
171
+ //# sourceMappingURL=seat-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seat-field.js","sourceRoot":"","sources":["../src/seat-field.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAkB,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEnF,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAA0C,MAAM,OAAO,CAAC;AACvH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAmD1D,mFAAmF;AACnF,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAC;AAC9B,MAAM,GAAG,GAAG,EAAE,CAAC;AACf,4FAA4F;AAC5F,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC,MAAM,WAAW,GAAG,UAAU,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAChF,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAC5B,CAAC,M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0BAA0B;CACtC,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { SeatMove } from "@graview/tools";
2
+ import { type ViewState } from "@graview/layout/view";
3
+ /**
4
+ * A SEAT'S MOVE, AS THE SCENE MAKES IT.
5
+ *
6
+ * The seat answers "go to The week" with data (`SeatMove`); the routed face
7
+ * navigates to its `address`, and the scene makes the same place a stop —
8
+ * through the same steps the bar, Find and a host's `go.place` already
9
+ * take, so a moved scene is one a person could have walked to and Back
10
+ * walks out of. Pure: the caller sets the view (which pushes history) or
11
+ * opens the pane.
12
+ */
13
+ export type SceneMove =
14
+ /** A stop to set. */
15
+ {
16
+ readonly view: ViewState;
17
+ }
18
+ /** A pane of the scene's own to open: the problems are the standing's list, not a stop. */
19
+ | {
20
+ readonly pane: "problems";
21
+ };
22
+ export declare function sceneMove(state: ViewState, move: SeatMove): SceneMove;
23
+ /** The standing's problems, opened or put away as a press on it would. */
24
+ export declare function problemsShown(shown: boolean): void;
25
+ /**
26
+ * THE SCENE MAKES A SEAT'S MOVE: a stop set through the provider (so the
27
+ * address follows it and Back walks out of it), or the problems opened at
28
+ * the standing. A drawn view standing in front of the picture is put away
29
+ * first: the reader asked to be somewhere else.
30
+ */
31
+ export declare function useSceneGo(): (move: SeatMove) => void;
32
+ //# sourceMappingURL=seat-move.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seat-move.d.ts","sourceRoot":"","sources":["../src/seat-move.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAmG,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEvJ;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS;AACnB,qBAAqB;AACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE;AAC9B,2FAA2F;GACzF;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;AAElC,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,GAAG,SAAS,CAwBrE;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAGlD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,IAAI,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAerD"}
@@ -0,0 +1,56 @@
1
+ import { useGraview } from "@graview/react/provider";
2
+ import { useCallback } from "react";
3
+ import { aggregateId, fromUrl, withFocus, withOverview, withPicture, withSelection, withWithin, withZoom } from "@graview/layout/view";
4
+ export function sceneMove(state, move) {
5
+ switch (move.to) {
6
+ case "place":
7
+ // The home and the scene itself are the scene's opening stop.
8
+ return { view: fromUrl("#") };
9
+ case "picture":
10
+ // A narrowing an earlier ask left on the stop is not this picture's: it goes.
11
+ return { view: withSelection(withPicture(withWithin(state, "filter", null), move.kind, move.as), []) };
12
+ case "kind": {
13
+ /*
14
+ * Down into the kind's district, close, narrowed by the same words a
15
+ * list page carries in `?filter=` — `in.filter` — with nothing chosen
16
+ * inside it: a picture named before would draw the narrowing in its
17
+ * own way, or not at all.
18
+ */
19
+ const down = withZoom(withOverview({ ...withFocus(state, aggregateId(move.kind)), relation: null }, false), true);
20
+ return { view: withSelection(withWithin(withWithin(down, "view", null), "filter", move.filter ?? null), []) };
21
+ }
22
+ case "record":
23
+ // On the ground at the record: the picture and the narrowing of the place it was found from go with it.
24
+ return { view: withSelection(withFocus(withOverview(withWithin(withWithin(state, "view", null), "filter", null), false), move.id), [move.id]) };
25
+ case "problems":
26
+ return { pane: "problems" };
27
+ }
28
+ }
29
+ /** The standing's problems, opened or put away as a press on it would. */
30
+ export function problemsShown(shown) {
31
+ const standing = typeof document === "undefined" ? null : document.querySelector('[data-testid="standing"]');
32
+ if (standing && (standing.getAttribute("aria-expanded") === "true") !== shown)
33
+ standing.click();
34
+ }
35
+ /**
36
+ * THE SCENE MAKES A SEAT'S MOVE: a stop set through the provider (so the
37
+ * address follows it and Back walks out of it), or the problems opened at
38
+ * the standing. A drawn view standing in front of the picture is put away
39
+ * first: the reader asked to be somewhere else.
40
+ */
41
+ export function useSceneGo() {
42
+ const { setView, seatTalk } = useGraview();
43
+ return useCallback((move) => {
44
+ if (seatTalk.get().draft)
45
+ seatTalk.setDraft(null);
46
+ // The standing is the scene's list of problems: opened as a press would open it, and put away when the seat goes elsewhere.
47
+ problemsShown(move.to === "problems");
48
+ if (move.to === "problems")
49
+ return;
50
+ setView((state) => {
51
+ const made = sceneMove(state, move);
52
+ return "view" in made ? made.view : state;
53
+ });
54
+ }, [setView, seatTalk]);
55
+ }
56
+ //# sourceMappingURL=seat-move.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seat-move.js","sourceRoot":"","sources":["../src/seat-move.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAkB,MAAM,sBAAsB,CAAC;AAkBvJ,MAAM,UAAU,SAAS,CAAC,KAAgB,EAAE,IAAc;IACxD,QAAQ,IAAI,CAAC,EAAE,EAAE,CAAC;QAChB,KAAK,OAAO;YACV,8DAA8D;YAC9D,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,KAAK,SAAS;YACZ,8EAA8E;YAC9E,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;QACzG,KAAK,MAAM,CAAC,CAAC,CAAC;YACZ;;;;;eAKG;YACH,MAAM,IAAI,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,CAAC,IAAc,EAAE,EAAE;QACjB,IAAI,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK;YAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAClD,4HAA4H;QAC5H,aAAa,CAAC,IAAI,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC;QACtC,IAAI,IAAI,CAAC,EAAE,KAAK,UAAU;YAAE,OAAO;QACnC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAChB,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACpC,OAAO,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC,EACD,CAAC,OAAO,EAAE,QAAQ,CAAC,CACpB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { type AnySchema } from "@graview/core";
2
+ import { type Responder, type SeatMove, type ToolCall } from "@graview/tools";
3
+ /**
4
+ * THE OPEN SEAT — fetched when the seat is first opened (`seat-field.tsx`).
5
+ *
6
+ * A row of two quiet controls (the other foot, and close; on a phone a
7
+ * grab line), then — with nothing asked yet — one plain line about
8
+ * where the reader is, at most three things to ask and at most three acts,
9
+ * and the conversation. No heading over it saying what it is about, no
10
+ * stack of acts, no stars, no filter: the rest is one question away.
11
+ */
12
+ export interface SeatPanelProps {
13
+ readonly phone: boolean;
14
+ readonly side: "left" | "right";
15
+ /** The app's name, as the field says it: "Ask Things". */
16
+ readonly name: string;
17
+ readonly onClose: () => void;
18
+ readonly respond?: Responder<AnySchema>;
19
+ readonly onCall?: (call: ToolCall) => void;
20
+ readonly onPick?: (id: string) => void;
21
+ /** Where an answer takes the app: the router on Pages; the scene's own stops when unsaid. */
22
+ readonly onMove?: (move: SeatMove) => void;
23
+ /** The place the reader stands in, by its slug, as the face knows it. */
24
+ readonly place?: string;
25
+ /** A view was drawn: the face shows it (Pages goes to `/~draft`). */
26
+ readonly onDraft?: () => void;
27
+ }
28
+ export declare function SeatPanel({ phone, side, name, onClose, respond, onCall, onPick, onMove, place, onDraft }: SeatPanelProps): import("react").JSX.Element;
29
+ /**
30
+ * WHERE A NAME IN AN ANSWER TAKES THE READER — the one place the seat moves
31
+ * the app. A face that knows its own way (Pages: the record's page) says so
32
+ * with `onPick`; on the scene the thing is chosen and flown to. When the
33
+ * seat's answers carry moves of their own (a place, a list narrowed by a
34
+ * date), they are applied here too, so both faces move the same way.
35
+ */
36
+ export declare function useSeatGo(onPick?: (id: string) => void): (id: string) => void;
37
+ //# sourceMappingURL=seat-panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seat-panel.d.ts","sourceRoot":"","sources":["../src/seat-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAI7D,OAAO,EAA6B,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AASzG;;;;;;;;GAQG;AAEH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,6FAA6F;IAC7F,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC3C,yEAAyE;IACzE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,cAAc,+BAmFxH;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,GAAG,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAM7E"}
@@ -0,0 +1,134 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { failureWords } from "@graview/core";
3
+ import { withFocus, withOverview, withSelection } from "@graview/layout/view";
4
+ import { useAffordances, useApplyAffordance, useGraview, useSeatTalkState, useViolations } from "@graview/react";
5
+ import { problemLine, useLined } from "./rule-line.js";
6
+ import { loadPins } from "@graview/tools";
7
+ // Its own entry: a bundler places a file in every chunk that can reach it, and only the open seat uses this.
8
+ import { offeredActs, suggestionsFor, whereLine } from "@graview/tools/suggest";
9
+ import { useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";
10
+ import { ChatPanel, LINK, QUIET_BUTTON } from "./chat.js";
11
+ import { useSubject } from "./subject.js";
12
+ import { VISUALLY_HIDDEN } from "./primitives/index.js";
13
+ import { AnswerArgs } from "./workbench/index.js";
14
+ export function SeatPanel({ phone, side, name, onClose, respond, onCall, onPick, onMove, place, onDraft }) {
15
+ const { seatTalk } = useGraview();
16
+ const talk = useSeatTalkState(seatTalk);
17
+ const go = useSeatGo(onPick);
18
+ const latest = [...talk.turns].reverse().find((turn) => turn.role === "seat");
19
+ /*
20
+ * A PHONE'S SHEET YIELDS TO A DRAWN VIEW. Asked for a board, the sheet
21
+ * stood over most of it until it was put away: with a draft in place it
22
+ * keeps only the latest answer's lines above the field (the rest of the
23
+ * talk scrolls behind them), so the view is what the reader looks at.
24
+ */
25
+ const yielding = phone && talk.draft !== null;
26
+ /* THE LATEST ANSWER IN SIGHT: the panel scrolls to its foot as a turn arrives. */
27
+ const body = useRef(null);
28
+ useLayoutEffect(() => {
29
+ const at = body.current;
30
+ if (!at)
31
+ return;
32
+ // Yielding, the sheet is exactly as tall as the latest answer (up to its cap): no half a line of the turn before it.
33
+ const last = yielding ? [...at.querySelectorAll("ol > li")].pop() : undefined;
34
+ if (last) {
35
+ // From the answer's top to the end of the talk (what follows it is the list's own foot).
36
+ const from = last.getBoundingClientRect().top - at.getBoundingClientRect().top + at.scrollTop;
37
+ at.style.maxHeight = `min(${Math.ceil(at.scrollHeight - from)}px, ${YIELDED})`;
38
+ }
39
+ at.scrollTop = at.scrollHeight;
40
+ }, [talk.turns.length, talk.busy, yielding]);
41
+ return (_jsxs("div", { "data-testid": "seat-panel", ...(yielding ? { "data-graview-seat-yields": "" } : {}), style: { display: "grid", gridTemplateRows: "auto minmax(0, 1fr)", gap: 4, minHeight: 0 }, children: [_jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: phone ? "center" : "flex-end", gap: 2, position: "relative", minHeight: 28 }, children: [phone ? (
42
+ /* A GRAB LINE, the sheet's own way away: a real button the width of a thumb. */
43
+ _jsx("button", { type: "button", "data-testid": "seat-grab", "aria-label": `Close Ask ${name}`, title: "Close", onClick: onClose, style: { ...ICON, width: 64 }, children: _jsx("span", { "aria-hidden": "true", style: { display: "block", width: 36, height: 4, margin: "0 auto", borderRadius: 2, background: "var(--graview-edge-strong, var(--graview-ink-faint))" } }) })) : (_jsx("button", { type: "button", "data-testid": "seat-side", "aria-label": side === "left" ? "Move to the right" : "Move to the left", title: side === "left" ? "Move to the right" : "Move to the left", onClick: () => seatTalk.setSide(side === "left" ? "right" : "left"), style: ICON, children: _jsx("span", { "aria-hidden": "true", children: "\u21C4" }) })), phone ? null : (_jsx("button", { type: "button", "data-testid": "seat-close", "aria-label": `Close Ask ${name}`, title: "Close", onClick: onClose, style: ICON, children: _jsx("span", { "aria-hidden": "true", children: "\u2715" }) }))] }), _jsx("div", { ref: body, "data-testid": "seat-body", style: {
44
+ minHeight: 0,
45
+ // A drawn view on a phone: the sheet yields to it, keeping the latest answer's lines over the field.
46
+ maxHeight: yielding ? YIELDED : phone ? "calc(70cqh - 96px)" : "min(520px, calc(100cqh - 112px))",
47
+ overflowY: "auto",
48
+ overflowX: "hidden",
49
+ padding: "0 4px",
50
+ }, children: _jsx(ChatPanel, { shared: true, composer: false, testId: "seat", onPick: go, ...(onMove ? { onMove } : {}), ...(place ? { place } : {}), ...(onDraft ? { onDraft } : {}), empty: _jsx(SeatHere, { ...(place ? { here: place } : {}) }), ...(respond ? { respond } : {}), ...(onCall ? { onCall } : {}) }) }), _jsx("p", { "aria-live": "polite", "data-testid": "seat-said", style: VISUALLY_HIDDEN, children: talk.busy ? "" : (latest?.text ?? "") })] }));
51
+ }
52
+ /**
53
+ * WHERE A NAME IN AN ANSWER TAKES THE READER — the one place the seat moves
54
+ * the app. A face that knows its own way (Pages: the record's page) says so
55
+ * with `onPick`; on the scene the thing is chosen and flown to. When the
56
+ * seat's answers carry moves of their own (a place, a list narrowed by a
57
+ * date), they are applied here too, so both faces move the same way.
58
+ */
59
+ export function useSeatGo(onPick) {
60
+ const { setView } = useGraview();
61
+ return useCallback((id) => (onPick ? onPick(id) : setView((stop) => withSelection(withFocus(withOverview(stop, false), id), [id]))), [onPick, setView]);
62
+ }
63
+ /**
64
+ * WITH NOTHING ASKED: one line about where the reader is, a few things to
65
+ * ask, and at most three acts — the repairs a broken rule names for this
66
+ * thing, and the ones the reader pinned.
67
+ */
68
+ function SeatHere({ here }) {
69
+ const { store, views, view, seatTalk } = useGraview();
70
+ const subject = useSubject({ hover: false });
71
+ // Each with its rule's line, so the line about where the reader is says the shape and the record's values.
72
+ const lined = useLined(store, useViolations());
73
+ const violations = useMemo(() => lined.map((violation) => (violation.line ? { ...violation, message: problemLine(violation) } : violation)), [lined]);
74
+ const record = subject.id ? store.graph.getNode(subject.id) : undefined;
75
+ const standing = here ?? view.within?.["view"];
76
+ const place = subject.because === "place" && subject.id === null
77
+ ? views.places().find((one) => one.title === subject.name)
78
+ : standing
79
+ ? views.places().find((one) => one.as === standing)
80
+ : undefined;
81
+ const today = store.today();
82
+ const input = {
83
+ store,
84
+ subject: { id: subject.id, name: subject.name },
85
+ violations,
86
+ place: place ? { title: place.title, kind: place.kind } : null,
87
+ places: views.places().map((one) => ({ title: one.title, kind: one.kind, picture: true })),
88
+ ...(today ? { today } : {}),
89
+ };
90
+ const line = whereLine(input);
91
+ const suggestions = suggestionsFor(input);
92
+ const options = useMemo(() => ({ pins: loadPins(), ...(record ? { focus: record.id, about: [record.id] } : {}) }), [record?.id]);
93
+ const { affordances } = useAffordances(options);
94
+ const acts = record ? offeredActs(affordances, { store, subject: { id: subject.id, name: subject.name } }) : [];
95
+ const { apply, preview } = useApplyAffordance();
96
+ const [asking, setAsking] = useState(null);
97
+ const [said, setSaid] = useState(null);
98
+ const act = (affordance, args) => {
99
+ try {
100
+ preview(affordance, args);
101
+ apply(affordance, args);
102
+ setSaid(null);
103
+ return true;
104
+ }
105
+ catch (error) {
106
+ setSaid(failureWords(store.schema, store.allMutations(), error));
107
+ return false;
108
+ }
109
+ };
110
+ return (_jsxs("div", { "data-testid": "seat-here", style: { display: "grid", gap: 10, padding: "2px 2px 6px" }, children: [_jsx("p", { "data-testid": "seat-where", style: { margin: 0, fontSize: "0.9375rem", lineHeight: 1.45, color: "var(--graview-ink)" }, children: line }), acts.length > 0 ? (_jsx("ul", { "aria-label": "What you can do", style: { margin: 0, padding: 0, listStyle: "none", display: "flex", flexWrap: "wrap", gap: 6 }, children: acts.map(({ affordance, label }) => (_jsx("li", { children: _jsx("button", { type: "button", "data-testid": "seat-act", "data-affordance": affordance.id, "aria-pressed": asking?.id === affordance.id, title: affordance.why, onClick: () => (affordance.open.length > 0 ? setAsking((was) => (was?.id === affordance.id ? null : affordance)) : void act(affordance)), style: { ...QUIET_BUTTON, minHeight: 30, textAlign: "start", ...(affordance.destructive ? { color: "var(--graview-warn)" } : {}) }, children: label }) }, affordance.id))) })) : null, asking ? (_jsx(AnswerArgs, { affordance: asking, onApply: (args) => {
111
+ if (act(asking, args))
112
+ setAsking(null);
113
+ }, onCancel: () => setAsking(null) })) : null, said ? (_jsx("p", { "data-testid": "seat-refused", style: { margin: 0, fontSize: "0.8125rem", color: "var(--graview-warn)" }, children: said })) : null, suggestions.length > 0 ? (_jsx("ul", { "aria-label": "Things to ask", style: { margin: 0, padding: 0, listStyle: "none", display: "grid", gap: 2, justifyItems: "start" }, children: suggestions.map((suggestion) => (_jsx("li", { children: _jsx("button", { type: "button", "data-testid": "seat-suggestion", "data-graview-why": suggestion.why, onClick: () => seatTalk.ask(suggestion.ask), style: LINK, children: suggestion.ask }) }, suggestion.ask))) })) : null] }));
114
+ }
115
+ /** A small square control in the panel's top row: a glyph, its name said to the screen reader. */
116
+ /** How much of the talk a phone's sheet keeps over a drawn view: the latest answer's lines. */
117
+ const YIELDED = "min(5.5em, 22cqh)";
118
+ const ICON = {
119
+ display: "inline-grid",
120
+ placeItems: "center",
121
+ width: 28,
122
+ height: 28,
123
+ padding: 0,
124
+ font: "inherit",
125
+ fontSize: "0.875rem",
126
+ lineHeight: 1,
127
+ color: "var(--graview-ink-muted)",
128
+ background: "transparent",
129
+ border: "1px solid transparent",
130
+ borderRadius: 6,
131
+ boxShadow: "none",
132
+ cursor: "pointer",
133
+ };
134
+ //# sourceMappingURL=seat-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seat-panel.js","sourceRoot":"","sources":["../src/seat-panel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,s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,CAAC;AACJ,CAAC;AAED,kGAAkG;AAClG,+FAA+F;AAC/F,MAAM,OAAO,GAAG,mBAAmB,CAAC;AAEpC,MAAM,IAAI,GAAkB;IAC1B,OAAO,EAAE,aAAa;IACtB,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,CAAC;IACb,KAAK,EAAE,0BAA0B;IACjC,UAAU,EAAE,aAAa;IACzB,MAAM,EAAE,uBAAuB;IAC/B,YAAY,EAAE,CAAC;IACf,SAAS,EAAE,MAAM;IACjB,MAAM,EAAE,SAAS;CAClB,CAAC"}
package/dist/seat.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import type { ChatContext, ChatReply, LocalStatus, OfferedQuestion, ProposedCall } from "@graview/tools";
1
+ import { type SeatOutcome, type SeatTalk, type SeatTurn } from "@graview/react/provider";
2
+ import type { ChatContext, ChatReply, ProposedCall } from "@graview/tools";
2
3
  import { type ReactNode } from "react";
3
4
  /**
4
5
  * ONE CONVERSATION WITH A SEAT, WHEREVER IT IS HELD.
@@ -11,38 +12,13 @@ import { type ReactNode } from "react";
11
12
  * person moving from the app into its studio met a second assistant.
12
13
  *
13
14
  * What is shared is everything a conversation IS: the turns, what became of
14
- * each proposal, what the model is told happened, the header that says
15
- * which rung is answering, the thread and the field. What differs is only
15
+ * each proposal, what the model is told happened, the thread and the
16
+ * field. What differs is only
16
17
  * what a proposal is FOR — a change to the graph, applied; a change to the
17
18
  * declaration, checked and kept — so a surface supplies how one proposal is
18
19
  * drawn and nothing else.
19
20
  */
20
- export interface SeatTurn {
21
- readonly role: "person" | "seat";
22
- readonly text: string;
23
- readonly proposals?: readonly ProposedCall[];
24
- /** Questions the seat is asking back, each at the node it is about. */
25
- readonly questions?: readonly OfferedQuestion[];
26
- /** The rung could not read the sentence: a model would, one press away. */
27
- readonly unsure?: boolean;
28
- /** What the words found, when that was the answer: each a way to go there. */
29
- readonly picks?: ChatReply["picks"];
30
- }
31
- /**
32
- * WHAT BECAME OF A PROPOSAL, said where it was offered. Each settling used
33
- * to post a message of its own, so one request read as five; the press
34
- * becomes its own outcome instead, in place.
35
- */
36
- export type SeatOutcome = {
37
- readonly state: "applied";
38
- readonly said: string;
39
- } | {
40
- readonly state: "declined";
41
- readonly said: string;
42
- } | {
43
- readonly state: "refused";
44
- readonly error: string;
45
- };
21
+ export type { SeatOutcome, SeatTurn };
46
22
  /** The key of a proposal in the thread: which turn, which of its proposals. */
47
23
  export declare const proposalKey: (turn: number, at: number) => string;
48
24
  export type SeatAnswer = (text: string, context: Pick<ChatContext, "history">) => Promise<ChatReply>;
@@ -53,10 +29,16 @@ export type SeatAnswer = (text: string, context: Pick<ChatContext, "history">) =
53
29
  * plot the last turn made, and the model only knows which if the history
54
30
  * carries what landed, by name — so every surface sends it, not just one.
55
31
  */
56
- export declare function useSeatConversation({ answer, onReply, }: {
32
+ export declare function useSeatConversation({ answer, onReply, talk, }: {
57
33
  readonly answer: SeatAnswer;
58
34
  /** Said from the body too, or refused at a gate: whatever the surface does with a reply besides showing it. */
59
35
  readonly onReply?: (reply: ChatReply) => void;
36
+ /**
37
+ * Where the conversation is kept: the app's (`useGraview().seatTalk`), so
38
+ * it outlives this surface and a face switch, or this surface's own when
39
+ * not given — the studio's declaration seat keeps its own.
40
+ */
41
+ readonly talk?: SeatTalk;
60
42
  }): {
61
43
  turns: readonly SeatTurn[];
62
44
  outcomes: ReadonlyMap<string, SeatOutcome>;
@@ -64,30 +46,20 @@ export declare function useSeatConversation({ answer, onReply, }: {
64
46
  send: (text: string) => Promise<void>;
65
47
  settle: (key: string, outcome: SeatOutcome) => void;
66
48
  };
67
- /** Where answers are coming from right now, for the header — the same words on every surface. */
68
- export declare function describeSource(described: string, warmth: LocalStatus | null, floor?: string): string;
69
- export declare function SeatHeader({ label, source, sourceTitle, testId, settings, onSettings, foot, }: {
70
- /** What the seat talks about: "Seat" in the app, "Declaration" in the studio. */
49
+ export declare function SeatHeader({ label, testId, }: {
50
+ /** What the seat talks about: "Declaration" in the studio. */
71
51
  readonly label: string;
72
- readonly source: string;
73
- readonly sourceTitle?: string;
74
52
  readonly testId: string;
75
- readonly settings?: boolean;
76
- /** Under the composer rather than over the thread: a status line, not a title. */
77
- readonly foot?: boolean;
78
- /** Absent when the ladder is not the reader's to set — a host answers for them. */
79
- readonly onSettings?: () => void;
80
53
  }): import("react").JSX.Element;
81
54
  /**
82
- * The seat's trailing aside — "(from the graph)", "(the local model is
83
- * warming …)" — is which rung answered, not the answer: kept, and set
84
- * quieter than what was said.
55
+ * The seat's trailing aside — "(AI didn't answer just now, …)" — is about
56
+ * the answer, not the answer: kept, and set quieter than what was said.
85
57
  */
86
58
  export declare const splitAside: (text: string) => {
87
59
  said: string;
88
60
  aside?: string;
89
61
  };
90
- export declare function SeatThread({ turns, outcomes, busy, testId, empty, minHeight, maxHeight, renderProposal, renderAfter, ready, onApplyAll, applyAllLabel, onChooseModel, }: {
62
+ export declare function SeatThread({ turns, outcomes, busy, testId, empty, minHeight, maxHeight, renderProposal, renderAfter, renderSaid, ready, onApplyAll, applyAllLabel, }: {
91
63
  readonly turns: readonly SeatTurn[];
92
64
  readonly outcomes: ReadonlyMap<string, SeatOutcome>;
93
65
  readonly busy: boolean;
@@ -104,14 +76,14 @@ export declare function SeatThread({ turns, outcomes, busy, testId, empty, minHe
104
76
  }) => ReactNode;
105
77
  /** Whatever else a seat turn carries on this surface — questions at nodes, in the app. */
106
78
  readonly renderAfter?: (turn: SeatTurn, index: number) => ReactNode;
79
+ /** The seat's own words, drawn: in the app, the names its moves went to are links. */
80
+ readonly renderSaid?: (turn: SeatTurn, said: string) => ReactNode;
107
81
  /** Whether a proposal could be taken at all here; one that could not is not counted for "all". */
108
82
  readonly ready?: (proposal: ProposedCall, key: string) => boolean;
109
83
  /** One request, one press: take this turn's open proposals in order. */
110
84
  readonly onApplyAll?: (turn: number, proposals: readonly ProposedCall[]) => void;
111
85
  readonly applyAllLabel?: string;
112
- /** Offered under a turn the rung could not read, when a model is one press away. */
113
- readonly onChooseModel?: () => void;
114
- }): import("react").JSX.Element;
86
+ }): import("react").JSX.Element | null;
115
87
  /** A proposal that landed, was set aside, or was refused — in the place it was offered. */
116
88
  export declare function Settled({ outcome, testId }: {
117
89
  readonly outcome: SeatOutcome;
@@ -124,14 +96,4 @@ export declare function SeatComposer({ busy, placeholder, ariaLabel, testId, onS
124
96
  readonly testId: string;
125
97
  readonly onSend: (text: string) => void;
126
98
  }): import("react").JSX.Element;
127
- /**
128
- * WHAT ANSWERS, chosen where the seat is. The same one setting the profile
129
- * holds — pills, and a key field only when a rung needs one — so a person
130
- * pressing "Let a model read it" is shown the choice they would find in
131
- * the profile, not a second form that could disagree with it.
132
- */
133
- export declare function SeatSettings({ testId, onDone }: {
134
- readonly testId: string;
135
- readonly onDone: () => void;
136
- }): import("react").JSX.Element;
137
99
  //# sourceMappingURL=seat.d.ts.map