@draftably/editor 0.0.0-stage → 0.2.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 (101) hide show
  1. package/README.md +25 -2
  2. package/dist/LICENSE +21 -0
  3. package/dist/assets/engine.worker-DwN9io_m.js +6856 -0
  4. package/dist/element.js +36 -0
  5. package/dist/index.js +19555 -0
  6. package/dist/types/src/cli/links.d.ts +4 -0
  7. package/dist/types/src/cli/pdf.d.ts +29 -0
  8. package/dist/types/src/cli/png.d.ts +23 -0
  9. package/dist/types/src/cli/svg.d.ts +4 -0
  10. package/dist/types/src/components/Icon.d.ts +14 -0
  11. package/dist/types/src/components/LayoutPreviewBar.d.ts +2 -0
  12. package/dist/types/src/components/canvas/Canvas.d.ts +15 -0
  13. package/dist/types/src/components/canvas/Frame.d.ts +22 -0
  14. package/dist/types/src/components/canvas/InlineEditor.d.ts +2 -0
  15. package/dist/types/src/components/canvas/Notes.d.ts +5 -0
  16. package/dist/types/src/components/canvas/Overlay.d.ts +2 -0
  17. package/dist/types/src/components/canvas/StateBar.d.ts +5 -0
  18. package/dist/types/src/components/canvas/TextHits.d.ts +6 -0
  19. package/dist/types/src/components/canvas/ZoomControls.d.ts +1 -0
  20. package/dist/types/src/components/canvas/text-boxes.d.ts +24 -0
  21. package/dist/types/src/components/controls.d.ts +91 -0
  22. package/dist/types/src/components/scene/EdgeView.d.ts +22 -0
  23. package/dist/types/src/components/scene/GroupView.d.ts +22 -0
  24. package/dist/types/src/components/scene/Lifelines.d.ts +15 -0
  25. package/dist/types/src/components/scene/LinkMark.d.ts +11 -0
  26. package/dist/types/src/components/scene/NodeView.d.ts +18 -0
  27. package/dist/types/src/components/scene/parts.d.ts +50 -0
  28. package/dist/types/src/components/sculpt/BrushDock.d.ts +2 -0
  29. package/dist/types/src/components/sculpt/TimelineDeck.d.ts +2 -0
  30. package/dist/types/src/components/session-context.d.ts +486 -0
  31. package/dist/types/src/dsl/cells.d.ts +91 -0
  32. package/dist/types/src/dsl/channels.d.ts +53 -0
  33. package/dist/types/src/dsl/compile.d.ts +162 -0
  34. package/dist/types/src/dsl/frame.d.ts +38 -0
  35. package/dist/types/src/dsl/lanes.d.ts +23 -0
  36. package/dist/types/src/dsl/layout-edits.d.ts +58 -0
  37. package/dist/types/src/dsl/legend-notes.d.ts +3 -0
  38. package/dist/types/src/dsl/project.d.ts +39 -0
  39. package/dist/types/src/dsl/source-edits.d.ts +37 -0
  40. package/dist/types/src/dsl/syntax.d.ts +317 -0
  41. package/dist/types/src/dsl/translate.d.ts +69 -0
  42. package/dist/types/src/editor/Editor.d.ts +6 -0
  43. package/dist/types/src/editor/element.d.ts +15 -0
  44. package/dist/types/src/editor/mount.d.ts +23 -0
  45. package/dist/types/src/lib/engine-tasks.d.ts +88 -0
  46. package/dist/types/src/lib/font-data.d.ts +9 -0
  47. package/dist/types/src/lib/saved-diagram.d.ts +4 -0
  48. package/dist/types/src/lib/scene-cache.d.ts +4 -0
  49. package/dist/types/src/lib/svg-export.d.ts +15 -0
  50. package/dist/types/src/model/appearance.d.ts +209 -0
  51. package/dist/types/src/model/bounds.d.ts +19 -0
  52. package/dist/types/src/model/camera.d.ts +21 -0
  53. package/dist/types/src/model/colors.d.ts +22 -0
  54. package/dist/types/src/model/document.d.ts +24 -0
  55. package/dist/types/src/model/edits.d.ts +133 -0
  56. package/dist/types/src/model/embed.d.ts +17 -0
  57. package/dist/types/src/model/font-faces.d.ts +24 -0
  58. package/dist/types/src/model/fonts.d.ts +47 -0
  59. package/dist/types/src/model/footnote.d.ts +34 -0
  60. package/dist/types/src/model/frame.d.ts +71 -0
  61. package/dist/types/src/model/geometry.d.ts +29 -0
  62. package/dist/types/src/model/graph.d.ts +53 -0
  63. package/dist/types/src/model/heading.d.ts +38 -0
  64. package/dist/types/src/model/icons.d.ts +2 -0
  65. package/dist/types/src/model/labels.d.ts +88 -0
  66. package/dist/types/src/model/legend.d.ts +25 -0
  67. package/dist/types/src/model/link.d.ts +63 -0
  68. package/dist/types/src/model/markers.d.ts +47 -0
  69. package/dist/types/src/model/note.d.ts +75 -0
  70. package/dist/types/src/model/panels.d.ts +11 -0
  71. package/dist/types/src/model/rich-text.d.ts +24 -0
  72. package/dist/types/src/model/routes.d.ts +170 -0
  73. package/dist/types/src/model/samples.d.ts +11 -0
  74. package/dist/types/src/model/stack.d.ts +8 -0
  75. package/dist/types/src/model/status.d.ts +84 -0
  76. package/dist/types/src/model/styles.d.ts +13 -0
  77. package/dist/types/src/model/surface.d.ts +31 -0
  78. package/dist/types/src/model/types.d.ts +277 -0
  79. package/dist/types/src/runtime/svg-renderer.d.ts +38 -0
  80. package/dist/types/src/server/file-session.d.ts +19 -0
  81. package/dist/types/src/server/workspace.d.ts +21 -0
  82. package/dist/types/src/state/active-session.d.ts +479 -0
  83. package/dist/types/src/state/canvas-commands.d.ts +169 -0
  84. package/dist/types/src/state/canvas-keyboard.d.ts +15 -0
  85. package/dist/types/src/state/keys.d.ts +5 -0
  86. package/dist/types/src/state/links.d.ts +14 -0
  87. package/dist/types/src/state/session/actions.d.ts +77 -0
  88. package/dist/types/src/state/session/canvas-text.d.ts +24 -0
  89. package/dist/types/src/state/session/document.d.ts +84 -0
  90. package/dist/types/src/state/session/editor.d.ts +81 -0
  91. package/dist/types/src/state/session/emphasis.d.ts +11 -0
  92. package/dist/types/src/state/session/file-session.d.ts +98 -0
  93. package/dist/types/src/state/session/index.d.ts +496 -0
  94. package/dist/types/src/state/session/layout.d.ts +79 -0
  95. package/dist/types/src/state/session/pointer.d.ts +19 -0
  96. package/dist/types/src/state/session/routing.d.ts +20 -0
  97. package/dist/types/src/state/session/scene.d.ts +144 -0
  98. package/dist/types/src/state/session/sculpt.d.ts +70 -0
  99. package/dist/types/src/state/toast.d.ts +14 -0
  100. package/dist/types/src/state/workspace.d.ts +3 -0
  101. package/package.json +41 -3
@@ -0,0 +1,496 @@
1
+ export interface ConfirmRequest {
2
+ title: string;
3
+ message: string;
4
+ confirmLabel: string;
5
+ onConfirm: () => void;
6
+ }
7
+ export interface SessionOptions {
8
+ /** Keep the diagram (and its last layout timeline) in browser storage under this key. */
9
+ storageKey?: string;
10
+ /** Read and write the shown emphasis state in the page URL (`?state=`). */
11
+ urlState?: boolean;
12
+ /** Ask before an action that replaces the diagram. Without it the action goes ahead. */
13
+ confirm?: (request: ConfirmRequest) => void;
14
+ /** Open an object's link. Without it a URL opens in a new tab and other links do nothing. */
15
+ openLink?: (href: string) => void;
16
+ /** The user started a gesture or a tool on the canvas; a host closes its menus here. */
17
+ onInteract?: () => void;
18
+ }
19
+ export declare function createDiagramSession(options?: SessionOptions): {
20
+ dispose: () => void;
21
+ } & {
22
+ selectedText: import("solid-js").Accessor<string | null>;
23
+ setSelectedText: import("solid-js").Setter<string | null>;
24
+ } & {
25
+ options: SessionOptions;
26
+ doc: import("../../model/types").Diagram;
27
+ setDoc: import("solid-js/store").SetStoreFunction<import("../../model/types").Diagram>;
28
+ saveStatus: import("solid-js").Accessor<"saved" | "saving" | "preview" | "failed">;
29
+ undoStack: import("solid-js").Accessor<import("./document").HistoryEntry[]>;
30
+ redoStack: import("solid-js").Accessor<import("./document").HistoryEntry[]>;
31
+ revision: import("solid-js").Accessor<number>;
32
+ snapshotDoc: () => import("../../model/types").Diagram;
33
+ snapshot: () => string;
34
+ selection: import("solid-js").Accessor<ReadonlySet<string>>;
35
+ selectedIds: () => string[];
36
+ isSelected: (id: string) => boolean;
37
+ singleSelection: () => string | undefined;
38
+ setSelection: (ids: Iterable<string>) => void;
39
+ selectItems: (ids: string[], { add, toggle }?: {
40
+ add?: boolean | undefined;
41
+ toggle?: boolean | undefined;
42
+ }) => void;
43
+ clearSelection: () => void;
44
+ selectText: (id: string) => void;
45
+ onBeforeEdit: (handler: () => void) => void;
46
+ prepareForEdit: () => void;
47
+ onSourceIdMap: (handler: (mapId: (id: string) => string) => void) => void;
48
+ mapSourceIds: (mapId: (id: string) => string) => void;
49
+ setCommitHandler: (handler: ((before: string, label: string, kind: import("./document").EditKind) => boolean) | null) => ((before: string, label: string, kind: import("./document").EditKind) => boolean) | null;
50
+ editsGoToFile: () => boolean;
51
+ commit: (before: string, label?: string, kind?: import("./document").EditKind) => boolean;
52
+ pushUndo: (entry: import("./document").HistoryEntry) => void;
53
+ annotateLastUndo: (holds: import("./document").HistoryEntry["holds"]) => void;
54
+ transact: (label: string, fn: (draft: import("../../model/types").Diagram) => void, kind?: import("./document").EditKind) => boolean;
55
+ mutate: (fn: (draft: import("../../model/types").Diagram) => void) => void;
56
+ restoreDocument: (next: import("../../model/types").Diagram, { keepCamera }?: {
57
+ keepCamera?: boolean | undefined;
58
+ }) => void;
59
+ onHistoryStep: (handler: (entry: import("./document").HistoryEntry, direction: "undo" | "redo") => void) => void;
60
+ setHistoryHandler: (handler: import("./document").HistoryHandler | null) => import("./document").HistoryHandler | null;
61
+ undo: () => void;
62
+ redo: () => void;
63
+ canUndo: () => boolean;
64
+ canRedo: () => boolean;
65
+ setCamera: (camera: import("../../model/types").Camera) => void;
66
+ disableBrowserStorage: () => boolean;
67
+ setPersistenceBlocked: (blocked: boolean) => void;
68
+ persist: () => void;
69
+ persistNow: () => void;
70
+ restoreSavedDocument: () => {
71
+ restored: boolean;
72
+ notice?: string;
73
+ };
74
+ watchOtherTabs: () => () => void;
75
+ } & {
76
+ openSource: (source: string, onChange?: (source: string) => void) => Promise<void>;
77
+ receiveSource: (source: string) => Promise<void>;
78
+ liveSource: import("solid-js").Accessor<string>;
79
+ sourceDraft: import("solid-js").Accessor<string | null>;
80
+ fileSession: import("solid-js").Accessor<import("./file-session").FileSessionInfo | null>;
81
+ fileMode: () => boolean;
82
+ exampleMode: () => boolean;
83
+ scratchName: () => "Draft" | "Example";
84
+ exampleEdited: () => boolean;
85
+ leaveAgreed: () => boolean;
86
+ agreeToLeave: () => undefined;
87
+ fileStatus: import("solid-js").Accessor<import("./file-session").FileStatus>;
88
+ sourceError: import("solid-js").Accessor<{
89
+ message: string;
90
+ line: number;
91
+ } | null>;
92
+ fileScene: import("solid-js").Accessor<import("../../dsl/compile").Scene | null>;
93
+ fileDiagnostics: () => import("../../dsl/compile").Diagnostic[];
94
+ conflictProposal: import("solid-js").Accessor<string | null>;
95
+ movedByChange: import("solid-js").Accessor<string[]>;
96
+ fileCompiling: import("solid-js").Accessor<boolean>;
97
+ exampleRestored: () => boolean;
98
+ currentSource: () => string;
99
+ setRouteSink: (sink: {
100
+ adopt: (routes: {
101
+ fingerprint: string;
102
+ result: import("../../engines/routing-engine").RoutingResult;
103
+ }) => void;
104
+ quick: (on: boolean) => void;
105
+ awaiting: (on: boolean) => void;
106
+ }) => {
107
+ adopt: (routes: {
108
+ fingerprint: string;
109
+ result: import("../../engines/routing-engine").RoutingResult;
110
+ }) => void;
111
+ quick: (on: boolean) => void;
112
+ awaiting: (on: boolean) => void;
113
+ };
114
+ showSource: (source: string, selection?: string[] | (() => string[]), mapId?: (id: string) => string) => Promise<import("../../dsl/compile").Scene | null>;
115
+ keepDiskVersion: () => void;
116
+ saveProposalOverDisk: () => void;
117
+ retrySave: () => undefined;
118
+ typeSource: (next: string, burst: number) => Promise<null | undefined>;
119
+ commitSource: (next: string, label: string, message: string) => Promise<boolean>;
120
+ fileBlocked: () => string | null;
121
+ sourceWithRecipe: (scope: string, settings: import("../../model/types").LayoutSettings, direction?: "right" | "down") => {
122
+ source: string;
123
+ removed: number;
124
+ };
125
+ sourceWithShape: (scope: string, change: import("../../dsl/layout-edits").ShapeChange) => {
126
+ source: string;
127
+ removed: number;
128
+ };
129
+ changedLines: (source: string) => string[];
130
+ changedLine: (source: string) => string;
131
+ sourceWithRouting: (routing: import("../../model/types").RoutingSettings, base?: string) => string;
132
+ projectSource: (source: string) => Promise<import("../../model/types").Diagram>;
133
+ reflowSelectedGroup: (id: string) => void;
134
+ openFileSession: (file: string) => Promise<boolean>;
135
+ prefetchFile: (file: string) => Promise<void>;
136
+ settleSave: () => Promise<void>;
137
+ closeFileSession: () => void;
138
+ openExampleSession: (id: string, title: string, source: string, key?: string) => Promise<void>;
139
+ resetExample: () => void;
140
+ markExampleSaved: () => void;
141
+ fileStatusText: () => string;
142
+ } & {
143
+ sculptGeometry: import("solid-js").Accessor<import("./editor").NodeGeometry | null>;
144
+ setSculptGeometry: import("solid-js").Setter<import("./editor").NodeGeometry | null>;
145
+ animationGeometry: import("solid-js").Accessor<import("./editor").NodeGeometry | null>;
146
+ setAnimationGeometry: import("solid-js").Setter<import("./editor").NodeGeometry | null>;
147
+ setQuickRouting: import("solid-js").Setter<boolean>;
148
+ routePrior: import("solid-js").Accessor<import("../../engines/routing-engine").PriorRoute[] | null>;
149
+ setRoutePrior: import("solid-js").Setter<import("../../engines/routing-engine").PriorRoute[] | null>;
150
+ setAdoptedRoutes: import("solid-js").Setter<{
151
+ fingerprint: string;
152
+ result: import("../../engines/routing-engine").RoutingResult;
153
+ } | null>;
154
+ geometry: (id: string) => import("../../model/types").NodeLayout;
155
+ visibleScene: import("solid-js").Accessor<import("../../model/graph").VisibleGraph>;
156
+ nodeIds: import("solid-js").Accessor<string[]>;
157
+ groupIds: import("solid-js").Accessor<string[]>;
158
+ edgeIds: import("solid-js").Accessor<string[]>;
159
+ sceneRects: import("solid-js").Accessor<Map<string, import("../../model/types").Rect>>;
160
+ routing: import("solid-js").Accessor<import("../../model/routes").SceneRoutes>;
161
+ routesById: import("solid-js").Accessor<Map<string, import("../../model/routes").DrawnRoute>>;
162
+ routeIds: import("solid-js").Accessor<string[]>;
163
+ routesPending: () => boolean;
164
+ resetRoutes: () => void;
165
+ routeInputFor: () => {
166
+ nodes: ({
167
+ shape: import("../../model/types").ShapeKind;
168
+ x: number;
169
+ y: number;
170
+ w: number;
171
+ h: number;
172
+ id: string;
173
+ title: string;
174
+ was?: string;
175
+ wasShape?: import("../../model/types").ShapeKind;
176
+ wasCount?: number | string;
177
+ href?: string;
178
+ count?: number | string;
179
+ span?: number | "var";
180
+ parentId?: string;
181
+ image?: string;
182
+ lifeline?: number;
183
+ } | {
184
+ parentId?: string | undefined;
185
+ frame?: boolean | undefined;
186
+ shape: import("../../model/types").ShapeKind;
187
+ x: number;
188
+ y: number;
189
+ w: number;
190
+ h: number;
191
+ id: string;
192
+ title: string;
193
+ })[];
194
+ groups: {
195
+ titleHeight?: number | undefined;
196
+ collapsed: boolean;
197
+ titleWidth: number;
198
+ x: number;
199
+ y: number;
200
+ w: number;
201
+ h: number;
202
+ id: string;
203
+ title: string;
204
+ was?: string;
205
+ href?: string;
206
+ parentId?: string;
207
+ frame?: "soft" | "none";
208
+ titleLines?: number;
209
+ hull?: import("../../model/types").Rect[];
210
+ }[];
211
+ edges: {
212
+ from: string;
213
+ to: string;
214
+ cfg: import("../../model/types").EdgeLayout;
215
+ a: string;
216
+ b: string;
217
+ id: string;
218
+ label: string;
219
+ was?: string;
220
+ directed: boolean;
221
+ head?: import("../../model/markers").EndMarker;
222
+ tail?: import("../../model/markers").EndMarker;
223
+ emphasis: boolean;
224
+ dashed: boolean;
225
+ status?: import("../../model/status").Status;
226
+ spot?: import("../../model/status").Spot;
227
+ }[];
228
+ };
229
+ routes: () => import("../../model/routes").DrawnRoute[];
230
+ routingReport: () => import("../../engines/routing-engine").RoutingReport;
231
+ blockedRouteIds: () => string[];
232
+ sceneBounds: () => import("../../model/types").Rect;
233
+ viewerFrame: () => {
234
+ x: number;
235
+ y: number;
236
+ w: number;
237
+ h: number;
238
+ natural: number;
239
+ head: {
240
+ w: number;
241
+ h: number;
242
+ };
243
+ key: {
244
+ w: number;
245
+ h: number;
246
+ row: number;
247
+ items: {
248
+ x: number;
249
+ y: number;
250
+ legend?: import("../../model/appearance").LegendEntry;
251
+ status?: import("../../model/status").StatusCount;
252
+ label: string;
253
+ }[];
254
+ };
255
+ heading: {
256
+ x: number;
257
+ y: number;
258
+ wrap: number;
259
+ };
260
+ legend: {
261
+ x: number;
262
+ y: number;
263
+ };
264
+ foot: {
265
+ x: number;
266
+ y: number;
267
+ type: import("../../model/fonts").TypeProfile;
268
+ gutter: number;
269
+ items: {
270
+ note: import("../../model/footnote").Footnote;
271
+ lines: import("../../model/rich-text").Run[][];
272
+ y: number;
273
+ }[];
274
+ h: number;
275
+ };
276
+ notes: import("../../model/note").PlacedNote[];
277
+ };
278
+ } & {
279
+ states: () => import("../../model/appearance").EmphasisState[];
280
+ activeState: () => string | null;
281
+ gridOpen: import("solid-js").Accessor<boolean>;
282
+ setGridOpen: import("solid-js").Setter<boolean>;
283
+ showState: (id: string | null) => void;
284
+ stepState: (by: 1 | -1) => boolean;
285
+ drawnDoc: () => import("../../model/types").Diagram;
286
+ } & {
287
+ tool: import("solid-js").Accessor<import("./editor").Tool>;
288
+ setToolSignal: import("solid-js").Setter<import("./editor").Tool>;
289
+ connectFrom: import("solid-js").Accessor<{
290
+ id: string;
291
+ side: import("../../model/types").PortSide;
292
+ } | null>;
293
+ setConnectFrom: import("solid-js").Setter<{
294
+ id: string;
295
+ side: import("../../model/types").PortSide;
296
+ } | null>;
297
+ pointer: import("solid-js").Accessor<import("../../model/types").Point | null>;
298
+ setPointer: import("solid-js").Setter<import("../../model/types").Point | null>;
299
+ drag: import("solid-js").Accessor<import("./editor").DragFeedback | null>;
300
+ setDrag: import("solid-js").Setter<import("./editor").DragFeedback | null>;
301
+ inlineEditId: import("solid-js").Accessor<string | null>;
302
+ setInlineEditId: import("solid-js").Setter<string | null>;
303
+ spaceHeld: import("solid-js").Accessor<boolean>;
304
+ setSpaceHeld: import("solid-js").Setter<boolean>;
305
+ measuredStageSize: import("solid-js").Accessor<{
306
+ width: number;
307
+ height: number;
308
+ }>;
309
+ setMeasuredStageSize: import("solid-js").Setter<{
310
+ width: number;
311
+ height: number;
312
+ }>;
313
+ reducedMotion: import("solid-js").Accessor<boolean>;
314
+ setReducedMotion: import("solid-js").Setter<boolean>;
315
+ registerCanvas: (el: SVGSVGElement) => SVGSVGElement;
316
+ canvasElement: () => SVGSVGElement | undefined;
317
+ focusCanvas: () => void | undefined;
318
+ stageSize: () => {
319
+ width: number;
320
+ height: number;
321
+ };
322
+ screenToWorld: (clientX: number, clientY: number) => import("../../model/types").Point;
323
+ canvasCenter: () => import("../../model/types").Point;
324
+ zoomAt: (factor: number, clientX?: number, clientY?: number) => void;
325
+ panBy: (dx: number, dy: number) => void;
326
+ setStageSize: (size: {
327
+ width: number;
328
+ height: number;
329
+ }) => void;
330
+ fitView: () => void;
331
+ diagramClipped: () => boolean;
332
+ fitRects: (rects: import("../../model/types").Rect[], reservedBottom?: number) => void;
333
+ revealObject: (id: string) => void;
334
+ centerSelection: () => void;
335
+ } & {
336
+ layoutBusy: import("solid-js").Accessor<boolean>;
337
+ layoutReport: import("solid-js").Accessor<import("../../engines/layout-engine").LayoutReport | null>;
338
+ setLayoutReport: import("solid-js").Setter<import("../../engines/layout-engine").LayoutReport | null>;
339
+ layoutPreview: import("solid-js").Accessor<import("./layout").LayoutPreview | null>;
340
+ labScope: import("solid-js").Accessor<import("./layout").LabScope>;
341
+ setLabScope: import("solid-js").Setter<import("./layout").LabScope>;
342
+ labEngine: import("solid-js").Accessor<import("../../model/types").LayoutAlgorithmId | null>;
343
+ setLabEngine: import("solid-js").Setter<import("../../model/types").LayoutAlgorithmId | null>;
344
+ layoutCheckpoint: import("solid-js").Accessor<import("../../model/types").Diagram | null>;
345
+ currentScope: () => {
346
+ scope: import("../../engines/layout-engine").LayoutScope;
347
+ containerId?: string;
348
+ };
349
+ layoutTarget: () => "the whole diagram" | "the selection and its neighbours" | "this group" | "the selection";
350
+ setFixedIdsProvider: (provider: () => string[]) => () => string[];
351
+ fixedIds: () => string[];
352
+ cancelLayout: () => void;
353
+ runLayout: (options?: import("./layout").RunLayoutOptions) => Promise<import("./layout").LayoutOutcome>;
354
+ runLabLayout: (mode?: "pass" | "rebuild", preview?: boolean, settings?: import("../../engines/layout-engine").LayoutOptions) => Promise<import("./layout").LayoutOutcome>;
355
+ previewSettings: (patch: Partial<Pick<import("../../engines/layout-engine").LayoutOptions, "direction" | "aspect">>) => Promise<void>;
356
+ arrangeScope: () => string | null;
357
+ movesBlocked: () => string | null;
358
+ rebuildBlocked: () => string | null;
359
+ routesBlocked: () => string | null;
360
+ previewShape: (change: import("../../dsl/layout-edits").ShapeChange) => Promise<import("./layout").LayoutOutcome>;
361
+ previewRouting: (routing: import("../../model/types").RoutingSettings) => Promise<import("./layout").LayoutOutcome>;
362
+ acceptPreview: () => void;
363
+ discardPreview: () => void;
364
+ holdPreviewBefore: (held: boolean) => void;
365
+ updateLayoutSettings: (patch: Partial<import("../../model/types").Diagram["settings"]>) => void;
366
+ captureCheckpoint: () => void;
367
+ setDocumentOpener: (open: (doc: import("../../model/types").Diagram, label: string) => void) => (doc: import("../../model/types").Diagram, label: string) => void;
368
+ restoreCheckpoint: () => void;
369
+ } & {
370
+ inlineDraft: import("solid-js").Accessor<string>;
371
+ setInlineDraft: import("solid-js").Setter<string>;
372
+ setToolInterceptor: (fn: (tool: import("./editor").Tool) => boolean) => (tool: import("./editor").Tool) => boolean;
373
+ setTool: (next: import("./editor").Tool) => void;
374
+ startInlineEdit: (id: string) => void;
375
+ finishInlineEdit: (save?: boolean) => void;
376
+ addNode: (partial?: import("../../model/edits").NewNode, at?: import("../../model/types").Point, edit?: boolean) => string;
377
+ addEdge: (partial: import("../../model/edits").NewEdge) => string;
378
+ completeConnection: (targetId: string, side?: import("../../model/types").Side | "auto") => void;
379
+ quickExtend: ({ side, sibling, at, from, }?: {
380
+ side?: import("../../model/types").Side | null;
381
+ sibling?: boolean;
382
+ at?: import("../../model/types").Point | null;
383
+ from?: string | null;
384
+ }) => string | undefined;
385
+ insertStep: (edgeId: string, at?: import("../../model/types").Point | null) => string | undefined;
386
+ buildFromList: (lines: string[], options?: {
387
+ mode?: import("../../model/edits").BuildMode;
388
+ title?: string;
389
+ source?: string | null;
390
+ parentId?: string | null;
391
+ }) => string[];
392
+ wrapSelection: () => string;
393
+ drawContainer: (rect: {
394
+ x: number;
395
+ y: number;
396
+ w: number;
397
+ h: number;
398
+ }) => void;
399
+ deleteSelection: (deep?: boolean) => void;
400
+ ungroupSelection: () => void;
401
+ togglePin: () => void;
402
+ clearManualMarkers: () => void;
403
+ alignSelection: (kind: import("../../model/edits").AlignKind) => void;
404
+ nudgeSelection: (dx: number, dy: number) => boolean;
405
+ setColor: (color: import("../../model/types").Diagram["styles"][string]["color"]) => void;
406
+ chooseTheme: (theme: import("../../model/appearance").ThemeId) => void;
407
+ setAppearanceOverrides: (patch: Partial<import("../../model/appearance").AppearanceOverrides>, label?: string) => void;
408
+ setShade: (shade: import("../../model/appearance").Shade | undefined) => void;
409
+ fitSelectedContainer: () => void;
410
+ toggleCollapse: (id?: string | undefined) => void;
411
+ reverseSelectedEdge: () => void;
412
+ resetSelectedBends: () => void;
413
+ setLayoutIntent: (role: import("../../model/types").IntentRole, id: string | null, placement?: import("../../model/types").IntentPlacement) => void;
414
+ markSelectedAs: (role: import("../../model/types").IntentRole) => void;
415
+ addWaypointAt: (edgeId: string, point?: import("../../model/types").Point) => void;
416
+ removeWaypoint: (edgeId: string, index: number) => void;
417
+ reroute: ({ auto }?: {
418
+ auto?: boolean | undefined;
419
+ }) => void;
420
+ toggleTheme: () => void;
421
+ copySelection: () => import("../../model/edits").ClipboardFragment | null;
422
+ hasClipboard: () => boolean;
423
+ pasteFragment: (part?: import("../../model/edits").ClipboardFragment | null) => void;
424
+ duplicateSelection: () => void;
425
+ openDocument: (input: unknown, { fit, label }?: {
426
+ fit?: boolean | undefined;
427
+ label?: string | undefined;
428
+ }) => import("../../model/types").Diagram;
429
+ newDocument: () => void;
430
+ openSample: (id: string) => import("../../model/types").Diagram | undefined;
431
+ } & {
432
+ setRouting: (patch: Partial<import("../../model/types").RoutingSettings>, label: string) => void;
433
+ applyRoutePreset: (preset: import("./routing").RoutePreset) => void;
434
+ activeRoutePreset: () => "Balanced" | "Fewer crossings" | null;
435
+ } & {
436
+ importTimeline: (input: unknown) => void;
437
+ timeline: import("solid-js").Accessor<import("./sculpt").TimelineState | null>;
438
+ playing: import("solid-js").Accessor<boolean>;
439
+ brushActive: import("solid-js").Accessor<boolean>;
440
+ brushSettings: import("solid-js").Accessor<import("../../engines/sculpt-engine").BrushSettings>;
441
+ brushPoint: import("solid-js").Accessor<import("../../model/types").Point | null>;
442
+ brushHover: import("solid-js").Accessor<import("../../engines/sculpt-engine").DabResult | null>;
443
+ stroking: import("solid-js").Accessor<boolean>;
444
+ restoreKey: import("solid-js").Accessor<boolean>;
445
+ referenceLabel: import("solid-js").Accessor<string>;
446
+ timelineOpen: () => boolean;
447
+ sculptInteracting: () => boolean;
448
+ heldIds: () => string[];
449
+ restoreArchive: () => void;
450
+ openTimeline: (options?: Record<string, unknown>) => Promise<void>;
451
+ closeTimeline: () => void;
452
+ scrub: (index: number, { peek }?: {
453
+ peek?: boolean | undefined;
454
+ }) => number | undefined;
455
+ endPeek: () => void;
456
+ setGhost: (ghost: import("./sculpt").GhostMode) => void;
457
+ bookmarkStep: () => void;
458
+ keepStep: ({ brush }?: {
459
+ brush?: boolean | undefined;
460
+ }) => boolean;
461
+ stopPlayback: () => void;
462
+ togglePlayback: () => void;
463
+ fitTimelinePath: (reservedBottom: number) => void;
464
+ reopenTimeline: () => void;
465
+ saveTimelineFile: () => void;
466
+ activateBrush: (options?: Partial<import("../../engines/sculpt-engine").BrushSettings>) => void;
467
+ deactivateBrush: () => void;
468
+ toggleBrush: () => void;
469
+ updateBrushSettings: (patch: Partial<import("../../engines/sculpt-engine").BrushSettings>) => void;
470
+ useCurrentAsReference: () => void;
471
+ brushPointerDown: (e: PointerEvent, target: Element) => boolean;
472
+ brushPointerMove: (e: PointerEvent) => boolean;
473
+ brushPointerUp: (e?: PointerEvent) => boolean;
474
+ brushPointerLeave: () => void;
475
+ cancelStroke: () => boolean;
476
+ brushDab: (point?: import("../../model/types").Point) => import("../../engines/sculpt-engine").DabResult;
477
+ clearHolds: () => void;
478
+ sculptUndo: () => boolean;
479
+ sculptKey: (e: KeyboardEvent) => boolean;
480
+ sculptBlur: () => void;
481
+ sculptBeforeUnload: () => void;
482
+ hasArchivedTimeline: import("solid-js").Accessor<boolean>;
483
+ setComparisonCloser: (fn: () => void) => () => void;
484
+ } & {
485
+ isDragging: () => boolean;
486
+ cancelGesture: () => void;
487
+ resetModifiers: () => void;
488
+ onWheel: (e: WheelEvent) => void;
489
+ onPointerDown: (e: PointerEvent) => void;
490
+ onPointerMove: (e: PointerEvent) => void;
491
+ onPointerUp: (e: PointerEvent | null) => void;
492
+ onDoubleClick: (e: MouseEvent) => void;
493
+ selectForContextMenu: (e: MouseEvent) => void;
494
+ dragKind: () => string | undefined;
495
+ };
496
+ export type DiagramSession = ReturnType<typeof createDiagramSession>;
@@ -0,0 +1,79 @@
1
+ import { type LayoutOptions, type LayoutReport, type LayoutScope } from '../../engines/layout-engine.js';
2
+ import { type ShapeChange } from '../../dsl/layout-edits';
3
+ import type { Diagram, LayoutAlgorithmId, RoutingSettings } from '../../model/types';
4
+ import type { DocumentPart } from './document';
5
+ import type { FileSessionPart } from './file-session';
6
+ import type { EditorPart } from './editor';
7
+ import type { ScenePart } from './scene';
8
+ export type LabScope = 'auto' | LayoutScope;
9
+ export interface LayoutPreview {
10
+ before: string;
11
+ mode: 'pass' | 'rebuild';
12
+ /** Objects a bounded pass moved; a rebuild's preview is a new drawing, so it has no count. */
13
+ moved?: number;
14
+ /** In a diagram file: the source that Keep saves, the line it changes, what it says once saved. */
15
+ file?: {
16
+ source: string;
17
+ label: string;
18
+ message: string;
19
+ line: string | null;
20
+ removed: number;
21
+ /** The direction and format asked for so far. A further choice builds on them. */
22
+ shape?: ShapeChange;
23
+ /** The connection preset asked for, which Keep saves with the shape. */
24
+ routing?: RoutingSettings;
25
+ };
26
+ }
27
+ export interface RunLayoutOptions extends LayoutOptions {
28
+ preview?: boolean;
29
+ fit?: boolean;
30
+ }
31
+ export type LayoutOutcome = {
32
+ status: 'busy' | 'cancelled';
33
+ }
34
+ /** A diagram file's layout recipe was previewed or saved. */
35
+ | {
36
+ status: 'recipe' | 'recipe-preview';
37
+ source: string;
38
+ } | {
39
+ status: 'error';
40
+ message: string;
41
+ } | ({
42
+ status: 'complete' | 'preview';
43
+ } & LayoutReport);
44
+ export declare function createLayout(s: DocumentPart & FileSessionPart & EditorPart & ScenePart): {
45
+ layoutBusy: import("solid-js").Accessor<boolean>;
46
+ layoutReport: import("solid-js").Accessor<LayoutReport | null>;
47
+ setLayoutReport: import("solid-js").Setter<LayoutReport | null>;
48
+ layoutPreview: import("solid-js").Accessor<LayoutPreview | null>;
49
+ labScope: import("solid-js").Accessor<LabScope>;
50
+ setLabScope: import("solid-js").Setter<LabScope>;
51
+ labEngine: import("solid-js").Accessor<LayoutAlgorithmId | null>;
52
+ setLabEngine: import("solid-js").Setter<LayoutAlgorithmId | null>;
53
+ layoutCheckpoint: import("solid-js").Accessor<Diagram | null>;
54
+ currentScope: () => {
55
+ scope: LayoutScope;
56
+ containerId?: string;
57
+ };
58
+ layoutTarget: () => "the whole diagram" | "the selection and its neighbours" | "this group" | "the selection";
59
+ setFixedIdsProvider: (provider: () => string[]) => () => string[];
60
+ fixedIds: () => string[];
61
+ cancelLayout: () => void;
62
+ runLayout: (options?: RunLayoutOptions) => Promise<LayoutOutcome>;
63
+ runLabLayout: (mode?: "pass" | "rebuild", preview?: boolean, settings?: LayoutOptions) => Promise<LayoutOutcome>;
64
+ previewSettings: (patch: Partial<Pick<LayoutOptions, "direction" | "aspect">>) => Promise<void>;
65
+ arrangeScope: () => string | null;
66
+ movesBlocked: () => string | null;
67
+ rebuildBlocked: () => string | null;
68
+ routesBlocked: () => string | null;
69
+ previewShape: (change: ShapeChange) => Promise<LayoutOutcome>;
70
+ previewRouting: (routing: RoutingSettings) => Promise<LayoutOutcome>;
71
+ acceptPreview: () => void;
72
+ discardPreview: () => void;
73
+ holdPreviewBefore: (held: boolean) => void;
74
+ updateLayoutSettings: (patch: Partial<Diagram["settings"]>) => void;
75
+ captureCheckpoint: () => void;
76
+ setDocumentOpener: (open: (doc: Diagram, label: string) => void) => (doc: Diagram, label: string) => void;
77
+ restoreCheckpoint: () => void;
78
+ };
79
+ export type LayoutPart = ReturnType<typeof createLayout>;
@@ -0,0 +1,19 @@
1
+ import type { EditorPart } from './editor';
2
+ import type { DocumentPart } from './document';
3
+ import type { ScenePart } from './scene';
4
+ import type { SculptPart } from './sculpt';
5
+ import type { ActionsPart } from './actions';
6
+ import type { LayoutPart } from './layout';
7
+ export declare function createPointer(s: EditorPart & DocumentPart & ScenePart & SculptPart & ActionsPart & LayoutPart): {
8
+ isDragging: () => boolean;
9
+ cancelGesture: () => void;
10
+ resetModifiers: () => void;
11
+ onWheel: (e: WheelEvent) => void;
12
+ onPointerDown: (e: PointerEvent) => void;
13
+ onPointerMove: (e: PointerEvent) => void;
14
+ onPointerUp: (e: PointerEvent | null) => void;
15
+ onDoubleClick: (e: MouseEvent) => void;
16
+ selectForContextMenu: (e: MouseEvent) => void;
17
+ dragKind: () => string | undefined;
18
+ };
19
+ export type PointerPart = ReturnType<typeof createPointer>;
@@ -0,0 +1,20 @@
1
+ import type { RoutingSettings } from '../../model/types';
2
+ import type { DocumentPart } from './document';
3
+ import type { FileSessionPart } from './file-session';
4
+ import type { LayoutPart } from './layout';
5
+ import type { ScenePart } from './scene';
6
+ export declare const ROUTE_PRESETS: {
7
+ Balanced: {};
8
+ 'Fewer crossings': {
9
+ crossingPenalty: number;
10
+ sharedPenalty: number;
11
+ portStability: number;
12
+ };
13
+ };
14
+ export type RoutePreset = keyof typeof ROUTE_PRESETS;
15
+ export declare function createRouting(s: DocumentPart & FileSessionPart & LayoutPart & ScenePart): {
16
+ setRouting: (patch: Partial<RoutingSettings>, label: string) => void;
17
+ applyRoutePreset: (preset: RoutePreset) => void;
18
+ activeRoutePreset: () => "Balanced" | "Fewer crossings" | null;
19
+ };
20
+ export type RoutingPart = ReturnType<typeof createRouting>;