@draftably/editor 0.1.0 → 0.3.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.
Files changed (104) hide show
  1. package/README.md +4 -5
  2. package/dist/assets/engine.worker-BY9GKt7x.js +7505 -0
  3. package/dist/element.js +1 -1
  4. package/dist/index.js +20202 -2
  5. package/dist/types/src/cli/raster-fonts.d.ts +3 -0
  6. package/dist/types/src/components/controls.d.ts +8 -5
  7. package/dist/types/src/dsl/compile.d.ts +13 -0
  8. package/dist/types/src/dsl/corridors.d.ts +38 -0
  9. package/dist/types/src/model/types.d.ts +9 -0
  10. package/dist/types/src/state/canvas-commands.d.ts +169 -0
  11. package/dist/types/src/state/canvas-keyboard.d.ts +15 -0
  12. package/dist/types/src/state/links.d.ts +4 -1
  13. package/dist/types/src/state/workspace.d.ts +3 -0
  14. package/package.json +1 -1
  15. package/dist/assets/engine.worker-DmHew5f6.js +0 -6813
  16. package/dist/assets/import-d2.worker-CnXfFXoa.js +0 -5395
  17. package/dist/chunks/abnfDiagram-WEYOIA3C-llcpthp5.js +0 -87
  18. package/dist/chunks/arc-rJj0TtXf.js +0 -83
  19. package/dist/chunks/architectureDiagram-ZHVYKT53-CfiXg0Lk.js +0 -4781
  20. package/dist/chunks/blockDiagram-RJAE7QA3-CO-14jWz.js +0 -1440
  21. package/dist/chunks/browser-iNhbPsGc.js +0 -40
  22. package/dist/chunks/c4Diagram-XDPPPE54-DYKuxA4n.js +0 -1524
  23. package/dist/chunks/channel-qMvPU6eH.js +0 -5
  24. package/dist/chunks/chunk-2E7WHVMD-BEZwsFS3.js +0 -670
  25. package/dist/chunks/chunk-2Q5K7J3B-gqtzQ8ux.js +0 -18
  26. package/dist/chunks/chunk-4EMNKR2T-MC54CXVe.js +0 -262
  27. package/dist/chunks/chunk-55XCU76K-DkZUAaqC.js +0 -68
  28. package/dist/chunks/chunk-5VM5RSS4-CaKe4sjM.js +0 -19
  29. package/dist/chunks/chunk-JWPE2WC7-CnAFS2xF.js +0 -8
  30. package/dist/chunks/chunk-VQ5W62QI-CXRv7FiX.js +0 -19
  31. package/dist/chunks/chunk-XXDRQBXY-B-AMQgD2.js +0 -8
  32. package/dist/chunks/chunk-ZCHMQSOR-BALpdc3g.js +0 -451
  33. package/dist/chunks/classDiagram-v2-4MYWR3UA-wPjgJTg4.js +0 -1570
  34. package/dist/chunks/cose-bilkent-JH36ORCC-Bbh5ggBc.js +0 -2608
  35. package/dist/chunks/cynefin-EF2NZ3EQ-Bt6b88hY.js +0 -22361
  36. package/dist/chunks/cynefinDiagram-WF24UDRP-BHWZvxoF.js +0 -299
  37. package/dist/chunks/cytoscape.esm-CRsF_JA3.js +0 -18791
  38. package/dist/chunks/dagre-NK4GIZVX-Cz37yPrT.js +0 -2157
  39. package/dist/chunks/defaultLocale-BgPVtth8.js +0 -171
  40. package/dist/chunks/diagram-CBK3MWTC-Q2R6FJ0B.js +0 -531
  41. package/dist/chunks/diagram-I5XIIV2D-a2Kdu_wA.js +0 -153
  42. package/dist/chunks/diagram-ODIL2UCW-DTWXxcOn.js +0 -346
  43. package/dist/chunks/diagram-PFBEJUXE-DIAQQ5KX.js +0 -480
  44. package/dist/chunks/diagram-RJA3I4VV-BPD0GghS.js +0 -219
  45. package/dist/chunks/diagram-TYUNFSNR-BmdkONfG.js +0 -2586
  46. package/dist/chunks/dot-importer-B23jwEkx.js +0 -1547
  47. package/dist/chunks/ebnfDiagram-V4P3TTPT-C5IKvYlb.js +0 -109
  48. package/dist/chunks/elk-QONTBCTQ-CtdQFvh2.js +0 -49229
  49. package/dist/chunks/erDiagram-KYQIGQAA-5wguK9Dx.js +0 -1064
  50. package/dist/chunks/flowDiagram-IUGLLWBU-BijvFPku.js +0 -1771
  51. package/dist/chunks/ganttDiagram-R7GPNTJY-BaqGPz-O.js +0 -2729
  52. package/dist/chunks/gitGraphDiagram-PDYL7XHY-DZfMGyHE.js +0 -815
  53. package/dist/chunks/graph-CKJmgLki.js +0 -1541
  54. package/dist/chunks/import-core-C-I1wGfw.js +0 -145
  55. package/dist/chunks/infoDiagram-MVDRKAX5-C2vH_59e.js +0 -24
  56. package/dist/chunks/init-DjUOC4st.js +0 -16
  57. package/dist/chunks/ishikawaDiagram-HPEHV2GE-q149MFlV.js +0 -624
  58. package/dist/chunks/journeyDiagram-BOSHW7O7-D-2Z3VtR.js +0 -834
  59. package/dist/chunks/kanban-definition-FNSA4HC5-wvAjV5ub.js +0 -724
  60. package/dist/chunks/katex-BsrBVQKd.js +0 -11314
  61. package/dist/chunks/linear-4t7D_ros.js +0 -259
  62. package/dist/chunks/mermaid-facade-BoLWBerE.js +0 -289
  63. package/dist/chunks/mermaid-importer-Cgx1IhmR.js +0 -478
  64. package/dist/chunks/mermaid.core-DXv6D2Sm.js +0 -19244
  65. package/dist/chunks/mindmap-definition-6OY57UG3-r9wTKul_.js +0 -837
  66. package/dist/chunks/mount-C1Xk_GQz.js +0 -22131
  67. package/dist/chunks/ordinal-DfAQgscy.js +0 -61
  68. package/dist/chunks/pegDiagram-ECIUJNBX-CmKlFWiP.js +0 -95
  69. package/dist/chunks/pieDiagram-GNMPY74T-DNTw_qan.js +0 -208
  70. package/dist/chunks/quadrantDiagram-D57K4MC3-CT_tvVub.js +0 -1029
  71. package/dist/chunks/railroadDiagram-Y72NRBL7-C5TUvZBe.js +0 -77
  72. package/dist/chunks/requirementDiagram-EQYSW5RA-C_c65aCa.js +0 -889
  73. package/dist/chunks/sankeyDiagram-SY24JHO5-CKcbizM1.js +0 -859
  74. package/dist/chunks/sequenceDiagram-BLEHNHQU-GpVnHOjf.js +0 -2972
  75. package/dist/chunks/sizeCapture-INFHLROL-CToN3JSu.js +0 -46
  76. package/dist/chunks/stateDiagram-v2-A6IESKWZ-rJYd2FfM.js +0 -1520
  77. package/dist/chunks/swimlanes-B3ENRKFQ-C7w5pfxG.js +0 -4991
  78. package/dist/chunks/swimlanesDiagram-AYQRV4AK-BpGY_bvE.js +0 -13
  79. package/dist/chunks/timeline-definition-JXYKGLGB-ChKFPBKc.js +0 -1058
  80. package/dist/chunks/usecaseDiagram-WPOLBNNX-skXH8Dcu.js +0 -7945
  81. package/dist/chunks/vennDiagram-Q3Y3IDCW-C5KknmJf.js +0 -1578
  82. package/dist/chunks/wardleyDiagram-IVAIDKWA-DY4Lkfpu.js +0 -678
  83. package/dist/chunks/xychartDiagram-4URNHDU4-BHScsL7h.js +0 -1536
  84. package/dist/types/src/cli/png.d.ts +0 -23
  85. package/dist/types/src/import/browser.d.ts +0 -3
  86. package/dist/types/src/import/detect.d.ts +0 -31
  87. package/dist/types/src/import/dot-importer.d.ts +0 -3
  88. package/dist/types/src/import/import-core.d.ts +0 -105
  89. package/dist/types/src/import/mermaid-facade.d.ts +0 -120
  90. package/dist/types/src/import/mermaid-importer.d.ts +0 -4
  91. package/dist/types/src/import/mermaid-sequence.d.ts +0 -8
  92. package/dist/types/src/import/scratch.d.ts +0 -3
  93. package/dist/types/src/lib/source-hash.d.ts +0 -7
  94. package/dist/types/src/model/candidates.d.ts +0 -53
  95. package/dist/types/src/model/embed.d.ts +0 -17
  96. package/dist/types/src/model/examples.d.ts +0 -15
  97. package/dist/types/src/model/label-hits.d.ts +0 -27
  98. package/dist/types/src/model/static-scene.d.ts +0 -15
  99. package/dist/types/src/state/commands.d.ts +0 -529
  100. package/dist/types/src/state/comparison.d.ts +0 -151
  101. package/dist/types/src/state/files.d.ts +0 -61
  102. package/dist/types/src/state/keyboard.d.ts +0 -6
  103. package/dist/types/src/state/launch.d.ts +0 -61
  104. package/dist/types/src/state/ui.d.ts +0 -39
@@ -1,23 +0,0 @@
1
- export declare function findChrome(): string;
2
- /** The width and height an SVG declares on its root, rounded up. */
3
- export declare function svgSize(svg: string): {
4
- w: number;
5
- h: number;
6
- };
7
- /**
8
- * Write `svg` as a PNG at `scale` times its own size, with `source` embedded when given. Returns
9
- * the image's size in pixels.
10
- */
11
- export declare function writePng(svg: string, out: string, scale?: number, source?: string): Promise<{
12
- w: number;
13
- h: number;
14
- }>;
15
- /**
16
- * Put the drawing on the macOS clipboard as a PNG at `scale` (with `source` in it when given) and
17
- * `svgText` as text, so it pastes as an image in a doc or chat and as markup in an editor. Returns
18
- * the PNG's size in pixels.
19
- */
20
- export declare function copyToClipboard(svg: string, svgText: string, scale?: number, source?: string): Promise<{
21
- w: number;
22
- h: number;
23
- }>;
@@ -1,3 +0,0 @@
1
- import type { ImportResult } from './import-core';
2
- /** Convert a supported text diagram without changing the current document. */
3
- export declare function importBrowser(source: string, filename?: string): Promise<ImportResult>;
@@ -1,31 +0,0 @@
1
- /** A bounded dispatcher, not a parser. Ambiguous plain text never becomes D2 by guess. */
2
- export type KnownFormat = 'native' | 'mermaid' | 'dot' | 'd2' | 'plantuml' | 'dbml' | 'nomnoml';
3
- export interface DetectedSource {
4
- status: 'detected';
5
- format: KnownFormat;
6
- source: string;
7
- via: 'explicit' | 'extension' | 'fence' | 'signature';
8
- /** One-based source line where the extracted content begins. */
9
- startLine: number;
10
- }
11
- export interface FencedSource {
12
- format: KnownFormat;
13
- source: string;
14
- startLine: number;
15
- }
16
- export type Detection = DetectedSource | {
17
- status: 'choose-fence';
18
- blocks: FencedSource[];
19
- } | {
20
- status: 'unknown';
21
- reason: string;
22
- };
23
- /** Focused conventional fences: <=3 leading spaces, backticks or tildes, closed.
24
- * A Markdown document is never sent wholesale to a diagram parser.
25
- * This intentionally does not implement every CommonMark container rule.
26
- */
27
- export declare function fencedSources(text: string): FencedSource[];
28
- export declare function detectSource(source: string, options?: {
29
- filename?: string;
30
- format?: KnownFormat;
31
- }): Detection;
@@ -1,3 +0,0 @@
1
- import { type ImportResult } from './import-core';
2
- /** Convert DOT and verify the generated source before exposing it to callers. */
3
- export declare function importDot(source: string, title?: string): ImportResult;
@@ -1,105 +0,0 @@
1
- /** Build native source from the facts retained by an importer. */
2
- import type { EndMarker } from '../model/markers';
3
- export type Format = 'dot' | 'mermaid' | 'd2';
4
- export type Impact = 'syntax' | 'semantics' | 'appearance' | 'layout' | 'security' | 'limit';
5
- export interface Diagnostic {
6
- code: string;
7
- severity: 'error' | 'warning' | 'info';
8
- impact: Impact;
9
- message: string;
10
- line?: number;
11
- column?: number;
12
- foreignIds?: string[];
13
- }
14
- export interface NativeObject {
15
- id: string;
16
- kind: 'node' | 'group';
17
- label: string;
18
- parent?: string;
19
- shape?: 'box' | 'pill' | 'circle' | 'diamond' | 'text';
20
- color?: string;
21
- shade?: number;
22
- }
23
- export interface NativeEdge {
24
- id: string;
25
- from: string;
26
- to: string;
27
- label: string;
28
- directed: boolean;
29
- head?: EndMarker;
30
- tail?: EndMarker;
31
- dashed?: boolean;
32
- constraint?: false;
33
- fromSide?: 'left' | 'right' | 'top' | 'bottom';
34
- toSide?: 'left' | 'right' | 'top' | 'bottom';
35
- }
36
- export interface NativeLayout {
37
- scope: string;
38
- kind: 'flow' | 'column' | 'row' | 'sequence';
39
- direction?: 'right' | 'down';
40
- }
41
- export interface NativeColor {
42
- name: string;
43
- fill: string;
44
- stroke: string;
45
- ink: string;
46
- }
47
- export interface NativePhase {
48
- id: string;
49
- label: string;
50
- members: string[];
51
- }
52
- export interface NativeNote {
53
- text: string;
54
- near?: string;
55
- side?: 'left' | 'right' | 'above' | 'below';
56
- }
57
- export interface NativePlan {
58
- title: string;
59
- objects: NativeObject[];
60
- edges: NativeEdge[];
61
- layouts: NativeLayout[];
62
- colors: NativeColor[];
63
- /** Sequence diagrams only. */
64
- phases?: NativePhase[];
65
- notes?: NativeNote[];
66
- }
67
- export interface IdMapping {
68
- kind: string;
69
- foreign: string;
70
- native: string;
71
- }
72
- export interface ImportResult {
73
- status: 'ready' | 'needs-review' | 'failed';
74
- format: Format;
75
- family: string;
76
- diagnostics: Diagnostic[];
77
- /** Absent on every fatal error; callers must not apply a partial graph. */
78
- nativeSource?: string;
79
- facts?: NativePlan;
80
- ids: IdMapping[];
81
- requires: string[];
82
- }
83
- export declare const LIMITS: Readonly<{
84
- sourceBytes: number;
85
- objects: 500;
86
- edges: 1200;
87
- depth: 12;
88
- labelChars: number;
89
- totalLabelBytes: number;
90
- outputBytes: number;
91
- nativeSourceChars: 300000;
92
- }>;
93
- export declare class Ids {
94
- readonly entries: IdMapping[];
95
- private readonly byForeign;
96
- private readonly taken;
97
- get(kind: string, foreign: string, preferred?: string): string;
98
- }
99
- export declare const quote: (value: string) => string;
100
- export declare const blankPlan: (title: string) => NativePlan;
101
- export declare function inputLimit(source: string): Diagnostic[];
102
- export declare function finish(format: Format, family: string, plan: NativePlan, diagnostics: Diagnostic[], ids: Ids): ImportResult;
103
- /** Only an explicit hex color is accepted. No CSS, URL, or Graphviz colorscheme interpretation. */
104
- export declare function hex(value: string | undefined): string | undefined;
105
- export declare function applyColor(plan: NativePlan, o: NativeObject, fill?: string, stroke?: string, ink?: string): void;
@@ -1,120 +0,0 @@
1
- /**
2
- * Tested against mermaid 12.2.0. Uses its internal DB behind a narrow, checked boundary.
3
- * This file parses only; it neither renders Mermaid nor attaches interaction callbacks.
4
- * Call in an isolated Node worker with a DOM, or in a dedicated browser Mermaid instance.
5
- */
6
- export declare const MERMAID_VERSION: "12.2.0";
7
- export type ParserDiagnostic = {
8
- code: string;
9
- severity: 'warning' | 'error';
10
- message: string;
11
- line?: number;
12
- column?: number;
13
- locationKind?: 'source' | 'parser-relative';
14
- };
15
- export type FlowVertex = {
16
- id: string;
17
- text: string;
18
- type?: string;
19
- labelType: string;
20
- classes: string[];
21
- styles: string[];
22
- link?: string;
23
- icon?: string;
24
- img?: string;
25
- props?: Record<string, unknown>;
26
- };
27
- export type FlowEdge = {
28
- start: string;
29
- end: string;
30
- text: string;
31
- type?: string;
32
- stroke?: string;
33
- id?: string;
34
- isUserDefinedId: boolean;
35
- labelType: string;
36
- classes: string[];
37
- style: string[];
38
- length?: number;
39
- interpolate?: string;
40
- animate?: boolean;
41
- animation?: string;
42
- };
43
- export type FlowGroup = {
44
- id: string;
45
- title: string;
46
- nodes: string[];
47
- dir?: string;
48
- labelType: string;
49
- classes: string[];
50
- metadata?: Record<string, unknown>;
51
- };
52
- export type FlowClass = {
53
- id: string;
54
- styles: string[];
55
- textStyles: string[];
56
- };
57
- export type FlowSnapshot = {
58
- format: 'mermaid';
59
- family: 'flowchart';
60
- parserVersion: typeof MERMAID_VERSION;
61
- direction: string;
62
- vertices: FlowVertex[];
63
- edges: FlowEdge[];
64
- groups: FlowGroup[];
65
- classes: FlowClass[];
66
- defaultEdgeStyle: string[];
67
- defaultEdgeInterpolate?: string;
68
- };
69
- /** One entry of Mermaid's ordered sequence log; `kind` is its LINETYPE name. */
70
- export type SequenceEvent = {
71
- kind: string;
72
- from?: string;
73
- to?: string;
74
- text: string;
75
- placement?: 'left' | 'right' | 'over';
76
- central: boolean;
77
- };
78
- export type SequenceActor = {
79
- id: string;
80
- name: string;
81
- type: string;
82
- box?: number;
83
- links: string[];
84
- };
85
- export type SequenceBox = {
86
- name?: string;
87
- fill?: string;
88
- };
89
- export type SequenceSnapshot = {
90
- format: 'mermaid';
91
- family: 'sequence';
92
- parserVersion: typeof MERMAID_VERSION;
93
- title?: string;
94
- actors: SequenceActor[];
95
- boxes: SequenceBox[];
96
- events: SequenceEvent[];
97
- created: string[];
98
- destroyed: string[];
99
- };
100
- export type ParseFlowResult = {
101
- ok: true;
102
- snapshot: FlowSnapshot | SequenceSnapshot;
103
- diagnostics: ParserDiagnostic[];
104
- } | {
105
- ok: false;
106
- diagnostics: ParserDiagnostic[];
107
- };
108
- type MermaidApi = Pick<(typeof import('mermaid'))['default'], 'initialize' | 'mermaidAPI'>;
109
- /** DB strings contain Mermaid entity sentinels; preserve entity spelling for text decoding. */
110
- export declare function restoreEntitySpelling(value: string): string;
111
- /**
112
- * Use an unattached HTML template only. Its content is inert and is never adopted into the page.
113
- * Caller supplies the browser document or the dedicated worker's JSDOM document.
114
- * Markdown markers deliberately remain visible; native Markdown rendering is not assumed.
115
- */
116
- export declare function makePlainLabel(document: Document): (value: string) => string;
117
- export declare function preflightMermaidFlow(source: string): ParserDiagnostic[];
118
- /** Each factory owns a serialized queue because Mermaid maintains parser/configuration state. */
119
- export declare function createMermaidFlowParser(load: () => Promise<MermaidApi>): (source: string) => Promise<ParseFlowResult>;
120
- export {};
@@ -1,4 +0,0 @@
1
- import { type ImportResult } from './import-core';
2
- import { type ParseFlowResult } from './mermaid-facade';
3
- /** Convert a checked Mermaid snapshot into valid native source. */
4
- export declare function importMermaidFlow(parsed: ParseFlowResult, plainText: (value: string) => string, title?: string): ImportResult;
@@ -1,8 +0,0 @@
1
- /**
2
- * Mermaid `sequenceDiagram` -> native source. Participants become nodes and messages become edges
3
- * in file order. Native sequences have no fragments, so each top-level branch of a block becomes
4
- * a phase band, and the warning says that the branch logic is gone.
5
- */
6
- import { type Diagnostic, type ImportResult } from './import-core';
7
- import type { SequenceSnapshot } from './mermaid-facade';
8
- export declare function mapMermaidSequence(snapshot: SequenceSnapshot, plainText: (value: string) => string, title: string, diagnostics: Diagnostic[]): ImportResult;
@@ -1,3 +0,0 @@
1
- /** Keep the imported native source before navigating away from the current diagram. */
2
- export declare function keepImportedSource(source: string): string;
3
- export declare function readImportedSource(id: string): string | null;
@@ -1,7 +0,0 @@
1
- /**
2
- * Source in a URL hash, deflated and base64url-encoded: `#s=<data>`. The hash never reaches a
3
- * server, so a shared link carries the diagram and nothing else.
4
- */
5
- export declare function encodeSource(source: string): Promise<string>;
6
- /** The source in a `#s=` hash, or null when there is none or it does not decode. */
7
- export declare function decodeSource(hash: string): Promise<string | null>;
@@ -1,53 +0,0 @@
1
- /**
2
- * Compare's reading of its candidates: what each one measures, which ones are the same drawing,
3
- * which few are worth showing, and how each differs from the current drawing.
4
- */
5
- import type { RoutingResult } from '../engines/routing-engine.js';
6
- import type { StaticScene } from './static-scene';
7
- export interface Measure {
8
- crossings: number;
9
- blocked: number;
10
- overlaps: number;
11
- labels: number;
12
- bends: number;
13
- length: number;
14
- area: number;
15
- aspect: number;
16
- }
17
- export declare function measure(scene: StaticScene, routing: RoutingResult): Measure;
18
- /** Two drawings match when every box and line agrees within a couple of pixels. */
19
- export declare function sameDrawing(a: StaticScene, b: StaticScene): boolean;
20
- export interface Reading {
21
- /** Hard defects this candidate has that the current drawing does not. */
22
- defects: string[];
23
- gains: string[];
24
- costs: string[];
25
- }
26
- export declare const count: (n: number, noun: string) => string;
27
- /** How a candidate differs from the current drawing, from its measures alone. */
28
- export declare function readDifference(m: Measure, base: Measure): Reading;
29
- /** The measures of the drawing the others are read against. */
30
- export declare const describeMeasure: (m: Measure) => string;
31
- export interface Candidate {
32
- index: number;
33
- measure: Measure;
34
- scene: StaticScene;
35
- }
36
- /**
37
- * The sheet's slots after a change: each card in `keep` stays where it was, so a card never moves
38
- * under the pointer, and `fill` takes the free slots in order.
39
- */
40
- export declare function holdSlots(before: number[], keep: number[], fill: number[], limit: number): number[];
41
- /**
42
- * The candidates worth showing beside the current drawing, best first. Repeats of the current
43
- * drawing or of each other are dropped. A candidate with more hard defects than the current
44
- * drawing comes last, whatever its other measures, and the fewer it has the sooner it comes. A
45
- * candidate that beats the current drawing on something comes before one that does not: first the
46
- * best for hard defects, crossings, area and line length, then the ones with the fewest hard
47
- * defects and least like those already chosen.
48
- */
49
- export declare function pickCandidates(current: Candidate, candidates: Candidate[], limit: number): {
50
- shown: number[];
51
- others: number[];
52
- alike: number;
53
- };
@@ -1,17 +0,0 @@
1
- export declare const SOURCE_KEYWORD = "draftably";
2
- export declare const VERSION_KEYWORD = "draftably-version";
3
- export declare const DRAFTABLY_VERSION: string;
4
- /** The PNG with `source` in a `draftably` chunk before its end, replacing any earlier one. */
5
- export declare function embedPngSource(png: Uint8Array, source: string): Promise<Uint8Array>;
6
- /** The source in a PNG's `draftably` chunk, or null when it has none. */
7
- export declare function readPngSource(png: Uint8Array): Promise<string | null>;
8
- /** The `<metadata>` element that carries `source` in an SVG. */
9
- export declare const svgSourceElement: (source: string) => string;
10
- /** The SVG with `source` in a metadata element just inside its root. */
11
- export declare const embedSvgSource: (svg: string, source: string) => string;
12
- /** The source in an SVG's `draftably-source` metadata, or null when it has none. */
13
- export declare function readSvgSource(svg: string): string | null;
14
- /** The source embedded in PNG or SVG bytes, or null when there is none. */
15
- export declare function readImageSource(bytes: Uint8Array): Promise<string | null>;
16
- /** True for a file name the CLI and viewer read source out of. */
17
- export declare const isImageName: (name: string) => boolean;
@@ -1,15 +0,0 @@
1
- export interface ExampleInfo {
2
- id: string;
3
- title: string;
4
- /** The first comment in the file. */
5
- summary: string;
6
- source: string;
7
- nodes: number;
8
- groups: number;
9
- edges: number;
10
- /** Deepest container nesting: 0 for a flat diagram. */
11
- depth: number;
12
- }
13
- /** All examples, flattest first, so the list reads as a ladder of nesting depth. */
14
- export declare const EXAMPLES: ExampleInfo[];
15
- export declare const findExample: (id: string) => ExampleInfo | undefined;
@@ -1,27 +0,0 @@
1
- /**
2
- * Where a drawing's text cannot be read: a connection label on another label, a shape, a group's
3
- * title or a line, and a shape title too long for its shape. Compare counts these for each
4
- * candidate and marks them on its card, so this has to stay cheap and read only the drawn scene.
5
- */
6
- import { type ResolvedAppearance } from './appearance';
7
- import type { DrawnRoute } from './routes';
8
- import type { StaticScene } from './static-scene';
9
- import type { DiagramGroup, Rect } from './types';
10
- /** Connection labels as boxes. Labels are centred on their spot. */
11
- export declare const labelBoxes: (routes: readonly DrawnRoute[]) => {
12
- route: DrawnRoute;
13
- box: {
14
- x: number;
15
- y: number;
16
- w: number;
17
- h: number;
18
- };
19
- }[];
20
- /** A group's title: its icon and text, as the canvas draws them. */
21
- export declare function groupTitleInk(g: DiagramGroup, r: Rect, look: ResolvedAppearance): Rect;
22
- export interface LabelHit {
23
- /** What cannot be read, and where to mark it. */
24
- box: Rect;
25
- note: string;
26
- }
27
- export declare function labelHits(scene: StaticScene): LabelHit[];
@@ -1,15 +0,0 @@
1
- import type { RoutingResult } from '../engines/routing-engine.js';
2
- import { type VisibleGraph } from './graph';
3
- import { type DrawnRoute } from './routes';
4
- import type { Diagram, Point, Rect } from './types';
5
- /** A read-only drawing of a document with precomputed routes, e.g. a comparison candidate. */
6
- export interface StaticScene {
7
- doc: Diagram;
8
- vg: VisibleGraph;
9
- rects: Map<string, Rect>;
10
- routes: DrawnRoute[];
11
- bounds: Rect;
12
- }
13
- export declare function buildStaticScene(doc: Diagram, routing: RoutingResult): StaticScene;
14
- /** Center of an object in a scene, or of its nearest visible container when it is hidden. */
15
- export declare function anchorPoint(scene: StaticScene, id: string): Point;