@yaks/canvas 0.0.0-stage → 0.2.36

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/search.js ADDED
@@ -0,0 +1,23 @@
1
+ // A search link dropped on a canvas becomes a live board there. The link
2
+ // itself carries no board spec: outside the canvas it remains an ordinary URL.
3
+ import { queryAt } from "@yaks/query";
4
+ export let searchBoard = (raw, origin)=>{
5
+ let url;
6
+ try {
7
+ url = new URL(raw);
8
+ } catch {
9
+ return null;
10
+ }
11
+ if (url.origin != origin || url.pathname != '/') return null;
12
+ let query = queryAt(url.search).query?.trim();
13
+ return query ? {
14
+ doc: {
15
+ title: query,
16
+ body: ''
17
+ },
18
+ board: {
19
+ query
20
+ }
21
+ } : null;
22
+ };
23
+ //# sourceMappingURL=search.js.map
package/search.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.js","sources":["./search.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,+EAA+E;AAC/E,SAAS,OAAO,2BAAgC;AAEhD,OAAO,IAAI,cAAc,CAAC,KAAa;EAIrC,IAAI;EACJ,IAAI;IACF,MAAM,IAAI,IAAI;EAChB,EAAE,OAAM;IACN,OAAO;EACT;EACA,IAAI,IAAI,MAAM,IAAI,UAAU,IAAI,QAAQ,IAAI,KAAK,OAAO;EACxD,IAAI,QAAQ,QAAQ,IAAI,MAAM,EAAE,KAAK,EAAE;EACvC,OAAO,QAAQ;IAAE,KAAK;MAAE,OAAO;MAAO,MAAM;IAAG;IAAG,OAAO;MAAE;IAAM;EAAE,IAAI;AACzE,EAAC"}
package/search.ts ADDED
@@ -0,0 +1,18 @@
1
+ // A search link dropped on a canvas becomes a live board there. The link
2
+ // itself carries no board spec: outside the canvas it remains an ordinary URL.
3
+ import { queryAt } from '@yaks/query'
4
+
5
+ export let searchBoard = (raw: string, origin: string): {
6
+ doc: { title: string; body: string }
7
+ board: { query: string }
8
+ } | null => {
9
+ let url: URL
10
+ try {
11
+ url = new URL(raw)
12
+ } catch {
13
+ return null
14
+ }
15
+ if (url.origin != origin || url.pathname != '/') return null
16
+ let query = queryAt(url.search).query?.trim()
17
+ return query ? { doc: { title: query, body: '' }, board: { query } } : null
18
+ }
package/view.js ADDED
@@ -0,0 +1,65 @@
1
+ // The camera: what a window can see, and where to point it.
2
+ //
3
+ // A camera is a centre, a scale, and the size of the window looking through
4
+ // it. Centre rather than corner, because that is the point every gesture
5
+ // preserves — zooming keeps the middle still, and a window that changes size
6
+ // keeps showing the same thing.
7
+ //
8
+ // So the whole of "what is on screen" is one rectangle, `world()`, and every
9
+ // other question here is asked of it.
10
+ import { bounds, overlaps, rect } from "./geom.js";
11
+ /** How far out a camera may pull back. */ export let ZOOM_MIN = 0.1;
12
+ /** How far in a camera may push. */ export let ZOOM_MAX = 4;
13
+ /** A zoom held inside the range every camera move shares, so a pinch and a
14
+ * fit-to-content cannot disagree about how far is too far. */ export let zoomed = (z)=>Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, z));
15
+ /**
16
+ * The part of the plane a camera can see, in canvas units. Zooming in shows
17
+ * less of the plane, so the window's pixel size is divided by the scale.
18
+ */ export let world = (cam)=>({
19
+ x: cam.x - cam.w / 2 / cam.zoom,
20
+ y: cam.y - cam.h / 2 / cam.zoom,
21
+ w: cam.w / cam.zoom,
22
+ h: cam.h / cam.zoom
23
+ });
24
+ /**
25
+ * The pins on screen — everything overlapping what the camera sees, in the
26
+ * order given. This is the one question a renderer asks every frame, so it is
27
+ * a filter over plain objects and nothing more.
28
+ */ export let visible = (cam, pins)=>{
29
+ let seen = world(cam);
30
+ return pins.filter((p)=>overlaps(seen, rect(p)));
31
+ };
32
+ /**
33
+ * The camera that frames everything: centred on the pins, pulled back until
34
+ * they fit, with `fill` of the window given over to them (the rest is the
35
+ * breathing room around the edge). Nothing pinned frames the origin at 1:1 —
36
+ * an empty wall looks the same from anywhere.
37
+ *
38
+ * The zoom is set by whichever axes the content actually spans: cards with no
39
+ * measured size still spread the bounds apart, and that spread is what gets
40
+ * fitted. Content with no extent at all — one unmeasured card, or several
41
+ * stacked on the same spot — constrains nothing, and frames at 1:1.
42
+ */ export let frame = (pins, size, fill = 0.9)=>{
43
+ let b = bounds(pins);
44
+ if (!b) return {
45
+ x: 0,
46
+ y: 0,
47
+ zoom: 1,
48
+ ...size
49
+ };
50
+ let fits = [
51
+ ...b.w > 0 ? [
52
+ size.w / b.w
53
+ ] : [],
54
+ ...b.h > 0 ? [
55
+ size.h / b.h
56
+ ] : []
57
+ ];
58
+ return {
59
+ x: b.x + b.w / 2,
60
+ y: b.y + b.h / 2,
61
+ zoom: fits.length ? zoomed(Math.min(...fits) * fill) : 1,
62
+ ...size
63
+ };
64
+ };
65
+ //# sourceMappingURL=view.js.map
package/view.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.js","sources":["./view.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,EAAE;AACF,4EAA4E;AAC5E,yEAAyE;AACzE,6EAA6E;AAC7E,gCAAgC;AAChC,EAAE;AACF,6EAA6E;AAC7E,sCAAsC;AAGtC,SAAS,MAAM,EAAE,QAAQ,EAAa,IAAI,oBAA8B;AAExE,wCAAwC,GACxC,OAAO,IAAI,WAAW,IAAG;AAEzB,kCAAkC,GAClC,OAAO,IAAI,WAAW,EAAC;AAEvB;4DAC4D,GAC5D,OAAO,IAAI,SAAS,CAAC,IACnB,KAAK,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,UAAU,IAAG;AAE3C;;;CAGC,GACD,OAAO,IAAI,QAAQ,CAAC,MAAsB,CAAC;IACzC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,IAAI;IAC/B,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,IAAI;IAC/B,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI;IACnB,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI;EACrB,CAAC,EAAC;AAEF;;;;CAIC,GACD,OAAO,IAAI,UAAU,CAAgB,KAAa;EAChD,IAAI,OAAO,MAAM;EACjB,OAAO,KAAK,MAAM,CAAC,CAAC,IAAM,SAAS,MAAM,KAAK;AAChD,EAAC;AAED;;;;;;;;;;CAUC,GACD,OAAO,IAAI,QAAQ,CAAC,MAAa,MAAY,OAAO,GAAG;EACrD,IAAI,IAAI,OAAO;EACf,IAAI,CAAC,GAAG,OAAO;IAAE,GAAG;IAAG,GAAG;IAAG,MAAM;IAAG,GAAG,IAAI;EAAC;EAC9C,IAAI,OAAO;OACL,EAAE,CAAC,GAAG,IAAI;MAAC,KAAK,CAAC,GAAG,EAAE,CAAC;KAAC,GAAG,EAAE;OAC7B,EAAE,CAAC,GAAG,IAAI;MAAC,KAAK,CAAC,GAAG,EAAE,CAAC;KAAC,GAAG,EAAE;GAClC;EACD,OAAO;IACL,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG;IACf,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG;IACf,MAAM,KAAK,MAAM,GAAG,OAAO,KAAK,GAAG,IAAI,QAAQ,QAAQ;IACvD,GAAG,IAAI;EACT;AACF,EAAC"}
package/view.ts ADDED
@@ -0,0 +1,70 @@
1
+ // The camera: what a window can see, and where to point it.
2
+ //
3
+ // A camera is a centre, a scale, and the size of the window looking through
4
+ // it. Centre rather than corner, because that is the point every gesture
5
+ // preserves — zooming keeps the middle still, and a window that changes size
6
+ // keeps showing the same thing.
7
+ //
8
+ // So the whole of "what is on screen" is one rectangle, `world()`, and every
9
+ // other question here is asked of it.
10
+
11
+ import type { Camera, Pin } from './comp.ts'
12
+ import { bounds, overlaps, type Rect, rect, type Size } from './geom.js'
13
+
14
+ /** How far out a camera may pull back. */
15
+ export let ZOOM_MIN = 0.1
16
+
17
+ /** How far in a camera may push. */
18
+ export let ZOOM_MAX = 4
19
+
20
+ /** A zoom held inside the range every camera move shares, so a pinch and a
21
+ * fit-to-content cannot disagree about how far is too far. */
22
+ export let zoomed = (z: number): number =>
23
+ Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, z))
24
+
25
+ /**
26
+ * The part of the plane a camera can see, in canvas units. Zooming in shows
27
+ * less of the plane, so the window's pixel size is divided by the scale.
28
+ */
29
+ export let world = (cam: Camera): Rect => ({
30
+ x: cam.x - cam.w / 2 / cam.zoom,
31
+ y: cam.y - cam.h / 2 / cam.zoom,
32
+ w: cam.w / cam.zoom,
33
+ h: cam.h / cam.zoom,
34
+ })
35
+
36
+ /**
37
+ * The pins on screen — everything overlapping what the camera sees, in the
38
+ * order given. This is the one question a renderer asks every frame, so it is
39
+ * a filter over plain objects and nothing more.
40
+ */
41
+ export let visible = <T extends Pin>(cam: Camera, pins: T[]): T[] => {
42
+ let seen = world(cam)
43
+ return pins.filter((p) => overlaps(seen, rect(p)))
44
+ }
45
+
46
+ /**
47
+ * The camera that frames everything: centred on the pins, pulled back until
48
+ * they fit, with `fill` of the window given over to them (the rest is the
49
+ * breathing room around the edge). Nothing pinned frames the origin at 1:1 —
50
+ * an empty wall looks the same from anywhere.
51
+ *
52
+ * The zoom is set by whichever axes the content actually spans: cards with no
53
+ * measured size still spread the bounds apart, and that spread is what gets
54
+ * fitted. Content with no extent at all — one unmeasured card, or several
55
+ * stacked on the same spot — constrains nothing, and frames at 1:1.
56
+ */
57
+ export let frame = (pins: Pin[], size: Size, fill = 0.9): Camera => {
58
+ let b = bounds(pins)
59
+ if (!b) return { x: 0, y: 0, zoom: 1, ...size }
60
+ let fits = [
61
+ ...(b.w > 0 ? [size.w / b.w] : []),
62
+ ...(b.h > 0 ? [size.h / b.h] : []),
63
+ ]
64
+ return {
65
+ x: b.x + b.w / 2,
66
+ y: b.y + b.h / 2,
67
+ zoom: fits.length ? zoomed(Math.min(...fits) * fill) : 1,
68
+ ...size,
69
+ }
70
+ }
package/vocab.js ADDED
@@ -0,0 +1,14 @@
1
+ // The component declarations, and nothing else: the module a server or a
2
+ // browser page imports at `@yaks/canvas/vocab`. It reaches no storage, no SQL
3
+ // and no runtime, so a browser tab loading this vocabulary loads nothing else.
4
+ import { canvasDoc } from "./comp.js";
5
+ import manifest from './package.json' with {
6
+ type: 'json'
7
+ };
8
+ export { canvasDoc };
9
+ /** What this package is: its manifest's description, the one place it is
10
+ * written, which a host stamps on each document here. */ export let description = manifest.description;
11
+ /** Every document this plugin declares. */ export let docs = [
12
+ canvasDoc
13
+ ];
14
+ //# sourceMappingURL=vocab.js.map
package/vocab.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vocab.js","sources":["./vocab.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,8EAA8E;AAC9E,+EAA+E;AAG/E,SAAS,SAAS,oBAAmB;AACrC,OAAO,cAAc,sBAAsB;EAAE,MAAM;AAAO,EAAC;AAE3D,SAAS,SAAS,GAAE;AAEpB;uDACuD,GACvD,OAAO,IAAI,cAAsB,SAAS,WAAW,CAAA;AAErD,yCAAyC,GACzC,OAAO,IAAI,OAAmB;EAAC;CAAU,CAAA"}
package/vocab.json ADDED
@@ -0,0 +1,394 @@
1
+ {
2
+ "$id": "urn:uuid:35c70371-3101-4bfb-8ffb-5995f14c1092",
3
+ "$vocabulary": {
4
+ "https://yak.sh/vocab/core": true,
5
+ "https://yak.sh/vocab/id": true,
6
+ "https://yak.sh/vocab/names": true
7
+ },
8
+ "title": "canvas",
9
+ "$defs": {
10
+ "camera": {
11
+ "$id": "urn:uuid:2832c8bc-1c70-40c3-8e47-5ad790e64f04",
12
+ "component": true,
13
+ "journal": false,
14
+ "type": "object",
15
+ "unique": [
16
+ [
17
+ "client",
18
+ "canvas"
19
+ ]
20
+ ],
21
+ "sync": "server",
22
+ "description": "where one window is looking at one canvas — synced to the server so another tab, or a tool, can read it and move it",
23
+ "properties": {
24
+ "client": {
25
+ "$id": "urn:uuid:08a85bd6-6418-4a70-8e6e-47f78c2de85b",
26
+ "type": "string",
27
+ "ref": "client",
28
+ "death": "cascade",
29
+ "description": "the window doing the looking"
30
+ },
31
+ "canvas": {
32
+ "$id": "urn:uuid:f19528f7-dbf6-45af-90a8-950a8d4ca6bc",
33
+ "type": "string",
34
+ "ref": "entity",
35
+ "death": "cascade",
36
+ "description": "the canvas it is looking at"
37
+ },
38
+ "x": {
39
+ "$id": "urn:uuid:a3819ce9-f5b3-418c-bb0a-6b00bbce0855",
40
+ "type": "number",
41
+ "description": "viewport centre, in canvas units"
42
+ },
43
+ "y": {
44
+ "$id": "urn:uuid:59bc9e3b-ecba-4597-923c-4a3edee0890d",
45
+ "type": "number",
46
+ "description": "viewport centre, in canvas units"
47
+ },
48
+ "zoom": {
49
+ "$id": "urn:uuid:82c1d33d-43a0-42f1-8b14-aa0c02319c65",
50
+ "type": "number",
51
+ "description": "scale — 2 draws everything twice as large"
52
+ },
53
+ "w": {
54
+ "$id": "urn:uuid:6659bfd3-4bd4-4323-859d-41bb9317781d",
55
+ "type": "number",
56
+ "description": "viewport width, in pixels"
57
+ },
58
+ "h": {
59
+ "$id": "urn:uuid:51e40a03-a8e4-4ac1-8598-a60114d0d7ac",
60
+ "type": "number",
61
+ "description": "viewport height, in pixels"
62
+ }
63
+ }
64
+ },
65
+ "canvas": {
66
+ "$id": "urn:uuid:aeb5a601-1227-4cf0-96fc-89b8441a700e",
67
+ "component": true,
68
+ "type": "object",
69
+ "by_name": true,
70
+ "sync": "server",
71
+ "description": "a plane things are arranged on",
72
+ "properties": {}
73
+ },
74
+ "card": {
75
+ "$id": "urn:uuid:96b001be-18d6-476b-8685-86e55cb58d5a",
76
+ "component": true,
77
+ "type": "object",
78
+ "sync": "server",
79
+ "description": "one entity shown on a canvas",
80
+ "properties": {
81
+ "target": {
82
+ "$id": "urn:uuid:57cc8830-7cf9-4904-8b44-f727b46b5a88",
83
+ "type": "string",
84
+ "ref": "entity",
85
+ "death": "cascade",
86
+ "description": "the entity shown — the card is deleted with it, because a card showing nothing is nothing"
87
+ },
88
+ "view": {
89
+ "$id": "urn:uuid:ee075b8c-1fae-4bbc-9690-001a3295e813",
90
+ "type": "string",
91
+ "description": "the view it is rendered in"
92
+ }
93
+ }
94
+ },
95
+ "client": {
96
+ "$id": "urn:uuid:557b0c46-5ab1-4386-adb9-f6baee1585b8",
97
+ "component": true,
98
+ "journal": false,
99
+ "type": "object",
100
+ "sync": "server",
101
+ "description": "one open window — what a camera, a cursor, a fold and a shelf each belong to",
102
+ "properties": {
103
+ "user_agent": {
104
+ "$id": "urn:uuid:ebda9795-3980-4797-9738-3554880dec1a",
105
+ "type": "string",
106
+ "description": "the user-agent string the window reported"
107
+ },
108
+ "actor": {
109
+ "$id": "urn:uuid:33bd1149-d72f-4105-b841-40e7a09169af",
110
+ "type": "string",
111
+ "ref": "entity",
112
+ "death": "detach",
113
+ "description": "who is at the window — the property is cleared, not the row deleted, when they are gone"
114
+ },
115
+ "ip": {
116
+ "$id": "urn:uuid:2f149ae1-2865-4590-90e0-3bbfbcc281d6",
117
+ "type": "string",
118
+ "stamped": true,
119
+ "description": "the address it connected from — written by the server"
120
+ }
121
+ }
122
+ },
123
+ "cursor": {
124
+ "$id": "urn:uuid:0dd8cb45-2b52-4661-ba43-7c2142602897",
125
+ "component": true,
126
+ "journal": false,
127
+ "type": "object",
128
+ "unique": [
129
+ [
130
+ "client"
131
+ ]
132
+ ],
133
+ "sync": "server",
134
+ "description": "what one window has open — synced to the server, so a tool can move someone there by writing it",
135
+ "properties": {
136
+ "client": {
137
+ "$id": "urn:uuid:1c4d9dd8-a0a6-4ff5-982f-83dc3c6345a5",
138
+ "type": "string",
139
+ "ref": "client",
140
+ "death": "cascade",
141
+ "description": "the window"
142
+ },
143
+ "target": {
144
+ "$id": "urn:uuid:ee6b746b-2286-4b54-96f0-0890196adc24",
145
+ "type": "string",
146
+ "ref": "entity",
147
+ "death": "keep",
148
+ "description": "the entity it is showing — kept when that entity is deleted, so the history still makes sense"
149
+ },
150
+ "view": {
151
+ "$id": "urn:uuid:2dc520c2-a61e-42b3-a7f6-f2bfd2bfdc9c",
152
+ "type": "string",
153
+ "description": "the view it is showing it in"
154
+ }
155
+ }
156
+ },
157
+ "fold": {
158
+ "$id": "urn:uuid:5d90cfbe-da63-45dc-96a7-794f5df15ba4",
159
+ "component": true,
160
+ "journal": false,
161
+ "type": "object",
162
+ "unique": [
163
+ [
164
+ "client",
165
+ "board"
166
+ ]
167
+ ],
168
+ "sync": "server",
169
+ "description": "the sections of a list one window has collapsed",
170
+ "properties": {
171
+ "client": {
172
+ "$id": "urn:uuid:bfec5731-e1ce-44dc-89ad-bc9d4a59440b",
173
+ "type": "string",
174
+ "ref": "client",
175
+ "death": "cascade",
176
+ "description": "the window"
177
+ },
178
+ "board": {
179
+ "$id": "urn:uuid:a2526a02-91b6-4358-9933-fd653ea0450b",
180
+ "type": "string",
181
+ "ref": "board",
182
+ "death": "cascade",
183
+ "description": "the list whose sections are collapsed — a `board` in your own vocabulary"
184
+ },
185
+ "statuses": {
186
+ "$id": "urn:uuid:7bd6b538-1de6-484d-bfc2-228384fba3c3",
187
+ "type": "string",
188
+ "description": "which sections are collapsed"
189
+ }
190
+ }
191
+ },
192
+ "layout": {
193
+ "$id": "urn:uuid:f894d9ba-8700-4ec7-a3bb-8ec46f77f8ce",
194
+ "component": true,
195
+ "type": "object",
196
+ "by_name": true,
197
+ "sync": "server",
198
+ "description": "a named split of the screen into panes",
199
+ "properties": {
200
+ "root": {
201
+ "$id": "urn:uuid:c91c8db3-1254-457b-82c5-78aac9500c42",
202
+ "type": "string",
203
+ "ref": "pane",
204
+ "death": "detach",
205
+ "description": "the pane every other pane sits inside"
206
+ }
207
+ }
208
+ },
209
+ "pane": {
210
+ "$id": "urn:uuid:bfc1a894-1b38-4fc3-bfe5-074a72d7a815",
211
+ "component": true,
212
+ "type": "object",
213
+ "sync": "server",
214
+ "description": "one region of a layout: either a split, or a region showing an entity",
215
+ "properties": {
216
+ "layout": {
217
+ "$id": "urn:uuid:8f2e141c-a1e8-4fdf-b32d-efdea7892a1e",
218
+ "type": "string",
219
+ "ref": "layout",
220
+ "death": "cascade",
221
+ "description": "the layout it belongs to"
222
+ },
223
+ "parent": {
224
+ "$id": "urn:uuid:e1461e8c-6604-4fb2-9704-1fff0efaaec3",
225
+ "type": "string",
226
+ "ref": "pane",
227
+ "death": "cascade",
228
+ "description": "the pane it sits inside"
229
+ },
230
+ "size": {
231
+ "$id": "urn:uuid:43933bdf-54a9-4ce8-89b9-618451017439",
232
+ "type": "number",
233
+ "description": "its share of the parent"
234
+ },
235
+ "order": {
236
+ "$id": "urn:uuid:83f4afa1-fde2-4aad-8bb8-7dcc3f64494b",
237
+ "type": "number",
238
+ "description": "its place among its siblings"
239
+ },
240
+ "dir": {
241
+ "$id": "urn:uuid:ceb15bfd-7d2a-4ce3-9b11-a1cbbd44a3b5",
242
+ "type": "string",
243
+ "enum": [
244
+ "h",
245
+ "v"
246
+ ],
247
+ "description": "how it splits: side by side, or stacked"
248
+ },
249
+ "content": {
250
+ "$id": "urn:uuid:25d4cbd4-7975-431b-8813-d1c35da736d5",
251
+ "type": "string",
252
+ "ref": "entity",
253
+ "death": "detach",
254
+ "description": "the entity shown in it, if it shows one"
255
+ },
256
+ "view": {
257
+ "$id": "urn:uuid:66ea451d-38d4-42b6-b6be-25aa1446ba9d",
258
+ "type": "string",
259
+ "description": "the view that entity is shown in"
260
+ }
261
+ }
262
+ },
263
+ "pin": {
264
+ "$id": "urn:uuid:fe4c99d3-8a42-4515-85a9-0b65f6a80164",
265
+ "component": true,
266
+ "type": "object",
267
+ "sync": "server",
268
+ "description": "where a card sits on a canvas",
269
+ "properties": {
270
+ "canvas": {
271
+ "$id": "urn:uuid:112a3d8b-4ebd-4db0-be50-d0cb26265467",
272
+ "type": "string",
273
+ "ref": "entity",
274
+ "death": "cascade",
275
+ "description": "the canvas it is pinned to"
276
+ },
277
+ "x": {
278
+ "$id": "urn:uuid:60eec654-7e11-4fe1-a860-9eaaaa1cfe8b",
279
+ "type": "number",
280
+ "description": "left edge, in canvas units"
281
+ },
282
+ "y": {
283
+ "$id": "urn:uuid:d979b53f-3cab-485d-8265-a9a0d99aa357",
284
+ "type": "number",
285
+ "description": "top edge, in canvas units"
286
+ },
287
+ "w": {
288
+ "$id": "urn:uuid:1d47e304-7ccd-41d1-9f04-5ad2d4c0dbba",
289
+ "type": "number",
290
+ "description": "width, or 0 for automatic"
291
+ },
292
+ "h": {
293
+ "$id": "urn:uuid:0196d042-923e-4f2e-b306-a607aaecf728",
294
+ "type": "number",
295
+ "description": "height, or 0 for automatic"
296
+ },
297
+ "z": {
298
+ "$id": "urn:uuid:48e031ab-2a80-47e8-9d26-c547f8dbe53d",
299
+ "type": "number",
300
+ "description": "stacking order — higher is front"
301
+ }
302
+ }
303
+ },
304
+ "shelf": {
305
+ "$id": "urn:uuid:cdc13d11-af29-4193-89be-b5e25d2b8723",
306
+ "component": true,
307
+ "journal": false,
308
+ "type": "object",
309
+ "unique": [
310
+ [
311
+ "client"
312
+ ]
313
+ ],
314
+ "sync": "server",
315
+ "description": "what one window is holding aside, off the canvas",
316
+ "properties": {
317
+ "client": {
318
+ "$id": "urn:uuid:e1f48694-ce5d-4a20-bed9-a86b2d03fadc",
319
+ "type": "string",
320
+ "ref": "client",
321
+ "death": "release",
322
+ "description": "the window holding it — when the window goes the shelf empties, and the entities on it remain"
323
+ }
324
+ }
325
+ }
326
+ },
327
+ "kinds": {
328
+ "camera": {
329
+ "$id": "urn:uuid:2832c8bc-1c70-40c3-8e47-5ad790e64f04",
330
+ "description": "where one window is looking at one canvas — synced to the server so another tab, or a tool, can read it and move it"
331
+ },
332
+ "canvas": {
333
+ "$id": "urn:uuid:aeb5a601-1227-4cf0-96fc-89b8441a700e",
334
+ "description": "a plane things are arranged on",
335
+ "examples": [
336
+ {
337
+ "canvas": {}
338
+ }
339
+ ]
340
+ },
341
+ "card": {
342
+ "$id": "urn:uuid:96b001be-18d6-476b-8685-86e55cb58d5a",
343
+ "description": "one entity shown on a canvas",
344
+ "examples": [
345
+ {
346
+ "card": {
347
+ "target": "7c1e1f0a-3b5d-4c2e-9a41-2f6d8b0e5a13"
348
+ }
349
+ }
350
+ ]
351
+ },
352
+ "client": {
353
+ "$id": "urn:uuid:557b0c46-5ab1-4386-adb9-f6baee1585b8",
354
+ "description": "one open window — what a camera, a cursor, a fold and a shelf each belong to"
355
+ },
356
+ "cursor": {
357
+ "$id": "urn:uuid:0dd8cb45-2b52-4661-ba43-7c2142602897",
358
+ "description": "what one window has open — synced to the server, so a tool can move someone there by writing it"
359
+ },
360
+ "fold": {
361
+ "$id": "urn:uuid:5d90cfbe-da63-45dc-96a7-794f5df15ba4",
362
+ "description": "the sections of a list one window has collapsed"
363
+ },
364
+ "layout": {
365
+ "$id": "urn:uuid:f894d9ba-8700-4ec7-a3bb-8ec46f77f8ce",
366
+ "description": "a named split of the screen into panes",
367
+ "with": {
368
+ "doc": true
369
+ },
370
+ "prefix": "L",
371
+ "examples": [
372
+ {
373
+ "layout": {},
374
+ "doc": {
375
+ "title": "Two columns"
376
+ }
377
+ }
378
+ ]
379
+ },
380
+ "pane": {
381
+ "$id": "urn:uuid:bfc1a894-1b38-4fc3-bfe5-074a72d7a815",
382
+ "description": "one region of a layout: either a split, or a region showing an entity",
383
+ "examples": [
384
+ {
385
+ "pane": {
386
+ "dir": "h",
387
+ "size": 0.5,
388
+ "order": 0
389
+ }
390
+ }
391
+ ]
392
+ }
393
+ }
394
+ }
package/vocab.ts ADDED
@@ -0,0 +1,16 @@
1
+ // The component declarations, and nothing else: the module a server or a
2
+ // browser page imports at `@yaks/canvas/vocab`. It reaches no storage, no SQL
3
+ // and no runtime, so a browser tab loading this vocabulary loads nothing else.
4
+
5
+ import type { VocabDoc } from 'jsr:@yaks/vocab@0.2.36'
6
+ import { canvasDoc } from './comp.js'
7
+ import manifest from './package.json' with { type: 'json' }
8
+
9
+ export { canvasDoc }
10
+
11
+ /** What this package is: its manifest's description, the one place it is
12
+ * written, which a host stamps on each document here. */
13
+ export let description: string = manifest.description
14
+
15
+ /** Every document this plugin declares. */
16
+ export let docs: VocabDoc[] = [canvasDoc]