@draftably/markdown 0.2.0 → 0.2.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/dist/mermaid.js CHANGED
@@ -61,7 +61,7 @@ async function S() {
61
61
  globalThis.fetch = async () => {
62
62
  throw Error("Mermaid resource loading is disabled.");
63
63
  };
64
- const { JSDOM: i } = await import("jsdom"), { createMermaidFlowParser: s, makePlainLabel: e } = await import("./chunks/mermaid-facade-BoLWBerE.js"), { importMermaidFlow: t } = await import("./chunks/mermaid-importer-IVovOQE9.js"), r = new i("<!doctype html><html><body></body></html>", {
64
+ const { JSDOM: i } = await import("jsdom"), { createMermaidFlowParser: s, makePlainLabel: e } = await import("./chunks/mermaid-facade-BoLWBerE.js"), { importMermaidFlow: t } = await import("./chunks/mermaid-importer-D9i_Vfxl.js"), r = new i("<!doctype html><html><body></body></html>", {
65
65
  url: "https://import.invalid/"
66
66
  });
67
67
  Object.assign(globalThis, {
@@ -1,5 +1,6 @@
1
1
  import { type ResolvedAppearance } from '../model/appearance';
2
2
  import type { CellsChrome, Lane, SequenceLayout } from '../model/types';
3
+ import { type Planned } from './corridors';
3
4
  import { GROUP_HEADER, GROUP_INSET, contentOrigin } from './frame';
4
5
  import { type Model, type ModelEdge, type ModelLayout, type ModelObject } from './syntax';
5
6
  /** The single render context. Browser window size changes the camera, never the layout. */
@@ -44,6 +45,8 @@ export interface Diagnostic {
44
45
  /** A connection as the file declares it, plus the lane a fold's wrap edge returns along. */
45
46
  export interface SceneEdge extends ModelEdge {
46
47
  lane?: Lane;
48
+ /** A forward line's route, planned from its scope's ranks and corridors (`planRoutes`). */
49
+ plan?: Planned;
47
50
  /** A sequence message: the height of its row; it is drawn straight between lifelines there. */
48
51
  row?: number;
49
52
  }
@@ -149,6 +152,16 @@ export declare function crossings(paths: Array<Array<{
149
152
  }>>): number;
150
153
  /** The order of up to six items that scores fewest crossings; the first such, from `items`. */
151
154
  export declare function fewestCrossings<T>(items: T[], score: (order: T[]) => number): T[];
155
+ /**
156
+ * The corridors a `flow` scope keeps for lines that skip ranks: the ranks with their stand-ins,
157
+ * each line's stand-ins by its index in the scope's pairs, and each stand-in's place across the
158
+ * run, in the scope's coordinates.
159
+ */
160
+ export interface Corridors {
161
+ order: string[][];
162
+ chains: Map<number, string[]>;
163
+ across: Map<string, number>;
164
+ }
152
165
  /**
153
166
  * Lay out a model. `arranged` holds world positions from layout engines; scopes that an engine
154
167
  * governs take their children's relative placement from it instead of their built-in recipe.
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Routes for a `flow` scope's forward lines, planned from its ranks as a layered layout routes its
3
+ * edges: out of the source's trailing side, along a track in each gap the line turns in, down a
4
+ * corridor through each rank it skips, and into the target's leading side. The ranks' order already
5
+ * keeps crossings few, so the plan only has to place ports and order each gap's tracks. The router
6
+ * takes a planned route as it is when it clears every box.
7
+ */
8
+ import type { Point, Rect } from '../model/types';
9
+ export interface PlanLine {
10
+ id: string;
11
+ /** Source, the stand-ins of the ranks it skips, target. */
12
+ chain: string[];
13
+ }
14
+ export interface Planned {
15
+ points: Point[];
16
+ fromOffset: number;
17
+ toOffset: number;
18
+ }
19
+ /**
20
+ * Space between ports on one side and between neighbouring tracks in a gap, as the router keeps
21
+ * them: ports `max(portGap, edgeGap)` apart and tracks `edgeGap` apart.
22
+ */
23
+ export interface Spacing {
24
+ port: number;
25
+ track: number;
26
+ }
27
+ /**
28
+ * Plans each line of `lines`. `order` is the ranks with stand-ins, `box` each real member's drawn
29
+ * box and `across` each stand-in's place across the run, all in drawing coordinates. Lines that
30
+ * cannot be planned (a member without a box) are left out.
31
+ */
32
+ export declare function planRoutes(axis: 'down' | 'right', order: string[][], lines: PlanLine[], box: (id: string) => Rect | undefined, across: (id: string) => number | undefined, spacing?: Spacing): Map<string, Planned>;
33
+ /**
34
+ * The room each gap between ranks needs for the tracks `planRoutes` lays in it: a standoff from
35
+ * the boxes either side and a pitch between tracks, by gap index; a gap with no track is absent.
36
+ * `box` may be a member's slot: only its place across the run counts.
37
+ */
38
+ export declare function trackRoom(axis: 'down' | 'right', order: string[][], lines: PlanLine[], box: (id: string) => Rect | undefined, across: (id: string) => number | undefined, spacing?: Spacing): number[];
@@ -93,6 +93,15 @@ export interface EdgeLayout {
93
93
  toOffset?: number;
94
94
  /** A sequence message: drawn straight between the two lifelines at this height, not routed. */
95
95
  row?: number;
96
+ /**
97
+ * Set by the compiler for a forward line in a `flow` scope: its route planned from the ranks.
98
+ * The quick router takes it as it is when it clears every box.
99
+ */
100
+ plan?: {
101
+ points: Point[];
102
+ fromOffset: number;
103
+ toOffset: number;
104
+ };
96
105
  }
97
106
  /**
98
107
  * A channel between two bands of a fold: a level line at `y`, or an upright one at `x`. With
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftably/markdown",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Build static SVG diagram assets from Markdown draft fences.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "jsdom": "26.1.0",
37
37
  "mermaid": "12.2.0",
38
- "@draftably/runtime": "0.2.0"
38
+ "@draftably/runtime": "0.3.0"
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=22.21.0"