@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,479 @@
1
+ import type { DiagramSession } from './session';
2
+ export declare function activeSession(): DiagramSession;
3
+ export declare const setActiveSession: (session: DiagramSession) => {
4
+ dispose: () => void;
5
+ } & {
6
+ selectedText: import("solid-js").Accessor<string | null>;
7
+ setSelectedText: import("solid-js").Setter<string | null>;
8
+ } & {
9
+ options: import("./session").SessionOptions;
10
+ doc: import("../model/types").Diagram;
11
+ setDoc: import("solid-js/store").SetStoreFunction<import("../model/types").Diagram>;
12
+ saveStatus: import("solid-js").Accessor<"saved" | "saving" | "preview" | "failed">;
13
+ undoStack: import("solid-js").Accessor<import("./session/document").HistoryEntry[]>;
14
+ redoStack: import("solid-js").Accessor<import("./session/document").HistoryEntry[]>;
15
+ revision: import("solid-js").Accessor<number>;
16
+ snapshotDoc: () => import("../model/types").Diagram;
17
+ snapshot: () => string;
18
+ selection: import("solid-js").Accessor<ReadonlySet<string>>;
19
+ selectedIds: () => string[];
20
+ isSelected: (id: string) => boolean;
21
+ singleSelection: () => string | undefined;
22
+ setSelection: (ids: Iterable<string>) => void;
23
+ selectItems: (ids: string[], { add, toggle }?: {
24
+ add?: boolean | undefined;
25
+ toggle?: boolean | undefined;
26
+ }) => void;
27
+ clearSelection: () => void;
28
+ selectText: (id: string) => void;
29
+ onBeforeEdit: (handler: () => void) => void;
30
+ prepareForEdit: () => void;
31
+ onSourceIdMap: (handler: (mapId: (id: string) => string) => void) => void;
32
+ mapSourceIds: (mapId: (id: string) => string) => void;
33
+ setCommitHandler: (handler: ((before: string, label: string, kind: import("./session/document").EditKind) => boolean) | null) => ((before: string, label: string, kind: import("./session/document").EditKind) => boolean) | null;
34
+ editsGoToFile: () => boolean;
35
+ commit: (before: string, label?: string, kind?: import("./session/document").EditKind) => boolean;
36
+ pushUndo: (entry: import("./session/document").HistoryEntry) => void;
37
+ annotateLastUndo: (holds: import("./session/document").HistoryEntry["holds"]) => void;
38
+ transact: (label: string, fn: (draft: import("../model/types").Diagram) => void, kind?: import("./session/document").EditKind) => boolean;
39
+ mutate: (fn: (draft: import("../model/types").Diagram) => void) => void;
40
+ restoreDocument: (next: import("../model/types").Diagram, { keepCamera }?: {
41
+ keepCamera?: boolean | undefined;
42
+ }) => void;
43
+ onHistoryStep: (handler: (entry: import("./session/document").HistoryEntry, direction: "undo" | "redo") => void) => void;
44
+ setHistoryHandler: (handler: import("./session/document").HistoryHandler | null) => import("./session/document").HistoryHandler | null;
45
+ undo: () => void;
46
+ redo: () => void;
47
+ canUndo: () => boolean;
48
+ canRedo: () => boolean;
49
+ setCamera: (camera: import("../model/types").Camera) => void;
50
+ disableBrowserStorage: () => boolean;
51
+ setPersistenceBlocked: (blocked: boolean) => void;
52
+ persist: () => void;
53
+ persistNow: () => void;
54
+ restoreSavedDocument: () => {
55
+ restored: boolean;
56
+ notice?: string;
57
+ };
58
+ watchOtherTabs: () => () => void;
59
+ } & {
60
+ openSource: (source: string, onChange?: (source: string) => void) => Promise<void>;
61
+ receiveSource: (source: string) => Promise<void>;
62
+ liveSource: import("solid-js").Accessor<string>;
63
+ sourceDraft: import("solid-js").Accessor<string | null>;
64
+ fileSession: import("solid-js").Accessor<import("./session/file-session").FileSessionInfo | null>;
65
+ fileMode: () => boolean;
66
+ exampleMode: () => boolean;
67
+ scratchName: () => "Draft" | "Example";
68
+ exampleEdited: () => boolean;
69
+ leaveAgreed: () => boolean;
70
+ agreeToLeave: () => undefined;
71
+ fileStatus: import("solid-js").Accessor<import("./session/file-session").FileStatus>;
72
+ sourceError: import("solid-js").Accessor<{
73
+ message: string;
74
+ line: number;
75
+ } | null>;
76
+ fileScene: import("solid-js").Accessor<import("../dsl/compile").Scene | null>;
77
+ fileDiagnostics: () => import("../dsl/compile").Diagnostic[];
78
+ conflictProposal: import("solid-js").Accessor<string | null>;
79
+ movedByChange: import("solid-js").Accessor<string[]>;
80
+ fileCompiling: import("solid-js").Accessor<boolean>;
81
+ exampleRestored: () => boolean;
82
+ currentSource: () => string;
83
+ setRouteSink: (sink: {
84
+ adopt: (routes: {
85
+ fingerprint: string;
86
+ result: import("../engines/routing-engine").RoutingResult;
87
+ }) => void;
88
+ quick: (on: boolean) => void;
89
+ awaiting: (on: boolean) => void;
90
+ }) => {
91
+ adopt: (routes: {
92
+ fingerprint: string;
93
+ result: import("../engines/routing-engine").RoutingResult;
94
+ }) => void;
95
+ quick: (on: boolean) => void;
96
+ awaiting: (on: boolean) => void;
97
+ };
98
+ showSource: (source: string, selection?: string[] | (() => string[]), mapId?: (id: string) => string) => Promise<import("../dsl/compile").Scene | null>;
99
+ keepDiskVersion: () => void;
100
+ saveProposalOverDisk: () => void;
101
+ retrySave: () => undefined;
102
+ typeSource: (next: string, burst: number) => Promise<null | undefined>;
103
+ commitSource: (next: string, label: string, message: string) => Promise<boolean>;
104
+ fileBlocked: () => string | null;
105
+ sourceWithRecipe: (scope: string, settings: import("../model/types").LayoutSettings, direction?: "right" | "down") => {
106
+ source: string;
107
+ removed: number;
108
+ };
109
+ sourceWithShape: (scope: string, change: import("../dsl/layout-edits").ShapeChange) => {
110
+ source: string;
111
+ removed: number;
112
+ };
113
+ changedLines: (source: string) => string[];
114
+ changedLine: (source: string) => string;
115
+ sourceWithRouting: (routing: import("../model/types").RoutingSettings, base?: string) => string;
116
+ projectSource: (source: string) => Promise<import("../model/types").Diagram>;
117
+ reflowSelectedGroup: (id: string) => void;
118
+ openFileSession: (file: string) => Promise<boolean>;
119
+ prefetchFile: (file: string) => Promise<void>;
120
+ settleSave: () => Promise<void>;
121
+ closeFileSession: () => void;
122
+ openExampleSession: (id: string, title: string, source: string, key?: string) => Promise<void>;
123
+ resetExample: () => void;
124
+ markExampleSaved: () => void;
125
+ fileStatusText: () => string;
126
+ } & {
127
+ sculptGeometry: import("solid-js").Accessor<import("./session/editor").NodeGeometry | null>;
128
+ setSculptGeometry: import("solid-js").Setter<import("./session/editor").NodeGeometry | null>;
129
+ animationGeometry: import("solid-js").Accessor<import("./session/editor").NodeGeometry | null>;
130
+ setAnimationGeometry: import("solid-js").Setter<import("./session/editor").NodeGeometry | null>;
131
+ setQuickRouting: import("solid-js").Setter<boolean>;
132
+ routePrior: import("solid-js").Accessor<import("../engines/routing-engine").PriorRoute[] | null>;
133
+ setRoutePrior: import("solid-js").Setter<import("../engines/routing-engine").PriorRoute[] | null>;
134
+ setAdoptedRoutes: import("solid-js").Setter<{
135
+ fingerprint: string;
136
+ result: import("../engines/routing-engine").RoutingResult;
137
+ } | null>;
138
+ geometry: (id: string) => import("../model/types").NodeLayout;
139
+ visibleScene: import("solid-js").Accessor<import("../model/graph").VisibleGraph>;
140
+ nodeIds: import("solid-js").Accessor<string[]>;
141
+ groupIds: import("solid-js").Accessor<string[]>;
142
+ edgeIds: import("solid-js").Accessor<string[]>;
143
+ sceneRects: import("solid-js").Accessor<Map<string, import("../model/types").Rect>>;
144
+ routing: import("solid-js").Accessor<import("../model/routes").SceneRoutes>;
145
+ routesById: import("solid-js").Accessor<Map<string, import("../model/routes").DrawnRoute>>;
146
+ routeIds: import("solid-js").Accessor<string[]>;
147
+ routesPending: () => boolean;
148
+ resetRoutes: () => void;
149
+ routeInputFor: () => {
150
+ nodes: ({
151
+ shape: import("../model/types").ShapeKind;
152
+ x: number;
153
+ y: number;
154
+ w: number;
155
+ h: number;
156
+ id: string;
157
+ title: string;
158
+ was?: string;
159
+ wasShape?: import("../model/types").ShapeKind;
160
+ wasCount?: number | string;
161
+ href?: string;
162
+ count?: number | string;
163
+ span?: number | "var";
164
+ parentId?: string;
165
+ image?: string;
166
+ lifeline?: number;
167
+ } | {
168
+ parentId?: string | undefined;
169
+ frame?: boolean | undefined;
170
+ shape: import("../model/types").ShapeKind;
171
+ x: number;
172
+ y: number;
173
+ w: number;
174
+ h: number;
175
+ id: string;
176
+ title: string;
177
+ })[];
178
+ groups: {
179
+ titleHeight?: number | undefined;
180
+ collapsed: boolean;
181
+ titleWidth: number;
182
+ x: number;
183
+ y: number;
184
+ w: number;
185
+ h: number;
186
+ id: string;
187
+ title: string;
188
+ was?: string;
189
+ href?: string;
190
+ parentId?: string;
191
+ frame?: "soft" | "none";
192
+ titleLines?: number;
193
+ hull?: import("../model/types").Rect[];
194
+ }[];
195
+ edges: {
196
+ from: string;
197
+ to: string;
198
+ cfg: import("../model/types").EdgeLayout;
199
+ a: string;
200
+ b: string;
201
+ id: string;
202
+ label: string;
203
+ was?: string;
204
+ directed: boolean;
205
+ head?: import("../model/markers").EndMarker;
206
+ tail?: import("../model/markers").EndMarker;
207
+ emphasis: boolean;
208
+ dashed: boolean;
209
+ status?: import("../model/status").Status;
210
+ spot?: import("../model/status").Spot;
211
+ }[];
212
+ };
213
+ routes: () => import("../model/routes").DrawnRoute[];
214
+ routingReport: () => import("../engines/routing-engine").RoutingReport;
215
+ blockedRouteIds: () => string[];
216
+ sceneBounds: () => import("../model/types").Rect;
217
+ viewerFrame: () => {
218
+ x: number;
219
+ y: number;
220
+ w: number;
221
+ h: number;
222
+ natural: number;
223
+ head: {
224
+ w: number;
225
+ h: number;
226
+ };
227
+ key: {
228
+ w: number;
229
+ h: number;
230
+ row: number;
231
+ items: {
232
+ x: number;
233
+ y: number;
234
+ legend?: import("../model/appearance").LegendEntry;
235
+ status?: import("../model/status").StatusCount;
236
+ label: string;
237
+ }[];
238
+ };
239
+ heading: {
240
+ x: number;
241
+ y: number;
242
+ wrap: number;
243
+ };
244
+ legend: {
245
+ x: number;
246
+ y: number;
247
+ };
248
+ foot: {
249
+ x: number;
250
+ y: number;
251
+ type: import("../model/fonts").TypeProfile;
252
+ gutter: number;
253
+ items: {
254
+ note: import("../model/footnote").Footnote;
255
+ lines: import("../model/rich-text").Run[][];
256
+ y: number;
257
+ }[];
258
+ h: number;
259
+ };
260
+ notes: import("../model/note").PlacedNote[];
261
+ };
262
+ } & {
263
+ states: () => import("../model/appearance").EmphasisState[];
264
+ activeState: () => string | null;
265
+ gridOpen: import("solid-js").Accessor<boolean>;
266
+ setGridOpen: import("solid-js").Setter<boolean>;
267
+ showState: (id: string | null) => void;
268
+ stepState: (by: 1 | -1) => boolean;
269
+ drawnDoc: () => import("../model/types").Diagram;
270
+ } & {
271
+ tool: import("solid-js").Accessor<import("./session/editor").Tool>;
272
+ setToolSignal: import("solid-js").Setter<import("./session/editor").Tool>;
273
+ connectFrom: import("solid-js").Accessor<{
274
+ id: string;
275
+ side: import("../model/types").PortSide;
276
+ } | null>;
277
+ setConnectFrom: import("solid-js").Setter<{
278
+ id: string;
279
+ side: import("../model/types").PortSide;
280
+ } | null>;
281
+ pointer: import("solid-js").Accessor<import("../model/types").Point | null>;
282
+ setPointer: import("solid-js").Setter<import("../model/types").Point | null>;
283
+ drag: import("solid-js").Accessor<import("./session/editor").DragFeedback | null>;
284
+ setDrag: import("solid-js").Setter<import("./session/editor").DragFeedback | null>;
285
+ inlineEditId: import("solid-js").Accessor<string | null>;
286
+ setInlineEditId: import("solid-js").Setter<string | null>;
287
+ spaceHeld: import("solid-js").Accessor<boolean>;
288
+ setSpaceHeld: import("solid-js").Setter<boolean>;
289
+ measuredStageSize: import("solid-js").Accessor<{
290
+ width: number;
291
+ height: number;
292
+ }>;
293
+ setMeasuredStageSize: import("solid-js").Setter<{
294
+ width: number;
295
+ height: number;
296
+ }>;
297
+ reducedMotion: import("solid-js").Accessor<boolean>;
298
+ setReducedMotion: import("solid-js").Setter<boolean>;
299
+ registerCanvas: (el: SVGSVGElement) => SVGSVGElement;
300
+ canvasElement: () => SVGSVGElement | undefined;
301
+ focusCanvas: () => void | undefined;
302
+ stageSize: () => {
303
+ width: number;
304
+ height: number;
305
+ };
306
+ screenToWorld: (clientX: number, clientY: number) => import("../model/types").Point;
307
+ canvasCenter: () => import("../model/types").Point;
308
+ zoomAt: (factor: number, clientX?: number, clientY?: number) => void;
309
+ panBy: (dx: number, dy: number) => void;
310
+ setStageSize: (size: {
311
+ width: number;
312
+ height: number;
313
+ }) => void;
314
+ fitView: () => void;
315
+ diagramClipped: () => boolean;
316
+ fitRects: (rects: import("../model/types").Rect[], reservedBottom?: number) => void;
317
+ revealObject: (id: string) => void;
318
+ centerSelection: () => void;
319
+ } & {
320
+ layoutBusy: import("solid-js").Accessor<boolean>;
321
+ layoutReport: import("solid-js").Accessor<import("../engines/layout-engine").LayoutReport | null>;
322
+ setLayoutReport: import("solid-js").Setter<import("../engines/layout-engine").LayoutReport | null>;
323
+ layoutPreview: import("solid-js").Accessor<import("./session/layout").LayoutPreview | null>;
324
+ labScope: import("solid-js").Accessor<import("./session/layout").LabScope>;
325
+ setLabScope: import("solid-js").Setter<import("./session/layout").LabScope>;
326
+ labEngine: import("solid-js").Accessor<import("../model/types").LayoutAlgorithmId | null>;
327
+ setLabEngine: import("solid-js").Setter<import("../model/types").LayoutAlgorithmId | null>;
328
+ layoutCheckpoint: import("solid-js").Accessor<import("../model/types").Diagram | null>;
329
+ currentScope: () => {
330
+ scope: import("../engines/layout-engine").LayoutScope;
331
+ containerId?: string;
332
+ };
333
+ layoutTarget: () => "the whole diagram" | "the selection and its neighbours" | "this group" | "the selection";
334
+ setFixedIdsProvider: (provider: () => string[]) => () => string[];
335
+ fixedIds: () => string[];
336
+ cancelLayout: () => void;
337
+ runLayout: (options?: import("./session/layout").RunLayoutOptions) => Promise<import("./session/layout").LayoutOutcome>;
338
+ runLabLayout: (mode?: "pass" | "rebuild", preview?: boolean, settings?: import("../engines/layout-engine").LayoutOptions) => Promise<import("./session/layout").LayoutOutcome>;
339
+ previewSettings: (patch: Partial<Pick<import("../engines/layout-engine").LayoutOptions, "direction" | "aspect">>) => Promise<void>;
340
+ arrangeScope: () => string | null;
341
+ movesBlocked: () => string | null;
342
+ rebuildBlocked: () => string | null;
343
+ routesBlocked: () => string | null;
344
+ previewShape: (change: import("../dsl/layout-edits").ShapeChange) => Promise<import("./session/layout").LayoutOutcome>;
345
+ previewRouting: (routing: import("../model/types").RoutingSettings) => Promise<import("./session/layout").LayoutOutcome>;
346
+ acceptPreview: () => void;
347
+ discardPreview: () => void;
348
+ holdPreviewBefore: (held: boolean) => void;
349
+ updateLayoutSettings: (patch: Partial<import("../model/types").Diagram["settings"]>) => void;
350
+ captureCheckpoint: () => void;
351
+ setDocumentOpener: (open: (doc: import("../model/types").Diagram, label: string) => void) => (doc: import("../model/types").Diagram, label: string) => void;
352
+ restoreCheckpoint: () => void;
353
+ } & {
354
+ inlineDraft: import("solid-js").Accessor<string>;
355
+ setInlineDraft: import("solid-js").Setter<string>;
356
+ setToolInterceptor: (fn: (tool: import("./session/editor").Tool) => boolean) => (tool: import("./session/editor").Tool) => boolean;
357
+ setTool: (next: import("./session/editor").Tool) => void;
358
+ startInlineEdit: (id: string) => void;
359
+ finishInlineEdit: (save?: boolean) => void;
360
+ addNode: (partial?: import("../model/edits").NewNode, at?: import("../model/types").Point, edit?: boolean) => string;
361
+ addEdge: (partial: import("../model/edits").NewEdge) => string;
362
+ completeConnection: (targetId: string, side?: import("../model/types").Side | "auto") => void;
363
+ quickExtend: ({ side, sibling, at, from, }?: {
364
+ side?: import("../model/types").Side | null;
365
+ sibling?: boolean;
366
+ at?: import("../model/types").Point | null;
367
+ from?: string | null;
368
+ }) => string | undefined;
369
+ insertStep: (edgeId: string, at?: import("../model/types").Point | null) => string | undefined;
370
+ buildFromList: (lines: string[], options?: {
371
+ mode?: import("../model/edits").BuildMode;
372
+ title?: string;
373
+ source?: string | null;
374
+ parentId?: string | null;
375
+ }) => string[];
376
+ wrapSelection: () => string;
377
+ drawContainer: (rect: {
378
+ x: number;
379
+ y: number;
380
+ w: number;
381
+ h: number;
382
+ }) => void;
383
+ deleteSelection: (deep?: boolean) => void;
384
+ ungroupSelection: () => void;
385
+ togglePin: () => void;
386
+ clearManualMarkers: () => void;
387
+ alignSelection: (kind: import("../model/edits").AlignKind) => void;
388
+ nudgeSelection: (dx: number, dy: number) => boolean;
389
+ setColor: (color: import("../model/types").Diagram["styles"][string]["color"]) => void;
390
+ chooseTheme: (theme: import("../model/appearance").ThemeId) => void;
391
+ setAppearanceOverrides: (patch: Partial<import("../model/appearance").AppearanceOverrides>, label?: string) => void;
392
+ setShade: (shade: import("../model/appearance").Shade | undefined) => void;
393
+ fitSelectedContainer: () => void;
394
+ toggleCollapse: (id?: string | undefined) => void;
395
+ reverseSelectedEdge: () => void;
396
+ resetSelectedBends: () => void;
397
+ setLayoutIntent: (role: import("../model/types").IntentRole, id: string | null, placement?: import("../model/types").IntentPlacement) => void;
398
+ markSelectedAs: (role: import("../model/types").IntentRole) => void;
399
+ addWaypointAt: (edgeId: string, point?: import("../model/types").Point) => void;
400
+ removeWaypoint: (edgeId: string, index: number) => void;
401
+ reroute: ({ auto }?: {
402
+ auto?: boolean | undefined;
403
+ }) => void;
404
+ toggleTheme: () => void;
405
+ copySelection: () => import("../model/edits").ClipboardFragment | null;
406
+ hasClipboard: () => boolean;
407
+ pasteFragment: (part?: import("../model/edits").ClipboardFragment | null) => void;
408
+ duplicateSelection: () => void;
409
+ openDocument: (input: unknown, { fit, label }?: {
410
+ fit?: boolean | undefined;
411
+ label?: string | undefined;
412
+ }) => import("../model/types").Diagram;
413
+ newDocument: () => void;
414
+ openSample: (id: string) => import("../model/types").Diagram | undefined;
415
+ } & {
416
+ setRouting: (patch: Partial<import("../model/types").RoutingSettings>, label: string) => void;
417
+ applyRoutePreset: (preset: import("./session/routing").RoutePreset) => void;
418
+ activeRoutePreset: () => "Balanced" | "Fewer crossings" | null;
419
+ } & {
420
+ importTimeline: (input: unknown) => void;
421
+ timeline: import("solid-js").Accessor<import("./session/sculpt").TimelineState | null>;
422
+ playing: import("solid-js").Accessor<boolean>;
423
+ brushActive: import("solid-js").Accessor<boolean>;
424
+ brushSettings: import("solid-js").Accessor<import("../engines/sculpt-engine").BrushSettings>;
425
+ brushPoint: import("solid-js").Accessor<import("../model/types").Point | null>;
426
+ brushHover: import("solid-js").Accessor<import("../engines/sculpt-engine").DabResult | null>;
427
+ stroking: import("solid-js").Accessor<boolean>;
428
+ restoreKey: import("solid-js").Accessor<boolean>;
429
+ referenceLabel: import("solid-js").Accessor<string>;
430
+ timelineOpen: () => boolean;
431
+ sculptInteracting: () => boolean;
432
+ heldIds: () => string[];
433
+ restoreArchive: () => void;
434
+ openTimeline: (options?: Record<string, unknown>) => Promise<void>;
435
+ closeTimeline: () => void;
436
+ scrub: (index: number, { peek }?: {
437
+ peek?: boolean | undefined;
438
+ }) => number | undefined;
439
+ endPeek: () => void;
440
+ setGhost: (ghost: import("./session/sculpt").GhostMode) => void;
441
+ bookmarkStep: () => void;
442
+ keepStep: ({ brush }?: {
443
+ brush?: boolean | undefined;
444
+ }) => boolean;
445
+ stopPlayback: () => void;
446
+ togglePlayback: () => void;
447
+ fitTimelinePath: (reservedBottom: number) => void;
448
+ reopenTimeline: () => void;
449
+ saveTimelineFile: () => void;
450
+ activateBrush: (options?: Partial<import("../engines/sculpt-engine").BrushSettings>) => void;
451
+ deactivateBrush: () => void;
452
+ toggleBrush: () => void;
453
+ updateBrushSettings: (patch: Partial<import("../engines/sculpt-engine").BrushSettings>) => void;
454
+ useCurrentAsReference: () => void;
455
+ brushPointerDown: (e: PointerEvent, target: Element) => boolean;
456
+ brushPointerMove: (e: PointerEvent) => boolean;
457
+ brushPointerUp: (e?: PointerEvent) => boolean;
458
+ brushPointerLeave: () => void;
459
+ cancelStroke: () => boolean;
460
+ brushDab: (point?: import("../model/types").Point) => import("../engines/sculpt-engine").DabResult;
461
+ clearHolds: () => void;
462
+ sculptUndo: () => boolean;
463
+ sculptKey: (e: KeyboardEvent) => boolean;
464
+ sculptBlur: () => void;
465
+ sculptBeforeUnload: () => void;
466
+ hasArchivedTimeline: import("solid-js").Accessor<boolean>;
467
+ setComparisonCloser: (fn: () => void) => () => void;
468
+ } & {
469
+ isDragging: () => boolean;
470
+ cancelGesture: () => void;
471
+ resetModifiers: () => void;
472
+ onWheel: (e: WheelEvent) => void;
473
+ onPointerDown: (e: PointerEvent) => void;
474
+ onPointerMove: (e: PointerEvent) => void;
475
+ onPointerUp: (e: PointerEvent | null) => void;
476
+ onDoubleClick: (e: MouseEvent) => void;
477
+ selectForContextMenu: (e: MouseEvent) => void;
478
+ dragKind: () => string | undefined;
479
+ };
@@ -0,0 +1,169 @@
1
+ export interface Command {
2
+ label: string;
3
+ /** Shortcut shown in menus. */
4
+ keys?: string;
5
+ icon?: string;
6
+ /** What it does, in a sentence: shown in tooltips and the palette. */
7
+ hint?: string;
8
+ run: () => unknown;
9
+ /** Allowed while a timeline preview is open. */
10
+ duringTimeline?: boolean;
11
+ /** Exits the brush before running. */
12
+ endsBrush?: boolean;
13
+ enabled?: () => boolean;
14
+ /** Why this cannot work here, shown instead of running it. */
15
+ blocked?: () => string | null;
16
+ }
17
+ declare function undoCommand(): void;
18
+ declare function redoCommand(): void;
19
+ export declare const hasSelection: () => boolean;
20
+ export declare const canvasCommands: {
21
+ undo: {
22
+ hint: string;
23
+ label: string;
24
+ keys: string;
25
+ icon: string;
26
+ run: typeof undoCommand;
27
+ duringTimeline: true;
28
+ enabled: () => boolean;
29
+ };
30
+ redo: {
31
+ hint: string;
32
+ label: string;
33
+ keys: string;
34
+ icon: string;
35
+ run: typeof redoCommand;
36
+ enabled: () => boolean;
37
+ };
38
+ 'add-node': {
39
+ hint: string;
40
+ label: string;
41
+ keys: string;
42
+ icon: string;
43
+ run: () => void;
44
+ };
45
+ 'add-connected': {
46
+ hint: string;
47
+ label: string;
48
+ keys: string;
49
+ icon: string;
50
+ run: () => string | undefined;
51
+ };
52
+ duplicate: {
53
+ hint: string;
54
+ enabled: () => boolean;
55
+ label: string;
56
+ keys: string;
57
+ icon: string;
58
+ run: () => void;
59
+ };
60
+ group: {
61
+ hint: string;
62
+ enabled: () => boolean;
63
+ label: string;
64
+ keys: string;
65
+ icon: string;
66
+ run: () => string;
67
+ };
68
+ ungroup: {
69
+ hint: string;
70
+ enabled: () => boolean;
71
+ label: string;
72
+ keys: string;
73
+ run: () => void;
74
+ };
75
+ pin: {
76
+ hint: string;
77
+ enabled: () => boolean;
78
+ label: string;
79
+ keys: string;
80
+ icon: string;
81
+ run: () => void;
82
+ };
83
+ delete: {
84
+ hint: string;
85
+ label: string;
86
+ enabled: () => boolean;
87
+ keys: string;
88
+ icon: string;
89
+ run: () => void;
90
+ };
91
+ 'delete-deep': {
92
+ label: string;
93
+ keys: string;
94
+ run: () => void;
95
+ };
96
+ layout: {
97
+ hint: string;
98
+ label: string;
99
+ keys: string;
100
+ icon: string;
101
+ run: () => Promise<import("./session/layout").LayoutOutcome>;
102
+ blocked: () => string | null;
103
+ endsBrush: true;
104
+ };
105
+ 'layout-rebuild': {
106
+ hint: string;
107
+ label: string;
108
+ keys: string;
109
+ run: () => Promise<import("./session/layout").LayoutOutcome>;
110
+ blocked: () => string | null;
111
+ endsBrush: true;
112
+ };
113
+ 'layout-accept': {
114
+ label: string;
115
+ run: () => void;
116
+ };
117
+ 'layout-discard': {
118
+ label: string;
119
+ run: () => void;
120
+ };
121
+ reroute: {
122
+ hint: string;
123
+ label: string;
124
+ keys: string;
125
+ icon: string;
126
+ run: () => void;
127
+ };
128
+ 'auto-ports': {
129
+ hint: string;
130
+ label: string;
131
+ keys: string;
132
+ run: () => void;
133
+ };
134
+ fit: {
135
+ hint: string;
136
+ label: string;
137
+ keys: string;
138
+ icon: string;
139
+ run: () => void;
140
+ duringTimeline: true;
141
+ };
142
+ 'zoom-in': {
143
+ label: string;
144
+ keys: string;
145
+ icon: string;
146
+ run: () => void;
147
+ duringTimeline: true;
148
+ };
149
+ 'zoom-out': {
150
+ label: string;
151
+ keys: string;
152
+ icon: string;
153
+ run: () => void;
154
+ duringTimeline: true;
155
+ };
156
+ 'reset-camera': {
157
+ label: string;
158
+ keys: string;
159
+ run: () => void;
160
+ duringTimeline: true;
161
+ };
162
+ };
163
+ export type CanvasCommandId = keyof typeof canvasCommands;
164
+ /** Run `command` unless a timeline preview or its own check blocks it, reporting failures. */
165
+ export declare function runChecked(id: string, command: Command): undefined;
166
+ export declare const checkedEnabled: (command: Command) => boolean;
167
+ export declare const runCanvasCommand: (id: CanvasCommandId) => undefined;
168
+ export declare const canvasCommandEnabled: (id: CanvasCommandId) => boolean;
169
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Canvas shortcuts and shape copy and paste for the active session. The app runs its own keys
3
+ * around these in `keyboard.ts`; an embedded editor uses them as they are.
4
+ */
5
+ export declare const isEditable: (el: EventTarget | null) => boolean;
6
+ /**
7
+ * Run the canvas shortcut for `e`. True when the key was used, or belongs to a field, so the host
8
+ * should not act on it. `closeMenu` lets Escape close the host's open menu, before it clears the
9
+ * selection; it returns true when it closed one.
10
+ */
11
+ export declare function handleCanvasKey(e: KeyboardEvent, closeMenu?: () => boolean): boolean;
12
+ export declare function handleKeyUp(e: KeyboardEvent): void;
13
+ export declare function copyShapes(e: ClipboardEvent): void;
14
+ /** Paste copied shapes: from the clipboard text, or the session's own copy when it is empty. */
15
+ export declare function pasteShapes(e: ClipboardEvent): void;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The lower-case key for a shortcut. With Alt (Option on a Mac) the typed character changes,
3
+ * e.g. Option+L types "¬", so letter and digit shortcuts use the physical key instead.
4
+ */
5
+ export declare function shortcutKey(e: KeyboardEvent): string;