@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,144 @@
1
+ import type { PriorRoute, RoutingResult } from '../../engines/routing-engine.js';
2
+ import { type VisibleGraph } from '../../model/graph';
3
+ import { type DrawnRoute } from '../../model/routes';
4
+ import type { NodeGeometry, NodeLayout, Rect } from '../../model/types';
5
+ import type { DocumentPart } from './document';
6
+ import type { FileSessionPart } from './file-session';
7
+ export declare function createScene(s: DocumentPart & FileSessionPart): {
8
+ sculptGeometry: import("solid-js").Accessor<NodeGeometry | null>;
9
+ setSculptGeometry: import("solid-js").Setter<NodeGeometry | null>;
10
+ animationGeometry: import("solid-js").Accessor<NodeGeometry | null>;
11
+ setAnimationGeometry: import("solid-js").Setter<NodeGeometry | null>;
12
+ setQuickRouting: import("solid-js").Setter<boolean>;
13
+ routePrior: import("solid-js").Accessor<PriorRoute[] | null>;
14
+ setRoutePrior: import("solid-js").Setter<PriorRoute[] | null>;
15
+ setAdoptedRoutes: import("solid-js").Setter<{
16
+ fingerprint: string;
17
+ result: RoutingResult;
18
+ } | null>;
19
+ geometry: (id: string) => NodeLayout;
20
+ visibleScene: import("solid-js").Accessor<VisibleGraph>;
21
+ nodeIds: import("solid-js").Accessor<string[]>;
22
+ groupIds: import("solid-js").Accessor<string[]>;
23
+ edgeIds: import("solid-js").Accessor<string[]>;
24
+ sceneRects: import("solid-js").Accessor<Map<string, Rect>>;
25
+ routing: import("solid-js").Accessor<import("../../model/routes").SceneRoutes>;
26
+ routesById: import("solid-js").Accessor<Map<string, DrawnRoute>>;
27
+ routeIds: import("solid-js").Accessor<string[]>;
28
+ routesPending: () => boolean;
29
+ resetRoutes: () => void;
30
+ routeInputFor: () => {
31
+ nodes: ({
32
+ shape: import("../../model/types").ShapeKind;
33
+ x: number;
34
+ y: number;
35
+ w: number;
36
+ h: number;
37
+ id: string;
38
+ title: string;
39
+ was?: string;
40
+ wasShape?: import("../../model/types").ShapeKind;
41
+ wasCount?: number | string;
42
+ href?: string;
43
+ count?: number | string;
44
+ span?: number | "var";
45
+ parentId?: string;
46
+ image?: string;
47
+ lifeline?: number;
48
+ } | {
49
+ parentId?: string | undefined;
50
+ frame?: boolean | undefined;
51
+ shape: import("../../model/types").ShapeKind;
52
+ x: number;
53
+ y: number;
54
+ w: number;
55
+ h: number;
56
+ id: string;
57
+ title: string;
58
+ })[];
59
+ groups: {
60
+ titleHeight?: number | undefined;
61
+ collapsed: boolean;
62
+ titleWidth: number;
63
+ x: number;
64
+ y: number;
65
+ w: number;
66
+ h: number;
67
+ id: string;
68
+ title: string;
69
+ was?: string;
70
+ href?: string;
71
+ parentId?: string;
72
+ frame?: "soft" | "none";
73
+ titleLines?: number;
74
+ hull?: Rect[];
75
+ }[];
76
+ edges: {
77
+ from: string;
78
+ to: string;
79
+ cfg: import("../../model/types").EdgeLayout;
80
+ a: string;
81
+ b: string;
82
+ id: string;
83
+ label: string;
84
+ was?: string;
85
+ directed: boolean;
86
+ head?: import("../../model/markers.js").EndMarker;
87
+ tail?: import("../../model/markers.js").EndMarker;
88
+ emphasis: boolean;
89
+ dashed: boolean;
90
+ status?: import("../../model/status").Status;
91
+ spot?: import("../../model/status").Spot;
92
+ }[];
93
+ };
94
+ routes: () => DrawnRoute[];
95
+ routingReport: () => import("../../engines/routing-engine.js").RoutingReport;
96
+ blockedRouteIds: () => string[];
97
+ sceneBounds: () => Rect;
98
+ viewerFrame: () => {
99
+ x: number;
100
+ y: number;
101
+ w: number;
102
+ h: number;
103
+ natural: number;
104
+ head: {
105
+ w: number;
106
+ h: number;
107
+ };
108
+ key: {
109
+ w: number;
110
+ h: number;
111
+ row: number;
112
+ items: {
113
+ x: number;
114
+ y: number;
115
+ legend?: import("../../model/appearance").LegendEntry;
116
+ status?: import("../../model/status").StatusCount;
117
+ label: string;
118
+ }[];
119
+ };
120
+ heading: {
121
+ x: number;
122
+ y: number;
123
+ wrap: number;
124
+ };
125
+ legend: {
126
+ x: number;
127
+ y: number;
128
+ };
129
+ foot: {
130
+ x: number;
131
+ y: number;
132
+ type: import("../../model/fonts.js").TypeProfile;
133
+ gutter: number;
134
+ items: {
135
+ note: import("../../model/footnote.js").Footnote;
136
+ lines: import("../../model/rich-text.js").Run[][];
137
+ y: number;
138
+ }[];
139
+ h: number;
140
+ };
141
+ notes: import("../../model/note").PlacedNote[];
142
+ };
143
+ };
144
+ export type ScenePart = ReturnType<typeof createScene>;
@@ -0,0 +1,70 @@
1
+ import { type BrushSettings, type DabResult, type Timeline } from '../../engines/sculpt-engine.js';
2
+ import type { Point } from '../../model/types';
3
+ import type { DocumentPart } from './document';
4
+ import type { LayoutPart } from './layout';
5
+ import type { ActionsPart } from './actions';
6
+ import type { EditorPart } from './editor';
7
+ import type { ScenePart } from './scene';
8
+ export type GhostMode = 'next' | 'final' | 'off';
9
+ export interface TimelineState {
10
+ signature: string;
11
+ scope: string;
12
+ algorithm: string;
13
+ busy: boolean;
14
+ index: number;
15
+ peek: number | null;
16
+ ghost: GhostMode;
17
+ data: Timeline | null;
18
+ }
19
+ export declare function validateTimeline(input: unknown): Timeline;
20
+ export declare function createSculpt(s: DocumentPart & LayoutPart & ActionsPart & EditorPart & ScenePart): {
21
+ importTimeline: (input: unknown) => void;
22
+ timeline: import("solid-js").Accessor<TimelineState | null>;
23
+ playing: import("solid-js").Accessor<boolean>;
24
+ brushActive: import("solid-js").Accessor<boolean>;
25
+ brushSettings: import("solid-js").Accessor<BrushSettings>;
26
+ brushPoint: import("solid-js").Accessor<Point | null>;
27
+ brushHover: import("solid-js").Accessor<DabResult | null>;
28
+ stroking: import("solid-js").Accessor<boolean>;
29
+ restoreKey: import("solid-js").Accessor<boolean>;
30
+ referenceLabel: import("solid-js").Accessor<string>;
31
+ timelineOpen: () => boolean;
32
+ sculptInteracting: () => boolean;
33
+ heldIds: () => string[];
34
+ restoreArchive: () => void;
35
+ openTimeline: (options?: Record<string, unknown>) => Promise<void>;
36
+ closeTimeline: () => void;
37
+ scrub: (index: number, { peek }?: {
38
+ peek?: boolean | undefined;
39
+ }) => number | undefined;
40
+ endPeek: () => void;
41
+ setGhost: (ghost: GhostMode) => void;
42
+ bookmarkStep: () => void;
43
+ keepStep: ({ brush }?: {
44
+ brush?: boolean | undefined;
45
+ }) => boolean;
46
+ stopPlayback: () => void;
47
+ togglePlayback: () => void;
48
+ fitTimelinePath: (reservedBottom: number) => void;
49
+ reopenTimeline: () => void;
50
+ saveTimelineFile: () => void;
51
+ activateBrush: (options?: Partial<BrushSettings>) => void;
52
+ deactivateBrush: () => void;
53
+ toggleBrush: () => void;
54
+ updateBrushSettings: (patch: Partial<BrushSettings>) => void;
55
+ useCurrentAsReference: () => void;
56
+ brushPointerDown: (e: PointerEvent, target: Element) => boolean;
57
+ brushPointerMove: (e: PointerEvent) => boolean;
58
+ brushPointerUp: (e?: PointerEvent) => boolean;
59
+ brushPointerLeave: () => void;
60
+ cancelStroke: () => boolean;
61
+ brushDab: (point?: Point) => DabResult;
62
+ clearHolds: () => void;
63
+ sculptUndo: () => boolean;
64
+ sculptKey: (e: KeyboardEvent) => boolean;
65
+ sculptBlur: () => void;
66
+ sculptBeforeUnload: () => void;
67
+ hasArchivedTimeline: import("solid-js").Accessor<boolean>;
68
+ setComparisonCloser: (fn: () => void) => () => void;
69
+ };
70
+ export type SculptPart = ReturnType<typeof createSculpt>;
@@ -0,0 +1,14 @@
1
+ /** A button on a toast, such as a way to take back what the message reports. */
2
+ export interface ToastAction {
3
+ label: string;
4
+ run: () => void;
5
+ }
6
+ export declare const toastMessage: import("solid-js").Accessor<{
7
+ text: string;
8
+ id: number;
9
+ action?: ToastAction;
10
+ } | null>;
11
+ /** Show a short status message at the bottom of the screen, with an optional button. */
12
+ export declare function toast(text: string, action?: ToastAction): void;
13
+ /** Hide the toast now. */
14
+ export declare function dismissToast(): void;
@@ -0,0 +1,3 @@
1
+ import type { WorkspaceInfo } from '../server/workspace';
2
+ /** The served folder, or null on the static site and in an embedded editor. */
3
+ export declare const workspace: import("solid-js").Accessor<WorkspaceInfo | null>, setWorkspace: import("solid-js").Setter<WorkspaceInfo | null>;
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "@draftably/editor",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "The Draftably diagram editor: drag boxes and lines, and get the .draft source back.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/types/src/editor/mount.d.ts",
14
+ "import": "./dist/index.js",
15
+ "default": "./dist/index.js"
16
+ },
17
+ "./element": {
18
+ "types": "./dist/types/src/editor/element.d.ts",
19
+ "import": "./dist/element.js",
20
+ "default": "./dist/element.js"
21
+ },
22
+ "./package.json": "./package.json"
23
+ },
24
+ "sideEffects": [
25
+ "./dist/element.js",
26
+ "./dist/index.js",
27
+ "./dist/chunks/*.js"
28
+ ],
29
+ "engines": {
30
+ "node": ">=22.21.0"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/byronwall/draftably.git",
35
+ "directory": "packages/editor"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public",
39
+ "registry": "https://registry.npmjs.org"
40
+ },
41
+ "scripts": {
42
+ "build": "node ../../scripts/build-editor.ts"
43
+ }
6
44
  }