@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.
- package/LICENSE +96 -0
- package/README.md +25 -0
- package/dist/arrange-bar.d.ts +49 -0
- package/dist/arrange-bar.d.ts.map +1 -0
- package/dist/arrange-bar.js +264 -0
- package/dist/arrange-bar.js.map +1 -0
- package/dist/chat.d.ts +46 -0
- package/dist/chat.d.ts.map +1 -0
- package/dist/chat.js +343 -0
- package/dist/chat.js.map +1 -0
- package/dist/companion.d.ts +58 -0
- package/dist/companion.d.ts.map +1 -0
- package/dist/companion.js +433 -0
- package/dist/companion.js.map +1 -0
- package/dist/connections.d.ts +23 -0
- package/dist/connections.d.ts.map +1 -0
- package/dist/connections.js +100 -0
- package/dist/connections.js.map +1 -0
- package/dist/default-views.d.ts +35 -0
- package/dist/default-views.d.ts.map +1 -0
- package/dist/default-views.js +605 -0
- package/dist/default-views.js.map +1 -0
- package/dist/editable.d.ts +71 -0
- package/dist/editable.d.ts.map +1 -0
- package/dist/editable.js +225 -0
- package/dist/editable.js.map +1 -0
- package/dist/figure.d.ts +30 -0
- package/dist/figure.d.ts.map +1 -0
- package/dist/figure.js +66 -0
- package/dist/figure.js.map +1 -0
- package/dist/find.d.ts +5 -0
- package/dist/find.d.ts.map +1 -0
- package/dist/find.js +252 -0
- package/dist/find.js.map +1 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/installation.d.ts +17 -0
- package/dist/installation.d.ts.map +1 -0
- package/dist/installation.js +37 -0
- package/dist/installation.js.map +1 -0
- package/dist/ladder.d.ts +2 -0
- package/dist/ladder.d.ts.map +1 -0
- package/dist/ladder.js +53 -0
- package/dist/ladder.js.map +1 -0
- package/dist/lens/arranging.d.ts +41 -0
- package/dist/lens/arranging.d.ts.map +1 -0
- package/dist/lens/arranging.js +38 -0
- package/dist/lens/arranging.js.map +1 -0
- package/dist/lens/board.d.ts +146 -0
- package/dist/lens/board.d.ts.map +1 -0
- package/dist/lens/board.js +658 -0
- package/dist/lens/board.js.map +1 -0
- package/dist/lens/calendar-dates.d.ts +19 -0
- package/dist/lens/calendar-dates.d.ts.map +1 -0
- package/dist/lens/calendar-dates.js +55 -0
- package/dist/lens/calendar-dates.js.map +1 -0
- package/dist/lens/calendar-drawing.d.ts +59 -0
- package/dist/lens/calendar-drawing.d.ts.map +1 -0
- package/dist/lens/calendar-drawing.js +229 -0
- package/dist/lens/calendar-drawing.js.map +1 -0
- package/dist/lens/calendar-options.d.ts +107 -0
- package/dist/lens/calendar-options.d.ts.map +1 -0
- package/dist/lens/calendar-options.js +19 -0
- package/dist/lens/calendar-options.js.map +1 -0
- package/dist/lens/calendar-placing.d.ts +35 -0
- package/dist/lens/calendar-placing.d.ts.map +1 -0
- package/dist/lens/calendar-placing.js +113 -0
- package/dist/lens/calendar-placing.js.map +1 -0
- package/dist/lens/calendar-spans.d.ts +48 -0
- package/dist/lens/calendar-spans.d.ts.map +1 -0
- package/dist/lens/calendar-spans.js +146 -0
- package/dist/lens/calendar-spans.js.map +1 -0
- package/dist/lens/calendar-view.d.ts +34 -0
- package/dist/lens/calendar-view.d.ts.map +1 -0
- package/dist/lens/calendar-view.js +228 -0
- package/dist/lens/calendar-view.js.map +1 -0
- package/dist/lens/calendar.d.ts +43 -0
- package/dist/lens/calendar.d.ts.map +1 -0
- package/dist/lens/calendar.js +43 -0
- package/dist/lens/calendar.js.map +1 -0
- package/dist/lens/coverage.d.ts +183 -0
- package/dist/lens/coverage.d.ts.map +1 -0
- package/dist/lens/coverage.js +732 -0
- package/dist/lens/coverage.js.map +1 -0
- package/dist/lens/horizon.d.ts +14 -0
- package/dist/lens/horizon.d.ts.map +1 -0
- package/dist/lens/horizon.js +20 -0
- package/dist/lens/horizon.js.map +1 -0
- package/dist/lens/more.d.ts +16 -0
- package/dist/lens/more.d.ts.map +1 -0
- package/dist/lens/more.js +17 -0
- package/dist/lens/more.js.map +1 -0
- package/dist/lens/plan-lens.d.ts +17 -0
- package/dist/lens/plan-lens.d.ts.map +1 -0
- package/dist/lens/plan-lens.js +24 -0
- package/dist/lens/plan-lens.js.map +1 -0
- package/dist/lens/plan-state.d.ts +122 -0
- package/dist/lens/plan-state.d.ts.map +1 -0
- package/dist/lens/plan-state.js +152 -0
- package/dist/lens/plan-state.js.map +1 -0
- package/dist/lens/plan-view.d.ts +10 -0
- package/dist/lens/plan-view.d.ts.map +1 -0
- package/dist/lens/plan-view.js +576 -0
- package/dist/lens/plan-view.js.map +1 -0
- package/dist/lens/plan.d.ts +25 -0
- package/dist/lens/plan.d.ts.map +1 -0
- package/dist/lens/plan.js +25 -0
- package/dist/lens/plan.js.map +1 -0
- package/dist/lens/reach.d.ts +47 -0
- package/dist/lens/reach.d.ts.map +1 -0
- package/dist/lens/reach.js +67 -0
- package/dist/lens/reach.js.map +1 -0
- package/dist/lens/timeline.d.ts +137 -0
- package/dist/lens/timeline.d.ts.map +1 -0
- package/dist/lens/timeline.js +426 -0
- package/dist/lens/timeline.js.map +1 -0
- package/dist/markup.d.ts +23 -0
- package/dist/markup.d.ts.map +1 -0
- package/dist/markup.js +24 -0
- package/dist/markup.js.map +1 -0
- package/dist/places.d.ts +24 -0
- package/dist/places.d.ts.map +1 -0
- package/dist/places.js +227 -0
- package/dist/places.js.map +1 -0
- package/dist/popover.d.ts +28 -0
- package/dist/popover.d.ts.map +1 -0
- package/dist/popover.js +59 -0
- package/dist/popover.js.map +1 -0
- package/dist/primitives/index.d.ts +214 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +381 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/profile.d.ts +65 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +233 -0
- package/dist/profile.js.map +1 -0
- package/dist/quick-relations.d.ts +16 -0
- package/dist/quick-relations.d.ts.map +1 -0
- package/dist/quick-relations.js +183 -0
- package/dist/quick-relations.js.map +1 -0
- package/dist/relation-key.d.ts +44 -0
- package/dist/relation-key.d.ts.map +1 -0
- package/dist/relation-key.js +196 -0
- package/dist/relation-key.js.map +1 -0
- package/dist/seat.d.ts +137 -0
- package/dist/seat.d.ts.map +1 -0
- package/dist/seat.js +162 -0
- package/dist/seat.js.map +1 -0
- package/dist/seats.d.ts +21 -0
- package/dist/seats.d.ts.map +1 -0
- package/dist/seats.js +62 -0
- package/dist/seats.js.map +1 -0
- package/dist/seeding.d.ts +150 -0
- package/dist/seeding.d.ts.map +1 -0
- package/dist/seeding.js +538 -0
- package/dist/seeding.js.map +1 -0
- package/dist/shell.d.ts +74 -0
- package/dist/shell.d.ts.map +1 -0
- package/dist/shell.js +86 -0
- package/dist/shell.js.map +1 -0
- package/dist/theme.d.ts +50 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +1692 -0
- package/dist/theme.js.map +1 -0
- package/dist/wordmark.d.ts +15 -0
- package/dist/wordmark.d.ts.map +1 -0
- package/dist/wordmark.js +55 -0
- package/dist/wordmark.js.map +1 -0
- package/dist/workbench/activity.d.ts +75 -0
- package/dist/workbench/activity.d.ts.map +1 -0
- package/dist/workbench/activity.js +259 -0
- package/dist/workbench/activity.js.map +1 -0
- package/dist/workbench/agent-seat.d.ts +51 -0
- package/dist/workbench/agent-seat.d.ts.map +1 -0
- package/dist/workbench/agent-seat.js +112 -0
- package/dist/workbench/agent-seat.js.map +1 -0
- package/dist/workbench/answer-args.d.ts +31 -0
- package/dist/workbench/answer-args.d.ts.map +1 -0
- package/dist/workbench/answer-args.js +257 -0
- package/dist/workbench/answer-args.js.map +1 -0
- package/dist/workbench/back-out.d.ts +71 -0
- package/dist/workbench/back-out.d.ts.map +1 -0
- package/dist/workbench/back-out.js +238 -0
- package/dist/workbench/back-out.js.map +1 -0
- package/dist/workbench/following.d.ts +7 -0
- package/dist/workbench/following.d.ts.map +1 -0
- package/dist/workbench/following.js +26 -0
- package/dist/workbench/following.js.map +1 -0
- package/dist/workbench/index.d.ts +23 -0
- package/dist/workbench/index.d.ts.map +1 -0
- package/dist/workbench/index.js +23 -0
- package/dist/workbench/index.js.map +1 -0
- package/dist/workbench/inspector.d.ts +27 -0
- package/dist/workbench/inspector.d.ts.map +1 -0
- package/dist/workbench/inspector.js +745 -0
- package/dist/workbench/inspector.js.map +1 -0
- package/dist/workbench/standing.d.ts +16 -0
- package/dist/workbench/standing.d.ts.map +1 -0
- package/dist/workbench/standing.js +102 -0
- package/dist/workbench/standing.js.map +1 -0
- package/dist/workbench/trail.d.ts +35 -0
- package/dist/workbench/trail.d.ts.map +1 -0
- package/dist/workbench/trail.js +150 -0
- package/dist/workbench/trail.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { withMore } from "./more.js";
|
|
3
|
+
import { fieldWords, isCurrent } from "@graview/core";
|
|
4
|
+
import { withWithin } from "@graview/layout";
|
|
5
|
+
import { useGraview, useNavigation } from "@graview/react";
|
|
6
|
+
import { useArranging } from "./arranging.js";
|
|
7
|
+
import { useRef, useState } from "react";
|
|
8
|
+
import { hueFor } from "../default-views.js";
|
|
9
|
+
import { Chip, Panel, Roster, useWidth } from "../primitives/index.js";
|
|
10
|
+
import { addDays, addMonths, daysBetween, minutesOf } from "./calendar-dates.js";
|
|
11
|
+
import { Agenda, Grid, PER_CELL, Step, longDay, stepStyle } from "./calendar-drawing.js";
|
|
12
|
+
import { CALENDAR_REQUIRED_ROLES, rangesOf, titleOf, } from "./calendar-options.js";
|
|
13
|
+
import { actThatMoves } from "./calendar-placing.js";
|
|
14
|
+
import { entriesOn, placeOnCalendar } from "./calendar-placing.js";
|
|
15
|
+
import { finerThan, spanOf } from "./calendar-spans.js";
|
|
16
|
+
export function createCalendarLens(options) {
|
|
17
|
+
const bound = (opening) => function Bound(props) {
|
|
18
|
+
const { store } = useGraview();
|
|
19
|
+
const { view } = useNavigation();
|
|
20
|
+
const here = opening ? { ...options, range: opening } : options;
|
|
21
|
+
const range = view.within?.["range"] ?? here.range ?? "month";
|
|
22
|
+
/*
|
|
23
|
+
* FILTERED EVERYWHERE, GROUPED WHERE THERE IS A PLACE. A month grid has
|
|
24
|
+
* no room for group headings; the agenda is a list and does. Sorting
|
|
25
|
+
* is the dates' business and is never offered.
|
|
26
|
+
*/
|
|
27
|
+
const kinds = Object.keys(options.bindings);
|
|
28
|
+
const { nodes, arranged, arrangement, bar } = useArranging(props, {
|
|
29
|
+
...(options.arranging !== undefined ? { allow: options.arranging } : {}),
|
|
30
|
+
lensAllows: { sort: false, group: range === "agenda" },
|
|
31
|
+
...(options.arrangedBy ? { arrangedBy: options.arrangedBy } : {}),
|
|
32
|
+
...(kinds[0] ? { kind: (props.nodes ?? []).find((node) => kinds.includes(String(node.kind)))?.kind ?? kinds[0] } : {}),
|
|
33
|
+
});
|
|
34
|
+
const groups = range === "agenda" && arranged.grouped && arrangement.group ? arranged.groups.map((group) => ({ label: group.label, ids: new Set(group.nodes.map((node) => node.id)) })) : undefined;
|
|
35
|
+
/*
|
|
36
|
+
* EVERY KIND IT IS BOUND TO, NOT ONLY THE GROUP IT HANGS OFF. A diary
|
|
37
|
+
* bound to test drives and service appointments, registered over the
|
|
38
|
+
* test drives, drew the test drives: `nodes` is the group's members,
|
|
39
|
+
* and the other bound kind was never read. The rest come from the
|
|
40
|
+
* graph, on the same horizon the group keeps (the past only when the
|
|
41
|
+
* stop asks for it), and after the group's own arranging.
|
|
42
|
+
*/
|
|
43
|
+
const own = new Set((props.nodes ?? []).map((node) => String(node.kind)));
|
|
44
|
+
const others = kinds
|
|
45
|
+
.filter((kind) => !own.has(kind) && store.schema.tryDefinition(kind) !== undefined)
|
|
46
|
+
.flatMap((kind) => {
|
|
47
|
+
const definition = store.schema.tryDefinition(kind);
|
|
48
|
+
return store.graph.nodesOfKind(kind).filter((node) => view.past === true || isCurrent(definition, node));
|
|
49
|
+
});
|
|
50
|
+
const drawn = others.length === 0 ? nodes : [...nodes, ...(props.budget !== undefined ? others.slice(0, props.budget) : others)];
|
|
51
|
+
return withMore(props, store.schema, _jsx(CalendarView, { schema: store.schema, ...props, nodes: drawn, options: here, ...(bar ? { bar } : {}), ...(groups ? { groups } : {}) }));
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
name: "calendar",
|
|
55
|
+
requiredRoles: [...CALENDAR_REQUIRED_ROLES],
|
|
56
|
+
bindings: options.bindings,
|
|
57
|
+
options,
|
|
58
|
+
View: bound(),
|
|
59
|
+
at: (range) => bound(range),
|
|
60
|
+
ranges: () => rangesOf(options).map((range) => ({ range, title: titleOf(range, options.horizon) })),
|
|
61
|
+
place: (nodes, schema) => nodes
|
|
62
|
+
.map((node) => placeOnCalendar(node, options.bindings, schema))
|
|
63
|
+
.filter((entry) => entry !== null),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function CalendarView({ nodes, label, fidelity, mode, options, schema, selectedIds = [], implicated = [], flagged = [], bar, groups, }) {
|
|
67
|
+
/*
|
|
68
|
+
* WHERE THE CALENDAR IS, IN THE STOP.
|
|
69
|
+
*
|
|
70
|
+
* The month you are looking at is a place: a URL somebody can be sent,
|
|
71
|
+
* a history entry Back returns to, a thing a harness can photograph
|
|
72
|
+
* twice. Component state would have made it the one part of this
|
|
73
|
+
* interface you could not link to.
|
|
74
|
+
*/
|
|
75
|
+
const { view, go } = useNavigation();
|
|
76
|
+
const { store, principal } = useGraview();
|
|
77
|
+
const at = view.within?.["at"] ?? options.today;
|
|
78
|
+
const range = view.within?.["range"] ?? options.range ?? "month";
|
|
79
|
+
const weekStartsOn = options.weekStartsOn ?? 1;
|
|
80
|
+
const highlit = new Set([...implicated, ...selectedIds]);
|
|
81
|
+
const emphasisOf = (id) => highlit.size === 0 ? "plain" : highlit.has(id) ? "lit" : "dimmed";
|
|
82
|
+
const broken = new Set(flagged);
|
|
83
|
+
const entries = (nodes ?? [])
|
|
84
|
+
.map((node) => placeOnCalendar(node, options.bindings, schema))
|
|
85
|
+
.filter((entry) => entry !== null);
|
|
86
|
+
const hue = options.hueOf ?? ((entry) => hueFor(entry.kind));
|
|
87
|
+
if (fidelity === "glyph") {
|
|
88
|
+
return _jsx(Chip, { label: `${label ?? "Calendar"} · ${entries.length}`, hue: hueFor("calendar") });
|
|
89
|
+
}
|
|
90
|
+
if (fidelity === "summary") {
|
|
91
|
+
const soon = entriesOn(entries, options.today);
|
|
92
|
+
return (_jsx(Panel, { title: label ?? "Calendar", meta: `${entries.length} dated`, tone: "muted", children: _jsx(Roster, { max: 6, items: soon.length > 0
|
|
93
|
+
? soon.map((entry) => ({ id: entry.id, label: entry.label, hue: hue(entry) }))
|
|
94
|
+
: entries
|
|
95
|
+
.filter((entry) => daysBetween(options.today, entry.from) >= 0)
|
|
96
|
+
.sort((a, b) => a.from.localeCompare(b.from))
|
|
97
|
+
.slice(0, 6)
|
|
98
|
+
.map((entry) => ({ id: entry.id, label: `${entry.from.slice(5)} ${entry.label}`, hue: hue(entry) })) }) }));
|
|
99
|
+
}
|
|
100
|
+
const page = mode === "fullscreen";
|
|
101
|
+
const span = spanOf(range, at, { weekStartsOn, ...(options.horizon ? { horizon: options.horizon } : {}) });
|
|
102
|
+
/*
|
|
103
|
+
* DRAGGING AN ENTRY TO A DAY IS AN ACT, not a special case.
|
|
104
|
+
*
|
|
105
|
+
* The declaration is asked which act writes the bound date; the store
|
|
106
|
+
* judges whether this seat may run it; the log records it with an author
|
|
107
|
+
* and an inverse, so one undo puts it back. A seat that may not is told
|
|
108
|
+
* so in the policy's own words rather than finding the entry silently
|
|
109
|
+
* snapping back — a drag that appears to work and does not is worse than
|
|
110
|
+
* one that refuses.
|
|
111
|
+
*/
|
|
112
|
+
const [said, setSaid] = useState(null);
|
|
113
|
+
const moveTo = (id, cell, grain) => {
|
|
114
|
+
const node = store.graph.getNode(id);
|
|
115
|
+
if (!node)
|
|
116
|
+
return;
|
|
117
|
+
const roles = options.bindings[node.kind];
|
|
118
|
+
if (!roles)
|
|
119
|
+
return;
|
|
120
|
+
const act = actThatMoves(store, node.kind, roles.start);
|
|
121
|
+
if (!act) {
|
|
122
|
+
setSaid({ text: `Nothing declared writes the ${fieldWords(store.schema.definitions.find((d) => d.kind === node.kind), roles.start).toLowerCase()}, so this cannot be moved from here.`, tone: "refused" });
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const day = cell.from;
|
|
126
|
+
// A date-time keeps its time: moving "Tuesday at 09:30" to Thursday
|
|
127
|
+
// means Thursday at 09:30, not Thursday at midnight.
|
|
128
|
+
const was = node[roles.start];
|
|
129
|
+
const minutes = minutesOf(was);
|
|
130
|
+
const value = minutes === null ? day : `${day}${String(was).slice(10)}`;
|
|
131
|
+
const call = { name: act.name, args: { [act.arg]: id, [roles.start]: value } };
|
|
132
|
+
const verdict = store.permits(call, principal);
|
|
133
|
+
if (!verdict.ok) {
|
|
134
|
+
setSaid({ text: verdict.refusal.message, tone: "refused" });
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
store.apply(call, { author: principal });
|
|
139
|
+
/*
|
|
140
|
+
* A COARSE CELL ROUNDS, AND SAYS SO.
|
|
141
|
+
*
|
|
142
|
+
* The act writes a DAY; a month cell is thirty of them. Dropping a
|
|
143
|
+
* planting on "March" and silently writing the first was the lens
|
|
144
|
+
* making a decision on the person's behalf and hiding it — so the
|
|
145
|
+
* drop lands, the trail carries it, undo takes it back, and the lens
|
|
146
|
+
* says exactly which date it wrote.
|
|
147
|
+
*/
|
|
148
|
+
setSaid(grain === "day"
|
|
149
|
+
? null
|
|
150
|
+
: {
|
|
151
|
+
text: `Moved to ${longDay(day)} — a ${grain} is coarser than the ${fieldWords(store.schema.definitions.find((d) => d.kind === node.kind), roles.start).toLowerCase()} holds, so it takes the first day of the cell. Undo puts it back.`,
|
|
152
|
+
tone: "rounded",
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
setSaid({ text: error instanceof Error ? error.message : String(error), tone: "refused" });
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
const move = (step) => {
|
|
160
|
+
const next = range === "years"
|
|
161
|
+
? addMonths(at, step * 12 * Math.max(1, options.horizon?.years ?? 1))
|
|
162
|
+
: range === "year"
|
|
163
|
+
? addMonths(at, step * 12)
|
|
164
|
+
: range === "quarter"
|
|
165
|
+
? addMonths(at, step * 3)
|
|
166
|
+
: range === "month"
|
|
167
|
+
? addMonths(at, step)
|
|
168
|
+
: range === "week"
|
|
169
|
+
? addDays(at, step * 7)
|
|
170
|
+
: addDays(at, step);
|
|
171
|
+
go(withWithin(view, "at", next));
|
|
172
|
+
};
|
|
173
|
+
const show = (nextRange, day) => {
|
|
174
|
+
let next = withWithin(view, "range", nextRange);
|
|
175
|
+
if (day !== undefined)
|
|
176
|
+
next = withWithin(next, "at", day);
|
|
177
|
+
go(next);
|
|
178
|
+
};
|
|
179
|
+
/*
|
|
180
|
+
* THE RANGES AS ONE CONTROL WHEN THERE IS NO ROW FOR THEM. Six chips —
|
|
181
|
+
* Day, Week, Month, Quarter, Year, the horizon — wrapped to three rows in
|
|
182
|
+
* a 300px card and left the calendar itself a strip under them. A select
|
|
183
|
+
* says the same six things in one row; the buttons stay wherever a row
|
|
184
|
+
* holds them, since a row of pressable words is quicker to read.
|
|
185
|
+
*/
|
|
186
|
+
const box = useRef(null);
|
|
187
|
+
const width = useWidth(box);
|
|
188
|
+
const rangesAsSelect = width !== null && width < 420;
|
|
189
|
+
const rangeName = (candidate) => candidate === "years" ? (options.horizon?.title ?? "years") : candidate.charAt(0).toUpperCase() + candidate.slice(1);
|
|
190
|
+
return (_jsx(Panel, { title: label ?? "Calendar", meta: span.title, style: { gap: 10, ...(page ? { flex: "1 1 auto", minHeight: 0, height: "100%" } : {}) }, children: _jsxs("div", { ref: box, "data-testid": "calendar", "data-calendar-range": range, "data-calendar-at": at, style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0, gap: 8 }, children: [_jsxs("div", { style: { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 6 }, children: [_jsxs("nav", { "aria-label": "When", style: { display: "flex", gap: 4 }, children: [_jsx(Step, { label: "Previous", glyph: "\u2039", onPress: () => move(-1) }), _jsx("button", { type: "button", "data-testid": "calendar-today", onClick: () => go(withWithin(view, "at", options.today)), style: stepStyle, children: "Today" }), _jsx(Step, { label: "Next", glyph: "\u203A", onPress: () => move(1) })] }), rangesAsSelect ? (_jsx("select", { "aria-label": "Range", "data-testid": "calendar-ranges", value: range, onChange: (event) => show(event.target.value),
|
|
191
|
+
/*
|
|
192
|
+
* THE NATIVE LOOK OFF, so the floor holds in WebKit: it draws a
|
|
193
|
+
* select at its own height and ignored the 24 asked of it — the
|
|
194
|
+
* range picker was 21 pixels tall on a phone in Safari (the
|
|
195
|
+
* W-121 lesson, one select over). The chevron is drawn instead.
|
|
196
|
+
*/
|
|
197
|
+
style: {
|
|
198
|
+
...stepStyle,
|
|
199
|
+
background: undefined,
|
|
200
|
+
backgroundColor: "transparent",
|
|
201
|
+
marginLeft: "auto",
|
|
202
|
+
maxWidth: "50%",
|
|
203
|
+
paddingRight: 24,
|
|
204
|
+
appearance: "none",
|
|
205
|
+
WebkitAppearance: "none",
|
|
206
|
+
backgroundImage: "linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%)",
|
|
207
|
+
backgroundPosition: "calc(100% - 13px) 55%, calc(100% - 9px) 55%",
|
|
208
|
+
backgroundSize: "4px 4px, 4px 4px",
|
|
209
|
+
backgroundRepeat: "no-repeat",
|
|
210
|
+
}, children: rangesOf(options).map((candidate) => (_jsx("option", { value: candidate, children: rangeName(candidate) }, candidate))) })) : (_jsx("div", { role: "group", "aria-label": "Range", "data-testid": "calendar-ranges", style: { display: "flex", flexWrap: "wrap", gap: 4, marginLeft: "auto" }, children: rangesOf(options).map((candidate) => (_jsx("button", { type: "button", "aria-pressed": candidate === range, "data-testid": `calendar-range-${candidate}`, onClick: () => show(candidate), style: {
|
|
211
|
+
...stepStyle,
|
|
212
|
+
// The range names are the framework's own words and read as
|
|
213
|
+
// buttons capitalised; the horizon's name is the APP's, and
|
|
214
|
+
// "The rotation" is not "The Rotation".
|
|
215
|
+
...(candidate === "years" ? {} : { textTransform: "capitalize" }),
|
|
216
|
+
...(candidate === range
|
|
217
|
+
? { borderColor: "var(--graview-accent)", color: "var(--graview-accent)", background: "var(--graview-panel)" }
|
|
218
|
+
: {}),
|
|
219
|
+
}, children: candidate === "years" ? (options.horizon?.title ?? "years") : candidate }, candidate))) }))] }), said ? (_jsx("p", { "data-testid": said.tone === "refused" ? "calendar-refused" : "calendar-rounded", role: "status", style: {
|
|
220
|
+
margin: 0,
|
|
221
|
+
fontSize: "0.8125rem",
|
|
222
|
+
color: said.tone === "refused" ? "var(--graview-warn)" : "var(--graview-ink-muted)",
|
|
223
|
+
}, children: said.text })) : null, span.years ? (_jsx("nav", { "aria-label": "Years", "data-testid": "calendar-years", style: { display: "flex", flexWrap: "wrap", gap: 4 }, children: span.years.map((year) => (_jsx("button", { type: "button", "data-testid": `calendar-year-${year}`, onClick: () => show("year", `${year}-01-01`), style: stepStyle, children: year }, year))) })) : null, bar, range === "agenda" && groups ? (_jsx("div", { "data-testid": "calendar-groups", style: { display: "grid", gap: 10, minHeight: 0, overflow: "auto" }, children: groups.map((group) => (_jsxs("section", { "data-testid": "calendar-group", style: { display: "grid", gap: 4 }, children: [_jsxs("h3", { style: { margin: 0, fontSize: "0.8125rem", letterSpacing: "0.08em", textTransform: "uppercase", color: "var(--graview-ink-muted)" }, children: [group.label, " ", _jsx("span", { style: { fontWeight: 400 }, children: group.ids.size })] }), _jsx(Agenda, { days: span.cells.map((cell) => cell.from), entries: entries.filter((entry) => group.ids.has(entry.id)), today: options.today, emphasisOf: emphasisOf, broken: broken, hue: hue, onMove: (id, day) => moveTo(id, { from: day, to: day, label: day }, "day") })] }, group.label))) })) : range === "agenda" ? (_jsx(Agenda, { days: span.cells.map((cell) => cell.from), entries: entries, today: options.today, emphasisOf: emphasisOf, broken: broken, hue: hue, onMove: (id, day) => moveTo(id, { from: day, to: day, label: day }, "day") })) : (_jsx(Grid, { span: span, weekStartsOn: weekStartsOn, entries: entries, today: options.today, perCell: options.perCell ?? PER_CELL[span.grain], emphasisOf: emphasisOf, broken: broken, hue: hue,
|
|
224
|
+
/* A press on a cell is a stop one level finer: a month opens a
|
|
225
|
+
month, a week opens a week, a day opens the day. */
|
|
226
|
+
onOpen: (cell) => show(finerThan(span.grain), cell.from), onMove: moveTo }))] }) }));
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=calendar-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-view.js","sourceRoot":"","sources":["../../src/lens/calendar-view.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAqC,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAkB,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAqC,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACzF,OAAO,EACL,uBAAuB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|
|
4
|
+
* The timeline binds a start and an end in minutes of a day and a named
|
|
5
|
+
* column, which is a week grid and nothing more: it cannot show a due date
|
|
6
|
+
* next month, a shift on the 14th, a planting sown in March and harvested
|
|
7
|
+
* in July, or what is on today across every list. Scheduled things need a
|
|
8
|
+
* calendar, and a calendar needs actual dates.
|
|
9
|
+
*
|
|
10
|
+
* Bound by ROLES, like every other starter. This lens has never heard of a
|
|
11
|
+
* task, a shift or a planting; an app says which of its own fields is the
|
|
12
|
+
* start, which the end, which says a thing takes the whole day and which
|
|
13
|
+
* names it — and gets every range, spans drawn across the cells they cover,
|
|
14
|
+
* overflow that opens the cell rather than hiding it, and every entry a real
|
|
15
|
+
* node the scene can select and a rule can flag.
|
|
16
|
+
*
|
|
17
|
+
* THE CELL COARSENS WITH THE HORIZON. It topped out at a month, so anything
|
|
18
|
+
* further out than four weeks was off the end of every picture the framework
|
|
19
|
+
* could draw: a planting sown in March and lifted in July, a plot on a
|
|
20
|
+
* rotation, a quarter's coverage, a lease, a review cycle. An app whose
|
|
21
|
+
* subject is years had no lens at all — it had a month grid it could page
|
|
22
|
+
* through twelve times. So a quarter draws a week per cell, a year and
|
|
23
|
+
* anything beyond it a month per cell, and an entry that spans cells is
|
|
24
|
+
* drawn across them exactly as a fortnight is already drawn across days.
|
|
25
|
+
*
|
|
26
|
+
* HOW FAR OUT IS THE APP'S TO SAY. Some domains think in three years and
|
|
27
|
+
* some in ten; a framework shipping a "5yr" button has guessed. The horizon
|
|
28
|
+
* is declared with its own span and its own name, or there is no horizon.
|
|
29
|
+
*
|
|
30
|
+
* Dates are ISO strings, because that is what an app's declaration holds and
|
|
31
|
+
* what `isoDate` already validates. A date-time ("2026-09-14T09:30") places
|
|
32
|
+
* the entry at a time within its day; a bare date is an all-day entry. The
|
|
33
|
+
* lens does no timezone arithmetic and no recurrence: both belong to the app
|
|
34
|
+
* that owns the domain, and a framework that guessed at either would be
|
|
35
|
+
* wrong in a different way for every app.
|
|
36
|
+
*/
|
|
37
|
+
export * from "./calendar-options.js";
|
|
38
|
+
export * from "./calendar-dates.js";
|
|
39
|
+
export * from "./calendar-placing.js";
|
|
40
|
+
export * from "./calendar-view.js";
|
|
41
|
+
export * from "./calendar-spans.js";
|
|
42
|
+
export * from "./calendar-drawing.js";
|
|
43
|
+
//# sourceMappingURL=calendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../src/lens/calendar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE CALENDAR LENS: day, week, month, quarter, year and a named horizon.
|
|
3
|
+
*
|
|
4
|
+
* The timeline binds a start and an end in minutes of a day and a named
|
|
5
|
+
* column, which is a week grid and nothing more: it cannot show a due date
|
|
6
|
+
* next month, a shift on the 14th, a planting sown in March and harvested
|
|
7
|
+
* in July, or what is on today across every list. Scheduled things need a
|
|
8
|
+
* calendar, and a calendar needs actual dates.
|
|
9
|
+
*
|
|
10
|
+
* Bound by ROLES, like every other starter. This lens has never heard of a
|
|
11
|
+
* task, a shift or a planting; an app says which of its own fields is the
|
|
12
|
+
* start, which the end, which says a thing takes the whole day and which
|
|
13
|
+
* names it — and gets every range, spans drawn across the cells they cover,
|
|
14
|
+
* overflow that opens the cell rather than hiding it, and every entry a real
|
|
15
|
+
* node the scene can select and a rule can flag.
|
|
16
|
+
*
|
|
17
|
+
* THE CELL COARSENS WITH THE HORIZON. It topped out at a month, so anything
|
|
18
|
+
* further out than four weeks was off the end of every picture the framework
|
|
19
|
+
* could draw: a planting sown in March and lifted in July, a plot on a
|
|
20
|
+
* rotation, a quarter's coverage, a lease, a review cycle. An app whose
|
|
21
|
+
* subject is years had no lens at all — it had a month grid it could page
|
|
22
|
+
* through twelve times. So a quarter draws a week per cell, a year and
|
|
23
|
+
* anything beyond it a month per cell, and an entry that spans cells is
|
|
24
|
+
* drawn across them exactly as a fortnight is already drawn across days.
|
|
25
|
+
*
|
|
26
|
+
* HOW FAR OUT IS THE APP'S TO SAY. Some domains think in three years and
|
|
27
|
+
* some in ten; a framework shipping a "5yr" button has guessed. The horizon
|
|
28
|
+
* is declared with its own span and its own name, or there is no horizon.
|
|
29
|
+
*
|
|
30
|
+
* Dates are ISO strings, because that is what an app's declaration holds and
|
|
31
|
+
* what `isoDate` already validates. A date-time ("2026-09-14T09:30") places
|
|
32
|
+
* the entry at a time within its day; a bare date is an all-day entry. The
|
|
33
|
+
* lens does no timezone arithmetic and no recurrence: both belong to the app
|
|
34
|
+
* that owns the domain, and a framework that guessed at either would be
|
|
35
|
+
* wrong in a different way for every app.
|
|
36
|
+
*/
|
|
37
|
+
export * from "./calendar-options.js";
|
|
38
|
+
export * from "./calendar-dates.js";
|
|
39
|
+
export * from "./calendar-placing.js";
|
|
40
|
+
export * from "./calendar-view.js";
|
|
41
|
+
export * from "./calendar-spans.js";
|
|
42
|
+
export * from "./calendar-drawing.js";
|
|
43
|
+
//# sourceMappingURL=calendar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/lens/calendar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { type AnySchema, type NodeOfSchema } from "@graview/core";
|
|
2
|
+
import { type ViewProps } from "@graview/react";
|
|
3
|
+
import { type ReactElement } from "react";
|
|
4
|
+
/**
|
|
5
|
+
* The coverage lens: does everything on one side have something on the other?
|
|
6
|
+
*
|
|
7
|
+
* The timeline answers "when". This answers "did we miss anything", which is
|
|
8
|
+
* a different question with a different natural picture — a bipartite mapping
|
|
9
|
+
* rather than an interval. Requirements against deliverables, tests against
|
|
10
|
+
* behaviours, controls against risks, skills against drills: the shape recurs
|
|
11
|
+
* everywhere two sets of things are supposed to correspond, and the failure
|
|
12
|
+
* is always the same two pictures.
|
|
13
|
+
*
|
|
14
|
+
* **An empty row** is something that was asked for and answered by nothing.
|
|
15
|
+
* **An empty column** is something you are doing that nobody asked for.
|
|
16
|
+
*
|
|
17
|
+
* Both are absences of a RELATIONSHIP, which is exactly what prose review is
|
|
18
|
+
* worst at and a graph is best at: reading a document top to bottom will not
|
|
19
|
+
* reveal the paragraph that was never written. Reading down a column of
|
|
20
|
+
* empty cells takes a second.
|
|
21
|
+
*
|
|
22
|
+
* Built from the same public primitives an app has, like the timeline, so it
|
|
23
|
+
* stays a worked example of the authoring API rather than a privileged
|
|
24
|
+
* insider.
|
|
25
|
+
*/
|
|
26
|
+
export declare const COVERAGE_REQUIRED_ROLES: readonly ["rows", "columns", "link"];
|
|
27
|
+
export interface CoverageRoles {
|
|
28
|
+
/** Kind whose nodes are rows: the things that must be covered. */
|
|
29
|
+
readonly rows: string;
|
|
30
|
+
/** Kind whose nodes are columns: the things that do the covering. */
|
|
31
|
+
readonly columns: string;
|
|
32
|
+
/**
|
|
33
|
+
* How a column node reaches a row node.
|
|
34
|
+
*
|
|
35
|
+
* An edge kind, for a relationship that IS a bare edge. Or a `path` of
|
|
36
|
+
* edge kinds — column end to row end — for one that runs through a node
|
|
37
|
+
* with fields of its own: a concern is addressed by a practice, applied by
|
|
38
|
+
* a routine, which covers a ground. That node is not incidental; it is
|
|
39
|
+
* where the cadence and the season live, so the cells carry it back.
|
|
40
|
+
*/
|
|
41
|
+
readonly link: string | {
|
|
42
|
+
readonly path: readonly string[];
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface CoverageOptions extends CoverageRoles {
|
|
46
|
+
/** Field on a row node carrying a short reference, shown before the label. */
|
|
47
|
+
readonly rowRef?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Field on a row node that sorts and groups it — a priority, a category.
|
|
50
|
+
* Values are grouped in the order given by `groupOrder`.
|
|
51
|
+
*/
|
|
52
|
+
readonly rowGroup?: string;
|
|
53
|
+
readonly groupOrder?: readonly string[];
|
|
54
|
+
/**
|
|
55
|
+
* Rows in this group must be covered; rows outside it are optional and an
|
|
56
|
+
* empty row is not a failure. Without it the picture cannot distinguish
|
|
57
|
+
* "we missed a mandatory thing" from "we declined an optional one".
|
|
58
|
+
*/
|
|
59
|
+
readonly requiredGroups?: readonly string[];
|
|
60
|
+
/**
|
|
61
|
+
* A row is required when something points at it along this edge.
|
|
62
|
+
*
|
|
63
|
+
* Grouping by a field only works when "must be covered" is a property the
|
|
64
|
+
* row carries. Often it is a property of the GRAPH: a skill matters
|
|
65
|
+
* because some position in the formation requires it, not because someone
|
|
66
|
+
* labelled it important. A third app needed exactly that, and adding it
|
|
67
|
+
* left the other two untouched because they never set it.
|
|
68
|
+
*/
|
|
69
|
+
readonly requiredVia?: {
|
|
70
|
+
readonly edge: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* A second relation, shown as a per-row badge rather than a second grid.
|
|
74
|
+
*
|
|
75
|
+
* Two coverage relations rarely share a column set — a requirement is
|
|
76
|
+
* satisfied by deliverables and narrated by sections — so overlaying them
|
|
77
|
+
* on one matrix is not possible. A gutter mark is, and it is enough: the
|
|
78
|
+
* row that has cells but no mark is work you do and never mention.
|
|
79
|
+
*/
|
|
80
|
+
readonly badge?: {
|
|
81
|
+
readonly edge: string;
|
|
82
|
+
readonly symbol: string;
|
|
83
|
+
readonly title: string;
|
|
84
|
+
readonly missingTitle: string;
|
|
85
|
+
};
|
|
86
|
+
/** Column ordering field. Falls back to the node id, which is stable. */
|
|
87
|
+
readonly columnGroup?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface CoverageCell {
|
|
90
|
+
readonly rowId: string;
|
|
91
|
+
readonly columnId: string;
|
|
92
|
+
/**
|
|
93
|
+
* The nodes the walk passed through, column end first — empty for a bare
|
|
94
|
+
* edge. "Mosquitoes are covered in the Back Lawn" is only useful if
|
|
95
|
+
* pressing it shows WHICH routine does it and when it next runs.
|
|
96
|
+
*/
|
|
97
|
+
readonly via?: readonly string[];
|
|
98
|
+
}
|
|
99
|
+
export interface CoverageGrid {
|
|
100
|
+
readonly rows: readonly {
|
|
101
|
+
readonly id: string;
|
|
102
|
+
readonly ref: string;
|
|
103
|
+
readonly label: string;
|
|
104
|
+
readonly group: string;
|
|
105
|
+
readonly required: boolean;
|
|
106
|
+
readonly covered: boolean;
|
|
107
|
+
readonly badged: boolean;
|
|
108
|
+
}[];
|
|
109
|
+
readonly columns: readonly {
|
|
110
|
+
readonly id: string;
|
|
111
|
+
readonly label: string;
|
|
112
|
+
readonly used: boolean;
|
|
113
|
+
}[];
|
|
114
|
+
readonly cells: readonly CoverageCell[];
|
|
115
|
+
/** Required rows with nothing against them. The reason the lens exists. */
|
|
116
|
+
readonly gaps: readonly string[];
|
|
117
|
+
/** Columns nobody asked for. The other reason. */
|
|
118
|
+
readonly unasked: readonly string[];
|
|
119
|
+
}
|
|
120
|
+
export declare class CoverageBindingError extends Error {
|
|
121
|
+
readonly hint: string;
|
|
122
|
+
constructor(message: string, hint: string);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Reads the grid out of the graph, in the app's own field names.
|
|
126
|
+
*
|
|
127
|
+
* Pure and exported, so an app can assert on the same numbers the picture is
|
|
128
|
+
* drawn from rather than on the rendering of them.
|
|
129
|
+
*/
|
|
130
|
+
/**
|
|
131
|
+
* A MATRIX THE ROOM CAN HOLD, and the DOM can.
|
|
132
|
+
*
|
|
133
|
+
* Every row times every column is a cell, and a real graph is not a
|
|
134
|
+
* fixture: a discography's "who worked with whom" is 568 artists by 568,
|
|
135
|
+
* a third of a million cells, and the page never came back from drawing
|
|
136
|
+
* them. Past the limit the picture keeps the rows and columns with the
|
|
137
|
+
* most ties — in their own order — and says how many it left out. What is
|
|
138
|
+
* missing (`gaps`, `unasked`) is still counted over all of it.
|
|
139
|
+
*
|
|
140
|
+
* Forty by twenty-four: at eighty by forty-eight, "who worked with whom"
|
|
141
|
+
* drew 3,840 cells — twelve thousand elements and a quarter-second task —
|
|
142
|
+
* and every row repeated the same forty-eight names past the point anyone
|
|
143
|
+
* reads them. The search and the row's "only…" reach the rest.
|
|
144
|
+
*/
|
|
145
|
+
export declare const COVERAGE_MAX_ROWS = 40;
|
|
146
|
+
export declare const COVERAGE_MAX_COLUMNS = 24;
|
|
147
|
+
export interface CappedCoverage extends CoverageGrid {
|
|
148
|
+
/** How many rows and columns there are in all, when fewer are drawn. */
|
|
149
|
+
readonly of?: {
|
|
150
|
+
readonly rows: number;
|
|
151
|
+
readonly columns: number;
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
export declare function capCoverage(grid: CoverageGrid, limits?: {
|
|
155
|
+
readonly rows?: number;
|
|
156
|
+
readonly columns?: number;
|
|
157
|
+
}): CappedCoverage;
|
|
158
|
+
export declare function buildCoverage<S extends AnySchema>(nodes: readonly NodeOfSchema<S>[], edges: readonly {
|
|
159
|
+
kind: string;
|
|
160
|
+
from: string;
|
|
161
|
+
to: string;
|
|
162
|
+
}[], options: CoverageOptions, schema?: S): CoverageGrid;
|
|
163
|
+
export interface CoverageViewProps<S extends AnySchema> extends ViewProps<S> {
|
|
164
|
+
readonly options: CoverageOptions;
|
|
165
|
+
readonly schema?: S;
|
|
166
|
+
}
|
|
167
|
+
export declare function gapWords(count: number, options: CoverageRoles, schema: AnySchema): string;
|
|
168
|
+
export declare function unaskedWords(count: number, options: CoverageRoles, schema: AnySchema): string;
|
|
169
|
+
export declare function CoverageView<S extends AnySchema>({ nodes, label, fidelity, mode, options, schema, implicated, flagged, budget, }: CoverageViewProps<S>): import("react").JSX.Element;
|
|
170
|
+
export interface CoverageLens<S extends AnySchema> {
|
|
171
|
+
readonly name: "coverage";
|
|
172
|
+
readonly requiredRoles: readonly string[];
|
|
173
|
+
readonly options: CoverageOptions;
|
|
174
|
+
View(props: ViewProps<S>): ReactElement | null;
|
|
175
|
+
/** The grid, for an app or a test that wants the numbers not the picture. */
|
|
176
|
+
build(nodes: readonly NodeOfSchema<S>[], edges: readonly {
|
|
177
|
+
kind: string;
|
|
178
|
+
from: string;
|
|
179
|
+
to: string;
|
|
180
|
+
}[], schema?: S): CoverageGrid;
|
|
181
|
+
}
|
|
182
|
+
export declare function createCoverageLens<S extends AnySchema>(options: CoverageOptions): CoverageLens<S>;
|
|
183
|
+
//# sourceMappingURL=coverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../src/lens/coverage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EAAmD,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAI3F;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,eAAO,MAAM,uBAAuB,sCAAuC,CAAC;AAE5E,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;;;;;OAQG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC;CAC9D;AAED,MAAM,WAAW,eAAgB,SAAQ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