@graview/primitives 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/LICENSE +96 -0
  2. package/README.md +25 -0
  3. package/dist/arrange-bar.d.ts +49 -0
  4. package/dist/arrange-bar.d.ts.map +1 -0
  5. package/dist/arrange-bar.js +264 -0
  6. package/dist/arrange-bar.js.map +1 -0
  7. package/dist/chat.d.ts +46 -0
  8. package/dist/chat.d.ts.map +1 -0
  9. package/dist/chat.js +343 -0
  10. package/dist/chat.js.map +1 -0
  11. package/dist/companion.d.ts +58 -0
  12. package/dist/companion.d.ts.map +1 -0
  13. package/dist/companion.js +433 -0
  14. package/dist/companion.js.map +1 -0
  15. package/dist/connections.d.ts +23 -0
  16. package/dist/connections.d.ts.map +1 -0
  17. package/dist/connections.js +100 -0
  18. package/dist/connections.js.map +1 -0
  19. package/dist/default-views.d.ts +35 -0
  20. package/dist/default-views.d.ts.map +1 -0
  21. package/dist/default-views.js +605 -0
  22. package/dist/default-views.js.map +1 -0
  23. package/dist/editable.d.ts +71 -0
  24. package/dist/editable.d.ts.map +1 -0
  25. package/dist/editable.js +225 -0
  26. package/dist/editable.js.map +1 -0
  27. package/dist/figure.d.ts +30 -0
  28. package/dist/figure.d.ts.map +1 -0
  29. package/dist/figure.js +66 -0
  30. package/dist/figure.js.map +1 -0
  31. package/dist/find.d.ts +5 -0
  32. package/dist/find.d.ts.map +1 -0
  33. package/dist/find.js +252 -0
  34. package/dist/find.js.map +1 -0
  35. package/dist/index.d.ts +51 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +44 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/installation.d.ts +17 -0
  40. package/dist/installation.d.ts.map +1 -0
  41. package/dist/installation.js +37 -0
  42. package/dist/installation.js.map +1 -0
  43. package/dist/ladder.d.ts +2 -0
  44. package/dist/ladder.d.ts.map +1 -0
  45. package/dist/ladder.js +53 -0
  46. package/dist/ladder.js.map +1 -0
  47. package/dist/lens/arranging.d.ts +41 -0
  48. package/dist/lens/arranging.d.ts.map +1 -0
  49. package/dist/lens/arranging.js +38 -0
  50. package/dist/lens/arranging.js.map +1 -0
  51. package/dist/lens/board.d.ts +146 -0
  52. package/dist/lens/board.d.ts.map +1 -0
  53. package/dist/lens/board.js +658 -0
  54. package/dist/lens/board.js.map +1 -0
  55. package/dist/lens/calendar-dates.d.ts +19 -0
  56. package/dist/lens/calendar-dates.d.ts.map +1 -0
  57. package/dist/lens/calendar-dates.js +55 -0
  58. package/dist/lens/calendar-dates.js.map +1 -0
  59. package/dist/lens/calendar-drawing.d.ts +59 -0
  60. package/dist/lens/calendar-drawing.d.ts.map +1 -0
  61. package/dist/lens/calendar-drawing.js +229 -0
  62. package/dist/lens/calendar-drawing.js.map +1 -0
  63. package/dist/lens/calendar-options.d.ts +107 -0
  64. package/dist/lens/calendar-options.d.ts.map +1 -0
  65. package/dist/lens/calendar-options.js +19 -0
  66. package/dist/lens/calendar-options.js.map +1 -0
  67. package/dist/lens/calendar-placing.d.ts +35 -0
  68. package/dist/lens/calendar-placing.d.ts.map +1 -0
  69. package/dist/lens/calendar-placing.js +113 -0
  70. package/dist/lens/calendar-placing.js.map +1 -0
  71. package/dist/lens/calendar-spans.d.ts +48 -0
  72. package/dist/lens/calendar-spans.d.ts.map +1 -0
  73. package/dist/lens/calendar-spans.js +146 -0
  74. package/dist/lens/calendar-spans.js.map +1 -0
  75. package/dist/lens/calendar-view.d.ts +34 -0
  76. package/dist/lens/calendar-view.d.ts.map +1 -0
  77. package/dist/lens/calendar-view.js +228 -0
  78. package/dist/lens/calendar-view.js.map +1 -0
  79. package/dist/lens/calendar.d.ts +43 -0
  80. package/dist/lens/calendar.d.ts.map +1 -0
  81. package/dist/lens/calendar.js +43 -0
  82. package/dist/lens/calendar.js.map +1 -0
  83. package/dist/lens/coverage.d.ts +183 -0
  84. package/dist/lens/coverage.d.ts.map +1 -0
  85. package/dist/lens/coverage.js +732 -0
  86. package/dist/lens/coverage.js.map +1 -0
  87. package/dist/lens/horizon.d.ts +14 -0
  88. package/dist/lens/horizon.d.ts.map +1 -0
  89. package/dist/lens/horizon.js +20 -0
  90. package/dist/lens/horizon.js.map +1 -0
  91. package/dist/lens/more.d.ts +16 -0
  92. package/dist/lens/more.d.ts.map +1 -0
  93. package/dist/lens/more.js +17 -0
  94. package/dist/lens/more.js.map +1 -0
  95. package/dist/lens/plan-lens.d.ts +17 -0
  96. package/dist/lens/plan-lens.d.ts.map +1 -0
  97. package/dist/lens/plan-lens.js +24 -0
  98. package/dist/lens/plan-lens.js.map +1 -0
  99. package/dist/lens/plan-state.d.ts +122 -0
  100. package/dist/lens/plan-state.d.ts.map +1 -0
  101. package/dist/lens/plan-state.js +152 -0
  102. package/dist/lens/plan-state.js.map +1 -0
  103. package/dist/lens/plan-view.d.ts +10 -0
  104. package/dist/lens/plan-view.d.ts.map +1 -0
  105. package/dist/lens/plan-view.js +576 -0
  106. package/dist/lens/plan-view.js.map +1 -0
  107. package/dist/lens/plan.d.ts +25 -0
  108. package/dist/lens/plan.d.ts.map +1 -0
  109. package/dist/lens/plan.js +25 -0
  110. package/dist/lens/plan.js.map +1 -0
  111. package/dist/lens/reach.d.ts +47 -0
  112. package/dist/lens/reach.d.ts.map +1 -0
  113. package/dist/lens/reach.js +67 -0
  114. package/dist/lens/reach.js.map +1 -0
  115. package/dist/lens/timeline.d.ts +137 -0
  116. package/dist/lens/timeline.d.ts.map +1 -0
  117. package/dist/lens/timeline.js +426 -0
  118. package/dist/lens/timeline.js.map +1 -0
  119. package/dist/markup.d.ts +23 -0
  120. package/dist/markup.d.ts.map +1 -0
  121. package/dist/markup.js +24 -0
  122. package/dist/markup.js.map +1 -0
  123. package/dist/places.d.ts +24 -0
  124. package/dist/places.d.ts.map +1 -0
  125. package/dist/places.js +227 -0
  126. package/dist/places.js.map +1 -0
  127. package/dist/popover.d.ts +28 -0
  128. package/dist/popover.d.ts.map +1 -0
  129. package/dist/popover.js +59 -0
  130. package/dist/popover.js.map +1 -0
  131. package/dist/primitives/index.d.ts +214 -0
  132. package/dist/primitives/index.d.ts.map +1 -0
  133. package/dist/primitives/index.js +381 -0
  134. package/dist/primitives/index.js.map +1 -0
  135. package/dist/profile.d.ts +65 -0
  136. package/dist/profile.d.ts.map +1 -0
  137. package/dist/profile.js +233 -0
  138. package/dist/profile.js.map +1 -0
  139. package/dist/quick-relations.d.ts +16 -0
  140. package/dist/quick-relations.d.ts.map +1 -0
  141. package/dist/quick-relations.js +183 -0
  142. package/dist/quick-relations.js.map +1 -0
  143. package/dist/relation-key.d.ts +44 -0
  144. package/dist/relation-key.d.ts.map +1 -0
  145. package/dist/relation-key.js +196 -0
  146. package/dist/relation-key.js.map +1 -0
  147. package/dist/seat.d.ts +137 -0
  148. package/dist/seat.d.ts.map +1 -0
  149. package/dist/seat.js +162 -0
  150. package/dist/seat.js.map +1 -0
  151. package/dist/seats.d.ts +21 -0
  152. package/dist/seats.d.ts.map +1 -0
  153. package/dist/seats.js +62 -0
  154. package/dist/seats.js.map +1 -0
  155. package/dist/seeding.d.ts +150 -0
  156. package/dist/seeding.d.ts.map +1 -0
  157. package/dist/seeding.js +538 -0
  158. package/dist/seeding.js.map +1 -0
  159. package/dist/shell.d.ts +74 -0
  160. package/dist/shell.d.ts.map +1 -0
  161. package/dist/shell.js +86 -0
  162. package/dist/shell.js.map +1 -0
  163. package/dist/theme.d.ts +50 -0
  164. package/dist/theme.d.ts.map +1 -0
  165. package/dist/theme.js +1692 -0
  166. package/dist/theme.js.map +1 -0
  167. package/dist/wordmark.d.ts +15 -0
  168. package/dist/wordmark.d.ts.map +1 -0
  169. package/dist/wordmark.js +55 -0
  170. package/dist/wordmark.js.map +1 -0
  171. package/dist/workbench/activity.d.ts +75 -0
  172. package/dist/workbench/activity.d.ts.map +1 -0
  173. package/dist/workbench/activity.js +259 -0
  174. package/dist/workbench/activity.js.map +1 -0
  175. package/dist/workbench/agent-seat.d.ts +51 -0
  176. package/dist/workbench/agent-seat.d.ts.map +1 -0
  177. package/dist/workbench/agent-seat.js +112 -0
  178. package/dist/workbench/agent-seat.js.map +1 -0
  179. package/dist/workbench/answer-args.d.ts +31 -0
  180. package/dist/workbench/answer-args.d.ts.map +1 -0
  181. package/dist/workbench/answer-args.js +257 -0
  182. package/dist/workbench/answer-args.js.map +1 -0
  183. package/dist/workbench/back-out.d.ts +71 -0
  184. package/dist/workbench/back-out.d.ts.map +1 -0
  185. package/dist/workbench/back-out.js +238 -0
  186. package/dist/workbench/back-out.js.map +1 -0
  187. package/dist/workbench/following.d.ts +7 -0
  188. package/dist/workbench/following.d.ts.map +1 -0
  189. package/dist/workbench/following.js +26 -0
  190. package/dist/workbench/following.js.map +1 -0
  191. package/dist/workbench/index.d.ts +23 -0
  192. package/dist/workbench/index.d.ts.map +1 -0
  193. package/dist/workbench/index.js +23 -0
  194. package/dist/workbench/index.js.map +1 -0
  195. package/dist/workbench/inspector.d.ts +27 -0
  196. package/dist/workbench/inspector.d.ts.map +1 -0
  197. package/dist/workbench/inspector.js +745 -0
  198. package/dist/workbench/inspector.js.map +1 -0
  199. package/dist/workbench/standing.d.ts +16 -0
  200. package/dist/workbench/standing.d.ts.map +1 -0
  201. package/dist/workbench/standing.js +102 -0
  202. package/dist/workbench/standing.js.map +1 -0
  203. package/dist/workbench/trail.d.ts +35 -0
  204. package/dist/workbench/trail.d.ts.map +1 -0
  205. package/dist/workbench/trail.js +150 -0
  206. package/dist/workbench/trail.js.map +1 -0
  207. package/package.json +62 -0
package/LICENSE ADDED
@@ -0,0 +1,96 @@
1
+ Elastic License 2.0
2
+
3
+ ## Acceptance
4
+
5
+ By using the software, you agree to all of the terms and conditions below.
6
+
7
+ ## Copyright License
8
+
9
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
10
+ non-sublicensable, non-transferable license to use, copy, distribute, make
11
+ available, and prepare derivative works of the software, in each case subject
12
+ to the limitations and conditions below.
13
+
14
+ ## Limitations
15
+
16
+ You may not provide the software to third parties as a hosted or managed
17
+ service, where the service provides users with access to any substantial set
18
+ of the features or functionality of the software.
19
+
20
+ You may not move, change, disable, or circumvent the license key
21
+ functionality in the software, and you may not remove or obscure any
22
+ functionality in the software that is protected by the license key.
23
+
24
+ You may not alter, remove, or obscure any licensing, copyright, or other
25
+ notices of the licensor in the software. Any use of the licensor's trademarks
26
+ is subject to applicable law.
27
+
28
+ ## Patents
29
+
30
+ The licensor grants you a license, under any patent claims the licensor can
31
+ license, or becomes able to license, to make, have made, use, sell, offer for
32
+ sale, import and have imported the software, in each case subject to the
33
+ limitations and conditions in this license. This license does not cover any
34
+ patent claims that you cause to be infringed by modifications or additions to
35
+ the software. If you or your company make any written claim that the software
36
+ infringes or contributes to infringement of any patent, your patent license
37
+ for the software granted under these terms ends immediately. If your company
38
+ makes such a claim, your patent license ends immediately for work on behalf
39
+ of your company.
40
+
41
+ ## Notices
42
+
43
+ You must ensure that anyone who gets a copy of any part of the software from
44
+ you also gets a copy of these terms.
45
+
46
+ If you modify the software, you must include in any modified copies of the
47
+ software prominent notices stating that you have modified the software.
48
+
49
+ ## No Other Rights
50
+
51
+ These terms do not imply any licenses other than those expressly granted in
52
+ these terms.
53
+
54
+ ## Termination
55
+
56
+ If you use the software in violation of these terms, such use is not
57
+ licensed, and your licenses will automatically terminate. If the licensor
58
+ provides you with a notice of your violation, and you cease all violation of
59
+ this license no later than 30 days after you receive that notice, your
60
+ licenses will be reinstated retroactively. However, if you violate these
61
+ terms after such reinstatement, any additional violation of these terms will
62
+ cause your licenses to terminate automatically and permanently.
63
+
64
+ ## No Liability
65
+
66
+ *As far as the law allows, the software comes as is, without any warranty or
67
+ condition, and the licensor will not be liable to you for any damages arising
68
+ out of these terms or the use or nature of the software, under any kind of
69
+ legal claim.*
70
+
71
+ ## Definitions
72
+
73
+ The **licensor** is the entity offering these terms, and the **software** is
74
+ the software the licensor makes available under these terms, including any
75
+ portion of it.
76
+
77
+ **you** refers to the individual or entity agreeing to these terms.
78
+
79
+ **your company** is any legal entity, sole proprietorship, or other kind of
80
+ organization that you work for, plus all organizations that have control
81
+ over, are under the control of, or are under common control with that
82
+ organization. **control** means ownership of substantially all the assets of
83
+ an entity, or the power to direct its management and policies by vote,
84
+ contract, or otherwise. Control can be direct or indirect.
85
+
86
+ **your licenses** are all the licenses granted to you for the software under
87
+ these terms.
88
+
89
+ **use** means anything you do with the software requiring one of your
90
+ licenses.
91
+
92
+ **trademark** means trademarks, service marks, and similar rights.
93
+
94
+ ---
95
+
96
+ Copyright 2025-2026 En Dash Consulting
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # @graview/primitives
2
+
3
+ A rich primitive set, five lenses, the workbench and the visual system.
4
+
5
+ **Primitives** — `Panel`, `Chip`, `Roster`, `Grid`, `Axis`, `Connector`,
6
+ `Aggregate`, `Fields`. Enough that a new node kind renders sensibly at all
7
+ three fidelities before anyone writes a view for it.
8
+
9
+ **Lenses** — a timeline, a calendar, a coverage matrix, a board and a plan.
10
+ Each binds ROLES to an app's own fields or kinds, so a lens written for one
11
+ domain is reused by another without learning anything about it. All five are
12
+ built from the public primitives, which makes them the worked example of the
13
+ authoring API rather than privileged insiders. The board draws discs when
14
+ every slot's code is three characters or fewer and tokens — a pill sized to
15
+ the word, the occupants inside it — when any code is longer; `arrange:
16
+ "shelf"` lays a board whose x and y are categories out as headed bands.
17
+
18
+ **Workbench** — the parts of an interface that are not about the domain: what
19
+ is selected and what can be done with it, whether the rules hold, what just
20
+ happened and how to take it back, how to back out of a view. All derived from
21
+ the schema, the invariants and the op log.
22
+
23
+ **Visual system** — `themeCss(scheme, brand)`. Two schemes that are not
24
+ inversions of each other: dark loses luminance, light loses contrast and gains
25
+ haze. A brand supplies its own and `graview check` measures it.
@@ -0,0 +1,49 @@
1
+ import { type AnySchema, type Arrangeable, type ArrangeOption, type Arrangement, type ArrangeGraph, type Condition } from "@graview/core";
2
+ import { type ViewState } from "@graview/layout";
3
+ import type { CSSProperties, ReactNode } from "react";
4
+ /**
5
+ * ONE CONTROL ROW FOR EVERY SURFACE THAT ARRANGES.
6
+ *
7
+ * The list page had a group-by select of its own, the todo app's own page
8
+ * had three, the lenses had none. The offers come from the declaration
9
+ * (`arrangeable`), the chosen arrangement is a string in the stop, and
10
+ * this draws the row between them: Sort by, Group by, the conditions as
11
+ * chips with a way to add one, and the words a person types. Whatever
12
+ * carries the arrangement — a page's search, a lens's `within` — hands the
13
+ * current one in and takes the next one back; nothing here holds state.
14
+ */
15
+ export interface ArrangeBarProps {
16
+ readonly schema: AnySchema;
17
+ readonly graph: ArrangeGraph;
18
+ readonly kind: string;
19
+ readonly arrangement: Arrangement;
20
+ readonly onChange: (next: Arrangement) => void;
21
+ /** What the surface declines, if anything. Everything is on unless declined. */
22
+ readonly allow?: ArrangeOption;
23
+ /** Whether to draw the words box. On unless declined. */
24
+ readonly query?: boolean;
25
+ /** How many the arrangement kept, of how many there were — said beside the row when given. */
26
+ readonly kept?: {
27
+ readonly shown: number;
28
+ readonly of: number;
29
+ };
30
+ /** Prefix for the row's test ids: `arrange` by default. */
31
+ readonly testId?: string;
32
+ readonly style?: CSSProperties;
33
+ }
34
+ /** The far ends an edge condition may name, from the graph. */
35
+ /**
36
+ * The far ends a menu offers to narrow by. A menu is for choosing, not for
37
+ * reading a catalogue: past FAR_ENDS it holds the most connected (the ones a
38
+ * person most likely means), and the search reaches the rest — a select of
39
+ * 1,177 songs was 1,177 elements in every row that offered it (docs/scale.md).
40
+ */
41
+ export declare const FAR_ENDS = 40;
42
+ /** A condition in words: "Due date before 2026-10-01", "The list it is on: Today", "Past". */
43
+ export declare function sayCondition(schema: AnySchema, graph: ArrangeGraph, offers: Arrangeable, condition: Condition): string;
44
+ export declare function ArrangeBar(props: ArrangeBarProps): import("react").JSX.Element | null;
45
+ export declare function arrangementOf(view: ViewState): Arrangement;
46
+ export declare function withArrangement(view: ViewState, arrangement: Arrangement): ViewState;
47
+ /** A small caption for what an arrangement did, for a surface with no room for the row. */
48
+ export declare function arrangementC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AAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,CAgBtH;AAKD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,sCAsKhD;AAoFD,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,WAAW,CAQ1D;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,GAAG,SAAS,CAKpF;AAED,2FAA2F;AAC3F,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,CAOtE"}
@@ -0,0 +1,264 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { arrangeAllows, arrangeable, formatArrangement, labelOf, parseArrangement, } from "@graview/core";
3
+ import { withWithin } from "@graview/layout";
4
+ /*
5
+ * NOTHING HERE MAY WIDEN THE PAGE. A select is as wide as its longest
6
+ * option, and at a reader's own text size — 32px root on a 390px phone —
7
+ * "as declared (due date)" alone pushed the tasks page sideways. Every
8
+ * control caps at the row's width and the row wraps; a long option is cut
9
+ * inside its box rather than carried outside it.
10
+ */
11
+ const control = {
12
+ font: "inherit",
13
+ fontSize: "0.875rem",
14
+ minHeight: 32,
15
+ minWidth: 0,
16
+ maxWidth: "100%",
17
+ padding: "4px 8px",
18
+ borderRadius: 8,
19
+ border: "1px solid var(--graview-edge)",
20
+ background: "var(--graview-panel)",
21
+ color: "var(--graview-ink)",
22
+ textOverflow: "ellipsis",
23
+ };
24
+ /*
25
+ * A SELECT THAT KEEPS ITS FLOOR IN EVERY ENGINE. WebKit draws a native
26
+ * select at its own height and ignores `min-height`: at phone width every
27
+ * arrange bar's select was 22 pixels tall in WebKit and 32 elsewhere —
28
+ * under the 24 a target needs, measured by a check that had only ever run
29
+ * in Chromium (the third walk's lesson, in the fifth). With the native
30
+ * appearance off the floor holds, and the chevron is drawn in the text's
31
+ * colour the way the places menu draws it.
32
+ */
33
+ const choice = {
34
+ ...control,
35
+ appearance: "none",
36
+ WebkitAppearance: "none",
37
+ paddingRight: 24,
38
+ backgroundImage: "linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%)",
39
+ backgroundPosition: "calc(100% - 13px) 55%, calc(100% - 9px) 55%",
40
+ backgroundSize: "4px 4px, 4px 4px",
41
+ backgroundRepeat: "no-repeat",
42
+ };
43
+ const label = {
44
+ display: "inline-flex",
45
+ alignItems: "center",
46
+ flexWrap: "wrap",
47
+ gap: 6,
48
+ minWidth: 0,
49
+ maxWidth: "100%",
50
+ fontSize: "0.875rem",
51
+ color: "var(--graview-ink-muted)",
52
+ };
53
+ const chip = {
54
+ display: "inline-flex",
55
+ alignItems: "center",
56
+ gap: 6,
57
+ minHeight: 28,
58
+ padding: "0 2px 0 10px",
59
+ borderRadius: 999,
60
+ border: "1px solid var(--graview-edge)",
61
+ background: "var(--graview-panel)",
62
+ color: "var(--graview-ink)",
63
+ fontSize: "0.8125rem",
64
+ };
65
+ /** The far ends an edge condition may name, from the graph. */
66
+ /**
67
+ * The far ends a menu offers to narrow by. A menu is for choosing, not for
68
+ * reading a catalogue: past FAR_ENDS it holds the most connected (the ones a
69
+ * person most likely means), and the search reaches the rest — a select of
70
+ * 1,177 songs was 1,177 elements in every row that offered it (docs/scale.md).
71
+ */
72
+ export const FAR_ENDS = 40;
73
+ function farEndsOf(schema, graph, offer) {
74
+ const kinds = offer.far ?? [];
75
+ const seen = new Map();
76
+ const wanted = new Set(kinds);
77
+ for (const node of graph.allNodes()) {
78
+ if (!wanted.has(node.kind))
79
+ continue;
80
+ seen.set(node.id, labelOf(schema.tryDefinition(node.kind), node));
81
+ }
82
+ const ends = [...seen.entries()].map(([id, text]) => ({ id, label: text }));
83
+ const kept = ends.length <= FAR_ENDS
84
+ ? ends
85
+ : ends
86
+ .map((end) => ({ end, ties: graph.out(end.id).length + graph.in(end.id).length }))
87
+ .sort((a, b) => b.ties - a.ties || a.end.label.localeCompare(b.end.label))
88
+ .slice(0, FAR_ENDS)
89
+ .map((entry) => entry.end);
90
+ return kept.sort((a, b) => a.label.localeCompare(b.label));
91
+ }
92
+ /** A condition in words: "Due date before 2026-10-01", "The list it is on: Today", "Past". */
93
+ export function sayCondition(schema, graph, offers, condition) {
94
+ const offer = offers.filters.find((candidate) => candidate.key === condition.key);
95
+ if (!offer)
96
+ return `${condition.key}: ${condition.value}`;
97
+ if (offer.about === "is")
98
+ return condition.value.charAt(0).toUpperCase() + condition.value.slice(1);
99
+ if (offer.about === "edge") {
100
+ if (condition.value === "*")
101
+ return `${offer.label}: anything`;
102
+ if (condition.value === "none")
103
+ return `${offer.label}: nothing`;
104
+ const node = graph.getNode(condition.value);
105
+ return `${offer.label}: ${node ? labelOf(schema.tryDefinition(node.kind), node) : condition.value}`;
106
+ }
107
+ if (offer.type === "date") {
108
+ const [op, date] = condition.value.split(":");
109
+ return `${offer.label} ${op} ${date ?? ""}`.trim();
110
+ }
111
+ if (offer.type === "boolean")
112
+ return `${offer.label}: ${condition.value === "true" ? "yes" : "no"}`;
113
+ return `${offer.label}: ${condition.value}`;
114
+ }
115
+ /** What each bar last sent, by its test id and kind (see `ArrangeBar`). */
116
+ const SENT = new Map();
117
+ export function ArrangeBar(props) {
118
+ const { schema, graph, kind, arrangement: given, onChange } = props;
119
+ const offers = arrangeable(schema, kind);
120
+ const id = props.testId ?? "arrange";
121
+ const sorts = arrangeAllows(props.allow, "sort");
122
+ const groups = arrangeAllows(props.allow, "group");
123
+ const filters = arrangeAllows(props.allow, "filter");
124
+ const words = props.query !== false;
125
+ if (!sorts && !groups && !filters && !words)
126
+ return null;
127
+ /*
128
+ * TWO CHANGES BEFORE ONE RENDER ARE TWO CHANGES. The bar merged each change
129
+ * onto the arrangement it was drawn with, and the arrangement comes back
130
+ * through the address or the view a render later — so a grouping chosen
131
+ * and a word typed before the page redrew sent the word on top of the old
132
+ * grouping, and the grouping was lost (on a slow phone, every time). The
133
+ * bar merges onto what it last sent while what comes back is its own echo,
134
+ * and follows what comes back once something else changed it.
135
+ */
136
+ const said = (one) => JSON.stringify(formatArrangement(one));
137
+ /*
138
+ * Kept per bar, not per mount: a busy page redrew the bar between a choice
139
+ * and the next keystroke, and a bar that forgot what it had sent took the
140
+ * stale arrangement back. For a moment after its own change it trusts what
141
+ * it sent; after that, what comes back is either its echo or news.
142
+ */
143
+ const memory = `${id}|${kind}`;
144
+ const sent = { current: SENT.get(memory) ?? { words: new Set(), latest: null, at: 0 } };
145
+ SENT.set(memory, sent.current);
146
+ if (sent.current.latest && Date.now() - sent.current.at > 1500 && !sent.current.words.has(said(given))) {
147
+ sent.current = { words: new Set(), latest: null, at: 0 };
148
+ SENT.set(memory, sent.current);
149
+ }
150
+ // What the controls show: what the bar last sent while what comes back is its echo.
151
+ const arrangement = sent.current.latest ?? given;
152
+ const set = (patch) => {
153
+ // What the bar last sent, read now — not the arrangement this render was drawn with.
154
+ const next = { ...(sent.current.latest ?? given), ...patch };
155
+ for (const key of Object.keys(next))
156
+ if (next[key] === undefined)
157
+ delete next[key];
158
+ sent.current.latest = next;
159
+ sent.current.at = Date.now();
160
+ sent.current.words.add(said(next));
161
+ onChange(next);
162
+ };
163
+ const conditions = arrangement.filter ?? [];
164
+ const without = (at) => {
165
+ const rest = conditions.filter((_, index) => index !== at);
166
+ set({ filter: rest.length > 0 ? rest : undefined });
167
+ };
168
+ const add = (condition) => set({ filter: [...conditions.filter((c) => !(c.key === condition.key && c.value === condition.value)), condition] });
169
+ return (_jsxs("div", { "data-testid": `${id}-bar`, role: "group", "aria-label": "Arrange", style: { display: "flex", flexWrap: "wrap", alignItems: "center", gap: "8px 14px", minWidth: 0, maxWidth: "100%", ...props.style }, children: [words ? (_jsxs("label", { style: label, children: [_jsx("span", { className: "graview-visually-hidden", style: { position: "absolute", width: 1, height: 1, overflow: "hidden", clip: "rect(0 0 0 0)" }, children: "Find" }), _jsx("input", { type: "search", "data-testid": `${id}-query`, value: arrangement.query ?? "", placeholder: "Find\u2026", onChange: (event) => set({ query: event.target.value.length > 0 ? event.target.value : undefined }), style: { ...control, width: "min(100%, 220px)" } })] })) : null, sorts && offers.sorts.length > 1 ? (_jsxs("label", { style: label, children: ["Sort by", _jsxs("select", { "data-testid": `${id}-sort`, value: arrangement.sort?.by ?? "", onChange: (event) => set({
170
+ sort: event.target.value ? { by: event.target.value, direction: arrangement.sort?.direction ?? "asc" } : undefined,
171
+ }), style: { ...choice, maxWidth: "min(100%, 60vw)" }, children: [_jsx("option", { value: "", children: offers.natural ? `as declared (${offers.sorts.find((o) => o.key === offers.natural.by)?.label.toLowerCase() ?? offers.natural.by})` : "as they come" }), offers.sorts.map((offer) => (_jsx("option", { value: offer.key, children: offer.label }, offer.key)))] }), arrangement.sort ? (_jsx("button", { type: "button", "data-testid": `${id}-direction`, "aria-label": arrangement.sort.direction === "asc" ? "Ascending; press for descending" : "Descending; press for ascending", title: arrangement.sort.direction === "asc" ? "Ascending" : "Descending", onClick: () => set({ sort: { by: arrangement.sort.by, direction: arrangement.sort.direction === "asc" ? "desc" : "asc" } }), style: { ...control, minWidth: 32, cursor: "pointer" }, children: arrangement.sort.direction === "asc" ? "↑" : "↓" })) : null] })) : null, groups && offers.groups.length > 0 ? (_jsxs("label", { style: label, children: ["Group by", _jsxs("select", { "data-testid": `${id}-group`, value: arrangement.group?.by ?? "", onChange: (event) => set({ group: event.target.value ? { by: event.target.value } : undefined }), style: { ...choice, maxWidth: "min(100%, 60vw)" }, children: [_jsx("option", { value: "", children: "nothing" }), offers.groups.map((offer) => (_jsx("option", { value: offer.key, children: offer.label }, offer.key)))] }), arrangement.group && offers.groups.find((offer) => offer.key === arrangement.group.by)?.buckets ? (_jsxs("select", { "data-testid": `${id}-bucket`, "aria-label": "How wide a group is", value: arrangement.group.bucket ?? "day", onChange: (event) => set({ group: { by: arrangement.group.by, bucket: event.target.value } }), style: choice, children: [_jsx("option", { value: "day", children: "by day" }), _jsx("option", { value: "week", children: "by week" }), _jsx("option", { value: "month", children: "by month" }), _jsx("option", { value: "year", children: "by year" }), _jsx("option", { value: "decade", children: "by decade" })] })) : null] })) : null, filters && offers.filters.length > 0 ? (_jsx(AddCondition, { schema: schema, graph: graph, offers: offers, testId: id, onAdd: add })) : null, filters
172
+ ? conditions.map((condition, at) => (_jsxs("span", { style: chip, "data-testid": `${id}-condition`, children: [sayCondition(schema, graph, offers, condition), _jsx("button", { type: "button", "aria-label": `Remove: ${sayCondition(schema, graph, offers, condition)}`, onClick: () => without(at),
173
+ // A control big enough to hit: 24px is the floor the face is held to, and a bare "×" glyph is 16 by 13.
174
+ style: { font: "inherit", border: 0, background: "transparent", color: "inherit", cursor: "pointer", padding: 0, lineHeight: 1, minWidth: 24, minHeight: 24, display: "inline-flex", alignItems: "center", justifyContent: "center", borderRadius: 999 }, children: "\u00D7" })] }, `${condition.key}:${condition.value}`)))
175
+ : null, props.kept && props.kept.shown !== props.kept.of ? (_jsxs("span", { "data-testid": `${id}-kept`, style: { ...label, marginLeft: "auto" }, children: [props.kept.shown, " of ", props.kept.of] })) : null] }));
176
+ }
177
+ /**
178
+ * "Add a condition": one select naming the offer, then — for what needs a
179
+ * value — a second control for it. Two presses, and the chip appears.
180
+ */
181
+ function AddCondition({ schema, graph, offers, testId, onAdd, }) {
182
+ /*
183
+ * Every offer's values are known up front — a choice's options, `is`'s
184
+ * words, an edge's far ends, a boolean's yes and no — so the whole set is
185
+ * one grouped select and one press adds a chip. A date wants typing, so
186
+ * it is listed as three entries that ask for the date when chosen.
187
+ */
188
+ const entries = [];
189
+ for (const offer of offers.filters) {
190
+ if (offer.about === "is") {
191
+ for (const word of offer.options ?? [])
192
+ entries.push({ value: `is:${word}`, label: word, group: offer.label, condition: { key: "is", value: word } });
193
+ }
194
+ else if (offer.about === "edge") {
195
+ entries.push({ value: `${offer.key}:*`, label: "anything", group: offer.label, condition: { key: offer.key, value: "*" } });
196
+ entries.push({ value: `${offer.key}:none`, label: "nothing", group: offer.label, condition: { key: offer.key, value: "none" } });
197
+ for (const end of farEndsOf(schema, graph, offer))
198
+ entries.push({ value: `${offer.key}:${end.id}`, label: end.label, group: offer.label, condition: { key: offer.key, value: end.id } });
199
+ }
200
+ else if (offer.type === "date") {
201
+ for (const op of ["before", "after", "on"])
202
+ entries.push({ value: `${offer.key}:${op}`, label: `${op}…`, group: offer.label, ask: { key: offer.key, op, label: offer.label } });
203
+ }
204
+ else if (offer.type === "boolean") {
205
+ entries.push({ value: `${offer.key}:true`, label: "yes", group: offer.label, condition: { key: offer.key, value: "true" } });
206
+ entries.push({ value: `${offer.key}:false`, label: "no", group: offer.label, condition: { key: offer.key, value: "false" } });
207
+ }
208
+ else {
209
+ for (const option of offer.options ?? [])
210
+ entries.push({ value: `${offer.key}:${option}`, label: option, group: offer.label, condition: { key: offer.key, value: option } });
211
+ }
212
+ }
213
+ const groups = [...new Set(entries.map((entry) => entry.group))];
214
+ return (_jsxs("label", { style: label, children: ["Only", _jsxs("select", { "data-testid": `${testId}-add`, value: "", onChange: (event) => {
215
+ const entry = entries.find((candidate) => candidate.value === event.target.value);
216
+ if (!entry)
217
+ return;
218
+ if (entry.condition)
219
+ onAdd(entry.condition);
220
+ else if (entry.ask) {
221
+ const date = typeof window !== "undefined" ? window.prompt(`${entry.ask.label} ${entry.ask.op} which day? (YYYY-MM-DD)`) : null;
222
+ if (date && /^\d{4}-\d{2}-\d{2}$/.test(date))
223
+ onAdd({ key: entry.ask.key, value: `${entry.ask.op}:${date}` });
224
+ }
225
+ }, style: choice, children: [_jsx("option", { value: "", children: "only\u2026" }), groups.map((group) => (_jsx("optgroup", { label: group, children: entries
226
+ .filter((entry) => entry.group === group)
227
+ .map((entry) => (_jsx("option", { value: entry.value, children: entry.label }, entry.value))) }, group)))] })] }));
228
+ }
229
+ /*
230
+ * THE STOP CARRIES IT. A lens reads its arrangement out of `view.within`
231
+ * and writes the next one back with these; `in.sort`, `in.filter`,
232
+ * `in.group` and `in.q` are the fragment's spelling of the same words a
233
+ * page puts in its search.
234
+ */
235
+ export function arrangementOf(view) {
236
+ const within = view.within ?? {};
237
+ return parseArrangement({
238
+ ...(within["sort"] ? { sort: within["sort"] } : {}),
239
+ ...(within["filter"] ? { filter: within["filter"] } : {}),
240
+ ...(within["group"] ? { group: within["group"] } : {}),
241
+ ...(within["q"] ? { q: within["q"] } : {}),
242
+ });
243
+ }
244
+ export function withArrangement(view, arrangement) {
245
+ const words = formatArrangement(arrangement);
246
+ let next = view;
247
+ for (const key of ["sort", "filter", "group", "q"])
248
+ next = withWithin(next, key, words[key] ?? null);
249
+ return next;
250
+ }
251
+ /** A small caption for what an arrangement did, for a surface with no room for the row. */
252
+ export function arrangementCaption(arrangement) {
253
+ const parts = [];
254
+ if (arrangement.query)
255
+ parts.push(`“${arrangement.query}”`);
256
+ if (arrangement.filter?.length)
257
+ parts.push(`${arrangement.filter.length} condition${arrangement.filter.length === 1 ? "" : "s"}`);
258
+ if (arrangement.group)
259
+ parts.push(`by ${arrangement.group.by}`);
260
+ if (arrangement.sort)
261
+ parts.push(`sorted by ${arrangement.sort.by}`);
262
+ return parts.length > 0 ? parts.join(" · ") : null;
263
+ }
264
+ //# sourceMappingURL=arrange-bar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrange-bar.js","sourceRoot":"","sources":["../src/arrange-bar.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,OAAO,EACP,gBAAgB,GASjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAkB,MAAM,iBAAiB,CAAC;AAgC7D;;;;;;GAMG;AACH,MAAM,OAAO,GAAkB;IAC7B,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,EAAE;IACb,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,CAAC;IACf,MAAM,EAAE,+BAA+B;IACvC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C,IAAI,WAAW,CAAC,KAAK,GAAG,CAAC,CAAC;IAC5D,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,aAAa,WAAW,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAClI,IAAI,WAAW,CAAC,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,MAAM,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;IAChE,IAAI,WAAW,CAAC,IAAI;QAAE,KAAK,CAAC,IAAI,CAAC,aAAa,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IACrE,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACrD,CAAC"}
package/dist/chat.d.ts ADDED
@@ -0,0 +1,46 @@
1
+ import type { AnySchema } from "@graview/core";
2
+ import { type Responder, type ToolCall } from "@graview/tools";
3
+ /**
4
+ * A SEAT YOU CAN TALK TO.
5
+ *
6
+ * The agent seat runs a turn when pressed; the providers whisper into the
7
+ * inspector; nothing let a person ASK. This panel does — and it earns no
8
+ * new trust to do it: every answer comes from a Responder (the graph's own
9
+ * deterministic one by default, a model through the one-function seam when
10
+ * the host supplies it), and every proposal is an ordinary validated call,
11
+ * applied through the same runtime a seat uses, attributed to `chat` in
12
+ * the log, previewer-visible, undoable. Words in, the usual paths out.
13
+ *
14
+ * The conversation itself — turns, outcomes, the thread, the header and the
15
+ * field — is `seat.tsx`, shared with the studio's declaration seat; what is
16
+ * this panel's own is what a proposal does here: apply to the graph.
17
+ */
18
+ export interface ChatPanelProps<S extends AnySchema> {
19
+ /**
20
+ * Drawn INSIDE something that already frames it — the companion rail —
21
+ * rather than as a pill on the bar with a panel hanging off it: no
22
+ * trigger, no float, no border of its own, and always open, because the
23
+ * rail is what opens and closes.
24
+ */
25
+ readonly inside?: boolean;
26
+ /** How the seat answers. Defaults to the graph's own responder. */
27
+ readonly respond?: Responder<S>;
28
+ /**
29
+ * Where a pick goes — a thing the words found, pressed. The scene focuses
30
+ * and selects it; a face with no scene to move (the pages' drawer) goes
31
+ * to the record's page instead.
32
+ */
33
+ readonly onPick?: (id: string) => void;
34
+ /**
35
+ * GROUNDED QUESTIONS, OFFERED BEFORE ANYBODY TYPES. A panel showing an
36
+ * empty field asks the person to guess what it can answer; these are
37
+ * questions the graph's own responder can answer about what is in front
38
+ * of them, and pressing one asks it.
39
+ */
40
+ readonly offer?: readonly string[];
41
+ /** Feeds the app's activity rail, like any other seat. */
42
+ readonly onCall?: (call: ToolCall) => void;
43
+ readonly testId?: string;
44
+ }
45
+ export declare function ChatPanel<S extends AnySchema>({ inside, offer, respond, onCall, onPick, testId, }: ChatPanelProps<S>): import("react").JSX.Element;
46
+ //# sourceMappingURL=chat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../src/chat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAUL,KAAK,SAAS,EACd,KAAK,QAAQ,EACd,MAAM,gBAAgB,CAAC;AAOxB;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,SAAS;IACjD;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,SAAS,EAAE,EAC7C,MAAc,EACd,KAAK,EACL,OAAO,EACP,MAAM,EACN,MAAM,EACN,MAAe,GAChB,EAAE,cAAc,CAAC,CAAC,CAAC,+BAuhBnB"}