@yaks/visualize 0.0.0-stage → 0.2.36
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/ActivityView.tsx +370 -0
- package/AnatomyList.tsx +183 -0
- package/Atlas.tsx +490 -0
- package/Detail.tsx +464 -0
- package/LICENSE +202 -0
- package/README.md +180 -2
- package/SectionHead.tsx +18 -0
- package/Topology.tsx +596 -0
- package/_dist/activity.d.ts +15 -0
- package/_dist/activity.d.ts.map +1 -0
- package/_dist/capture.d.ts +19 -0
- package/_dist/capture.d.ts.map +1 -0
- package/_dist/cli.d.ts +6 -0
- package/_dist/cli.d.ts.map +1 -0
- package/_dist/front.d.ts +6 -0
- package/_dist/front.d.ts.map +1 -0
- package/_dist/http.d.ts +21 -0
- package/_dist/http.d.ts.map +1 -0
- package/_dist/main.d.ts +2 -0
- package/_dist/main.d.ts.map +1 -0
- package/_dist/mod.d.ts +6 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/model.d.ts +55 -0
- package/_dist/model.d.ts.map +1 -0
- package/_dist/parts.d.ts +19 -0
- package/_dist/parts.d.ts.map +1 -0
- package/_dist/routes.d.ts +7 -0
- package/_dist/routes.d.ts.map +1 -0
- package/_dist/snapshot.d.ts +38 -0
- package/_dist/snapshot.d.ts.map +1 -0
- package/_dist/stream.d.ts +3 -0
- package/_dist/stream.d.ts.map +1 -0
- package/_dist/tools.d.ts +10 -0
- package/_dist/tools.d.ts.map +1 -0
- package/_dist/vocab.d.ts +5 -0
- package/_dist/vocab.d.ts.map +1 -0
- package/activity.js +73 -0
- package/activity.js.map +1 -0
- package/activity.ts +104 -0
- package/capture.js +46 -0
- package/capture.js.map +1 -0
- package/capture.ts +68 -0
- package/cli.js +173 -0
- package/cli.js.map +1 -0
- package/cli.ts +200 -0
- package/deno.json +1 -0
- package/front.js +21 -0
- package/front.js.map +1 -0
- package/front.json +210 -0
- package/front.ts +22 -0
- package/http.js +290 -0
- package/http.js.map +1 -0
- package/http.ts +338 -0
- package/main.js +51 -0
- package/main.js.map +1 -0
- package/main.ts +50 -0
- package/mod.js +6 -0
- package/mod.js.map +1 -0
- package/mod.ts +15 -0
- package/model.js +551 -0
- package/model.js.map +1 -0
- package/model.ts +543 -0
- package/package.json +76 -4
- package/parts.js +70 -0
- package/parts.js.map +1 -0
- package/parts.ts +113 -0
- package/routes.js +53 -0
- package/routes.js.map +1 -0
- package/routes.ts +76 -0
- package/snapshot.js +117 -0
- package/snapshot.js.map +1 -0
- package/snapshot.ts +157 -0
- package/stream.js +73 -0
- package/stream.js.map +1 -0
- package/stream.ts +95 -0
- package/tools.js +64 -0
- package/tools.js.map +1 -0
- package/tools.ts +79 -0
- package/visualize.css +1787 -0
- package/vocab.js +13 -0
- package/vocab.js.map +1 -0
- package/vocab.json +97 -0
- package/vocab.ts +14 -0
package/Topology.tsx
ADDED
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
/** @jsxRuntime automatic *//** @jsxImportSourceTypes npm:react@19.3.0 *//** @jsxImportSource npm:react@19.3.0 */
|
|
2
|
+
/** The domain's controlled spatial view: fixed lanes, bounded geometry and
|
|
3
|
+
* event-driven pulses. Pointer captures are resources; the camera is graph data.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { SectionHead } from './SectionHead.tsx'
|
|
7
|
+
/* @ts-types="npm:@types/react@19.3.0" */ import { type KeyboardEvent, type PointerEvent, useRef } from 'npm:react@19.3.0'
|
|
8
|
+
import { Button } from 'jsr:@yaks/ui@0.2.36'
|
|
9
|
+
import type { Activity, AtlasModel, Edge, Node } from './model.ts'
|
|
10
|
+
|
|
11
|
+
export let NODE_LIMIT = 160
|
|
12
|
+
export let EDGE_LIMIT = 320
|
|
13
|
+
export let PULSE_LIMIT = 48
|
|
14
|
+
|
|
15
|
+
export let sections = [
|
|
16
|
+
{
|
|
17
|
+
id: 'foundation',
|
|
18
|
+
name: 'Composition',
|
|
19
|
+
note: 'Packages, roles & facets',
|
|
20
|
+
groups: ['packages', 'roles', 'facets'],
|
|
21
|
+
color: 'info',
|
|
22
|
+
mark: '01',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 'vocabulary',
|
|
26
|
+
name: 'Vocabulary',
|
|
27
|
+
note: 'Components & their contracts',
|
|
28
|
+
groups: ['comps'],
|
|
29
|
+
color: 'positive',
|
|
30
|
+
mark: '02',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 'automation',
|
|
34
|
+
name: 'Automation',
|
|
35
|
+
note: 'Rules, hooks & effects',
|
|
36
|
+
groups: ['phases', 'rules', 'hooks', 'effects'],
|
|
37
|
+
color: 'active',
|
|
38
|
+
mark: '03',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'interfaces',
|
|
42
|
+
name: 'Interfaces',
|
|
43
|
+
note: 'Tools, commands & routes',
|
|
44
|
+
groups: ['tools', 'commands', 'routes'],
|
|
45
|
+
color: 'special',
|
|
46
|
+
mark: '04',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'presentation',
|
|
50
|
+
name: 'Presentation',
|
|
51
|
+
note: 'Views, kits & themes',
|
|
52
|
+
groups: ['views', 'inspectViews', 'tui', 'kits', 'themes'],
|
|
53
|
+
color: 'link',
|
|
54
|
+
mark: '05',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'configuration',
|
|
58
|
+
name: 'Wiring',
|
|
59
|
+
note: 'Secret names & skills',
|
|
60
|
+
groups: ['secrets', 'skills'],
|
|
61
|
+
color: 'caution',
|
|
62
|
+
mark: '06',
|
|
63
|
+
},
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
let labels: Record<string, string> = {
|
|
67
|
+
packages: 'Packages',
|
|
68
|
+
roles: 'Roles',
|
|
69
|
+
facets: 'Facets',
|
|
70
|
+
comps: 'Components',
|
|
71
|
+
phases: 'Pipeline labels',
|
|
72
|
+
rules: 'Rules',
|
|
73
|
+
hooks: 'Hooks',
|
|
74
|
+
effects: 'Effects',
|
|
75
|
+
tools: 'Tools',
|
|
76
|
+
commands: 'Commands',
|
|
77
|
+
routes: 'Routes',
|
|
78
|
+
views: 'Views',
|
|
79
|
+
inspectViews: 'Inspector views',
|
|
80
|
+
tui: 'Terminal views',
|
|
81
|
+
kits: 'UI kits',
|
|
82
|
+
themes: 'Themes',
|
|
83
|
+
secrets: 'Secret names',
|
|
84
|
+
skills: 'Skills',
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export let groupName = (group: string) => labels[group] ?? group
|
|
88
|
+
export let colorOf = (node: Node) =>
|
|
89
|
+
sections.find((s) => s.groups.includes(node.group))?.color ?? 'info'
|
|
90
|
+
|
|
91
|
+
export let statusOf = (node: Node) =>
|
|
92
|
+
node.group == 'phases'
|
|
93
|
+
? 'pipeline label'
|
|
94
|
+
: node.bound
|
|
95
|
+
? 'bound'
|
|
96
|
+
: node.loaded
|
|
97
|
+
? 'loaded'
|
|
98
|
+
: node.group == 'facets' && node.detail.attempted === false
|
|
99
|
+
? 'unattempted'
|
|
100
|
+
: node.declared
|
|
101
|
+
? 'declared'
|
|
102
|
+
: 'not declared'
|
|
103
|
+
|
|
104
|
+
export let filtered = (model: AtlasModel) => {
|
|
105
|
+
let { filter, group } = model.state
|
|
106
|
+
let text = filter.trim().toLocaleLowerCase()
|
|
107
|
+
return model.nodes.filter((node) =>
|
|
108
|
+
(!group || group == 'all' || node.group == group) &&
|
|
109
|
+
(!text || [node.name, node.package, node.facet, node.description]
|
|
110
|
+
.filter(Boolean).join(' ').toLocaleLowerCase().includes(text))
|
|
111
|
+
).sort((a, b) => a.name.localeCompare(b.name) || a.id.localeCompare(b.id))
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Phase labels belong to the spine (and list), never the composition map.
|
|
115
|
+
export let mapParts = (model: AtlasModel) =>
|
|
116
|
+
filtered(model).filter((node) => node.group != 'phases')
|
|
117
|
+
|
|
118
|
+
export let elapsed = (event?: Activity) =>
|
|
119
|
+
event?.duration == undefined
|
|
120
|
+
? event?.stage == 'start' ? 'in flight' : '—'
|
|
121
|
+
: `${
|
|
122
|
+
event.duration < 1 ? event.duration.toFixed(2) : event.duration.toFixed(1)
|
|
123
|
+
} ms`
|
|
124
|
+
|
|
125
|
+
let phaseOf = (event: Activity, node: Node) =>
|
|
126
|
+
event.kind == 'phase' &&
|
|
127
|
+
(event.node == node.id || event.name == node.detail.phase ||
|
|
128
|
+
event.name.split('.').at(-1) == node.detail.phase)
|
|
129
|
+
|
|
130
|
+
/** The model supplies explanatory pipeline labels, not bound host handlers.
|
|
131
|
+
* Only retained phase observations supply timing and pulses. */
|
|
132
|
+
export let Spine = ({ model }: { model: AtlasModel }) => {
|
|
133
|
+
let recent = model.events.slice(-PULSE_LIMIT)
|
|
134
|
+
let phases = model.nodes.filter((node) => node.group == 'phases')
|
|
135
|
+
.sort((a, b) => Number(a.detail.order ?? 0) - Number(b.detail.order ?? 0))
|
|
136
|
+
return (
|
|
137
|
+
<section
|
|
138
|
+
className='Spine'
|
|
139
|
+
aria-label='Pipeline labels and observed phase activity'
|
|
140
|
+
>
|
|
141
|
+
<div className='Spine_Intro'>
|
|
142
|
+
<span className='Atlas_Eyebrow Spine_Intro_Text'>Pipeline labels</span>
|
|
143
|
+
<strong className='Spine_Intro_Strong'>apply()</strong>
|
|
144
|
+
<span className='Spine_Intro_Text'>
|
|
145
|
+
Labels ≠ bound handlers. Activity is observed.
|
|
146
|
+
</span>
|
|
147
|
+
</div>
|
|
148
|
+
{phases.length
|
|
149
|
+
? (
|
|
150
|
+
<ol className='Spine_Path Atlas_Reset'>
|
|
151
|
+
{phases.map((node, i) => {
|
|
152
|
+
let event = recent.findLast((e) => phaseOf(e, node))
|
|
153
|
+
return (
|
|
154
|
+
<li
|
|
155
|
+
key={node.id}
|
|
156
|
+
className='Spine_Step'
|
|
157
|
+
data-observed={Boolean(event)}
|
|
158
|
+
data-path={node.detail.path}
|
|
159
|
+
>
|
|
160
|
+
<Button
|
|
161
|
+
type='button'
|
|
162
|
+
className='Spine_Phase'
|
|
163
|
+
mod='quiet'
|
|
164
|
+
onClick={() => {
|
|
165
|
+
model.select(node.id)
|
|
166
|
+
if (event) model.choose(event.id)
|
|
167
|
+
}}
|
|
168
|
+
title={event
|
|
169
|
+
? `${event.name}: ${elapsed(event)}`
|
|
170
|
+
: `${node.name}: no observation in the last ${PULSE_LIMIT} records`}
|
|
171
|
+
>
|
|
172
|
+
<span className='Spine_Number'>
|
|
173
|
+
{String(i + 1).padStart(2, '0')}
|
|
174
|
+
</span>
|
|
175
|
+
<span>{node.name}</span>
|
|
176
|
+
{node.detail.path == 'rollback' &&
|
|
177
|
+
<span className='Spine_PathLabel'>rollback only</span>}
|
|
178
|
+
<span className='Spine_Time'>{elapsed(event)}</span>
|
|
179
|
+
{event && (
|
|
180
|
+
<span
|
|
181
|
+
key={`${event.epoch}:${event.seq}`}
|
|
182
|
+
className='Spine_Pulse'
|
|
183
|
+
/>
|
|
184
|
+
)}
|
|
185
|
+
</Button>
|
|
186
|
+
</li>
|
|
187
|
+
)
|
|
188
|
+
})}
|
|
189
|
+
</ol>
|
|
190
|
+
)
|
|
191
|
+
: (
|
|
192
|
+
<p className='Spine_Empty Atlas_Reset'>
|
|
193
|
+
Pipeline labels are not available in this page.
|
|
194
|
+
</p>
|
|
195
|
+
)}
|
|
196
|
+
</section>
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
type Placed = { node: Node; x: number; y: number }
|
|
201
|
+
type Frame = typeof sections[number] & {
|
|
202
|
+
x: number
|
|
203
|
+
y: number
|
|
204
|
+
height: number
|
|
205
|
+
total: number
|
|
206
|
+
shown: Placed[]
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Round-robin allocation prevents a large vocabulary from hiding every other
|
|
210
|
+
// mechanism. Position depends only on filtered anatomy, never on event rates.
|
|
211
|
+
let geometry = (nodes: Node[]) => {
|
|
212
|
+
let buckets = sections.map((section) => ({
|
|
213
|
+
...section,
|
|
214
|
+
nodes: nodes.filter((n) => section.groups.includes(n.group)),
|
|
215
|
+
take: [] as Node[],
|
|
216
|
+
}))
|
|
217
|
+
let count = 0
|
|
218
|
+
while (count < NODE_LIMIT) {
|
|
219
|
+
let moved = false
|
|
220
|
+
for (let b of buckets) {
|
|
221
|
+
if (count >= NODE_LIMIT) break
|
|
222
|
+
if (b.take.length >= b.nodes.length) continue
|
|
223
|
+
b.take.push(b.nodes[b.take.length])
|
|
224
|
+
count++
|
|
225
|
+
moved = true
|
|
226
|
+
}
|
|
227
|
+
if (!moved) break
|
|
228
|
+
}
|
|
229
|
+
let top = Math.max(
|
|
230
|
+
304,
|
|
231
|
+
...buckets.slice(0, 3)
|
|
232
|
+
.map((b) => 104 + Math.ceil(b.take.length / 2) * 46),
|
|
233
|
+
)
|
|
234
|
+
let frames: Frame[] = buckets.map((b, i) => {
|
|
235
|
+
let x = 24 + (i % 3) * 462
|
|
236
|
+
let y = i < 3 ? 24 : top + 48
|
|
237
|
+
let height = Math.max(304, 104 + Math.ceil(b.take.length / 2) * 46)
|
|
238
|
+
return {
|
|
239
|
+
...b,
|
|
240
|
+
x,
|
|
241
|
+
y,
|
|
242
|
+
height,
|
|
243
|
+
total: b.nodes.length,
|
|
244
|
+
shown: b.take.map((node, j) => ({
|
|
245
|
+
node,
|
|
246
|
+
x: x + 18 + (j % 2) * 211,
|
|
247
|
+
y: y + 84 + Math.floor(j / 2) * 46,
|
|
248
|
+
})),
|
|
249
|
+
}
|
|
250
|
+
})
|
|
251
|
+
let placed = frames.flatMap((f) => f.shown)
|
|
252
|
+
return {
|
|
253
|
+
frames,
|
|
254
|
+
placed,
|
|
255
|
+
height: Math.max(...frames.map((f) => f.y + f.height)) + 24,
|
|
256
|
+
width: 1428,
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
let pathOf = (a: Placed, b: Placed) => {
|
|
261
|
+
let ax = a.x + 101, ay = a.y + 18
|
|
262
|
+
let bx = b.x + 101, by = b.y + 18
|
|
263
|
+
let mid = (ax + bx) / 2
|
|
264
|
+
return `M${ax},${ay} C${mid},${ay} ${mid},${by} ${bx},${by}`
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
let short = (name: string, length = 25) =>
|
|
268
|
+
name.length > length ? `${name.slice(0, length - 1)}…` : name
|
|
269
|
+
|
|
270
|
+
export let zoomed = (model: AtlasModel, delta: number) =>
|
|
271
|
+
model.set({ zoom: Math.min(3, Math.max(.35, model.state.zoom + delta)) })
|
|
272
|
+
|
|
273
|
+
type Drag = {
|
|
274
|
+
id: number
|
|
275
|
+
x: number
|
|
276
|
+
y: number
|
|
277
|
+
cameraX: number
|
|
278
|
+
cameraY: number
|
|
279
|
+
ratio: number
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** The map has no clocks or animation loop. At most 48 observed records pulse. */
|
|
283
|
+
export let Topology = ({ model }: { model: AtlasModel }) => {
|
|
284
|
+
let state = model.state
|
|
285
|
+
let nodes = mapParts(model)
|
|
286
|
+
let { frames, placed, height, width } = geometry(nodes)
|
|
287
|
+
// Fit the aperture to width, not the full tall roster. Lower lanes stay
|
|
288
|
+
// reachable by panning rather than shrinking every label to a pixel.
|
|
289
|
+
let aperture = Math.min(height, width * .65)
|
|
290
|
+
let positions = new Map(placed.map((p) => [p.node.id, p]))
|
|
291
|
+
let relations = model.edges.filter((e) =>
|
|
292
|
+
positions.has(e.from) && positions.has(e.to)
|
|
293
|
+
)
|
|
294
|
+
let edges = relations.slice(0, EDGE_LIMIT)
|
|
295
|
+
let related = new Set(
|
|
296
|
+
model.edges.filter((e) =>
|
|
297
|
+
e.from == state.selected || e.to == state.selected
|
|
298
|
+
)
|
|
299
|
+
.flatMap((e) => [e.from, e.to]),
|
|
300
|
+
)
|
|
301
|
+
let active = model.events.slice(-PULSE_LIMIT).filter((e) =>
|
|
302
|
+
e.kind != 'phase' && e.node && positions.has(e.node)
|
|
303
|
+
)
|
|
304
|
+
let drag = useRef<Drag | undefined>(undefined)
|
|
305
|
+
let pan = (event: PointerEvent<SVGSVGElement>) => {
|
|
306
|
+
if (
|
|
307
|
+
event.button != 0 ||
|
|
308
|
+
(event.target as Element).closest('[data-node],[data-edge]')
|
|
309
|
+
) return
|
|
310
|
+
let svg = event.currentTarget as SVGSVGElement
|
|
311
|
+
let rect = svg.getBoundingClientRect()
|
|
312
|
+
drag.current = {
|
|
313
|
+
id: event.pointerId,
|
|
314
|
+
x: event.clientX,
|
|
315
|
+
y: event.clientY,
|
|
316
|
+
cameraX: state.x,
|
|
317
|
+
cameraY: state.y,
|
|
318
|
+
ratio: Math.max(width / rect.width, aperture / rect.height) / state.zoom,
|
|
319
|
+
}
|
|
320
|
+
svg.setPointerCapture(event.pointerId)
|
|
321
|
+
}
|
|
322
|
+
let move = (event: PointerEvent<SVGSVGElement>) => {
|
|
323
|
+
let start = drag.current
|
|
324
|
+
if (!start || start.id != event.pointerId) return
|
|
325
|
+
model.set({
|
|
326
|
+
x: start.cameraX + (event.clientX - start.x) * start.ratio,
|
|
327
|
+
y: start.cameraY + (event.clientY - start.y) * start.ratio,
|
|
328
|
+
})
|
|
329
|
+
}
|
|
330
|
+
let end = (event: PointerEvent<SVGSVGElement>) => {
|
|
331
|
+
if (drag.current?.id == event.pointerId) drag.current = undefined
|
|
332
|
+
}
|
|
333
|
+
let press = (event: KeyboardEvent<SVGGElement>, id: string) => {
|
|
334
|
+
if (event.key == 'Enter' || event.key == ' ') {
|
|
335
|
+
event.preventDefault()
|
|
336
|
+
model.select(id)
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
let pickEdge = (edge: Edge) => model.select(edge.id)
|
|
340
|
+
return (
|
|
341
|
+
<section className='Map' aria-label='System anatomy map'>
|
|
342
|
+
<SectionHead
|
|
343
|
+
eyebrow='Anatomy'
|
|
344
|
+
title='The shape of this runtime'
|
|
345
|
+
actions={
|
|
346
|
+
<span className='Map_Count'>
|
|
347
|
+
{placed.length} of {nodes.length} parts
|
|
348
|
+
<span className='Map_Count_Text'>· {edges.length} relations</span>
|
|
349
|
+
</span>
|
|
350
|
+
}
|
|
351
|
+
/>
|
|
352
|
+
{!nodes.length && (
|
|
353
|
+
<div className='Map_NoMatches' role='status'>
|
|
354
|
+
<strong className='Map_NoMatches_Strong'>
|
|
355
|
+
No parts match this view.
|
|
356
|
+
</strong>
|
|
357
|
+
<span>Change the filter or choose another anatomy group.</span>
|
|
358
|
+
</div>
|
|
359
|
+
)}
|
|
360
|
+
<div className='Map_Viewport'>
|
|
361
|
+
<svg
|
|
362
|
+
className='Map_Canvas Atlas_Focusable'
|
|
363
|
+
viewBox={`0 0 ${width} ${aperture}`}
|
|
364
|
+
role='group'
|
|
365
|
+
aria-label='Pan and zoom the system topology'
|
|
366
|
+
tabIndex={0}
|
|
367
|
+
onPointerDown={pan}
|
|
368
|
+
onPointerMove={move}
|
|
369
|
+
onPointerUp={end}
|
|
370
|
+
onPointerCancel={end}
|
|
371
|
+
onLostPointerCapture={() => {
|
|
372
|
+
drag.current = undefined
|
|
373
|
+
}}
|
|
374
|
+
>
|
|
375
|
+
<defs>
|
|
376
|
+
<pattern
|
|
377
|
+
id='atlas-grid'
|
|
378
|
+
width='24'
|
|
379
|
+
height='24'
|
|
380
|
+
patternUnits='userSpaceOnUse'
|
|
381
|
+
>
|
|
382
|
+
<circle cx='1' cy='1' r='.7' className='Map_GridDot' />
|
|
383
|
+
</pattern>
|
|
384
|
+
<marker
|
|
385
|
+
id='atlas-arrow'
|
|
386
|
+
viewBox='0 0 10 10'
|
|
387
|
+
refX='9'
|
|
388
|
+
refY='5'
|
|
389
|
+
markerWidth='5'
|
|
390
|
+
markerHeight='5'
|
|
391
|
+
orient='auto-start-reverse'
|
|
392
|
+
>
|
|
393
|
+
<path d='M0 0L10 5L0 10z' className='Map_Arrow' />
|
|
394
|
+
</marker>
|
|
395
|
+
</defs>
|
|
396
|
+
<rect width={width} height={height} fill='url(#atlas-grid)' />
|
|
397
|
+
<g
|
|
398
|
+
transform={`translate(${width / 2} ${aperture / 2}) ` +
|
|
399
|
+
`scale(${state.zoom}) ` +
|
|
400
|
+
`translate(${-width / 2 + state.x} ${-aperture / 2 + state.y})`}
|
|
401
|
+
>
|
|
402
|
+
{frames.map((f) => (
|
|
403
|
+
<g
|
|
404
|
+
key={f.id}
|
|
405
|
+
className='Map_Lane'
|
|
406
|
+
style={{ '--lane': `var(--${f.color})` }}
|
|
407
|
+
>
|
|
408
|
+
<rect
|
|
409
|
+
x={f.x}
|
|
410
|
+
y={f.y}
|
|
411
|
+
width='438'
|
|
412
|
+
height={f.height}
|
|
413
|
+
rx='16'
|
|
414
|
+
className='Map_Frame'
|
|
415
|
+
/>
|
|
416
|
+
<text x={f.x + 18} y={f.y + 28} className='Map_LaneMark'>
|
|
417
|
+
{f.mark}
|
|
418
|
+
</text>
|
|
419
|
+
<text x={f.x + 54} y={f.y + 29} className='Map_LaneName'>
|
|
420
|
+
{f.name}
|
|
421
|
+
</text>
|
|
422
|
+
<text x={f.x + 18} y={f.y + 54} className='Map_LaneNote'>
|
|
423
|
+
{f.note}
|
|
424
|
+
</text>
|
|
425
|
+
<text
|
|
426
|
+
x={f.x + 414}
|
|
427
|
+
y={f.y + 29}
|
|
428
|
+
text-anchor='end'
|
|
429
|
+
className='Map_LaneCount'
|
|
430
|
+
>
|
|
431
|
+
{f.shown.length}/{f.total}
|
|
432
|
+
</text>
|
|
433
|
+
{!f.total && (
|
|
434
|
+
<text x={f.x + 18} y={f.y + 112} className='Map_EmptyLane'>
|
|
435
|
+
{f.groups.some((group) =>
|
|
436
|
+
model.coverage[group] === false
|
|
437
|
+
)
|
|
438
|
+
? 'Includes unobserved categories'
|
|
439
|
+
: 'No matching declarations'}
|
|
440
|
+
</text>
|
|
441
|
+
)}
|
|
442
|
+
</g>
|
|
443
|
+
))}
|
|
444
|
+
<g className='Map_Relations'>
|
|
445
|
+
{edges.map((edge) => {
|
|
446
|
+
let from = positions.get(edge.from)!
|
|
447
|
+
let to = positions.get(edge.to)!
|
|
448
|
+
let selected = state.selected == edge.id ||
|
|
449
|
+
state.selected == edge.from || state.selected == edge.to
|
|
450
|
+
return (
|
|
451
|
+
<g
|
|
452
|
+
key={edge.id}
|
|
453
|
+
data-edge={edge.id}
|
|
454
|
+
className={`Atlas_Focusable Map_Edge${
|
|
455
|
+
selected ? ' Map_Edge-selected' : ''
|
|
456
|
+
}`}
|
|
457
|
+
role='button'
|
|
458
|
+
tabIndex={0}
|
|
459
|
+
aria-pressed={state.selected == edge.id}
|
|
460
|
+
aria-label={`${from.node.name} ${edge.kind} ${to.node.name}`}
|
|
461
|
+
onClick={() => pickEdge(edge)}
|
|
462
|
+
onKeyDown={(event) => press(event, edge.id)}
|
|
463
|
+
>
|
|
464
|
+
<title>
|
|
465
|
+
{from.node.name} → {edge.kind} → {to.node.name}
|
|
466
|
+
</title>
|
|
467
|
+
<path d={pathOf(from, to)} className='Map_EdgeHit' />
|
|
468
|
+
<path
|
|
469
|
+
d={pathOf(from, to)}
|
|
470
|
+
className='Map_EdgeLine'
|
|
471
|
+
marker-end='url(#atlas-arrow)'
|
|
472
|
+
/>
|
|
473
|
+
</g>
|
|
474
|
+
)
|
|
475
|
+
})}
|
|
476
|
+
</g>
|
|
477
|
+
{placed.map(({ node, x, y }) => (
|
|
478
|
+
<g
|
|
479
|
+
key={node.id}
|
|
480
|
+
transform={`translate(${x} ${y})`}
|
|
481
|
+
data-node={node.id}
|
|
482
|
+
style={{ '--node': `var(--${colorOf(node)})` }}
|
|
483
|
+
className={`Atlas_Focusable Map_Node${
|
|
484
|
+
state.selected == node.id
|
|
485
|
+
? ' Map_Node-selected'
|
|
486
|
+
: related.has(node.id)
|
|
487
|
+
? ' Map_Node-related'
|
|
488
|
+
: ''
|
|
489
|
+
}`}
|
|
490
|
+
role='button'
|
|
491
|
+
tabIndex={0}
|
|
492
|
+
aria-pressed={state.selected == node.id}
|
|
493
|
+
aria-label={`${node.name}, ${groupName(node.group)}, ${
|
|
494
|
+
statusOf(node)
|
|
495
|
+
}`}
|
|
496
|
+
onClick={() => model.select(node.id)}
|
|
497
|
+
onKeyDown={(event) => press(event, node.id)}
|
|
498
|
+
>
|
|
499
|
+
<title>
|
|
500
|
+
{node.name} · {groupName(node.group)} · {statusOf(node)}
|
|
501
|
+
</title>
|
|
502
|
+
<rect width='202' height='37' rx='7' className='Map_NodeBody' />
|
|
503
|
+
<circle
|
|
504
|
+
cx='13'
|
|
505
|
+
cy='18'
|
|
506
|
+
r='3'
|
|
507
|
+
className='Map_NodeDot'
|
|
508
|
+
data-bound={node.bound}
|
|
509
|
+
data-loaded={node.loaded}
|
|
510
|
+
/>
|
|
511
|
+
<text x='25' y='16' className='Map_NodeName'>
|
|
512
|
+
{short(node.name)}
|
|
513
|
+
</text>
|
|
514
|
+
<text x='25' y='29' className='Map_NodeKind'>
|
|
515
|
+
{groupName(node.group)} · {statusOf(node)}
|
|
516
|
+
</text>
|
|
517
|
+
</g>
|
|
518
|
+
))}
|
|
519
|
+
{active.map((event) => {
|
|
520
|
+
let p = positions.get(event.node!)!
|
|
521
|
+
return (
|
|
522
|
+
<rect
|
|
523
|
+
key={`${event.epoch}:${event.seq}`}
|
|
524
|
+
x={p.x - 3}
|
|
525
|
+
y={p.y - 3}
|
|
526
|
+
width='208'
|
|
527
|
+
height='43'
|
|
528
|
+
rx='9'
|
|
529
|
+
className='Map_Pulse'
|
|
530
|
+
pointer-events='none'
|
|
531
|
+
style={{ '--node': `var(--${colorOf(p.node)})` }}
|
|
532
|
+
/>
|
|
533
|
+
)
|
|
534
|
+
})}
|
|
535
|
+
</g>
|
|
536
|
+
</svg>
|
|
537
|
+
<div className='Map_Camera' aria-label='Map camera controls'>
|
|
538
|
+
<Button
|
|
539
|
+
className='Atlas_Button Map_Camera_Button'
|
|
540
|
+
type='button'
|
|
541
|
+
aria-label='Zoom out'
|
|
542
|
+
onClick={() => zoomed(model, -.2)}
|
|
543
|
+
>
|
|
544
|
+
−
|
|
545
|
+
</Button>
|
|
546
|
+
<output className='Map_Camera_Output' aria-label='Current zoom'>
|
|
547
|
+
{Math.round(state.zoom * 100)}%
|
|
548
|
+
</output>
|
|
549
|
+
<Button
|
|
550
|
+
className='Atlas_Button Map_Camera_Button'
|
|
551
|
+
type='button'
|
|
552
|
+
aria-label='Zoom in'
|
|
553
|
+
onClick={() => zoomed(model, .2)}
|
|
554
|
+
>
|
|
555
|
+
+
|
|
556
|
+
</Button>
|
|
557
|
+
<Button
|
|
558
|
+
className='Atlas_Button Map_Camera_Button'
|
|
559
|
+
type='button'
|
|
560
|
+
onClick={() => model.set({ x: 0, y: 0, zoom: 1 })}
|
|
561
|
+
>
|
|
562
|
+
Fit
|
|
563
|
+
</Button>
|
|
564
|
+
</div>
|
|
565
|
+
<div className='Map_Legend' aria-label='Map legend'>
|
|
566
|
+
<span className='Map_Legend_Text'>
|
|
567
|
+
<i className='Map_LegendDot Map_LegendDot-bound' />bound
|
|
568
|
+
</span>
|
|
569
|
+
<span className='Map_Legend_Text'>
|
|
570
|
+
<i className='Map_LegendDot' />declaration
|
|
571
|
+
</span>
|
|
572
|
+
<span className='Map_Legend_Text'>
|
|
573
|
+
<i className='Map_LegendLine' />relationship
|
|
574
|
+
</span>
|
|
575
|
+
</div>
|
|
576
|
+
</div>
|
|
577
|
+
<footer className='Map_Footer'>
|
|
578
|
+
<span>Drag to pan · + / − zoom · ↑ / ↓ select · Enter inspect</span>
|
|
579
|
+
<span className='Map_Budget'>
|
|
580
|
+
≤{PULSE_LIMIT} observed records animate
|
|
581
|
+
</span>
|
|
582
|
+
{(nodes.length > NODE_LIMIT || relations.length > EDGE_LIMIT) && (
|
|
583
|
+
<Button
|
|
584
|
+
className='Atlas_Button'
|
|
585
|
+
type='button'
|
|
586
|
+
mod='quiet'
|
|
587
|
+
onClick={() => model.set({ view: 'list' })}
|
|
588
|
+
>
|
|
589
|
+
Map cap: {NODE_LIMIT} parts / {EDGE_LIMIT}{' '}
|
|
590
|
+
relations. Open full list →
|
|
591
|
+
</Button>
|
|
592
|
+
)}
|
|
593
|
+
</footer>
|
|
594
|
+
</section>
|
|
595
|
+
)
|
|
596
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Leases on the graph's one @yaks/trace channel, never another measurement. */ import { type Event } from "@yaks/trace";
|
|
2
|
+
export type Activity = Event & {
|
|
3
|
+
readonly seq: number;
|
|
4
|
+
readonly epoch: string;
|
|
5
|
+
readonly node?: string;
|
|
6
|
+
};
|
|
7
|
+
export type Observation = {
|
|
8
|
+
readonly epoch: string;
|
|
9
|
+
history: (limit?: number) => Activity[];
|
|
10
|
+
subscribe: (fn: (event: Activity) => void) => () => void;
|
|
11
|
+
close: () => void;
|
|
12
|
+
};
|
|
13
|
+
/** The first lease subscribes before taking history. The last releases the
|
|
14
|
+
* producer's active path; no timer, clock or observer survives it. */ export declare let observe: (graph: object) => Observation;
|
|
15
|
+
//# sourceMappingURL=activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.d.ts","sources":["../activity.ts"],"names":[],"mappings":"AAAA,8EAA8E,GAC9E,SAAkB,KAAK,KAAK,2BAAgC;AAG5D,YAAY,WAAW;WACZ,KAAK,MAAM;WACX,OAAO,MAAM;WACb,OAAO,MAAM;;AAExB,YAAY;WACD,OAAO,MAAM;EACtB,UAAU,QAAQ,MAAM,KAAK;EAC7B,YAAY,KAAK,OAAO,aAAa,IAAI,WAAW,IAAI;EACxD,aAAa,IAAI;;AAanB;oEACoE,GACpE,OAAO,YAAI,UAAW,OAAO,MAAM,KAAG,YA2ErC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** A bounded finite observation for commands and tools. */ import { type Clock } from "@yaks/fp";
|
|
2
|
+
import { type Activity } from "./activity.js";
|
|
3
|
+
export declare let DEFAULT_LIMIT: number;
|
|
4
|
+
export declare let MAX_LIMIT: number;
|
|
5
|
+
export declare let MAX_WAIT: number;
|
|
6
|
+
export type Capture = {
|
|
7
|
+
epoch: string;
|
|
8
|
+
events: Activity[];
|
|
9
|
+
/** Known records omitted by the limit or overwritten during this capture. */ gap: number;
|
|
10
|
+
coverage: 'process-local';
|
|
11
|
+
};
|
|
12
|
+
export type CaptureOptions = {
|
|
13
|
+
limit?: number;
|
|
14
|
+
wait?: number;
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
/** the clock the wait runs on (default: the runtime's, @yaks/fp `system`) */ clock?: Clock;
|
|
17
|
+
};
|
|
18
|
+
export declare let capture: (graph: object, opts?: CaptureOptions) => Promise<Capture>;
|
|
19
|
+
//# sourceMappingURL=capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.d.ts","sources":["../capture.ts"],"names":[],"mappings":"AAAA,yDAAyD,GACzD,SAAS,KAAK,KAAK,wBAAqC;AACxD,SAAS,KAAK,QAAQ,wBAAgC;AAGtD,OAAO,YAAI,sBAAmB;AAC9B,OAAO,YAAI,kBAAe;AAC1B,OAAO,YAAI,iBAAe;AAC1B,YAAY;EACV,OAAO,MAAM;EACb,QAAQ;EACR,2EAA2E,GAC3E,KAAK,MAAM;EACX,UAAU;;AAEZ,YAAY;EACV,QAAQ,MAAM;EACd,OAAO,MAAM;EACb,SAAS;EACT,2EAA2E,GAC3E,QAAQ;;AAGV,OAAO,YAAI,UACT,OAAO,MAAM,EACb,OAAM,mBACL,QAAQ,SAyCV"}
|
package/_dist/cli.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AccountOptions, Ctx } from "@yaks/cli";
|
|
2
|
+
import type { Host } from "@yaks/host";
|
|
3
|
+
import type { CliCommand } from "@yaks/cli/host";
|
|
4
|
+
/** The CLI door into the same served snapshots used by the page. */ export declare let command: (_dts_1: never) => any;
|
|
5
|
+
export declare let commands: CliCommand[];
|
|
6
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sources":["../cli.ts"],"names":[],"mappings":"AAEA,cAAc,cAAc,EAAE,GAAG,yBAA8B;AAC/D,cAAc,IAAI,0BAA+B;AACjD,cAAc,UAAU,8BAAmC;AAyD3D,kEAAkE,GAClE,OAAO,YAAI,UAAW,sBAuIC;AAEvB,OAAO,YAAI,UAAU,aAA0B"}
|
package/_dist/front.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { VocabDoc } from "@yaks/vocab";
|
|
2
|
+
export declare let frontDoc: VocabDoc;
|
|
3
|
+
export declare let docs: VocabDoc[];
|
|
4
|
+
/** Reuse the draft contract, changing only this local graph's lifetimes.
|
|
5
|
+
* No duplicate component declaration and no host vocabulary override. */ export declare let draftDocs: VocabDoc[];
|
|
6
|
+
//# sourceMappingURL=front.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"front.d.ts","sources":["../front.ts"],"names":[],"mappings":"AAEA,cAAc,QAAQ,2BAAgC;AAGtD,OAAO,YAAI,UAA6B,SAAQ;AAChD,OAAO,YAAI,MAAM,WAAuB;AAExC;uEACuE,GACvE,OAAO,YAAI,WAAW,WAWnB"}
|
package/_dist/http.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Portable authenticated doors. No runtime, storage adapter or entity reads. */ import { type Clock } from "@yaks/fp";
|
|
2
|
+
import { type Supplier } from "./snapshot.js";
|
|
3
|
+
/** Null permits anonymous access only when this supplied policy permits it. */ export type Hosting = Supplier & {
|
|
4
|
+
graph: object;
|
|
5
|
+
who?: (request: Request) => unknown | Promise<unknown>;
|
|
6
|
+
stopping?: AbortSignal;
|
|
7
|
+
report?: (error: unknown) => void;
|
|
8
|
+
/** the clock a capture's wait and a stream's keepalives run on (default:
|
|
9
|
+
* the runtime's, @yaks/fp `system`) */ clock?: Clock;
|
|
10
|
+
};
|
|
11
|
+
export type Route = {
|
|
12
|
+
method: string;
|
|
13
|
+
path: string;
|
|
14
|
+
handle: (request: Request) => Response | Promise<Response>;
|
|
15
|
+
};
|
|
16
|
+
/** Authenticate before supplying metadata, building assets or taking a lease.
|
|
17
|
+
* Only our fixed validation messages cross the door: arbitrary host errors,
|
|
18
|
+
* including their name/message/status fields, can contain secrets. */ export declare let guarded: (host: Hosting, handle: Route['handle']) => Route['handle'];
|
|
19
|
+
/** Direct adapter entry is authenticated too, not just the routes facade. */ export declare let events: (host: Hosting, request: Request) => ReturnType<Route['handle']>;
|
|
20
|
+
export declare let http: (host: Hosting) => Route[];
|
|
21
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sources":["../http.ts"],"names":[],"mappings":"AAAA,+EAA+E,GAC/E,SAAS,KAAK,KAAK,wBAAqC;AAGxD,SAKE,KAAK,QAAQ,wBACO;AAEtB,6EAA6E,GAC7E,YAAY,UAAU;EACpB,OAAO,MAAM;EACb,OAAO,SAAS,YAAY,OAAO,GAAG,QAAQ,OAAO;EACrD,WAAW;EACX,UAAU,OAAO,OAAO,KAAK,IAAI;EACjC;uCACqC,GACrC,QAAQ;;AAEV,YAAY;EACV,QAAQ,MAAM;EACd,MAAM,MAAM;EACZ,SAAS,SAAS,YAAY,WAAW,QAAQ;;AAmCnD;;oEAEoE,GACpE,OAAO,YAAI,UACT,MAAM,SACN,QAAQ,MAAM,cACb,MAAM,UAwER;AAkJD,2EAA2E,GAC3E,OAAO,YAAI,SACT,MAAM,SACN,SAAS,YACR,WAAW,MAAM,WACwC;AAE5D,OAAO,YAAI,OAAQ,MAAM,YAAU,QA8ClC"}
|