@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,57 @@
|
|
|
1
|
+
import type { EditorModel } from '../model.js';
|
|
2
|
+
import type { SchemaNav } from '../schema-nav.js';
|
|
3
|
+
import type { Problem } from '../validate.js';
|
|
4
|
+
import type { Commands } from '../commands.js';
|
|
5
|
+
import type { ObjectKindInfo, ObjectRef, RefSlot } from '../adapter.js';
|
|
6
|
+
import { type Actions } from './actions.js';
|
|
7
|
+
import { type Path } from '../path.js';
|
|
8
|
+
/** what the panel shows of the domain */
|
|
9
|
+
export interface PropsUi {
|
|
10
|
+
/** keys worth showing even when unset */
|
|
11
|
+
important(kind: string, value: Record<string, unknown>, external: boolean): string[];
|
|
12
|
+
/** an object that exists elsewhere (only its reference keys apply) */
|
|
13
|
+
isExternal(value: unknown): boolean;
|
|
14
|
+
/** a key one object inherits (its value, and where from), given the domain's reading; and every key it inherits */
|
|
15
|
+
inherited?(path: Path, key: string, read: unknown): {
|
|
16
|
+
value: unknown;
|
|
17
|
+
from?: string;
|
|
18
|
+
} | undefined;
|
|
19
|
+
inheritedKeys?(path: Path, read: unknown): string[];
|
|
20
|
+
/** where inherited values come from, when the reading doesn't say */
|
|
21
|
+
inheritedFrom: string;
|
|
22
|
+
/** what is true now about an object, as rows (undefined: not shown; empty: not known) */
|
|
23
|
+
facts?(now: unknown): {
|
|
24
|
+
term: string;
|
|
25
|
+
def: string;
|
|
26
|
+
cls?: string;
|
|
27
|
+
}[] | undefined;
|
|
28
|
+
/** an x- key's words */
|
|
29
|
+
extensionDoc: string;
|
|
30
|
+
/** the root's title, and its words in a list */
|
|
31
|
+
rootTitle: string;
|
|
32
|
+
rootItem: string;
|
|
33
|
+
}
|
|
34
|
+
/** what the panel is given of the domain */
|
|
35
|
+
export interface PropsKit {
|
|
36
|
+
commands: Pick<Commands, 'setCmd' | 'deleteCmd' | 'insertItemCmd' | 'referencesTo' | 'describe'>;
|
|
37
|
+
actions: Pick<Actions, 'deletePaths' | 'renameDialog'>;
|
|
38
|
+
slotAt(ptr: string): RefSlot | undefined;
|
|
39
|
+
objectOf(ptr: string): ObjectRef | undefined;
|
|
40
|
+
kinds: ObjectKindInfo[];
|
|
41
|
+
ui: PropsUi;
|
|
42
|
+
}
|
|
43
|
+
export interface PropsOpts {
|
|
44
|
+
kit: PropsKit;
|
|
45
|
+
nav(): SchemaNav;
|
|
46
|
+
problems(): Problem[];
|
|
47
|
+
/** the domain's reading of the file (the kit's inherited() reads it) */
|
|
48
|
+
read(): unknown;
|
|
49
|
+
note(t: string, tone?: 'info' | 'warn' | 'bad'): void;
|
|
50
|
+
showInText(p: Path): void;
|
|
51
|
+
/** while the host's state is shown, what is true now about an object (the kit's facts() reads it); undefined while not */
|
|
52
|
+
now?(ptr: string): unknown;
|
|
53
|
+
}
|
|
54
|
+
export declare function propsPanel(body: HTMLElement, doc: EditorModel, opts: PropsOpts): {
|
|
55
|
+
paint: () => void;
|
|
56
|
+
dispose: () => void;
|
|
57
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** One selector under the root: html, body and :root (with any state they name) become the root itself; * is the
|
|
2
|
+
* root and everything in it. */
|
|
3
|
+
export declare function scopeOne(sel: string, root: string): string;
|
|
4
|
+
/** Scope a stylesheet to the root class. */
|
|
5
|
+
export declare function scopeCss(css: string, root: string): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { DomainAdapter } from '../adapter.js';
|
|
2
|
+
import type { KindCatalog } from '../../iso-objects/kinds.js';
|
|
3
|
+
import { type CanvasKit, type CanvasDrawing } from './canvas.js';
|
|
4
|
+
import type { CanvasCtx, CanvasLayer } from './canvas-layer.js';
|
|
5
|
+
import type { EditorSetup, ShellWords } from './mount.js';
|
|
6
|
+
import type { PaneOpts } from './pane.js';
|
|
7
|
+
import type { MonacoPane } from './text.js';
|
|
8
|
+
import type { IconName } from './icons.js';
|
|
9
|
+
import type { KeyGroup } from './keys.js';
|
|
10
|
+
import type { EditorModel } from '../model.js';
|
|
11
|
+
import type { PartCtx, EditorPart } from './part.js';
|
|
12
|
+
/** what a domain gives besides its adapter */
|
|
13
|
+
export interface DomainView<R, D extends CanvasDrawing> {
|
|
14
|
+
/** a reading, drawn (the adapter's read() gives the reading) */
|
|
15
|
+
draw(read: R, data: unknown, theme: string): D;
|
|
16
|
+
catalog: KindCatalog;
|
|
17
|
+
theme: string;
|
|
18
|
+
/** the file's name when the host gives none */
|
|
19
|
+
fileName: string;
|
|
20
|
+
/** what a name must be, and the rule in words */
|
|
21
|
+
nameRule?: RegExp;
|
|
22
|
+
nameHint?: string;
|
|
23
|
+
/** a kind's icon (default: box) */
|
|
24
|
+
icon?(kind: string): IconName;
|
|
25
|
+
/** the domain's own icons, as 24 × 24 SVG bodies by name (stroke in currentColor, as Lucide's), added to L3's */
|
|
26
|
+
icons?: Record<string, string>;
|
|
27
|
+
words?: Partial<ShellWords>;
|
|
28
|
+
keymap?: KeyGroup[];
|
|
29
|
+
/** (0.10.0) the palette's entries: presets of a kind, each with its label, icon, what a new one starts as (a copy of
|
|
30
|
+
* `value`; default: the kind's template) and the base of its fresh name. None: one entry per kind, as before */
|
|
31
|
+
palette?: {
|
|
32
|
+
kind: string;
|
|
33
|
+
label: string;
|
|
34
|
+
icon?: string;
|
|
35
|
+
value?: unknown;
|
|
36
|
+
name?: string;
|
|
37
|
+
}[];
|
|
38
|
+
/** the canvas's 2D view (0.6.0): a 3D | 2D switch; its link kinds' styles (the host's canvas CSS adds flatCss) */
|
|
39
|
+
flat?: CanvasKit<R, D>['flat'];
|
|
40
|
+
/** a layer over the canvas, and a part beside the views (A: their calls) */
|
|
41
|
+
layer?(ctx: CanvasCtx<D>): CanvasLayer<object>;
|
|
42
|
+
part?(ctx: PartCtx): EditorPart<object>;
|
|
43
|
+
}
|
|
44
|
+
/** the plain shell's words */
|
|
45
|
+
export declare const PLAIN_WORDS: ShellWords;
|
|
46
|
+
/** the plain keymap: the shell's own keys */
|
|
47
|
+
export declare const PLAIN_KEYMAP: KeyGroup[];
|
|
48
|
+
/** The kits and features for an adapter (R: its reading; D: its drawing), with the text pane if the host has one. */
|
|
49
|
+
export declare function setupFor<R, D extends CanvasDrawing>(a: DomainAdapter, v: DomainView<R, D>, textPane?: (el: HTMLElement, doc: EditorModel, o: PaneOpts) => MonacoPane): EditorSetup<R, undefined, object>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import 'monaco-editor/languages/definitions/yaml/register.js';
|
|
2
|
+
import type { EditorModel } from '../model.js';
|
|
3
|
+
import type { TextPane, PaneOpts } from './pane.js';
|
|
4
|
+
export type Monaco = typeof import('monaco-editor/editor/editor.api.js');
|
|
5
|
+
export declare const monaco: Monaco;
|
|
6
|
+
type IModel = import('monaco-editor/editor/editor.api.js').editor.ITextModel;
|
|
7
|
+
/** threads Monaco has made and not been given back (for the tests) */
|
|
8
|
+
export declare const liveThreads: () => number;
|
|
9
|
+
export type MonacoPane = TextPane & {
|
|
10
|
+
editor: import('monaco-editor/editor/editor.api.js').editor.IStandaloneCodeEditor;
|
|
11
|
+
model: IModel;
|
|
12
|
+
monaco: Monaco;
|
|
13
|
+
setReadOnly(ro: boolean): void;
|
|
14
|
+
dispose(): void;
|
|
15
|
+
};
|
|
16
|
+
export declare function textPane(el: HTMLElement, doc: EditorModel, opts: PaneOpts): MonacoPane;
|
|
17
|
+
/** Monaco themes made from the page's tokens (--surface, --ink…), as the page resolves them now (light or dark). */
|
|
18
|
+
export declare function paneTheme(dark: boolean, within?: HTMLElement): string;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type IconName } from './icons.js';
|
|
2
|
+
import { type OutlineNode } from '../outline.js';
|
|
3
|
+
import type { EditorModel } from '../model.js';
|
|
4
|
+
import type { EditorDoc } from '../doc.js';
|
|
5
|
+
import type { SchemaNav } from '../schema-nav.js';
|
|
6
|
+
import type { Problem } from '../validate.js';
|
|
7
|
+
import type { Commands } from '../commands.js';
|
|
8
|
+
import type { FileRole, ObjectKindInfo, RefSlot } from '../adapter.js';
|
|
9
|
+
import { type Path } from '../path.js';
|
|
10
|
+
/** a "New …" entry for a kind's group: its words, its icon, and what it starts as (default: the kind's) */
|
|
11
|
+
export interface NewItem {
|
|
12
|
+
label: string;
|
|
13
|
+
icon: IconName;
|
|
14
|
+
desc?: string;
|
|
15
|
+
template?: () => unknown;
|
|
16
|
+
stem?: string;
|
|
17
|
+
}
|
|
18
|
+
/** an entry an entry group offers: its words, its icon, its key (made unique) and its value */
|
|
19
|
+
export interface EntryItem {
|
|
20
|
+
label: string;
|
|
21
|
+
icon: IconName;
|
|
22
|
+
entry: string;
|
|
23
|
+
value: unknown;
|
|
24
|
+
cmdLabel?: string;
|
|
25
|
+
when?: (data: Record<string, unknown>) => boolean;
|
|
26
|
+
}
|
|
27
|
+
/** what the tree shows of the domain, in its words */
|
|
28
|
+
export interface TreeUi {
|
|
29
|
+
/** the tree's aria-label */
|
|
30
|
+
label: string;
|
|
31
|
+
rootIcon: IconName;
|
|
32
|
+
kindIcon(kind: string): IconName;
|
|
33
|
+
/** a top-level key's icon, if it has one */
|
|
34
|
+
keyIcon(key: string): IconName | undefined;
|
|
35
|
+
/** an entry group's entries' icon */
|
|
36
|
+
entryIcon(group: string): IconName;
|
|
37
|
+
/** a kind's group's "New …" entries, in order */
|
|
38
|
+
newItems(kind: string): NewItem[];
|
|
39
|
+
/** an entry group's own add items (its entries made from the file: owned, not yet entered) */
|
|
40
|
+
entryItems?(group: Path, data: Record<string, unknown>, owned: (kind: string) => string[]): EntryItem[];
|
|
41
|
+
/** a tag's pill (none: no pill) */
|
|
42
|
+
tagPill(tag: string): {
|
|
43
|
+
title: string;
|
|
44
|
+
} | undefined;
|
|
45
|
+
/** the name rule, in words */
|
|
46
|
+
nameHint: string;
|
|
47
|
+
text: {
|
|
48
|
+
root: string;
|
|
49
|
+
rootAdd: string;
|
|
50
|
+
renameWhy: string;
|
|
51
|
+
deleteWhy: string;
|
|
52
|
+
duplicateNote: string;
|
|
53
|
+
duplicateWhy: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** what the tree is given of the domain */
|
|
57
|
+
export interface TreeKit {
|
|
58
|
+
outline(d: EditorDoc, role: FileRole, tags: Map<string, string>): OutlineNode;
|
|
59
|
+
commands: Pick<Commands, 'setCmd' | 'insertCmd' | 'insertItemCmd' | 'deleteCmd' | 'renameCmd' | 'renameKeyCmd' | 'duplicateCmd' | 'moveCmd' | 'moveItemCmd' | 'referencesTo' | 'describe' | 'freshName'>;
|
|
60
|
+
slotAt(ptr: string): RefSlot | undefined;
|
|
61
|
+
/** the kinds, in the outline's order */
|
|
62
|
+
kinds: ObjectKindInfo[];
|
|
63
|
+
/** named maps that aren't kinds (their names a pool of their own) */
|
|
64
|
+
entryGroups: Path[];
|
|
65
|
+
/** what a name must be */
|
|
66
|
+
nameRule: RegExp;
|
|
67
|
+
ui: TreeUi;
|
|
68
|
+
}
|
|
69
|
+
export interface TreeOpts {
|
|
70
|
+
kit: TreeKit;
|
|
71
|
+
nav(): SchemaNav;
|
|
72
|
+
problems(): Problem[];
|
|
73
|
+
role(): FileRole;
|
|
74
|
+
/** each object's tag as the reader resolved it, with the base files merged */
|
|
75
|
+
lifetimes(): Map<string, string>;
|
|
76
|
+
/** show a path in the text pane and give it the focus */
|
|
77
|
+
showInText(path: Path): void;
|
|
78
|
+
/** Copy, Cut and Paste for the menu */
|
|
79
|
+
clipItems?(): import('./menu.js').MenuItem[];
|
|
80
|
+
/** a message for the person (an edit that can't be made) */
|
|
81
|
+
note(text: string, tone?: 'info' | 'warn' | 'bad'): void;
|
|
82
|
+
}
|
|
83
|
+
export declare function treeView(el: HTMLElement, doc: EditorModel, opts: TreeOpts): {
|
|
84
|
+
paint: () => void;
|
|
85
|
+
dispose: () => void;
|
|
86
|
+
focus: () => void;
|
|
87
|
+
/** for the tests */
|
|
88
|
+
rows: () => {
|
|
89
|
+
id: string;
|
|
90
|
+
label: string;
|
|
91
|
+
depth: number;
|
|
92
|
+
kind: import("../outline.js").NodeKind;
|
|
93
|
+
value: string | undefined;
|
|
94
|
+
lifetime: string | undefined;
|
|
95
|
+
}[];
|
|
96
|
+
startEdit: (id: string, mode: 'rename' | 'value') => void;
|
|
97
|
+
remove: (ids: string[]) => Promise<void>;
|
|
98
|
+
duplicate: (id: string) => void;
|
|
99
|
+
expand: (id: string) => void;
|
|
100
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EditorDoc } from './doc.js';
|
|
2
|
+
import type { Diag } from '../iso-core/errors.js';
|
|
3
|
+
import type { PlaceAdapter, ReadAdapter } from './adapter.js';
|
|
4
|
+
export interface Problem {
|
|
5
|
+
severity: 'error' | 'warning';
|
|
6
|
+
message: string;
|
|
7
|
+
hint?: string;
|
|
8
|
+
path: string;
|
|
9
|
+
/** 1-based, end exclusive */
|
|
10
|
+
startLine: number;
|
|
11
|
+
startCol: number;
|
|
12
|
+
endLine: number;
|
|
13
|
+
endCol: number;
|
|
14
|
+
/** the other file it is in, when it isn't this one */
|
|
15
|
+
file?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ValidateOpts {
|
|
18
|
+
fileName?: string;
|
|
19
|
+
defaults?: {
|
|
20
|
+
name: string;
|
|
21
|
+
text: string;
|
|
22
|
+
}[];
|
|
23
|
+
/** problems resolving extends: (loops, missing files), from the server */
|
|
24
|
+
extendsDiags?: Diag[];
|
|
25
|
+
profiles?: string[];
|
|
26
|
+
}
|
|
27
|
+
/** The problems, and what the reader resolved: each object's tag (with the base files merged), and its own reading. */
|
|
28
|
+
export declare function analyse(a: ReadAdapter, text: string, opts: ValidateOpts & {
|
|
29
|
+
fileName: string;
|
|
30
|
+
}): {
|
|
31
|
+
problems: Problem[];
|
|
32
|
+
tags: Map<string, string>;
|
|
33
|
+
read?: unknown;
|
|
34
|
+
};
|
|
35
|
+
/** A diagnostic as a range in the text (a host's plan problem too: its pointer and line, made a Diag). */
|
|
36
|
+
export declare function place(a: PlaceAdapter, d: EditorDoc, x: Diag, fileName: string): Problem;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Theme, SaveResult } from '../ui/mount.js';
|
|
2
|
+
export declare const PROTOCOL = 1;
|
|
3
|
+
export type Refused = {
|
|
4
|
+
refused: string;
|
|
5
|
+
};
|
|
6
|
+
/** what a window can do: a newer window tells an older host what it lacks, and the reverse */
|
|
7
|
+
export interface Capabilities {
|
|
8
|
+
protocol: number;
|
|
9
|
+
features: string[];
|
|
10
|
+
messages: string[];
|
|
11
|
+
}
|
|
12
|
+
/** the window's messages every editor sends */
|
|
13
|
+
export type BaseToHost = {
|
|
14
|
+
v: 1;
|
|
15
|
+
type: 'hello';
|
|
16
|
+
capabilities: Capabilities;
|
|
17
|
+
} | {
|
|
18
|
+
v: 1;
|
|
19
|
+
type: 'save';
|
|
20
|
+
id: number;
|
|
21
|
+
text: string;
|
|
22
|
+
} | {
|
|
23
|
+
v: 1;
|
|
24
|
+
type: 'dirty';
|
|
25
|
+
dirty: boolean;
|
|
26
|
+
} | {
|
|
27
|
+
v: 1;
|
|
28
|
+
type: 'close';
|
|
29
|
+
};
|
|
30
|
+
/** the host's messages every editor takes (I: the domain's own fields in init) */
|
|
31
|
+
export type BaseToWindow<I extends object = object> = ({
|
|
32
|
+
v: 1;
|
|
33
|
+
type: 'init';
|
|
34
|
+
text: string;
|
|
35
|
+
fileName?: string;
|
|
36
|
+
readOnly?: boolean;
|
|
37
|
+
theme?: Theme;
|
|
38
|
+
features?: string[];
|
|
39
|
+
} & I) | {
|
|
40
|
+
v: 1;
|
|
41
|
+
type: 'text';
|
|
42
|
+
text: string;
|
|
43
|
+
} | {
|
|
44
|
+
v: 1;
|
|
45
|
+
type: 'read-only';
|
|
46
|
+
readOnly: boolean;
|
|
47
|
+
} | {
|
|
48
|
+
v: 1;
|
|
49
|
+
type: 'theme';
|
|
50
|
+
theme: Theme;
|
|
51
|
+
} | {
|
|
52
|
+
v: 1;
|
|
53
|
+
type: 'saved';
|
|
54
|
+
re: number;
|
|
55
|
+
result: SaveResult | Refused;
|
|
56
|
+
};
|
|
57
|
+
/** a message of this protocol, of a type the receiver knows (anything else is ignored, never an error) */
|
|
58
|
+
export declare function isMessage<T extends {
|
|
59
|
+
type: string;
|
|
60
|
+
}>(d: unknown, types: readonly string[]): d is T;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Routed } from './route.js';
|
|
2
|
+
import type { Layout } from './place.js';
|
|
3
|
+
import { type Rect } from './labels.js';
|
|
4
|
+
export type Edge = 'left' | 'right' | 'top' | 'bottom';
|
|
5
|
+
export interface Piece {
|
|
6
|
+
id: string;
|
|
7
|
+
kind: 'region' | 'node';
|
|
8
|
+
edge: Edge;
|
|
9
|
+
dx: number;
|
|
10
|
+
dy: number;
|
|
11
|
+
delay: number;
|
|
12
|
+
dur: number;
|
|
13
|
+
bbox: Rect;
|
|
14
|
+
}
|
|
15
|
+
export interface Assembly {
|
|
16
|
+
pieces: Piece[];
|
|
17
|
+
routes: {
|
|
18
|
+
id: string;
|
|
19
|
+
delay: number;
|
|
20
|
+
dur: number;
|
|
21
|
+
}[];
|
|
22
|
+
labels: {
|
|
23
|
+
delay: number;
|
|
24
|
+
dur: number;
|
|
25
|
+
};
|
|
26
|
+
/** ms until everything is in place */
|
|
27
|
+
total: number;
|
|
28
|
+
}
|
|
29
|
+
/** The edge of the canvas nearest a box, and the offset that puts the box fully outside the canvas beyond it. */
|
|
30
|
+
export declare function offscreen(b: Rect, vb: [number, number, number, number]): {
|
|
31
|
+
edge: Edge;
|
|
32
|
+
dx: number;
|
|
33
|
+
dy: number;
|
|
34
|
+
};
|
|
35
|
+
export declare function assembly(layout: Layout, routes: Routed[], vb: [number, number, number, number]): Assembly;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type Box, type Kernel } from '../iso-core/kernel.js';
|
|
2
|
+
import * as D from '../iso-core/glyphs.js';
|
|
3
|
+
import type { RawDeco, RawNode } from './types.js';
|
|
4
|
+
export interface LabelSpot {
|
|
5
|
+
/** screen pixels: where the label's first line's baseline sits */
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
anchor: 'start' | 'middle' | 'end';
|
|
9
|
+
}
|
|
10
|
+
export interface NodeAsset {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
/** default w (x), d (y), h (z) in grid units */
|
|
14
|
+
size: [number, number, number];
|
|
15
|
+
role: string;
|
|
16
|
+
deco?: RawDeco[];
|
|
17
|
+
/** SVG for the inside of the node's <g class="blk k-ROLE">; b is the node's box */
|
|
18
|
+
draw(k: Kernel, b: Box, n: RawNode): string;
|
|
19
|
+
/** where the label goes; default: centred above the top */
|
|
20
|
+
label?(b: Box, n: RawNode, hasSub: boolean): LabelSpot;
|
|
21
|
+
/** [x, y, z, r]: centre and radius (px) of the step pulse ring; default from the footprint */
|
|
22
|
+
pulse?(b: Box): [number, number, number, number];
|
|
23
|
+
/** extra classes for the node group */
|
|
24
|
+
cls?: string;
|
|
25
|
+
}
|
|
26
|
+
/** an icon a node can wear (deco: icon: NAME), painted on its box */
|
|
27
|
+
export type IconPainter = (k: Kernel, b: Box) => string;
|
|
28
|
+
/** `css`: the marks' styles; drawingCss() includes them from then on */
|
|
29
|
+
export declare function registerMarks(marks: {
|
|
30
|
+
icons?: Record<string, IconPainter>;
|
|
31
|
+
faces?: Record<string, D.FacePainter>;
|
|
32
|
+
css?: string;
|
|
33
|
+
}): void;
|
|
34
|
+
/** the registered marks' styles */
|
|
35
|
+
export declare const markCss: () => string;
|
|
36
|
+
export declare const iconPainter: (name: string) => IconPainter | undefined;
|
|
37
|
+
export declare const facePainter: (name: string) => D.FacePainter | undefined;
|
|
38
|
+
/** an icon the drawing names but nothing has registered: a dashed square with a question mark on the top face */
|
|
39
|
+
export declare function placeholderIcon(k: Kernel, b: Box): string;
|
|
40
|
+
export declare function drawDecos(k: Kernel, b: Box, decos: RawDeco[] | undefined): string;
|
|
41
|
+
/** A plain box, with decorations: the workhorse. */
|
|
42
|
+
export declare function boxAsset(name: string, description: string, size: [number, number, number], role: string, deco?: RawDeco[], extra?: (k: Kernel, b: Box) => string): NodeAsset;
|
|
43
|
+
/** The plate figures stand on: 1.5 × 1.5, 0.18 high, centred in the box. */
|
|
44
|
+
export declare function plate(b: Box): Box;
|
|
45
|
+
/** A puffy cloud outline in a face's 2D plane (w × h px), drawn clockwise with outward bumps. */
|
|
46
|
+
export declare function cloudPath(w: number, h: number): string;
|
|
47
|
+
/** A cloud lying on the floor with a little thickness: the side is the outline dropped by the height. */
|
|
48
|
+
export declare function drawCloud(k: Kernel, b: Box): string;
|
|
49
|
+
export declare function defaultLabel(b: Box, hasSub: boolean): LabelSpot;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { NodeAsset } from './assets.js';
|
|
2
|
+
import type { KindCatalog } from './kinds.js';
|
|
3
|
+
import type { CompiledScene } from './compile.js';
|
|
4
|
+
import type { RawDiagram, RawKind, RawRole } from './types.js';
|
|
5
|
+
import { type Board } from './flat.js';
|
|
6
|
+
/** the board of a laid-out scene; `visible`: only what it says is shown (e.g. a step's visible set) */
|
|
7
|
+
export declare function boardOf(scene: CompiledScene, visible?: (id: string) => boolean): Required<Board>;
|
|
8
|
+
/** the 3D board's sizes, in grid units: a card's footprint and height, the gaps, a panel's margin, the channel */
|
|
9
|
+
export declare const BOARD_3D: {
|
|
10
|
+
W: number;
|
|
11
|
+
D: number;
|
|
12
|
+
H: number;
|
|
13
|
+
GX: number;
|
|
14
|
+
GY: number;
|
|
15
|
+
PAD: number;
|
|
16
|
+
CH: number;
|
|
17
|
+
PANEL_H: number;
|
|
18
|
+
};
|
|
19
|
+
/** the text on a 3D card's front face */
|
|
20
|
+
export declare const BOARD_CSS = "\n.blk .card-name{font-size:13px;font-weight:600;fill:var(--ink)}\n.blk .card-sub{font-size:10px;fill:var(--ink);opacity:.75}\n.blk.ghost .card-name,.blk.ghost .card-sub{fill:var(--muted)}\n";
|
|
21
|
+
/** a card: a slab with its name (and sub) on its front face. The text is the board's (`text`), not the node's label:
|
|
22
|
+
* a node with a label gets the scene's upright label above it as well */
|
|
23
|
+
export declare function cardAsset(text: (id: string) => {
|
|
24
|
+
label: string;
|
|
25
|
+
sub?: string;
|
|
26
|
+
} | undefined): NodeAsset;
|
|
27
|
+
/** the catalogue a board is drawn with in 3D: a panel (a thin slab, its name on its floor) and a card showing the
|
|
28
|
+
* board's text */
|
|
29
|
+
export declare function boardCatalog(board: Board): KindCatalog;
|
|
30
|
+
/** a board as an engine drawing (one scene): panels as regions, nested as they hold each other, cards as nodes, links
|
|
31
|
+
* as routes (kinds and roles: the drawing's own, as a document's `kinds:` and `roles:`) */
|
|
32
|
+
export declare function boardDiagram(board: Board, opts?: {
|
|
33
|
+
title?: string;
|
|
34
|
+
kinds?: Record<string, RawKind>;
|
|
35
|
+
roles?: Record<string, RawRole>;
|
|
36
|
+
}): RawDiagram;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Parsed } from '../iso-core/parse.js';
|
|
2
|
+
import type { Diag } from '../iso-core/errors.js';
|
|
3
|
+
import { type Layout } from './place.js';
|
|
4
|
+
import { type RenderedScene } from './scene.js';
|
|
5
|
+
import { type Routed } from './route.js';
|
|
6
|
+
import { type Steps } from './steps.js';
|
|
7
|
+
import { type KindCatalog } from './kinds.js';
|
|
8
|
+
import type { GridDef, RawDiagram, Theme } from './types.js';
|
|
9
|
+
export interface CompiledScene {
|
|
10
|
+
id: string;
|
|
11
|
+
raw: RawDiagram['scenes'][number];
|
|
12
|
+
layout: Layout;
|
|
13
|
+
routes: Routed[];
|
|
14
|
+
steps: Steps;
|
|
15
|
+
rendered: RenderedScene;
|
|
16
|
+
grid: GridDef;
|
|
17
|
+
assemble: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface Compiled {
|
|
20
|
+
ok: boolean;
|
|
21
|
+
/** the parsed source: positions and spans of every value, for the proof sheet */
|
|
22
|
+
parsed?: Parsed;
|
|
23
|
+
source?: string;
|
|
24
|
+
diags: Diag[];
|
|
25
|
+
doc?: RawDiagram;
|
|
26
|
+
theme?: Theme;
|
|
27
|
+
/** the kinds it was drawn with (a page's legend and stylesheet ask them) */
|
|
28
|
+
catalog: KindCatalog;
|
|
29
|
+
scenes: CompiledScene[];
|
|
30
|
+
}
|
|
31
|
+
/** Places for a document that has no source text: every place is unknown (line 0). */
|
|
32
|
+
export declare const noSource: (data: unknown) => Parsed;
|
|
33
|
+
export declare function compileRaw(doc: RawDiagram, themeText: string, catalog: KindCatalog, parsed?: Parsed, source?: string, opts?: {
|
|
34
|
+
snap?: number;
|
|
35
|
+
}, diags?: Diag[]): Compiled;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type KindCatalog } from './kinds.js';
|
|
2
|
+
/** The page around a figure (the standalone page only). */
|
|
3
|
+
export declare const PAGE_CSS = "\n*{box-sizing:border-box}\nhtml,body{margin:0}\nbody{background:var(--bg);color:var(--ink);font:15px/1.55 system-ui,-apple-system,\"Segoe UI\",Roboto,sans-serif;-webkit-font-smoothing:antialiased;overflow-x:hidden}\ncode,pre,.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}\ncode{font-size:.92em;background:var(--code-bg);padding:1px 5px;border-radius:5px;overflow-wrap:anywhere}\n.wrap{max-width:1180px;margin:0 auto;padding:32px 16px 64px}\nheader.page{display:flex;flex-wrap:wrap;gap:12px 24px;align-items:flex-end;justify-content:space-between;margin-bottom:8px}\nh1{font-size:clamp(24px,4vw,34px);line-height:1.15;margin:0;letter-spacing:-.01em}\n.lede{color:var(--muted);max-width:76ch;margin:8px 0 0}\n.pills{display:flex;gap:8px;align-items:center;flex-wrap:wrap}\n.pill{display:inline-block;font-size:12px;font-weight:600;padding:3px 10px;border-radius:99px;border:1px solid var(--line);color:var(--muted);background:var(--surface)}\n.theme{font:inherit;font-size:12px;border:1px solid var(--line);background:var(--surface);color:var(--muted);border-radius:99px;padding:3px 10px;cursor:pointer}\nh2{font-size:20px;margin:44px 0 4px;letter-spacing:-.005em;text-wrap:balance}\n.sec-sub{color:var(--muted);margin:0 0 14px;font-size:14px;max-width:84ch}\n.figure{background:var(--surface);border:1px solid var(--line);border-radius:16px;margin:12px 0 10px;overflow:hidden}\n.scroller{overflow-x:auto;-webkit-overflow-scrolling:touch}\n.scroller svg{display:block;width:100%;min-width:720px;height:auto}\n.legend{display:flex;flex-wrap:wrap;gap:6px 18px;padding:10px 18px;border-top:1px solid var(--line);font-size:12.5px;color:var(--muted)}\n.legend:empty{display:none}\n.legend span{display:inline-flex;align-items:center;gap:8px}\n.legend i{display:inline-block;width:26px;height:0;border-top:3px solid}\n.legend i.box{height:10px;border-width:1.5px;border-style:solid;border-radius:2px}\nfooter{margin-top:40px;font-size:12.5px;color:var(--muted)}\n";
|
|
4
|
+
/** The drawing itself (a page's, and an interactive view's, scoped: src/iso-viewer/view-css.ts). */
|
|
5
|
+
/** the drawing's stylesheet; the catalogue's kinds add their own rules (kindsCss) in the middle, as they always sat */
|
|
6
|
+
/** the drawing's styles for a catalogue, with the marks a host has registered so far (registerMarks) */
|
|
7
|
+
export declare const drawingCss: (cat: KindCatalog) => string;
|
|
8
|
+
/** a page's stylesheet: the page's own rules and the drawing's */
|
|
9
|
+
export declare const baseCss: (cat: KindCatalog) => string;
|
|
10
|
+
/** Step marks and step focus, drawn in the SVG (the page, and the editor's canvas). */
|
|
11
|
+
export declare const MARKS_CSS = "\n/* step marks */\n.xm circle{fill:var(--surface);stroke:var(--blocked);stroke-width:2.5}\n.xm path{stroke:var(--blocked);stroke-width:3;stroke-linecap:round}\n.say rect{fill:var(--surface);stroke-width:1.5}\n.say text{font-size:12px;font-weight:600}\n.badge{cursor:pointer}\n.badge circle{fill:var(--c);stroke:var(--surface);stroke-width:2.5}\n.badge text{font-size:11.5px;font-weight:800;fill:var(--on);text-anchor:middle;dominant-baseline:central;pointer-events:none}\n.tok{stroke:var(--surface);stroke-width:2.5}\n.pulse{fill:none;stroke-width:2.5;transform-box:fill-box;transform-origin:center;animation:pulse 1.5s ease-out infinite}\n@keyframes pulse{from{transform:scale(.35);opacity:.95}to{transform:scale(1.5);opacity:0}}\n.sub{stroke-width:5px}\n\n/* step focus: what a step does not touch dims; things that appear later are hidden */\n[data-hl],[data-id],[data-step]{transition:opacity .25s}\nsvg.focus [data-hl]:not(.hl){opacity:.12}\nsvg.focus.dim-all [data-dim]:not(.hl){opacity:.14}\nsvg.focus .badge:not(.on){opacity:.14}\nsvg.all .badge{opacity:1}\nsvg.focus.all [data-hl]:not(.hl),svg.focus.all.dim-all [data-dim]:not(.hl){opacity:.9}\nsvg [data-step]:not(.on),svg.all [data-step]{opacity:0!important;pointer-events:none}\n.pre{opacity:0!important;pointer-events:none}\n";
|
|
12
|
+
/** The player's controls (the page only). */
|
|
13
|
+
export declare const PLAYER_UI_CSS = "\n/* player */\n.player{display:flex;align-items:flex-start;gap:10px 14px;padding:12px 16px;border-top:1px solid var(--line);flex-wrap:wrap}\n.ctrls{display:flex;gap:6px;flex:none}\n.pbtn{font:inherit;font-size:13px;font-weight:700;display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);background:var(--bg);color:var(--ink);border-radius:99px;padding:6px 14px;cursor:pointer}\n.pbtn.icon{padding:6px 11px}\n.pbtn:hover{border-color:var(--muted)}\n.pbtn:disabled{opacity:.6;cursor:default}\n.pbtn.primary{background:var(--ink);color:var(--surface);border-color:var(--ink);min-width:92px;justify-content:center}\n.pbtn:focus-visible,.dot:focus-visible,.badge:focus-visible{outline:2px solid var(--send);outline-offset:2px}\n.cap{flex:1 1 360px;min-width:0}\n.cap-h{font-size:14.5px;font-weight:700;display:flex;align-items:center;gap:8px}\n.cap-h .cnt{margin-left:auto;font-weight:500;color:var(--muted);font-size:12px;white-space:nowrap}\n.num{flex:none;display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;background:var(--c,var(--control));color:var(--on);font-size:11px;font-weight:800}\n.cap-t{font-size:13.5px;color:var(--ink);margin:4px 0 0;max-width:92ch;min-height:3.1em}\n.cap-c{margin:8px 0 0;background:var(--code-bg);border-radius:8px;padding:7px 10px;font-size:12px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere;max-height:9.5em;overflow-y:auto;color:var(--ink)}\n.cap-c:empty{display:none}\n.prog{height:3px;background:var(--line);border-radius:3px;overflow:hidden;margin-top:9px}\n.prog i{display:block;height:100%;width:0;background:var(--c,var(--ink))}\n.dots{display:flex;gap:5px;flex-wrap:wrap;flex-basis:100%;padding-left:2px;order:4}\n.dot{width:10px;height:10px;border-radius:50%;background:var(--line);border:0;padding:0;cursor:pointer}\n.dot.on{background:var(--ink)} .dot.done{background:var(--muted)}\ndetails.steps{margin:0 0 8px;font-size:13.5px}\ndetails.steps summary{cursor:pointer;color:var(--muted);font-size:13px}\ndetails.steps ol{margin:8px 0 0;padding-left:22px;max-width:92ch}\ndetails.steps li{margin:6px 0}\ndetails.steps li code{font-size:11.5px}\n@media (prefers-reduced-motion:reduce){.pulse{animation:none;opacity:.8}}\n@media (max-width:560px){.cap{flex-basis:100%}}\n.still .pulse{animation:none;opacity:.85}\n.still *,.still *::before{transition:none!important}\n.still .prog{display:none}\n.still .ctrls,.still .tools{display:none}\n.tools{display:flex;gap:6px;flex:none;order:3;margin-left:auto}\n.pbtn.small{font-size:12px;padding:4px 11px;font-weight:600;color:var(--muted)}\n.pbtn.small[aria-pressed=\"true\"]{color:var(--ink);border-color:var(--muted);background:var(--surface)}";
|
|
14
|
+
/** The floor grid and the assemble intro, in the SVG. */
|
|
15
|
+
export declare const GRID_CSS = "\n.grid{display:none;fill:none;stroke:var(--ink);stroke-width:.6;opacity:.16;pointer-events:none}\nsvg.show-grid .grid{display:inline}\nsvg.pre-assemble > g:not(.g-anim){opacity:0}\n";
|
|
16
|
+
export declare const PLAYER_CSS: string;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { type Font } from '../iso-core/kernel.js';
|
|
2
|
+
/** a card: one thing, at a cell of the grid ([column, row]) */
|
|
3
|
+
export interface BoardCard {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
sub?: string;
|
|
7
|
+
role?: string;
|
|
8
|
+
ghost?: boolean;
|
|
9
|
+
cell: [number, number];
|
|
10
|
+
}
|
|
11
|
+
/** a panel: a container over a range of cells, [c0, r0, c1, r1] inclusive; panels nest by containment */
|
|
12
|
+
export interface BoardPanel {
|
|
13
|
+
id: string;
|
|
14
|
+
label?: string;
|
|
15
|
+
sub?: string;
|
|
16
|
+
role?: string;
|
|
17
|
+
cells: [number, number, number, number];
|
|
18
|
+
}
|
|
19
|
+
/** a link between two cards or panels; aOn / bOn: draw that end to a panel (one holding it, or any) instead */
|
|
20
|
+
export interface BoardLink {
|
|
21
|
+
id?: string;
|
|
22
|
+
a: string;
|
|
23
|
+
b: string;
|
|
24
|
+
kind?: string;
|
|
25
|
+
label?: string;
|
|
26
|
+
aOn?: string;
|
|
27
|
+
bOn?: string;
|
|
28
|
+
}
|
|
29
|
+
/** the scene description both views are drawn from */
|
|
30
|
+
export interface Board {
|
|
31
|
+
cards: BoardCard[];
|
|
32
|
+
panels?: BoardPanel[];
|
|
33
|
+
links?: BoardLink[];
|
|
34
|
+
}
|
|
35
|
+
export interface FlatRect {
|
|
36
|
+
l: number;
|
|
37
|
+
t: number;
|
|
38
|
+
r: number;
|
|
39
|
+
b: number;
|
|
40
|
+
}
|
|
41
|
+
export type FlatPoint = [number, number];
|
|
42
|
+
/** the fonts a 2D layout measures: a card's name and sub, a panel's title and its subtitle, a link's label */
|
|
43
|
+
export type FlatFont = 'name' | 'sub' | 'title' | 'titleSub' | 'label';
|
|
44
|
+
export type Measure = (text: string, font: FlatFont) => number;
|
|
45
|
+
export interface FlatOptions {
|
|
46
|
+
W: number;
|
|
47
|
+
H: number;
|
|
48
|
+
GX: number;
|
|
49
|
+
GY: number;
|
|
50
|
+
PAD: number;
|
|
51
|
+
TITLE: number;
|
|
52
|
+
CH: number;
|
|
53
|
+
/** card and panel corner radii */
|
|
54
|
+
cardRx: number;
|
|
55
|
+
panelRx: number;
|
|
56
|
+
/** the cost model */
|
|
57
|
+
bend: number;
|
|
58
|
+
overlap: number;
|
|
59
|
+
crossPanel: number;
|
|
60
|
+
border: number;
|
|
61
|
+
nearEdge: number;
|
|
62
|
+
/** the margin round the drawing */
|
|
63
|
+
margin: number;
|
|
64
|
+
/** wrap a drawing wider than this (width / height) onto further shelves (wrapBoard); off by default */
|
|
65
|
+
wrap?: {
|
|
66
|
+
aspect: number;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export declare const FLAT_DEFAULTS: Readonly<FlatOptions>;
|
|
70
|
+
export interface FlatCard extends BoardCard {
|
|
71
|
+
rect: FlatRect;
|
|
72
|
+
}
|
|
73
|
+
export interface FlatPanel extends BoardPanel {
|
|
74
|
+
rect: FlatRect;
|
|
75
|
+
/** the title strip's box (what a link may not cross) */
|
|
76
|
+
title: FlatRect;
|
|
77
|
+
/** the title's baseline */
|
|
78
|
+
titleAt: FlatPoint;
|
|
79
|
+
/** the panel it sits in, if any */
|
|
80
|
+
parent?: string;
|
|
81
|
+
depth: number;
|
|
82
|
+
}
|
|
83
|
+
export interface FlatLabel {
|
|
84
|
+
x: number;
|
|
85
|
+
y: number;
|
|
86
|
+
anchor: 'start' | 'middle' | 'end';
|
|
87
|
+
box: FlatRect;
|
|
88
|
+
text: string;
|
|
89
|
+
}
|
|
90
|
+
export interface FlatLink extends BoardLink {
|
|
91
|
+
id: string;
|
|
92
|
+
points: FlatPoint[];
|
|
93
|
+
at?: FlatLabel;
|
|
94
|
+
routed: boolean;
|
|
95
|
+
}
|
|
96
|
+
export interface FlatLayout {
|
|
97
|
+
cards: FlatCard[];
|
|
98
|
+
panels: FlatPanel[];
|
|
99
|
+
links: FlatLink[];
|
|
100
|
+
/** everything drawn, with the margin */
|
|
101
|
+
bounds: FlatRect;
|
|
102
|
+
options: FlatOptions;
|
|
103
|
+
/** warnings: a link with no clear route (drawn the least bad way) */
|
|
104
|
+
warnings: string[];
|
|
105
|
+
}
|
|
106
|
+
/** the 2D view's fonts (its stylesheet's: src/iso-viewer/flat-view.ts), as L0's measured metrics have them */
|
|
107
|
+
export declare const FLAT_FONTS: Record<FlatFont, Font>;
|
|
108
|
+
/** text measured with L0's font metrics: the same in Node and every browser (stills and tests); a page measures its
|
|
109
|
+
* rendered text instead (flat-view.ts: measureIn) */
|
|
110
|
+
export declare const metricsMeasure: Measure;
|
|
111
|
+
/** what is wrong with a board, as messages; layoutFlat refuses a board with any */
|
|
112
|
+
export declare function boardErrors(board: Board): string[];
|
|
113
|
+
/** where a board's cards and panels go on a grid with the given sizes and gaps (the 2D layout's, in px; the 3D
|
|
114
|
+
* drawing's, in grid units): each card's top-left corner, each panel's rect, and how the panels nest */
|
|
115
|
+
export declare function placeBoard(board: Board, o: Pick<FlatOptions, 'W' | 'H' | 'GX' | 'GY' | 'PAD' | 'TITLE' | 'CH'>): {
|
|
116
|
+
prect: FlatRect[];
|
|
117
|
+
parentIx: number[];
|
|
118
|
+
depthOf: (i: number) => number;
|
|
119
|
+
pos: (i: number, j: number) => FlatPoint;
|
|
120
|
+
cardAt: (i: number) => FlatPoint;
|
|
121
|
+
};
|
|
122
|
+
/** the 2D layout of a board. Throws on a board with errors (boardErrors). */
|
|
123
|
+
export declare function layoutFlat(board: Board, measure: Measure, opts?: Partial<FlatOptions>): FlatLayout;
|
|
124
|
+
/** which card or panel a point is on (topmost: a card, then the innermost panel) */
|
|
125
|
+
export declare function flatHit(L: FlatLayout, x: number, y: number): string | undefined;
|
|
126
|
+
/** A wide drawing wrapped for a frame of an aspect (width / height): in a container (the drawing, or a panel) whose
|
|
127
|
+
* children stand side by side, the last of them go onto a shelf of their own below the others, in their order. Each
|
|
128
|
+
* step takes the wrap that lets the drawing be drawn largest in such a frame, while one does. Cards inside a panel of cards only
|
|
129
|
+
* stay as they are: what moves is a container's children as wholes (inner panels, and cards beside them). */
|
|
130
|
+
export declare function wrapBoard(board: Board, measure: Measure, aspect: number, opts?: Partial<FlatOptions>): Board;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function focusView(full: number[], box: [number, number, number, number] | undefined): number[];
|