@johnoscott/isometric-engine 0.0.0-stage → 0.10.1
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/EDITOR-GUIDE.md +355 -0
- package/LICENSE +21 -0
- package/LICENSES/ajv.txt +22 -0
- package/LICENSES/lucide-static.txt +43 -0
- package/LICENSES/yaml.txt +13 -0
- package/README.md +62 -2
- package/assets/app.css +269 -0
- package/assets/default-theme.yaml +99 -0
- package/assets/icons.svg +1 -0
- package/assets/marks.css +39 -0
- package/assets/skin.css +181 -0
- package/iso-editor.d.ts +4 -0
- package/iso-editor.js +550 -0
- package/iso-render.d.ts +3 -0
- package/iso-render.js +388 -0
- package/iso-systems.d.ts +4 -0
- package/iso-systems.js +389 -0
- package/js/iso-core/compile-schema.js +22 -0
- package/js/iso-core/depth.js +55 -0
- package/js/iso-core/errors.js +65 -0
- package/js/iso-core/glyphs.js +100 -0
- package/js/iso-core/index.js +55 -0
- package/js/iso-core/kernel.js +158 -0
- package/js/iso-core/metrics.json +1 -0
- package/js/iso-core/package.json +6 -0
- package/js/iso-core/parse.js +79 -0
- package/js/iso-core/schema-errors.js +170 -0
- package/js/iso-core/shims/crypto.js +125 -0
- package/js/iso-core/shims/path.js +49 -0
- package/js/iso-core/svg-dom.js +144 -0
- package/js/iso-core/theme.js +48 -0
- package/js/iso-core/vdom.js +48 -0
- package/js/iso-editor/adapter.js +0 -0
- package/js/iso-editor/clipboard.js +152 -0
- package/js/iso-editor/commands.js +173 -0
- package/js/iso-editor/complete.js +55 -0
- package/js/iso-editor/doc.js +182 -0
- package/js/iso-editor/index.js +105 -0
- package/js/iso-editor/model.js +210 -0
- package/js/iso-editor/outline.js +111 -0
- package/js/iso-editor/package.json +6 -0
- package/js/iso-editor/path.js +19 -0
- package/js/iso-editor/providers.js +96 -0
- package/js/iso-editor/schema-nav.js +117 -0
- package/js/iso-editor/splice.js +443 -0
- package/js/iso-editor/storage-keys.js +6 -0
- package/js/iso-editor/ui/actions.js +116 -0
- package/js/iso-editor/ui/canvas-layer.js +0 -0
- package/js/iso-editor/ui/canvas.js +1403 -0
- package/js/iso-editor/ui/clip.js +133 -0
- package/js/iso-editor/ui/dialog.js +26 -0
- package/js/iso-editor/ui/flat-canvas.js +54 -0
- package/js/iso-editor/ui/icons.js +15 -0
- package/js/iso-editor/ui/keys.js +26 -0
- package/js/iso-editor/ui/later.js +28 -0
- package/js/iso-editor/ui/layer.js +11 -0
- package/js/iso-editor/ui/menu.js +105 -0
- package/js/iso-editor/ui/monaco-entry.js +2 -0
- package/js/iso-editor/ui/mount-kit.js +0 -0
- package/js/iso-editor/ui/mount.js +767 -0
- package/js/iso-editor/ui/pane.js +0 -0
- package/js/iso-editor/ui/part.js +0 -0
- package/js/iso-editor/ui/plain-icons.js +34 -0
- package/js/iso-editor/ui/props.js +314 -0
- package/js/iso-editor/ui/scope-css.js +81 -0
- package/js/iso-editor/ui/setup.js +149 -0
- package/js/iso-editor/ui/text.js +323 -0
- package/js/iso-editor/ui/tree.js +728 -0
- package/js/iso-editor/validate.js +33 -0
- package/js/iso-editor/window/protocol.js +8 -0
- package/js/iso-objects/assemble.js +43 -0
- package/js/iso-objects/assets.js +88 -0
- package/js/iso-objects/board.js +162 -0
- package/js/iso-objects/compile.js +60 -0
- package/js/iso-objects/css.js +154 -0
- package/js/iso-objects/flat.js +696 -0
- package/js/iso-objects/focus.js +16 -0
- package/js/iso-objects/geometry.js +76 -0
- package/js/iso-objects/index.js +93 -0
- package/js/iso-objects/kinds.js +12 -0
- package/js/iso-objects/labels.js +325 -0
- package/js/iso-objects/package.json +6 -0
- package/js/iso-objects/place.js +347 -0
- package/js/iso-objects/route.js +461 -0
- package/js/iso-objects/scene.js +350 -0
- package/js/iso-objects/steps.js +246 -0
- package/js/iso-objects/types.js +0 -0
- package/js/iso-systems/catalog.js +42 -0
- package/js/iso-systems/compile.js +34 -0
- package/js/iso-systems/css.js +8 -0
- package/js/iso-systems/index.js +16 -0
- package/js/iso-systems/nodes.js +124 -0
- package/js/iso-systems/package.json +6 -0
- package/js/iso-systems/schema.json +311 -0
- package/js/iso-systems/validate.js +35 -0
- package/js/iso-viewer/bundle.js +20 -0
- package/js/iso-viewer/card-motion.js +228 -0
- package/js/iso-viewer/dom.js +14 -0
- package/js/iso-viewer/dual-view.js +212 -0
- package/js/iso-viewer/flat-view.js +124 -0
- package/js/iso-viewer/history.js +990 -0
- package/js/iso-viewer/index.js +98 -0
- package/js/iso-viewer/morph.js +192 -0
- package/js/iso-viewer/overlay.js +199 -0
- package/js/iso-viewer/package.json +6 -0
- package/js/iso-viewer/page.js +138 -0
- package/js/iso-viewer/player.js +409 -0
- package/js/iso-viewer/still.js +81 -0
- package/js/iso-viewer/timeline-contract.js +14 -0
- package/js/iso-viewer/timeline-engine.js +475 -0
- package/js/iso-viewer/timeline-export.js +36 -0
- package/js/iso-viewer/timeline-scale.js +116 -0
- package/js/iso-viewer/timeline-scope.js +58 -0
- package/js/iso-viewer/timeline-search.js +216 -0
- package/js/iso-viewer/timeline-time.js +55 -0
- package/js/iso-viewer/view-css.js +68 -0
- package/js/iso-viewer/viewport.js +177 -0
- package/package.json +511 -4
- package/src/iso-core/compile-schema.ts +23 -0
- package/src/iso-core/depth.ts +56 -0
- package/src/iso-core/errors.ts +73 -0
- package/src/iso-core/glyphs.ts +108 -0
- package/src/iso-core/index.ts +27 -0
- package/src/iso-core/kernel.ts +163 -0
- package/src/iso-core/metrics.json +1 -0
- package/src/iso-core/package.json +6 -0
- package/src/iso-core/parse.ts +91 -0
- package/src/iso-core/schema-errors.ts +163 -0
- package/src/iso-core/shims/crypto.ts +37 -0
- package/src/iso-core/shims/path.ts +24 -0
- package/src/iso-core/svg-dom.ts +103 -0
- package/src/iso-core/theme.ts +64 -0
- package/src/iso-core/vdom.ts +41 -0
- package/src/iso-editor/adapter.ts +147 -0
- package/src/iso-editor/clipboard.ts +163 -0
- package/src/iso-editor/commands.ts +191 -0
- package/src/iso-editor/complete.ts +73 -0
- package/src/iso-editor/doc.ts +207 -0
- package/src/iso-editor/index.ts +67 -0
- package/src/iso-editor/model.ts +234 -0
- package/src/iso-editor/outline.ts +126 -0
- package/src/iso-editor/package.json +6 -0
- package/src/iso-editor/path.ts +18 -0
- package/src/iso-editor/providers.ts +113 -0
- package/src/iso-editor/schema-nav.ts +129 -0
- package/src/iso-editor/splice.ts +477 -0
- package/src/iso-editor/storage-keys.ts +6 -0
- package/src/iso-editor/ui/actions.ts +119 -0
- package/src/iso-editor/ui/app.css +230 -0
- package/src/iso-editor/ui/canvas-layer.ts +56 -0
- package/src/iso-editor/ui/canvas.ts +1227 -0
- package/src/iso-editor/ui/clip.ts +97 -0
- package/src/iso-editor/ui/dialog.ts +25 -0
- package/src/iso-editor/ui/flat-canvas.ts +51 -0
- package/src/iso-editor/ui/icons.ts +21 -0
- package/src/iso-editor/ui/keys.ts +30 -0
- package/src/iso-editor/ui/later.ts +22 -0
- package/src/iso-editor/ui/layer.ts +7 -0
- package/src/iso-editor/ui/marks.css +39 -0
- package/src/iso-editor/ui/menu.ts +67 -0
- package/src/iso-editor/ui/monaco-entry.ts +6 -0
- package/src/iso-editor/ui/mount-kit.ts +35 -0
- package/src/iso-editor/ui/mount.ts +684 -0
- package/src/iso-editor/ui/pane.ts +45 -0
- package/src/iso-editor/ui/part.ts +45 -0
- package/src/iso-editor/ui/plain-icons.ts +83 -0
- package/src/iso-editor/ui/props.ts +347 -0
- package/src/iso-editor/ui/scope-css.ts +65 -0
- package/src/iso-editor/ui/setup.ts +153 -0
- package/src/iso-editor/ui/skin.css +181 -0
- package/src/iso-editor/ui/text.ts +262 -0
- package/src/iso-editor/ui/tree.ts +657 -0
- package/src/iso-editor/validate.ts +62 -0
- package/src/iso-editor/window/protocol.ts +33 -0
- package/src/iso-objects/assemble.ts +57 -0
- package/src/iso-objects/assets.ts +122 -0
- package/src/iso-objects/board.ts +169 -0
- package/src/iso-objects/compile.ts +76 -0
- package/src/iso-objects/css.ts +163 -0
- package/src/iso-objects/flat.ts +653 -0
- package/src/iso-objects/focus.ts +14 -0
- package/src/iso-objects/geometry.ts +86 -0
- package/src/iso-objects/index.ts +33 -0
- package/src/iso-objects/kinds.ts +56 -0
- package/src/iso-objects/labels.ts +310 -0
- package/src/iso-objects/package.json +6 -0
- package/src/iso-objects/place.ts +318 -0
- package/src/iso-objects/route.ts +444 -0
- package/src/iso-objects/scene.ts +376 -0
- package/src/iso-objects/steps.ts +234 -0
- package/src/iso-objects/types.ts +68 -0
- package/src/iso-systems/catalog.ts +31 -0
- package/src/iso-systems/compile.ts +39 -0
- package/src/iso-systems/css.ts +9 -0
- package/src/iso-systems/index.ts +12 -0
- package/src/iso-systems/nodes.ts +126 -0
- package/src/iso-systems/package.json +6 -0
- package/src/iso-systems/schema.json +311 -0
- package/src/iso-systems/validate.ts +34 -0
- package/src/iso-viewer/bundle.ts +15 -0
- package/src/iso-viewer/card-motion.ts +237 -0
- package/src/iso-viewer/dom.ts +13 -0
- package/src/iso-viewer/dual-view.ts +212 -0
- package/src/iso-viewer/flat-view.ts +127 -0
- package/src/iso-viewer/history.ts +781 -0
- package/src/iso-viewer/index.ts +40 -0
- package/src/iso-viewer/morph.ts +191 -0
- package/src/iso-viewer/overlay.ts +212 -0
- package/src/iso-viewer/package.json +6 -0
- package/src/iso-viewer/page.ts +150 -0
- package/src/iso-viewer/player.ts +321 -0
- package/src/iso-viewer/still.ts +74 -0
- package/src/iso-viewer/timeline-contract.ts +342 -0
- package/src/iso-viewer/timeline-engine.ts +420 -0
- package/src/iso-viewer/timeline-export.ts +31 -0
- package/src/iso-viewer/timeline-scale.ts +129 -0
- package/src/iso-viewer/timeline-scope.ts +56 -0
- package/src/iso-viewer/timeline-search.ts +198 -0
- package/src/iso-viewer/timeline-time.ts +54 -0
- package/src/iso-viewer/view-css.ts +59 -0
- package/src/iso-viewer/viewport.ts +142 -0
- package/types/iso-core/compile-schema.d.ts +11 -0
- package/types/iso-core/depth.d.ts +6 -0
- package/types/iso-core/errors.d.ts +24 -0
- package/types/iso-core/glyphs.d.ts +19 -0
- package/types/iso-core/index.d.ts +17 -0
- package/types/iso-core/kernel.d.ts +130 -0
- package/types/iso-core/metrics.json +1 -0
- package/types/iso-core/parse.d.ts +18 -0
- package/types/iso-core/schema-errors.d.ts +14 -0
- package/types/iso-core/shims/crypto.d.ts +9 -0
- package/types/iso-core/svg-dom.d.ts +15 -0
- package/types/iso-core/theme.d.ts +38 -0
- package/types/iso-core/vdom.d.ts +26 -0
- package/types/iso-editor/adapter.d.ts +178 -0
- package/types/iso-editor/clipboard.d.ts +23 -0
- package/types/iso-editor/commands.d.ts +32 -0
- package/types/iso-editor/complete.d.ts +25 -0
- package/types/iso-editor/doc.d.ts +50 -0
- package/types/iso-editor/index.d.ts +57 -0
- package/types/iso-editor/model.d.ts +96 -0
- package/types/iso-editor/outline.d.ts +28 -0
- package/types/iso-editor/path.d.ts +7 -0
- package/types/iso-editor/providers.d.ts +43 -0
- package/types/iso-editor/schema-nav.d.ts +34 -0
- package/types/iso-editor/splice.d.ts +53 -0
- package/types/iso-editor/storage-keys.d.ts +5 -0
- package/types/iso-editor/ui/actions.d.ts +23 -0
- package/types/iso-editor/ui/canvas-layer.d.ts +65 -0
- package/types/iso-editor/ui/canvas.d.ts +307 -0
- package/types/iso-editor/ui/clip.d.ts +14 -0
- package/types/iso-editor/ui/dialog.d.ts +7 -0
- package/types/iso-editor/ui/flat-canvas.d.ts +2 -0
- package/types/iso-editor/ui/icons.d.ts +5 -0
- package/types/iso-editor/ui/keys.d.ts +7 -0
- package/types/iso-editor/ui/later.d.ts +12 -0
- package/types/iso-editor/ui/layer.d.ts +2 -0
- package/types/iso-editor/ui/menu.d.ts +21 -0
- package/types/iso-editor/ui/mount-kit.d.ts +31 -0
- package/types/iso-editor/ui/mount.d.ts +146 -0
- package/types/iso-editor/ui/pane.d.ts +60 -0
- package/types/iso-editor/ui/part.d.ts +40 -0
- package/types/iso-editor/ui/plain-icons.d.ts +10 -0
- package/types/iso-editor/ui/props.d.ts +57 -0
- package/types/iso-editor/ui/scope-css.d.ts +5 -0
- package/types/iso-editor/ui/setup.d.ts +49 -0
- package/types/iso-editor/ui/text.d.ts +19 -0
- package/types/iso-editor/ui/tree.d.ts +100 -0
- package/types/iso-editor/validate.d.ts +36 -0
- package/types/iso-editor/window/protocol.d.ts +60 -0
- package/types/iso-objects/assemble.d.ts +35 -0
- package/types/iso-objects/assets.d.ts +49 -0
- package/types/iso-objects/board.d.ts +36 -0
- package/types/iso-objects/compile.d.ts +35 -0
- package/types/iso-objects/css.d.ts +16 -0
- package/types/iso-objects/flat.d.ts +130 -0
- package/types/iso-objects/focus.d.ts +1 -0
- package/types/iso-objects/geometry.d.ts +59 -0
- package/types/iso-objects/index.d.ts +26 -0
- package/types/iso-objects/kinds.d.ts +53 -0
- package/types/iso-objects/labels.d.ts +92 -0
- package/types/iso-objects/place.d.ts +25 -0
- package/types/iso-objects/route.d.ts +67 -0
- package/types/iso-objects/scene.d.ts +63 -0
- package/types/iso-objects/steps.d.ts +90 -0
- package/types/iso-objects/types.d.ts +140 -0
- package/types/iso-systems/catalog.d.ts +4 -0
- package/types/iso-systems/compile.d.ts +6 -0
- package/types/iso-systems/css.d.ts +3 -0
- package/types/iso-systems/index.d.ts +5 -0
- package/types/iso-systems/nodes.d.ts +3 -0
- package/types/iso-viewer/card-motion.d.ts +56 -0
- package/types/iso-viewer/dom.d.ts +1 -0
- package/types/iso-viewer/dual-view.d.ts +44 -0
- package/types/iso-viewer/flat-view.d.ts +25 -0
- package/types/iso-viewer/history.d.ts +91 -0
- package/types/iso-viewer/index.d.ts +31 -0
- package/types/iso-viewer/morph.d.ts +28 -0
- package/types/iso-viewer/overlay.d.ts +135 -0
- package/types/iso-viewer/page.d.ts +13 -0
- package/types/iso-viewer/still.d.ts +26 -0
- package/types/iso-viewer/timeline-contract.d.ts +345 -0
- package/types/iso-viewer/timeline-engine.d.ts +20 -0
- package/types/iso-viewer/timeline-export.d.ts +5 -0
- package/types/iso-viewer/timeline-scale.d.ts +44 -0
- package/types/iso-viewer/timeline-scope.d.ts +33 -0
- package/types/iso-viewer/timeline-search.d.ts +52 -0
- package/types/iso-viewer/timeline-time.d.ts +8 -0
- package/types/iso-viewer/view-css.d.ts +7 -0
- package/types/iso-viewer/viewport.d.ts +50 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// The diagram as the YAML says it (Raw*), and as layout resolves it (placed boxes in grid units).
|
|
2
|
+
|
|
3
|
+
import type { Box } from '../iso-core/kernel.ts';
|
|
4
|
+
import type { RawRole, RawKind, Theme } from '../iso-core/theme.ts';
|
|
5
|
+
|
|
6
|
+
export type { RawRole, RawKind, Theme };
|
|
7
|
+
|
|
8
|
+
export type Side = 'n' | 'e' | 's' | 'w';
|
|
9
|
+
export type StepRef = string | number;
|
|
10
|
+
|
|
11
|
+
export interface RawPlacement {
|
|
12
|
+
in?: string; at?: [number, number];
|
|
13
|
+
'right-of'?: string; 'left-of'?: string; below?: string; behind?: string;
|
|
14
|
+
gap?: number; align?: 'start' | 'center' | 'end'; shift?: [number, number];
|
|
15
|
+
appears?: StepRef; disappears?: StepRef;
|
|
16
|
+
}
|
|
17
|
+
export type RawDeco = string | { terminal?: number; icon?: string; screen?: string };
|
|
18
|
+
export interface RawNode extends RawPlacement {
|
|
19
|
+
id: string; asset?: string; role?: string; label?: string; sub?: string;
|
|
20
|
+
size?: number[]; z?: number; deco?: RawDeco[]; ghost?: boolean; face?: string; facing?: number;
|
|
21
|
+
'label-at'?: { side?: 'above' | 'right' | 'left' | 'below'; dx?: number; dy?: number };
|
|
22
|
+
nodes?: RawNode[];
|
|
23
|
+
}
|
|
24
|
+
export interface RawGate { side: Side; at?: number; width?: number; height?: number; node?: string }
|
|
25
|
+
export interface RawRegion extends RawPlacement {
|
|
26
|
+
id: string; kind: RegionKindName; label?: string; 'label-style'?: 'face' | 'face-right' | 'floor' | 'none'; ghost?: boolean;
|
|
27
|
+
role?: string; size?: number[]; padding?: number; height?: number; z?: number; flow?: 'row' | 'column';
|
|
28
|
+
gate?: RawGate; around?: string[]; regions?: RawRegion[]; nodes?: RawNode[];
|
|
29
|
+
}
|
|
30
|
+
export interface RawNote {
|
|
31
|
+
floor?: string; face?: string; label?: string; sub?: string; at?: number[]; on?: string; kind?: string;
|
|
32
|
+
dir?: 'x' | 'y'; anchor?: 'start' | 'middle' | 'end'; dx?: number; dy?: number; appears?: StepRef; disappears?: StepRef;
|
|
33
|
+
}
|
|
34
|
+
export interface RawScene {
|
|
35
|
+
id: string; title: string; caption?: string; aria?: string; gap?: number; flow?: 'row' | 'column';
|
|
36
|
+
regions?: RawRegion[]; nodes?: RawNode[]; routes?: unknown[]; notes?: RawNote[]; steps?: unknown[];
|
|
37
|
+
legend?: 'auto' | false | string[]; badges?: boolean; loop?: boolean; after?: string;
|
|
38
|
+
grid?: GridDef; assemble?: boolean; dim?: 'flows' | 'all';
|
|
39
|
+
}
|
|
40
|
+
export interface GridDef { snap?: number; show?: boolean; step?: number }
|
|
41
|
+
export interface RawDiagram {
|
|
42
|
+
isodiag: 1; title?: string; lede?: string; pills?: string[]; theme?: string;
|
|
43
|
+
roles?: Record<string, RawRole>; kinds?: Record<string, RawKind>; after?: string; footer?: string;
|
|
44
|
+
grid?: GridDef; assemble?: boolean;
|
|
45
|
+
scenes: RawScene[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** a region kind's name in the catalogue the drawing is laid out with (src/iso-objects/kinds.ts) */
|
|
49
|
+
export type RegionKindName = string;
|
|
50
|
+
|
|
51
|
+
/** Something placed: a region or a node, with its absolute box after layout. */
|
|
52
|
+
export interface Placed {
|
|
53
|
+
id: string;
|
|
54
|
+
type: 'region' | 'node';
|
|
55
|
+
/** JSON path into the source, for diagnostics */
|
|
56
|
+
path: string;
|
|
57
|
+
parent?: Placed;
|
|
58
|
+
children: Placed[];
|
|
59
|
+
box: Box;
|
|
60
|
+
/** the z its children stand on */
|
|
61
|
+
floor: number;
|
|
62
|
+
appears?: StepRef; disappears?: StepRef;
|
|
63
|
+
region?: RawRegion;
|
|
64
|
+
node?: RawNode;
|
|
65
|
+
/** set when another item (a walled region's gate) decides this item's box */
|
|
66
|
+
placedBy?: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// The systems pack's catalogue: the drawing format's region kinds (as they were drawn before kinds became data, R1
|
|
2
|
+
// S2: the same numbers, roles, label styles, legend rows and CSS), and its node kinds (nodes.ts).
|
|
3
|
+
|
|
4
|
+
import type { KindCatalog, RegionKind } from '../iso-objects/kinds.ts';
|
|
5
|
+
import { NODE_ASSETS } from './nodes.ts';
|
|
6
|
+
|
|
7
|
+
const FENCE_SWATCH = 'border-color:hsl(38 80% 45%);background:hsl(38 80% 55% / .2)';
|
|
8
|
+
|
|
9
|
+
/** in this order: the legend's automatic rows follow it (fence, then vm), and so does the kinds' CSS */
|
|
10
|
+
export const REGION_KINDS: Record<string, RegionKind> = {
|
|
11
|
+
slab: { shape: 'slab', pad: 1.2, z: [-0.8, 0.35], floor: true, role: 'slab', labelStyle: 'face' },
|
|
12
|
+
pad: { shape: 'block', pad: 0.6, z: [0, 0.2], floor: true, role: 'pad', labelStyle: 'floor' },
|
|
13
|
+
fence: {
|
|
14
|
+
shape: 'walled', pad: 0.7, z: [0, 0.8], floor: false, role: 'fence', labelStyle: 'face',
|
|
15
|
+
legend: { label: 'Fence', swatch: FENCE_SWATCH, box: true, auto: true },
|
|
16
|
+
css: '.fz{fill:var(--fence-text)!important;opacity:1!important}\n',
|
|
17
|
+
},
|
|
18
|
+
vm: {
|
|
19
|
+
shape: 'block', pad: 0.6, z: [0, 0.45], floor: true, role: 'sandbox', labelStyle: 'face',
|
|
20
|
+
legend: { label: 'Sandbox VM', swatch: 'border-color:hsl(170 35% 40%);background:hsl(170 40% 50% / .2)', box: true, auto: true },
|
|
21
|
+
},
|
|
22
|
+
platform: { shape: 'block', pad: 0.6, z: [0, 0.7], floor: true, role: 'server', labelStyle: 'face-right' },
|
|
23
|
+
cloud: { shape: 'cloud', pad: 0.8, z: [0, 0.2], floor: true, role: 'cloud', labelStyle: 'floor' },
|
|
24
|
+
zone: { shape: 'zone', pad: 0.5, z: [0, 0.005], floor: false, role: 'grey', labelStyle: 'floor' },
|
|
25
|
+
tunnel: {
|
|
26
|
+
shape: 'tunnel', pad: 0, z: [0, 0.8], floor: false, role: 'socket', labelStyle: 'none',
|
|
27
|
+
legend: { label: 'Tailscale tunnel', swatch: 'border-color:hsl(205 70% 50%);border-top-width:9px;opacity:.35', box: false, auto: false },
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const systems: KindCatalog = { regions: REGION_KINDS, nodes: NODE_ASSETS, defaultNode: 'block' };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// YAML text → validated, laid-out, rendered scenes. Pure: the caller supplies the theme text.
|
|
2
|
+
|
|
3
|
+
import { parse, type Parsed } from '../iso-core/parse.ts';
|
|
4
|
+
import { validateSchema } from './validate.ts';
|
|
5
|
+
import type { Diag } from '../iso-core/errors.ts';
|
|
6
|
+
import { place } from '../iso-objects/place.ts';
|
|
7
|
+
import { extendTheme, loadTheme } from '../iso-core/theme.ts';
|
|
8
|
+
import type { RawDiagram } from '../iso-objects/types.ts';
|
|
9
|
+
import { compileRaw, type Compiled } from '../iso-objects/compile.ts';
|
|
10
|
+
import { systems } from './catalog.ts';
|
|
11
|
+
export type { Compiled, CompiledScene } from '../iso-objects/compile.ts';
|
|
12
|
+
|
|
13
|
+
/** opts.snap overrides every scene's grid snap (the editor's snap control). */
|
|
14
|
+
export function compile(source: string, themeText: string, opts: { snap?: number } = {}): Compiled {
|
|
15
|
+
const parsed = parse(source);
|
|
16
|
+
const diags: Diag[] = [...parsed.diags];
|
|
17
|
+
if (diags.some(d => d.severity === 'error')) return { ok: false, diags, catalog: systems, scenes: [] };
|
|
18
|
+
const schemaDiags = validateSchema(parsed);
|
|
19
|
+
diags.push(...schemaDiags);
|
|
20
|
+
const doc = parsed.data as RawDiagram;
|
|
21
|
+
if (schemaDiags.length) {
|
|
22
|
+
// Still report the reference and layout problems, so an author sees them all in one round.
|
|
23
|
+
// The data may be malformed, so this is best effort, and nothing is rendered.
|
|
24
|
+
try {
|
|
25
|
+
const theme = extendTheme(loadTheme(themeText), doc.roles ?? {}, doc.kinds ?? {});
|
|
26
|
+
const bad = schemaDiags.map(d => d.path);
|
|
27
|
+
(Array.isArray(doc.scenes) ? doc.scenes : []).forEach((raw, i) => {
|
|
28
|
+
try {
|
|
29
|
+
const layout = place(raw, `/scenes/${i}`, parsed, theme, systems, doc.roles ?? {});
|
|
30
|
+
diags.push(...layout.diags.filter(d => !bad.some(b => d.path === b || d.path.startsWith(b + '/'))));
|
|
31
|
+
} catch { /* malformed scene: the schema errors say why */ }
|
|
32
|
+
});
|
|
33
|
+
} catch { /* malformed roles or kinds */ }
|
|
34
|
+
diags.sort((a, b) => a.line - b.line || a.col - b.col);
|
|
35
|
+
return { ok: false, diags, catalog: systems, scenes: [] };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return compileRaw(doc, themeText, systems, parsed, source, opts, diags);
|
|
39
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// The drawing's and a page's stylesheets with the systems pack's kinds in them, as one string each: what a host page
|
|
2
|
+
// and the editor's canvas embed.
|
|
3
|
+
|
|
4
|
+
import { drawingCss, baseCss } from '../iso-objects/css.ts';
|
|
5
|
+
import { systems } from './catalog.ts';
|
|
6
|
+
|
|
7
|
+
/** without any marks a host registers: for those, drawingCss(systems) / baseCss(systems) after registering */
|
|
8
|
+
export const DRAWING_CSS = drawingCss(systems);
|
|
9
|
+
export const BASE_CSS = baseCss(systems);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// iso-systems: the kind pack for drawing software systems (docs/editor/LAYERS.md §0.2, §2), beside the layers: the
|
|
2
|
+
// drawing format (its schema, reader and compile), its catalogue of region and node kinds, and the
|
|
3
|
+
// stylesheets with its kinds in them. It may use iso-core and iso-objects; the generic layers never use it.
|
|
4
|
+
//
|
|
5
|
+
// The pack's public API. Importers name the module a name comes from, as with the layers.
|
|
6
|
+
|
|
7
|
+
export { NODE_ASSETS, getAsset } from './nodes.ts';
|
|
8
|
+
export { REGION_KINDS, systems } from './catalog.ts';
|
|
9
|
+
export { DRAWING_CSS, BASE_CSS } from './css.ts';
|
|
10
|
+
export { validateSchema, schemaValidator } from './validate.ts';
|
|
11
|
+
export { compile } from './compile.ts';
|
|
12
|
+
export type { Compiled, CompiledScene } from './compile.ts';
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// The systems pack's node kinds: the drawing format's asset library. Each says its default size and colour role, how
|
|
2
|
+
// to draw itself in a box, where its label and pulse go. Adding one: write it here and add it to NODE_ASSETS. The
|
|
3
|
+
// factories and the NodeAsset shape are iso-objects' (src/iso-objects/assets.ts).
|
|
4
|
+
|
|
5
|
+
import { type Mat, type P3, iso, tag, S, center } from '../iso-core/kernel.ts';
|
|
6
|
+
import * as D from '../iso-core/glyphs.ts';
|
|
7
|
+
import { type NodeAsset, boxAsset, plate, drawCloud, facePainter } from '../iso-objects/assets.ts';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A drum: data that outlives what uses it (a Docker-style volume, a room's history, an archive). Its visible side is
|
|
11
|
+
* split where the shading changes, so it shades like a block; two bands mark it as storage.
|
|
12
|
+
*/
|
|
13
|
+
const volume: NodeAsset = {
|
|
14
|
+
name: 'volume', description: 'Stored data that is kept: a drum with two bands (a volume, a room\'s history, an archive).',
|
|
15
|
+
size: [1.8, 1.8, 1.3], role: 'folder',
|
|
16
|
+
draw(k, b) {
|
|
17
|
+
const [cx, cy] = center(b), r = Math.min(b.x1 - b.x0, b.y1 - b.y0) / 2;
|
|
18
|
+
const at = (deg: number, z: number): P3 => [cx + r * Math.cos(deg * Math.PI / 180), cy + r * Math.sin(deg * Math.PI / 180), z];
|
|
19
|
+
const arc = (a0: number, a1: number, z: number) => Array.from({ length: 13 }, (_, i) => at(a0 + (a1 - a0) * i / 12, z));
|
|
20
|
+
// the visible side runs from the right silhouette (-45°) through the front (45°) to the left one (135°)
|
|
21
|
+
const side = (a0: number, a1: number, cls: string) => k.poly([...arc(a0, a1, b.z0), ...arc(a0, a1, b.z1).reverse()], cls);
|
|
22
|
+
const h = b.z1 - b.z0;
|
|
23
|
+
const band = (z: number) => arc(-45, 135, z).slice(1).map((p, i, all) => k.line3(i ? all[i - 1] : at(-45, z), p, 'det')).join('');
|
|
24
|
+
return side(45, 135, 'lft') + side(-45, 45, 'rgt') + band(b.z0 + h * 0.36) + band(b.z0 + h * 0.68)
|
|
25
|
+
+ k.poly(Array.from({ length: 32 }, (_, i) => at(i * 360 / 32, b.z1)), 'top');
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const orb: NodeAsset = {
|
|
30
|
+
name: 'orb', description: 'An agent: a white sphere with two eyes, on a small plate.',
|
|
31
|
+
size: [1.5, 1.5, 1.6], role: 'lead', cls: 'orb',
|
|
32
|
+
draw(k, b) {
|
|
33
|
+
k.def('orbG', tag('radialGradient', { id: 'orbG', cx: '0.36', cy: '0.30', r: '0.80' },
|
|
34
|
+
tag('stop', { offset: '0', style: 'stop-color:#ffffff' }) + tag('stop', { offset: '0.62', style: 'stop-color:#f6f6f4' }) + tag('stop', { offset: '1', style: 'stop-color:#cfd0d6' })));
|
|
35
|
+
const p = plate(b);
|
|
36
|
+
const [px, py] = iso((b.x0 + b.x1) / 2, (b.y0 + b.y1) / 2, p.z1), R = 23, cy = py - R + 3;
|
|
37
|
+
k.bounds.add([px - R, cy - R]); k.bounds.add([px + R, cy + R]);
|
|
38
|
+
const eye = (dx: number, dy: number, w: number, h: number) =>
|
|
39
|
+
tag('rect', { class: 'eye', x: px + dx - w / 2, y: cy + dy - h / 2, width: w, height: h, rx: w / 2, transform: `rotate(-24 ${(px + dx).toFixed(1)} ${(cy + dy).toFixed(1)})` });
|
|
40
|
+
return k.blockFaces(p)
|
|
41
|
+
+ tag('ellipse', { class: 'shade', cx: px, cy: py + 1, rx: R * 0.8, ry: R * 0.3 })
|
|
42
|
+
+ tag('circle', { class: 'ball', cx: px, cy, r: R })
|
|
43
|
+
+ eye(3, -7, 6.4, 13.5) + eye(14, -12, 5.4, 10.5);
|
|
44
|
+
},
|
|
45
|
+
label(b, _n, hasSub) {
|
|
46
|
+
const [X, Y] = iso((b.x0 + b.x1) / 2, (b.y0 + b.y1) / 2, b.z0 + 1.95);
|
|
47
|
+
return { x: X, y: Y - 26 + (hasSub ? 0 : 14), anchor: 'middle' };
|
|
48
|
+
},
|
|
49
|
+
pulse: b => [(b.x0 + b.x1) / 2, (b.y0 + b.y1) / 2, b.z0 + 0.8, 26],
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const person: NodeAsset = {
|
|
53
|
+
name: 'person', description: 'A human: body and head on a small plate. The label sits to the right.',
|
|
54
|
+
size: [1.5, 1.5, 1.6], role: 'person', cls: 'person',
|
|
55
|
+
draw(k, b) {
|
|
56
|
+
const p = plate(b);
|
|
57
|
+
const [px, py] = iso((b.x0 + b.x1) / 2, (b.y0 + b.y1) / 2, p.z1);
|
|
58
|
+
k.bounds.add([px - 13, py - 50]);
|
|
59
|
+
const r = (v: number) => v.toFixed(1);
|
|
60
|
+
return k.blockFaces(p)
|
|
61
|
+
+ tag('path', { class: 'body', d: `M${r(px - 13)},${r(py - 4)} C${r(px - 13)},${r(py - 34)} ${r(px + 13)},${r(py - 34)} ${r(px + 13)},${r(py - 4)} Q${r(px)},${r(py + 4)} ${r(px - 13)},${r(py - 4)}z` })
|
|
62
|
+
+ tag('circle', { class: 'head', cx: px, cy: py - 40, r: 10 });
|
|
63
|
+
},
|
|
64
|
+
label(b) {
|
|
65
|
+
const [X, Y] = iso((b.x0 + b.x1) / 2, (b.y0 + b.y1) / 2, b.z0);
|
|
66
|
+
return { x: X + 30, y: Y + 2, anchor: 'start' };
|
|
67
|
+
},
|
|
68
|
+
pulse: b => [(b.x0 + b.x1) / 2, (b.y0 + b.y1) / 2, b.z0 + 0.9, 26],
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** An upright screen: a thin standing panel; its large face looks toward the front left (+y) unless turned. */
|
|
72
|
+
const screen: NodeAsset = {
|
|
73
|
+
name: 'screen', description: 'An upright screen or terminal panel. `face`: terminal, chat, desktop, tiles, or one the host registers. `facing`: turn in degrees.',
|
|
74
|
+
size: [1.64, 0.3, 1.75], role: 'term',
|
|
75
|
+
draw(k, b, n) {
|
|
76
|
+
const [cx, cy] = center(b), HW = (b.x1 - b.x0) / 2, PH = b.z1 - b.z0, T = 0.14;
|
|
77
|
+
const t = (n.facing ?? 0) * Math.PI / 180, tx = Math.cos(t), ty = Math.sin(t), nx = Math.sin(t) * T, ny = -Math.cos(t) * T;
|
|
78
|
+
const a: [number, number] = [cx - tx * HW, cy - ty * HW], bb: [number, number] = [cx + tx * HW, cy + ty * HW];
|
|
79
|
+
const z0 = b.z0, z1 = b.z1;
|
|
80
|
+
let s = k.poly([[bb[0], bb[1], z0], [bb[0] + nx, bb[1] + ny, z0], [bb[0] + nx, bb[1] + ny, z1], [bb[0], bb[1], z1]], 'rgt')
|
|
81
|
+
+ k.poly([[a[0], a[1], z1], [bb[0], bb[1], z1], [bb[0] + nx, bb[1] + ny, z1], [a[0] + nx, a[1] + ny, z1]], 'top')
|
|
82
|
+
+ k.poly([[a[0], a[1], z0], [bb[0], bb[1], z0], [bb[0], bb[1], z1], [a[0], a[1], z1]], 'lft');
|
|
83
|
+
const A = iso(a[0], a[1], z1), B = iso(bb[0], bb[1], z1), w = 2 * HW * S, h = PH * S;
|
|
84
|
+
const m: Mat = [(B[0] - A[0]) / w, (B[1] - A[1]) / w, 0, 1, A[0], A[1]];
|
|
85
|
+
const face = facePainter(n.face ?? 'terminal') ?? D.placeholderFace;
|
|
86
|
+
s += k.onMatrix(m, w, h, (W, H) => D.screenGlass(W, H) + face(W, H), 'scr');
|
|
87
|
+
return s;
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** A big block with the screen face on its front-left side: a desktop or a session window. */
|
|
92
|
+
const monitor: NodeAsset = {
|
|
93
|
+
name: 'monitor', description: 'A block with a screen painted on its front-left face. `face` as for screen.',
|
|
94
|
+
size: [2.4, 0.8, 1.8], role: 'term',
|
|
95
|
+
draw(k, b, n) {
|
|
96
|
+
const face = facePainter(n.face ?? 'terminal') ?? D.placeholderFace;
|
|
97
|
+
return k.blockFaces(b) + k.onFace(b, 'left', (w, h) => D.screenGlass(w, h) + face(w, h), 'scr');
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const cloud: NodeAsset = {
|
|
102
|
+
name: 'cloud', description: 'A cloud lying on the floor: the internet, or a hosted service.',
|
|
103
|
+
size: [3, 2.4, 0.3], role: 'cloud',
|
|
104
|
+
draw: (k, b) => drawCloud(k, b),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const NODE_ASSETS: Record<string, NodeAsset> = {
|
|
108
|
+
block: boxAsset('block', 'A box. Size and colour role are free; add decorations with `deco`.', [2.4, 2.4, 1.6], 'grey'),
|
|
109
|
+
session: boxAsset('session', 'An agent session: a box with terminal lines (`deco: [terminal: 4]`; add an icon the host registers with `icon: NAME`).', [2.6, 2.6, 1.8], 'work', [{ terminal: 4 }]),
|
|
110
|
+
terminal: boxAsset('terminal', 'A box with terminal lines on its front.', [1.6, 1.2, 0.8], 'term', [{ terminal: 2 }]),
|
|
111
|
+
server: boxAsset('server', 'A service or daemon: a low box with two terminal lines.', [3, 2.2, 0.9], 'doz', [{ terminal: 2 }]),
|
|
112
|
+
chat: boxAsset('chat', 'A chat server or room: a box with a chat bubble on top.', [3.6, 4.4, 1.3], 'chat', ['bubble']),
|
|
113
|
+
mailbox: boxAsset('mailbox', 'A room or inbox: terminal lines and an envelope on top.', [2.4, 2.4, 1.6], 'mail', [{ terminal: 3 }, 'envelope']),
|
|
114
|
+
file: boxAsset('file', 'A file or document: a low box with lines on top.', [1.6, 1.6, 0.6], 'file', ['file-lines']),
|
|
115
|
+
folder: boxAsset('folder', 'A folder or directory: a flat box.', [1.6, 1.6, 0.5], 'folder'),
|
|
116
|
+
key: boxAsset('key', 'A secret: a low box with a key on top.', [1.6, 1.6, 0.6], 'key', [], (k, b) => D.keyGlyph(k, b)),
|
|
117
|
+
socket: boxAsset('socket', 'A socket: a small box with a round opening on top.', [1.2, 1.2, 0.5], 'socket', [], (k, b) => D.socketGlyph(k, b)),
|
|
118
|
+
gate: boxAsset('gate', 'A gate or proxy: a narrow upright slab, usually set in a fence wall.', [0.3, 2, 1.1], 'gate'),
|
|
119
|
+
placeholder: boxAsset('placeholder', 'A placeholder value: a small low box with lines.', [1.2, 1.0, 0.45], 'placeholder', ['file-lines']),
|
|
120
|
+
orb, person, screen, monitor, cloud, volume,
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export function getAsset(name: string | undefined): NodeAsset | undefined {
|
|
124
|
+
return NODE_ASSETS[name ?? 'block'];
|
|
125
|
+
}
|
|
126
|
+
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://isodiag.local/schema/isodiag-1.json",
|
|
4
|
+
"title": "isodiag diagram",
|
|
5
|
+
"description": "A page of isometric, animated diagrams. See docs/FORMAT.md.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["isodiag", "scenes"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"isodiag": { "const": 1, "description": "Format version. Always 1." },
|
|
11
|
+
"title": { "type": "string" },
|
|
12
|
+
"lede": { "type": "string" },
|
|
13
|
+
"pills": { "type": "array", "items": { "type": "string" } },
|
|
14
|
+
"theme": { "type": "string", "description": "'default' or a path to a theme file" },
|
|
15
|
+
"roles": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"description": "Extra or changed colour roles for nodes and regions",
|
|
18
|
+
"additionalProperties": { "$ref": "#/$defs/role" }
|
|
19
|
+
},
|
|
20
|
+
"kinds": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"description": "Extra flow kinds, or new legend text for the standard ones",
|
|
23
|
+
"additionalProperties": { "$ref": "#/$defs/kindDef" }
|
|
24
|
+
},
|
|
25
|
+
"after": { "type": "string", "description": "Markdown shown after all scenes" },
|
|
26
|
+
"grid": { "$ref": "#/$defs/grid" },
|
|
27
|
+
"assemble": { "type": "boolean", "description": "draw each scene by flying its parts in from the nearest edge, then play" },
|
|
28
|
+
"footer": { "type": "string" },
|
|
29
|
+
"scenes": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/scene" } }
|
|
30
|
+
},
|
|
31
|
+
"$defs": {
|
|
32
|
+
"id": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_-]*$" },
|
|
33
|
+
"grid": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"additionalProperties": false,
|
|
36
|
+
"properties": {
|
|
37
|
+
"snap": { "type": "number", "exclusiveMinimum": 0, "description": "round every placed edge and route waypoint to this step, in grid units" },
|
|
38
|
+
"show": { "type": "boolean", "description": "draw the floor grid when the page opens (the Grid button toggles it)" },
|
|
39
|
+
"step": { "type": "number", "exclusiveMinimum": 0, "description": "spacing of the drawn grid lines; default the snap step, or 1" }
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"num": { "type": "number" },
|
|
43
|
+
"point2": { "type": "array", "items": { "type": "number" }, "minItems": 2, "maxItems": 2 },
|
|
44
|
+
"size2or3": { "type": "array", "items": { "type": "number", "exclusiveMinimum": 0 }, "minItems": 2, "maxItems": 3 },
|
|
45
|
+
"stepRef": { "anyOf": [{ "type": "string" }, { "type": "integer", "minimum": 1 }] },
|
|
46
|
+
"side": { "enum": ["n", "e", "s", "w"] },
|
|
47
|
+
"align": { "enum": ["start", "center", "end"] },
|
|
48
|
+
"role": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"additionalProperties": false,
|
|
51
|
+
"required": ["h", "s"],
|
|
52
|
+
"properties": {
|
|
53
|
+
"h": { "type": "number", "minimum": 0, "maximum": 360, "description": "hue" },
|
|
54
|
+
"s": { "type": "number", "minimum": 0, "maximum": 100, "description": "saturation, percent" },
|
|
55
|
+
"top": { "type": "string", "description": "CSS colour for the top face, overriding the computed one" },
|
|
56
|
+
"tint": { "type": "number", "minimum": 0, "maximum": 100, "description": "percent of the role colour mixed into the pad colour for the top face" }
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"kindDef": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"additionalProperties": false,
|
|
62
|
+
"properties": {
|
|
63
|
+
"legend": { "type": "string" },
|
|
64
|
+
"like": { "type": "string", "description": "a standard kind whose colour and line style this one uses" },
|
|
65
|
+
"color": { "type": "string" },
|
|
66
|
+
"dash": { "enum": ["solid", "dashed", "dotted"] }
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"placement": {
|
|
70
|
+
"properties": {
|
|
71
|
+
"in": { "$ref": "#/$defs/id" },
|
|
72
|
+
"at": { "$ref": "#/$defs/point2" },
|
|
73
|
+
"right-of": { "$ref": "#/$defs/id" },
|
|
74
|
+
"left-of": { "$ref": "#/$defs/id" },
|
|
75
|
+
"below": { "$ref": "#/$defs/id" },
|
|
76
|
+
"behind": { "$ref": "#/$defs/id" },
|
|
77
|
+
"gap": { "type": "number" },
|
|
78
|
+
"align": { "$ref": "#/$defs/align" },
|
|
79
|
+
"shift": { "$ref": "#/$defs/point2", "description": "nudge after placement, grid units [dx, dy]" },
|
|
80
|
+
"appears": { "$ref": "#/$defs/stepRef" },
|
|
81
|
+
"disappears": { "$ref": "#/$defs/stepRef" }
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"scene": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"required": ["id", "title"],
|
|
87
|
+
"additionalProperties": false,
|
|
88
|
+
"properties": {
|
|
89
|
+
"id": { "$ref": "#/$defs/id" },
|
|
90
|
+
"title": { "type": "string" },
|
|
91
|
+
"caption": { "type": "string" },
|
|
92
|
+
"aria": { "type": "string" },
|
|
93
|
+
"gap": { "type": "number", "exclusiveMinimum": 0 },
|
|
94
|
+
"flow": { "enum": ["row", "column"] },
|
|
95
|
+
"regions": { "type": "array", "items": { "$ref": "#/$defs/region" } },
|
|
96
|
+
"nodes": { "type": "array", "items": { "$ref": "#/$defs/node" } },
|
|
97
|
+
"routes": { "type": "array", "items": { "$ref": "#/$defs/route" } },
|
|
98
|
+
"notes": { "type": "array", "items": { "$ref": "#/$defs/note" } },
|
|
99
|
+
"steps": { "type": "array", "items": { "$ref": "#/$defs/step" } },
|
|
100
|
+
"legend": {
|
|
101
|
+
"anyOf": [
|
|
102
|
+
{ "enum": ["auto"] },
|
|
103
|
+
{ "const": false },
|
|
104
|
+
{ "type": "array", "items": { "type": "string" } }
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"badges": { "type": "boolean" },
|
|
108
|
+
"grid": { "$ref": "#/$defs/grid" },
|
|
109
|
+
"assemble": { "type": "boolean", "description": "draw the scene by flying its parts in from the nearest edge, then play" },
|
|
110
|
+
"loop": { "type": "boolean", "description": "the player wraps from the last step to the first (default true)" },
|
|
111
|
+
"dim": { "enum": ["flows", "all"], "description": "what a step dims: only flows, their labels and marks (default), or nodes too" },
|
|
112
|
+
"after": { "type": "string" }
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"region": {
|
|
116
|
+
"type": "object",
|
|
117
|
+
"required": ["id", "kind"],
|
|
118
|
+
"unevaluatedProperties": false,
|
|
119
|
+
"allOf": [{ "$ref": "#/$defs/placement" }],
|
|
120
|
+
"properties": {
|
|
121
|
+
"id": { "$ref": "#/$defs/id" },
|
|
122
|
+
"kind": { "enum": ["slab", "pad", "fence", "vm", "cloud", "zone", "platform", "tunnel"] },
|
|
123
|
+
"label": { "type": "string" },
|
|
124
|
+
"label-style": { "enum": ["face", "face-right", "floor", "none"] },
|
|
125
|
+
"ghost": { "type": "boolean", "description": "drawn as a dashed outline: not there yet, out of reach, or stopped" },
|
|
126
|
+
"role": { "type": "string" },
|
|
127
|
+
"size": { "$ref": "#/$defs/size2or3" },
|
|
128
|
+
"padding": { "type": "number", "minimum": 0 },
|
|
129
|
+
"height": { "type": "number", "exclusiveMinimum": 0 },
|
|
130
|
+
"z": { "type": "number", "description": "lift above the floor it stands on (tunnels)" },
|
|
131
|
+
"flow": { "enum": ["row", "column"] },
|
|
132
|
+
"gate": {
|
|
133
|
+
"type": "object",
|
|
134
|
+
"additionalProperties": false,
|
|
135
|
+
"required": ["side"],
|
|
136
|
+
"properties": {
|
|
137
|
+
"side": { "$ref": "#/$defs/side" },
|
|
138
|
+
"at": { "type": "number", "minimum": 0, "maximum": 1, "description": "centre of the gate along the wall, 0..1" },
|
|
139
|
+
"width": { "type": "number", "exclusiveMinimum": 0 },
|
|
140
|
+
"height": { "type": "number", "exclusiveMinimum": 0 },
|
|
141
|
+
"node": { "$ref": "#/$defs/id" }
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"around": { "type": "array", "items": { "$ref": "#/$defs/id" }, "description": "tunnel: routes it wraps" },
|
|
145
|
+
"regions": { "type": "array", "items": { "$ref": "#/$defs/region" } },
|
|
146
|
+
"nodes": { "type": "array", "items": { "$ref": "#/$defs/node" } }
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"deco": {
|
|
150
|
+
"anyOf": [
|
|
151
|
+
{ "enum": ["envelope", "bubble", "file-lines", "ghost", "terminal"] },
|
|
152
|
+
{
|
|
153
|
+
"type": "object",
|
|
154
|
+
"additionalProperties": false,
|
|
155
|
+
"minProperties": 1,
|
|
156
|
+
"maxProperties": 1,
|
|
157
|
+
"properties": {
|
|
158
|
+
"terminal": { "type": "integer", "minimum": 1, "maximum": 8 },
|
|
159
|
+
"icon": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$", "description": "an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning" },
|
|
160
|
+
"screen": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$", "description": "terminal, chat, desktop, tiles, or a face the host registers" }
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
},
|
|
165
|
+
"node": {
|
|
166
|
+
"type": "object",
|
|
167
|
+
"required": ["id"],
|
|
168
|
+
"unevaluatedProperties": false,
|
|
169
|
+
"allOf": [{ "$ref": "#/$defs/placement" }],
|
|
170
|
+
"properties": {
|
|
171
|
+
"id": { "$ref": "#/$defs/id" },
|
|
172
|
+
"asset": { "type": "string", "description": "asset name from the library; default 'block'" },
|
|
173
|
+
"role": { "type": "string", "description": "colour role" },
|
|
174
|
+
"label": { "type": "string" },
|
|
175
|
+
"sub": { "type": "string" },
|
|
176
|
+
"size": { "$ref": "#/$defs/size2or3" },
|
|
177
|
+
"z": { "type": "number", "description": "lift above the floor it stands on" },
|
|
178
|
+
"deco": { "type": "array", "items": { "$ref": "#/$defs/deco" } },
|
|
179
|
+
"ghost": { "type": "boolean" },
|
|
180
|
+
"face": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$", "description": "screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers" },
|
|
181
|
+
"facing": { "type": "number", "description": "screen asset: rotation in degrees" },
|
|
182
|
+
"label-at": {
|
|
183
|
+
"type": "object",
|
|
184
|
+
"additionalProperties": false,
|
|
185
|
+
"properties": {
|
|
186
|
+
"side": { "enum": ["above", "right", "left", "below"] },
|
|
187
|
+
"dx": { "type": "number" },
|
|
188
|
+
"dy": { "type": "number" }
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"nodes": { "type": "array", "items": { "$ref": "#/$defs/node" }, "description": "nodes standing on top of this one" }
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"endpoint": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$" },
|
|
195
|
+
"route": {
|
|
196
|
+
"type": "object",
|
|
197
|
+
"required": ["id", "from", "to"],
|
|
198
|
+
"additionalProperties": false,
|
|
199
|
+
"properties": {
|
|
200
|
+
"id": { "$ref": "#/$defs/id" },
|
|
201
|
+
"from": { "$ref": "#/$defs/endpoint" },
|
|
202
|
+
"to": { "$ref": "#/$defs/endpoint" },
|
|
203
|
+
"kind": { "type": "string" },
|
|
204
|
+
"via": { "type": "array", "items": { "anyOf": [{ "$ref": "#/$defs/point2" }, { "$ref": "#/$defs/endpoint" }] } },
|
|
205
|
+
"points": { "type": "array", "items": { "type": "array", "items": { "type": "number" }, "minItems": 2, "maxItems": 3 }, "description": "exact polyline in grid units; skips the router" },
|
|
206
|
+
"lane": { "type": "number" },
|
|
207
|
+
"arrow": { "type": "boolean" },
|
|
208
|
+
"cross": { "type": "boolean", "description": "the route may pass through fence walls (it crosses a boundary)" },
|
|
209
|
+
"label": {
|
|
210
|
+
"anyOf": [
|
|
211
|
+
{ "type": "string" },
|
|
212
|
+
{
|
|
213
|
+
"type": "object",
|
|
214
|
+
"additionalProperties": false,
|
|
215
|
+
"required": ["text"],
|
|
216
|
+
"properties": {
|
|
217
|
+
"text": { "type": "string" },
|
|
218
|
+
"along": { "type": "integer", "minimum": 1 },
|
|
219
|
+
"side": { "enum": ["left", "right"] },
|
|
220
|
+
"at": { "type": "array", "items": { "type": "number" }, "minItems": 2, "maxItems": 3, "description": "exact place [x, y] or [x, y, z]; skips placement" },
|
|
221
|
+
"dir": { "enum": ["x", "y"] },
|
|
222
|
+
"anchor": { "enum": ["start", "middle", "end"] }
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
"appears": { "$ref": "#/$defs/stepRef" },
|
|
228
|
+
"disappears": { "$ref": "#/$defs/stepRef" }
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
"note": {
|
|
232
|
+
"type": "object",
|
|
233
|
+
"additionalProperties": false,
|
|
234
|
+
"properties": {
|
|
235
|
+
"floor": { "type": "string" },
|
|
236
|
+
"face": { "type": "string" },
|
|
237
|
+
"label": { "type": "string" },
|
|
238
|
+
"sub": { "type": "string" },
|
|
239
|
+
"at": { "anyOf": [{ "$ref": "#/$defs/point2" }, { "type": "array", "items": { "type": "number" }, "minItems": 3, "maxItems": 3 }] },
|
|
240
|
+
"on": { "$ref": "#/$defs/id", "description": "a node, region or route; a note on a route dims and lights with it" },
|
|
241
|
+
"kind": { "type": "string" },
|
|
242
|
+
"dir": { "enum": ["x", "y"] },
|
|
243
|
+
"anchor": { "enum": ["start", "middle", "end"] },
|
|
244
|
+
"dx": { "type": "number" },
|
|
245
|
+
"dy": { "type": "number" },
|
|
246
|
+
"appears": { "$ref": "#/$defs/stepRef" },
|
|
247
|
+
"disappears": { "$ref": "#/$defs/stepRef" }
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
"routeRef": {
|
|
251
|
+
"anyOf": [
|
|
252
|
+
{ "type": "string" },
|
|
253
|
+
{ "type": "object", "minProperties": 1, "maxProperties": 1, "additionalProperties": { "type": "string" } }
|
|
254
|
+
]
|
|
255
|
+
},
|
|
256
|
+
"phase": {
|
|
257
|
+
"anyOf": [
|
|
258
|
+
{ "$ref": "#/$defs/routeRef" },
|
|
259
|
+
{ "type": "array", "items": { "$ref": "#/$defs/routeRef" } }
|
|
260
|
+
]
|
|
261
|
+
},
|
|
262
|
+
"step": {
|
|
263
|
+
"type": "object",
|
|
264
|
+
"required": ["heading"],
|
|
265
|
+
"additionalProperties": false,
|
|
266
|
+
"properties": {
|
|
267
|
+
"id": { "$ref": "#/$defs/id" },
|
|
268
|
+
"number": { "type": "integer", "minimum": 1, "description": "the number shown; defaults to the position" },
|
|
269
|
+
"kind": { "type": "string" },
|
|
270
|
+
"heading": { "type": "string" },
|
|
271
|
+
"caption": { "type": "string" },
|
|
272
|
+
"command": { "type": "string" },
|
|
273
|
+
"animate": { "type": "array", "items": { "$ref": "#/$defs/phase" } },
|
|
274
|
+
"pulse": { "type": "array", "items": { "$ref": "#/$defs/id" } },
|
|
275
|
+
"highlight": { "type": "array", "items": { "$ref": "#/$defs/id" } },
|
|
276
|
+
"focus": { "type": "array", "items": { "$ref": "#/$defs/id" }, "description": "nodes or regions to zoom to for this step; the view eases back on steps without focus" },
|
|
277
|
+
"show": { "type": "array", "items": { "$ref": "#/$defs/id" } },
|
|
278
|
+
"hide": { "type": "array", "items": { "$ref": "#/$defs/id" } },
|
|
279
|
+
"say": {
|
|
280
|
+
"type": "array",
|
|
281
|
+
"items": {
|
|
282
|
+
"type": "object",
|
|
283
|
+
"additionalProperties": false,
|
|
284
|
+
"required": ["at", "text"],
|
|
285
|
+
"properties": {
|
|
286
|
+
"at": { "anyOf": [{ "$ref": "#/$defs/id" }, { "type": "array", "items": { "type": "number" }, "minItems": 2, "maxItems": 3 }], "description": "a node (the callout sits above it) or a grid point [x, y, z]" },
|
|
287
|
+
"text": { "type": "string" },
|
|
288
|
+
"kind": { "type": "string" },
|
|
289
|
+
"dx": { "type": "number" },
|
|
290
|
+
"dy": { "type": "number" },
|
|
291
|
+
"anchor": { "enum": ["start", "middle", "end"] }
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
"mark": {
|
|
296
|
+
"type": "array",
|
|
297
|
+
"items": {
|
|
298
|
+
"type": "object",
|
|
299
|
+
"additionalProperties": false,
|
|
300
|
+
"properties": {
|
|
301
|
+
"on": { "$ref": "#/$defs/id" },
|
|
302
|
+
"at": { "type": "array", "items": { "type": "number" }, "minItems": 2, "maxItems": 3 }
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
"badge": { "anyOf": [{ "type": "boolean" }, { "$ref": "#/$defs/id" }, { "type": "array", "items": { "type": "number" }, "minItems": 2, "maxItems": 3 }], "description": "false, a route or node id, or a grid point [x, y, z]" },
|
|
307
|
+
"duration": { "anyOf": [{ "const": "auto" }, { "type": "integer", "minimum": 500 }] }
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|