@johnoscott/isometric-engine 0.14.1 → 0.15.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 +1 -1
- package/iso-editor.js +199 -190
- package/iso-render.js +157 -148
- package/iso-systems.js +170 -159
- package/js/iso-objects/ants.js +36 -0
- package/js/iso-objects/index.js +47 -1
- package/js/iso-objects/looks.js +25 -0
- package/js/iso-objects/motion-builder.js +130 -0
- package/js/iso-objects/motion-doc.js +500 -0
- package/js/iso-objects/motion-entry.js +32 -0
- package/js/iso-objects/motion.js +635 -0
- package/js/iso-objects/resolve.js +238 -0
- package/js/iso-objects/scene.js +15 -13
- package/js/iso-objects/timeline.js +553 -0
- package/js/iso-systems/compile.js +59 -1
- package/js/iso-systems/index.js +4 -1
- package/js/iso-systems/render.js +20 -0
- package/js/iso-systems/schema.json +39 -0
- package/js/iso-viewer/page.js +2 -1
- package/js/iso-viewer/player.js +23 -34
- package/package.json +46 -1
- package/src/iso-objects/ants.ts +53 -0
- package/src/iso-objects/compile.ts +4 -1
- package/src/iso-objects/index.ts +14 -1
- package/src/iso-objects/looks.ts +21 -0
- package/src/iso-objects/motion-builder.ts +79 -0
- package/src/iso-objects/motion-doc.ts +361 -0
- package/src/iso-objects/motion-entry.ts +12 -0
- package/src/iso-objects/motion.ts +616 -0
- package/src/iso-objects/resolve.ts +196 -0
- package/src/iso-objects/scene.ts +29 -13
- package/src/iso-objects/timeline.ts +443 -0
- package/src/iso-objects/types.ts +20 -2
- package/src/iso-systems/compile.ts +58 -3
- package/src/iso-systems/index.ts +4 -1
- package/src/iso-systems/render.ts +41 -0
- package/src/iso-systems/schema.json +39 -0
- package/src/iso-viewer/page.ts +2 -1
- package/src/iso-viewer/player.ts +24 -41
- package/types/iso-objects/ants.d.ts +33 -0
- package/types/iso-objects/compile.d.ts +3 -0
- package/types/iso-objects/index.d.ts +14 -1
- package/types/iso-objects/looks.d.ts +4 -0
- package/types/iso-objects/motion-builder.d.ts +105 -0
- package/types/iso-objects/motion-doc.d.ts +787 -0
- package/types/iso-objects/motion-entry.d.ts +10 -0
- package/types/iso-objects/motion.d.ts +200 -0
- package/types/iso-objects/resolve.d.ts +20 -0
- package/types/iso-objects/scene.d.ts +11 -0
- package/types/iso-objects/timeline.d.ts +46 -0
- package/types/iso-objects/types.d.ts +32 -0
- package/types/iso-systems/compile.d.ts +20 -3
- package/types/iso-systems/index.d.ts +4 -1
- package/types/iso-systems/render.d.ts +21 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './motion.js';
|
|
2
|
+
export { bindMotion, motionOfSteps } from './timeline.js';
|
|
3
|
+
export type { Timeline, BindOptions, BeatInfo, Cue } from './timeline.js';
|
|
4
|
+
export { motion, MotionBuilder, SeriesBuilder, NodesBuilder } from './motion-builder.js';
|
|
5
|
+
export type { SequenceOptions, Timing, CameraVerbs, Ids as MotionIds } from './motion-builder.js';
|
|
6
|
+
export { MOTION_SCHEMA, EASING_NAMES, EXTRAPOLATE, checkMotion, msOf, readMs, easeOf, curveAt, springAt, bezier } from './motion-doc.js';
|
|
7
|
+
export type { MotionDoc, MotionNode, MotionTime, MotionEase, EasingName, Extrapolate, SpringConfig, Curve, Say as MotionSay, Focus, ReadTime, Sequence, SeriesItem, Transition, MotionDiag } from './motion-doc.js';
|
|
8
|
+
export { withAnts, antsOf, antDash, ANTS_CSS, ANT_SPEED, ANT_DASH, ANT_STILL } from './ants.js';
|
|
9
|
+
export type { AntsOptions } from './ants.js';
|
|
10
|
+
export { drawLooks } from './looks.js';
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import type { CompiledScene } from './compile.js';
|
|
2
|
+
import type { RawMotion } from './types.js';
|
|
3
|
+
import { type Assembly } from './assemble.js';
|
|
4
|
+
import { type Rect } from './labels.js';
|
|
5
|
+
export declare const ASSEMBLE_STYLES: readonly ['edge', 'drop', 'rise', 'fly', 'pop', 'scatter', 'build', 'fade'];
|
|
6
|
+
export declare const DISASSEMBLE_STYLES: readonly ['explode', 'lift-off', 'sink', 'scatter', 'fly-out', 'collapse', 'fade', 'reverse'];
|
|
7
|
+
export declare const MOTION_ORDERS: readonly ['by-depth', 'by-layer', 'by-region', 'by-flow', 'as-listed', 'random'];
|
|
8
|
+
export declare const MOTION_EASINGS: readonly ['linear', 'ease', 'ease-in', 'ease-out', 'settle', 'spring', 'bounce'];
|
|
9
|
+
export type AssembleStyle = typeof ASSEMBLE_STYLES[number];
|
|
10
|
+
export type DisassembleStyle = typeof DISASSEMBLE_STYLES[number];
|
|
11
|
+
export type MotionOrder = typeof MOTION_ORDERS[number];
|
|
12
|
+
export type MotionEasing = typeof MOTION_EASINGS[number];
|
|
13
|
+
export type Direction = 'left' | 'right' | 'top' | 'bottom';
|
|
14
|
+
/** what one piece's (or a region's contents') `motion:` in the file may say */
|
|
15
|
+
export type PieceMotion = RawMotion;
|
|
16
|
+
interface CommonOptions {
|
|
17
|
+
order?: MotionOrder;
|
|
18
|
+
/** where by-flow starts: a piece's id (default: the first piece no connector ends at) */
|
|
19
|
+
source?: string;
|
|
20
|
+
connectors?: 'draw' | 'grow' | 'fade';
|
|
21
|
+
/** after the connectors are in (before they go): a token runs along each, once */
|
|
22
|
+
pulses?: boolean;
|
|
23
|
+
labels?: 'fade' | 'type' | 'with-piece';
|
|
24
|
+
/** the whole plan's length, ms: everything is scaled to it (default: as long as it comes to) */
|
|
25
|
+
duration?: number;
|
|
26
|
+
/** ms between one piece's start and the next's */
|
|
27
|
+
stagger?: number;
|
|
28
|
+
/** ms one piece's move takes */
|
|
29
|
+
piece?: number;
|
|
30
|
+
/** how much of the next part (pieces, connectors, labels) runs over the end of the one before, 0 to 1 */
|
|
31
|
+
overlap?: number;
|
|
32
|
+
easing?: MotionEasing;
|
|
33
|
+
/** fly, fly-out: the side it comes from or goes to */
|
|
34
|
+
from?: Direction;
|
|
35
|
+
seed?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface AssembleOptions extends CommonOptions {
|
|
38
|
+
style?: AssembleStyle;
|
|
39
|
+
}
|
|
40
|
+
export interface DisassembleOptions extends CommonOptions {
|
|
41
|
+
style?: DisassembleStyle;
|
|
42
|
+
/** explode, collapse: the point (in the drawing's units), or a piece's id (default: the drawing's middle; collapse
|
|
43
|
+
* into the region that holds each piece: 'region') */
|
|
44
|
+
point?: [number, number] | string;
|
|
45
|
+
/** reverse: the assemble style it plays backwards */
|
|
46
|
+
of?: AssembleStyle;
|
|
47
|
+
}
|
|
48
|
+
export interface MotionPiece {
|
|
49
|
+
id: string;
|
|
50
|
+
kind: 'region' | 'node';
|
|
51
|
+
parent?: string;
|
|
52
|
+
depth: number;
|
|
53
|
+
layer: number;
|
|
54
|
+
key: number;
|
|
55
|
+
bbox: Rect;
|
|
56
|
+
/** the middle of its footprint, and its bottom outline (left, front, right corner), in the drawing's units */
|
|
57
|
+
foot: [number, number];
|
|
58
|
+
base: [number, number][];
|
|
59
|
+
motion?: PieceMotion;
|
|
60
|
+
}
|
|
61
|
+
export interface MotionModel {
|
|
62
|
+
viewBox: [number, number, number, number];
|
|
63
|
+
pieces: MotionPiece[];
|
|
64
|
+
routes: {
|
|
65
|
+
id: string;
|
|
66
|
+
path: string;
|
|
67
|
+
from?: string;
|
|
68
|
+
to?: string;
|
|
69
|
+
}[];
|
|
70
|
+
/** notes' ids and what they are on (a piece or a route) */
|
|
71
|
+
notes: Record<string, string | undefined>;
|
|
72
|
+
/** the build-time intro's own timing (`edge` with no other timing given plays exactly it) */
|
|
73
|
+
intro: Assembly;
|
|
74
|
+
}
|
|
75
|
+
export declare function motionModel(s: CompiledScene): MotionModel;
|
|
76
|
+
/** a thing's block, walls, gate and name: what is not given is as in the still */
|
|
77
|
+
export interface ItemState {
|
|
78
|
+
opacity?: number;
|
|
79
|
+
/** in the drawing's units */
|
|
80
|
+
dx?: number;
|
|
81
|
+
dy?: number;
|
|
82
|
+
/** about `about` (default: the drawing's origin) */
|
|
83
|
+
scale?: number;
|
|
84
|
+
about?: [number, number];
|
|
85
|
+
/** only what is inside this shows (a polygon, before the offset) */
|
|
86
|
+
clip?: [number, number][];
|
|
87
|
+
}
|
|
88
|
+
/** a label or a note: faded, or typed so far (0 to 1) */
|
|
89
|
+
export interface LabelState {
|
|
90
|
+
opacity?: number;
|
|
91
|
+
typed?: number;
|
|
92
|
+
dx?: number;
|
|
93
|
+
dy?: number;
|
|
94
|
+
}
|
|
95
|
+
/** a connector: how much of it is drawn (0 to 1: its arrowhead shows at 1), stroked in, or growing from its source */
|
|
96
|
+
export interface RouteState {
|
|
97
|
+
opacity?: number;
|
|
98
|
+
drawn?: number;
|
|
99
|
+
by?: 'stroke' | 'grow';
|
|
100
|
+
/** (a timeline's) marching dashes: on and off, and how far they have marched, in the drawing's units along it */
|
|
101
|
+
ants?: {
|
|
102
|
+
dash: [number, number];
|
|
103
|
+
offset: number;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/** Plain JSON. Empty: the still render. What isn't named is as in the still. */
|
|
107
|
+
export interface SceneState {
|
|
108
|
+
items?: Record<string, ItemState>;
|
|
109
|
+
/** by the id of a thing, a connector or a note */
|
|
110
|
+
labels?: Record<string, LabelState>;
|
|
111
|
+
routes?: Record<string, RouteState>;
|
|
112
|
+
/** by the id of a thing: how much of each of its looks is there (the rest is its own), 0 to 1 */
|
|
113
|
+
variants?: Record<string, Record<string, number>>;
|
|
114
|
+
/** the step marks' and badges' layers */
|
|
115
|
+
marks?: {
|
|
116
|
+
opacity: number;
|
|
117
|
+
};
|
|
118
|
+
/** a token on a connector, a fraction (0 to 1) of the way along it */
|
|
119
|
+
tokens?: {
|
|
120
|
+
route: string;
|
|
121
|
+
at: number;
|
|
122
|
+
color?: string;
|
|
123
|
+
kind?: string;
|
|
124
|
+
}[];
|
|
125
|
+
/** a ring round a point */
|
|
126
|
+
pulses?: {
|
|
127
|
+
x: number;
|
|
128
|
+
y: number;
|
|
129
|
+
rx: number;
|
|
130
|
+
ry: number;
|
|
131
|
+
opacity?: number;
|
|
132
|
+
color?: string;
|
|
133
|
+
}[];
|
|
134
|
+
/** (a timeline's) an outline round a thing: its silhouette */
|
|
135
|
+
outlines?: {
|
|
136
|
+
id: string;
|
|
137
|
+
points: [number, number][];
|
|
138
|
+
opacity?: number;
|
|
139
|
+
color?: string;
|
|
140
|
+
}[];
|
|
141
|
+
/** the view, in the drawing's units */
|
|
142
|
+
camera?: [number, number, number, number];
|
|
143
|
+
/** how far toward the 2D view (0 to 1): a morph's, for a host that draws one; svgAt and paint draw the 3D view */
|
|
144
|
+
morph?: number;
|
|
145
|
+
}
|
|
146
|
+
export interface MotionPlan {
|
|
147
|
+
kind: 'assemble' | 'disassemble';
|
|
148
|
+
/** ms */
|
|
149
|
+
duration: number;
|
|
150
|
+
/** when each piece moves, in the order it does */
|
|
151
|
+
pieces: {
|
|
152
|
+
id: string;
|
|
153
|
+
delay: number;
|
|
154
|
+
dur: number;
|
|
155
|
+
style: string;
|
|
156
|
+
}[];
|
|
157
|
+
routes: {
|
|
158
|
+
id: string;
|
|
159
|
+
delay: number;
|
|
160
|
+
dur: number;
|
|
161
|
+
}[];
|
|
162
|
+
labels: {
|
|
163
|
+
delay: number;
|
|
164
|
+
dur: number;
|
|
165
|
+
};
|
|
166
|
+
/** what the scene looks like at t ms: plain JSON, the same for the same t */
|
|
167
|
+
at(t: number): SceneState;
|
|
168
|
+
}
|
|
169
|
+
export interface ScenePlan extends MotionPlan {
|
|
170
|
+
/** the scene's SVG at t ms, as text: svgAt(scene, at(t)) */
|
|
171
|
+
frame(t: number): string;
|
|
172
|
+
}
|
|
173
|
+
/** the order the pieces move in: what they stand on, or are in, never after them (but as-listed and random) */
|
|
174
|
+
export declare function motionOrder(m: MotionModel, order: MotionOrder, o?: {
|
|
175
|
+
seed?: number;
|
|
176
|
+
source?: string;
|
|
177
|
+
}): MotionPiece[];
|
|
178
|
+
/** either's options: the style is the plan's own kind's */
|
|
179
|
+
export type PlanOptions = Omit<AssembleOptions & DisassembleOptions, 'style'> & {
|
|
180
|
+
style?: AssembleStyle | DisassembleStyle;
|
|
181
|
+
};
|
|
182
|
+
type AnyOptions = PlanOptions;
|
|
183
|
+
export declare function planOf(m: MotionModel, kind: 'assemble' | 'disassemble', opts?: AnyOptions): MotionPlan;
|
|
184
|
+
/** a point a fraction of the way along an SVG polyline path ("M x,y L x,y …") */
|
|
185
|
+
export declare function alongPath(d: string, f: number): [number, number];
|
|
186
|
+
/** the start of a text run: an entity counts as one character */
|
|
187
|
+
export declare function typed(s: string, f: number): string;
|
|
188
|
+
type Looks = Pick<CompiledScene['rendered'], 'svg' | 'variants' | 'looks'>;
|
|
189
|
+
/** A scene as it looks in a state, as SVG text. An empty state is the still render itself, byte for byte. */
|
|
190
|
+
export declare function svgAt(scene: Pick<CompiledScene, 'rendered' | 'id'>, S: SceneState): string;
|
|
191
|
+
/** The same on a live drawing (a scene's own <svg>). Idempotent, in any order: what the last state changed is put back
|
|
192
|
+
* first, so the same state gives the same DOM; an empty state gives the still back. */
|
|
193
|
+
export declare function paint(svg: SVGSVGElement, S: SceneState, rendered?: Looks): void;
|
|
194
|
+
/** the drawing arrives: frame(0) is empty, frame(duration) is the still render */
|
|
195
|
+
export declare const assemble: (s: CompiledScene, o?: AssembleOptions) => ScenePlan;
|
|
196
|
+
/** the drawing leaves: frame(0) is the still render, frame(duration) is empty */
|
|
197
|
+
export declare const disassemble: (s: CompiledScene, o?: DisassembleOptions) => ScenePlan;
|
|
198
|
+
/** A frame of the page's intro (the default assemble) at t ms, as SVG text. */
|
|
199
|
+
export declare const introSvg: (s: CompiledScene, t: number) => string;
|
|
200
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Theme } from './types.js';
|
|
2
|
+
export type ThemeMode = 'light' | 'dark';
|
|
3
|
+
export interface ResolveOptions {
|
|
4
|
+
mode: ThemeMode;
|
|
5
|
+
theme: Theme;
|
|
6
|
+
/** the drawing's stylesheets, in order, after the theme's */
|
|
7
|
+
css: string;
|
|
8
|
+
/** the fonts the texts ask for (a stack each) */
|
|
9
|
+
fonts?: {
|
|
10
|
+
sans: string;
|
|
11
|
+
mono: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare const FONT_STACKS: {
|
|
15
|
+
sans: string;
|
|
16
|
+
mono: string;
|
|
17
|
+
};
|
|
18
|
+
/** The drawing, self-contained, in one of its theme's modes. What its stylesheets hide is left out of the paint (display
|
|
19
|
+
* none); ids, classes and data- attributes stay. */
|
|
20
|
+
export declare function resolveSvg(svg: string, o: ResolveOptions): string;
|
|
@@ -26,6 +26,17 @@ export interface RenderedScene {
|
|
|
26
26
|
paths: Record<string, string>;
|
|
27
27
|
/** things drawn worse than asked, e.g. a route label shortened or dropped */
|
|
28
28
|
warnings: RenderWarning[];
|
|
29
|
+
/** (0.15.0) a self-contained drawing's own colours, for what a state adds to it (a token's rim and fill) */
|
|
30
|
+
inks?: {
|
|
31
|
+
surface: string;
|
|
32
|
+
control: string;
|
|
33
|
+
kinds?: Record<string, string>;
|
|
34
|
+
};
|
|
35
|
+
/** the drawing with every thing that has a look of this name in it, as SVG text (what a switch takes the thing's parts from);
|
|
36
|
+
* none when nothing declares one */
|
|
37
|
+
variants?: Record<string, string>;
|
|
38
|
+
/** the looks each thing declares */
|
|
39
|
+
looks?: Record<string, string[]>;
|
|
29
40
|
/** the assemble intro's timeline */
|
|
30
41
|
assembly: Assembly;
|
|
31
42
|
/** callout pills in screen px, per step, for layout tests */
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { CompiledScene } from './compile.js';
|
|
2
|
+
import { type SceneState } from './motion.js';
|
|
3
|
+
import { type MotionDiag, type MotionDoc, type Say } from './motion-doc.js';
|
|
4
|
+
export interface BeatInfo {
|
|
5
|
+
name: string;
|
|
6
|
+
index: number;
|
|
7
|
+
start: number;
|
|
8
|
+
end: number;
|
|
9
|
+
say?: Say;
|
|
10
|
+
}
|
|
11
|
+
export interface Cue {
|
|
12
|
+
beat: string;
|
|
13
|
+
chapter?: string;
|
|
14
|
+
index: number;
|
|
15
|
+
of: number;
|
|
16
|
+
progress: number;
|
|
17
|
+
say?: Say;
|
|
18
|
+
color?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface Timeline {
|
|
21
|
+
readonly ok: boolean;
|
|
22
|
+
readonly diags: MotionDiag[];
|
|
23
|
+
/** ms */
|
|
24
|
+
readonly duration: number;
|
|
25
|
+
readonly beats: BeatInfo[];
|
|
26
|
+
readonly markers: Record<string, number>;
|
|
27
|
+
/** what the drawing looks like at ms. `ambient`: the ambient clock's time (default: the same; a host that stopped it passes the time it
|
|
28
|
+
* stopped at, and what loops stands where it was), or 'off': it never ran, and each loop stands at its start */
|
|
29
|
+
at(ms: number, o?: {
|
|
30
|
+
ambient?: number | 'off';
|
|
31
|
+
}): SceneState;
|
|
32
|
+
cues(ms: number): Cue | undefined;
|
|
33
|
+
beatAt(ms: number): BeatInfo | undefined;
|
|
34
|
+
startOf(name: string): number | undefined;
|
|
35
|
+
}
|
|
36
|
+
export interface BindOptions {
|
|
37
|
+
/** the connectors' dashes, by kind: the theme's `kinds` (a dashed kind marches with its own dash) */
|
|
38
|
+
kinds?: Record<string, {
|
|
39
|
+
dash?: 'solid' | 'dashed' | 'dotted';
|
|
40
|
+
}>;
|
|
41
|
+
/** kinds whose connectors stand still (default: blocked, planned) */
|
|
42
|
+
still?: string[];
|
|
43
|
+
}
|
|
44
|
+
export declare function bindMotion(scene: CompiledScene, doc: MotionDoc, opts?: BindOptions): Timeline;
|
|
45
|
+
/** A drawing's own steps as a motion document, so that every drawing with steps has a timeline. */
|
|
46
|
+
export declare function motionOfSteps(scene: CompiledScene): MotionDoc;
|
|
@@ -3,6 +3,16 @@ import type { RawRole, RawKind, Theme } from '../iso-core/theme.js';
|
|
|
3
3
|
export type { RawRole, RawKind, Theme };
|
|
4
4
|
export type Side = 'n' | 'e' | 's' | 'w';
|
|
5
5
|
export type StepRef = string | number;
|
|
6
|
+
/** how one piece (and, a region's, its contents) moves when a drawing assembles or disassembles (motion.ts) */
|
|
7
|
+
export interface RawMotion {
|
|
8
|
+
style?: 'edge' | 'drop' | 'rise' | 'fly' | 'pop' | 'scatter' | 'build' | 'fade';
|
|
9
|
+
out?: 'explode' | 'lift-off' | 'sink' | 'scatter' | 'fly-out' | 'collapse' | 'fade' | 'reverse';
|
|
10
|
+
easing?: 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'settle' | 'spring' | 'bounce';
|
|
11
|
+
from?: 'left' | 'right' | 'top' | 'bottom';
|
|
12
|
+
/** ms after its turn, and ms its own move takes */
|
|
13
|
+
delay?: number;
|
|
14
|
+
duration?: number;
|
|
15
|
+
}
|
|
6
16
|
export interface RawPlacement {
|
|
7
17
|
in?: string;
|
|
8
18
|
at?: [number, number];
|
|
@@ -39,6 +49,18 @@ export interface RawNode extends RawPlacement {
|
|
|
39
49
|
dy?: number;
|
|
40
50
|
};
|
|
41
51
|
nodes?: RawNode[];
|
|
52
|
+
motion?: RawMotion;
|
|
53
|
+
/** other looks of it, by name, for a motion to switch to: its own keys, over what it is */
|
|
54
|
+
variants?: Record<string, RawVariant>;
|
|
55
|
+
}
|
|
56
|
+
/** what a look may change: never the thing's box, so nothing else moves */
|
|
57
|
+
export interface RawVariant {
|
|
58
|
+
role?: string;
|
|
59
|
+
ghost?: boolean;
|
|
60
|
+
label?: string;
|
|
61
|
+
sub?: string;
|
|
62
|
+
face?: string;
|
|
63
|
+
deco?: RawDeco[];
|
|
42
64
|
}
|
|
43
65
|
export interface RawGate {
|
|
44
66
|
side: Side;
|
|
@@ -63,6 +85,8 @@ export interface RawRegion extends RawPlacement {
|
|
|
63
85
|
around?: string[];
|
|
64
86
|
regions?: RawRegion[];
|
|
65
87
|
nodes?: RawNode[];
|
|
88
|
+
motion?: RawMotion;
|
|
89
|
+
variants?: Record<string, RawVariant>;
|
|
66
90
|
}
|
|
67
91
|
export interface RawNote {
|
|
68
92
|
floor?: string;
|
|
@@ -98,6 +122,14 @@ export interface RawScene {
|
|
|
98
122
|
grid?: GridDef;
|
|
99
123
|
assemble?: boolean;
|
|
100
124
|
dim?: 'flows' | 'all';
|
|
125
|
+
/** the scene's motion document (its `isomotion: 1` may be left out) */
|
|
126
|
+
motion?: Record<string, unknown>;
|
|
127
|
+
/** its connectors march: all that may, these, or these with a speed and a dash (ants.ts) */
|
|
128
|
+
ants?: boolean | string[] | {
|
|
129
|
+
ids?: string[];
|
|
130
|
+
speed?: number;
|
|
131
|
+
dash?: [number, number];
|
|
132
|
+
};
|
|
101
133
|
}
|
|
102
134
|
export interface GridDef {
|
|
103
135
|
snap?: number;
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
+
import type { Diag } from '../iso-core/errors.js';
|
|
1
2
|
import { type Compiled } from '../iso-objects/compile.js';
|
|
3
|
+
import { type ThemeMode } from '../iso-objects/resolve.js';
|
|
2
4
|
export type { Compiled, CompiledScene } from '../iso-objects/compile.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
export interface CompileOptions {
|
|
6
|
+
/** overrides every scene's grid snap (the editor's snap control) */
|
|
5
7
|
snap?: number;
|
|
6
|
-
|
|
8
|
+
/** which of the theme's modes a self-contained drawing is in (default: light) */
|
|
9
|
+
mode?: ThemeMode;
|
|
10
|
+
/** (0.15.0) self-contained drawings: each scene's SVG has its colours and text styles on its elements, in `mode`: no
|
|
11
|
+
* stylesheet, no custom properties, no hsl() or color-mix() (svgAt's frames too) */
|
|
12
|
+
resolveVars?: boolean;
|
|
13
|
+
/** a file with an error draws nothing: `scenes` is empty (true), or it throws ('throw'). Default: what could be laid
|
|
14
|
+
* out is in `scenes` all the same, with `ok` false */
|
|
15
|
+
strict?: boolean | 'throw';
|
|
16
|
+
/** ms each step lasts, for a video (default: by the length of its words) */
|
|
17
|
+
stepMs?: number;
|
|
18
|
+
}
|
|
19
|
+
export declare class CompileError extends Error {
|
|
20
|
+
diags: Diag[];
|
|
21
|
+
constructor(diags: Diag[]);
|
|
22
|
+
}
|
|
23
|
+
export declare function compile(source: string, themeText: string, opts?: CompileOptions): Compiled;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export { NODE_ASSETS, getAsset } from './nodes.js';
|
|
2
2
|
export { REGION_KINDS, systems } from './catalog.js';
|
|
3
3
|
export { DRAWING_CSS, BASE_CSS } from './css.js';
|
|
4
|
-
export { compile } from './compile.js';
|
|
4
|
+
export { compile, CompileError } from './compile.js';
|
|
5
|
+
export type { CompileOptions } from './compile.js';
|
|
6
|
+
export { renderSvg } from './render.js';
|
|
7
|
+
export type { RenderSvgOptions } from './render.js';
|
|
5
8
|
export type { Compiled, CompiledScene } from './compile.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type AntsOptions } from '../iso-objects/ants.js';
|
|
2
|
+
import type { MotionDoc } from '../iso-objects/motion-doc.js';
|
|
3
|
+
import type { ThemeMode } from '../iso-objects/resolve.js';
|
|
4
|
+
export interface RenderSvgOptions {
|
|
5
|
+
/** the theme's text */
|
|
6
|
+
theme: string;
|
|
7
|
+
mode?: ThemeMode;
|
|
8
|
+
/** which scene: its id or its place (default: the first) */
|
|
9
|
+
scene?: string | number;
|
|
10
|
+
/** a moment of its motion, ms: the still without it */
|
|
11
|
+
t?: number;
|
|
12
|
+
/** the motion (default: the scene's own in the file) */
|
|
13
|
+
motion?: MotionDoc;
|
|
14
|
+
/** the ambient clock at that moment (default: t), or 'off': what loops stands at its start (a still's ants too) */
|
|
15
|
+
ambient?: number | 'off';
|
|
16
|
+
/** the still's connectors march, by an animation in the SVG itself (default: as the scene's `ants:` in the file says; a
|
|
17
|
+
* frame's are its motion's, and where that says nothing, the file's) */
|
|
18
|
+
ants?: boolean | Omit<AntsOptions, 'by' | 'kinds'>;
|
|
19
|
+
}
|
|
20
|
+
/** Throws, with every fault and its line, when the file or its motion has one. */
|
|
21
|
+
export declare function renderSvg(source: string, o: RenderSvgOptions): string;
|