@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,59 @@
|
|
|
1
|
+
import type { CompiledScene } from './compile.js';
|
|
2
|
+
import { type KindCatalog } from './kinds.js';
|
|
3
|
+
/** A move on screen (SVG units) as a move on the floor (grid units): the inverse of the iso projection at one height. */
|
|
4
|
+
export declare function screenToGrid(dx: number, dy: number): [number, number];
|
|
5
|
+
/** Where an element sits in its parent's frame (what at: means), in grid units. */
|
|
6
|
+
export declare function localAt(sc: CompiledScene, id: string): [number, number] | undefined;
|
|
7
|
+
type Box3 = {
|
|
8
|
+
x0: number;
|
|
9
|
+
y0: number;
|
|
10
|
+
z0: number;
|
|
11
|
+
x1: number;
|
|
12
|
+
y1: number;
|
|
13
|
+
z1: number;
|
|
14
|
+
};
|
|
15
|
+
/** The outline a box makes on screen: the convex hull of its eight projected corners (a hexagon, seen from above). */
|
|
16
|
+
export declare function boxSilhouette(b: Box3): [number, number][];
|
|
17
|
+
/** A region's floor: its footprint at the height it stands on, projected (a parallelogram). */
|
|
18
|
+
export declare function floorOf(b: Box3): [number, number][];
|
|
19
|
+
/** a region's inner margin: its own, else its kind's (as place.ts pads it); 0 for a kind the catalogue doesn't have */
|
|
20
|
+
export declare const paddingOf: (cat: KindCatalog, region: {
|
|
21
|
+
kind?: string;
|
|
22
|
+
padding?: number;
|
|
23
|
+
} | undefined) => number;
|
|
24
|
+
export interface Move {
|
|
25
|
+
/** the new at: in the parent's frame */
|
|
26
|
+
at: [number, number];
|
|
27
|
+
/** the grid move actually made (after snapping and clamping) */
|
|
28
|
+
delta: [number, number];
|
|
29
|
+
/** which edges of the parent stopped it */
|
|
30
|
+
clamped: {
|
|
31
|
+
left: boolean;
|
|
32
|
+
right: boolean;
|
|
33
|
+
top: boolean;
|
|
34
|
+
bottom: boolean;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A drag of (dx, dy) grid units, from `start` (at: in the parent's frame), to a position snapped to `step` (1: whole
|
|
39
|
+
* cells; 0.5: half cells), then clamped so the item's footprint `size` stays inside its parent's inner area (`parent`: its size, `pad`:
|
|
40
|
+
* its margin). With no parent (the scene), nothing clamps.
|
|
41
|
+
*/
|
|
42
|
+
export declare function snapMove(start: [number, number], d: [number, number], step: number, size: [number, number], parent?: {
|
|
43
|
+
w: number;
|
|
44
|
+
d: number;
|
|
45
|
+
pad: number;
|
|
46
|
+
}): Move;
|
|
47
|
+
/** Does a footprint overlap any of these (sharing an edge isn't overlapping)? */
|
|
48
|
+
export declare function overlaps(a: {
|
|
49
|
+
x0: number;
|
|
50
|
+
y0: number;
|
|
51
|
+
x1: number;
|
|
52
|
+
y1: number;
|
|
53
|
+
}, others: {
|
|
54
|
+
x0: number;
|
|
55
|
+
y0: number;
|
|
56
|
+
x1: number;
|
|
57
|
+
y1: number;
|
|
58
|
+
}[]): boolean;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type { Side, StepRef, RawPlacement, RawDeco, RawNode, RawGate, RawRegion, RawNote, RawScene, GridDef, RawDiagram, RegionKindName, Placed, RawRole, RawKind, Theme } from './types.js';
|
|
2
|
+
export { regionKind, nodeKind, nodeKindOr, wallHeight, kindsCss } from './kinds.js';
|
|
3
|
+
export type { RegionShape, RegionKind, KindCatalog } from './kinds.js';
|
|
4
|
+
export { drawDecos, boxAsset, plate, cloudPath, drawCloud, defaultLabel, registerMarks, markCss, iconPainter, facePainter, placeholderIcon } from './assets.js';
|
|
5
|
+
export type { LabelSpot, NodeAsset, IconPainter } from './assets.js';
|
|
6
|
+
export { WALL_T, place, gateBox, overlap2 } from './place.js';
|
|
7
|
+
export type { Located, Layout } from './place.js';
|
|
8
|
+
export { parseEnd, floorAt, ROUTE_BUDGET, routeAll, openList, simplify } from './route.js';
|
|
9
|
+
export type { Side as RouteSide, RawRoute, Routed, RouteResult } from './route.js';
|
|
10
|
+
export { silhouette, polyBounds, polyRectArea, rectArea, lineRectArea, Obstacles, labelRect, placeNodeLabel, calloutRect, placeCallout, inConvex, convexOverlap } from './labels.js';
|
|
11
|
+
export type { Rect, Poly, LabelText, PlacedLabel, CalloutSpot } from './labels.js';
|
|
12
|
+
export { offscreen, assembly } from './assemble.js';
|
|
13
|
+
export type { Edge, Piece, Assembly } from './assemble.js';
|
|
14
|
+
export { durationFor, resolveSteps, midpoint } from './steps.js';
|
|
15
|
+
export type { RawStep, Token, StepData, Say, Mark, Badge, Steps } from './steps.js';
|
|
16
|
+
export { focusView } from './focus.js';
|
|
17
|
+
export { regionRole, renderScene, wallsOf, LABEL_BUDGET } from './scene.js';
|
|
18
|
+
export type { RenderedScene, RenderWarning, SceneInput } from './scene.js';
|
|
19
|
+
export { PAGE_CSS, drawingCss, baseCss, MARKS_CSS, PLAYER_UI_CSS, GRID_CSS, PLAYER_CSS } from './css.js';
|
|
20
|
+
export { noSource, compileRaw } from './compile.js';
|
|
21
|
+
export { screenToGrid, localAt, boxSilhouette, floorOf, paddingOf, snapMove, overlaps } from './geometry.js';
|
|
22
|
+
export type { Move } from './geometry.js';
|
|
23
|
+
export type { CompiledScene, Compiled } from './compile.js';
|
|
24
|
+
export { FLAT_DEFAULTS, FLAT_FONTS, metricsMeasure, boardErrors, placeBoard, layoutFlat, flatHit } from './flat.js';
|
|
25
|
+
export type { Board, BoardCard, BoardPanel, BoardLink, FlatRect, FlatPoint, FlatFont, Measure, FlatOptions, FlatCard, FlatPanel, FlatLabel, FlatLink, FlatLayout } from './flat.js';
|
|
26
|
+
export { boardOf, BOARD_3D, BOARD_CSS, cardAsset, boardCatalog, boardDiagram } from './board.js';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { NodeAsset } from './assets.js';
|
|
2
|
+
/** How a region is drawn, and how it takes part in layout and routing. */
|
|
3
|
+
export type RegionShape =
|
|
4
|
+
/** a thick base slab: a skirt below its floor (none on another slab), its name large on its front face */
|
|
5
|
+
'slab'
|
|
6
|
+
/** a plain block children stand on */
|
|
7
|
+
| 'block'
|
|
8
|
+
/** a cloud lying on the floor, its name in the middle */
|
|
9
|
+
| 'cloud'
|
|
10
|
+
/** a flat tint on the floor: overlays other things on purpose */
|
|
11
|
+
| 'zone'
|
|
12
|
+
/** a cage of thin walls with a gate in one: routes go round its walls (or through its gate) */
|
|
13
|
+
| 'walled'
|
|
14
|
+
/** a translucent tube over other things: overlays them on purpose */
|
|
15
|
+
| 'tunnel';
|
|
16
|
+
export interface RegionKind {
|
|
17
|
+
shape: RegionShape;
|
|
18
|
+
/** inner margin, grid units */
|
|
19
|
+
pad: number;
|
|
20
|
+
/** [z0 offset below the floor it stands on, default height above it] */
|
|
21
|
+
z: [number, number];
|
|
22
|
+
/** children stand on its top, and routes find a floor on it */
|
|
23
|
+
floor: boolean;
|
|
24
|
+
/** the colour role it is drawn in, unless the region says its own */
|
|
25
|
+
role: string;
|
|
26
|
+
/** where its name goes, unless the region says */
|
|
27
|
+
labelStyle: 'face' | 'face-right' | 'floor' | 'none';
|
|
28
|
+
/** its row in a page's legend: a swatch (a box, or a line) and its words; auto: shown whenever the kind is drawn */
|
|
29
|
+
legend?: {
|
|
30
|
+
label: string;
|
|
31
|
+
swatch: string;
|
|
32
|
+
box: boolean;
|
|
33
|
+
auto: boolean;
|
|
34
|
+
};
|
|
35
|
+
/** the kind's own drawing CSS, in the drawing's stylesheet */
|
|
36
|
+
css?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface KindCatalog {
|
|
39
|
+
regions: Record<string, RegionKind>;
|
|
40
|
+
nodes: Record<string, NodeAsset>;
|
|
41
|
+
/** the node kind a node without one (or with an unknown one) is drawn as */
|
|
42
|
+
defaultNode: string;
|
|
43
|
+
}
|
|
44
|
+
/** a region kind's data; undefined for a name the catalogue doesn't have */
|
|
45
|
+
export declare const regionKind: (cat: KindCatalog, name: string | undefined) => RegionKind | undefined;
|
|
46
|
+
/** a node kind by name (none: the default); undefined for a name the catalogue doesn't have */
|
|
47
|
+
export declare const nodeKind: (cat: KindCatalog, name: string | undefined) => NodeAsset | undefined;
|
|
48
|
+
/** a node kind by name, or the default one */
|
|
49
|
+
export declare const nodeKindOr: (cat: KindCatalog, name: string | undefined) => NodeAsset;
|
|
50
|
+
/** a walled kind's default height: a gate's height follows it */
|
|
51
|
+
export declare const wallHeight: (cat: KindCatalog) => number;
|
|
52
|
+
/** the kinds' CSS, in the catalogue's order */
|
|
53
|
+
export declare const kindsCss: (cat: KindCatalog) => string;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type Box, type P2 } from '../iso-core/kernel.js';
|
|
2
|
+
export interface Rect {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
w: number;
|
|
6
|
+
h: number;
|
|
7
|
+
}
|
|
8
|
+
export type Poly = P2[];
|
|
9
|
+
/** The outline of a box as seen: six corners, clockwise from the back-top corner. */
|
|
10
|
+
export declare function silhouette(b: Box): Poly;
|
|
11
|
+
export declare function polyBounds(p: Poly): Rect;
|
|
12
|
+
/** Area of a convex polygon clipped to a rectangle (Sutherland–Hodgman). */
|
|
13
|
+
export declare function polyRectArea(poly: Poly, r: Rect): number;
|
|
14
|
+
export declare function rectArea(a: Rect, b: Rect): number;
|
|
15
|
+
/** How much of a polyline (as 4px-wide strokes) falls inside a rectangle, in px². */
|
|
16
|
+
export declare function lineRectArea(pts: P2[], r: Rect): number;
|
|
17
|
+
export declare class Obstacles {
|
|
18
|
+
polys: {
|
|
19
|
+
poly: Poly;
|
|
20
|
+
owner: string;
|
|
21
|
+
}[];
|
|
22
|
+
rects: {
|
|
23
|
+
r: Rect;
|
|
24
|
+
owner: string;
|
|
25
|
+
}[];
|
|
26
|
+
lines: {
|
|
27
|
+
pts: P2[];
|
|
28
|
+
owner: string;
|
|
29
|
+
}[];
|
|
30
|
+
/** everything drawn over the floor (nodes, walls, gates): floor text under them is hidden */
|
|
31
|
+
solids: Poly[];
|
|
32
|
+
/** text lying in a plane (floor and face labels), as parallelograms */
|
|
33
|
+
slants: Poly[];
|
|
34
|
+
/** label spots the scene may still weigh (see LABEL_BUDGET in src/iso-objects/scene.ts); shared with forks */
|
|
35
|
+
budget: {
|
|
36
|
+
spots: number;
|
|
37
|
+
over: boolean;
|
|
38
|
+
told: boolean;
|
|
39
|
+
};
|
|
40
|
+
/** px² of a rectangle hidden under solids */
|
|
41
|
+
hidden(r: Rect): number;
|
|
42
|
+
/** px² of a convex polygon (slanted floor text) hidden under solids */
|
|
43
|
+
hiddenPoly(q: Poly): number;
|
|
44
|
+
/** like cost(), for a convex polygon */
|
|
45
|
+
costPoly(q: Poly, limit?: number): number;
|
|
46
|
+
/** px² a rectangle shares with nodes, labels and (weighted by lineW) route lines */
|
|
47
|
+
cost(r: Rect, owner?: string, lineW?: number): number;
|
|
48
|
+
/** a copy whose added rectangles do not reach this one (callouts of one step) */
|
|
49
|
+
fork(): Obstacles;
|
|
50
|
+
}
|
|
51
|
+
export interface LabelText {
|
|
52
|
+
name?: string;
|
|
53
|
+
sub?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface PlacedLabel {
|
|
56
|
+
x: number;
|
|
57
|
+
y: number;
|
|
58
|
+
anchor: 'start' | 'middle' | 'end';
|
|
59
|
+
rect: Rect;
|
|
60
|
+
}
|
|
61
|
+
/** The rectangle a label block covers when its first baseline is at (x, y). */
|
|
62
|
+
export declare function labelRect(t: LabelText, x: number, y: number, anchor: 'start' | 'middle' | 'end'): Rect;
|
|
63
|
+
/**
|
|
64
|
+
* Place a node's label. Spots, each with a penalty that says how natural it is: above the node clear of its top (the
|
|
65
|
+
* references' place), a little higher, beside it, then below. Each spot costs its penalty plus what it covers;
|
|
66
|
+
* route lines count little, since labels have a halo. The cheapest wins.
|
|
67
|
+
*/
|
|
68
|
+
export declare function placeNodeLabel(t: LabelText, box: Box, own: Poly, obs: Obstacles, owner: string, preferred?: {
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
anchor: 'start' | 'middle' | 'end';
|
|
72
|
+
}): PlacedLabel;
|
|
73
|
+
export interface CalloutSpot {
|
|
74
|
+
x: number;
|
|
75
|
+
y: number;
|
|
76
|
+
anchor: 'start' | 'middle' | 'end';
|
|
77
|
+
rect: Rect;
|
|
78
|
+
}
|
|
79
|
+
/** The rectangle of a callout pill whose text centre line is at y. */
|
|
80
|
+
export declare function calloutRect(w: number, x: number, y: number, anchor: 'start' | 'middle' | 'end'): Rect;
|
|
81
|
+
/**
|
|
82
|
+
* Place a step's callout pill: where the author put it if that is clear, else around its anchor (above first),
|
|
83
|
+
* whichever covers least of the nodes, the labels and the step's other callouts. Callouts move; labels stay.
|
|
84
|
+
*/
|
|
85
|
+
export declare function placeCallout(w: number, ax: number, ay: number, preferred: {
|
|
86
|
+
x: number;
|
|
87
|
+
y: number;
|
|
88
|
+
anchor: 'start' | 'middle' | 'end';
|
|
89
|
+
}, obs: Obstacles): CalloutSpot;
|
|
90
|
+
export declare function inConvex(poly: Poly, q: P2): boolean;
|
|
91
|
+
/** Area of the intersection of two convex polygons (Sutherland–Hodgman, clipping a by each edge of b). */
|
|
92
|
+
export declare function convexOverlap(a: Poly, b: Poly): number;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Box } from '../iso-core/kernel.js';
|
|
2
|
+
import { type KindCatalog } from './kinds.js';
|
|
3
|
+
import { type Diag } from '../iso-core/errors.js';
|
|
4
|
+
import type { Placed, RawScene, Theme } from './types.js';
|
|
5
|
+
export interface Located {
|
|
6
|
+
locate(path: string, opts?: {
|
|
7
|
+
key?: boolean;
|
|
8
|
+
}): {
|
|
9
|
+
line: number;
|
|
10
|
+
col: number;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/** a walled region's wall thickness */
|
|
14
|
+
export declare const WALL_T = 0.16;
|
|
15
|
+
export interface Layout {
|
|
16
|
+
items: Placed[];
|
|
17
|
+
byId: Map<string, Placed>;
|
|
18
|
+
roots: Placed[];
|
|
19
|
+
diags: Diag[];
|
|
20
|
+
/** the kinds it was laid out with: drawing and routing ask them too */
|
|
21
|
+
catalog: KindCatalog;
|
|
22
|
+
}
|
|
23
|
+
export declare function place(scene: RawScene, scenePath: string, src: Located, theme: Theme, catalog: KindCatalog, fileRoles?: Record<string, unknown>, snap?: number): Layout;
|
|
24
|
+
export declare function gateBox(f: Placed, h: number, w: number, d: number): Box;
|
|
25
|
+
export declare function overlap2(a: Box, b: Box, e?: number): boolean;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { P3 } from '../iso-core/kernel.js';
|
|
2
|
+
import { type Diag } from '../iso-core/errors.js';
|
|
3
|
+
import type { Placed, RawScene } from './types.js';
|
|
4
|
+
import { type Layout, type Located } from './place.js';
|
|
5
|
+
export type Side = 'n' | 'e' | 's' | 'w' | 'top';
|
|
6
|
+
export interface RawRoute {
|
|
7
|
+
id: string;
|
|
8
|
+
from: string;
|
|
9
|
+
to: string;
|
|
10
|
+
kind?: string;
|
|
11
|
+
via?: (number[] | string)[];
|
|
12
|
+
points?: number[][];
|
|
13
|
+
lane?: number;
|
|
14
|
+
arrow?: boolean;
|
|
15
|
+
cross?: boolean;
|
|
16
|
+
label?: string | {
|
|
17
|
+
text: string;
|
|
18
|
+
along?: number;
|
|
19
|
+
side?: 'left' | 'right';
|
|
20
|
+
at?: number[];
|
|
21
|
+
dir?: 'x' | 'y';
|
|
22
|
+
anchor?: 'start' | 'middle' | 'end';
|
|
23
|
+
};
|
|
24
|
+
appears?: string | number;
|
|
25
|
+
disappears?: string | number;
|
|
26
|
+
}
|
|
27
|
+
export interface Routed {
|
|
28
|
+
id: string;
|
|
29
|
+
raw: RawRoute;
|
|
30
|
+
path: string;
|
|
31
|
+
kind: string;
|
|
32
|
+
points: P3[];
|
|
33
|
+
from?: Placed;
|
|
34
|
+
to?: Placed;
|
|
35
|
+
}
|
|
36
|
+
export declare function parseEnd(s: string): {
|
|
37
|
+
id: string;
|
|
38
|
+
side?: Side;
|
|
39
|
+
};
|
|
40
|
+
export declare function floorAt(layout: Layout, x: number, y: number): number;
|
|
41
|
+
export interface RouteResult {
|
|
42
|
+
routes: Routed[];
|
|
43
|
+
diags: Diag[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The search steps routing may take in one scene. The heaviest diagram in this repo takes about 57,000
|
|
47
|
+
* (the large drawing in corpus/messaging.yaml); a drawing with 40 more nodes took 11 million, and minutes. Past the budget,
|
|
48
|
+
* the routes left are drawn as plain elbows and the scene says so, so a large diagram draws in about a second.
|
|
49
|
+
*/
|
|
50
|
+
export declare const ROUTE_BUDGET = 500000;
|
|
51
|
+
export declare function routeAll(scene: RawScene, scenePath: string, layout: Layout, src: Located, kinds: Set<string>, snap?: number): RouteResult;
|
|
52
|
+
/**
|
|
53
|
+
* A* open list, taking the state with the lowest f, ties to the one earliest in the list, where taking one moves the
|
|
54
|
+
* last into its place (so the order is exactly that of the array scan this replaces, and every route is the same).
|
|
55
|
+
* A binary heap ordered by (f, position): O(log n) a step instead of a scan of the whole list, which on a large drawing
|
|
56
|
+
* (tens of thousands of open states, hundreds of thousands of steps) took minutes.
|
|
57
|
+
*/
|
|
58
|
+
export declare function openList<T extends {
|
|
59
|
+
f: number;
|
|
60
|
+
idx: number;
|
|
61
|
+
hp: number;
|
|
62
|
+
}>(): {
|
|
63
|
+
length: () => number;
|
|
64
|
+
push(s: T): void;
|
|
65
|
+
take(): T;
|
|
66
|
+
};
|
|
67
|
+
export declare function simplify(p: [number, number][]): [number, number][];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type Box } from '../iso-core/kernel.js';
|
|
2
|
+
import { type KindCatalog } from './kinds.js';
|
|
3
|
+
import { type Layout } from './place.js';
|
|
4
|
+
import { type Routed } from './route.js';
|
|
5
|
+
import { type Assembly } from './assemble.js';
|
|
6
|
+
import type { Steps } from './steps.js';
|
|
7
|
+
import type { Placed, RawScene, Theme } from './types.js';
|
|
8
|
+
/** the colour role a region is drawn in: its own, else its kind's */
|
|
9
|
+
export declare const regionRole: (cat: KindCatalog, r: {
|
|
10
|
+
role?: string;
|
|
11
|
+
kind: string;
|
|
12
|
+
}) => string;
|
|
13
|
+
export interface RenderedScene {
|
|
14
|
+
svg: string;
|
|
15
|
+
viewBox: [number, number, number, number];
|
|
16
|
+
/** text rectangles in screen px, for layout tests */
|
|
17
|
+
texts: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
w: number;
|
|
21
|
+
h: number;
|
|
22
|
+
text: string;
|
|
23
|
+
owner?: string;
|
|
24
|
+
}[];
|
|
25
|
+
/** each route's path, for the player's tokens; in screen px */
|
|
26
|
+
paths: Record<string, string>;
|
|
27
|
+
/** things drawn worse than asked, e.g. a route label shortened or dropped */
|
|
28
|
+
warnings: RenderWarning[];
|
|
29
|
+
/** the assemble intro's timeline */
|
|
30
|
+
assembly: Assembly;
|
|
31
|
+
/** callout pills in screen px, per step, for layout tests */
|
|
32
|
+
callouts: {
|
|
33
|
+
step: number;
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
w: number;
|
|
37
|
+
h: number;
|
|
38
|
+
text: string;
|
|
39
|
+
}[];
|
|
40
|
+
}
|
|
41
|
+
export interface RenderWarning {
|
|
42
|
+
path: string;
|
|
43
|
+
message: string;
|
|
44
|
+
}
|
|
45
|
+
export interface SceneInput {
|
|
46
|
+
scene: RawScene;
|
|
47
|
+
layout: Layout;
|
|
48
|
+
routes: Routed[];
|
|
49
|
+
steps: Steps;
|
|
50
|
+
theme: Theme;
|
|
51
|
+
id: string;
|
|
52
|
+
gridStep?: number;
|
|
53
|
+
}
|
|
54
|
+
export declare function renderScene({ scene, layout, routes, steps, theme, id, gridStep }: SceneInput): RenderedScene;
|
|
55
|
+
/** The walls of a walled region's cage, with a gap where its gate is. */
|
|
56
|
+
export declare function wallsOf(r: Placed): Box[];
|
|
57
|
+
/**
|
|
58
|
+
* A route's floor label: beside one of its level segments (the `along` one, else the longest first), on either side,
|
|
59
|
+
* slid along the segment, wherever nothing drawn over the floor would hide it. If nowhere fits, the text is shortened
|
|
60
|
+
* with an ellipsis; if even that fails, the label is dropped. Either way the caller gets a warning.
|
|
61
|
+
*/
|
|
62
|
+
/** label spots weighed in one scene: the busiest diagram here weighs under 200; a drawing with 80 more nodes, 79,000 */
|
|
63
|
+
export declare const LABEL_BUDGET = 20000;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type P3 } from '../iso-core/kernel.js';
|
|
2
|
+
import { type Diag } from '../iso-core/errors.js';
|
|
3
|
+
import type { Layout, Located } from './place.js';
|
|
4
|
+
import type { Routed } from './route.js';
|
|
5
|
+
import type { RawScene, Theme } from './types.js';
|
|
6
|
+
export interface RawStep {
|
|
7
|
+
id?: string;
|
|
8
|
+
number?: number;
|
|
9
|
+
kind?: string;
|
|
10
|
+
heading: string;
|
|
11
|
+
caption?: string;
|
|
12
|
+
command?: string;
|
|
13
|
+
animate?: (string | Record<string, string> | (string | Record<string, string>)[])[];
|
|
14
|
+
pulse?: string[];
|
|
15
|
+
highlight?: string[];
|
|
16
|
+
show?: string[];
|
|
17
|
+
hide?: string[];
|
|
18
|
+
focus?: string[];
|
|
19
|
+
say?: {
|
|
20
|
+
at: string | number[];
|
|
21
|
+
text: string;
|
|
22
|
+
kind?: string;
|
|
23
|
+
dx?: number;
|
|
24
|
+
dy?: number;
|
|
25
|
+
anchor?: 'start' | 'middle' | 'end';
|
|
26
|
+
}[];
|
|
27
|
+
mark?: {
|
|
28
|
+
on?: string;
|
|
29
|
+
at?: number[];
|
|
30
|
+
}[];
|
|
31
|
+
badge?: boolean | string | number[];
|
|
32
|
+
duration?: 'auto' | number;
|
|
33
|
+
}
|
|
34
|
+
export interface Token {
|
|
35
|
+
route: string;
|
|
36
|
+
kind: string;
|
|
37
|
+
color: string;
|
|
38
|
+
}
|
|
39
|
+
export interface StepData {
|
|
40
|
+
n: number;
|
|
41
|
+
num: number;
|
|
42
|
+
kind: string;
|
|
43
|
+
color: string;
|
|
44
|
+
heading: string;
|
|
45
|
+
caption: string;
|
|
46
|
+
command: string;
|
|
47
|
+
phases: Token[][];
|
|
48
|
+
pulses: [number, number, number, number][];
|
|
49
|
+
lit: string[];
|
|
50
|
+
duration: number;
|
|
51
|
+
/** screen box [x0, y0, x1, y1] to zoom to, from `focus:` */
|
|
52
|
+
focus?: [number, number, number, number];
|
|
53
|
+
}
|
|
54
|
+
/** A callout: (x, y) is where the author asked for it; (ax, ay) is the point it belongs to, for placement. */
|
|
55
|
+
export interface Say {
|
|
56
|
+
step: number;
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
ax: number;
|
|
60
|
+
ay: number;
|
|
61
|
+
text: string;
|
|
62
|
+
kind: string;
|
|
63
|
+
anchor: 'start' | 'middle' | 'end';
|
|
64
|
+
}
|
|
65
|
+
export interface Mark {
|
|
66
|
+
step: number;
|
|
67
|
+
p: P3;
|
|
68
|
+
on?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface Badge {
|
|
71
|
+
step: number;
|
|
72
|
+
num: number;
|
|
73
|
+
kind: string;
|
|
74
|
+
p: P3;
|
|
75
|
+
}
|
|
76
|
+
export interface Steps {
|
|
77
|
+
steps: StepData[];
|
|
78
|
+
says: Say[];
|
|
79
|
+
marks: Mark[];
|
|
80
|
+
badges: Badge[];
|
|
81
|
+
/** id → visibility at each step (index 0 = step 1); only for ids whose visibility ever changes */
|
|
82
|
+
vis: Record<string, boolean[]>;
|
|
83
|
+
/** ids of route-bound notes: note index → route id */
|
|
84
|
+
diags: Diag[];
|
|
85
|
+
kindsUsed: string[];
|
|
86
|
+
}
|
|
87
|
+
export declare function durationFor(caption: string): number;
|
|
88
|
+
export declare function resolveSteps(scene: RawScene, scenePath: string, layout: Layout, routes: Routed[], src: Located, theme: Theme): Steps;
|
|
89
|
+
/** The point halfway along a polyline. */
|
|
90
|
+
export declare function midpoint(pts: P3[]): P3;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { Box } from '../iso-core/kernel.js';
|
|
2
|
+
import type { RawRole, RawKind, Theme } from '../iso-core/theme.js';
|
|
3
|
+
export type { RawRole, RawKind, Theme };
|
|
4
|
+
export type Side = 'n' | 'e' | 's' | 'w';
|
|
5
|
+
export type StepRef = string | number;
|
|
6
|
+
export interface RawPlacement {
|
|
7
|
+
in?: string;
|
|
8
|
+
at?: [number, number];
|
|
9
|
+
'right-of'?: string;
|
|
10
|
+
'left-of'?: string;
|
|
11
|
+
below?: string;
|
|
12
|
+
behind?: string;
|
|
13
|
+
gap?: number;
|
|
14
|
+
align?: 'start' | 'center' | 'end';
|
|
15
|
+
shift?: [number, number];
|
|
16
|
+
appears?: StepRef;
|
|
17
|
+
disappears?: StepRef;
|
|
18
|
+
}
|
|
19
|
+
export type RawDeco = string | {
|
|
20
|
+
terminal?: number;
|
|
21
|
+
icon?: string;
|
|
22
|
+
screen?: string;
|
|
23
|
+
};
|
|
24
|
+
export interface RawNode extends RawPlacement {
|
|
25
|
+
id: string;
|
|
26
|
+
asset?: string;
|
|
27
|
+
role?: string;
|
|
28
|
+
label?: string;
|
|
29
|
+
sub?: string;
|
|
30
|
+
size?: number[];
|
|
31
|
+
z?: number;
|
|
32
|
+
deco?: RawDeco[];
|
|
33
|
+
ghost?: boolean;
|
|
34
|
+
face?: string;
|
|
35
|
+
facing?: number;
|
|
36
|
+
'label-at'?: {
|
|
37
|
+
side?: 'above' | 'right' | 'left' | 'below';
|
|
38
|
+
dx?: number;
|
|
39
|
+
dy?: number;
|
|
40
|
+
};
|
|
41
|
+
nodes?: RawNode[];
|
|
42
|
+
}
|
|
43
|
+
export interface RawGate {
|
|
44
|
+
side: Side;
|
|
45
|
+
at?: number;
|
|
46
|
+
width?: number;
|
|
47
|
+
height?: number;
|
|
48
|
+
node?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface RawRegion extends RawPlacement {
|
|
51
|
+
id: string;
|
|
52
|
+
kind: RegionKindName;
|
|
53
|
+
label?: string;
|
|
54
|
+
'label-style'?: 'face' | 'face-right' | 'floor' | 'none';
|
|
55
|
+
ghost?: boolean;
|
|
56
|
+
role?: string;
|
|
57
|
+
size?: number[];
|
|
58
|
+
padding?: number;
|
|
59
|
+
height?: number;
|
|
60
|
+
z?: number;
|
|
61
|
+
flow?: 'row' | 'column';
|
|
62
|
+
gate?: RawGate;
|
|
63
|
+
around?: string[];
|
|
64
|
+
regions?: RawRegion[];
|
|
65
|
+
nodes?: RawNode[];
|
|
66
|
+
}
|
|
67
|
+
export interface RawNote {
|
|
68
|
+
floor?: string;
|
|
69
|
+
face?: string;
|
|
70
|
+
label?: string;
|
|
71
|
+
sub?: string;
|
|
72
|
+
at?: number[];
|
|
73
|
+
on?: string;
|
|
74
|
+
kind?: string;
|
|
75
|
+
dir?: 'x' | 'y';
|
|
76
|
+
anchor?: 'start' | 'middle' | 'end';
|
|
77
|
+
dx?: number;
|
|
78
|
+
dy?: number;
|
|
79
|
+
appears?: StepRef;
|
|
80
|
+
disappears?: StepRef;
|
|
81
|
+
}
|
|
82
|
+
export interface RawScene {
|
|
83
|
+
id: string;
|
|
84
|
+
title: string;
|
|
85
|
+
caption?: string;
|
|
86
|
+
aria?: string;
|
|
87
|
+
gap?: number;
|
|
88
|
+
flow?: 'row' | 'column';
|
|
89
|
+
regions?: RawRegion[];
|
|
90
|
+
nodes?: RawNode[];
|
|
91
|
+
routes?: unknown[];
|
|
92
|
+
notes?: RawNote[];
|
|
93
|
+
steps?: unknown[];
|
|
94
|
+
legend?: 'auto' | false | string[];
|
|
95
|
+
badges?: boolean;
|
|
96
|
+
loop?: boolean;
|
|
97
|
+
after?: string;
|
|
98
|
+
grid?: GridDef;
|
|
99
|
+
assemble?: boolean;
|
|
100
|
+
dim?: 'flows' | 'all';
|
|
101
|
+
}
|
|
102
|
+
export interface GridDef {
|
|
103
|
+
snap?: number;
|
|
104
|
+
show?: boolean;
|
|
105
|
+
step?: number;
|
|
106
|
+
}
|
|
107
|
+
export interface RawDiagram {
|
|
108
|
+
isodiag: 1;
|
|
109
|
+
title?: string;
|
|
110
|
+
lede?: string;
|
|
111
|
+
pills?: string[];
|
|
112
|
+
theme?: string;
|
|
113
|
+
roles?: Record<string, RawRole>;
|
|
114
|
+
kinds?: Record<string, RawKind>;
|
|
115
|
+
after?: string;
|
|
116
|
+
footer?: string;
|
|
117
|
+
grid?: GridDef;
|
|
118
|
+
assemble?: boolean;
|
|
119
|
+
scenes: RawScene[];
|
|
120
|
+
}
|
|
121
|
+
/** a region kind's name in the catalogue the drawing is laid out with (src/iso-objects/kinds.ts) */
|
|
122
|
+
export type RegionKindName = string;
|
|
123
|
+
/** Something placed: a region or a node, with its absolute box after layout. */
|
|
124
|
+
export interface Placed {
|
|
125
|
+
id: string;
|
|
126
|
+
type: 'region' | 'node';
|
|
127
|
+
/** JSON path into the source, for diagnostics */
|
|
128
|
+
path: string;
|
|
129
|
+
parent?: Placed;
|
|
130
|
+
children: Placed[];
|
|
131
|
+
box: Box;
|
|
132
|
+
/** the z its children stand on */
|
|
133
|
+
floor: number;
|
|
134
|
+
appears?: StepRef;
|
|
135
|
+
disappears?: StepRef;
|
|
136
|
+
region?: RawRegion;
|
|
137
|
+
node?: RawNode;
|
|
138
|
+
/** set when another item (a walled region's gate) decides this item's box */
|
|
139
|
+
placedBy?: string;
|
|
140
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { KindCatalog, RegionKind } from '../iso-objects/kinds.js';
|
|
2
|
+
/** in this order: the legend's automatic rows follow it (fence, then vm), and so does the kinds' CSS */
|
|
3
|
+
export declare const REGION_KINDS: Record<string, RegionKind>;
|
|
4
|
+
export declare const systems: KindCatalog;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Compiled } from '../iso-objects/compile.js';
|
|
2
|
+
export type { Compiled, CompiledScene } from '../iso-objects/compile.js';
|
|
3
|
+
/** opts.snap overrides every scene's grid snap (the editor's snap control). */
|
|
4
|
+
export declare function compile(source: string, themeText: string, opts?: {
|
|
5
|
+
snap?: number;
|
|
6
|
+
}): Compiled;
|