@hattoriai/poney-react 0.1.1 → 0.3.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/README.md +3 -3
- package/dist/index.d.ts +58 -804
- package/dist/index.js +65 -2282
- package/dist/index.js.map +1 -1
- package/package.json +8 -20
- package/dist/poney.css +0 -211
- package/dist/poney.min.css +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,829 +1,83 @@
|
|
|
1
|
+
import * as _hattoriai_poney_core from '@hattoriai/poney-core';
|
|
2
|
+
import { Ref, View } from '@hattoriai/poney-core';
|
|
3
|
+
import * as _hattoriai_poney_layout from '@hattoriai/poney-layout';
|
|
1
4
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { ChangeState, Effect, Badge, Ref, ModelIndex, Walkthrough, PoneyDocument, View, TraceStep, Tone, Entity, ResolvedStyle } from '@hattoriai/poney-core';
|
|
4
|
-
export { indexOf, marksOf } from '@hattoriai/poney-core';
|
|
5
|
-
import { Rect, SceneBase, ViewLayoutOptions, MapScene, SequenceScene, StateScene, Point } from '@hattoriai/poney-layout';
|
|
5
|
+
import { MouseEvent, KeyboardEvent, FC, ReactNode } from 'react';
|
|
6
6
|
import { LucideIcon } from 'lucide-react';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
type Mode = 'before' | 'change' | 'after';
|
|
16
|
-
interface StoryState {
|
|
17
|
-
marks: Map<string, ChangeState>;
|
|
18
|
-
mode: Mode;
|
|
19
|
-
/** Elements the scene is about. Everything else dims. Null: nothing dims. */
|
|
20
|
-
focus: Set<string> | null;
|
|
21
|
-
/** Numbered callouts by element. */
|
|
22
|
-
callouts: Map<string, number>;
|
|
23
|
-
/** The element under the reader's attention: hovered here or in the text. */
|
|
24
|
-
hot: string | null;
|
|
25
|
-
setHot(key: string | null): void;
|
|
26
|
-
/** Show relationship labels on every edge, not only on focused ones. */
|
|
27
|
-
allLabels?: boolean;
|
|
28
|
-
/** Opens or closes a group in a map. Without it, groups cannot be toggled (a static picture). */
|
|
29
|
-
toggleGroup?(entityId: string): void;
|
|
30
|
-
/** Effects and badges by ref key. */
|
|
31
|
-
effects?: Map<string, Effect[]>;
|
|
32
|
-
badges?: Map<string, Badge[]>;
|
|
33
|
-
/**
|
|
34
|
-
* The path the reader can play: its steps as ref keys, the step shown
|
|
35
|
-
* (null: not playing), whether to animate, and whether a still picture
|
|
36
|
-
* numbers the steps.
|
|
37
|
-
*/
|
|
38
|
-
trace?: {
|
|
39
|
-
steps: string[];
|
|
40
|
-
current: number | null;
|
|
41
|
-
animate: boolean;
|
|
42
|
-
numbered: boolean;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
declare const StoryProvider: ({ value, children }: {
|
|
46
|
-
value: StoryState;
|
|
47
|
-
children: ReactNode;
|
|
48
|
-
}) => react.JSX.Element;
|
|
49
|
-
declare const useStory: () => StoryState;
|
|
50
|
-
interface Look {
|
|
51
|
-
/** The change state, shown only in "change" mode. */
|
|
52
|
-
state?: ChangeState;
|
|
53
|
-
hidden: boolean;
|
|
54
|
-
dim: boolean;
|
|
55
|
-
hot: boolean;
|
|
56
|
-
focused: boolean;
|
|
57
|
-
callout?: number;
|
|
58
|
-
}
|
|
59
|
-
/** How one element should look in the current story state. */
|
|
60
|
-
declare function useLook(key: string): Look;
|
|
61
|
-
/** One look for an element that stands for several (a line through a hidden hop). */
|
|
62
|
-
declare function useLookAny(keys: string[]): Look;
|
|
63
|
-
declare function lookOf(s: StoryState, key: string): Look;
|
|
64
|
-
declare const lookClass: (l: Look) => string;
|
|
65
|
-
declare const stateStroke: (s?: ChangeState, fallback?: string) => string;
|
|
66
|
-
declare const stateFill: (s?: ChangeState, fallback?: string) => string;
|
|
67
|
-
declare const STATE_LABEL: Record<ChangeState, string>;
|
|
68
|
-
/** A small label that says New, Changed or Removed, centred on a point. */
|
|
69
|
-
declare function StateTag({ state, x, y, anchor }: {
|
|
70
|
-
state?: ChangeState;
|
|
71
|
-
x: number;
|
|
72
|
-
y: number;
|
|
73
|
-
anchor?: 'start' | 'end' | 'middle';
|
|
74
|
-
}): react.JSX.Element | null;
|
|
75
|
-
/** A numbered marker that ties the diagram to a note in the text. */
|
|
76
|
-
declare function CalloutBadge({ n, x, y, hot }: {
|
|
77
|
-
n: number;
|
|
78
|
-
x: number;
|
|
79
|
-
y: number;
|
|
80
|
-
hot?: boolean;
|
|
81
|
-
}): react.JSX.Element;
|
|
82
|
-
/** A filled arrowhead at the end of a line. */
|
|
83
|
-
declare function Head$1({ x, y, angle, color, size }: {
|
|
84
|
-
x: number;
|
|
85
|
-
y: number;
|
|
86
|
-
angle: number;
|
|
87
|
-
color: string;
|
|
88
|
-
size?: number;
|
|
89
|
-
}): react.JSX.Element;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* What a renderer needs from its host (an app, a page, a headless render).
|
|
93
|
-
* Only the model is required:
|
|
94
|
-
*
|
|
95
|
-
* - `bind` makes an element interactive (click, hover, keyboard). Without it,
|
|
96
|
-
* elements are plain SVG with their ref in `data-ref`.
|
|
97
|
-
* - `selection` and `hover` say what the reader is looking at; diagrams
|
|
98
|
-
* light it and its neighbours up.
|
|
99
|
-
* - `viewState` and `setViewState` keep what the reader changed in a view
|
|
100
|
-
* (groups opened or closed, tables expanded). Without them, each view
|
|
101
|
-
* keeps its own state while it is shown.
|
|
102
|
-
*
|
|
103
|
-
* The zoom level comes separately (ZoomProvider), from the host's canvas.
|
|
104
|
-
*/
|
|
105
|
-
interface BindProps {
|
|
106
|
-
'data-ref'?: string;
|
|
107
|
-
className?: string;
|
|
108
|
-
tabIndex?: number;
|
|
109
|
-
role?: string;
|
|
110
|
-
'aria-label'?: string;
|
|
111
|
-
'aria-pressed'?: boolean;
|
|
112
|
-
onClick?: (e: React.MouseEvent) => void;
|
|
113
|
-
onDoubleClick?: (e: React.MouseEvent) => void;
|
|
114
|
-
onMouseEnter?: () => void;
|
|
115
|
-
onMouseLeave?: () => void;
|
|
116
|
-
onFocus?: () => void;
|
|
117
|
-
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
7
|
+
import * as D from '@hattoriai/poney-diagrams';
|
|
8
|
+
export { AnyDiagramModule, DiagramModule, DrawingTarget, FONTS, FoundTarget, IconData, LineShape, Look, Mode, STATE_LABEL, STORY_TYPES, StoryState, THEMES, ThemeName, ViewBox, ViewState, expandFocus, findScene, findTarget, fit, followFrame, lookClass, lookOf, panViewBox, registerDiagram, sceneFrame, sceneLayoutOptions, sceneLines, stateFill, stateStroke, stepLetter, storyState, toneColor, toneWash, viewKey, zoomViewBox } from '@hattoriai/poney-diagrams';
|
|
9
|
+
|
|
10
|
+
/** What `bind` gives an element, with React's events. */
|
|
11
|
+
interface BindProps extends Omit<D.BindProps, 'onClick' | 'onDoubleClick' | 'onKeyDown'> {
|
|
12
|
+
onClick?: (e: MouseEvent) => void;
|
|
13
|
+
onDoubleClick?: (e: MouseEvent) => void;
|
|
14
|
+
onKeyDown?: (e: KeyboardEvent) => void;
|
|
118
15
|
}
|
|
119
16
|
type BindFn = (ref: Ref, label: string) => BindProps;
|
|
120
|
-
/** What
|
|
121
|
-
interface
|
|
122
|
-
/** Containers and groups opened or closed, overriding the view. */
|
|
123
|
-
collapsed?: string[];
|
|
124
|
-
/** ERD: tables that show every field. */
|
|
125
|
-
expandedTables?: string[];
|
|
126
|
-
/** Data flow: show relationships without data. */
|
|
127
|
-
controlFlow?: boolean;
|
|
128
|
-
/** Dependency: highlight transitive dependencies, not only direct ones. */
|
|
129
|
-
transitive?: boolean;
|
|
130
|
-
}
|
|
131
|
-
interface RenderValue {
|
|
132
|
-
idx: ModelIndex;
|
|
17
|
+
/** What the drawings need from a React app (see @hattoriai/poney-diagrams RenderValue). */
|
|
18
|
+
interface RenderValue extends Omit<D.RenderValue, 'bind'> {
|
|
133
19
|
bind?: BindFn;
|
|
134
|
-
selection?: Ref | null;
|
|
135
|
-
hover?: Ref | null;
|
|
136
|
-
viewState?: (viewId: string) => ViewState | undefined;
|
|
137
|
-
setViewState?: (viewId: string, patch: Partial<ViewState>) => void;
|
|
138
|
-
/** A still picture (an image, a print): controls such as open/close buttons are not drawn. */
|
|
139
|
-
still?: boolean;
|
|
140
20
|
}
|
|
21
|
+
/** What the drawings need from the app: the model index, and optionally interaction, selection and view state. */
|
|
141
22
|
declare const RenderProvider: ({ value, children }: {
|
|
142
23
|
value: RenderValue;
|
|
143
|
-
children
|
|
24
|
+
children?: ReactNode;
|
|
144
25
|
}) => react.JSX.Element;
|
|
145
|
-
|
|
146
|
-
declare
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
hover: Ref | null;
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* A view's state and a way to change it: the host's, when it keeps one;
|
|
155
|
-
* otherwise kept here while the view is shown.
|
|
156
|
-
*/
|
|
157
|
-
declare function useViewState(viewId: string): [ViewState, (patch: Partial<ViewState>) => void];
|
|
158
|
-
/** The host's zoom level, for level-of-detail drawing (small text hides when far away). */
|
|
26
|
+
/** How a story drawing shows a change: marks, mode, focus, callouts. */
|
|
27
|
+
declare const StoryProvider: ({ value, children }: {
|
|
28
|
+
value: D.StoryState;
|
|
29
|
+
children?: ReactNode;
|
|
30
|
+
}) => react.JSX.Element;
|
|
31
|
+
/** The host's zoom level, for level-of-detail drawing. */
|
|
159
32
|
declare const ZoomProvider: ({ value, children }: {
|
|
160
33
|
value: number;
|
|
161
|
-
children
|
|
34
|
+
children?: ReactNode;
|
|
162
35
|
}) => react.JSX.Element;
|
|
163
36
|
declare const useRenderZoom: () => number;
|
|
164
|
-
/**
|
|
165
|
-
declare
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
declare
|
|
169
|
-
/**
|
|
170
|
-
* The elements a focus really covers: a line or a transition brings its two
|
|
171
|
-
* ends, so the things it connects are never dimmed.
|
|
172
|
-
*/
|
|
173
|
-
declare function expandFocus(refs: string[], idx?: ModelIndex, walkthrough?: Walkthrough): string[];
|
|
174
|
-
/**
|
|
175
|
-
* The part of a scene to frame: the focus, or everything. A focused sequence
|
|
176
|
-
* is already cut to its focus. The frame grows to hold whole any box it
|
|
177
|
-
* would otherwise cut.
|
|
178
|
-
*/
|
|
179
|
-
declare function sceneFrame(scene: SceneBase, view: View, focus: string[], idx?: ModelIndex, walkthrough?: Walkthrough): Rect;
|
|
180
|
-
interface ViewBox {
|
|
181
|
-
x: number;
|
|
182
|
-
y: number;
|
|
183
|
-
w: number;
|
|
184
|
-
h: number;
|
|
185
|
-
}
|
|
186
|
-
/** Fits a frame into a box of the given size, never closer than `maxScale`. */
|
|
187
|
-
declare function fit(frame: Rect, W: number, H: number, pad: number, maxScale: number): ViewBox;
|
|
188
|
-
/** The story state of a scene: marks, mode, focus and numbered callouts. */
|
|
189
|
-
declare function storyState(input: {
|
|
190
|
-
marks: Map<string, ChangeState>;
|
|
191
|
-
mode: Mode;
|
|
192
|
-
view: View;
|
|
193
|
-
focus: string[];
|
|
194
|
-
callouts: string[];
|
|
195
|
-
hot?: string | null;
|
|
196
|
-
setHot?: (k: string | null) => void;
|
|
197
|
-
idx?: ModelIndex;
|
|
198
|
-
walkthrough?: Walkthrough;
|
|
199
|
-
effects?: Effect[];
|
|
200
|
-
badges?: Badge[];
|
|
201
|
-
trace?: TraceStep[];
|
|
202
|
-
/** The trace step shown; null or absent: not playing. */
|
|
203
|
-
traceStep?: number | null;
|
|
204
|
-
/** Animate the trace token and effects. Default: true. */
|
|
205
|
-
animate?: boolean;
|
|
206
|
-
/** A still picture: number the steps of the trace. */
|
|
207
|
-
numberSteps?: boolean;
|
|
208
|
-
}): StoryState;
|
|
209
|
-
/** Finds a scene by walkthrough and scene id ("overview" for the overview). */
|
|
210
|
-
declare function findScene(doc: PoneyDocument, walkthroughId?: string, sceneId?: string): {
|
|
211
|
-
walkthrough: {
|
|
212
|
-
overview: string | undefined;
|
|
213
|
-
scenes: {
|
|
214
|
-
view: string | undefined;
|
|
215
|
-
code: {
|
|
216
|
-
hunks: {
|
|
217
|
-
lines: {
|
|
218
|
-
kind: "add" | "del" | "ctx";
|
|
219
|
-
text: string;
|
|
220
|
-
new?: number | undefined;
|
|
221
|
-
old?: number | undefined;
|
|
222
|
-
}[];
|
|
223
|
-
header?: string | undefined;
|
|
224
|
-
}[];
|
|
225
|
-
path: string;
|
|
226
|
-
notes: {
|
|
227
|
-
line: number;
|
|
228
|
-
text: string;
|
|
229
|
-
}[];
|
|
230
|
-
title?: string | undefined;
|
|
231
|
-
}[];
|
|
232
|
-
id: string;
|
|
233
|
-
title: string;
|
|
234
|
-
text: string;
|
|
235
|
-
risk: "look" | "routine";
|
|
236
|
-
focus: string[];
|
|
237
|
-
callouts: {
|
|
238
|
-
target: string;
|
|
239
|
-
text: string;
|
|
240
|
-
}[];
|
|
241
|
-
cases: {
|
|
242
|
-
then: string;
|
|
243
|
-
when: string;
|
|
244
|
-
note?: string | undefined;
|
|
245
|
-
}[];
|
|
246
|
-
proof: {
|
|
247
|
-
text: string;
|
|
248
|
-
missing: boolean;
|
|
249
|
-
source?: string | undefined;
|
|
250
|
-
test?: string | undefined;
|
|
251
|
-
}[];
|
|
252
|
-
questions: string[];
|
|
253
|
-
trace: {
|
|
254
|
-
ref: string;
|
|
255
|
-
caption?: string | undefined;
|
|
256
|
-
}[];
|
|
257
|
-
effects: {
|
|
258
|
-
target: string;
|
|
259
|
-
as: "flow" | "attention" | "hot-path" | "slow" | "failing" | "blocked";
|
|
260
|
-
tone?: string | undefined;
|
|
261
|
-
}[];
|
|
262
|
-
badges: {
|
|
263
|
-
target: string;
|
|
264
|
-
text: string;
|
|
265
|
-
tone?: string | undefined;
|
|
266
|
-
}[];
|
|
267
|
-
question?: string | undefined;
|
|
268
|
-
}[];
|
|
269
|
-
id: string;
|
|
270
|
-
kind: "change" | "tour";
|
|
271
|
-
summary: string;
|
|
272
|
-
title: string;
|
|
273
|
-
removed: {
|
|
274
|
-
transitions: {
|
|
275
|
-
stateMachine: string;
|
|
276
|
-
transition: {
|
|
277
|
-
id: string;
|
|
278
|
-
event: string;
|
|
279
|
-
from: string;
|
|
280
|
-
to: string;
|
|
281
|
-
actions: string[];
|
|
282
|
-
description?: string | undefined;
|
|
283
|
-
guard?: string | undefined;
|
|
284
|
-
triggeredBy?: string | undefined;
|
|
285
|
-
};
|
|
286
|
-
}[];
|
|
287
|
-
entities: {
|
|
288
|
-
id: string;
|
|
289
|
-
kind: string;
|
|
290
|
-
name: string;
|
|
291
|
-
summary: string;
|
|
292
|
-
tags: string[];
|
|
293
|
-
sourceRefs: {
|
|
294
|
-
path: string;
|
|
295
|
-
symbol?: string | undefined;
|
|
296
|
-
line?: number | undefined;
|
|
297
|
-
repository?: string | undefined;
|
|
298
|
-
}[];
|
|
299
|
-
metadata: Record<string, string | number | boolean>;
|
|
300
|
-
ext: Record<string, unknown>;
|
|
301
|
-
description?: string | undefined;
|
|
302
|
-
parent?: string | undefined;
|
|
303
|
-
technology?: string | undefined;
|
|
304
|
-
}[];
|
|
305
|
-
relationships: {
|
|
306
|
-
id: string;
|
|
307
|
-
kind: string;
|
|
308
|
-
metadata: Record<string, string | number | boolean>;
|
|
309
|
-
ext: Record<string, unknown>;
|
|
310
|
-
source: string;
|
|
311
|
-
target: string;
|
|
312
|
-
label: string;
|
|
313
|
-
data: string[];
|
|
314
|
-
description?: string | undefined;
|
|
315
|
-
protocol?: string | undefined;
|
|
316
|
-
}[];
|
|
317
|
-
};
|
|
318
|
-
story: {
|
|
319
|
-
text: string;
|
|
320
|
-
before?: string | undefined;
|
|
321
|
-
after?: string | undefined;
|
|
322
|
-
};
|
|
323
|
-
marks: {
|
|
324
|
-
state: "new" | "changed" | "removed";
|
|
325
|
-
ref: string;
|
|
326
|
-
note?: string | undefined;
|
|
327
|
-
}[];
|
|
328
|
-
source?: {
|
|
329
|
-
kind: string;
|
|
330
|
-
repository?: string | undefined;
|
|
331
|
-
head?: string | undefined;
|
|
332
|
-
removed?: number | undefined;
|
|
333
|
-
ref?: string | undefined;
|
|
334
|
-
url?: string | undefined;
|
|
335
|
-
base?: string | undefined;
|
|
336
|
-
author?: string | undefined;
|
|
337
|
-
files?: number | undefined;
|
|
338
|
-
added?: number | undefined;
|
|
339
|
-
} | undefined;
|
|
340
|
-
verdict?: {
|
|
341
|
-
risk: "look" | "routine";
|
|
342
|
-
facts: {
|
|
343
|
-
value: string;
|
|
344
|
-
label: string;
|
|
345
|
-
}[];
|
|
346
|
-
findings: {
|
|
347
|
-
text: string;
|
|
348
|
-
severity: "note" | "risk";
|
|
349
|
-
scene?: string | undefined;
|
|
350
|
-
}[];
|
|
351
|
-
} | undefined;
|
|
352
|
-
};
|
|
353
|
-
viewId: string;
|
|
354
|
-
focus: string[];
|
|
355
|
-
callouts: string[];
|
|
356
|
-
notes: string[];
|
|
357
|
-
title: string;
|
|
358
|
-
scene: undefined;
|
|
359
|
-
} | {
|
|
360
|
-
walkthrough: {
|
|
361
|
-
overview: string | undefined;
|
|
362
|
-
scenes: {
|
|
363
|
-
view: string | undefined;
|
|
364
|
-
code: {
|
|
365
|
-
hunks: {
|
|
366
|
-
lines: {
|
|
367
|
-
kind: "add" | "del" | "ctx";
|
|
368
|
-
text: string;
|
|
369
|
-
new?: number | undefined;
|
|
370
|
-
old?: number | undefined;
|
|
371
|
-
}[];
|
|
372
|
-
header?: string | undefined;
|
|
373
|
-
}[];
|
|
374
|
-
path: string;
|
|
375
|
-
notes: {
|
|
376
|
-
line: number;
|
|
377
|
-
text: string;
|
|
378
|
-
}[];
|
|
379
|
-
title?: string | undefined;
|
|
380
|
-
}[];
|
|
381
|
-
id: string;
|
|
382
|
-
title: string;
|
|
383
|
-
text: string;
|
|
384
|
-
risk: "look" | "routine";
|
|
385
|
-
focus: string[];
|
|
386
|
-
callouts: {
|
|
387
|
-
target: string;
|
|
388
|
-
text: string;
|
|
389
|
-
}[];
|
|
390
|
-
cases: {
|
|
391
|
-
then: string;
|
|
392
|
-
when: string;
|
|
393
|
-
note?: string | undefined;
|
|
394
|
-
}[];
|
|
395
|
-
proof: {
|
|
396
|
-
text: string;
|
|
397
|
-
missing: boolean;
|
|
398
|
-
source?: string | undefined;
|
|
399
|
-
test?: string | undefined;
|
|
400
|
-
}[];
|
|
401
|
-
questions: string[];
|
|
402
|
-
trace: {
|
|
403
|
-
ref: string;
|
|
404
|
-
caption?: string | undefined;
|
|
405
|
-
}[];
|
|
406
|
-
effects: {
|
|
407
|
-
target: string;
|
|
408
|
-
as: "flow" | "attention" | "hot-path" | "slow" | "failing" | "blocked";
|
|
409
|
-
tone?: string | undefined;
|
|
410
|
-
}[];
|
|
411
|
-
badges: {
|
|
412
|
-
target: string;
|
|
413
|
-
text: string;
|
|
414
|
-
tone?: string | undefined;
|
|
415
|
-
}[];
|
|
416
|
-
question?: string | undefined;
|
|
417
|
-
}[];
|
|
418
|
-
id: string;
|
|
419
|
-
kind: "change" | "tour";
|
|
420
|
-
summary: string;
|
|
421
|
-
title: string;
|
|
422
|
-
removed: {
|
|
423
|
-
transitions: {
|
|
424
|
-
stateMachine: string;
|
|
425
|
-
transition: {
|
|
426
|
-
id: string;
|
|
427
|
-
event: string;
|
|
428
|
-
from: string;
|
|
429
|
-
to: string;
|
|
430
|
-
actions: string[];
|
|
431
|
-
description?: string | undefined;
|
|
432
|
-
guard?: string | undefined;
|
|
433
|
-
triggeredBy?: string | undefined;
|
|
434
|
-
};
|
|
435
|
-
}[];
|
|
436
|
-
entities: {
|
|
437
|
-
id: string;
|
|
438
|
-
kind: string;
|
|
439
|
-
name: string;
|
|
440
|
-
summary: string;
|
|
441
|
-
tags: string[];
|
|
442
|
-
sourceRefs: {
|
|
443
|
-
path: string;
|
|
444
|
-
symbol?: string | undefined;
|
|
445
|
-
line?: number | undefined;
|
|
446
|
-
repository?: string | undefined;
|
|
447
|
-
}[];
|
|
448
|
-
metadata: Record<string, string | number | boolean>;
|
|
449
|
-
ext: Record<string, unknown>;
|
|
450
|
-
description?: string | undefined;
|
|
451
|
-
parent?: string | undefined;
|
|
452
|
-
technology?: string | undefined;
|
|
453
|
-
}[];
|
|
454
|
-
relationships: {
|
|
455
|
-
id: string;
|
|
456
|
-
kind: string;
|
|
457
|
-
metadata: Record<string, string | number | boolean>;
|
|
458
|
-
ext: Record<string, unknown>;
|
|
459
|
-
source: string;
|
|
460
|
-
target: string;
|
|
461
|
-
label: string;
|
|
462
|
-
data: string[];
|
|
463
|
-
description?: string | undefined;
|
|
464
|
-
protocol?: string | undefined;
|
|
465
|
-
}[];
|
|
466
|
-
};
|
|
467
|
-
story: {
|
|
468
|
-
text: string;
|
|
469
|
-
before?: string | undefined;
|
|
470
|
-
after?: string | undefined;
|
|
471
|
-
};
|
|
472
|
-
marks: {
|
|
473
|
-
state: "new" | "changed" | "removed";
|
|
474
|
-
ref: string;
|
|
475
|
-
note?: string | undefined;
|
|
476
|
-
}[];
|
|
477
|
-
source?: {
|
|
478
|
-
kind: string;
|
|
479
|
-
repository?: string | undefined;
|
|
480
|
-
head?: string | undefined;
|
|
481
|
-
removed?: number | undefined;
|
|
482
|
-
ref?: string | undefined;
|
|
483
|
-
url?: string | undefined;
|
|
484
|
-
base?: string | undefined;
|
|
485
|
-
author?: string | undefined;
|
|
486
|
-
files?: number | undefined;
|
|
487
|
-
added?: number | undefined;
|
|
488
|
-
} | undefined;
|
|
489
|
-
verdict?: {
|
|
490
|
-
risk: "look" | "routine";
|
|
491
|
-
facts: {
|
|
492
|
-
value: string;
|
|
493
|
-
label: string;
|
|
494
|
-
}[];
|
|
495
|
-
findings: {
|
|
496
|
-
text: string;
|
|
497
|
-
severity: "note" | "risk";
|
|
498
|
-
scene?: string | undefined;
|
|
499
|
-
}[];
|
|
500
|
-
} | undefined;
|
|
501
|
-
};
|
|
502
|
-
viewId: string;
|
|
503
|
-
focus: string[];
|
|
504
|
-
callouts: string[];
|
|
505
|
-
notes: string[];
|
|
506
|
-
title: string;
|
|
507
|
-
scene: {
|
|
508
|
-
view: string | undefined;
|
|
509
|
-
code: {
|
|
510
|
-
hunks: {
|
|
511
|
-
lines: {
|
|
512
|
-
kind: "add" | "del" | "ctx";
|
|
513
|
-
text: string;
|
|
514
|
-
new?: number | undefined;
|
|
515
|
-
old?: number | undefined;
|
|
516
|
-
}[];
|
|
517
|
-
header?: string | undefined;
|
|
518
|
-
}[];
|
|
519
|
-
path: string;
|
|
520
|
-
notes: {
|
|
521
|
-
line: number;
|
|
522
|
-
text: string;
|
|
523
|
-
}[];
|
|
524
|
-
title?: string | undefined;
|
|
525
|
-
}[];
|
|
526
|
-
id: string;
|
|
527
|
-
title: string;
|
|
528
|
-
text: string;
|
|
529
|
-
risk: "look" | "routine";
|
|
530
|
-
focus: string[];
|
|
531
|
-
callouts: {
|
|
532
|
-
target: string;
|
|
533
|
-
text: string;
|
|
534
|
-
}[];
|
|
535
|
-
cases: {
|
|
536
|
-
then: string;
|
|
537
|
-
when: string;
|
|
538
|
-
note?: string | undefined;
|
|
539
|
-
}[];
|
|
540
|
-
proof: {
|
|
541
|
-
text: string;
|
|
542
|
-
missing: boolean;
|
|
543
|
-
source?: string | undefined;
|
|
544
|
-
test?: string | undefined;
|
|
545
|
-
}[];
|
|
546
|
-
questions: string[];
|
|
547
|
-
trace: {
|
|
548
|
-
ref: string;
|
|
549
|
-
caption?: string | undefined;
|
|
550
|
-
}[];
|
|
551
|
-
effects: {
|
|
552
|
-
target: string;
|
|
553
|
-
as: "flow" | "attention" | "hot-path" | "slow" | "failing" | "blocked";
|
|
554
|
-
tone?: string | undefined;
|
|
555
|
-
}[];
|
|
556
|
-
badges: {
|
|
557
|
-
target: string;
|
|
558
|
-
text: string;
|
|
559
|
-
tone?: string | undefined;
|
|
560
|
-
}[];
|
|
561
|
-
question?: string | undefined;
|
|
562
|
-
};
|
|
563
|
-
} | undefined;
|
|
564
|
-
|
|
565
|
-
/**
|
|
566
|
-
* The colour tokens, by name: `--poney-<name>` in CSS (styles/tokens.css,
|
|
567
|
-
* which a test keeps equal to this table), and these values where CSS
|
|
568
|
-
* variables cannot be resolved (static SVG, PNG).
|
|
569
|
-
*/
|
|
570
|
-
declare const THEMES: {
|
|
571
|
-
readonly light: {
|
|
572
|
-
readonly plaster: "#eef0ec";
|
|
573
|
-
readonly paper: "#fbfbf9";
|
|
574
|
-
readonly 'paper-raised': "#ffffff";
|
|
575
|
-
readonly sunken: "#e5e8e3";
|
|
576
|
-
readonly ink: "#1d2230";
|
|
577
|
-
readonly 'ink-2': "#4e5566";
|
|
578
|
-
readonly 'ink-3': "#848a97";
|
|
579
|
-
readonly 'ink-4': "#b3b8c1";
|
|
580
|
-
readonly rule: "#dcdfd8";
|
|
581
|
-
readonly 'rule-strong': "#c8ccc4";
|
|
582
|
-
readonly accent: "#b24a32";
|
|
583
|
-
readonly 'accent-wash': "#f7ebe7";
|
|
584
|
-
readonly 'accent-ring': "#b24a3240";
|
|
585
|
-
readonly lapis: "#3a5a9e";
|
|
586
|
-
readonly malachite: "#2e7656";
|
|
587
|
-
readonly ochre: "#a8761c";
|
|
588
|
-
readonly umber: "#7d5a43";
|
|
589
|
-
readonly tyrian: "#7a4a88";
|
|
590
|
-
readonly slate: "#56627a";
|
|
591
|
-
readonly verdigris: "#26807f";
|
|
592
|
-
readonly success: "#2e7656";
|
|
593
|
-
readonly failure: "#9c3554";
|
|
594
|
-
readonly new: "#1d8a4e";
|
|
595
|
-
readonly 'new-wash': "#ecf8f0";
|
|
596
|
-
readonly changed: "#b86e0b";
|
|
597
|
-
readonly 'changed-wash': "#fdf5e6";
|
|
598
|
-
readonly removed: "#c03550";
|
|
599
|
-
readonly 'removed-wash': "#fcf0f2";
|
|
600
|
-
readonly 'story-node': "#ffffff";
|
|
601
|
-
readonly 'story-line': "#8c939e";
|
|
602
|
-
readonly 'story-rule': "#d7dade";
|
|
603
|
-
};
|
|
604
|
-
readonly dark: {
|
|
605
|
-
readonly plaster: "#15181e";
|
|
606
|
-
readonly paper: "#1b1f27";
|
|
607
|
-
readonly 'paper-raised': "#212631";
|
|
608
|
-
readonly sunken: "#12151a";
|
|
609
|
-
readonly ink: "#e6e8ec";
|
|
610
|
-
readonly 'ink-2': "#aeb4c0";
|
|
611
|
-
readonly 'ink-3': "#7c8391";
|
|
612
|
-
readonly 'ink-4': "#535a67";
|
|
613
|
-
readonly rule: "#2a2f39";
|
|
614
|
-
readonly 'rule-strong': "#3a404c";
|
|
615
|
-
readonly accent: "#e2765b";
|
|
616
|
-
readonly 'accent-wash': "#3a2621";
|
|
617
|
-
readonly 'accent-ring': "#e2765b4d";
|
|
618
|
-
readonly lapis: "#7f9ce0";
|
|
619
|
-
readonly malachite: "#5fb68d";
|
|
620
|
-
readonly ochre: "#d6a64c";
|
|
621
|
-
readonly umber: "#c19a7f";
|
|
622
|
-
readonly tyrian: "#b98ac8";
|
|
623
|
-
readonly slate: "#98a3b9";
|
|
624
|
-
readonly verdigris: "#58bcba";
|
|
625
|
-
readonly success: "#5fb68d";
|
|
626
|
-
readonly failure: "#e07a98";
|
|
627
|
-
readonly new: "#4fc887";
|
|
628
|
-
readonly 'new-wash': "#15281f";
|
|
629
|
-
readonly changed: "#e3a54a";
|
|
630
|
-
readonly 'changed-wash': "#2b2416";
|
|
631
|
-
readonly removed: "#ef7f97";
|
|
632
|
-
readonly 'removed-wash': "#2e1a20";
|
|
633
|
-
readonly 'story-node': "#1f242d";
|
|
634
|
-
readonly 'story-line': "#7d8592";
|
|
635
|
-
readonly 'story-rule': "#363c48";
|
|
636
|
-
};
|
|
637
|
-
};
|
|
638
|
-
type ThemeName = keyof typeof THEMES;
|
|
639
|
-
/** The font tokens, --poney-font-sans and --poney-font-mono. */
|
|
640
|
-
declare const FONTS: {
|
|
641
|
-
readonly sans: "'Hanken Grotesk Variable', 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif";
|
|
642
|
-
readonly mono: "'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, monospace";
|
|
643
|
-
};
|
|
644
|
-
|
|
645
|
-
/** Icons a presentation may name. Kept explicit so the bundle stays small. */
|
|
646
|
-
declare const ICONS: Record<string, LucideIcon>;
|
|
647
|
-
declare function iconFor(name: string): LucideIcon;
|
|
648
|
-
/** An icon positioned inside SVG. */
|
|
649
|
-
declare function Glyph({ name, x, y, size, color, strokeWidth }: {
|
|
650
|
-
name: string;
|
|
651
|
-
x: number;
|
|
652
|
-
y: number;
|
|
653
|
-
size?: number;
|
|
654
|
-
color?: string;
|
|
655
|
-
strokeWidth?: number;
|
|
656
|
-
}): react.JSX.Element;
|
|
657
|
-
|
|
658
|
-
/** Named pigments map to theme variables (--poney-<name>; the tone "poney" is --poney-accent); hex colors pass through. */
|
|
659
|
-
declare const toneColor: (tone: Tone | string) => string;
|
|
660
|
-
/** A pale wash of a tone over paper, for fills. */
|
|
661
|
-
declare const toneWash: (tone: Tone | string, amount?: number) => string;
|
|
662
|
-
|
|
663
|
-
/** Draws a map scene in the crisp story style. */
|
|
664
|
-
declare function MapStory({ scene, extra }: {
|
|
665
|
-
scene: MapScene;
|
|
666
|
-
extra?: Entity[];
|
|
667
|
-
}): react.JSX.Element;
|
|
668
|
-
|
|
669
|
-
/** Draws a sequence scene in the crisp story style. */
|
|
670
|
-
declare function SequenceStory({ scene }: {
|
|
671
|
-
scene: SequenceScene;
|
|
672
|
-
}): react.JSX.Element;
|
|
673
|
-
|
|
674
|
-
/** Draws a state machine scene in the crisp story style. */
|
|
675
|
-
declare function StateStory({ scene }: {
|
|
676
|
-
scene: StateScene;
|
|
677
|
-
}): react.JSX.Element;
|
|
678
|
-
|
|
679
|
-
/** Draws a map, sequence or state scene in the story style, with its effects, badges and trace. */
|
|
680
|
-
declare function SceneStory({ view, scene, extra }: {
|
|
37
|
+
/** The drawn tree as React elements. */
|
|
38
|
+
declare function toReact(nodes: D.Resolved[]): ReactNode[];
|
|
39
|
+
/** A Poney component as a React component. */
|
|
40
|
+
declare function reactComponent<P extends object>(component: D.Component<P>, name?: string): FC<P>;
|
|
41
|
+
declare const SceneStory: FC<{
|
|
681
42
|
view: View;
|
|
682
|
-
scene: SceneBase;
|
|
683
|
-
extra?: Entity[];
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
d: string;
|
|
698
|
-
at(t: number): Point & {
|
|
699
|
-
angle: number;
|
|
700
|
-
};
|
|
701
|
-
/** Where a step mark sits, clear of the label. */
|
|
702
|
-
stepAt: number;
|
|
703
|
-
/** Where a badge sits: under the line's label when it has one. */
|
|
704
|
-
badge: Point;
|
|
705
|
-
/** Where a sign (slow, failing, blocked) sits: after the label when it has one. */
|
|
706
|
-
sign: Point;
|
|
707
|
-
}
|
|
708
|
-
/** The shape of every line in a scene, by ref key. Boxes come from the scene's anchors. */
|
|
709
|
-
declare function sceneLines(scene: SceneBase, view: View): Map<string, LineShape>;
|
|
710
|
-
/** Bands under lines: drawn before the scene, so they never cover a label. */
|
|
711
|
-
declare function EmphasisUnder({ scene, view }: {
|
|
712
|
-
scene: SceneBase;
|
|
43
|
+
scene: _hattoriai_poney_layout.SceneBase;
|
|
44
|
+
extra?: _hattoriai_poney_core.Entity[];
|
|
45
|
+
}>;
|
|
46
|
+
declare const MapStory: FC<{
|
|
47
|
+
scene: _hattoriai_poney_layout.MapScene;
|
|
48
|
+
extra?: _hattoriai_poney_core.Entity[];
|
|
49
|
+
}>;
|
|
50
|
+
declare const SequenceStory: FC<{
|
|
51
|
+
scene: _hattoriai_poney_layout.SequenceScene;
|
|
52
|
+
}>;
|
|
53
|
+
declare const StateStory: FC<{
|
|
54
|
+
scene: _hattoriai_poney_layout.StateScene;
|
|
55
|
+
}>;
|
|
56
|
+
declare const EmphasisOver: FC<{
|
|
57
|
+
scene: _hattoriai_poney_layout.SceneBase;
|
|
713
58
|
view: View;
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
scene: SceneBase;
|
|
59
|
+
}>;
|
|
60
|
+
declare const EmphasisUnder: FC<{
|
|
61
|
+
scene: _hattoriai_poney_layout.SceneBase;
|
|
718
62
|
view: View;
|
|
719
|
-
}
|
|
720
|
-
/**
|
|
721
|
-
declare
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
* its host (RenderProvider) the selection, the hover and the view's state.
|
|
727
|
-
*/
|
|
728
|
-
interface DiagramModule<V extends View = View, S extends SceneBase = SceneBase> {
|
|
729
|
-
/** "architecture", "sequence"… or "<extension>/<view>" for extension views. */
|
|
730
|
-
key: string;
|
|
731
|
-
label: string;
|
|
63
|
+
}>;
|
|
64
|
+
/** A Poney icon as a Lucide React component. */
|
|
65
|
+
declare function reactIcon(icon: D.IconData): LucideIcon;
|
|
66
|
+
/** The icon a presentation names, as a React component. */
|
|
67
|
+
declare const iconFor: (name: string) => LucideIcon;
|
|
68
|
+
/** A diagram type for React: its icon, renderer and key are React components. */
|
|
69
|
+
interface ReactDiagramModule<V extends View = View> extends Omit<D.DiagramModule<V>, 'icon' | 'Renderer' | 'Legend'> {
|
|
732
70
|
icon: LucideIcon;
|
|
733
|
-
/** How to read this kind of diagram, in one or two sentences. */
|
|
734
|
-
howToRead: string;
|
|
735
71
|
Renderer: FC<{
|
|
736
|
-
scene:
|
|
72
|
+
scene: any;
|
|
737
73
|
view: V;
|
|
738
74
|
}>;
|
|
739
|
-
/** How a host should first frame this diagram: all of it, or its start (e.g. the top of a long sequence). */
|
|
740
|
-
initialView?: 'fit' | 'start';
|
|
741
|
-
/** Key to the symbols, for a host to show next to the diagram. */
|
|
742
75
|
Legend?: FC<{
|
|
743
76
|
view: V;
|
|
744
77
|
}>;
|
|
745
78
|
}
|
|
746
|
-
|
|
747
|
-
declare
|
|
748
|
-
|
|
749
|
-
/** The core diagram types. Extensions add theirs with registerDiagram. */
|
|
750
|
-
declare const BUILT_IN_DIAGRAMS: AnyDiagramModule[];
|
|
751
|
-
/** Adds (or replaces) the renderer for a view type, e.g. an extension's "ownership/team-map". */
|
|
752
|
-
declare function registerDiagram(module: AnyDiagramModule): void;
|
|
753
|
-
/** The renderer for a view, if one is registered. */
|
|
754
|
-
declare function diagramFor(view: View): AnyDiagramModule | undefined;
|
|
755
|
-
declare function diagramByKey(key: string): AnyDiagramModule | undefined;
|
|
756
|
-
|
|
757
|
-
/**
|
|
758
|
-
* Semantic zoom: the font size, in diagram units, that keeps text at least
|
|
759
|
-
* `screen` pixels tall on screen, in steps so layouts can be cached.
|
|
760
|
-
*/
|
|
761
|
-
declare function useReadableSize(base: number, screen?: number, max?: number): number;
|
|
762
|
-
type Emphasis = 'normal' | 'selected' | 'dim';
|
|
763
|
-
interface Props {
|
|
764
|
-
entity: Entity;
|
|
765
|
-
style: ResolvedStyle;
|
|
766
|
-
w: number;
|
|
767
|
-
h: number;
|
|
768
|
-
emphasis: Emphasis;
|
|
769
|
-
/** Show the summary text (level of detail). */
|
|
770
|
-
detail: boolean;
|
|
771
|
-
/** Footer text, for example "17 parts inside". */
|
|
772
|
-
footer?: string;
|
|
773
|
-
}
|
|
774
|
-
/** Selection ring and keyboard focus ring around a node box. */
|
|
775
|
-
declare function Rings({ w, h, rx, selected }: {
|
|
776
|
-
w: number;
|
|
777
|
-
h: number;
|
|
778
|
-
rx?: number;
|
|
779
|
-
selected: boolean;
|
|
780
|
-
}): react.JSX.Element;
|
|
781
|
-
/**
|
|
782
|
-
* The visual treatment of one entity, by shape: card, cylinder (stores),
|
|
783
|
-
* stack (queues), person, chip (code modules) and frame (a closed system).
|
|
784
|
-
* Drawn at the origin; the caller positions it.
|
|
785
|
-
*/
|
|
786
|
-
declare function EntityNode({ entity, style, w, h, emphasis, detail, footer }: Props): react.JSX.Element;
|
|
787
|
-
|
|
788
|
-
type Head = 'arrow' | 'open-arrow' | 'triangle' | 'none';
|
|
789
|
-
interface EdgeStyle {
|
|
790
|
-
color: string;
|
|
791
|
-
width: number;
|
|
792
|
-
dash?: string;
|
|
793
|
-
head: Head;
|
|
794
|
-
tail?: Head;
|
|
795
|
-
opacity?: number;
|
|
796
|
-
flowing?: boolean;
|
|
797
|
-
}
|
|
798
|
-
/** A routed edge with an invisible wide hit area for easy pointing. */
|
|
799
|
-
declare function EdgeLine({ points, style, radius }: {
|
|
800
|
-
points: Point[];
|
|
801
|
-
style: EdgeStyle;
|
|
802
|
-
radius?: number;
|
|
803
|
-
}): react.JSX.Element;
|
|
804
|
-
/** A label pill centered on a point. */
|
|
805
|
-
declare function EdgeLabel({ at, text, secondary, tone, strong, size, }: {
|
|
806
|
-
at: Point;
|
|
807
|
-
text: string;
|
|
808
|
-
secondary?: string;
|
|
809
|
-
tone?: string;
|
|
810
|
-
strong?: boolean;
|
|
811
|
-
size?: number;
|
|
812
|
-
}): react.JSX.Element;
|
|
813
|
-
|
|
814
|
-
/** A miniature of a node shape with its label, for diagram keys. */
|
|
815
|
-
declare function LegendShape({ shape, tone, label, dashed }: {
|
|
816
|
-
shape: string;
|
|
817
|
-
tone: string;
|
|
818
|
-
label: string;
|
|
819
|
-
dashed?: boolean;
|
|
820
|
-
}): react.JSX.Element;
|
|
821
|
-
/** A line sample with its label. */
|
|
822
|
-
declare function LegendRow({ line, label, color, head }: {
|
|
823
|
-
line: 'solid' | 'dashed' | 'dotted';
|
|
824
|
-
label: string;
|
|
825
|
-
color?: string;
|
|
826
|
-
head?: boolean;
|
|
827
|
-
}): react.JSX.Element;
|
|
79
|
+
/** The renderer for a view, if one is registered, as React components. */
|
|
80
|
+
declare function diagramFor(view: View): ReactDiagramModule | undefined;
|
|
81
|
+
declare function diagramByKey(key: string): ReactDiagramModule | undefined;
|
|
828
82
|
|
|
829
|
-
export { type
|
|
83
|
+
export { type BindFn, type BindProps, EmphasisOver, EmphasisUnder, MapStory, type ReactDiagramModule, RenderProvider, type RenderValue, SceneStory, SequenceStory, StateStory, StoryProvider, ZoomProvider, diagramByKey, diagramFor, iconFor, reactComponent, reactIcon, toReact, useRenderZoom };
|