@zsherman/canvas 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/LICENSE +373 -0
- package/README.md +15 -2
- package/THIRD_PARTY_NOTICES.md +117 -0
- package/dist/dom/canvas/assets.js +89 -0
- package/dist/dom/canvas/board-store.js +56 -0
- package/dist/dom/canvas/canvas-actions.js +78 -0
- package/dist/dom/canvas/canvas-board.js +557 -0
- package/dist/dom/canvas/canvas-board.styles.js +110 -0
- package/dist/dom/canvas/canvas-chrome.js +1167 -0
- package/dist/dom/canvas/canvas-chrome.styles.js +220 -0
- package/dist/dom/canvas/canvas-comments.js +950 -0
- package/dist/dom/canvas/canvas-comments.styles.js +231 -0
- package/dist/dom/canvas/canvas-context.js +196 -0
- package/dist/dom/canvas/canvas-controller.js +697 -0
- package/dist/dom/canvas/canvas-cursor-chat.js +120 -0
- package/dist/dom/canvas/canvas-cursor-chat.styles.js +55 -0
- package/dist/dom/canvas/canvas-menus.js +276 -0
- package/dist/dom/canvas/canvas-menus.styles.js +7 -0
- package/dist/dom/canvas/canvas-style-bar.js +930 -0
- package/dist/dom/canvas/canvas-style-bar.styles.js +52 -0
- package/dist/dom/canvas/canvas-surface.js +1353 -0
- package/dist/dom/canvas/canvas-surface.styles.js +345 -0
- package/dist/dom/canvas/canvas-tool-rail.js +406 -0
- package/dist/dom/canvas/canvas-tool-rail.styles.js +20 -0
- package/dist/dom/canvas/comments.js +58 -0
- package/dist/dom/canvas/equality.js +13 -0
- package/dist/dom/canvas/export-png.js +496 -0
- package/dist/dom/canvas/gesture-machine.js +91 -0
- package/dist/dom/canvas/handlers.js +18 -0
- package/dist/dom/canvas/index.js +9 -0
- package/dist/dom/canvas/input.js +85 -0
- package/dist/dom/canvas/instant.js +28 -0
- package/dist/dom/canvas/kernel.js +39 -0
- package/dist/dom/canvas/motion.js +686 -0
- package/dist/dom/canvas/palette.js +165 -0
- package/dist/dom/canvas/random-id.js +15 -0
- package/dist/dom/canvas/scene-renderer.js +559 -0
- package/dist/dom/canvas/scene.styles.js +7 -0
- package/dist/dom/canvas/surface-model.js +324 -0
- package/dist/dom/canvas/uploads.js +294 -0
- package/dist/dom/index.js +9 -0
- package/dist/dom/kernel/actions.js +455 -0
- package/dist/dom/kernel/board.js +856 -0
- package/dist/dom/kernel/claims.js +40 -0
- package/dist/dom/kernel/clipboard.js +30 -0
- package/dist/dom/kernel/constants.js +210 -0
- package/dist/dom/kernel/contract.js +0 -0
- package/dist/dom/kernel/decode.js +85 -0
- package/dist/dom/kernel/editor.js +2077 -0
- package/dist/dom/kernel/errors.js +82 -0
- package/dist/dom/kernel/fonts/inter.js +7924 -0
- package/dist/dom/kernel/fractional-index.js +54 -0
- package/dist/dom/kernel/geometry.js +123 -0
- package/dist/dom/kernel/hit-test.js +156 -0
- package/dist/dom/kernel/index.js +22 -0
- package/dist/dom/kernel/inspect.js +116 -0
- package/dist/dom/kernel/kernel.js +251 -0
- package/dist/dom/kernel/outline.js +64 -0
- package/dist/dom/kernel/plan.js +1370 -0
- package/dist/dom/kernel/rev.js +173 -0
- package/dist/dom/kernel/scene.js +580 -0
- package/dist/dom/kernel/schema.js +1109 -0
- package/dist/dom/kernel/snap.js +258 -0
- package/dist/dom/kernel/svg.js +148 -0
- package/dist/dom/kernel/text.js +142 -0
- package/dist/solid/canvas/assets.jsx +89 -0
- package/dist/solid/canvas/board-store.jsx +56 -0
- package/dist/solid/canvas/canvas-actions.jsx +78 -0
- package/dist/solid/canvas/canvas-board.jsx +326 -0
- package/dist/solid/canvas/canvas-board.styles.jsx +110 -0
- package/dist/solid/canvas/canvas-chrome.jsx +612 -0
- package/dist/solid/canvas/canvas-chrome.styles.jsx +220 -0
- package/dist/solid/canvas/canvas-comments.jsx +435 -0
- package/dist/solid/canvas/canvas-comments.styles.jsx +231 -0
- package/dist/solid/canvas/canvas-context.jsx +174 -0
- package/dist/solid/canvas/canvas-controller.jsx +697 -0
- package/dist/solid/canvas/canvas-cursor-chat.jsx +87 -0
- package/dist/solid/canvas/canvas-cursor-chat.styles.jsx +55 -0
- package/dist/solid/canvas/canvas-menus.jsx +223 -0
- package/dist/solid/canvas/canvas-menus.styles.jsx +7 -0
- package/dist/solid/canvas/canvas-style-bar.jsx +486 -0
- package/dist/solid/canvas/canvas-style-bar.styles.jsx +52 -0
- package/dist/solid/canvas/canvas-surface.jsx +681 -0
- package/dist/solid/canvas/canvas-surface.styles.jsx +345 -0
- package/dist/solid/canvas/canvas-tool-rail.jsx +195 -0
- package/dist/solid/canvas/canvas-tool-rail.styles.jsx +20 -0
- package/dist/solid/canvas/comments.jsx +58 -0
- package/dist/solid/canvas/equality.jsx +13 -0
- package/dist/solid/canvas/export-png.jsx +496 -0
- package/dist/solid/canvas/gesture-machine.jsx +91 -0
- package/dist/solid/canvas/handlers.jsx +18 -0
- package/dist/solid/canvas/index.jsx +9 -0
- package/dist/solid/canvas/input.jsx +85 -0
- package/dist/solid/canvas/instant.jsx +28 -0
- package/dist/solid/canvas/kernel.jsx +39 -0
- package/dist/solid/canvas/motion.jsx +686 -0
- package/dist/solid/canvas/palette.jsx +165 -0
- package/dist/solid/canvas/random-id.jsx +15 -0
- package/dist/solid/canvas/scene-renderer.jsx +559 -0
- package/dist/solid/canvas/scene.styles.jsx +7 -0
- package/dist/solid/canvas/surface-model.jsx +324 -0
- package/dist/solid/canvas/uploads.jsx +294 -0
- package/dist/solid/index.jsx +9 -0
- package/dist/solid/kernel/actions.jsx +455 -0
- package/dist/solid/kernel/board.jsx +856 -0
- package/dist/solid/kernel/claims.jsx +40 -0
- package/dist/solid/kernel/clipboard.jsx +30 -0
- package/dist/solid/kernel/constants.jsx +210 -0
- package/dist/solid/kernel/contract.jsx +0 -0
- package/dist/solid/kernel/decode.jsx +85 -0
- package/dist/solid/kernel/editor.jsx +2077 -0
- package/dist/solid/kernel/errors.jsx +82 -0
- package/dist/solid/kernel/fonts/inter.jsx +7924 -0
- package/dist/solid/kernel/fractional-index.jsx +54 -0
- package/dist/solid/kernel/geometry.jsx +123 -0
- package/dist/solid/kernel/hit-test.jsx +156 -0
- package/dist/solid/kernel/index.jsx +22 -0
- package/dist/solid/kernel/inspect.jsx +116 -0
- package/dist/solid/kernel/kernel.jsx +251 -0
- package/dist/solid/kernel/outline.jsx +64 -0
- package/dist/solid/kernel/plan.jsx +1370 -0
- package/dist/solid/kernel/rev.jsx +173 -0
- package/dist/solid/kernel/scene.jsx +580 -0
- package/dist/solid/kernel/schema.jsx +1109 -0
- package/dist/solid/kernel/snap.jsx +258 -0
- package/dist/solid/kernel/svg.jsx +148 -0
- package/dist/solid/kernel/text.jsx +142 -0
- package/dist/styles.css +1 -0
- package/dist/types/canvas/assets.d.ts +111 -0
- package/dist/types/canvas/board-store.d.ts +86 -0
- package/dist/types/canvas/canvas-actions.d.ts +21 -0
- package/dist/types/canvas/canvas-board.d.ts +53 -0
- package/dist/types/canvas/canvas-board.styles.d.ts +94 -0
- package/dist/types/canvas/canvas-chrome.d.ts +109 -0
- package/dist/types/canvas/canvas-chrome.styles.d.ts +193 -0
- package/dist/types/canvas/canvas-comments.d.ts +20 -0
- package/dist/types/canvas/canvas-comments.styles.d.ts +208 -0
- package/dist/types/canvas/canvas-context.d.ts +104 -0
- package/dist/types/canvas/canvas-controller.d.ts +159 -0
- package/dist/types/canvas/canvas-cursor-chat.d.ts +13 -0
- package/dist/types/canvas/canvas-cursor-chat.styles.d.ts +54 -0
- package/dist/types/canvas/canvas-menus.d.ts +21 -0
- package/dist/types/canvas/canvas-menus.styles.d.ts +6 -0
- package/dist/types/canvas/canvas-style-bar.d.ts +19 -0
- package/dist/types/canvas/canvas-style-bar.styles.d.ts +43 -0
- package/dist/types/canvas/canvas-surface.d.ts +15 -0
- package/dist/types/canvas/canvas-surface.styles.d.ts +313 -0
- package/dist/types/canvas/canvas-tool-rail.d.ts +41 -0
- package/dist/types/canvas/canvas-tool-rail.styles.d.ts +15 -0
- package/dist/types/canvas/comments.d.ts +106 -0
- package/dist/types/canvas/equality.d.ts +4 -0
- package/dist/types/canvas/export-png.d.ts +77 -0
- package/dist/types/canvas/gesture-machine.d.ts +46 -0
- package/dist/types/canvas/handlers.d.ts +7 -0
- package/dist/types/canvas/index.d.ts +18 -0
- package/dist/types/canvas/input.d.ts +63 -0
- package/dist/types/canvas/instant.d.ts +13 -0
- package/dist/types/canvas/kernel.d.ts +27 -0
- package/dist/types/canvas/motion.d.ts +72 -0
- package/dist/types/canvas/palette.d.ts +46 -0
- package/dist/types/canvas/random-id.d.ts +6 -0
- package/dist/types/canvas/scene-renderer.d.ts +27 -0
- package/dist/types/canvas/scene.styles.d.ts +4 -0
- package/dist/types/canvas/surface-model.d.ts +113 -0
- package/dist/types/canvas/uploads.d.ts +58 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/kernel/actions.d.ts +19 -0
- package/dist/types/kernel/board.d.ts +137 -0
- package/dist/types/kernel/claims.d.ts +29 -0
- package/dist/types/kernel/clipboard.d.ts +10 -0
- package/dist/types/kernel/constants.d.ts +195 -0
- package/dist/types/kernel/contract.d.ts +1533 -0
- package/dist/types/kernel/decode.d.ts +60 -0
- package/dist/types/kernel/editor.d.ts +12 -0
- package/dist/types/kernel/errors.d.ts +11 -0
- package/dist/types/kernel/fractional-index.d.ts +7 -0
- package/dist/types/kernel/geometry.d.ts +42 -0
- package/dist/types/kernel/hit-test.d.ts +16 -0
- package/dist/types/kernel/index.d.ts +8 -0
- package/dist/types/kernel/inspect.d.ts +6 -0
- package/dist/types/kernel/kernel.d.ts +6 -0
- package/dist/types/kernel/outline.d.ts +4 -0
- package/dist/types/kernel/plan.d.ts +20 -0
- package/dist/types/kernel/rev.d.ts +21 -0
- package/dist/types/kernel/scene.d.ts +16 -0
- package/dist/types/kernel/schema.d.ts +3436 -0
- package/dist/types/kernel/snap.d.ts +41 -0
- package/dist/types/kernel/svg.d.ts +3 -0
- package/dist/types/kernel/text.d.ts +21 -0
- package/docs/api.json +207 -0
- package/docs/canvas.md +444 -0
- package/docs/kernel.md +108 -0
- package/docs/llms.txt +41 -0
- package/docs/search-index.json +52 -0
- package/package.json +55 -4
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import * as stylex from "@stylexjs/stylex";
|
|
2
|
+
export declare const surface: Readonly<{
|
|
3
|
+
readonly root: Readonly<{
|
|
4
|
+
readonly position: stylex.StyleXClassNameFor<"position", "relative">;
|
|
5
|
+
readonly width: stylex.StyleXClassNameFor<"width", "100%">;
|
|
6
|
+
readonly height: stylex.StyleXClassNameFor<"height", "100%">;
|
|
7
|
+
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
|
|
8
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", "inherit">;
|
|
9
|
+
readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "none">;
|
|
10
|
+
readonly touchAction: stylex.StyleXClassNameFor<"touchAction", "none">;
|
|
11
|
+
readonly userSelect: stylex.StyleXClassNameFor<"userSelect", "none">;
|
|
12
|
+
readonly WebkitUserSelect: stylex.StyleXClassNameFor<"WebkitUserSelect", "none">;
|
|
13
|
+
readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", unknown>;
|
|
14
|
+
readonly outline: stylex.StyleXClassNameFor<"outline", unknown>;
|
|
15
|
+
readonly outlineOffset: stylex.StyleXClassNameFor<"outlineOffset", "-2px">;
|
|
16
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
17
|
+
}>;
|
|
18
|
+
readonly scene: Readonly<{
|
|
19
|
+
readonly position: stylex.StyleXClassNameFor<"position", "absolute">;
|
|
20
|
+
readonly inset: stylex.StyleXClassNameFor<"inset", 0>;
|
|
21
|
+
readonly width: stylex.StyleXClassNameFor<"width", "100%">;
|
|
22
|
+
readonly height: stylex.StyleXClassNameFor<"height", "100%">;
|
|
23
|
+
readonly display: stylex.StyleXClassNameFor<"display", "block">;
|
|
24
|
+
}>;
|
|
25
|
+
readonly overlay: Readonly<{
|
|
26
|
+
readonly position: stylex.StyleXClassNameFor<"position", "absolute">;
|
|
27
|
+
readonly inset: stylex.StyleXClassNameFor<"inset", 0>;
|
|
28
|
+
readonly pointerEvents: stylex.StyleXClassNameFor<"pointerEvents", "none">;
|
|
29
|
+
}>;
|
|
30
|
+
readonly following: Readonly<{
|
|
31
|
+
readonly position: stylex.StyleXClassNameFor<"position", "absolute">;
|
|
32
|
+
readonly inset: stylex.StyleXClassNameFor<"inset", 0>;
|
|
33
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", "inherit">;
|
|
34
|
+
readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", "inset 0 0 0 2px var(--canvas-leader)">;
|
|
35
|
+
readonly outline: stylex.StyleXClassNameFor<"outline", "2px solid Highlight" | null>;
|
|
36
|
+
readonly outlineOffset: stylex.StyleXClassNameFor<"outlineOffset", "-2px">;
|
|
37
|
+
}>;
|
|
38
|
+
readonly drop: Readonly<{
|
|
39
|
+
readonly position: stylex.StyleXClassNameFor<"position", "absolute">;
|
|
40
|
+
readonly inset: stylex.StyleXClassNameFor<"inset", 0>;
|
|
41
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
42
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
43
|
+
readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "center">;
|
|
44
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", "inherit">;
|
|
45
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
46
|
+
readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", `inset 0 0 0 2px ${stylex.StyleXVar<string>}`>;
|
|
47
|
+
}>;
|
|
48
|
+
readonly dropHint: Readonly<{
|
|
49
|
+
readonly paddingBlock: stylex.StyleXClassNameFor<"paddingBlock", string>;
|
|
50
|
+
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
51
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
52
|
+
readonly borderWidth: stylex.StyleXClassNameFor<"borderWidth", "1px">;
|
|
53
|
+
readonly borderStyle: stylex.StyleXClassNameFor<"borderStyle", "solid">;
|
|
54
|
+
readonly borderColor: stylex.StyleXClassNameFor<"borderColor", string>;
|
|
55
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
56
|
+
readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", string>;
|
|
57
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
58
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
59
|
+
}>;
|
|
60
|
+
readonly editor: Readonly<{
|
|
61
|
+
readonly position: stylex.StyleXClassNameFor<"position", "absolute">;
|
|
62
|
+
readonly pointerEvents: stylex.StyleXClassNameFor<"pointerEvents", "auto">;
|
|
63
|
+
readonly transformOrigin: stylex.StyleXClassNameFor<"transformOrigin", "top left">;
|
|
64
|
+
readonly resize: stylex.StyleXClassNameFor<"resize", "none">;
|
|
65
|
+
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
|
|
66
|
+
readonly borderWidth: stylex.StyleXClassNameFor<"borderWidth", 0>;
|
|
67
|
+
readonly padding: stylex.StyleXClassNameFor<"padding", 0>;
|
|
68
|
+
readonly margin: stylex.StyleXClassNameFor<"margin", 0>;
|
|
69
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", "transparent">;
|
|
70
|
+
readonly caretColor: stylex.StyleXClassNameFor<"caretColor", "currentColor">;
|
|
71
|
+
readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "none">;
|
|
72
|
+
readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", "'Inter Variable', sans-serif">;
|
|
73
|
+
readonly fontKerning: stylex.StyleXClassNameFor<"fontKerning", "none">;
|
|
74
|
+
readonly fontVariantLigatures: stylex.StyleXClassNameFor<"fontVariantLigatures", "none">;
|
|
75
|
+
readonly fontFeatureSettings: stylex.StyleXClassNameFor<"fontFeatureSettings", "'calt' 0">;
|
|
76
|
+
readonly fontOpticalSizing: stylex.StyleXClassNameFor<"fontOpticalSizing", "auto">;
|
|
77
|
+
readonly overflowWrap: stylex.StyleXClassNameFor<"overflowWrap", "anywhere">;
|
|
78
|
+
readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "pre-wrap">;
|
|
79
|
+
}>;
|
|
80
|
+
}>;
|
|
81
|
+
export declare const cursor: Readonly<{
|
|
82
|
+
readonly root: Readonly<{
|
|
83
|
+
readonly position: stylex.StyleXClassNameFor<"position", "absolute">;
|
|
84
|
+
readonly top: stylex.StyleXClassNameFor<"top", 0>;
|
|
85
|
+
readonly left: stylex.StyleXClassNameFor<"left", 0>;
|
|
86
|
+
readonly pointerEvents: stylex.StyleXClassNameFor<"pointerEvents", "none">;
|
|
87
|
+
}>;
|
|
88
|
+
readonly body: Readonly<{
|
|
89
|
+
readonly display: stylex.StyleXClassNameFor<"display", "block" | "none">;
|
|
90
|
+
readonly pointerEvents: stylex.StyleXClassNameFor<"pointerEvents", "auto" | "none">;
|
|
91
|
+
}>;
|
|
92
|
+
readonly pointer: Readonly<{
|
|
93
|
+
readonly display: stylex.StyleXClassNameFor<"display", "block">;
|
|
94
|
+
readonly width: stylex.StyleXClassNameFor<"width", "1rem">;
|
|
95
|
+
readonly height: stylex.StyleXClassNameFor<"height", "1rem">;
|
|
96
|
+
readonly filter: stylex.StyleXClassNameFor<"filter", `drop-shadow(0 1px 1px color-mix(in oklab, ${stylex.StyleXVar<string>} 25%, transparent))`>;
|
|
97
|
+
}>;
|
|
98
|
+
readonly pill: Readonly<{
|
|
99
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
100
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
101
|
+
readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
|
|
102
|
+
readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "14rem">;
|
|
103
|
+
readonly marginTop: stylex.StyleXClassNameFor<"marginTop", "-0.25rem">;
|
|
104
|
+
readonly marginInlineStart: stylex.StyleXClassNameFor<"marginInlineStart", string | 0>;
|
|
105
|
+
readonly paddingBlock: stylex.StyleXClassNameFor<"paddingBlock", string>;
|
|
106
|
+
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
107
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
108
|
+
readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", string>;
|
|
109
|
+
readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", string>;
|
|
110
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
111
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
112
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1.4>;
|
|
113
|
+
readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "nowrap">;
|
|
114
|
+
readonly position: stylex.StyleXClassNameFor<"position", "absolute" | "static">;
|
|
115
|
+
readonly top: stylex.StyleXClassNameFor<"top", "1rem" | null>;
|
|
116
|
+
readonly right: stylex.StyleXClassNameFor<"right", string | null>;
|
|
117
|
+
readonly forcedColorAdjust: stylex.StyleXClassNameFor<"forcedColorAdjust", "none">;
|
|
118
|
+
}>;
|
|
119
|
+
readonly full: Readonly<{
|
|
120
|
+
readonly display: stylex.StyleXClassNameFor<"display", "inline-flex" | "none">;
|
|
121
|
+
}>;
|
|
122
|
+
readonly name: Readonly<{
|
|
123
|
+
readonly display: stylex.StyleXClassNameFor<"display", "inline-flex" | "none">;
|
|
124
|
+
}>;
|
|
125
|
+
readonly chip: Readonly<{
|
|
126
|
+
readonly display: stylex.StyleXClassNameFor<"display", "inline-flex" | "none">;
|
|
127
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
128
|
+
readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "center">;
|
|
129
|
+
readonly width: stylex.StyleXClassNameFor<"width", "1.25rem">;
|
|
130
|
+
readonly height: stylex.StyleXClassNameFor<"height", "1.25rem">;
|
|
131
|
+
readonly marginTop: stylex.StyleXClassNameFor<"marginTop", "-0.25rem">;
|
|
132
|
+
readonly marginInlineStart: stylex.StyleXClassNameFor<"marginInlineStart", string | 0>;
|
|
133
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
134
|
+
readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", `0 0 0 2px ${stylex.StyleXVar<string>}, ${stylex.StyleXVar<string>}`>;
|
|
135
|
+
readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", string>;
|
|
136
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", "0.6875rem">;
|
|
137
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
138
|
+
readonly position: stylex.StyleXClassNameFor<"position", "absolute" | "static">;
|
|
139
|
+
readonly top: stylex.StyleXClassNameFor<"top", "0.75rem" | null>;
|
|
140
|
+
readonly right: stylex.StyleXClassNameFor<"right", string | null>;
|
|
141
|
+
readonly forcedColorAdjust: stylex.StyleXClassNameFor<"forcedColorAdjust", "none">;
|
|
142
|
+
}>;
|
|
143
|
+
readonly truncate: Readonly<{
|
|
144
|
+
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
|
|
145
|
+
readonly textOverflow: stylex.StyleXClassNameFor<"textOverflow", "ellipsis">;
|
|
146
|
+
readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "nowrap">;
|
|
147
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
148
|
+
}>;
|
|
149
|
+
readonly agent: Readonly<{
|
|
150
|
+
readonly flexShrink: stylex.StyleXClassNameFor<"flexShrink", 0>;
|
|
151
|
+
}>;
|
|
152
|
+
readonly chat: Readonly<{
|
|
153
|
+
readonly display: stylex.StyleXClassNameFor<"display", "block">;
|
|
154
|
+
readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
|
|
155
|
+
readonly width: stylex.StyleXClassNameFor<"width", "max-content">;
|
|
156
|
+
readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "15rem">;
|
|
157
|
+
readonly marginTop: stylex.StyleXClassNameFor<"marginTop", string>;
|
|
158
|
+
readonly marginBottom: stylex.StyleXClassNameFor<"marginBottom", 0>;
|
|
159
|
+
readonly marginInlineStart: stylex.StyleXClassNameFor<"marginInlineStart", string | 0>;
|
|
160
|
+
readonly paddingBlock: stylex.StyleXClassNameFor<"paddingBlock", string>;
|
|
161
|
+
readonly paddingInline: stylex.StyleXClassNameFor<"paddingInline", string>;
|
|
162
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", `${stylex.StyleXVar<string>} 0.25rem ${stylex.StyleXVar<string>} ${stylex.StyleXVar<string>}` | `0.25rem ${stylex.StyleXVar<string>} ${stylex.StyleXVar<string>} ${stylex.StyleXVar<string>}`>;
|
|
163
|
+
readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", string>;
|
|
164
|
+
readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", string>;
|
|
165
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
166
|
+
readonly lineHeight: stylex.StyleXClassNameFor<"lineHeight", 1.4>;
|
|
167
|
+
readonly overflowWrap: stylex.StyleXClassNameFor<"overflowWrap", "anywhere">;
|
|
168
|
+
readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "pre-wrap">;
|
|
169
|
+
readonly position: stylex.StyleXClassNameFor<"position", "absolute" | "static">;
|
|
170
|
+
readonly top: stylex.StyleXClassNameFor<"top", "2.5rem" | null>;
|
|
171
|
+
readonly right: stylex.StyleXClassNameFor<"right", string | null>;
|
|
172
|
+
readonly forcedColorAdjust: stylex.StyleXClassNameFor<"forcedColorAdjust", "none">;
|
|
173
|
+
}>;
|
|
174
|
+
readonly edge: Readonly<{
|
|
175
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex" | "none">;
|
|
176
|
+
readonly position: stylex.StyleXClassNameFor<"position", "relative">;
|
|
177
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
178
|
+
readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "center">;
|
|
179
|
+
readonly width: stylex.StyleXClassNameFor<"width", "1.5rem">;
|
|
180
|
+
readonly height: stylex.StyleXClassNameFor<"height", "1.5rem">;
|
|
181
|
+
readonly padding: stylex.StyleXClassNameFor<"padding", 0>;
|
|
182
|
+
readonly borderWidth: stylex.StyleXClassNameFor<"borderWidth", 0>;
|
|
183
|
+
readonly borderRadius: stylex.StyleXClassNameFor<"borderRadius", string>;
|
|
184
|
+
readonly pointerEvents: stylex.StyleXClassNameFor<"pointerEvents", "auto">;
|
|
185
|
+
readonly cursor: stylex.StyleXClassNameFor<"cursor", "pointer">;
|
|
186
|
+
readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", `0 0 0 2px ${stylex.StyleXVar<string>}, ${stylex.StyleXVar<string>}`>;
|
|
187
|
+
readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "none" | "solid">;
|
|
188
|
+
readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", string>;
|
|
189
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
190
|
+
readonly fontWeight: stylex.StyleXClassNameFor<"fontWeight", string>;
|
|
191
|
+
readonly forcedColorAdjust: stylex.StyleXClassNameFor<"forcedColorAdjust", "none">;
|
|
192
|
+
readonly "::after": stylex.StyleXClassNameFor<"::after", {
|
|
193
|
+
readonly content: {
|
|
194
|
+
readonly default: null;
|
|
195
|
+
readonly "@media (pointer: coarse)": "''";
|
|
196
|
+
};
|
|
197
|
+
readonly position: "absolute";
|
|
198
|
+
readonly inset: "-0.625rem";
|
|
199
|
+
}>;
|
|
200
|
+
}>;
|
|
201
|
+
readonly arrow: Readonly<{
|
|
202
|
+
readonly position: stylex.StyleXClassNameFor<"position", "absolute">;
|
|
203
|
+
readonly top: stylex.StyleXClassNameFor<"top", "50%">;
|
|
204
|
+
readonly left: stylex.StyleXClassNameFor<"left", "50%">;
|
|
205
|
+
readonly width: stylex.StyleXClassNameFor<"width", "0.5rem">;
|
|
206
|
+
readonly height: stylex.StyleXClassNameFor<"height", "0.5rem">;
|
|
207
|
+
readonly transform: stylex.StyleXClassNameFor<"transform", "translate(-50%, -50%) rotate(var(--canvas-edge-angle, 0rad)) translateX(17px)">;
|
|
208
|
+
}>;
|
|
209
|
+
}>;
|
|
210
|
+
/** Panels over images and uploads: placed and sized every frame over their box (`data-anchor`). */
|
|
211
|
+
export declare const media: Readonly<{
|
|
212
|
+
readonly panel: Readonly<{
|
|
213
|
+
readonly position: stylex.StyleXClassNameFor<"position", "absolute">;
|
|
214
|
+
readonly top: stylex.StyleXClassNameFor<"top", 0>;
|
|
215
|
+
readonly left: stylex.StyleXClassNameFor<"left", 0>;
|
|
216
|
+
readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
|
|
217
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
218
|
+
readonly flexDirection: stylex.StyleXClassNameFor<"flexDirection", "column">;
|
|
219
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
220
|
+
readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "center">;
|
|
221
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
222
|
+
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
|
|
223
|
+
readonly padding: stylex.StyleXClassNameFor<"padding", string>;
|
|
224
|
+
readonly pointerEvents: stylex.StyleXClassNameFor<"pointerEvents", "none">;
|
|
225
|
+
readonly fontFamily: stylex.StyleXClassNameFor<"fontFamily", string>;
|
|
226
|
+
readonly fontSize: stylex.StyleXClassNameFor<"fontSize", string>;
|
|
227
|
+
}>;
|
|
228
|
+
readonly status: Readonly<{
|
|
229
|
+
readonly padding: stylex.StyleXClassNameFor<"padding", string>;
|
|
230
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
231
|
+
}>;
|
|
232
|
+
readonly failed: Readonly<{
|
|
233
|
+
readonly borderWidth: stylex.StyleXClassNameFor<"borderWidth", "1px">;
|
|
234
|
+
readonly borderStyle: stylex.StyleXClassNameFor<"borderStyle", "dashed">;
|
|
235
|
+
readonly borderColor: stylex.StyleXClassNameFor<"borderColor", string>;
|
|
236
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", string>;
|
|
237
|
+
}>;
|
|
238
|
+
readonly replacing: Readonly<{
|
|
239
|
+
readonly backgroundColor: stylex.StyleXClassNameFor<"backgroundColor", `color-mix(in oklab, ${stylex.StyleXVar<string>} 80%, transparent)`>;
|
|
240
|
+
}>;
|
|
241
|
+
readonly row: Readonly<{
|
|
242
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
243
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
244
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
245
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
246
|
+
readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "100%">;
|
|
247
|
+
}>;
|
|
248
|
+
readonly column: Readonly<{
|
|
249
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
250
|
+
readonly flexDirection: stylex.StyleXClassNameFor<"flexDirection", "column">;
|
|
251
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
252
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
253
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
254
|
+
readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "100%">;
|
|
255
|
+
readonly textAlign: stylex.StyleXClassNameFor<"textAlign", "center">;
|
|
256
|
+
}>;
|
|
257
|
+
readonly muted: Readonly<{
|
|
258
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
259
|
+
}>;
|
|
260
|
+
readonly text: Readonly<{
|
|
261
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
262
|
+
}>;
|
|
263
|
+
readonly danger: Readonly<{
|
|
264
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
265
|
+
}>;
|
|
266
|
+
readonly icon: Readonly<{
|
|
267
|
+
readonly flexShrink: stylex.StyleXClassNameFor<"flexShrink", 0>;
|
|
268
|
+
}>;
|
|
269
|
+
readonly truncate: Readonly<{
|
|
270
|
+
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
|
|
271
|
+
readonly textOverflow: stylex.StyleXClassNameFor<"textOverflow", "ellipsis">;
|
|
272
|
+
readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "nowrap">;
|
|
273
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
274
|
+
}>;
|
|
275
|
+
readonly wordy: Readonly<{
|
|
276
|
+
readonly position: stylex.StyleXClassNameFor<"position", "absolute" | "static">;
|
|
277
|
+
readonly width: stylex.StyleXClassNameFor<"width", "1px" | null>;
|
|
278
|
+
readonly height: stylex.StyleXClassNameFor<"height", "1px" | null>;
|
|
279
|
+
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden" | null>;
|
|
280
|
+
readonly clipPath: stylex.StyleXClassNameFor<"clipPath", "inset(50%)" | null>;
|
|
281
|
+
readonly whiteSpace: stylex.StyleXClassNameFor<"whiteSpace", "nowrap" | null>;
|
|
282
|
+
}>;
|
|
283
|
+
readonly message: Readonly<{
|
|
284
|
+
readonly display: stylex.StyleXClassNameFor<"display", "-webkit-box">;
|
|
285
|
+
readonly WebkitLineClamp: stylex.StyleXClassNameFor<"WebkitLineClamp", 3>;
|
|
286
|
+
readonly WebkitBoxOrient: stylex.StyleXClassNameFor<"WebkitBoxOrient", "vertical">;
|
|
287
|
+
readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "16rem">;
|
|
288
|
+
readonly margin: stylex.StyleXClassNameFor<"margin", 0>;
|
|
289
|
+
readonly overflow: stylex.StyleXClassNameFor<"overflow", "hidden">;
|
|
290
|
+
readonly textAlign: stylex.StyleXClassNameFor<"textAlign", "center">;
|
|
291
|
+
readonly color: stylex.StyleXClassNameFor<"color", string>;
|
|
292
|
+
}>;
|
|
293
|
+
readonly actions: Readonly<{
|
|
294
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
295
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
296
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
297
|
+
readonly pointerEvents: stylex.StyleXClassNameFor<"pointerEvents", "auto">;
|
|
298
|
+
}>;
|
|
299
|
+
readonly progress: Readonly<{
|
|
300
|
+
readonly display: stylex.StyleXClassNameFor<"display", "flex">;
|
|
301
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
302
|
+
readonly justifyContent: stylex.StyleXClassNameFor<"justifyContent", "center">;
|
|
303
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
304
|
+
readonly width: stylex.StyleXClassNameFor<"width", "100%">;
|
|
305
|
+
readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "12rem">;
|
|
306
|
+
readonly pointerEvents: stylex.StyleXClassNameFor<"pointerEvents", "auto">;
|
|
307
|
+
}>;
|
|
308
|
+
readonly bar: Readonly<{
|
|
309
|
+
readonly flex: stylex.StyleXClassNameFor<"flex", "1 1 0">;
|
|
310
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", 0>;
|
|
311
|
+
readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "3rem" | null>;
|
|
312
|
+
}>;
|
|
313
|
+
}>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { IconNode } from "@zsherman/kit/icon";
|
|
2
|
+
import type { JSX } from "@solidjs/web";
|
|
3
|
+
import type { ActionIdJson, ToolJson } from "../kernel/index.js";
|
|
4
|
+
declare const TOOL_ICONS: Record<ToolJson, IconNode>;
|
|
5
|
+
/** An action's first shortcut as keys, named for assistive technology. */
|
|
6
|
+
declare function CanvasShortcut(props: {
|
|
7
|
+
action: ActionIdJson;
|
|
8
|
+
}): JSX.Element;
|
|
9
|
+
/** Where a hint opens beside its control. */
|
|
10
|
+
type HintSide = "right" | "top" | "bottom";
|
|
11
|
+
interface ActionHintProps extends Omit<JSX.HTMLAttributes<HTMLElement>, "children"> {
|
|
12
|
+
/** The action the control runs: its label, shortcut and, when it can't run, why. */
|
|
13
|
+
action: ActionIdJson;
|
|
14
|
+
side: HintSide;
|
|
15
|
+
/**
|
|
16
|
+
* Renders the control with the tooltip trigger's props spread on it, as `TooltipTrigger`'s `render` does:
|
|
17
|
+
* `render={(trigger) => <ToolbarButton {...trigger} iconOnly />}`. Name the control with `aria-label` on
|
|
18
|
+
* the hint, and give it `onClick` there too: they reach the control through `trigger`, with `children` and
|
|
19
|
+
* any other attribute, the handler joined to the tooltip's own.
|
|
20
|
+
*/
|
|
21
|
+
render: (trigger: Record<string, unknown>) => JSX.Element;
|
|
22
|
+
children?: JSX.Element;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A control named by its action, with the action's shortcut on hover, and the kernel's reason when it can't
|
|
26
|
+
* run, such as "Lee Park is editing this".
|
|
27
|
+
*/
|
|
28
|
+
declare function ActionHint(props: ActionHintProps): JSX.Element;
|
|
29
|
+
/**
|
|
30
|
+
* The tools, and undo and redo. A column at the board's side, or a row along its bottom when the board is
|
|
31
|
+
* narrow, with the less used tools in a menu.
|
|
32
|
+
*/
|
|
33
|
+
declare function CanvasToolRail(props: {
|
|
34
|
+
/**
|
|
35
|
+
* A row with an overflow menu, for a board in a side panel.
|
|
36
|
+
* @defaultValue false
|
|
37
|
+
*/
|
|
38
|
+
compact?: boolean;
|
|
39
|
+
}): JSX.Element;
|
|
40
|
+
export { ActionHint, CanvasShortcut, CanvasToolRail, TOOL_ICONS };
|
|
41
|
+
export type { ActionHintProps, HintSide };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as stylex from "@stylexjs/stylex";
|
|
2
|
+
export declare const rail: Readonly<{
|
|
3
|
+
readonly floating: Readonly<{
|
|
4
|
+
readonly boxShadow: stylex.StyleXClassNameFor<"boxShadow", unknown>;
|
|
5
|
+
}>;
|
|
6
|
+
readonly shortcut: Readonly<{
|
|
7
|
+
readonly display: stylex.StyleXClassNameFor<"display", "inline-flex">;
|
|
8
|
+
readonly alignItems: stylex.StyleXClassNameFor<"alignItems", "center">;
|
|
9
|
+
readonly gap: stylex.StyleXClassNameFor<"gap", string>;
|
|
10
|
+
readonly flexShrink: stylex.StyleXClassNameFor<"flexShrink", 0>;
|
|
11
|
+
}>;
|
|
12
|
+
readonly fileInput: Readonly<{
|
|
13
|
+
readonly display: stylex.StyleXClassNameFor<"display", "none">;
|
|
14
|
+
}>;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { BoardJson, PointJson } from "../kernel/index.js";
|
|
2
|
+
/** Who wrote a comment: a person, or an agent acting on the board. */
|
|
3
|
+
type CanvasCommentAuthor = {
|
|
4
|
+
readonly principal: string;
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly kind: "person" | "agent";
|
|
7
|
+
};
|
|
8
|
+
type CanvasComment = {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly author: CanvasCommentAuthor;
|
|
11
|
+
/** Plain text, 1–2000 code units. */
|
|
12
|
+
readonly body: string;
|
|
13
|
+
/** Epoch milliseconds. */
|
|
14
|
+
readonly createdAt: number;
|
|
15
|
+
/** Epoch milliseconds of the last edit, or null when never edited. */
|
|
16
|
+
readonly editedAt: number | null;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Where a thread's pin sits. A `Shape` pin follows its shape: it sits at the
|
|
20
|
+
* shape's top-left corner plus `offset`, and at `at` once the shape is gone.
|
|
21
|
+
*/
|
|
22
|
+
type CanvasCommentAnchor = {
|
|
23
|
+
readonly _tag: "Point";
|
|
24
|
+
readonly at: PointJson;
|
|
25
|
+
} | {
|
|
26
|
+
readonly _tag: "Shape";
|
|
27
|
+
readonly shape: string;
|
|
28
|
+
readonly offset: PointJson;
|
|
29
|
+
readonly at: PointJson;
|
|
30
|
+
};
|
|
31
|
+
type CanvasCommentThread = {
|
|
32
|
+
readonly id: string;
|
|
33
|
+
readonly anchor: CanvasCommentAnchor;
|
|
34
|
+
/** The first comment starts the thread; the rest are replies, oldest first. */
|
|
35
|
+
readonly comments: readonly [CanvasComment, ...CanvasComment[]];
|
|
36
|
+
readonly resolved: {
|
|
37
|
+
readonly by: CanvasCommentAuthor;
|
|
38
|
+
readonly at: number;
|
|
39
|
+
} | null;
|
|
40
|
+
};
|
|
41
|
+
/** A change the viewer asked for. The host sends it on and updates `threads`. */
|
|
42
|
+
type CanvasCommentCommand = {
|
|
43
|
+
readonly _tag: "StartThread";
|
|
44
|
+
readonly thread: string;
|
|
45
|
+
readonly comment: string;
|
|
46
|
+
readonly anchor: CanvasCommentAnchor;
|
|
47
|
+
readonly body: string;
|
|
48
|
+
} | {
|
|
49
|
+
readonly _tag: "Reply";
|
|
50
|
+
readonly thread: string;
|
|
51
|
+
readonly comment: string;
|
|
52
|
+
readonly body: string;
|
|
53
|
+
} | {
|
|
54
|
+
readonly _tag: "EditComment";
|
|
55
|
+
readonly thread: string;
|
|
56
|
+
readonly comment: string;
|
|
57
|
+
readonly body: string;
|
|
58
|
+
} | {
|
|
59
|
+
/** Deleting a thread's first comment deletes the thread. */
|
|
60
|
+
readonly _tag: "DeleteComment";
|
|
61
|
+
readonly thread: string;
|
|
62
|
+
readonly comment: string;
|
|
63
|
+
} | {
|
|
64
|
+
readonly _tag: "SetResolved";
|
|
65
|
+
readonly thread: string;
|
|
66
|
+
readonly resolved: boolean;
|
|
67
|
+
};
|
|
68
|
+
/** Comment threads on a board, and what the viewer may do with them. */
|
|
69
|
+
type CanvasComments = {
|
|
70
|
+
readonly threads: ReadonlyArray<CanvasCommentThread>;
|
|
71
|
+
/** The viewer's principal: their own comments are theirs to edit. */
|
|
72
|
+
readonly viewer: string;
|
|
73
|
+
/**
|
|
74
|
+
* The viewer may start threads, reply, resolve and reopen: they can write
|
|
75
|
+
* to the board and the server takes comments. Without it, threads are
|
|
76
|
+
* read-only.
|
|
77
|
+
*/
|
|
78
|
+
readonly canComment: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The viewer may delete anyone's comment or thread. It implies
|
|
81
|
+
* `canComment`: set it to `canComment && <may manage the board>`.
|
|
82
|
+
*/
|
|
83
|
+
readonly canManage: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Sends a change to the host. Return the request's promise to keep a typed comment in its field until it
|
|
86
|
+
* resolves; a rejection keeps the text there, with an error, to send again.
|
|
87
|
+
*/
|
|
88
|
+
readonly onCommand: (command: CanvasCommentCommand) => unknown;
|
|
89
|
+
};
|
|
90
|
+
/** The longest comment body, in UTF-16 code units. */
|
|
91
|
+
declare const COMMENT_MAX = 2000;
|
|
92
|
+
/** A new thread or comment id, in the server's id alphabet. */
|
|
93
|
+
declare function commentId(): string;
|
|
94
|
+
/** The body to send for typed text, or null when it can't be sent. */
|
|
95
|
+
declare function commentBody(text: string): string | null;
|
|
96
|
+
/** Where a thread's pin sits on the board now. */
|
|
97
|
+
declare function pinPoint(board: BoardJson, anchor: CanvasCommentAnchor): PointJson;
|
|
98
|
+
/** The anchor for a pin dropped at `at`, on `shape` when one is under it. */
|
|
99
|
+
declare function anchorAt(board: BoardJson, at: PointJson, shape: string | null): CanvasCommentAnchor;
|
|
100
|
+
/** What the viewer may do with one comment. */
|
|
101
|
+
declare function commentPermissions(comments: Pick<CanvasComments, "canComment" | "canManage" | "viewer">, comment: CanvasComment): {
|
|
102
|
+
edit: boolean;
|
|
103
|
+
delete: boolean;
|
|
104
|
+
};
|
|
105
|
+
export { anchorAt, COMMENT_MAX, commentBody, commentId, commentPermissions, pinPoint };
|
|
106
|
+
export type { CanvasComment, CanvasCommentAnchor, CanvasCommentAuthor, CanvasCommentCommand, CanvasComments, CanvasCommentThread, };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** True when two plain objects hold the same values, key by key. */
|
|
2
|
+
export declare function shallowEqual<T extends Readonly<Record<string, unknown>>>(a: T, b: T): boolean;
|
|
3
|
+
/** True when two lists hold the same items in the same order. */
|
|
4
|
+
export declare function sameList<T>(a: readonly T[], b: readonly T[]): boolean;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { BoardJson, BoxJson, PaletteJson, SceneJson } from "../kernel/index.js";
|
|
2
|
+
import { type CanvasAssets } from "./assets.js";
|
|
3
|
+
import { type CanvasKernel } from "./kernel.js";
|
|
4
|
+
type ExportSize = {
|
|
5
|
+
/** Output pixels per board unit. */
|
|
6
|
+
readonly scale: number;
|
|
7
|
+
readonly width: number;
|
|
8
|
+
readonly height: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The output size for board bounds: twice the board's size when that fits,
|
|
12
|
+
* otherwise as large as a canvas every browser draws, keeping the aspect.
|
|
13
|
+
*/
|
|
14
|
+
declare function exportSize(bounds: {
|
|
15
|
+
readonly w: number;
|
|
16
|
+
readonly h: number;
|
|
17
|
+
}): {
|
|
18
|
+
height: number;
|
|
19
|
+
scale: number;
|
|
20
|
+
width: number;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A file name for a board's PNG: its title without characters file
|
|
24
|
+
* systems refuse, or "canvas".
|
|
25
|
+
*/
|
|
26
|
+
declare function boardFileName(title?: string | null): string;
|
|
27
|
+
/** The board's shapes as one scene, framed with a margin, or null for an empty board. */
|
|
28
|
+
declare function boardScene(canvas: CanvasKernel, board: BoardJson): SceneJson | null;
|
|
29
|
+
/** The board's pictures for an export, and the assets that could not be drawn. */
|
|
30
|
+
type ExportPictures = {
|
|
31
|
+
readonly urls: Record<string, string>;
|
|
32
|
+
readonly missing: readonly string[];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Each picture on the board as a data URL, so the SVG holds it and the
|
|
36
|
+
* canvas stays readable. A picture the host can't give, or that can't be
|
|
37
|
+
* fetched with CORS, draws as the board's "Image unavailable" tile and is
|
|
38
|
+
* named in `missing`.
|
|
39
|
+
*
|
|
40
|
+
* Every source is asked for in one turn, so a host that batches its answers
|
|
41
|
+
* sends one request, and only an answer the host never gives times out.
|
|
42
|
+
* Files are then fetched a few at a time, however long that takes.
|
|
43
|
+
*/
|
|
44
|
+
declare function pictureUrls(scene: SceneJson, assets: CanvasAssets | undefined, scale: number, placeholder: (box: BoxJson) => Promise<string>): Promise<ExportPictures>;
|
|
45
|
+
/**
|
|
46
|
+
* The kernel's SVG of a scene at an output size, with CSS added: `width` and
|
|
47
|
+
* `height` set the pixels it draws at, so no browser scales a bitmap.
|
|
48
|
+
*/
|
|
49
|
+
declare function exportSvg(canvas: CanvasKernel, scene: SceneJson, palette: PaletteJson, pictures: Readonly<Record<string, string>>, size: ExportSize, css: string): string;
|
|
50
|
+
type BoardPngOptions = {
|
|
51
|
+
/** A loaded kernel, from `useCanvasKernel` or `loadCanvasKernel`. */
|
|
52
|
+
readonly canvas: CanvasKernel;
|
|
53
|
+
/** The board to draw, such as `store.getBoard()`. */
|
|
54
|
+
readonly board: BoardJson;
|
|
55
|
+
/** The board's image storage, so pictures draw; without it they draw as placeholders. */
|
|
56
|
+
readonly assets?: CanvasAssets;
|
|
57
|
+
/** An element in the theme to draw in, such as the board; defaults to `document.body`. */
|
|
58
|
+
readonly element?: Element;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Draws every shape on a board to a PNG in the browser, in the theme
|
|
62
|
+
* `element` sits in, on that theme's background. Rejects for an empty
|
|
63
|
+
* board or when the browser can't draw it.
|
|
64
|
+
*/
|
|
65
|
+
declare function exportBoardPng(options: BoardPngOptions): Promise<Blob>;
|
|
66
|
+
/**
|
|
67
|
+
* Exports a board as `exportBoardPng` does and downloads it as
|
|
68
|
+
* `<title>.png`, or `canvas.png` without a title. Resolves with how many
|
|
69
|
+
* pictures the file shows as "Image unavailable".
|
|
70
|
+
*/
|
|
71
|
+
declare function downloadBoardPng({ title, ...options }: BoardPngOptions & {
|
|
72
|
+
readonly title?: string | null;
|
|
73
|
+
}): Promise<{
|
|
74
|
+
readonly missingPictures: number;
|
|
75
|
+
}>;
|
|
76
|
+
export { boardFileName, boardScene, downloadBoardPng, exportBoardPng, exportSize, exportSvg, pictureUrls };
|
|
77
|
+
export type { BoardPngOptions };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { PointerKindJson } from "../kernel/index.js";
|
|
2
|
+
type ScreenPoint = {
|
|
3
|
+
readonly x: number;
|
|
4
|
+
readonly y: number;
|
|
5
|
+
};
|
|
6
|
+
/** What the surface does with one pointer event. */
|
|
7
|
+
type GestureVerdict =
|
|
8
|
+
/** Send it to the editor as a pointer input. */
|
|
9
|
+
"forward"
|
|
10
|
+
/** The machine used it to pan or zoom, or dropped it as a resting palm. */
|
|
11
|
+
| "absorb";
|
|
12
|
+
type GestureHandlers = {
|
|
13
|
+
/** Pan the view by screen pixels. */
|
|
14
|
+
readonly pan: (dx: number, dy: number) => void;
|
|
15
|
+
/** Zoom by `factor` around a screen point. */
|
|
16
|
+
readonly zoom: (at: ScreenPoint, factor: number) => void;
|
|
17
|
+
/** End the editor's gesture: a second finger turned a draw into a pinch. */
|
|
18
|
+
readonly cancel: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Whether a lone finger would leave a mark with the current tool (any but Select and Hand). Once a pen
|
|
21
|
+
* has been used, such a finger pans instead, as a resting palm would; with Select it still selects.
|
|
22
|
+
*/
|
|
23
|
+
readonly marks: () => boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Sorts touch from the pen and the mouse.
|
|
27
|
+
*
|
|
28
|
+
* - A mouse and a pen always go to the editor.
|
|
29
|
+
* - One finger draws and selects, until a pen is used. From then on, with a
|
|
30
|
+
* tool that leaves marks, a finger pans and only the pen draws, so a hand
|
|
31
|
+
* resting on the screen leaves no marks; with Select and Hand a finger
|
|
32
|
+
* still selects, drags and pans.
|
|
33
|
+
* - Two fingers pan and pinch-zoom; a second finger cancels what the first
|
|
34
|
+
* one started.
|
|
35
|
+
* - While a pen is down, touches are ignored.
|
|
36
|
+
*/
|
|
37
|
+
declare function createGestureMachine(handlers: GestureHandlers): {
|
|
38
|
+
/** Pointer cancel or lost capture: forget the pointer. */
|
|
39
|
+
cancel(id: number, kind: PointerKindJson): GestureVerdict;
|
|
40
|
+
down: (id: number, kind: PointerKindJson, point: ScreenPoint) => GestureVerdict;
|
|
41
|
+
move: (id: number, kind: PointerKindJson, point: ScreenPoint) => GestureVerdict;
|
|
42
|
+
up: (id: number, kind: PointerKindJson) => GestureVerdict;
|
|
43
|
+
};
|
|
44
|
+
type GestureMachine = ReturnType<typeof createGestureMachine>;
|
|
45
|
+
export { createGestureMachine };
|
|
46
|
+
export type { GestureMachine, GestureVerdict };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calls an app's JSX event handler for an event the board also handles: Solid's handler forms are a
|
|
3
|
+
* function or a `[handler, data]` pair.
|
|
4
|
+
*/
|
|
5
|
+
export declare function call(handler: unknown, event: Event): void;
|
|
6
|
+
/** Hands an element to an app's `ref`: a function, or an array of them (a ref spread from another part). */
|
|
7
|
+
export declare function assignRef<T>(ref: unknown, element: T): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type { CanvasAssets, CanvasAssetSource, CanvasUploadFailure, CanvasUploadOptions } from "./assets.js";
|
|
2
|
+
export type { CanvasBoardStore, CanvasCommit, CanvasCommitResult, MemoryBoardStore } from "./board-store.js";
|
|
3
|
+
export { createMemoryBoardStore } from "./board-store.js";
|
|
4
|
+
export type { CanvasBoardProps } from "./canvas-board.js";
|
|
5
|
+
export { CanvasBoard } from "./canvas-board.js";
|
|
6
|
+
export type { CanvasStatusProps } from "./canvas-chrome.js";
|
|
7
|
+
export { CanvasStatus } from "./canvas-chrome.js";
|
|
8
|
+
export type { CanvasCommands, CanvasKernelState, CanvasProviderProps } from "./canvas-context.js";
|
|
9
|
+
export { CanvasProvider, useCanvas, useCanvasCommands, useCanvasKernel } from "./canvas-context.js";
|
|
10
|
+
export type { CanvasBoardError, CanvasPlace, CanvasSnapshot } from "./canvas-controller.js";
|
|
11
|
+
export type { CanvasSurfaceProps } from "./canvas-surface.js";
|
|
12
|
+
export { CanvasSurface } from "./canvas-surface.js";
|
|
13
|
+
export type { CanvasComment, CanvasCommentAnchor, CanvasCommentAuthor, CanvasCommentCommand, CanvasComments, CanvasCommentThread, } from "./comments.js";
|
|
14
|
+
export type { BoardPngOptions } from "./export-png.js";
|
|
15
|
+
export { boardFileName, downloadBoardPng, exportBoardPng } from "./export-png.js";
|
|
16
|
+
export type { CanvasKernel } from "./kernel.js";
|
|
17
|
+
export { loadCanvasKernel } from "./kernel.js";
|
|
18
|
+
export { resolvePalette } from "./palette.js";
|