mellos-mapping 0.20.0 → 0.20.2
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 +360 -63
- package/README.zh-CN.md +314 -54
- package/dist/hook-session-start.mjs +239 -0
- package/dist/mmap.mjs +338 -0
- package/dist/server.mjs +1614 -809
- package/dist/store-paths.mjs +107 -0
- package/dist/watch.mjs +1391 -760
- package/lib/domain/ops.d.ts +71 -12
- package/lib/domain/ops.js +145 -14
- package/lib/domain/types.d.ts +47 -6
- package/lib/domain/types.js +34 -3
- package/lib/render/canvas.d.ts +50 -0
- package/lib/render/canvas.js +210 -0
- package/lib/render/draw.d.ts +37 -0
- package/lib/render/draw.js +111 -0
- package/lib/render/layout.d.ts +89 -0
- package/lib/render/layout.js +200 -0
- package/lib/render/options.d.ts +39 -0
- package/lib/render/options.js +10 -0
- package/lib/render/render.d.ts +32 -46
- package/lib/render/render.js +58 -789
- package/lib/render/routing.d.ts +56 -0
- package/lib/render/routing.js +244 -0
- package/lib/render/skins.d.ts +54 -0
- package/lib/render/skins.js +99 -0
- package/lib/render/width.d.ts +24 -0
- package/lib/render/width.js +139 -0
- package/lib/render/zoom-geometry.d.ts +52 -0
- package/lib/render/zoom-geometry.js +56 -0
- package/lib/semantics/semantics.d.ts +53 -4
- package/lib/semantics/semantics.js +130 -6
- package/lib/semantics/vocabulary.d.ts +79 -0
- package/lib/semantics/vocabulary.js +112 -0
- package/lib/store/format.d.ts +17 -0
- package/lib/store/format.js +185 -66
- package/lib/store/store.d.ts +220 -20
- package/lib/store/store.js +491 -38
- package/package.json +12 -4
- package/scripts/codex-register.mjs +89 -20
- package/scripts/install-mmap-command.mjs +293 -0
- package/scripts/mmap.mjs +213 -0
- package/scripts/open-pane.mjs +115 -254
- package/scripts/pane-core.mjs +418 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layer 4a — what a caller asks the renderer for.
|
|
3
|
+
*
|
|
4
|
+
* Every stage below (canvas, skins, layout, drawing) reads these, so they
|
|
5
|
+
* live in a module of their own rather than in whichever stage happens to
|
|
6
|
+
* touch them first: a picture's inputs are not the property of one stage.
|
|
7
|
+
*
|
|
8
|
+
* Pure types; no behavior.
|
|
9
|
+
*/
|
|
10
|
+
import type { ZoomStep } from '../semantics/semantics.js';
|
|
11
|
+
export interface RenderOptions {
|
|
12
|
+
/** Emit ANSI color codes. */
|
|
13
|
+
readonly color: boolean;
|
|
14
|
+
/** Use box-drawing characters; false falls back to pure ASCII. */
|
|
15
|
+
readonly unicode: boolean;
|
|
16
|
+
/** Spinner frame index for in-progress nodes; caller advances it over time. */
|
|
17
|
+
readonly spinnerFrame: number;
|
|
18
|
+
/**
|
|
19
|
+
* Id of the BOX to spotlight: its border and every wire touching it render
|
|
20
|
+
* bright instead of faint. Color mode only — monochrome output ignores it.
|
|
21
|
+
*
|
|
22
|
+
* VIOLATION: no-primitive-obsession - a raw string where NodeId exists,
|
|
23
|
+
* because at the far zoom the boxes are aggregated GROUPS, so this is a
|
|
24
|
+
* NodeId or a GroupId and the caller (a hit test) cannot know which. See
|
|
25
|
+
* focusInfo in ../semantics/semantics.ts, which resolves the same value and
|
|
26
|
+
* carries the full reasoning; typing it here as a union would only move the
|
|
27
|
+
* cast to whichever side of the hit test names it first.
|
|
28
|
+
*/
|
|
29
|
+
readonly focus?: string | undefined;
|
|
30
|
+
/** Position on the zoom ladder; omitted means ZOOM_DEFAULT (100%). */
|
|
31
|
+
readonly zoom?: ZoomStep | undefined;
|
|
32
|
+
}
|
|
33
|
+
/** A window over the rendered picture, in cell coordinates (0-based). */
|
|
34
|
+
export interface Viewport {
|
|
35
|
+
readonly x: number;
|
|
36
|
+
readonly y: number;
|
|
37
|
+
readonly width: number;
|
|
38
|
+
readonly height: number;
|
|
39
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layer 4a — what a caller asks the renderer for.
|
|
3
|
+
*
|
|
4
|
+
* Every stage below (canvas, skins, layout, drawing) reads these, so they
|
|
5
|
+
* live in a module of their own rather than in whichever stage happens to
|
|
6
|
+
* touch them first: a picture's inputs are not the property of one stage.
|
|
7
|
+
*
|
|
8
|
+
* Pure types; no behavior.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
package/lib/render/render.d.ts
CHANGED
|
@@ -5,6 +5,22 @@
|
|
|
5
5
|
* (colored, animated). Pure function of (map, options): no I/O, no clock —
|
|
6
6
|
* animation is driven by the caller passing a spinner frame index.
|
|
7
7
|
*
|
|
8
|
+
* This file is the COMPOSITION ROOT of the picture and holds the public
|
|
9
|
+
* surface; each stage lives beside it and knows nothing of the next:
|
|
10
|
+
*
|
|
11
|
+
* width.ts how many columns a string takes (the grid's foundation)
|
|
12
|
+
* options.ts what a caller asks for
|
|
13
|
+
* canvas.ts the drawing surface: cells, mask algebra, ANSI emission
|
|
14
|
+
* skins.ts status vocabulary -> this medium's borders and colors
|
|
15
|
+
* zoom-geometry.ts what one rung of the zoom ladder buys, in cells
|
|
16
|
+
* layout.ts where every box goes (columns, then rows)
|
|
17
|
+
* routing.ts how each edge gets there (columns and track rows)
|
|
18
|
+
* draw.ts transcription of all of the above onto the canvas
|
|
19
|
+
*
|
|
20
|
+
* The pipeline reads in that order and only forward: sizes and columns fix
|
|
21
|
+
* the width, routing needs the columns, the row layout needs routing's track
|
|
22
|
+
* counts, and drawing needs everything. Nothing drawn is ever decided.
|
|
23
|
+
*
|
|
8
24
|
* Visual language — a dark circuit board:
|
|
9
25
|
* rank 0 renders at the BOTTOM of the picture ("primitives are the
|
|
10
26
|
* ground"). Wiring and band bars are FAINT; the glowing things are the
|
|
@@ -14,21 +30,10 @@
|
|
|
14
30
|
* planned dashed dim rounded box, '·' — a ghost: designed, not built
|
|
15
31
|
* in-progress amber rounded box, spinner — where attention currently is
|
|
16
32
|
* done heavy green box, '■' — built and verified
|
|
33
|
+
* done, no evidence the same box, hollow '□' in a dimmer green — the
|
|
34
|
+
* ledger's fourth rule, made visible
|
|
17
35
|
* regressed heavy red box, '✗' — was done, foundation cracked
|
|
18
36
|
*
|
|
19
|
-
* Routing preference, in order:
|
|
20
|
-
* 1. STRAIGHT — an adjacent-band edge whose box borders share a free
|
|
21
|
-
* column is one vertical line, no corners.
|
|
22
|
-
* 2. DOGLEG — descend, run horizontally on a track row in the gap above
|
|
23
|
-
* the target band, descend. Tracks are PACKED: segments that do not
|
|
24
|
-
* overlap share a row, keeping bands close together.
|
|
25
|
-
* 3. THREAD — a skip-level edge descends through the nearest column that
|
|
26
|
-
* is free of boxes in every intermediate band (threading the needle
|
|
27
|
-
* between boxes); only if no such column exists does it fall back to a
|
|
28
|
-
* private column on the right margin.
|
|
29
|
-
* Crossings merge into proper junction characters via a direction-bitmask
|
|
30
|
-
* union instead of any routing cleverness.
|
|
31
|
-
*
|
|
32
37
|
* Zoom — terminals cannot scale glyphs, so zooming out first COMPRESSES the
|
|
33
38
|
* geometry (gaps, breathing rows, padding shrink; labels truncate toward a
|
|
34
39
|
* scale-proportional budget) while boxes stay boxes. Only when a further
|
|
@@ -48,42 +53,23 @@
|
|
|
48
53
|
* box spec (size, border, content) and the whitespace geometry change.
|
|
49
54
|
*/
|
|
50
55
|
import type { MellosMap } from '../domain/types.js';
|
|
51
|
-
import {
|
|
52
|
-
export
|
|
53
|
-
export
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/** Use box-drawing characters; false falls back to pure ASCII. */
|
|
57
|
-
readonly unicode: boolean;
|
|
58
|
-
/** Spinner frame index for in-progress nodes; caller advances it over time. */
|
|
59
|
-
readonly spinnerFrame: number;
|
|
60
|
-
/**
|
|
61
|
-
* Node id to spotlight: its box border and every wire touching it render
|
|
62
|
-
* bright instead of faint. Color mode only — monochrome output ignores it.
|
|
63
|
-
*/
|
|
64
|
-
readonly focus?: string | undefined;
|
|
65
|
-
/** Position on the zoom ladder; omitted means ZOOM_DEFAULT (100%). */
|
|
66
|
-
readonly zoom?: ZoomStep | undefined;
|
|
67
|
-
}
|
|
68
|
-
/** A window over the rendered picture, in cell coordinates (0-based). */
|
|
69
|
-
export interface Viewport {
|
|
70
|
-
readonly x: number;
|
|
71
|
-
readonly y: number;
|
|
72
|
-
readonly width: number;
|
|
73
|
-
readonly height: number;
|
|
74
|
-
}
|
|
75
|
-
/** Terminal column width of a string (CJK chars occupy two columns). */
|
|
76
|
-
export declare function displayWidth(text: string): number;
|
|
77
|
-
/** Truncate to a display width, ANSI-free input, appending … when cut. */
|
|
78
|
-
export declare function fitWidth(s: string, width: number): string;
|
|
79
|
-
/** Hard word-wrap by display width (CJK-aware, splits anywhere). */
|
|
80
|
-
export declare function wrapWidth(s: string, width: number): string[];
|
|
81
|
-
/** Glyph for a node kind, or undefined for unknown kinds. Shared with the watcher's panel. */
|
|
82
|
-
export declare function kindGlyph(kind: string, unicode: boolean): string | undefined;
|
|
56
|
+
import type { RenderOptions, Viewport } from './options.js';
|
|
57
|
+
export type { RenderOptions, Viewport } from './options.js';
|
|
58
|
+
export { displayWidth, fitWidth, wrapWidth } from './width.js';
|
|
59
|
+
export { statusSgr } from './skins.js';
|
|
60
|
+
export { type ZoomStep, ZOOM_DEFAULT, ZOOM_MAX, ZOOM_MIN, clampZoom, isNeutralKind, kindGlyph, spinnerGlyph, statusGlyph, unverifiedDoneGlyph, zoomLabel, } from '../semantics/semantics.js';
|
|
83
61
|
/** Render the whole map as terminal lines. */
|
|
84
62
|
export declare function renderMap(map: MellosMap, opts: RenderOptions): string[];
|
|
85
|
-
/** Where a
|
|
63
|
+
/** Where a box sits on the full (unwindowed) picture, for hit testing. */
|
|
86
64
|
export interface BoxHit {
|
|
65
|
+
/**
|
|
66
|
+
* The box's id — a node id, or a GROUP id on the aggregated far zoom.
|
|
67
|
+
*
|
|
68
|
+
* VIOLATION: no-primitive-obsession - raw string where NodeId exists, for
|
|
69
|
+
* the reason spelled out at focusInfo (../semantics/semantics.ts): which of
|
|
70
|
+
* the two an id names is what the consumer of a hit calls that function to
|
|
71
|
+
* find out, so this type cannot promise either.
|
|
72
|
+
*/
|
|
87
73
|
readonly id: string;
|
|
88
74
|
readonly x: number;
|
|
89
75
|
readonly y: number;
|