@draftably/editor 0.0.0-stage → 0.1.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 (185) hide show
  1. package/README.md +26 -2
  2. package/dist/LICENSE +21 -0
  3. package/dist/assets/engine.worker-DmHew5f6.js +6813 -0
  4. package/dist/assets/import-d2.worker-CnXfFXoa.js +5395 -0
  5. package/dist/chunks/abnfDiagram-WEYOIA3C-llcpthp5.js +87 -0
  6. package/dist/chunks/arc-rJj0TtXf.js +83 -0
  7. package/dist/chunks/architectureDiagram-ZHVYKT53-CfiXg0Lk.js +4781 -0
  8. package/dist/chunks/blockDiagram-RJAE7QA3-CO-14jWz.js +1440 -0
  9. package/dist/chunks/browser-iNhbPsGc.js +40 -0
  10. package/dist/chunks/c4Diagram-XDPPPE54-DYKuxA4n.js +1524 -0
  11. package/dist/chunks/channel-qMvPU6eH.js +5 -0
  12. package/dist/chunks/chunk-2E7WHVMD-BEZwsFS3.js +670 -0
  13. package/dist/chunks/chunk-2Q5K7J3B-gqtzQ8ux.js +18 -0
  14. package/dist/chunks/chunk-4EMNKR2T-MC54CXVe.js +262 -0
  15. package/dist/chunks/chunk-55XCU76K-DkZUAaqC.js +68 -0
  16. package/dist/chunks/chunk-5VM5RSS4-CaKe4sjM.js +19 -0
  17. package/dist/chunks/chunk-JWPE2WC7-CnAFS2xF.js +8 -0
  18. package/dist/chunks/chunk-VQ5W62QI-CXRv7FiX.js +19 -0
  19. package/dist/chunks/chunk-XXDRQBXY-B-AMQgD2.js +8 -0
  20. package/dist/chunks/chunk-ZCHMQSOR-BALpdc3g.js +451 -0
  21. package/dist/chunks/classDiagram-v2-4MYWR3UA-wPjgJTg4.js +1570 -0
  22. package/dist/chunks/cose-bilkent-JH36ORCC-Bbh5ggBc.js +2608 -0
  23. package/dist/chunks/cynefin-EF2NZ3EQ-Bt6b88hY.js +22361 -0
  24. package/dist/chunks/cynefinDiagram-WF24UDRP-BHWZvxoF.js +299 -0
  25. package/dist/chunks/cytoscape.esm-CRsF_JA3.js +18791 -0
  26. package/dist/chunks/dagre-NK4GIZVX-Cz37yPrT.js +2157 -0
  27. package/dist/chunks/defaultLocale-BgPVtth8.js +171 -0
  28. package/dist/chunks/diagram-CBK3MWTC-Q2R6FJ0B.js +531 -0
  29. package/dist/chunks/diagram-I5XIIV2D-a2Kdu_wA.js +153 -0
  30. package/dist/chunks/diagram-ODIL2UCW-DTWXxcOn.js +346 -0
  31. package/dist/chunks/diagram-PFBEJUXE-DIAQQ5KX.js +480 -0
  32. package/dist/chunks/diagram-RJA3I4VV-BPD0GghS.js +219 -0
  33. package/dist/chunks/diagram-TYUNFSNR-BmdkONfG.js +2586 -0
  34. package/dist/chunks/dot-importer-B23jwEkx.js +1547 -0
  35. package/dist/chunks/ebnfDiagram-V4P3TTPT-C5IKvYlb.js +109 -0
  36. package/dist/chunks/elk-QONTBCTQ-CtdQFvh2.js +49229 -0
  37. package/dist/chunks/erDiagram-KYQIGQAA-5wguK9Dx.js +1064 -0
  38. package/dist/chunks/flowDiagram-IUGLLWBU-BijvFPku.js +1771 -0
  39. package/dist/chunks/ganttDiagram-R7GPNTJY-BaqGPz-O.js +2729 -0
  40. package/dist/chunks/gitGraphDiagram-PDYL7XHY-DZfMGyHE.js +815 -0
  41. package/dist/chunks/graph-CKJmgLki.js +1541 -0
  42. package/dist/chunks/import-core-C-I1wGfw.js +145 -0
  43. package/dist/chunks/infoDiagram-MVDRKAX5-C2vH_59e.js +24 -0
  44. package/dist/chunks/init-DjUOC4st.js +16 -0
  45. package/dist/chunks/ishikawaDiagram-HPEHV2GE-q149MFlV.js +624 -0
  46. package/dist/chunks/journeyDiagram-BOSHW7O7-D-2Z3VtR.js +834 -0
  47. package/dist/chunks/kanban-definition-FNSA4HC5-wvAjV5ub.js +724 -0
  48. package/dist/chunks/katex-BsrBVQKd.js +11314 -0
  49. package/dist/chunks/linear-4t7D_ros.js +259 -0
  50. package/dist/chunks/mermaid-facade-BoLWBerE.js +289 -0
  51. package/dist/chunks/mermaid-importer-Cgx1IhmR.js +478 -0
  52. package/dist/chunks/mermaid.core-DXv6D2Sm.js +19244 -0
  53. package/dist/chunks/mindmap-definition-6OY57UG3-r9wTKul_.js +837 -0
  54. package/dist/chunks/mount-C1Xk_GQz.js +22131 -0
  55. package/dist/chunks/ordinal-DfAQgscy.js +61 -0
  56. package/dist/chunks/pegDiagram-ECIUJNBX-CmKlFWiP.js +95 -0
  57. package/dist/chunks/pieDiagram-GNMPY74T-DNTw_qan.js +208 -0
  58. package/dist/chunks/quadrantDiagram-D57K4MC3-CT_tvVub.js +1029 -0
  59. package/dist/chunks/railroadDiagram-Y72NRBL7-C5TUvZBe.js +77 -0
  60. package/dist/chunks/requirementDiagram-EQYSW5RA-C_c65aCa.js +889 -0
  61. package/dist/chunks/sankeyDiagram-SY24JHO5-CKcbizM1.js +859 -0
  62. package/dist/chunks/sequenceDiagram-BLEHNHQU-GpVnHOjf.js +2972 -0
  63. package/dist/chunks/sizeCapture-INFHLROL-CToN3JSu.js +46 -0
  64. package/dist/chunks/stateDiagram-v2-A6IESKWZ-rJYd2FfM.js +1520 -0
  65. package/dist/chunks/swimlanes-B3ENRKFQ-C7w5pfxG.js +4991 -0
  66. package/dist/chunks/swimlanesDiagram-AYQRV4AK-BpGY_bvE.js +13 -0
  67. package/dist/chunks/timeline-definition-JXYKGLGB-ChKFPBKc.js +1058 -0
  68. package/dist/chunks/usecaseDiagram-WPOLBNNX-skXH8Dcu.js +7945 -0
  69. package/dist/chunks/vennDiagram-Q3Y3IDCW-C5KknmJf.js +1578 -0
  70. package/dist/chunks/wardleyDiagram-IVAIDKWA-DY4Lkfpu.js +678 -0
  71. package/dist/chunks/xychartDiagram-4URNHDU4-BHScsL7h.js +1536 -0
  72. package/dist/element.js +36 -0
  73. package/dist/index.js +4 -0
  74. package/dist/types/src/cli/links.d.ts +4 -0
  75. package/dist/types/src/cli/pdf.d.ts +29 -0
  76. package/dist/types/src/cli/png.d.ts +23 -0
  77. package/dist/types/src/cli/svg.d.ts +4 -0
  78. package/dist/types/src/components/Icon.d.ts +14 -0
  79. package/dist/types/src/components/LayoutPreviewBar.d.ts +2 -0
  80. package/dist/types/src/components/canvas/Canvas.d.ts +15 -0
  81. package/dist/types/src/components/canvas/Frame.d.ts +22 -0
  82. package/dist/types/src/components/canvas/InlineEditor.d.ts +2 -0
  83. package/dist/types/src/components/canvas/Notes.d.ts +5 -0
  84. package/dist/types/src/components/canvas/Overlay.d.ts +2 -0
  85. package/dist/types/src/components/canvas/StateBar.d.ts +5 -0
  86. package/dist/types/src/components/canvas/TextHits.d.ts +6 -0
  87. package/dist/types/src/components/canvas/ZoomControls.d.ts +1 -0
  88. package/dist/types/src/components/canvas/text-boxes.d.ts +24 -0
  89. package/dist/types/src/components/controls.d.ts +88 -0
  90. package/dist/types/src/components/scene/EdgeView.d.ts +22 -0
  91. package/dist/types/src/components/scene/GroupView.d.ts +22 -0
  92. package/dist/types/src/components/scene/Lifelines.d.ts +15 -0
  93. package/dist/types/src/components/scene/LinkMark.d.ts +11 -0
  94. package/dist/types/src/components/scene/NodeView.d.ts +18 -0
  95. package/dist/types/src/components/scene/parts.d.ts +50 -0
  96. package/dist/types/src/components/sculpt/BrushDock.d.ts +2 -0
  97. package/dist/types/src/components/sculpt/TimelineDeck.d.ts +2 -0
  98. package/dist/types/src/components/session-context.d.ts +486 -0
  99. package/dist/types/src/dsl/cells.d.ts +91 -0
  100. package/dist/types/src/dsl/channels.d.ts +53 -0
  101. package/dist/types/src/dsl/compile.d.ts +162 -0
  102. package/dist/types/src/dsl/frame.d.ts +38 -0
  103. package/dist/types/src/dsl/lanes.d.ts +23 -0
  104. package/dist/types/src/dsl/layout-edits.d.ts +58 -0
  105. package/dist/types/src/dsl/legend-notes.d.ts +3 -0
  106. package/dist/types/src/dsl/project.d.ts +39 -0
  107. package/dist/types/src/dsl/source-edits.d.ts +37 -0
  108. package/dist/types/src/dsl/syntax.d.ts +317 -0
  109. package/dist/types/src/dsl/translate.d.ts +69 -0
  110. package/dist/types/src/editor/Editor.d.ts +6 -0
  111. package/dist/types/src/editor/element.d.ts +15 -0
  112. package/dist/types/src/editor/mount.d.ts +23 -0
  113. package/dist/types/src/import/browser.d.ts +3 -0
  114. package/dist/types/src/import/detect.d.ts +31 -0
  115. package/dist/types/src/import/dot-importer.d.ts +3 -0
  116. package/dist/types/src/import/import-core.d.ts +105 -0
  117. package/dist/types/src/import/mermaid-facade.d.ts +120 -0
  118. package/dist/types/src/import/mermaid-importer.d.ts +4 -0
  119. package/dist/types/src/import/mermaid-sequence.d.ts +8 -0
  120. package/dist/types/src/import/scratch.d.ts +3 -0
  121. package/dist/types/src/lib/engine-tasks.d.ts +88 -0
  122. package/dist/types/src/lib/font-data.d.ts +9 -0
  123. package/dist/types/src/lib/saved-diagram.d.ts +4 -0
  124. package/dist/types/src/lib/scene-cache.d.ts +4 -0
  125. package/dist/types/src/lib/source-hash.d.ts +7 -0
  126. package/dist/types/src/lib/svg-export.d.ts +15 -0
  127. package/dist/types/src/model/appearance.d.ts +209 -0
  128. package/dist/types/src/model/bounds.d.ts +19 -0
  129. package/dist/types/src/model/camera.d.ts +21 -0
  130. package/dist/types/src/model/candidates.d.ts +53 -0
  131. package/dist/types/src/model/colors.d.ts +22 -0
  132. package/dist/types/src/model/document.d.ts +24 -0
  133. package/dist/types/src/model/edits.d.ts +133 -0
  134. package/dist/types/src/model/embed.d.ts +17 -0
  135. package/dist/types/src/model/examples.d.ts +15 -0
  136. package/dist/types/src/model/font-faces.d.ts +24 -0
  137. package/dist/types/src/model/fonts.d.ts +47 -0
  138. package/dist/types/src/model/footnote.d.ts +34 -0
  139. package/dist/types/src/model/frame.d.ts +71 -0
  140. package/dist/types/src/model/geometry.d.ts +29 -0
  141. package/dist/types/src/model/graph.d.ts +53 -0
  142. package/dist/types/src/model/heading.d.ts +38 -0
  143. package/dist/types/src/model/icons.d.ts +2 -0
  144. package/dist/types/src/model/label-hits.d.ts +27 -0
  145. package/dist/types/src/model/labels.d.ts +88 -0
  146. package/dist/types/src/model/legend.d.ts +25 -0
  147. package/dist/types/src/model/link.d.ts +63 -0
  148. package/dist/types/src/model/markers.d.ts +47 -0
  149. package/dist/types/src/model/note.d.ts +75 -0
  150. package/dist/types/src/model/panels.d.ts +11 -0
  151. package/dist/types/src/model/rich-text.d.ts +24 -0
  152. package/dist/types/src/model/routes.d.ts +170 -0
  153. package/dist/types/src/model/samples.d.ts +11 -0
  154. package/dist/types/src/model/stack.d.ts +8 -0
  155. package/dist/types/src/model/static-scene.d.ts +15 -0
  156. package/dist/types/src/model/status.d.ts +84 -0
  157. package/dist/types/src/model/styles.d.ts +13 -0
  158. package/dist/types/src/model/surface.d.ts +31 -0
  159. package/dist/types/src/model/types.d.ts +277 -0
  160. package/dist/types/src/runtime/svg-renderer.d.ts +38 -0
  161. package/dist/types/src/server/file-session.d.ts +19 -0
  162. package/dist/types/src/server/workspace.d.ts +21 -0
  163. package/dist/types/src/state/active-session.d.ts +479 -0
  164. package/dist/types/src/state/commands.d.ts +529 -0
  165. package/dist/types/src/state/comparison.d.ts +151 -0
  166. package/dist/types/src/state/files.d.ts +61 -0
  167. package/dist/types/src/state/keyboard.d.ts +6 -0
  168. package/dist/types/src/state/keys.d.ts +5 -0
  169. package/dist/types/src/state/launch.d.ts +61 -0
  170. package/dist/types/src/state/links.d.ts +11 -0
  171. package/dist/types/src/state/session/actions.d.ts +77 -0
  172. package/dist/types/src/state/session/canvas-text.d.ts +24 -0
  173. package/dist/types/src/state/session/document.d.ts +84 -0
  174. package/dist/types/src/state/session/editor.d.ts +81 -0
  175. package/dist/types/src/state/session/emphasis.d.ts +11 -0
  176. package/dist/types/src/state/session/file-session.d.ts +98 -0
  177. package/dist/types/src/state/session/index.d.ts +496 -0
  178. package/dist/types/src/state/session/layout.d.ts +79 -0
  179. package/dist/types/src/state/session/pointer.d.ts +19 -0
  180. package/dist/types/src/state/session/routing.d.ts +20 -0
  181. package/dist/types/src/state/session/scene.d.ts +144 -0
  182. package/dist/types/src/state/session/sculpt.d.ts +70 -0
  183. package/dist/types/src/state/toast.d.ts +14 -0
  184. package/dist/types/src/state/ui.d.ts +39 -0
  185. package/package.json +41 -3
@@ -0,0 +1,486 @@
1
+ /** The diagram session a canvas and its panels edit, provided once per editor. */
2
+ import { type JSX } from 'solid-js';
3
+ import type { DiagramSession } from '../state/session';
4
+ export declare function DiagramSessionProvider(props: {
5
+ session: DiagramSession;
6
+ children: JSX.Element;
7
+ }): JSX.Element;
8
+ /** The session drawn here, or undefined where scene views draw without one (Compare, tests). */
9
+ export declare const useSessionIfAny: () => ({
10
+ dispose: () => void;
11
+ } & {
12
+ selectedText: import("solid-js").Accessor<string | null>;
13
+ setSelectedText: import("solid-js").Setter<string | null>;
14
+ } & {
15
+ options: import("../state/session").SessionOptions;
16
+ doc: import("../model/types").Diagram;
17
+ setDoc: import("solid-js/store").SetStoreFunction<import("../model/types").Diagram>;
18
+ saveStatus: import("solid-js").Accessor<"saved" | "saving" | "preview" | "failed">;
19
+ undoStack: import("solid-js").Accessor<import("../state/session/document").HistoryEntry[]>;
20
+ redoStack: import("solid-js").Accessor<import("../state/session/document").HistoryEntry[]>;
21
+ revision: import("solid-js").Accessor<number>;
22
+ snapshotDoc: () => import("../model/types").Diagram;
23
+ snapshot: () => string;
24
+ selection: import("solid-js").Accessor<ReadonlySet<string>>;
25
+ selectedIds: () => string[];
26
+ isSelected: (id: string) => boolean;
27
+ singleSelection: () => string | undefined;
28
+ setSelection: (ids: Iterable<string>) => void;
29
+ selectItems: (ids: string[], { add, toggle }?: {
30
+ add?: boolean | undefined;
31
+ toggle?: boolean | undefined;
32
+ }) => void;
33
+ clearSelection: () => void;
34
+ selectText: (id: string) => void;
35
+ onBeforeEdit: (handler: () => void) => void;
36
+ prepareForEdit: () => void;
37
+ onSourceIdMap: (handler: (mapId: (id: string) => string) => void) => void;
38
+ mapSourceIds: (mapId: (id: string) => string) => void;
39
+ setCommitHandler: (handler: ((before: string, label: string, kind: import("../state/session/document").EditKind) => boolean) | null) => ((before: string, label: string, kind: import("../state/session/document").EditKind) => boolean) | null;
40
+ editsGoToFile: () => boolean;
41
+ commit: (before: string, label?: string, kind?: import("../state/session/document").EditKind) => boolean;
42
+ pushUndo: (entry: import("../state/session/document").HistoryEntry) => void;
43
+ annotateLastUndo: (holds: import("../state/session/document").HistoryEntry["holds"]) => void;
44
+ transact: (label: string, fn: (draft: import("../model/types").Diagram) => void, kind?: import("../state/session/document").EditKind) => boolean;
45
+ mutate: (fn: (draft: import("../model/types").Diagram) => void) => void;
46
+ restoreDocument: (next: import("../model/types").Diagram, { keepCamera }?: {
47
+ keepCamera?: boolean | undefined;
48
+ }) => void;
49
+ onHistoryStep: (handler: (entry: import("../state/session/document").HistoryEntry, direction: "undo" | "redo") => void) => void;
50
+ setHistoryHandler: (handler: import("../state/session/document").HistoryHandler | null) => import("../state/session/document").HistoryHandler | null;
51
+ undo: () => void;
52
+ redo: () => void;
53
+ canUndo: () => boolean;
54
+ canRedo: () => boolean;
55
+ setCamera: (camera: import("../model/types").Camera) => void;
56
+ disableBrowserStorage: () => boolean;
57
+ setPersistenceBlocked: (blocked: boolean) => void;
58
+ persist: () => void;
59
+ persistNow: () => void;
60
+ restoreSavedDocument: () => {
61
+ restored: boolean;
62
+ notice?: string;
63
+ };
64
+ watchOtherTabs: () => () => void;
65
+ } & {
66
+ openSource: (source: string, onChange?: (source: string) => void) => Promise<void>;
67
+ receiveSource: (source: string) => Promise<void>;
68
+ liveSource: import("solid-js").Accessor<string>;
69
+ sourceDraft: import("solid-js").Accessor<string | null>;
70
+ fileSession: import("solid-js").Accessor<import("../state/session/file-session").FileSessionInfo | null>;
71
+ fileMode: () => boolean;
72
+ exampleMode: () => boolean;
73
+ scratchName: () => "Draft" | "Example";
74
+ exampleEdited: () => boolean;
75
+ leaveAgreed: () => boolean;
76
+ agreeToLeave: () => undefined;
77
+ fileStatus: import("solid-js").Accessor<import("../state/session/file-session").FileStatus>;
78
+ sourceError: import("solid-js").Accessor<{
79
+ message: string;
80
+ line: number;
81
+ } | null>;
82
+ fileScene: import("solid-js").Accessor<import("../dsl/compile").Scene | null>;
83
+ fileDiagnostics: () => import("../dsl/compile").Diagnostic[];
84
+ conflictProposal: import("solid-js").Accessor<string | null>;
85
+ movedByChange: import("solid-js").Accessor<string[]>;
86
+ fileCompiling: import("solid-js").Accessor<boolean>;
87
+ exampleRestored: () => boolean;
88
+ currentSource: () => string;
89
+ setRouteSink: (sink: {
90
+ adopt: (routes: {
91
+ fingerprint: string;
92
+ result: import("../engines/routing-engine").RoutingResult;
93
+ }) => void;
94
+ quick: (on: boolean) => void;
95
+ awaiting: (on: boolean) => void;
96
+ }) => {
97
+ adopt: (routes: {
98
+ fingerprint: string;
99
+ result: import("../engines/routing-engine").RoutingResult;
100
+ }) => void;
101
+ quick: (on: boolean) => void;
102
+ awaiting: (on: boolean) => void;
103
+ };
104
+ showSource: (source: string, selection?: string[] | (() => string[]), mapId?: (id: string) => string) => Promise<import("../dsl/compile").Scene | null>;
105
+ keepDiskVersion: () => void;
106
+ saveProposalOverDisk: () => void;
107
+ retrySave: () => undefined;
108
+ typeSource: (next: string, burst: number) => Promise<null | undefined>;
109
+ commitSource: (next: string, label: string, message: string) => Promise<boolean>;
110
+ fileBlocked: () => string | null;
111
+ sourceWithRecipe: (scope: string, settings: import("../model/types").LayoutSettings, direction?: "right" | "down") => {
112
+ source: string;
113
+ removed: number;
114
+ };
115
+ sourceWithShape: (scope: string, change: import("../dsl/layout-edits").ShapeChange) => {
116
+ source: string;
117
+ removed: number;
118
+ };
119
+ changedLines: (source: string) => string[];
120
+ changedLine: (source: string) => string;
121
+ sourceWithRouting: (routing: import("../model/types").RoutingSettings, base?: string) => string;
122
+ projectSource: (source: string) => Promise<import("../model/types").Diagram>;
123
+ reflowSelectedGroup: (id: string) => void;
124
+ openFileSession: (file: string) => Promise<boolean>;
125
+ prefetchFile: (file: string) => Promise<void>;
126
+ settleSave: () => Promise<void>;
127
+ closeFileSession: () => void;
128
+ openExampleSession: (id: string, title: string, source: string, key?: string) => Promise<void>;
129
+ resetExample: () => void;
130
+ markExampleSaved: () => void;
131
+ fileStatusText: () => string;
132
+ } & {
133
+ sculptGeometry: import("solid-js").Accessor<import("../model/types").NodeGeometry | null>;
134
+ setSculptGeometry: import("solid-js").Setter<import("../model/types").NodeGeometry | null>;
135
+ animationGeometry: import("solid-js").Accessor<import("../model/types").NodeGeometry | null>;
136
+ setAnimationGeometry: import("solid-js").Setter<import("../model/types").NodeGeometry | null>;
137
+ setQuickRouting: import("solid-js").Setter<boolean>;
138
+ routePrior: import("solid-js").Accessor<import("../engines/routing-engine").PriorRoute[] | null>;
139
+ setRoutePrior: import("solid-js").Setter<import("../engines/routing-engine").PriorRoute[] | null>;
140
+ setAdoptedRoutes: import("solid-js").Setter<{
141
+ fingerprint: string;
142
+ result: import("../engines/routing-engine").RoutingResult;
143
+ } | null>;
144
+ geometry: (id: string) => import("../model/types").NodeLayout;
145
+ visibleScene: import("solid-js").Accessor<import("../model/graph").VisibleGraph>;
146
+ nodeIds: import("solid-js").Accessor<string[]>;
147
+ groupIds: import("solid-js").Accessor<string[]>;
148
+ edgeIds: import("solid-js").Accessor<string[]>;
149
+ sceneRects: import("solid-js").Accessor<Map<string, import("../model/types").Rect>>;
150
+ routing: import("solid-js").Accessor<import("../model/routes").SceneRoutes>;
151
+ routesById: import("solid-js").Accessor<Map<string, import("../model/routes").DrawnRoute>>;
152
+ routeIds: import("solid-js").Accessor<string[]>;
153
+ routesPending: () => boolean;
154
+ resetRoutes: () => void;
155
+ routeInputFor: () => {
156
+ nodes: ({
157
+ shape: import("../model/types").ShapeKind;
158
+ x: number;
159
+ y: number;
160
+ w: number;
161
+ h: number;
162
+ id: string;
163
+ title: string;
164
+ was?: string;
165
+ wasShape?: import("../model/types").ShapeKind;
166
+ wasCount?: number | string;
167
+ href?: string;
168
+ count?: number | string;
169
+ span?: number | "var";
170
+ parentId?: string;
171
+ image?: string;
172
+ lifeline?: number;
173
+ } | {
174
+ parentId?: string | undefined;
175
+ frame?: boolean | undefined;
176
+ shape: import("../model/types").ShapeKind;
177
+ x: number;
178
+ y: number;
179
+ w: number;
180
+ h: number;
181
+ id: string;
182
+ title: string;
183
+ })[];
184
+ groups: {
185
+ titleHeight?: number | undefined;
186
+ collapsed: boolean;
187
+ titleWidth: number;
188
+ x: number;
189
+ y: number;
190
+ w: number;
191
+ h: number;
192
+ id: string;
193
+ title: string;
194
+ was?: string;
195
+ href?: string;
196
+ parentId?: string;
197
+ frame?: "soft" | "none";
198
+ titleLines?: number;
199
+ hull?: import("../model/types").Rect[];
200
+ }[];
201
+ edges: {
202
+ from: string;
203
+ to: string;
204
+ cfg: import("../model/types").EdgeLayout;
205
+ a: string;
206
+ b: string;
207
+ id: string;
208
+ label: string;
209
+ was?: string;
210
+ directed: boolean;
211
+ head?: import("../model/markers").EndMarker;
212
+ tail?: import("../model/markers").EndMarker;
213
+ emphasis: boolean;
214
+ dashed: boolean;
215
+ status?: import("../model/status").Status;
216
+ spot?: import("../model/status").Spot;
217
+ }[];
218
+ };
219
+ routes: () => import("../model/routes").DrawnRoute[];
220
+ routingReport: () => import("../engines/routing-engine").RoutingReport;
221
+ blockedRouteIds: () => string[];
222
+ sceneBounds: () => import("../model/types").Rect;
223
+ viewerFrame: () => {
224
+ x: number;
225
+ y: number;
226
+ w: number;
227
+ h: number;
228
+ natural: number;
229
+ head: {
230
+ w: number;
231
+ h: number;
232
+ };
233
+ key: {
234
+ w: number;
235
+ h: number;
236
+ row: number;
237
+ items: {
238
+ x: number;
239
+ y: number;
240
+ legend?: import("../model/appearance").LegendEntry;
241
+ status?: import("../model/status").StatusCount;
242
+ label: string;
243
+ }[];
244
+ };
245
+ heading: {
246
+ x: number;
247
+ y: number;
248
+ wrap: number;
249
+ };
250
+ legend: {
251
+ x: number;
252
+ y: number;
253
+ };
254
+ foot: {
255
+ x: number;
256
+ y: number;
257
+ type: import("../model/fonts").TypeProfile;
258
+ gutter: number;
259
+ items: {
260
+ note: import("../model/footnote").Footnote;
261
+ lines: import("../model/rich-text").Run[][];
262
+ y: number;
263
+ }[];
264
+ h: number;
265
+ };
266
+ notes: import("../model/note").PlacedNote[];
267
+ };
268
+ } & {
269
+ states: () => import("../model/appearance").EmphasisState[];
270
+ activeState: () => string | null;
271
+ gridOpen: import("solid-js").Accessor<boolean>;
272
+ setGridOpen: import("solid-js").Setter<boolean>;
273
+ showState: (id: string | null) => void;
274
+ stepState: (by: 1 | -1) => boolean;
275
+ drawnDoc: () => import("../model/types").Diagram;
276
+ } & {
277
+ tool: import("solid-js").Accessor<import("../state/session/editor").Tool>;
278
+ setToolSignal: import("solid-js").Setter<import("../state/session/editor").Tool>;
279
+ connectFrom: import("solid-js").Accessor<{
280
+ id: string;
281
+ side: import("../model/types").PortSide;
282
+ } | null>;
283
+ setConnectFrom: import("solid-js").Setter<{
284
+ id: string;
285
+ side: import("../model/types").PortSide;
286
+ } | null>;
287
+ pointer: import("solid-js").Accessor<import("../model/types").Point | null>;
288
+ setPointer: import("solid-js").Setter<import("../model/types").Point | null>;
289
+ drag: import("solid-js").Accessor<import("../state/session/editor").DragFeedback | null>;
290
+ setDrag: import("solid-js").Setter<import("../state/session/editor").DragFeedback | null>;
291
+ inlineEditId: import("solid-js").Accessor<string | null>;
292
+ setInlineEditId: import("solid-js").Setter<string | null>;
293
+ spaceHeld: import("solid-js").Accessor<boolean>;
294
+ setSpaceHeld: import("solid-js").Setter<boolean>;
295
+ measuredStageSize: import("solid-js").Accessor<{
296
+ width: number;
297
+ height: number;
298
+ }>;
299
+ setMeasuredStageSize: import("solid-js").Setter<{
300
+ width: number;
301
+ height: number;
302
+ }>;
303
+ reducedMotion: import("solid-js").Accessor<boolean>;
304
+ setReducedMotion: import("solid-js").Setter<boolean>;
305
+ registerCanvas: (el: SVGSVGElement) => SVGSVGElement;
306
+ canvasElement: () => SVGSVGElement | undefined;
307
+ focusCanvas: () => void | undefined;
308
+ stageSize: () => {
309
+ width: number;
310
+ height: number;
311
+ };
312
+ screenToWorld: (clientX: number, clientY: number) => import("../model/types").Point;
313
+ canvasCenter: () => import("../model/types").Point;
314
+ zoomAt: (factor: number, clientX?: number, clientY?: number) => void;
315
+ panBy: (dx: number, dy: number) => void;
316
+ setStageSize: (size: {
317
+ width: number;
318
+ height: number;
319
+ }) => void;
320
+ fitView: () => void;
321
+ diagramClipped: () => boolean;
322
+ fitRects: (rects: import("../model/types").Rect[], reservedBottom?: number) => void;
323
+ revealObject: (id: string) => void;
324
+ centerSelection: () => void;
325
+ } & {
326
+ layoutBusy: import("solid-js").Accessor<boolean>;
327
+ layoutReport: import("solid-js").Accessor<import("../engines/layout-engine").LayoutReport | null>;
328
+ setLayoutReport: import("solid-js").Setter<import("../engines/layout-engine").LayoutReport | null>;
329
+ layoutPreview: import("solid-js").Accessor<import("../state/session/layout").LayoutPreview | null>;
330
+ labScope: import("solid-js").Accessor<import("../state/session/layout").LabScope>;
331
+ setLabScope: import("solid-js").Setter<import("../state/session/layout").LabScope>;
332
+ labEngine: import("solid-js").Accessor<import("../model/types").LayoutAlgorithmId | null>;
333
+ setLabEngine: import("solid-js").Setter<import("../model/types").LayoutAlgorithmId | null>;
334
+ layoutCheckpoint: import("solid-js").Accessor<import("../model/types").Diagram | null>;
335
+ currentScope: () => {
336
+ scope: import("../engines/layout-engine").LayoutScope;
337
+ containerId?: string;
338
+ };
339
+ layoutTarget: () => "the whole diagram" | "the selection and its neighbours" | "this group" | "the selection";
340
+ setFixedIdsProvider: (provider: () => string[]) => () => string[];
341
+ fixedIds: () => string[];
342
+ cancelLayout: () => void;
343
+ runLayout: (options?: import("../state/session/layout").RunLayoutOptions) => Promise<import("../state/session/layout").LayoutOutcome>;
344
+ runLabLayout: (mode?: "pass" | "rebuild", preview?: boolean, settings?: import("../engines/layout-engine").LayoutOptions) => Promise<import("../state/session/layout").LayoutOutcome>;
345
+ previewSettings: (patch: Partial<Pick<import("../engines/layout-engine").LayoutOptions, "direction" | "aspect">>) => Promise<void>;
346
+ arrangeScope: () => string | null;
347
+ movesBlocked: () => string | null;
348
+ rebuildBlocked: () => string | null;
349
+ routesBlocked: () => string | null;
350
+ previewShape: (change: import("../dsl/layout-edits").ShapeChange) => Promise<import("../state/session/layout").LayoutOutcome>;
351
+ previewRouting: (routing: import("../model/types").RoutingSettings) => Promise<import("../state/session/layout").LayoutOutcome>;
352
+ acceptPreview: () => void;
353
+ discardPreview: () => void;
354
+ holdPreviewBefore: (held: boolean) => void;
355
+ updateLayoutSettings: (patch: Partial<import("../model/types").Diagram["settings"]>) => void;
356
+ captureCheckpoint: () => void;
357
+ setDocumentOpener: (open: (doc: import("../model/types").Diagram, label: string) => void) => (doc: import("../model/types").Diagram, label: string) => void;
358
+ restoreCheckpoint: () => void;
359
+ } & {
360
+ inlineDraft: import("solid-js").Accessor<string>;
361
+ setInlineDraft: import("solid-js").Setter<string>;
362
+ setToolInterceptor: (fn: (tool: import("../state/session/editor").Tool) => boolean) => (tool: import("../state/session/editor").Tool) => boolean;
363
+ setTool: (next: import("../state/session/editor").Tool) => void;
364
+ startInlineEdit: (id: string) => void;
365
+ finishInlineEdit: (save?: boolean) => void;
366
+ addNode: (partial?: import("../model/edits").NewNode, at?: import("../model/types").Point, edit?: boolean) => string;
367
+ addEdge: (partial: import("../model/edits").NewEdge) => string;
368
+ completeConnection: (targetId: string, side?: import("../model/types").Side | "auto") => void;
369
+ quickExtend: ({ side, sibling, at, from, }?: {
370
+ side?: import("../model/types").Side | null;
371
+ sibling?: boolean;
372
+ at?: import("../model/types").Point | null;
373
+ from?: string | null;
374
+ }) => string | undefined;
375
+ insertStep: (edgeId: string, at?: import("../model/types").Point | null) => string | undefined;
376
+ buildFromList: (lines: string[], options?: {
377
+ mode?: import("../model/edits").BuildMode;
378
+ title?: string;
379
+ source?: string | null;
380
+ parentId?: string | null;
381
+ }) => string[];
382
+ wrapSelection: () => string;
383
+ drawContainer: (rect: {
384
+ x: number;
385
+ y: number;
386
+ w: number;
387
+ h: number;
388
+ }) => void;
389
+ deleteSelection: (deep?: boolean) => void;
390
+ ungroupSelection: () => void;
391
+ togglePin: () => void;
392
+ clearManualMarkers: () => void;
393
+ alignSelection: (kind: import("../model/edits").AlignKind) => void;
394
+ nudgeSelection: (dx: number, dy: number) => boolean;
395
+ setColor: (color: import("../model/types").Diagram["styles"][string]["color"]) => void;
396
+ chooseTheme: (theme: import("../model/appearance").ThemeId) => void;
397
+ setAppearanceOverrides: (patch: Partial<import("../model/appearance").AppearanceOverrides>, label?: string) => void;
398
+ setShade: (shade: import("../model/appearance").Shade | undefined) => void;
399
+ fitSelectedContainer: () => void;
400
+ toggleCollapse: (id?: string | undefined) => void;
401
+ reverseSelectedEdge: () => void;
402
+ resetSelectedBends: () => void;
403
+ setLayoutIntent: (role: import("../model/types").IntentRole, id: string | null, placement?: import("../model/types").IntentPlacement) => void;
404
+ markSelectedAs: (role: import("../model/types").IntentRole) => void;
405
+ addWaypointAt: (edgeId: string, point?: import("../model/types").Point) => void;
406
+ removeWaypoint: (edgeId: string, index: number) => void;
407
+ reroute: ({ auto }?: {
408
+ auto?: boolean | undefined;
409
+ }) => void;
410
+ toggleTheme: () => void;
411
+ copySelection: () => import("../model/edits").ClipboardFragment | null;
412
+ hasClipboard: () => boolean;
413
+ pasteFragment: (part?: import("../model/edits").ClipboardFragment | null) => void;
414
+ duplicateSelection: () => void;
415
+ openDocument: (input: unknown, { fit, label }?: {
416
+ fit?: boolean | undefined;
417
+ label?: string | undefined;
418
+ }) => import("../model/types").Diagram;
419
+ newDocument: () => void;
420
+ openSample: (id: string) => import("../model/types").Diagram | undefined;
421
+ } & {
422
+ setRouting: (patch: Partial<import("../model/types").RoutingSettings>, label: string) => void;
423
+ applyRoutePreset: (preset: import("../state/session/routing").RoutePreset) => void;
424
+ activeRoutePreset: () => "Balanced" | "Fewer crossings" | null;
425
+ } & {
426
+ importTimeline: (input: unknown) => void;
427
+ timeline: import("solid-js").Accessor<import("../state/session/sculpt").TimelineState | null>;
428
+ playing: import("solid-js").Accessor<boolean>;
429
+ brushActive: import("solid-js").Accessor<boolean>;
430
+ brushSettings: import("solid-js").Accessor<import("../engines/sculpt-engine").BrushSettings>;
431
+ brushPoint: import("solid-js").Accessor<import("../model/types").Point | null>;
432
+ brushHover: import("solid-js").Accessor<import("../engines/sculpt-engine").DabResult | null>;
433
+ stroking: import("solid-js").Accessor<boolean>;
434
+ restoreKey: import("solid-js").Accessor<boolean>;
435
+ referenceLabel: import("solid-js").Accessor<string>;
436
+ timelineOpen: () => boolean;
437
+ sculptInteracting: () => boolean;
438
+ heldIds: () => string[];
439
+ restoreArchive: () => void;
440
+ openTimeline: (options?: Record<string, unknown>) => Promise<void>;
441
+ closeTimeline: () => void;
442
+ scrub: (index: number, { peek }?: {
443
+ peek?: boolean | undefined;
444
+ }) => number | undefined;
445
+ endPeek: () => void;
446
+ setGhost: (ghost: import("../state/session/sculpt").GhostMode) => void;
447
+ bookmarkStep: () => void;
448
+ keepStep: ({ brush }?: {
449
+ brush?: boolean | undefined;
450
+ }) => boolean;
451
+ stopPlayback: () => void;
452
+ togglePlayback: () => void;
453
+ fitTimelinePath: (reservedBottom: number) => void;
454
+ reopenTimeline: () => void;
455
+ saveTimelineFile: () => void;
456
+ activateBrush: (options?: Partial<import("../engines/sculpt-engine").BrushSettings>) => void;
457
+ deactivateBrush: () => void;
458
+ toggleBrush: () => void;
459
+ updateBrushSettings: (patch: Partial<import("../engines/sculpt-engine").BrushSettings>) => void;
460
+ useCurrentAsReference: () => void;
461
+ brushPointerDown: (e: PointerEvent, target: Element) => boolean;
462
+ brushPointerMove: (e: PointerEvent) => boolean;
463
+ brushPointerUp: (e?: PointerEvent) => boolean;
464
+ brushPointerLeave: () => void;
465
+ cancelStroke: () => boolean;
466
+ brushDab: (point?: import("../model/types").Point) => import("../engines/sculpt-engine").DabResult;
467
+ clearHolds: () => void;
468
+ sculptUndo: () => boolean;
469
+ sculptKey: (e: KeyboardEvent) => boolean;
470
+ sculptBlur: () => void;
471
+ sculptBeforeUnload: () => void;
472
+ hasArchivedTimeline: import("solid-js").Accessor<boolean>;
473
+ setComparisonCloser: (fn: () => void) => () => void;
474
+ } & {
475
+ isDragging: () => boolean;
476
+ cancelGesture: () => void;
477
+ resetModifiers: () => void;
478
+ onWheel: (e: WheelEvent) => void;
479
+ onPointerDown: (e: PointerEvent) => void;
480
+ onPointerMove: (e: PointerEvent) => void;
481
+ onPointerUp: (e: PointerEvent | null) => void;
482
+ onDoubleClick: (e: MouseEvent) => void;
483
+ selectForContextMenu: (e: MouseEvent) => void;
484
+ dragKind: () => string | undefined;
485
+ }) | undefined;
486
+ export declare function useDiagramSession(): DiagramSession;
@@ -0,0 +1,91 @@
1
+ import type { ResolvedAppearance } from '../model/appearance';
2
+ /** Width of a marker's bar, centred on the seam it marks. */
3
+ export declare const MARKER_WIDTH = 8;
4
+ /** How far a marker's bar runs past the cells, so a line meets it clear of their corners. */
5
+ export declare const MARKER_TAIL = 16;
6
+ /** Height of a cells group's title band for a title type of this line height. */
7
+ export declare const cellsBandFor: (lineHeight: number) => number;
8
+ export interface CellInput {
9
+ id: string;
10
+ label: string;
11
+ marker: boolean;
12
+ /** Columns the cell covers in a grid. */
13
+ span?: number;
14
+ /** From a `size` line. */
15
+ size?: {
16
+ width: number;
17
+ height?: number;
18
+ };
19
+ }
20
+ export interface CellBox {
21
+ x: number;
22
+ y: number;
23
+ w: number;
24
+ h: number;
25
+ }
26
+ /** A cell's own size: one line of title when it fits in `MAX_CELL`, wrapped when it does not. */
27
+ export declare function cellSize(c: CellInput, look: ResolvedAppearance): {
28
+ w: number;
29
+ h: number;
30
+ };
31
+ /**
32
+ * Cells edge to edge, in rows of `columns` columns filled in order; a cell's `span` covers that
33
+ * many columns, and a cell that does not fit the rest of a row starts the next one. Without
34
+ * `columns`, the cells form one row (`right`) or one column (`down`). Each column is as wide as
35
+ * its widest single cell, widened at its last column for a wider spanning cell, and each row is
36
+ * as tall as its tallest cell. Cells narrower than `minWidth` in all, the title band's width,
37
+ * widen the last column.
38
+ *
39
+ * A marker takes no room: in one row or column, its bar sits on the seam before the next cell
40
+ * and spans the band above as well, so it cuts the whole object, and runs a short tail past the
41
+ * cells where lines meet it.
42
+ */
43
+ export declare function layoutCells(cells: CellInput[], shape: {
44
+ direction: 'right' | 'down';
45
+ columns?: number;
46
+ }, look: ResolvedAppearance, minWidth?: number): {
47
+ boxes: Map<string, CellBox>;
48
+ w: number;
49
+ h: number;
50
+ };
51
+ /** Width of one unit of a byte or bit layout, and the units in each row, unless the file says. */
52
+ export declare const UNIT_WIDTH: {
53
+ readonly bit: 24;
54
+ readonly byte: 48;
55
+ };
56
+ export declare const UNIT_COLUMNS: {
57
+ readonly bit: 32;
58
+ readonly byte: 16;
59
+ };
60
+ export interface UnitCells {
61
+ /** Each field's main box: the longest piece, which holds its title. */
62
+ boxes: Map<string, CellBox>;
63
+ /** The other pieces of a field that runs on past a row's end. */
64
+ pieces: Map<string, CellBox[]>;
65
+ /** Fields of variable length, drawn with broken ends. */
66
+ open: string[];
67
+ /** Unit numbers above the first row: their centres, and the room they take above the cells. */
68
+ ruler?: {
69
+ h: number;
70
+ ticks: Array<{
71
+ x: number;
72
+ label: string;
73
+ }>;
74
+ };
75
+ w: number;
76
+ h: number;
77
+ }
78
+ /**
79
+ * A byte or bit layout: every unit has one width, so a field's width is its size. Rows hold
80
+ * `columns` units. A field longer than the rest of its row runs on into the next rows; a field of
81
+ * variable length (`span: 'var'`) fills the rest of its row, or a whole row, with broken ends.
82
+ * Every row has the height of the tallest title.
83
+ */
84
+ export declare function layoutUnits(cells: Array<CellInput & {
85
+ open?: boolean;
86
+ }>, shape: {
87
+ unit: 'bit' | 'byte';
88
+ columns?: number;
89
+ unitWidth?: number;
90
+ ruler: boolean;
91
+ }, look: ResolvedAppearance): UnitCells;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Routing channels inside groups.
3
+ *
4
+ * A group leaves `GROUP_INSET` between its members and its border. That is padding, not room for
5
+ * a line: a line routed through it runs beside a member and along the border at once. When a
6
+ * connection has to travel inside a group (a member boxed in by its neighbours, or a link between
7
+ * two of the group's children that can't go straight across), the group grows a channel on one
8
+ * side, wide enough for each such line to run a full standoff from the members,
9
+ * the border and each other. A link between children takes the side of them both ends lean
10
+ * toward, and a return (up or left) takes the left or top when they lean neither way, so a
11
+ * forward line and its return don't cross. The compiler lays the scene out once, plans channels
12
+ * from that geometry, and lays it out again with them.
13
+ */
14
+ import type { ModelEdge } from './syntax';
15
+ /**
16
+ * Room a group leaves round its content: the inset on the left, right and bottom (at least
17
+ * `GROUP_INSET`), and extra room under the title band on top (0 without a channel there).
18
+ */
19
+ export interface Channel {
20
+ left: number;
21
+ right: number;
22
+ top: number;
23
+ bottom: number;
24
+ /** How many lines each side's channel was planned for. */
25
+ lines: Record<Side, number>;
26
+ }
27
+ /** Channels may grow the drawing's area by this much at most. */
28
+ export declare const CHANNEL_BUDGET = 1.1;
29
+ /**
30
+ * Drop the channels that carry fewest lines until the drawing laid out with the rest (`measure`)
31
+ * is within `CHANNEL_BUDGET` of its area without any (`plain`).
32
+ */
33
+ export declare function trimChannels(plan: Map<string, Channel>, plain: number, measure: (channels: Map<string, Channel>) => number): Map<string, Channel>;
34
+ interface Box {
35
+ id: string;
36
+ type: string;
37
+ parent: string;
38
+ x: number;
39
+ y: number;
40
+ w: number;
41
+ h: number;
42
+ }
43
+ export type Side = 'left' | 'right' | 'top' | 'bottom';
44
+ /**
45
+ * Channels for the scene laid out as `objects`. A group is keyed by id; groups with no traffic
46
+ * are left out.
47
+ */
48
+ export declare function planChannels(objects: Box[], edges: ModelEdge[], routing?: {
49
+ edgeGap?: number;
50
+ portGap?: number;
51
+ standoff?: number;
52
+ }): Map<string, Channel>;
53
+ export {};