@zsherman/canvas 0.0.0-stage → 0.1.1

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 (196) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/LICENSE +373 -0
  3. package/README.md +15 -2
  4. package/THIRD_PARTY_NOTICES.md +117 -0
  5. package/dist/dom/canvas/assets.js +89 -0
  6. package/dist/dom/canvas/board-store.js +56 -0
  7. package/dist/dom/canvas/canvas-actions.js +78 -0
  8. package/dist/dom/canvas/canvas-board.js +557 -0
  9. package/dist/dom/canvas/canvas-board.styles.js +110 -0
  10. package/dist/dom/canvas/canvas-chrome.js +1167 -0
  11. package/dist/dom/canvas/canvas-chrome.styles.js +220 -0
  12. package/dist/dom/canvas/canvas-comments.js +950 -0
  13. package/dist/dom/canvas/canvas-comments.styles.js +231 -0
  14. package/dist/dom/canvas/canvas-context.js +196 -0
  15. package/dist/dom/canvas/canvas-controller.js +697 -0
  16. package/dist/dom/canvas/canvas-cursor-chat.js +120 -0
  17. package/dist/dom/canvas/canvas-cursor-chat.styles.js +55 -0
  18. package/dist/dom/canvas/canvas-menus.js +276 -0
  19. package/dist/dom/canvas/canvas-menus.styles.js +7 -0
  20. package/dist/dom/canvas/canvas-style-bar.js +930 -0
  21. package/dist/dom/canvas/canvas-style-bar.styles.js +52 -0
  22. package/dist/dom/canvas/canvas-surface.js +1354 -0
  23. package/dist/dom/canvas/canvas-surface.styles.js +345 -0
  24. package/dist/dom/canvas/canvas-tool-rail.js +406 -0
  25. package/dist/dom/canvas/canvas-tool-rail.styles.js +20 -0
  26. package/dist/dom/canvas/comments.js +58 -0
  27. package/dist/dom/canvas/equality.js +13 -0
  28. package/dist/dom/canvas/export-png.js +496 -0
  29. package/dist/dom/canvas/gesture-machine.js +91 -0
  30. package/dist/dom/canvas/handlers.js +18 -0
  31. package/dist/dom/canvas/index.js +9 -0
  32. package/dist/dom/canvas/input.js +85 -0
  33. package/dist/dom/canvas/instant.js +28 -0
  34. package/dist/dom/canvas/kernel.js +39 -0
  35. package/dist/dom/canvas/motion.js +686 -0
  36. package/dist/dom/canvas/palette.js +165 -0
  37. package/dist/dom/canvas/random-id.js +15 -0
  38. package/dist/dom/canvas/scene-renderer.js +559 -0
  39. package/dist/dom/canvas/scene.styles.js +7 -0
  40. package/dist/dom/canvas/surface-model.js +324 -0
  41. package/dist/dom/canvas/uploads.js +294 -0
  42. package/dist/dom/index.js +9 -0
  43. package/dist/dom/kernel/actions.js +455 -0
  44. package/dist/dom/kernel/board.js +856 -0
  45. package/dist/dom/kernel/claims.js +40 -0
  46. package/dist/dom/kernel/clipboard.js +30 -0
  47. package/dist/dom/kernel/constants.js +210 -0
  48. package/dist/dom/kernel/contract.js +0 -0
  49. package/dist/dom/kernel/decode.js +85 -0
  50. package/dist/dom/kernel/editor.js +2077 -0
  51. package/dist/dom/kernel/errors.js +82 -0
  52. package/dist/dom/kernel/fonts/inter.js +7924 -0
  53. package/dist/dom/kernel/fractional-index.js +54 -0
  54. package/dist/dom/kernel/geometry.js +123 -0
  55. package/dist/dom/kernel/hit-test.js +156 -0
  56. package/dist/dom/kernel/index.js +22 -0
  57. package/dist/dom/kernel/inspect.js +116 -0
  58. package/dist/dom/kernel/kernel.js +251 -0
  59. package/dist/dom/kernel/outline.js +64 -0
  60. package/dist/dom/kernel/plan.js +1370 -0
  61. package/dist/dom/kernel/rev.js +173 -0
  62. package/dist/dom/kernel/scene.js +580 -0
  63. package/dist/dom/kernel/schema.js +1109 -0
  64. package/dist/dom/kernel/snap.js +258 -0
  65. package/dist/dom/kernel/svg.js +148 -0
  66. package/dist/dom/kernel/text.js +142 -0
  67. package/dist/solid/canvas/assets.jsx +89 -0
  68. package/dist/solid/canvas/board-store.jsx +56 -0
  69. package/dist/solid/canvas/canvas-actions.jsx +78 -0
  70. package/dist/solid/canvas/canvas-board.jsx +326 -0
  71. package/dist/solid/canvas/canvas-board.styles.jsx +110 -0
  72. package/dist/solid/canvas/canvas-chrome.jsx +612 -0
  73. package/dist/solid/canvas/canvas-chrome.styles.jsx +220 -0
  74. package/dist/solid/canvas/canvas-comments.jsx +435 -0
  75. package/dist/solid/canvas/canvas-comments.styles.jsx +231 -0
  76. package/dist/solid/canvas/canvas-context.jsx +174 -0
  77. package/dist/solid/canvas/canvas-controller.jsx +697 -0
  78. package/dist/solid/canvas/canvas-cursor-chat.jsx +87 -0
  79. package/dist/solid/canvas/canvas-cursor-chat.styles.jsx +55 -0
  80. package/dist/solid/canvas/canvas-menus.jsx +223 -0
  81. package/dist/solid/canvas/canvas-menus.styles.jsx +7 -0
  82. package/dist/solid/canvas/canvas-style-bar.jsx +486 -0
  83. package/dist/solid/canvas/canvas-style-bar.styles.jsx +52 -0
  84. package/dist/solid/canvas/canvas-surface.jsx +681 -0
  85. package/dist/solid/canvas/canvas-surface.styles.jsx +345 -0
  86. package/dist/solid/canvas/canvas-tool-rail.jsx +195 -0
  87. package/dist/solid/canvas/canvas-tool-rail.styles.jsx +20 -0
  88. package/dist/solid/canvas/comments.jsx +58 -0
  89. package/dist/solid/canvas/equality.jsx +13 -0
  90. package/dist/solid/canvas/export-png.jsx +496 -0
  91. package/dist/solid/canvas/gesture-machine.jsx +91 -0
  92. package/dist/solid/canvas/handlers.jsx +18 -0
  93. package/dist/solid/canvas/index.jsx +9 -0
  94. package/dist/solid/canvas/input.jsx +85 -0
  95. package/dist/solid/canvas/instant.jsx +28 -0
  96. package/dist/solid/canvas/kernel.jsx +39 -0
  97. package/dist/solid/canvas/motion.jsx +686 -0
  98. package/dist/solid/canvas/palette.jsx +165 -0
  99. package/dist/solid/canvas/random-id.jsx +15 -0
  100. package/dist/solid/canvas/scene-renderer.jsx +559 -0
  101. package/dist/solid/canvas/scene.styles.jsx +7 -0
  102. package/dist/solid/canvas/surface-model.jsx +324 -0
  103. package/dist/solid/canvas/uploads.jsx +294 -0
  104. package/dist/solid/index.jsx +9 -0
  105. package/dist/solid/kernel/actions.jsx +455 -0
  106. package/dist/solid/kernel/board.jsx +856 -0
  107. package/dist/solid/kernel/claims.jsx +40 -0
  108. package/dist/solid/kernel/clipboard.jsx +30 -0
  109. package/dist/solid/kernel/constants.jsx +210 -0
  110. package/dist/solid/kernel/contract.jsx +0 -0
  111. package/dist/solid/kernel/decode.jsx +85 -0
  112. package/dist/solid/kernel/editor.jsx +2077 -0
  113. package/dist/solid/kernel/errors.jsx +82 -0
  114. package/dist/solid/kernel/fonts/inter.jsx +7924 -0
  115. package/dist/solid/kernel/fractional-index.jsx +54 -0
  116. package/dist/solid/kernel/geometry.jsx +123 -0
  117. package/dist/solid/kernel/hit-test.jsx +156 -0
  118. package/dist/solid/kernel/index.jsx +22 -0
  119. package/dist/solid/kernel/inspect.jsx +116 -0
  120. package/dist/solid/kernel/kernel.jsx +251 -0
  121. package/dist/solid/kernel/outline.jsx +64 -0
  122. package/dist/solid/kernel/plan.jsx +1370 -0
  123. package/dist/solid/kernel/rev.jsx +173 -0
  124. package/dist/solid/kernel/scene.jsx +580 -0
  125. package/dist/solid/kernel/schema.jsx +1109 -0
  126. package/dist/solid/kernel/snap.jsx +258 -0
  127. package/dist/solid/kernel/svg.jsx +148 -0
  128. package/dist/solid/kernel/text.jsx +142 -0
  129. package/dist/styles.css +1 -0
  130. package/dist/types/canvas/assets.d.ts +111 -0
  131. package/dist/types/canvas/board-store.d.ts +86 -0
  132. package/dist/types/canvas/canvas-actions.d.ts +21 -0
  133. package/dist/types/canvas/canvas-board.d.ts +53 -0
  134. package/dist/types/canvas/canvas-board.styles.d.ts +94 -0
  135. package/dist/types/canvas/canvas-chrome.d.ts +109 -0
  136. package/dist/types/canvas/canvas-chrome.styles.d.ts +193 -0
  137. package/dist/types/canvas/canvas-comments.d.ts +20 -0
  138. package/dist/types/canvas/canvas-comments.styles.d.ts +208 -0
  139. package/dist/types/canvas/canvas-context.d.ts +104 -0
  140. package/dist/types/canvas/canvas-controller.d.ts +159 -0
  141. package/dist/types/canvas/canvas-cursor-chat.d.ts +13 -0
  142. package/dist/types/canvas/canvas-cursor-chat.styles.d.ts +54 -0
  143. package/dist/types/canvas/canvas-menus.d.ts +21 -0
  144. package/dist/types/canvas/canvas-menus.styles.d.ts +6 -0
  145. package/dist/types/canvas/canvas-style-bar.d.ts +19 -0
  146. package/dist/types/canvas/canvas-style-bar.styles.d.ts +43 -0
  147. package/dist/types/canvas/canvas-surface.d.ts +15 -0
  148. package/dist/types/canvas/canvas-surface.styles.d.ts +313 -0
  149. package/dist/types/canvas/canvas-tool-rail.d.ts +41 -0
  150. package/dist/types/canvas/canvas-tool-rail.styles.d.ts +15 -0
  151. package/dist/types/canvas/comments.d.ts +106 -0
  152. package/dist/types/canvas/equality.d.ts +4 -0
  153. package/dist/types/canvas/export-png.d.ts +77 -0
  154. package/dist/types/canvas/gesture-machine.d.ts +46 -0
  155. package/dist/types/canvas/handlers.d.ts +7 -0
  156. package/dist/types/canvas/index.d.ts +18 -0
  157. package/dist/types/canvas/input.d.ts +63 -0
  158. package/dist/types/canvas/instant.d.ts +13 -0
  159. package/dist/types/canvas/kernel.d.ts +27 -0
  160. package/dist/types/canvas/motion.d.ts +72 -0
  161. package/dist/types/canvas/palette.d.ts +46 -0
  162. package/dist/types/canvas/random-id.d.ts +6 -0
  163. package/dist/types/canvas/scene-renderer.d.ts +27 -0
  164. package/dist/types/canvas/scene.styles.d.ts +4 -0
  165. package/dist/types/canvas/surface-model.d.ts +113 -0
  166. package/dist/types/canvas/uploads.d.ts +58 -0
  167. package/dist/types/index.d.ts +1 -0
  168. package/dist/types/kernel/actions.d.ts +19 -0
  169. package/dist/types/kernel/board.d.ts +137 -0
  170. package/dist/types/kernel/claims.d.ts +29 -0
  171. package/dist/types/kernel/clipboard.d.ts +10 -0
  172. package/dist/types/kernel/constants.d.ts +195 -0
  173. package/dist/types/kernel/contract.d.ts +1533 -0
  174. package/dist/types/kernel/decode.d.ts +60 -0
  175. package/dist/types/kernel/editor.d.ts +12 -0
  176. package/dist/types/kernel/errors.d.ts +11 -0
  177. package/dist/types/kernel/fractional-index.d.ts +7 -0
  178. package/dist/types/kernel/geometry.d.ts +42 -0
  179. package/dist/types/kernel/hit-test.d.ts +16 -0
  180. package/dist/types/kernel/index.d.ts +8 -0
  181. package/dist/types/kernel/inspect.d.ts +6 -0
  182. package/dist/types/kernel/kernel.d.ts +6 -0
  183. package/dist/types/kernel/outline.d.ts +4 -0
  184. package/dist/types/kernel/plan.d.ts +20 -0
  185. package/dist/types/kernel/rev.d.ts +21 -0
  186. package/dist/types/kernel/scene.d.ts +16 -0
  187. package/dist/types/kernel/schema.d.ts +3436 -0
  188. package/dist/types/kernel/snap.d.ts +41 -0
  189. package/dist/types/kernel/svg.d.ts +3 -0
  190. package/dist/types/kernel/text.d.ts +21 -0
  191. package/docs/api.json +207 -0
  192. package/docs/canvas.md +444 -0
  193. package/docs/kernel.md +108 -0
  194. package/docs/llms.txt +41 -0
  195. package/docs/search-index.json +52 -0
  196. package/package.json +60 -4
@@ -0,0 +1,159 @@
1
+ import type { ActionIdJson, ActionJson, BoardJson, ClipboardDataJson, ClipboardJson, CommandErrorJson, EditorActionJson, EditorInputJson, EditorStateJson, InsetJson, PointerStyleJson, PointJson, PresenceJson, ViewportJson } from "../kernel/index.js";
2
+ import type { CanvasBoardStore } from "./board-store.js";
3
+ import { type CanvasKernel } from "./kernel.js";
4
+ /** What the chrome and the surface read; a new object after every change. */
5
+ type CanvasSnapshot = {
6
+ readonly board: BoardJson;
7
+ /** The host takes comments, so the comment tool shows. */
8
+ readonly comments: boolean;
9
+ readonly state: EditorStateJson;
10
+ /** Everyone else on the board. */
11
+ readonly presence: readonly PresenceJson[];
12
+ readonly cursor: PointerStyleJson;
13
+ /** The latest sentence for the live region; `id` changes on every one. */
14
+ readonly announcement: {
15
+ readonly id: number;
16
+ readonly text: string;
17
+ } | null;
18
+ /** The latest change the board could not make, to show; `id` changes on every one. */
19
+ readonly problem: {
20
+ readonly id: number;
21
+ readonly text: string;
22
+ } | null;
23
+ /** Transactions the store has not yet confirmed or refused. */
24
+ readonly pending: number;
25
+ /**
26
+ * Text the viewer typed into a shape someone else claimed first, which was
27
+ * not saved; `id` changes on every one. Offer it back, such as to copy.
28
+ */
29
+ readonly unsaved: {
30
+ readonly id: number;
31
+ /** The board item the text was typed into. */
32
+ readonly target: string;
33
+ readonly text: string;
34
+ } | null;
35
+ };
36
+ /**
37
+ * What the board draws this frame: the camera, which eases toward the
38
+ * editor's view, and everyone else's presence, smoothed between samples.
39
+ * A new object only when one of them moves.
40
+ */
41
+ type CanvasFrame = {
42
+ readonly view: ViewportJson;
43
+ readonly presence: readonly PresenceJson[];
44
+ };
45
+ /** Time and animation frames, so tests can drive the board with a fake clock. */
46
+ type CanvasClock = {
47
+ readonly now: () => number;
48
+ /** Calls back on the next animation frame with its time. */
49
+ readonly frame: (callback: (now: number) => void) => number;
50
+ readonly cancel: (handle: number) => void;
51
+ };
52
+ /** A change the board could not make, for a host's own reporting. */
53
+ type CanvasBoardError = {
54
+ readonly transaction: string;
55
+ /** The kernel's error, or null when the store refused without one. */
56
+ readonly error: CommandErrorJson | null;
57
+ /** What the viewer was told. */
58
+ readonly text: string;
59
+ };
60
+ type CanvasStep = {
61
+ readonly handled: boolean;
62
+ /** What a copy or cut put on the clipboard, for the event that asked. */
63
+ readonly clipboard: ClipboardDataJson | null;
64
+ };
65
+ type CanvasControllerOptions = {
66
+ readonly canvas: CanvasKernel;
67
+ readonly store: CanvasBoardStore;
68
+ readonly readOnly?: boolean;
69
+ /**
70
+ * The board point at the top left of the view, and the zoom. Left out, the
71
+ * board opens fitted to its content, at 100% at most, once its size is known.
72
+ */
73
+ readonly view?: {
74
+ readonly x: number;
75
+ readonly y: number;
76
+ readonly zoom: number;
77
+ };
78
+ /** Copy or cut outside a clipboard event, such as from a menu. */
79
+ readonly onClipboard?: (data: ClipboardDataJson) => void;
80
+ /** A change was refused, by the kernel or the store, after the viewer was told. */
81
+ readonly onError?: (error: CanvasBoardError) => void;
82
+ /** Defaults to `performance.now` and `requestAnimationFrame`. */
83
+ readonly clock?: CanvasClock;
84
+ /**
85
+ * The host takes comments, so the comment tool works. Without them its
86
+ * shortcut and action do nothing.
87
+ */
88
+ readonly comments?: boolean;
89
+ };
90
+ /** A click with the comment or timestamp tool: where, and on which shape. */
91
+ type CanvasPlace = Extract<EditorActionJson, {
92
+ _tag: "Place";
93
+ }>;
94
+ /**
95
+ * Runs the kernel's host loop for one viewer: inputs go through `editor`,
96
+ * transactions are planned, applied and handed to the store, and refusals
97
+ * roll back. The shown camera eases toward the editor's view, and other
98
+ * people's presence is smoothed between samples, on animation frames that
99
+ * run only while something moves.
100
+ */
101
+ declare function createCanvasController({ canvas, clock, comments: withComments, onClipboard, onError, readOnly, store, view: given, }: CanvasControllerOptions): {
102
+ /**
103
+ * Every action for a snapshot, asked of the kernel once however many
104
+ * menus and toolbars read it.
105
+ */
106
+ actions(of: CanvasSnapshot): ReadonlyMap<ActionIdJson, ActionJson>;
107
+ /** Sends an input from the person or the host, and redraws. */
108
+ dispatch(input: EditorInputJson): CanvasStep;
109
+ /**
110
+ * Shapes copied from a board, read from clipboard text; null for
111
+ * anything else. A board clipboard this board can't read says so.
112
+ */
113
+ readClipboard(text: string): ClipboardJson | null;
114
+ /** Shows and announces something the board could not do, such as a file it can't add. */
115
+ /** Says something to assistive technology only, such as why an upload failed. */
116
+ announce(text: string): void;
117
+ notify: (text: string) => void;
118
+ /** Forgets the unsaved text once the viewer has dealt with it. */
119
+ dismissUnsaved(): void;
120
+ /** Glides the view to centre on a board point, keeping the zoom. */
121
+ centerOn(point: PointJson): void;
122
+ /**
123
+ * Tracks another person's or agent's view until the viewer pans or zooms,
124
+ * or `follow(null)`; a second call with the same actor stops it. The
125
+ * kernel fits the leader's view and the camera eases there.
126
+ */
127
+ follow(actor: string | null): void;
128
+ /** The camera and smoothed presence to draw now. */
129
+ getFrame: () => CanvasFrame;
130
+ getSnapshot: () => CanvasSnapshot;
131
+ lastClipboard: () => ClipboardDataJson | null;
132
+ kernel: import("../kernel/contract.js").Kernel;
133
+ metrics: {
134
+ readonly ascender: number;
135
+ readonly descender: number;
136
+ };
137
+ /** The surface's size in screen pixels changed. */
138
+ resize(width: number, height: number): void;
139
+ /** Screen pixels the chrome covers on each edge; fits and zoom steps keep clear of them. */
140
+ setInset(inset: InsetJson): void;
141
+ store: CanvasBoardStore;
142
+ subscribe(listener: () => void): () => void;
143
+ /**
144
+ * Turns the comment tool on or off with the host's comments; turning it
145
+ * off while it is in use goes back to Select.
146
+ */
147
+ setComments(next: boolean): void;
148
+ /** Calls back on each click with the comment tool. Returns an unsubscribe. */
149
+ subscribePlace(listener: (place: CanvasPlace) => void): () => void;
150
+ /** Redraws on every snapshot and every animation frame that moved. */
151
+ subscribeDraw(listener: () => void): () => void;
152
+ /** The board point at the middle of the area the chrome leaves clear. */
153
+ centre(): PointJson;
154
+ toBoard: (x: number, y: number) => PointJson;
155
+ setReadOnly(next: boolean): void;
156
+ };
157
+ type CanvasController = ReturnType<typeof createCanvasController>;
158
+ export { createCanvasController };
159
+ export type { CanvasBoardError, CanvasClock, CanvasController, CanvasControllerOptions, CanvasFrame, CanvasPlace, CanvasSnapshot, CanvasStep, };
@@ -0,0 +1,13 @@
1
+ import type { JSX } from "@solidjs/web";
2
+ /**
3
+ * The viewer's cursor chat: a bubble at their pointer that they type straight into, in their selection color,
4
+ * as others' chats are in theirs. It has no field chrome: the text grows inside the bubble, which widens and
5
+ * then wraps. What they type goes out live in their presence, so others see it at the viewer's cursor. Enter,
6
+ * Escape or leaving it closes it, and the text clears a few seconds later. Anyone who sees cursors may chat,
7
+ * including a read-only viewer: it is presence, not board content.
8
+ */
9
+ export declare function CanvasCursorChat(props: {
10
+ open: boolean;
11
+ /** The chat closed: by Enter or Escape (`key`), or by focus leaving it. */
12
+ onClose: (by: "key" | "blur") => void;
13
+ }): JSX.Element;
@@ -0,0 +1,54 @@
1
+ import * as stylex from "@stylexjs/stylex";
2
+ export declare const chat: Readonly<{
3
+ readonly root: Readonly<{
4
+ readonly position: stylex.StyleXClassNameFor<"position", "absolute">;
5
+ readonly top: stylex.StyleXClassNameFor<"top", 0>;
6
+ readonly left: stylex.StyleXClassNameFor<"left", 0>;
7
+ readonly pointerEvents: stylex.StyleXClassNameFor<"pointerEvents", "auto">;
8
+ }>;
9
+ readonly bubble: Readonly<{
10
+ readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
11
+ readonly display: stylex.StyleXClassNameFor<"display", "grid">;
12
+ readonly width: stylex.StyleXClassNameFor<"width", "max-content">;
13
+ readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "15rem">;
14
+ readonly paddingBlock: stylex.StyleXClassNameFor<"paddingBlock", string>;
15
+ readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
16
+ readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", "0.25rem var(--sui-radius-xl) var(--sui-radius-xl) var(--sui-radius-xl)">;
17
+ readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
18
+ readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", string>;
19
+ readonly color: stylex.StyleXClassNameFor<"color", string>;
20
+ readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", string>;
21
+ readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
22
+ readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1.4>;
23
+ readonly overflowWrap: stylex.StyleXClassNameFor<"overflowWrap", "anywhere">;
24
+ readonly forcedColorAdjust: stylex.StyleXClassNameFor<"forcedColorAdjust", "none">;
25
+ readonly outline: stylex.StyleXClassNameFor<"outline", "1px solid CanvasText" | null>;
26
+ readonly "::after": stylex.StyleXClassNameFor<"::after", {
27
+ readonly content: "attr(data-value) ' '";
28
+ readonly gridArea: "1 / 1";
29
+ readonly visibility: "hidden";
30
+ readonly whiteSpace: "pre-wrap";
31
+ readonly overflowWrap: "anywhere";
32
+ }>;
33
+ }>;
34
+ readonly field: Readonly<{
35
+ readonly gridArea: stylex.StyleXClassNameFor<"gridArea", "1 / 1">;
36
+ readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
37
+ readonly margin: stylex.StyleXClassNameFor<"margin", 0>;
38
+ readonly padding: stylex.StyleXClassNameFor<"padding", 0>;
39
+ readonly borderWidth: stylex.StyleXClassNameFor<"borderWidth", 0>;
40
+ readonly resize: stylex.StyleXClassNameFor<"resize", "none">;
41
+ readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
42
+ readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", "transparent">;
43
+ readonly color: stylex.StyleXClassNameFor<"color", "inherit">;
44
+ readonly font: stylex.StyleXClassNameFor<"font", "inherit">;
45
+ readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", "inherit">;
46
+ readonly overflowWrap: stylex.StyleXClassNameFor<"overflowWrap", "anywhere">;
47
+ readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "pre-wrap">;
48
+ readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "none">;
49
+ readonly "::placeholder": stylex.StyleXClassNameFor<"::placeholder", {
50
+ readonly color: "currentColor";
51
+ readonly opacity: 0.7;
52
+ }>;
53
+ }>;
54
+ }>;
@@ -0,0 +1,21 @@
1
+ import type { JSX } from "@solidjs/web";
2
+ import type { EditorModeJson } from "../kernel/index.js";
3
+ /** The items of the style bar's More menu: the context menu's, without Replace image. */
4
+ export declare function CanvasDropdownItems(): JSX.Element;
5
+ /** What a board does with a request to open its context menu. */
6
+ export type MenuOpening = "open" | "refuse" | "end-press";
7
+ /**
8
+ * Touch opens the menu on a long press, so a finger or a pen resting mid-gesture could open it. Only a still
9
+ * finger on an idle board, or one still pressing under the drag threshold, opens it; the press then ends so
10
+ * lifting the finger does not select. A pen's press never does (Apple Pencil reports touch as a stylus), though
11
+ * its barrel button, a right click, does. A right click and the keyboard always open it.
12
+ */
13
+ export declare function menuOpening(event: Event | undefined, mode: EditorModeJson["_tag"]): MenuOpening;
14
+ /**
15
+ * Right click, a still long press, the context-menu key or Shift+F10 on the board opens the actions for the
16
+ * selection, or for the board when nothing is selected. `children` is the surface, which is focusable and keeps
17
+ * its own `data-slot`; the menu's area wraps it without a box of its own.
18
+ */
19
+ export declare function CanvasContextMenu(props: {
20
+ children: JSX.Element;
21
+ }): JSX.Element;
@@ -0,0 +1,6 @@
1
+ import * as stylex from "@stylexjs/stylex";
2
+ export declare const menus: Readonly<{
3
+ readonly area: Readonly<{
4
+ readonly display: stylex.StyleXClassNameFor<"display", "contents">;
5
+ }>;
6
+ }>;
@@ -0,0 +1,19 @@
1
+ import type { JSX } from "@solidjs/web";
2
+ import type { ToolJson } from "../kernel/index.js";
3
+ /**
4
+ * Style for the selection, or for the next shape when a shape tool is in hand, with the selection's actions
5
+ * in a menu. One selected image gets its own bar: a description, the original file, and the actions.
6
+ */
7
+ export declare function CanvasStyleBar(props: {
8
+ /** Size and alignment as menus, for a board in a side panel. */
9
+ compact?: boolean;
10
+ /**
11
+ * The edge of the board the bar sits on; its menus open away from it, into the board.
12
+ * @defaultValue "bottom" when compact, else "top"
13
+ */
14
+ edge?: "top" | "bottom";
15
+ }): JSX.Element;
16
+ /** Pens, ink color and width while the pen or eraser is in hand: the kit's Draw toolbar. */
17
+ export declare function CanvasDrawBar(): JSX.Element;
18
+ /** Whether the draw bar shows instead of the style bar. */
19
+ export declare const drawing: (tool: ToolJson) => tool is "eraser" | "pen";
@@ -0,0 +1,43 @@
1
+ import * as stylex from "@stylexjs/stylex";
2
+ export declare const styleBar: Readonly<{
3
+ readonly swatch: Readonly<{
4
+ readonly display: stylex.StyleXClassNameFor<"display", "block">;
5
+ readonly flexShrink: stylex.StyleXClassNameFor<"flexShrink", 0>;
6
+ readonly width: stylex.StyleXClassNameFor<"width", "1rem">;
7
+ readonly height: stylex.StyleXClassNameFor<"height", "1rem">;
8
+ readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
9
+ readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", "var(--canvas-swatch)">;
10
+ readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", `inset 0 0 0 1px color-mix(in oklab, ${stylex.StyleXVar<string>} 18%, transparent)`>;
11
+ readonly forcedColorAdjust: stylex.StyleXClassNameFor<"forcedColorAdjust", "none">;
12
+ }>;
13
+ readonly mixed: Readonly<{
14
+ readonly backgroundImage: stylex.StyleXClassNameFor<"backgroundImage", `conic-gradient(${stylex.StyleXVar<string>} 0 25%, ${stylex.StyleXVar<string>} 0 50%, ${stylex.StyleXVar<string>} 0 75%, ${stylex.StyleXVar<string>} 0)`>;
15
+ }>;
16
+ readonly title: Readonly<{
17
+ readonly margin: stylex.StyleXClassNameFor<"margin", 0>;
18
+ readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
19
+ readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
20
+ readonly color: stylex.StyleXClassNameFor<"color", string>;
21
+ }>;
22
+ readonly swatches: Readonly<{
23
+ readonly display: stylex.StyleXClassNameFor<"display", "grid">;
24
+ readonly gridTemplateColumns: stylex.StyleXClassNameFor<"gridTemplateColumns", "repeat(5, auto)">;
25
+ readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "start">;
26
+ readonly gap: stylex.StyleXClassNameFor<"gap", string>;
27
+ }>;
28
+ readonly form: Readonly<{
29
+ readonly display: stylex.StyleXClassNameFor<"display", "flex">;
30
+ readonly flexDirection: stylex.StyleXClassNameFor<"flexDirection", "column">;
31
+ readonly gap: stylex.StyleXClassNameFor<"gap", string>;
32
+ }>;
33
+ readonly actions: Readonly<{
34
+ readonly display: stylex.StyleXClassNameFor<"display", "flex">;
35
+ readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "flex-end">;
36
+ readonly gap: stylex.StyleXClassNameFor<"gap", string>;
37
+ }>;
38
+ readonly square: Readonly<{
39
+ readonly aspectRatio: stylex.StyleXClassNameFor<"aspectRatio", "1">;
40
+ readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", 0>;
41
+ readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "center">;
42
+ }>;
43
+ }>;
@@ -0,0 +1,15 @@
1
+ import type { JSX } from "@solidjs/web";
2
+ export interface CanvasSurfaceProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "children" | "role"> {
3
+ /**
4
+ * Names the board for assistive technology, such as "Retro board".
5
+ * @defaultValue "Board"
6
+ */
7
+ label?: string;
8
+ }
9
+ /**
10
+ * The drawing surface: the board's shapes, the viewer's gesture previews, other people's cursors and
11
+ * images, with pointer, touch, wheel, keyboard, clipboard and file-drop input. It fills its parent. The
12
+ * scene redraws outside Solid on every change and animation frame; Solid renders only when what the
13
+ * surface shows changes kind. Render it inside a `CanvasProvider`.
14
+ */
15
+ export declare function CanvasSurface(props: CanvasSurfaceProps): JSX.Element;